From 8d00297509fe40ef09071a93dfd7fccbc7d3e8da Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 16:11:31 -0300 Subject: [PATCH 1/9] Move php values to js call Not inside js declaration --- htdocs/cashdesk/tpl/validation2.tpl.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/cashdesk/tpl/validation2.tpl.php b/htdocs/cashdesk/tpl/validation2.tpl.php index 844522f55e0..8f24e2069aa 100644 --- a/htdocs/cashdesk/tpl/validation2.tpl.php +++ b/htdocs/cashdesk/tpl/validation2.tpl.php @@ -29,15 +29,15 @@ $langs->load("bills"); From 5a7c20e897a47acdd3417c84c87ef1e7f5a8cd8b Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 17:13:54 -0300 Subject: [PATCH 2/9] Code style var to public --- htdocs/contact/class/contact.class.php | 68 +++++++++++++------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 3b4fa942f81..40051753252 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -41,61 +41,61 @@ class Contact extends CommonObject public $table_element='socpeople'; protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - var $civility_id; // In fact we store civility_code - var $civility_code; - var $address; - var $zip; - var $town; + public $civility_id; // In fact we store civility_code + public $civility_code; + public $address; + public $zip; + public $town; /** * @deprecated * @see state_id */ - var $fk_departement; + public $fk_departement; /** * @deprecated * @see state_code */ - var $departement_code; + public $departement_code; /** * @deprecated * @see state */ - var $departement; - var $state_id; // Id of department - var $state_code; // Code of department - var $state; // Label of department + public $departement; + public $state_id; // Id of department + public $state_code; // Code of department + public $state; // Label of department - var $poste; // Position + public $poste; // Position - var $socid; // fk_soc - var $statut; // 0=inactif, 1=actif + public $socid; // fk_soc + public $statut; // 0=inactif, 1=actif - var $code; - var $email; - var $skype; - var $photo; - var $jabberid; - var $phone_pro; - var $phone_perso; - var $phone_mobile; - var $fax; + public $code; + public $email; + public $skype; + public $photo; + public $jabberid; + public $phone_pro; + public $phone_perso; + public $phone_mobile; + public $fax; - var $priv; + public $priv; - var $birthday; - var $default_lang; - var $no_email; // 1=Don't send e-mail to this contact, 0=do + public $birthday; + public $default_lang; + public $no_email; // 1=Don't send e-mail to this contact, 0=do - var $ref_facturation; // Nb de reference facture pour lequel il est contact - var $ref_contrat; // Nb de reference contrat pour lequel il est contact - var $ref_commande; // Nb de reference commande pour lequel il est contact - var $ref_propal; // Nb de reference propal pour lequel il est contact + public $ref_facturation; // Reference number of invoice for which it is contact + public $ref_contrat; // Nb de reference contrat pour lequel il est contact + public $ref_commande; // Nb de reference commande pour lequel il est contact + public $ref_propal; // Nb de reference propal pour lequel il est contact - var $user_id; - var $user_login; + public $user_id; + public $user_login; - var $oldcopy; // To contains a clone of this when we need to save old properties of object + public $oldcopy; // To contains a clone of this when we need to save old properties of object /** From e053308c6fc5ae9da3a2aca9eba7f7fec06880b7 Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 17:24:11 -0300 Subject: [PATCH 3/9] Code style var to public --- htdocs/societe/class/address.class.php | 58 +++++++++++++------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index d8a1687cf9d..a3a20dfbd3d 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -31,21 +31,21 @@ */ class Address { - var $db; + private $db; - var $id; - var $type; - var $label; - var $socid; - var $name; - var $address; - var $zip; - var $town; - var $country_id; - var $country_code; - var $phone; - var $fax; - var $note; + public $id; + public $type; + public $label; + public $socid; + public $name; + public $address; + public $zip; + public $town; + public $country_id; + public $country_code; + public $phone; + public $fax; + public $note; /** * Adresses liees a la societe @@ -495,21 +495,21 @@ class Address */ class AddressLine { - - var $id; - var $date_creation; - var $date_modification; - var $label; - var $name; - var $address; - var $zip; - var $town; - var $country_id; - var $country_code; - var $country; - var $phone; - var $fax; - var $note; + private $db; + public $id; + public $date_creation; + public $date_modification; + public $label; + public $name; + public $address; + public $zip; + public $town; + public $country_id; + public $country_code; + public $country; + public $phone; + public $fax; + public $note; /** From a8c5661cb70f5f3314274e94f5f16f977336e5fe Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 17:36:04 -0300 Subject: [PATCH 4/9] Code style Set public and private --- htdocs/cashdesk/class/Auth.class.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index 33bbd094050..0de4254cf29 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -22,14 +22,14 @@ */ class Auth { - var $db; + private $db; - var $login; - var $passwd; + private $login; + private $passwd; - var $reponse; + private $reponse; - var $sqlQuery; + public $sqlQuery; /** * Enter description here ... @@ -37,7 +37,7 @@ class Auth * @param DoliDB $db Database handler * @return void */ - function __construct($db) + public function __construct($db) { $this->db = $db; $this->reponse(null); @@ -49,7 +49,7 @@ class Auth * @param string $aLogin Login * @return void */ - function login($aLogin) + public function login($aLogin) { $this->login = $aLogin; } @@ -71,7 +71,7 @@ class Auth * @param string $aReponse Response * @return void */ - function reponse($aReponse) + public function reponse($aReponse) { $this->reponse = $aReponse; } @@ -83,7 +83,7 @@ class Auth * @param string $aPasswd Password * @return int 0 or 1 */ - function verif($aLogin, $aPasswd) + public function verif($aLogin, $aPasswd) { global $conf,$langs; global $dolibarr_main_authentication,$dolibarr_auto_user; From 2418754d71811bcec2d0abf3fc79fd8d69c43ddd Mon Sep 17 00:00:00 2001 From: Ion Date: Wed, 8 Feb 2017 23:27:58 +0100 Subject: [PATCH 5/9] Fill oldline in supplier order updateline --- htdocs/fourn/class/fournisseur.commande.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index f656e7a41e7..053e5b314d6 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2346,8 +2346,11 @@ class CommandeFournisseur extends CommonOrder $subprice = price2num($pu_ht,'MU'); + //Fetch current line from the database and then clone the object and set it in $oldline property $this->line=new CommandeFournisseurLigne($this->db); $this->line->fetch($rowid); + $oldline = clone $this->line; + $this->line->oldline = $oldline; $this->line->context = $this->context; From f8a6d60fe53b2966ed4707a2c741931fdde79095 Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 20:24:20 -0300 Subject: [PATCH 6/9] $db attibute now be protected. --- htdocs/cashdesk/class/Auth.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index 0de4254cf29..5e431514d1c 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -22,7 +22,7 @@ */ class Auth { - private $db; + protected $db; private $login; private $passwd; From febe95cd2eaa45a044c354f6a9590637d77db15a Mon Sep 17 00:00:00 2001 From: Gustavo Novaro Date: Wed, 8 Feb 2017 20:27:14 -0300 Subject: [PATCH 7/9] $db attributte now be protected --- htdocs/societe/class/address.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/class/address.class.php b/htdocs/societe/class/address.class.php index a3a20dfbd3d..43e46008910 100644 --- a/htdocs/societe/class/address.class.php +++ b/htdocs/societe/class/address.class.php @@ -31,7 +31,7 @@ */ class Address { - private $db; + protected $db; public $id; public $type; @@ -495,7 +495,7 @@ class Address */ class AddressLine { - private $db; + protected $db; public $id; public $date_creation; public $date_modification; From fa527ff4eb436003a4bb5a4764f14807f12183b4 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Thu, 9 Feb 2017 13:10:32 +0100 Subject: [PATCH 8/9] fix the card page generator --- dev/skeletons/build_class_from_table.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dev/skeletons/build_class_from_table.php b/dev/skeletons/build_class_from_table.php index d9e30b23501..0e5a6d82a82 100755 --- a/dev/skeletons/build_class_from_table.php +++ b/dev/skeletons/build_class_from_table.php @@ -636,7 +636,8 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'".$prop['field'].".'\">';\n"; + $baseString = 'print "".\$langs->trans("Field%s")."%s."\">";'; + $varprop.= sprintf("\t ".$baseString." \n", $prop['field'], $prop['field'], $prop['field']); } } $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent); @@ -648,7 +649,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile) { if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime']) { - $varprop.="print ''.\$langs->trans(\"Field".$prop['field']."\").'\$object->".$prop['field']."';\n"; + $varprop.=sprintf("\t print ''.\$langs->trans(\"Field%s\").''.\$object->%s.'';\n",$prop['field'],$prop['field']); } } $targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent); From 4fb4bc6f6cf51332a5776acfe9ce87e689ad51b6 Mon Sep 17 00:00:00 2001 From: De Coninck Laurent Date: Fri, 10 Feb 2017 10:20:32 +0100 Subject: [PATCH 9/9] [FIX] Dictionnaries without rowid It's possible to create a dictionnary without the key rowid. But in that case it's impossible to enable/disable the value because the dictionnary fonctionality uses always rowid even another primary key is defined. By this fix, the id property uses is the primary key defined on the dictionnary creation. --- htdocs/admin/dict.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 09ee313e487..2bb0bbe15dc 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -1537,7 +1537,8 @@ if ($id) $canbemodified=$iserasable; if ($obj->code == 'RECEP') $canbemodified=1; - $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); + $rowidcol=$tabrowid[$id]; + $url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->{$rowidcol})?$obj->{$rowidcol}:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):''); if ($param) $url .= '&'.$param; $url.='&';