Merge remote branch 'origin/platal-1.0.0'
authorStéphane Jacob <sj@m4x.org>
Sun, 4 Jul 2010 17:10:45 +0000 (19:10 +0200)
committerStéphane Jacob <sj@m4x.org>
Sun, 4 Jul 2010 17:10:45 +0000 (19:10 +0200)
15 files changed:
ChangeLog
classes/profile.php
core
include/profilefields.inc.php
include/validations.inc.php
include/validations/entreprises.inc.php
include/validations/names.inc.php
modules/profile.php
modules/profile/jobs.inc.php
templates/include/form.valid.edit-entreprises.tpl
templates/include/form.valid.entreprises.tpl
templates/profile/profile.tpl
upgrade/1.0.1/00_job.sql [new file with mode: 0644]
upgrade/1.0.1/connect.db.inc.php [new symlink]
upgrade/1.0.1/phone.php [new file with mode: 0755]

index eeeefd6..d705816 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
 ================================================================================
+VERSION 1.0.1                                                         XX XX XXXX
+
+
+================================================================================
 VERSION 1.0.0                                                         30 06 2010
 
 New:
index ee23cab..fe929c1 100644 (file)
@@ -841,8 +841,8 @@ class Profile
 
         $it = XDB::Iterator('SELECT  p.pid, p.hrpid, p.xorg_id, p.ax_id, p.birthdate, p.birthdate_ref,
                                      p.next_birthday, p.deathdate, p.deathdate_rec, p.sex = \'female\' AS sex,
-                                     p.cv, p.medals_pub, p.alias_pub, p.email_directory, p.last_change,
-                                     p.nationality1, p.nationality2, p.nationality3,
+                                     IF ({?}, p.cv, NULL) AS cv, p.medals_pub, p.alias_pub, p.email_directory,
+                                     p.last_change, p.nationality1, p.nationality2, p.nationality3,
                                      IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
                                      pe.entry_year, pe.grad_year,
                                      IF ({?}, pse.text, NULL) AS section,
@@ -878,11 +878,12 @@ class Profile
                               WHERE  p.pid IN {?}
                            GROUP BY  p.pid
                                      ' . $order,
-                           $visibility->levels(),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE),
-                           $visibility->levels(),
-                           $visibility->levels(),
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // CV
+                           $visibility->levels(), // freetext
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // section
+                           $visibility->isVisible(ProfileVisibility::VIS_PRIVATE), // nickname
+                           $visibility->levels(), // mobile
+                           $visibility->levels(), // photo
                            $pids
                        );
         return new ProfileIterator($it, $pids, $fields, $visibility);
diff --git a/core b/core
index 786bffb..92d96cb 160000 (submodule)
--- a/core
+++ b/core
@@ -1 +1 @@
-Subproject commit 786bffb570bfc2f5ff1dad386a9558501d4c16e8
+Subproject commit 92d96cb7270caff156df7785b800a7a3084e8a16
index 83f3fb0..9fe2552 100644 (file)
@@ -281,6 +281,11 @@ class Job
             $this->$key = $val;
         }
         $this->company = CompanyList::get($this->jobid);
+        if (is_null($this->company)) {
+            require_once 'validations.inc.php';
+            $entreprise = ProfileValidate::get_typed_requests($this->pid, 'entreprise');
+            $this->company = new Company(array('name' =>  $entreprise[$this->id]->name));
+        }
     }
 
     public function phones()
index dcc4b63..c3af12e 100644 (file)
@@ -622,11 +622,7 @@ abstract class ProfileValidate extends Validate
 
     public function id()
     {
-        if (!is_null($this->profile)) {
-            return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
-        } else {
-            return $this->user->id() . '_' . $this->type . '_' . $this->stamp;
-        }
+        return $this->profile->id() . '_' . $this->type . '_' . $this->stamp;
     }
 
     // }}}
index cff4801..47e6a02 100644 (file)
@@ -68,12 +68,14 @@ class EntrReq extends ProfileValidate
                 $where .= "name LIKE '%" . $name_array[$i] . "%'";
             }
         }
-        $res = XDB::iterator('SELECT  name
-                                FROM  profile_job_enum
-                               WHERE  ' . $where);
-        $this->suggestions = "| ";
-        while ($sug = $res->next()) {
-            $this->suggestions .= $sug['name'] . " | ";
+        if ($where != '') {
+            $res = XDB::iterator('SELECT  name
+                                    FROM  profile_job_enum
+                                   WHERE  ' . $where);
+            $this->suggestions = "| ";
+            while ($sug = $res->next()) {
+                $this->suggestions .= $sug['name'] . " | ";
+            }
         }
     }
 
@@ -98,26 +100,37 @@ class EntrReq extends ProfileValidate
 
     protected function handle_editor()
     {
-        if (Env::has('holdingid')) {
-            $this->holdingid = Env::t('holdingid');
-        }
         if (Env::has('name')) {
             $this->name = Env::t('name');
-            if (Env::has('acronym')) {
-                $this->acronym = Env::t('acronym');
-                if (Env::has('url')) {
-                    $this->url = Env::t('url');
-                    if (Env::has('NAF_code')) {
-                        $this->NAF_code = Env::t('NAF_code');
-                        if (Env::has('AX_code')) {
-                            $this->AX_code = Env::t('AX_code');
-                            return true;
-                        }
-                    }
-                }
-            }
         }
-        return false;
+        if (Env::has('acronym')) {
+            $this->acronym = Env::t('acronym');
+        }
+        if (Env::has('url')) {
+            $this->url = Env::t('url');
+        }
+        if (Env::has('email')) {
+            $this->email = Env::t('email');
+        }
+        if (Env::has('holdingid')) {
+            $this->holdingid = Env::i('holdingid');
+        }
+        if (Env::has('NAF_code')) {
+            $this->NAF_code = Env::t('NAF_code');
+        }
+        if (Env::has('AX_code')) {
+            $this->AX_code = Env::i('AX_code');
+        }
+        if (Env::has('address')) {
+            $this->address['text'] = Env::t('address');
+        }
+        if (Env::has('tel')) {
+            $this->tel = Env::t('tel');
+        }
+        if (Env::has('fax')) {
+            $this->fax = Env::t('fax');
+        }
+        return true;
     }
 
     // }}}
index 08fd85b..712f4e1 100644 (file)
@@ -19,7 +19,7 @@
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-// {{{ class NamesReq4
+// {{{ class NamesReq
 
 class NamesReq extends ProfileValidate
 {
index 20305e3..473db30 100644 (file)
@@ -259,6 +259,11 @@ class ProfileModule extends PLModule
             $view = 'private';
         }
 
+        // Display pending picture
+        if (S::logged() && Env::v('modif') == 'new') {
+            $page->assign('with_pending_pic', true);
+        }
+
         // Fetches profile's and profile's owner information and redirects to
         // marketing if the owner has not subscribed and the requirer has logged in.
         $profile = Profile::get($pid, Profile::FETCH_ALL, $view);
index f698485..1fa65fc 100644 (file)
@@ -162,6 +162,7 @@ class ProfileSettingJob extends ProfileSettingGeocoding
                                    $job['hq_email'], $job['hq_fixed'], $job['hq_fax'], $job['hq_address']);
                 $req->submit();
                 $job['jobid'] = null;
+                sleep(1);
             } else {
                 $job['jobid'] = $res->fetchOneCell();
             }
index 1fce6e7..7b59719 100644 (file)
@@ -27,7 +27,7 @@
 <strong>Site web&nbsp;:</strong>
 <input type="text" name="url" size="25" maxlength="200" value="{$valid->url}" /><br />
 <strong>Email&nbsp;:</strong>
-<input type="text" name="url" size="25" maxlength="200" value="{$valid->email}" /><br />
+<input type="text" name="email" size="25" maxlength="200" value="{$valid->email}" /><br />
 <strong>Holding&nbsp;:</strong>
 <input type="text" name="holdingid" size="25" maxlength="200" value="{$valid->holdingid}" /><br />
 <strong>Code NAF&nbsp;:</strong>
@@ -35,7 +35,7 @@
 <strong>Code AX&nbsp;:</strong>
 <input type="text" name="AX_code" size="25" maxlength="200" value="{$valid->AX_code}" /><br />
 <strong>Adresse&nbsp;:</strong>
-<textarea cols="30" rows="4" name="address">{$valid->address['text']}</textarea><br />
+<textarea cols="30" rows="4" name="address">{$valid->address.text}</textarea><br />
 <strong>Téléphone&nbsp;:</strong>
 <input type="text" name="tel" size="25" maxlength="200" value="{$valid->tel}" /><br />
 <strong>Fax&nbsp;:</strong>
index 58112e1..855ade8 100644 (file)
@@ -55,7 +55,7 @@
 </tr>
 <tr class="pair">
   <td class="titre">Adresse&nbsp;:</td>
-  <td>{$valid->address[text]}</td>
+  <td>{$valid->address.text}</td>
 </tr>
 <tr class="pair">
   <td class="titre">Téléphone&nbsp;:</td>
index df3cf2c..e1e8210 100644 (file)
@@ -42,7 +42,7 @@ function chgMainWinLoc(strPage)
 <div id="fiche">
   <div id="photo" class="part">
     {assign var=photo value=$profile->getPhoto(false)}
-    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}" width="{$photo->width()}"/>{/if}
+    {if $photo}<img alt="Photo de {$profile->fullName()}" src="photo/{$profile->hrid()}{if $with_pending_pic}/req{/if}" width="{$photo->width()}"/>{/if}
 
     {if $logged && $view eq 'private' && ( $profile->section|smarty:nodefaults || $profile->getBinets()|smarty:nodefaults || ($owner && $owner->groups()|smarty:nodefaults))}
       <h2>À l'X&hellip;</h2>
diff --git a/upgrade/1.0.1/00_job.sql b/upgrade/1.0.1/00_job.sql
new file mode 100644 (file)
index 0000000..4b6b5dd
--- /dev/null
@@ -0,0 +1,6 @@
+ALTER TABLE profile_job_enum MODIFY COLUMN acronym VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN url VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN email VARCHAR(255) DEFAULT NULL;
+ALTER TABLE profile_job_enum MODIFY COLUMN NAF_code CHAR(5) DEFAULT NULL;
+
+-- vim:set syntax=mysql:
diff --git a/upgrade/1.0.1/connect.db.inc.php b/upgrade/1.0.1/connect.db.inc.php
new file mode 120000 (symlink)
index 0000000..442fab7
--- /dev/null
@@ -0,0 +1 @@
+../../bin/connect.db.inc.php
\ No newline at end of file
diff --git a/upgrade/1.0.1/phone.php b/upgrade/1.0.1/phone.php
new file mode 100755 (executable)
index 0000000..4239ece
--- /dev/null
@@ -0,0 +1,58 @@
+#!/usr/bin/php5
+<?php
+require_once 'connect.db.inc.php';
+
+$globals->debug = 0; //do not store backtraces
+
+$phones = array(
+    'AF' => '93',
+    'AN' => '599',
+    'BY' => '375',
+    'FM' => '691',
+    'GE' => '995',
+    'GL' => '299',
+    'ID' => '62',
+    'IL' => '972',
+    'IN' => '91',
+    'IQ' => '964',
+    'IR' => '98',
+    'JO' => '962',
+    'JP' => '81',
+    'KG' => '996',
+    'KW' => '965',
+    'KZ' => '7',
+    'LA' => '856',
+    'LB' => '961',
+    'LK' => '94',
+    'MM' => '95',
+    'MN' => '976',
+    'MV' => '960',
+    'MY' => '60',
+    'NP' => '977',
+    'OM' => '968',
+    'PH' => '63',
+    'PK' => '92',
+    'QA' => '974',
+    'SA' => '966',
+    'SG' => '65',
+    'SY' => '963',
+    'TH' => '66',
+    'TJ' => '992',
+    'TM' => '993',
+    'TR' => '90',
+    'TW' => '886',
+    'UZ' => '998',
+    'VG' => '1284',
+    'VN' => '84',
+    'YE' => '967',
+);
+
+foreach ($phones as $country => $phone) {
+    XDB::execute('UPDATE  geoloc_countries
+                     SET  phonePrefix = {?}
+                   WHERE  iso_3166_1_a2 = {?}',
+                 $phone, $country);
+}
+
+/* vim:set et sw=4 sts=4 ts=4: */
+?>