From 1e087b68e131885d71afe65d629209ba6fefe590 Mon Sep 17 00:00:00 2001 From: atm-ph Date: Wed, 17 Apr 2019 16:29:48 +0200 Subject: [PATCH 01/36] New show html list instead input text for extrafields typed as list --- htdocs/core/tpl/extrafields_list_search_input.tpl.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index b4a98946f94..c0a7ecbb437 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -24,11 +24,11 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ $typeofextrafield=$extrafields->attributes[$extrafieldsobjectkey]['type'][$key]; print ''; $tmpkey=preg_replace('/'.$search_options_pattern.'/', '', $key); - if (in_array($typeofextrafield, array('varchar', 'int', 'double', 'select')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) + if (in_array($typeofextrafield, array('varchar', 'int', 'double')) && empty($extrafields->attributes[$extrafieldsobjectkey]['computed'][$key])) { $crit=$val; $searchclass=''; - if (in_array($typeofextrafield, array('varchar', 'select'))) $searchclass='searchstring'; + if (in_array($typeofextrafield, array('varchar'))) $searchclass='searchstring'; if (in_array($typeofextrafield, array('int', 'double'))) $searchclass='searchnum'; print ''; } @@ -37,7 +37,9 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') $morecss=''; if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; - echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $search_options_pattern, $morecss); + $keyprefix=$search_options_pattern; + if (substr($search_options_pattern, -8) === 'options_') $keyprefix = substr($search_options_pattern, 0,-8); + echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $keyprefix, $morecss); } elseif (in_array($typeofextrafield, array('datetime','timestamp'))) { From 8765e7648e1354e6b2bf13ea395f409f2d330811 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 31 Oct 2019 11:03:46 +0000 Subject: [PATCH 02/36] Fixing style errors. --- htdocs/core/tpl/extrafields_list_search_input.tpl.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index 0ba2385eda2..fb0a0dea3aa 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -38,9 +38,8 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ $morecss=''; if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; $keyprefix=$search_options_pattern; - if (substr($search_options_pattern, -8) === 'options_') $keyprefix = substr($search_options_pattern, 0,-8); + if (substr($search_options_pattern, -8) === 'options_') $keyprefix = substr($search_options_pattern, 0, -8); echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $keyprefix, $morecss); - } else { From 4f3d4950e1ba0439fc73a6e59f000753d82ca56d Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Tue, 12 Nov 2019 13:01:16 +0100 Subject: [PATCH 03/36] Check if draft exists in TakePOS customer list Check if draft invoice already exists, if not create it --- htdocs/societe/list.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index afd4c89aab5..bbe9f6a9424 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -231,7 +231,25 @@ if ($action == "change") // Change customer for TakePOS $idcustomer = GETPOST('idcustomer', 'int'); $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant - // @TODO Check if draft invoice already exists, if not create it or return a warning to ask to enter at least one line to have it created automatically + // Check if draft invoice already exists, if not create it + $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'facture + where ref=\'(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')\' + AND entity IN ('.getEntity('invoice').')'; + $result = $db->query($sql); + $num_lines = $db->num_rows($result); + if ($num_lines==0) + { + require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + $invoice = new Facture($db); + $invoice->socid = $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}; + $invoice->date = dol_now(); + $invoice->module_source = 'takepos'; + $invoice->pos_source = $_SESSION["takeposterminal"]; + $placeid =$invoice->create($user); + $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; + $db->query($sql); + } + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); ?> From 34b832507959882da8c70467aea8d6fd551e95e5 Mon Sep 17 00:00:00 2001 From: andreubisquerra Date: Tue, 12 Nov 2019 14:21:49 +0100 Subject: [PATCH 04/36] Update list.php --- htdocs/societe/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index bbe9f6a9424..a62dde1d79d 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -249,7 +249,7 @@ if ($action == "change") // Change customer for TakePOS $sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' where rowid=".$placeid; $db->query($sql); } - + $sql = "UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); ?> From 1153b81e6f6883a45719d5de149373b73cecfc91 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 16:08:03 +0100 Subject: [PATCH 05/36] Update templates --- .../websites/website_template-corporate.zip | Bin 1721234 -> 1721252 bytes .../websites/website_template-stellar.zip | Bin 191327 -> 194363 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/htdocs/install/doctemplates/websites/website_template-corporate.zip b/htdocs/install/doctemplates/websites/website_template-corporate.zip index e86e11df2885d4590449673680bfd555722e92d4..01d984562cc35dfe45a4fbcee307779136c93baf 100644 GIT binary patch delta 18228 zcmZ_01z1~6w>FHsYY6V{?heHrio0u(;si>u;u@s5dy7kHi(7Fk?p~bY^3yzhu5;e^ ze1EP?_Py8Kv(}n5*~!c#YbQn67e&~kt1H36p+Nn4#HTwYqEo^CIdCyR4#wPn4xf`V zq5mA~Ibg0~{(xjA_&$i>0^S-@6KaUqY={W0cl<{RZu|{Bgz*B@IP^?)D+r;W<_QyX z$eJs!pt}hF5SraEV03XHXpjPC2@!(I7+`D(A+5N8SduuC6u6fH|56Z|Z6py(-$QI;^&t-Z0TIi6h%W`{r69i)l$V0qyxfOo zcmSaZe?}LAnDzOLj_(9P38WZG6cDr`iV=c>{ig%oJ8S3fNuZ!WFNG~JpBRkA3`7L` zu>dif^Iu`akw8d08y?!R3Q$n>FNNg~X^j<#+H7Nuk*5Grhg^#Rj|oB8Uol!lAn3;( zMhr3p8Ny*ca6ym(Kjt1b1j#C3Cc#3`f-)us-5(Tj=#JTZ=#Eue3z272VKC=h?+KCB2H@ z@dretfeD(^z=Vl;5GIoV00Rg8MXtuyio=h_4+W(FmQ@5WAn+jt7hxoTJrn_|h>tBJ z4WhIA-~mMdpT!OxvB@~IXxT{?nzYo|ij|N}`C=y>YSs5}cDifyF?U!cfvg{y>O-hv z9XL7ru3X~dp;%9uLMawLM&Pq|$nWRdxVva-PTz^q%v({bk)yTDllxh~B$luhVXNjD zVqEjhgH4qH1fXs@4=G}%m6KtS3-DM!jJK#jv9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4*n+em+c3k7q&$f0ARZX z06zME^&(hI_=PzJu%0lG5@O=dRRIhw{L*1V;2dEfHG~u9>=KKATf^}mj@B=MV+DYC z;NQYP28g>YGsPb>Ug(SeU(B~H1HcE%FXy14$Y1L0MP8_j`Th@eIU;|lL&lgq|F^Q2 zlkxxg(1K?~fD{nw&e{$W{#E)sNffUv48s$tSJhlg$Vp#1kn26EKwje z#0tV&K8Am-{AX4B;P0Y;t4bTKxc&cDngWxH{Z--~%^}@**(s<%{_g?T3^oz_J8EOa zUV38ki~#&}MnLet#{D&|LxkQ-YmHwL?*G$jD5y5@nHZ1?Laz~*!)4gZG{yAN=>I&$ zY^csr4wDvXFTm1hFT0G>KI?de;H2575OQKlt_1E-+j?gfA4bt^| zI=d4z`RF+T9eweSHLH{YhBu!Yg&oZVCVDSm zq6d~!NT6W)eJ3exa76Js105keUDFv_&|Z7yDPs#vRg*9><@4!<&QiK;F{+@@003}< Bqf`I@ diff --git a/htdocs/install/doctemplates/websites/website_template-stellar.zip b/htdocs/install/doctemplates/websites/website_template-stellar.zip index b4d55a83e7314ffbc3a3deb243081f17395ff972..f3ed48c6729a93142095cc0aba87b64b2f882274 100644 GIT binary patch delta 22710 zcmY(pV~{3I6E-@wZSC0h?AW$#+qlQJZQI;2c5K_WJ!hZyJBZVNGUKYwimr;dQk^@? zuwB=%@CwqPU@$=cJ+bLF3GgJK{|RQw{|Q}||3pI)vgm)ZsZ7*V`hN;yf}+s>6yt@k z|1Gs$VFAPb`VVUR-~qn)KiZi-u<`5vFnJ9S1oHp1Gy^{nvi~XJejtp1e~5g~-8J_G z5)e?R2oMnRzprpNHFCCeG1Yf4G&gmocXqVd(s^^j?U?)7@Prv!(;7qHPV`Y=)zy;L zsxsoKO~Ip3tuzW?A&Pi%V9e;3IBr{me9!&Gkg5-wo+KQp)WMG1)jSUuD^|qd!r|4r zWk&d_Qy-=5w(32yZVXt?lllIe6BX^H*XYi%ss51XN+zzaK+gzqTM&hB^#kqO#w)sH+o2yFB{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wptx1CDL?=J?=hAGR%`-d6gMF}0Hf~6 z1wi3v0JrSnj8A8_TiTHGPz4|mzF%?4s2l}`;Q<*6N67)lIWz#GFaQ@gg$EcZ&1>Xl z04M+%w*bl^VxS_qSb-W*0Du*x0N1}_9V%`3En0s8n7s8P&DsNwJ5K?yzY^dCaa#Z* zCD}ug>))L1pMggSfF#9gtL^KICAmW5GRNVm+35vs34j>g!355>Kwp7PTL3o@H3a4p z0AY$RQPMNUhRkb6ez<<)hd?}rK@}oEIpPewLL}$BHw*?6e}tS@LbSV(N6_$JBe*sK tHWC3D;e(LBwvC6shLlkNG@b)s+!rq#A@3_85K;1-0);@Z(_}`-e*tykY|8)u From c07f1f824688e059ea3e34e8c1abfb426817d2bb Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 16:26:42 +0100 Subject: [PATCH 06/36] Try exakat --- build/exakat/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 build/exakat/README.md diff --git a/build/exakat/README.md b/build/exakat/README.md new file mode 100644 index 00000000000..da04e781765 --- /dev/null +++ b/build/exakat/README.md @@ -0,0 +1,13 @@ + +mkdir exakat +cd exakat +curl -o exakat.phar http://dist.exakat.io/index.php?file=latest +curl -o apache-tinkerpop-gremlin-server-3.3.5-bin.zip http://dist.exakat.io/apache-tinkerpop-gremlin-server-3.3.5-bin.zip +unzip apache-tinkerpop-gremlin-server-3.3.5-bin.zip +mv apache-tinkerpop-gremlin-server-3.3.5 tinkergraph +rm -rf apache-tinkerpop-gremlin-server-3.3.5-bin.zip +cd tinkergraph ./bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin 3.3.5 +cd .. + +php exakat.phar version +php exakat.phar doctor From e79ac7081a8493bd30beb0422ef085698aafef8f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 17:37:05 +0100 Subject: [PATCH 07/36] Look and feel v11 --- build/exakat/README.md | 16 ++++++++++++++++ htdocs/compta/prelevement/card.php | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/build/exakat/README.md b/build/exakat/README.md index da04e781765..3b9052e5281 100644 --- a/build/exakat/README.md +++ b/build/exakat/README.md @@ -1,4 +1,5 @@ +== Install exakat == mkdir exakat cd exakat curl -o exakat.phar http://dist.exakat.io/index.php?file=latest @@ -11,3 +12,18 @@ cd .. php exakat.phar version php exakat.phar doctor + +== Init project == +php + + +Edit config.ini file to exclude some dirs: +ignore_dirs[] = "/htdocs/includes"; +ignore_dirs[] = "/scripts"; +ignore_dirs[] = "/build"; +ignore_dirs[] = "/dev"; +ignore_dirs[] = "/documents"; + + +== Analyze project == +php diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index fb41142d970..72508c804a5 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -177,7 +177,7 @@ if ($id > 0 || $ref) print '

'; print '
'; - print ''; + print '
'; //print ''; print ''; @@ -214,7 +214,7 @@ if ($id > 0 || $ref) print '
'; print '
'; - print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'; + print '
'; $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); From 2a67dd0f6682647832b75d53ea3b4f8378927d92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 17:43:27 +0100 Subject: [PATCH 08/36] Look and feel v11 --- htdocs/compta/prelevement/factures.php | 4 ++-- htdocs/compta/prelevement/fiche-rejet.php | 4 ++-- htdocs/compta/prelevement/fiche-stat.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index 01acea0479a..a9fd4f1fbbc 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -79,7 +79,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'; + print '
'; //print ''; print ''; @@ -111,7 +111,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'; + print '
'; $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index ebb7ab7fbb2..d44ffdea4a8 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -75,7 +75,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'."\n"; + print '
'."\n"; //print ''; print ''; @@ -112,7 +112,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'; + print '
'; $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index fa7b1758435..70441ff19c2 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -72,7 +72,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'."\n"; + print '
'."\n"; //print ''; print ''; @@ -109,7 +109,7 @@ if ($prev_id > 0 || $ref) print '
'; print '
'; - print '
'.$langs->trans("Ref").''.$object->getNomUrl(1).'
'.$langs->trans("Date").''.dol_print_date($object->datec, 'day').'
'; + print '
'; $acc = new Account($db); $result = $acc->fetch($conf->global->PRELEVEMENT_ID_BANKACCOUNT); From 453ffad9e882415e2c070b7364abeb866edf07ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 18:01:16 +0100 Subject: [PATCH 09/36] Look and feel v11 --- .../class/bonprelevement.class.php | 58 ++++++------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index f1c3f70c53a..1e2050c5a47 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -74,6 +74,10 @@ class BonPrelevement extends CommonObject public $invoice_in_error=array(); public $thirdparty_in_error=array(); + const STATUS_DRAFT = 0; + const STATUS_TRANSFERED = 1; + const STATUS_CREDITED = 2; + /** * Constructor @@ -2001,49 +2005,23 @@ class BonPrelevement extends CommonObject */ public function LibStatut($status, $mode = 0) { - // phpcs:enable - if (empty($this->labelStatus)) + // phpcs:enable + if (empty($this->labelStatus) || empty($this->labelStatusShort)) { global $langs; - $langs->load("withdrawals"); - $this->labelStatus[0]=$langs->trans("StatusWaiting"); - $this->labelStatus[1]=$langs->trans("StatusTrans"); - $this->labelStatus[2]=$langs->trans("StatusCredited"); + //$langs->load("mymodule"); + $this->labelStatus[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); + $this->labelStatus[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); + $this->labelStatus[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); + $this->labelStatusShort[self::STATUS_DRAFT] = $langs->trans('StatusWaiting'); + $this->labelStatusShort[self::STATUS_TRANSFERED] = $langs->trans('StatusTrans'); + $this->labelStatusShort[self::STATUS_CREDITED] = $langs->trans('StatusCredited'); } - if ($mode == 0 || $mode == 1) - { - return $this->labelStatus[$status]; - } - elseif ($mode == 2) - { - if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status]; - elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status]; - elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status]; - } - elseif ($mode == 3) - { - if ($status==0) return img_picto($this->labelStatus[$status], 'statut1'); - elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3'); - elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6'); - } - elseif ($mode == 4) - { - if ($status==0) return img_picto($this->labelStatus[$status], 'statut1').' '.$this->labelStatus[$status]; - elseif ($status==1) return img_picto($this->labelStatus[$status], 'statut3').' '.$this->labelStatus[$status]; - elseif ($status==2) return img_picto($this->labelStatus[$status], 'statut6').' '.$this->labelStatus[$status]; - } - elseif ($mode == 5) - { - if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1'); - elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3'); - elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6'); - } - elseif ($mode == 6) - { - if ($status==0) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut1'); - elseif ($status==1) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut3'); - elseif ($status==2) return $this->labelStatus[$status].' '.img_picto($this->labelStatus[$status], 'statut6'); - } + $statusType = 'status1'; + if ($status == self::STATUS_TRANSFERED) $statusType = 'status3'; + if ($status == self::STATUS_CREDITED) $statusType = 'status6'; + + return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } From 480ac1a926286c29c4518f8a23502b150a077353 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Tue, 12 Nov 2019 18:08:09 +0100 Subject: [PATCH 10/36] API New link/unlink products with categories Need it for V11 please :) --- .../categories/class/api_categories.class.php | 240 ++++++++++++++++++ 1 file changed, 240 insertions(+) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index d289874d1ee..f7a2addef3d 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -264,6 +264,246 @@ class Categories extends DolibarrApi ) ); } + + /** + * Link an object to a category by id + * + * @param int $id ID of category + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param int $object_id ID of object + * + * @return array + * @throws RestException + * + * @url POST {id}/objects/{type}/{object_id} + */ + public function link_object_by_id($id, $type, $object_id) + { + if (empty($type) || empty($object_id)) { + throw new RestException(401); + } + + if(! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + $result = $this->category->fetch($id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + # TODO Add all types + if ($type === "product") { + if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + throw new RestException(401); + } + $object = new Product($this->db); + } else { + throw new RestException(401, "this type is not recognized yet."); + } + + if (!empty($object)) { + $result = $object->fetch($object_id); + if ($result > 0) { + $result=$this->category->add_type($object, $type); + if ($result < 0) { + if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') { + throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors)); + } + } + } else { + throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Objects succefully linked to the category' + ) + ); + } + + throw new RestException(401); + } + + /** + * Link an object to a category by ref + * + * @param int $id ID of category + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param string $object_ref Reference of object + * + * @return array + * @throws RestException + * + * @url POST {id}/objects/{type}/ref/{object_ref} + */ + public function link_object_by_ref($id, $type, $object_ref) + { + if (empty($type) || empty($object_ref)) { + throw new RestException(401); + } + + if(! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + $result = $this->category->fetch($id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + # TODO Add all types + if ($type === "product") { + if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + throw new RestException(401); + } + $object = new Product($this->db); + } else { + throw new RestException(401, "this type is not recognized yet."); + } + + if (!empty($object)) { + $result = $object->fetch('', $object_ref); + if ($result > 0) { + $result=$this->category->add_type($object, $type); + if ($result < 0) { + if ($this->category->error != 'DB_ERROR_RECORD_ALREADY_EXISTS') { + throw new RestException(500, 'Error when linking object', array_merge(array($this->category->error), $this->category->errors)); + } + } + } else { + throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Objects succefully linked to the category' + ) + ); + } + + throw new RestException(401); + } + + /** + * Unlink an object from a category by id + * + * @param int $id ID of category + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param int $object_id ID of the object + * + * @return array + * @throws RestException + * + * @url DELETE {id}/objects/{type}/{object_id} + */ + public function unlink_object_by_id($id, $type, $object_id) + { + if (empty($type) || empty($object_id)) { + throw new RestException(401); + } + + if(! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + $result = $this->category->fetch($id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + # TODO Add all types + if ($type === "product") { + if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + throw new RestException(401); + } + $object = new Product($this->db); + } else { + throw new RestException(401, "this type is not recognized yet."); + } + + if (!empty($object)) { + $result = $object->fetch((int) $object_id); + if ($result > 0) { + $result=$this->category->del_type($object, $type); + if ($result < 0) { + throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors)); + } + } else { + throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Objects succefully unlinked from the category' + ) + ); + } + + throw new RestException(401); + } + + /** + * Unlink an object from a category by ref + * + * @param int $id ID of category + * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') + * @param string $object_ref Reference of the object + * + * @return array + * @throws RestException + * + * @url DELETE {id}/objects/{type}/ref/{object_ref} + */ + public function unlink_object_by_ref($id, $type, $object_ref) + { + if (empty($type) || empty($object_ref)) { + throw new RestException(401); + } + + if(! DolibarrApiAccess::$user->rights->categorie->lire) { + throw new RestException(401); + } + + $result = $this->category->fetch($id); + if( ! $result ) { + throw new RestException(404, 'category not found'); + } + + # TODO Add all types + if ($type === "product") { + if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { + throw new RestException(401); + } + $object = new Product($this->db); + } else { + throw new RestException(401, "this type is not recognized yet."); + } + + if (!empty($object)) { + $result = $object->fetch('', (string) $object_ref); + if ($result > 0) { + $result=$this->category->del_type($object, $type); + if ($result < 0) { + throw new RestException(500, 'Error when unlinking object', array_merge(array($this->category->error), $this->category->errors)); + } + } else { + throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); + } + + return array( + 'success' => array( + 'code' => 200, + 'message' => 'Objects succefully unlinked from the category' + ) + ); + } + + throw new RestException(401); + } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore From fcb50841ccf35a298fb9c145f4be21445381e4e0 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 12 Nov 2019 17:10:20 +0000 Subject: [PATCH 11/36] Fixing style errors. --- .../categories/class/api_categories.class.php | 68 +++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index f7a2addef3d..36b3e10174a 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -264,17 +264,17 @@ class Categories extends DolibarrApi ) ); } - + /** * Link an object to a category by id * * @param int $id ID of category * @param string $type Type of category ('member', 'customer', 'supplier', 'product', 'contact') * @param int $object_id ID of object - * + * * @return array * @throws RestException - * + * * @url POST {id}/objects/{type}/{object_id} */ public function link_object_by_id($id, $type, $object_id) @@ -282,17 +282,17 @@ class Categories extends DolibarrApi if (empty($type) || empty($object_id)) { throw new RestException(401); } - + if(! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); } - + $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - - # TODO Add all types + + // TODO Add all types if ($type === "product") { if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { throw new RestException(401); @@ -301,7 +301,7 @@ class Categories extends DolibarrApi } else { throw new RestException(401, "this type is not recognized yet."); } - + if (!empty($object)) { $result = $object->fetch($object_id); if ($result > 0) { @@ -314,7 +314,7 @@ class Categories extends DolibarrApi } else { throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); } - + return array( 'success' => array( 'code' => 200, @@ -322,10 +322,10 @@ class Categories extends DolibarrApi ) ); } - + throw new RestException(401); } - + /** * Link an object to a category by ref * @@ -343,17 +343,17 @@ class Categories extends DolibarrApi if (empty($type) || empty($object_ref)) { throw new RestException(401); } - + if(! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); } - + $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - - # TODO Add all types + + // TODO Add all types if ($type === "product") { if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { throw new RestException(401); @@ -362,7 +362,7 @@ class Categories extends DolibarrApi } else { throw new RestException(401, "this type is not recognized yet."); } - + if (!empty($object)) { $result = $object->fetch('', $object_ref); if ($result > 0) { @@ -375,7 +375,7 @@ class Categories extends DolibarrApi } else { throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); } - + return array( 'success' => array( 'code' => 200, @@ -383,10 +383,10 @@ class Categories extends DolibarrApi ) ); } - + throw new RestException(401); } - + /** * Unlink an object from a category by id * @@ -404,17 +404,17 @@ class Categories extends DolibarrApi if (empty($type) || empty($object_id)) { throw new RestException(401); } - + if(! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); } - + $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - - # TODO Add all types + + // TODO Add all types if ($type === "product") { if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { throw new RestException(401); @@ -423,7 +423,7 @@ class Categories extends DolibarrApi } else { throw new RestException(401, "this type is not recognized yet."); } - + if (!empty($object)) { $result = $object->fetch((int) $object_id); if ($result > 0) { @@ -434,7 +434,7 @@ class Categories extends DolibarrApi } else { throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); } - + return array( 'success' => array( 'code' => 200, @@ -442,10 +442,10 @@ class Categories extends DolibarrApi ) ); } - + throw new RestException(401); } - + /** * Unlink an object from a category by ref * @@ -463,17 +463,17 @@ class Categories extends DolibarrApi if (empty($type) || empty($object_ref)) { throw new RestException(401); } - + if(! DolibarrApiAccess::$user->rights->categorie->lire) { throw new RestException(401); } - + $result = $this->category->fetch($id); if( ! $result ) { throw new RestException(404, 'category not found'); } - - # TODO Add all types + + // TODO Add all types if ($type === "product") { if(! (DolibarrApiAccess::$user->rights->produit->creer || DolibarrApiAccess::$user->rights->service->creer)) { throw new RestException(401); @@ -482,7 +482,7 @@ class Categories extends DolibarrApi } else { throw new RestException(401, "this type is not recognized yet."); } - + if (!empty($object)) { $result = $object->fetch('', (string) $object_ref); if ($result > 0) { @@ -493,7 +493,7 @@ class Categories extends DolibarrApi } else { throw new RestException(500, 'Error when fetching object', array_merge(array($object->error), $object->errors)); } - + return array( 'success' => array( 'code' => 200, @@ -501,7 +501,7 @@ class Categories extends DolibarrApi ) ); } - + throw new RestException(401); } From e33d969178ed5885548c7e590dafc3af4aad6654 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 12 Nov 2019 18:38:23 +0100 Subject: [PATCH 12/36] Fix php error on stripe account display convert non object in full array in order to avoid php error message. --- htdocs/societe/paymentmodes.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5636f09b3a4..11a5955a3ff 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1317,11 +1317,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->available=$cpt->amount / 100; + $currencybalance[$cpt->currency]['available']=$cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->available=$cpt->amount; + $currencybalance[$cpt->currency]['available']=$cpt->amount; } - $currencybalance[$cpt->currency]->currency=$cpt->currency; + $currencybalance[$cpt->currency]['currency']=$cpt->currency; } } @@ -1331,9 +1331,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100; + $currencybalance[$cpt->currency]['pending']=$currencybalance[$cpt->currency]['available']+$cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount; + $currencybalance[$cpt->currency]['pending']=$currencybalance[$cpt->currency]['available']+$cpt->amount; } } } @@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''; + print ''; } } From 24bac213aaa7d0f141ef32036d939b610c7ad879 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 12 Nov 2019 18:39:39 +0100 Subject: [PATCH 13/36] Update paymentmodes.php --- htdocs/societe/paymentmodes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 11a5955a3ff..e44feb047ab 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''; + print ''; } } From 422d893eccac641b482188741ce90c050f5dd44c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 Nov 2019 21:33:42 +0100 Subject: [PATCH 14/36] Update llx_c_action_trigger.sql --- htdocs/install/mysql/data/llx_c_action_trigger.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/data/llx_c_action_trigger.sql b/htdocs/install/mysql/data/llx_c_action_trigger.sql index b7cad86d6bb..85360478500 100644 --- a/htdocs/install/mysql/data/llx_c_action_trigger.sql +++ b/htdocs/install/mysql/data/llx_c_action_trigger.sql @@ -125,7 +125,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_REOPEN','BOM reopen','Executed when a BOM is re-open','bom',653); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); -- actions not enabled by default : they are excluded when we enable the module Agenda (except TASK_...) From 4f90fe0fd23e02387882d04964ba549df2dc3e39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 Nov 2019 21:34:45 +0100 Subject: [PATCH 15/36] Update 10.0.0-11.0.0.sql --- htdocs/install/mysql/migration/10.0.0-11.0.0.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 9c52044291d..6a31fa3e745 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -493,7 +493,7 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('BOM_DELETE','BOM deleted','Executed when a BOM deleted','bom',654); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_VALIDATE','MO validated','Executed when a MO is validated','bom',660); -insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO disabled','Executed when a MO is produced','bom',661); +insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_PRODUCED','MO produced','Executed when a MO is produced','bom',661); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_DELETE','MO deleted','Executed when a MO is deleted','bom',662); insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('MO_CANCEL','MO canceled','Executed when a MO is canceled','bom',663); From 7ce297c6cc54b463b210ddc285555552a41cf083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 Nov 2019 21:53:17 +0100 Subject: [PATCH 16/36] doxygen --- htdocs/core/lib/ticket.lib.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 41e783b7597..609dbd9926d 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -180,10 +181,10 @@ function showDirectPublicLink($object) } /** - * Generate a random id + * Generate a random id * - * @param string $car Char to generate key - * @return void + * @param int $car Length of string to generate key + * @return string */ function generate_random_id($car = 16) { From 89bf35a8bf736dd1d61b0085ecd6d5dac8b2d496 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 21:54:41 +0100 Subject: [PATCH 17/36] Fix default value show must match the theme selected --- htdocs/core/lib/usergroups.lib.php | 46 +++++++++++++++++++----------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 5e842612b24..eeaa4d4d6ce 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -420,6 +420,10 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; + if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) { + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + } + // Show logo if ($foruserprofile) { @@ -563,8 +567,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='5a6482'; - if ($conf->theme == 'md') $default='5a3278'; + $default=(empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1))); print ''; print ''; @@ -612,8 +615,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='f0f0f0'; - if ($conf->theme == 'md') $default='ffffff'; + $default=(empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1))); print ''; print ''; @@ -641,6 +643,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab))); + print ''; print ''; print ''; @@ -666,6 +670,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1))); + print ''; print ''; print ''; @@ -691,6 +697,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle))); + print ''; print ''; print ''; @@ -716,8 +724,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='ffffff'; - if ($conf->theme == 'md') $default='ffffff'; + $default=(empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1))); print ''; print ''; @@ -745,8 +752,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { - $default='f8f8f8'; - if ($conf->theme == 'md') $default='f8f8f8'; + $default=(empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1))); print ''; print ''; @@ -794,6 +800,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink))); + print ''; print ''; print ''; @@ -834,6 +842,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) */ } else { + $default=(empty($colorbacklinepairhover) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairhover))); + print ''; print ''; print ''; @@ -878,6 +888,8 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else { + $default=(empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked))); + print ''; print ''; print ''; From 9efcdc78f90d2892a3869da7b98197e9676a4270 Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Tue, 12 Nov 2019 21:56:05 +0100 Subject: [PATCH 18/36] Cleanup interface_90_modSociete_ContactRoles --- .../interface_90_modSociete_ContactRoles.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php index b806e70c71d..b50008dba2e 100644 --- a/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php +++ b/htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php @@ -21,9 +21,9 @@ */ /** - * \file htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php + * \file htdocs/core/triggers/interface_90_modSociete_ContactRoles.class.php * \ingroup agenda - * \brief Trigger file for agenda module + * \brief Trigger file for company - contactroles */ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; @@ -35,7 +35,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; class InterfaceContactRoles extends DolibarrTriggers { public $family = 'agenda'; - public $description = "Triggers of this module add actions in agenda according to setup made in agenda setup."; + public $description = "Triggers of this module auto link contact to company."; /** * Version of the trigger @@ -73,7 +73,6 @@ class InterfaceContactRoles extends DolibarrTriggers $socid=(property_exists($object, 'socid')?$object->socid:$object->fk_soc); if (! empty($socid) && $socid > 0) { - global $db, $langs; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contactdefault = new Contact($this->db); $contactdefault->socid=$socid; @@ -83,7 +82,7 @@ class InterfaceContactRoles extends DolibarrTriggers if ($object->id > 0) { $class = get_class($object); - $cloneFrom = new $class($db); + $cloneFrom = new $class($this->db); $r = $cloneFrom->fetch($object->id); if (!empty($cloneFrom->id)) $TContactAlreadyLinked = array_merge($cloneFrom->liste_contact(-1, 'external'), $cloneFrom->liste_contact(-1, 'internal')); From e7d51d4ec753451c600d5bbb50cf1a613f3f3674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 Nov 2019 22:01:53 +0100 Subject: [PATCH 19/36] do not trim int --- htdocs/ticket/class/ticket.class.php | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 5784fc22a3e..2b673ad8899 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2016 Christophe Battarel + * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -250,11 +251,11 @@ class Ticket extends CommonObject } if (isset($this->fk_soc)) { - $this->fk_soc = trim($this->fk_soc); + $this->fk_soc = (int) $this->fk_soc; } if (isset($this->fk_project)) { - $this->fk_project = trim($this->fk_project); + $this->fk_project = (int) $this->fk_project; } if (isset($this->origin_email)) { @@ -262,11 +263,11 @@ class Ticket extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->fk_user_assign)) { - $this->fk_user_assign = trim($this->fk_user_assign); + $this->fk_user_assign = (int) $this->fk_user_assign; } if (isset($this->subject)) { @@ -278,7 +279,7 @@ class Ticket extends CommonObject } if (isset($this->fk_statut)) { - $this->fk_statut = trim($this->fk_statut); + $this->fk_statut = (int) $this->fk_statut; } if (isset($this->resolution)) { @@ -746,11 +747,11 @@ class Ticket extends CommonObject } if (isset($this->fk_soc)) { - $this->fk_soc = trim($this->fk_soc); + $this->fk_soc = (int) $this->fk_soc; } if (isset($this->fk_project)) { - $this->fk_project = trim($this->fk_project); + $this->fk_project = (int) $this->fk_project; } if (isset($this->origin_email)) { @@ -758,11 +759,11 @@ class Ticket extends CommonObject } if (isset($this->fk_user_create)) { - $this->fk_user_create = trim($this->fk_user_create); + $this->fk_user_create = (int) $this->fk_user_create; } if (isset($this->fk_user_assign)) { - $this->fk_user_assign = trim($this->fk_user_assign); + $this->fk_user_assign = (int) $this->fk_user_assign; } if (isset($this->subject)) { @@ -774,7 +775,7 @@ class Ticket extends CommonObject } if (isset($this->fk_statut)) { - $this->fk_statut = trim($this->fk_statut); + $this->fk_statut = (int) $this->fk_statut; } if (isset($this->resolution)) { @@ -1002,12 +1003,12 @@ class Ticket extends CommonObject $this->ref = 'TI0501-001'; $this->track_id = 'XXXXaaaa'; $this->origin_email = 'email@email.com'; - $this->fk_project = '1'; - $this->fk_user_create = '1'; - $this->fk_user_assign = '1'; + $this->fk_project = 1; + $this->fk_user_create = 1; + $this->fk_user_assign = 1; $this->subject = 'Subject of ticket'; $this->message = 'Message of ticket'; - $this->fk_statut = '0'; + $this->fk_statut = 0; $this->resolution = '1'; $this->progress = '10'; $this->timing = '30'; From bb4fd0d5c02518f7464edc2ad34e25f4df213739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 12 Nov 2019 22:06:22 +0100 Subject: [PATCH 20/36] timing is varchar in db --- htdocs/ticket/class/ticket.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 2b673ad8899..1d6b1d591c4 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -121,7 +121,7 @@ class Ticket extends CommonObject public $progress; /** - * @var int Duration for ticket + * @var string Duration for ticket */ public $timing; From 56c2dc26148f1f7809c691361009b57bf7a26ce3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 12 Nov 2019 22:29:36 +0100 Subject: [PATCH 21/36] Reduce need of translations --- htdocs/core/class/html.formwebsite.class.php | 7 ++++--- htdocs/install/upgrade2.php | 8 ++++---- htdocs/langs/en_US/install.lang | 5 +---- htdocs/website/index.php | 5 +++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 6bb4e1d25f5..7aab9bd6774 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -228,9 +228,10 @@ class FormWebsite * @param int $pageid Preselected container ID * @param int $showempty Show empty record * @param string $action Action on page that use this select list + * @param string $morecss More CSS * @return string HTML select component with list of type of containers */ - public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '') + public function selectContainer($website, $htmlname = 'pageid', $pageid = 0, $showempty = 0, $action = '', $morecss = 'minwidth200') { global $langs; @@ -239,11 +240,11 @@ class FormWebsite $out=''; if ($atleastonepage && $action != 'editsource') { - $out.=''; } else { - $out.=''; } if ($showempty || ! $atleastonepage) $out.=''; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index cdae711873b..0efb8dfde59 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -5030,7 +5030,7 @@ function migrate_users_socialnetworks() dol_print_error($db); $db->rollback(); } - print ''.$langs->trans('MigrationUsersSocialNetworks')."
\n"; + print ''.$langs->trans('MigrationFieldsSocialNetworks', 'Users')."
\n"; print '
'; } @@ -5121,7 +5121,7 @@ function migrate_members_socialnetworks() dol_print_error($db); $db->rollback(); } - print ''.$langs->trans('MigrationMembersSocialNetworks')."
\n"; + print ''.$langs->trans('MigrationFieldsSocialNetworks', 'Members')."
\n"; print ''; } @@ -5216,7 +5216,7 @@ function migrate_contacts_socialnetworks() dol_print_error($db); $db->rollback(); } - print ''.$langs->trans('MigrationContactsSocialNetworks')."
\n"; + print ''.$langs->trans('MigrationFieldsSocialNetworks', 'Contacts')."
\n"; print ''; } @@ -5306,6 +5306,6 @@ function migrate_thirdparties_socialnetworks() dol_print_error($db); $db->rollback(); } - print ''.$langs->trans('MigrationThirdpartiesSocialNetworks')."
\n"; + print ''.$langs->trans('MigrationFieldsSocialNetworks', 'Thirdparties')."
\n"; print ''; } diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index cfd95d879b7..708b3bac479 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -205,10 +205,7 @@ MigrationRemiseExceptEntity=Update entity field value of llx_societe_remise_exce MigrationUserRightsEntity=Update entity field value of llx_user_rights MigrationUserGroupRightsEntity=Update entity field value of llx_usergroup_rights MigrationUserPhotoPath=Migration of photo paths for users -MigrationUsersSocialNetworks=Migration of users fields social networks -MigrationMembersSocialNetworks=Migration of members fields social networks -MigrationContactsSocialNetworks=Migration of contacts fields social networks -MigrationThirdpartiesSocialNetworks=Migration of thirdparties fields social networks +MigrationFieldsSocialNetworks=Migration of users fields social networks (%s) MigrationReloadModule=Reload module %s MigrationResetBlockedLog=Reset module BlockedLog for v7 algorithm ShowNotAvailableOptions=Show unavailable options diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 26199b90d0b..d35ca0130cb 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -3059,9 +3059,10 @@ if ($action == 'editmeta' || $action == 'createcontainer') } elseif ($result > 0) { - $translationof = $sourcepage->id; + $translationof = 0; + //$translationof = $sourcepage->id; print ''.$langs->trans('ThisPageIsTranslationOf').' '; - print $formwebsite->selectContainer($website, 'pageidfortranslation', $sourcepage->id, 1, $action); + print $formwebsite->selectContainer($website, 'pageidfortranslation', $translationof, 1, $action, 'minwidth300'); } } print ''; From 4340f85e3c50aadeb62473ff2233842907fcf5e1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 01:22:13 +0100 Subject: [PATCH 22/36] Add warning --- htdocs/compta/paiement/cheque/card.php | 18 ++++++++++-------- htdocs/langs/en_US/errors.lang | 3 ++- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 72de78e5d9f..9388fbcdd1f 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -678,19 +678,12 @@ else print_liste_field_titre("LineRecord", $_SERVER["PHP_SELF"], "b.rowid", "", $param, 'align="center"', $sortfield, $sortorder); print_liste_field_titre(''); print "\n"; - $i = 1; + $i = 1; if ($num > 0) { while ($objp = $db->fetch_object($resql)) { - //$account_id = $objp->bid; FIXME not used - - // FIXME $accounts[$objp->bid] is a label - /*if (! isset($accounts[$objp->bid])) - $accounts[$objp->bid]=0; - $accounts[$objp->bid] += 1;*/ - print ''; print ''; print ''; // Date operation @@ -751,6 +744,15 @@ else } print "
'.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'
'.$langs->trans("Currency".strtoupper($cpt['pending'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'
'.$langs->trans("Currency".strtoupper($cpt['pending'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'
'.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).'
'.$langs->trans("TopMenuBackgroundColor").'
'.$langs->trans("LeftMenuBackgroundColor").'
'.$langs->trans("TextTitleColor").''; @@ -652,7 +656,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 643c14) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$langs->trans("BackgroundTableTitleColor").''; @@ -677,7 +683,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': f0f0f0) '; // $colorbacktitle1 in CSS + print '   ('.$langs->trans("Default").': '.$default.') '; // $colorbacktitle1 in CSS print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$langs->trans("BackgroundTableTitleTextColor").''; @@ -702,7 +710,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } - print '   ('.$langs->trans("Default").': 000000) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$langs->trans("BackgroundTableLineOddColor").'
'.$langs->trans("BackgroundTableLineEvenColor").'
'.$langs->trans("LinkColor").''; @@ -812,7 +820,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print $langs->trans("Default"); } } - print '   ('.$langs->trans("Default").': 000078) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$langs->trans("HighlightLinesColor").''; @@ -841,22 +851,22 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) //print '   ('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; if ($edit) { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover)); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' '; } else { - if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color='e6edf0'; + if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color=colorArrayToHex(colorStringToArray($colorbacklinepairhover)); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); if ($color) { - if ($color != 'e6edf0') print ''; + if ($color != colorArrayToHex(colorStringToArray($colorbacklinepairhover))) print ''; else print $langs->trans("Default"); } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': e6edf0) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$langs->trans("HighlightLinesChecked").''; @@ -900,7 +912,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) } else print $langs->trans("Default"); } - print '   ('.$langs->trans("Default").': e6edf0) '; + print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; print '
'.$i.''.dol_print_date($db->jdate($objp->date), 'day').'
"; + + // Cheque denormalized data nbcheque is similar to real number of cheque + if ($num > 0 && $i < ($object->nbcheque + 1)) { + // Show warning that some records were removed. + $langs->load("errors"); + print info_admin($langs->trans("WarningSomeBankTransactionByChequeWereRemovedAfter"), 0, 0, 'warning'); + // TODO Fix data ->nbcheque and ->amount + } + print "
"; } else diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 2b23fc6d19e..53f9e57fceb 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -247,4 +247,5 @@ WarningYourLoginWasModifiedPleaseLogin=Your login was modified. For security pur WarningAnEntryAlreadyExistForTransKey=An entry already exists for the translation key for this language WarningNumberOfRecipientIsRestrictedInMassAction=Warning, number of different recipient is limited to %s when using the mass actions on lists WarningDateOfLineMustBeInExpenseReportRange=Warning, the date of line is not in the range of the expense report -WarningProjectClosed=Project is closed. You must re-open it first. \ No newline at end of file +WarningProjectClosed=Project is closed. You must re-open it first. +WarningSomeBankTransactionByChequeWereRemovedAfter=Some bank transaction were removed after that the receipt including them were generated. So nb of cheques and total of receipt may differ from number and total in list. \ No newline at end of file From ec0d5602f8f04952181bd1afe437b512a1c66fd1 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 02:05:11 +0100 Subject: [PATCH 23/36] Fix log --- htdocs/stripe/class/stripe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 7edccbfeeb7..5f8e264e9ab 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -178,7 +178,7 @@ class Stripe extends CommonObject global $stripearrayofkeysbyenv; \Stripe\Stripe::setApiKey($stripearrayofkeysbyenv[$status]['secret_key']); - dol_syslog(get_class($this)."::customerStripe found stripe customer key_account = ".$tiers." with publishable_key = ".$stripearrayofkeysbyenv[$status]['publishable_key']); + dol_syslog(get_class($this)."::customerStripe found stripe customer key_account = ".$tiers.". We will try to read it on Stripe with publishable_key = ".$stripearrayofkeysbyenv[$status]['publishable_key']); try { if (empty($key)) { // If the Stripe connect account not set, we use common API usage From 39229b7a99d872e54597bfe9e520788d2df0fd35 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 02:21:23 +0100 Subject: [PATCH 24/36] Fix css --- htdocs/theme/eldy/global.inc.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 05e7919d764..2af18e3f3e0 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2120,9 +2120,9 @@ img.login, img.printer, img.entity { background-size: contain; } img.userphoto { /* size for user photo in lists */ - border-radius: 0.75em; - width: 1.5em; - height: 1.5em; + border-radius: 0.725em; + width: 1.45em; + height: 1.45em; background-size: contain; vertical-align: middle; } From c4c463fb96eb9a207db5a3ac684cafc99b0f807d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric?= <35066297+c3do@users.noreply.github.com> Date: Wed, 13 Nov 2019 11:36:42 +0100 Subject: [PATCH 25/36] camelCaps --- htdocs/categories/class/api_categories.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 36b3e10174a..0f2a425fe87 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -277,7 +277,7 @@ class Categories extends DolibarrApi * * @url POST {id}/objects/{type}/{object_id} */ - public function link_object_by_id($id, $type, $object_id) + public function linkObjectById($id, $type, $object_id) { if (empty($type) || empty($object_id)) { throw new RestException(401); @@ -338,7 +338,7 @@ class Categories extends DolibarrApi * * @url POST {id}/objects/{type}/ref/{object_ref} */ - public function link_object_by_ref($id, $type, $object_ref) + public function linkObjectByRef($id, $type, $object_ref) { if (empty($type) || empty($object_ref)) { throw new RestException(401); @@ -399,7 +399,7 @@ class Categories extends DolibarrApi * * @url DELETE {id}/objects/{type}/{object_id} */ - public function unlink_object_by_id($id, $type, $object_id) + public function unlinkObjectById($id, $type, $object_id) { if (empty($type) || empty($object_id)) { throw new RestException(401); @@ -458,7 +458,7 @@ class Categories extends DolibarrApi * * @url DELETE {id}/objects/{type}/ref/{object_ref} */ - public function unlink_object_by_ref($id, $type, $object_ref) + public function unlinkObjectByRef($id, $type, $object_ref) { if (empty($type) || empty($object_ref)) { throw new RestException(401); From 5d42ef323e6419d0135d12697f1c3fd6a4522b2b Mon Sep 17 00:00:00 2001 From: Francis Appels Date: Wed, 13 Nov 2019 15:13:56 +0100 Subject: [PATCH 26/36] Fix Printsheet product selector --- htdocs/barcode/printsheet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/barcode/printsheet.php b/htdocs/barcode/printsheet.php index 1ed7c449868..7c055855ffc 100644 --- a/htdocs/barcode/printsheet.php +++ b/htdocs/barcode/printsheet.php @@ -380,7 +380,7 @@ if (! empty($user->rights->produit->lire) || ! empty($user->rights->service->lir print ' '.$langs->trans("FillBarCodeTypeAndValueFromProduct").'   '; print '
'; print '
'; - $form->select_produits(GETPOST('productid'), 'productid', ''); + $form->select_produits(GETPOST('productid'), 'productid', '', '', 0, -1, 2, '', 0, array(), 0, '1', 0, 'minwidth400imp', 1); print '   '; print '
'; } From bdf02199411c9e6ef45c1b184d2219733c86a977 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 18:18:45 +0100 Subject: [PATCH 27/36] Missing link to create contact Fix css --- htdocs/core/tpl/contacts.tpl.php | 16 +++++++++++----- htdocs/theme/md/style.css.php | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index 821881314d3..2f4efae770a 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -127,7 +127,16 @@ if ($permission) { selectCompaniesForNewContact($object, 'id', $selectedCompany, 'newcompany', '', 0, '', 'minwidth300imp'); ?>
-
+
trans("User"); ?> trans("ThirdPartyContact"); ?> diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index fff500fba1b..792d93dbcf6 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2738,7 +2738,7 @@ div.colorback border-left: 1px solid #ccc; } table.liste, table.noborder, table.formdoc, div.noborder { - width: 100%; + width: calc(100% - 1px); /* -1 to fix a bug. Without, a scroll appears dur to overflow-x: auto; of div-tableèresponsive border-collapse: separate !important; border-spacing: 0px; From 7118dbbd1d510c55eb58b2d2b02516bcfc75a4ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 18:25:48 +0100 Subject: [PATCH 28/36] Fix var not defined --- htdocs/core/lib/usergroups.lib.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index eeaa4d4d6ce..44829cc9758 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -420,6 +420,18 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; + // Set variables of theme + $colorbackhmenu1 = ''; + $colorbackvmenu1 = ''; + $colortexttitlenotab = ''; + $colorbacktitle1 = ''; + $colortexttitle = ''; + $colorbacklineimpair1 = ''; + $colorbacklinepair1 = ''; + $colortextlink = ''; + $colorbacklinepairhover = ''; + $colorbacklinepairhover = ''; + $colorbacklinepairchecked = ''; if (file_exists(DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php')) { include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; } From c66bce7ec6a241b39a5369e7b0e17e879e5de3eb Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Wed, 13 Nov 2019 17:31:18 +0000 Subject: [PATCH 29/36] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- .../sociales/class/chargesociales.class.php | 170 +++++++++--------- htdocs/core/modules/modBom.class.php | 54 +++--- 2 files changed, 112 insertions(+), 112 deletions(-) diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 2bc82fc8b78..fecc5a96aa1 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -35,14 +35,14 @@ class ChargeSociales extends CommonObject /** * @var string ID to identify managed object */ - public $element='chargesociales'; + public $element = 'chargesociales'; - public $table='chargesociales'; + public $table = 'chargesociales'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='chargesociales'; + public $table_element = 'chargesociales'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -175,7 +175,7 @@ class ChargeSociales extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } } @@ -187,10 +187,10 @@ class ChargeSociales extends CommonObject */ public function check() { - $newamount=price2num($this->amount, 'MT'); + $newamount = price2num($this->amount, 'MT'); // Validation parametres - if (! $newamount > 0 || empty($this->date_ech) || empty($this->periode)) + if (!$newamount > 0 || empty($this->date_ech) || empty($this->periode)) { return false; } @@ -208,55 +208,55 @@ class ChargeSociales extends CommonObject public function create($user) { global $conf; - $error=0; + $error = 0; - $now=dol_now(); + $now = dol_now(); // Nettoyage parametres - $newamount=price2num($this->amount, 'MT'); + $newamount = price2num($this->amount, 'MT'); if (!$this->check()) { - $this->error="ErrorBadParameter"; + $this->error = "ErrorBadParameter"; return -2; } $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."chargesociales (fk_type, fk_account, fk_mode_reglement, libelle, date_ech, periode, amount, fk_projet, entity, fk_user_author, date_creation)"; - $sql.= " VALUES (".$this->type; - $sql.= ", ".($this->fk_account>0 ? $this->fk_account:'NULL'); - $sql.= ", ".($this->mode_reglement_id>0 ? $this->mode_reglement_id:"NULL"); - $sql.= ", '".$this->db->escape($this->label?$this->label:$this->lib)."'"; - $sql.= ", '".$this->db->idate($this->date_ech)."'"; - $sql.= ", '".$this->db->idate($this->periode)."'"; - $sql.= ", '".price2num($newamount)."'"; - $sql.= ", ".($this->fk_project>0?$this->fk_project:'NULL'); - $sql.= ", ".$conf->entity; - $sql.= ", ".$user->id; - $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ")"; + $sql .= " VALUES (".$this->type; + $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); + $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : "NULL"); + $sql .= ", '".$this->db->escape($this->label ? $this->label : $this->lib)."'"; + $sql .= ", '".$this->db->idate($this->date_ech)."'"; + $sql .= ", '".$this->db->idate($this->periode)."'"; + $sql .= ", '".price2num($newamount)."'"; + $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : 'NULL'); + $sql .= ", ".$conf->entity; + $sql .= ", ".$user->id; + $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $this->id=$this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); + $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."chargesociales"); //dol_syslog("ChargesSociales::create this->id=".$this->id); - $result=$this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user); + $result = $this->call_trigger('SOCIALCONTRIBUTION_CREATE', $user); if ($result < 0) $error++; - if(empty($error)) { + if (empty($error)) { $this->db->commit(); return $this->id; } else { $this->db->rollback(); - return -1*$error; + return -1 * $error; } } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); $this->db->rollback(); return -1; } @@ -271,23 +271,23 @@ class ChargeSociales extends CommonObject */ public function delete($user) { - $error=0; + $error = 0; $this->db->begin(); // Get bank transaction lines for this social contributions include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; - $account=new Account($this->db); - $lines_url=$account->get_url('', $this->id, 'sc'); + $account = new Account($this->db); + $lines_url = $account->get_url('', $this->id, 'sc'); // Delete bank urls foreach ($lines_url as $line_url) { - if (! $error) + if (!$error) { - $accountline=new AccountLine($this->db); + $accountline = new AccountLine($this->db); $accountline->fetch($line_url['fk_bank']); - $result=$accountline->delete_urls($user); + $result = $accountline->delete_urls($user); if ($result < 0) { $error++; @@ -296,31 +296,31 @@ class ChargeSociales extends CommonObject } // Delete payments - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."paiementcharge WHERE fk_charge=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { $error++; - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."chargesociales WHERE rowid=".$this->id; dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { $error++; - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); } } - if (! $error) + if (!$error) { $this->db->commit(); return 1; @@ -342,31 +342,31 @@ class ChargeSociales extends CommonObject */ public function update($user, $notrigger = 0) { - $error=0; + $error = 0; $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; - $sql.= " SET libelle='".$this->db->escape($this->label?$this->label:$this->lib)."'"; - $sql.= ", date_ech='".$this->db->idate($this->date_ech)."'"; - $sql.= ", periode='".$this->db->idate($this->periode)."'"; - $sql.= ", amount='".price2num($this->amount, 'MT')."'"; - $sql.= ", fk_projet=".($this->fk_project>0?$this->db->escape($this->fk_project):"NULL"); - $sql.= ", fk_user_modif=".$user->id; - $sql.= " WHERE rowid=".$this->id; + $sql .= " SET libelle='".$this->db->escape($this->label ? $this->label : $this->lib)."'"; + $sql .= ", date_ech='".$this->db->idate($this->date_ech)."'"; + $sql .= ", periode='".$this->db->idate($this->periode)."'"; + $sql .= ", amount='".price2num($this->amount, 'MT')."'"; + $sql .= ", fk_projet=".($this->fk_project > 0 ? $this->db->escape($this->fk_project) : "NULL"); + $sql .= ", fk_user_modif=".$user->id; + $sql .= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); - if (! $resql) { - $error++; $this->errors[]="Error ".$this->db->lasterror(); + if (!$resql) { + $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('SOCIALCHARGES_MODIFY', $user); + $result = $this->call_trigger('SOCIALCHARGES_MODIFY', $user); if ($result < 0) $error++; // End call triggers } @@ -375,13 +375,13 @@ class ChargeSociales extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -401,9 +401,9 @@ class ChargeSociales extends CommonObject global $conf; $sql = "SELECT SUM(f.amount) as amount"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as f"; - $sql.= " WHERE f.entity = ".$conf->entity; - $sql.= " AND paye = 0"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as f"; + $sql .= " WHERE f.entity = ".$conf->entity; + $sql .= " AND paye = 0"; if ($year) { $sql .= " AND f.datev >= '$y-01-01' AND f.datev <= '$y-12-31' "; @@ -441,8 +441,8 @@ class ChargeSociales extends CommonObject { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; - $sql.= " paye = 1"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " paye = 1"; + $sql .= " WHERE rowid = ".$this->id; $return = $this->db->query($sql); if ($return) return 1; else return -1; @@ -459,8 +459,8 @@ class ChargeSociales extends CommonObject { // phpcs:enable $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales SET"; - $sql.= " paye = 0"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " paye = 0"; + $sql .= " WHERE rowid = ".$this->id; $return = $this->db->query($sql); if ($return) return 1; else return -1; @@ -549,9 +549,9 @@ class ChargeSociales extends CommonObject { global $langs, $conf, $user, $form; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $result=''; + $result = ''; $url = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id; @@ -607,20 +607,20 @@ class ChargeSociales extends CommonObject */ public function getSommePaiement() { - $table='paiementcharge'; - $field='fk_charge'; + $table = 'paiementcharge'; + $field = 'fk_charge'; $sql = 'SELECT sum(amount) as amount'; - $sql.= ' FROM '.MAIN_DB_PREFIX.$table; - $sql.= ' WHERE '.$field.' = '.$this->id; + $sql .= ' FROM '.MAIN_DB_PREFIX.$table; + $sql .= ' WHERE '.$field.' = '.$this->id; dol_syslog(get_class($this)."::getSommePaiement", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $amount=0; + $amount = 0; $obj = $this->db->fetch_object($resql); - if ($obj) $amount=$obj->amount?$obj->amount:0; + if ($obj) $amount = $obj->amount ? $obj->amount : 0; $this->db->free($resql); return $amount; @@ -640,12 +640,12 @@ class ChargeSociales extends CommonObject public function info($id) { $sql = "SELECT e.rowid, e.tms as datem, e.date_creation as datec, e.date_valid as datev, e.import_key,"; - $sql.= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; - $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; - $sql.= " WHERE e.rowid = ".$id; + $sql .= " e.fk_user_author, e.fk_user_modif, e.fk_user_valid"; + $sql .= " FROM ".MAIN_DB_PREFIX."chargesociales as e"; + $sql .= " WHERE e.rowid = ".$id; dol_syslog(get_class($this)."::info", LOG_DEBUG); - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) @@ -696,14 +696,14 @@ class ChargeSociales extends CommonObject public function initAsSpecimen() { // Initialize parameters - $this->id=0; + $this->id = 0; $this->ref = 'SPECIMEN'; - $this->specimen=1; + $this->specimen = 1; $this->paye = 0; $this->date = dol_now(); - $this->date_ech=$this->date+3600*24*30; - $this->periode=$this->date+3600*24*30; - $this->amount=100; + $this->date_ech = $this->date + 3600 * 24 * 30; + $this->periode = $this->date + 3600 * 24 * 30; + $this->amount = 100; $this->label = 'Social contribution label'; $this->type = 1; $this->type_label = 'Type of social contribution'; diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 714e15f0ee9..362e0c445ee 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -25,7 +25,7 @@ * \ingroup bom * \brief Description and activation file for module Bom */ -include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php'; +include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php'; /** @@ -75,7 +75,7 @@ class modBom extends DolibarrModules // Name of image file used for this module. // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' - $this->picto='bom'; + $this->picto = 'bom'; // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( @@ -103,15 +103,15 @@ class modBom extends DolibarrModules $this->config_page_url = array("bom.php"); // Dependencies - $this->hidden = false; // A condition to hide module - $this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) - $this->requiredby = array('modMrp'); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) - $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) + $this->hidden = false; // A condition to hide module + $this->depends = array('modProduct'); // List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...) + $this->requiredby = array('modMrp'); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...) + $this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...) $this->langfiles = array("mrp"); //$this->phpmin = array(5,4); // Minimum version of PHP required by module - $this->need_dolibarr_version = array(9,0); // Minimum version of Dolibarr required by module - $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) - $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->need_dolibarr_version = array(9, 0); // Minimum version of Dolibarr required by module + $this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','ES'='textes'...) + $this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','ES'='textes'...) //$this->automatic_activation = array('FR'=>'BomWasAutomaticallyActivatedBecauseOfYourCountryChoice'); //$this->always_enabled = true; // If true, can't be disabled @@ -132,10 +132,10 @@ class modBom extends DolibarrModules 'fr_FR:ParentCompany'=>'Maison mère ou revendeur' )*/ - if (! isset($conf->bom) || ! isset($conf->bom->enabled)) + if (!isset($conf->bom) || !isset($conf->bom->enabled)) { - $conf->bom=new stdClass(); - $conf->bom->enabled=0; + $conf->bom = new stdClass(); + $conf->bom->enabled = 0; } @@ -281,28 +281,28 @@ class modBom extends DolibarrModules // Exports - $r=1; + $r = 1; /* BEGIN MODULEBUILDER EXPORT BILLOFMATERIALS */ $langs->load("mrp"); - $this->export_code[$r]=$this->rights_class.'_'.$r; - $this->export_label[$r]='BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) - $this->export_icon[$r]='bom'; - $keyforclass = 'BOM'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bom'; + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = 'BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r] = 'bom'; + $keyforclass = 'BOM'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforclass = 'BOMLine'; $keyforclassfile='/bom/class/bom.class.php'; $keyforelement='bomline'; $keyforalias='tl'; + $keyforclass = 'BOMLine'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bomline'; $keyforalias = 'tl'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; unset($this->export_fields_array[$r]['tl.fk_bom']); - $keyforselect ='bom_bom'; $keyforaliasextra='extra'; $keyforelement='bom'; + $keyforselect = 'bom_bom'; $keyforaliasextra = 'extra'; $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect ='bom_bomline'; $keyforaliasextra='extraline'; $keyforelement='bomline'; + $keyforselect = 'bom_bomline'; $keyforaliasextra = 'extraline'; $keyforelement = 'bomline'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $this->export_dependencies_array[$r]=array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) - $this->export_sql_start[$r]='SELECT DISTINCT '; - $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'bom_bom as t'; - $this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid'; - $this->export_sql_end[$r] .=' WHERE 1 = 1'; - $this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('bom').')'; + $this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'bom_bom as t'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bom_bomline as tl ON tl.fk_bom = t.rowid'; + $this->export_sql_end[$r] .= ' WHERE 1 = 1'; + $this->export_sql_end[$r] .= ' AND t.entity IN ('.getEntity('bom').')'; $r++; /* END MODULEBUILDER EXPORT BILLOFMATERIALS */ } @@ -319,7 +319,7 @@ class modBom extends DolibarrModules { global $conf, $langs; - $result=$this->_load_tables('/bom/sql/'); + $result = $this->_load_tables('/bom/sql/'); if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') // Create extrafields From 87585c0f2a040c6cc26545d22619c033dda6b707 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Wed, 13 Nov 2019 17:32:11 +0000 Subject: [PATCH 30/36] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/adherents/card.php | 630 ++++---- htdocs/core/actions_addupdatedelete.inc.php | 78 +- htdocs/core/class/CMailFile.class.php | 612 +++---- htdocs/expensereport/card.php | 706 ++++---- htdocs/install/check.php | 172 +- .../template/class/myobject.class.php | 144 +- htdocs/product/stock/productlot_card.php | 124 +- htdocs/projet/class/task.class.php | 1124 ++++++------- htdocs/reception/class/reception.class.php | 760 ++++----- htdocs/societe/card.php | 798 ++++----- htdocs/societe/class/societe.class.php | 1440 ++++++++--------- htdocs/societe/paymentmodes.php | 540 +++---- 12 files changed, 3564 insertions(+), 3564 deletions(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 417d4cd2c99..2a8177df6f2 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -43,19 +43,19 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Load translation files required by the page -$langs->loadLangs(array("companies","bills","members","users","other")); +$langs->loadLangs(array("companies", "bills", "members", "users", "other")); -$action=GETPOST('action', 'alpha'); -$cancel=GETPOST('cancel', 'alpha'); -$backtopage=GETPOST('backtopage', 'alpha'); -$confirm=GETPOST('confirm', 'alpha'); -$rowid=GETPOST('rowid', 'int'); -$id=GETPOST('id')?GETPOST('id', 'int'):$rowid; -$typeid=GETPOST('typeid', 'int'); -$userid=GETPOST('userid', 'int'); -$socid=GETPOST('socid', 'int'); +$action = GETPOST('action', 'alpha'); +$cancel = GETPOST('cancel', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); +$confirm = GETPOST('confirm', 'alpha'); +$rowid = GETPOST('rowid', 'int'); +$id = GETPOST('id') ?GETPOST('id', 'int') : $rowid; +$typeid = GETPOST('typeid', 'int'); +$userid = GETPOST('userid', 'int'); +$socid = GETPOST('socid', 'int'); -if (! empty($conf->mailmanspip->enabled)) +if (!empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; @@ -74,9 +74,9 @@ $socialnetworks = getArrayOfSocialNetworks(); // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($id); -$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=null; -if (! empty($canvas)) +$canvas = $object->canvas ? $object->canvas : GETPOST("canvas"); +$objcanvas = null; +if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); @@ -84,7 +84,7 @@ if (! empty($canvas)) } // Security check -$result=restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); +$result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); if ($id > 0) { @@ -92,28 +92,28 @@ if ($id > 0) $result = $object->fetch($id); // Define variables to know what current user can do on users - $canadduser=($user->admin || $user->rights->user->user->creer); + $canadduser = ($user->admin || $user->rights->user->user->creer); // Define variables to know what current user can do on properties of user linked to edited member if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member - $caneditfielduser=((($user->id == $object->user_id) && $user->rights->user->self->creer) + $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); - $caneditpassworduser=((($user->id == $object->user_id) && $user->rights->user->self->password) + $caneditpassworduser = ((($user->id == $object->user_id) && $user->rights->user->self->password) || (($user->id != $object->user_id) && $user->rights->user->user->password)); } } // Define variables to determine what the current user can do on the members -$canaddmember=$user->rights->adherent->creer; +$canaddmember = $user->rights->adherent->creer; // Define variables to determine what the current user can do on the properties of a member if ($id) { - $caneditfieldmember=$user->rights->adherent->creer; + $caneditfieldmember = $user->rights->adherent->creer; } // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('membercard','globalcard')); +$hookmanager->initHooks(array('membercard', 'globalcard')); @@ -121,25 +121,25 @@ $hookmanager->initHooks(array('membercard','globalcard')); * Actions */ -$parameters=array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'=>$confirm); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { if ($cancel) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action=''; + $action = ''; } if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { - $error=0; + $error = 0; if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only { if ($userid != $user->id && $userid != $object->user_id) @@ -149,47 +149,47 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { if ($userid != $object->user_id) // If link differs from currently in database { - $result=$object->setUserId($userid); + $result = $object->setUserId($userid); if ($result < 0) dol_print_error($object->db, $object->error); - $action=''; + $action = ''; } } } if ($action == 'setsocid') { - $error=0; - if (! $error) + $error = 0; + if (!$error) { if ($socid != $object->socid) // If link differs from currently in database { - $sql ="SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; - $sql.=" WHERE socid = '".$socid."'"; - $sql.=" AND entity = ".$conf->entity; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; + $sql .= " WHERE socid = '".$socid."'"; + $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); if ($obj && $obj->rowid > 0) { - $othermember=new Adherent($db); + $othermember = new Adherent($db); $othermember->fetch($obj->rowid); - $thirdparty=new Societe($db); + $thirdparty = new Societe($db); $thirdparty->fetch($socid); $error++; setEventMessages($langs->trans("ErrorMemberIsAlreadyLinkedToThisThirdParty", $othermember->getFullName($langs), $othermember->login, $thirdparty->name), null, 'errors'); } } - if (! $error) + if (!$error) { - $result=$object->setThirdPartyId($socid); + $result = $object->setThirdPartyId($socid); if ($result < 0) dol_print_error($object->db, $object->error); - $action=''; + $action = ''; } } } @@ -202,7 +202,7 @@ if (empty($reshook)) { // Creation user $nuser = new User($db); - $result=$nuser->create_from_member($object, GETPOST('login')); + $result = $nuser->create_from_member($object, GETPOST('login')); if ($result < 0) { @@ -223,7 +223,7 @@ if (empty($reshook)) { // User creation $company = new Societe($db); - $result=$company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); + $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); if ($result < 0) { @@ -238,29 +238,29 @@ if (empty($reshook)) } } - if ($action == 'update' && ! $cancel && $user->rights->adherent->creer) + if ($action == 'update' && !$cancel && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $birthdate=''; + $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } - $lastname=$_POST["lastname"]; - $firstname=$_POST["firstname"]; + $lastname = $_POST["lastname"]; + $firstname = $_POST["firstname"]; $gender = $_POST["gender"]; - $societe=$_POST["societe"]; - $morphy=$_POST["morphy"]; - $login=$_POST["login"]; + $societe = $_POST["societe"]; + $morphy = $_POST["morphy"]; + $login = $_POST["login"]; if ($morphy != 'mor' && empty($lastname)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); } - if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); @@ -279,7 +279,7 @@ if (empty($reshook)) } } // Create new object - if ($result > 0 && ! $error) + if ($result > 0 && !$error) { $object->oldcopy = clone $object; @@ -291,7 +291,7 @@ if (empty($reshook)) $object->login = trim(GETPOST("login", 'alpha')); $object->pass = trim(GETPOST("pass", 'alpha')); - $object->societe = trim(GETPOST("societe", 'alpha')); // deprecated + $object->societe = trim(GETPOST("societe", 'alpha')); // deprecated $object->company = trim(GETPOST("societe", 'alpha')); $object->address = trim(GETPOST("address", 'alpha')); @@ -302,11 +302,11 @@ if (empty($reshook)) $object->phone = trim(GETPOST("phone", 'alpha')); $object->phone_perso = trim(GETPOST("phone_perso", 'alpha')); - $object->phone_mobile= trim(GETPOST("phone_mobile", 'alpha')); + $object->phone_mobile = trim(GETPOST("phone_mobile", 'alpha')); $object->email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); $object->socialnetworks = array(); foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = trim(GETPOST($key, 'alphanohtml')); } } @@ -320,8 +320,8 @@ if (empty($reshook)) //$object->note = trim(GETPOST("comment","alpha")); $object->morphy = GETPOST("morphy", 'alpha'); - if (GETPOST('deletephoto', 'alpha')) $object->photo=''; - elseif (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); + if (GETPOST('deletephoto', 'alpha')) $object->photo = ''; + elseif (!empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Get status and public property $object->statut = GETPOST("statut", 'alpha'); @@ -332,36 +332,36 @@ if (empty($reshook)) if ($ret < 0) $error++; // Check if we need to also synchronize user information - $nosyncuser=0; + $nosyncuser = 0; if ($object->user_id) // If linked to a user { - if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser=1; // Disable synchronizing + if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser = 1; // Disable synchronizing } // Check if we need to also synchronize password information - $nosyncuserpass=0; + $nosyncuserpass = 0; if ($object->user_id) // If linked to a user { - if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass=1; // Disable synchronizing + if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing } - $result=$object->update($user, 0, $nosyncuser, $nosyncuserpass); + $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { $categories = GETPOST('memcats', 'array'); $object->setCategories($categories); // Logo/Photo save - $dir= $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; + $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if ($file_OK) { if (GETPOST('deletephoto')) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $fileimg=$conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; - $dirthumbs=$conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; + $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } @@ -372,8 +372,8 @@ if (empty($reshook)) if (@is_dir($dir)) { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - if (! dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } @@ -391,7 +391,7 @@ if (empty($reshook)) } else { - switch($_FILES['photo']['error']) + switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form @@ -403,11 +403,11 @@ if (empty($reshook)) } } - $rowid=$object->id; - $id=$object->id; - $action=''; + $rowid = $object->id; + $id = $object->id; + $action = ''; - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -416,67 +416,67 @@ if (empty($reshook)) else { setEventMessages($object->error, $object->errors, 'errors'); - $action=''; + $action = ''; } } else { - $action='edit'; + $action = 'edit'; } } if ($action == 'add' && $user->rights->adherent->creer) { - if ($canvas) $object->canvas=$canvas; - $birthdate=''; + if ($canvas) $object->canvas = $canvas; + $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] && isset($_POST["birthyear"]) && $_POST["birthyear"]) { - $birthdate=dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); + $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } - $datesubscription=''; + $datesubscription = ''; if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) { - $datesubscription=dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); + $datesubscription = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } - $typeid=GETPOST("typeid", 'int'); - $civility_id=GETPOST("civility_id", 'alpha'); - $lastname=GETPOST("lastname", 'alpha'); - $firstname=GETPOST("firstname", 'alpha'); - $gender=GETPOST("gender", 'alpha'); - $societe=GETPOST("societe", 'alpha'); - $address=GETPOST("address", 'alpha'); - $zip=GETPOST("zipcode", 'alpha'); - $town=GETPOST("town", 'alpha'); - $state_id=GETPOST("state_id", 'int'); - $country_id=GETPOST("country_id", 'int'); + $typeid = GETPOST("typeid", 'int'); + $civility_id = GETPOST("civility_id", 'alpha'); + $lastname = GETPOST("lastname", 'alpha'); + $firstname = GETPOST("firstname", 'alpha'); + $gender = GETPOST("gender", 'alpha'); + $societe = GETPOST("societe", 'alpha'); + $address = GETPOST("address", 'alpha'); + $zip = GETPOST("zipcode", 'alpha'); + $town = GETPOST("town", 'alpha'); + $state_id = GETPOST("state_id", 'int'); + $country_id = GETPOST("country_id", 'int'); - $phone=GETPOST("phone", 'alpha'); - $phone_perso=GETPOST("phone_perso", 'alpha'); - $phone_mobile=GETPOST("phone_mobile", 'alpha'); + $phone = GETPOST("phone", 'alpha'); + $phone_perso = GETPOST("phone_perso", 'alpha'); + $phone_mobile = GETPOST("phone_mobile", 'alpha'); // $skype=GETPOST("member_skype", 'alpha'); // $twitter=GETPOST("member_twitter", 'alpha'); // $facebook=GETPOST("member_facebook", 'alpha'); // $linkedin=GETPOST("member_linkedin", 'alpha'); - $email=preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); - $login=GETPOST("member_login", 'alpha'); - $pass=GETPOST("password", 'alpha'); - $photo=GETPOST("photo", 'alpha'); + $email = preg_replace('/\s+/', '', GETPOST("member_email", 'alpha')); + $login = GETPOST("member_login", 'alpha'); + $pass = GETPOST("password", 'alpha'); + $photo = GETPOST("photo", 'alpha'); //$comment=GETPOST("comment",'none'); - $morphy=GETPOST("morphy", 'alpha'); - $subscription=GETPOST("subscription", 'alpha'); - $public=GETPOST("public", 'alpha'); + $morphy = GETPOST("morphy", 'alpha'); + $subscription = GETPOST("subscription", 'alpha'); + $public = GETPOST("public", 'alpha'); - $userid=GETPOST("userid", 'int'); - $socid=GETPOST("socid", 'int'); + $userid = GETPOST("userid", 'int'); + $socid = GETPOST("socid", 'int'); $object->civility_id = $civility_id; $object->firstname = $firstname; $object->lastname = $lastname; $object->gender = $gender; - $object->societe = $societe; // deprecated + $object->societe = $societe; // deprecated $object->company = $societe; $object->address = $address; $object->zip = $zip; @@ -485,11 +485,11 @@ if (empty($reshook)) $object->country_id = $country_id; $object->phone = $phone; $object->phone_perso = $phone_perso; - $object->phone_mobile= $phone_mobile; + $object->phone_mobile = $phone_mobile; $object->socialnetworks = array(); - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST("member_".$key, 'alphanohtml'); } } @@ -509,7 +509,7 @@ if (empty($reshook)) //$object->note = $comment; $object->morphy = $morphy; $object->user_id = $userid; - $object->socid = $socid; + $object->socid = $socid; $object->public = $public; // Fill array 'array_options' with data from add form @@ -555,29 +555,29 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Lastname")), null, 'errors'); } - if ($morphy != 'mor' && (!isset($firstname) || $firstname=='')) { + if ($morphy != 'mor' && (!isset($firstname) || $firstname == '')) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Firstname")), null, 'errors'); } - if (! ($typeid > 0)) { // Keep () before ! + if (!($typeid > 0)) { // Keep () before ! $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); } - if ($conf->global->ADHERENT_MAIL_REQUIRED && ! isValidEMail($email)) { + if ($conf->global->ADHERENT_MAIL_REQUIRED && !isValidEMail($email)) { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); } - $public=0; - if (isset($public)) $public=1; + $public = 0; + if (isset($public)) $public = 1; - if (! $error) + if (!$error) { $db->begin(); // Email about right and login does not exist - $result=$object->create($user); + $result = $object->create($user); if ($result > 0) { // Foundation categories @@ -585,9 +585,9 @@ if (empty($reshook)) $object->setCategories($memcats); $db->commit(); - $rowid=$object->id; - $id=$object->id; - $action=''; + $rowid = $object->id; + $id = $object->id; + $action = ''; } else { @@ -609,10 +609,10 @@ if (empty($reshook)) if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { - $result=$object->delete($id, $user); + $result = $object->delete($id, $user); if ($result > 0) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -625,44 +625,44 @@ if (empty($reshook)) } else { - $errmesg=$object->error; + $errmesg = $object->error; } } if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { - $error=0; + $error = 0; $db->begin(); $adht = new AdherentType($db); $adht->fetch($object->typeid); - $result=$object->validate($user); + $result = $object->validate($user); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { // Send confirmation email (according to parameters of member type. Otherwise generic) if ($object->email && GETPOST("send_mail")) { $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; @@ -674,14 +674,14 @@ if (empty($reshook)) $error++; } else { - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -700,7 +700,7 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { $db->commit(); } @@ -708,7 +708,7 @@ if (empty($reshook)) { $db->rollback(); } - $action=''; + $action = ''; } if ($user->rights->adherent->supprimer && $action == 'confirm_resign') @@ -720,30 +720,30 @@ if (empty($reshook)) $adht = new AdherentType($db); $adht->fetch($object->typeid); - $result=$object->resiliate($user); + $result = $object->resiliate($user); - if ($result >= 0 && ! count($object->errors)) + if ($result >= 0 && !count($object->errors)) { if ($object->email && GETPOST("send_mail")) { $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; @@ -755,14 +755,14 @@ if (empty($reshook)) $error++; } else { - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); + $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -780,10 +780,10 @@ if (empty($reshook)) } else { setEventMessages($object->error, $object->errors, 'errors'); } - $action=''; + $action = ''; } } - if (! empty($backtopage) && ! $error) + if (!empty($backtopage) && !$error) { header("Location: ".$backtopage); exit; @@ -793,7 +793,7 @@ if (empty($reshook)) // SPIP Management if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { - if (! count($object->errors)) + if (!count($object->errors)) { if (!$mailmanspip->del_to_spip($object)) { @@ -804,7 +804,7 @@ if (empty($reshook)) if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') { - if (! count($object->errors)) + if (!count($object->errors)) { if (!$mailmanspip->add_to_spip($object)) { @@ -818,14 +818,14 @@ if (empty($reshook)) // Actions to build doc $upload_dir = $conf->adherent->dir_output; - $permissiontoadd=$user->rights->adherent->creer; + $permissiontoadd = $user->rights->adherent->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; // Actions to send emails - $trigger_name='MEMBER_SENTBYMAIL'; - $paramname='id'; - $mode='emailfrommember'; - $trackid='mem'.$object->id; + $trigger_name = 'MEMBER_SENTBYMAIL'; + $paramname = 'id'; + $mode = 'emailfrommember'; + $trackid = 'mem'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -838,11 +838,11 @@ $form = new Form($db); $formfile = new FormFile($db); $formcompany = new FormCompany($db); -$title=$langs->trans("Member") . " - " . $langs->trans("Card"); -$help_url='EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; +$title = $langs->trans("Member")." - ".$langs->trans("Card"); +$help_url = 'EN:Module_Foundations|FR:Module_Adhérents|ES:Módulo_Miembros'; llxHeader('', $title, $help_url); -$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { @@ -852,11 +852,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if (empty($object->error) && $id) { $object = new Adherent($db); - $result=$object->fetch($id); + $result = $object->fetch($id); if ($result <= 0) dol_print_error('', $object->error); } - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates - $objcanvas->display_canvas($action); // Show template + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template } else { @@ -871,23 +871,23 @@ else /* Creation mode */ /* */ /* ************************************************************************** */ - $object->canvas=$canvas; + $object->canvas = $canvas; $object->state_id = GETPOST('state_id', 'int'); // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id', 'int')?GETPOST('country_id', 'int'):$mysoc->country_id; + $object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id; if ($object->country_id) { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; + $tmparray = getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; } if (!empty($socid)) { $object = new Societe($db); if ($socid > 0) $object->fetch($socid); - if (! ($object->id > 0)) + if (!($object->id > 0)) { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); @@ -944,14 +944,14 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'" autofocus="autofocus">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'" autofocus="autofocus">'; } // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $generated_password=getRandomPassword(false); + $generated_password = getRandomPassword(false); print ''.$langs->trans("Password").''; print ''; print ''; @@ -959,10 +959,10 @@ else // Type print ''.$langs->trans("MemberType").''; - $listetype=$adht->liste_array(); + $listetype = $adht->liste_array(); if (count($listetype)) { - print $form->selectarray("typeid", $listetype, GETPOST('typeid', 'int')?GETPOST('typeid', 'int'):$typeid, count($listetype)>1?1:0); + print $form->selectarray("typeid", $listetype, GETPOST('typeid', 'int') ?GETPOST('typeid', 'int') : $typeid, count($listetype) > 1 ? 1 : 0); } else { print ''.$langs->trans("NoTypeDefinedGoToSetup").''; } @@ -972,51 +972,51 @@ else $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans("MemberNature")."\n"; - print $form->selectarray("morphy", $morphys, GETPOST('morphy', 'alpha')?GETPOST('morphy', 'alpha'):$object->morphy, 1); + print $form->selectarray("morphy", $morphys, GETPOST('morphy', 'alpha') ?GETPOST('morphy', 'alpha') : $object->morphy, 1); print "\n"; // Company - print ''.$langs->trans("Company").''; + print ''.$langs->trans("Company").''; // Civility print ''.$langs->trans("UserTitle").''; - print $formcompany->select_civility(GETPOST('civility_id', 'int')?GETPOST('civility_id', 'int'):$object->civility_id, 'civility_id').''; + print $formcompany->select_civility(GETPOST('civility_id', 'int') ?GETPOST('civility_id', 'int') : $object->civility_id, 'civility_id').''; print ''; // Lastname - print ''.$langs->trans("Lastname").''; + print ''.$langs->trans("Lastname").''; print ''; // Firstname - print ''.$langs->trans("Firstname").''; + print ''.$langs->trans("Firstname").''; print ''; // Gender print ''.$langs->trans("Gender").''; print ''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); + $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); print $form->selectarray('gender', $arraygender, GETPOST('gender'), 1); print ''; // EMail - print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').''; + print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').''; // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((GETPOST('zipcode', 'alphanohtml')?GETPOST('zipcode', 'alphanohtml'):$object->zip), 'zipcode', array('town','selectcountry_id','state_id'), 6); + print $formcompany->select_ziptown((GETPOST('zipcode', 'alphanohtml') ?GETPOST('zipcode', 'alphanohtml') : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print ' '; - print $formcompany->select_ziptown((GETPOST('town', 'alphanohtml')?GETPOST('town', 'alphanohtml'):$object->town), 'town', array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown((GETPOST('town', 'alphanohtml') ?GETPOST('town', 'alphanohtml') : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country - $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; + $object->country_id = $object->country_id ? $object->country_id : $mysoc->country_id; print ''.$langs->trans('Country').''; - print $form->select_country(GETPOST('country_id', 'alpha')?GETPOST('country_id', 'alpha'):$object->country_id, 'country_id'); + print $form->select_country(GETPOST('country_id', 'alpha') ?GETPOST('country_id', 'alpha') : $object->country_id, 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -1026,7 +1026,7 @@ else print ''.$langs->trans('State').''; if ($object->country_id) { - print $formcompany->select_state(GETPOST('state_id', 'int')?GETPOST('state_id', 'int'):$object->state_id, $object->country_code); + print $formcompany->select_state(GETPOST('state_id', 'int') ?GETPOST('state_id', 'int') : $object->state_id, $object->country_code); } else { @@ -1036,18 +1036,18 @@ else } // Pro phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").''; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").''; // Personal phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").''; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").''; // Mobile phone - print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; + print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").''; - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if (!$value['active']) break; - print ''.$langs->trans($value['label']).''; + print ''.$langs->trans($value['label']).''; } } @@ -1062,9 +1062,9 @@ else print "\n"; // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print '' .$form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; + print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, 'parent', null, null, 1); print $form->multiselectarray('memcats', $cate_arbo, GETPOST('memcats', 'array'), null, null, null, null, '100%'); print ""; @@ -1073,7 +1073,7 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; //Hooks here - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -1087,13 +1087,13 @@ else print '
'; print ''; print '  '; - if (! empty($backtopage)) + if (!empty($backtopage)) { print ''; } else { - print ''; + print ''; } print '
'; @@ -1108,11 +1108,11 @@ else * ********************************************/ - $res=$object->fetch($id); + $res = $object->fetch($id); if ($res < 0) { dol_print_error($db, $object->error); exit; } - $res=$object->fetch_optionals(); + $res = $object->fetch_optionals(); if ($res < 0) { dol_print_error($db); exit; } @@ -1121,11 +1121,11 @@ else $adht->fetch($object->typeid); // We set country_id, and country_code, country of the chosen country - $country=GETPOST('country', 'int'); + $country = GETPOST('country', 'int'); if (!empty($country) || $object->country_id) { - $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country)?$country:$object->country_id); - $resql=$db->query($sql); + $sql = "SELECT rowid, code, label from ".MAIN_DB_PREFIX."c_country where rowid = ".(!empty($country) ? $country : $object->country_id); + $resql = $db->query($sql); if ($resql) { $obj = $db->fetch_object($resql); @@ -1134,9 +1134,9 @@ else { dol_print_error($db); } - $object->country_id=$obj->rowid; - $object->country_code=$obj->code; - $object->country=$langs->trans("Country".$obj->code)?$langs->trans("Country".$obj->code):$obj->label; + $object->country_id = $obj->rowid; + $object->country_code = $obj->code; + $object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; } $head = member_prepare_head($object); @@ -1190,26 +1190,26 @@ else // Login if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; + print ''.$langs->trans("Login").' / '.$langs->trans("Id").'login).'">'; } // Password if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { - print ''.$langs->trans("Password").'pass).'">'; + print ''.$langs->trans("Password").'pass).'">'; } // Morphy $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); print ''.$langs->trans("MemberNature").''; - print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy")?GETPOST("morphy", 'alpha'):$object->morphy)); + print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy") ?GETPOST("morphy", 'alpha') : $object->morphy)); print ""; // Type print ''.$langs->trans("Type").''; if ($user->rights->adherent->creer) { - print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid")?GETPOST("typeid", 'int'):$object->typeid)); + print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ?GETPOST("typeid", 'int') : $object->typeid)); } else { @@ -1219,27 +1219,27 @@ else print ""; // Company - print ''.$langs->trans("Company").'company).'">'; + print ''.$langs->trans("Company").'company).'">'; // Civility print ''.$langs->trans("UserTitle").''; - print $formcompany->select_civility(isset($_POST["civility_id"])?$_POST["civility_id"]:$object->civility_id)."\n"; + print $formcompany->select_civility(isset($_POST["civility_id"]) ? $_POST["civility_id"] : $object->civility_id)."\n"; print ''; print ''; // Lastname - print ''.$langs->trans("Lastname").'lastname).'">'; + print ''.$langs->trans("Lastname").'lastname).'">'; print ''; // Firstname - print ''.$langs->trans("Firstname").'firstname).'">'; + print ''.$langs->trans("Firstname").'firstname).'">'; print ''; // Gender print ''.$langs->trans("Gender").''; print ''; - $arraygender=array('man'=>$langs->trans("Genderman"),'woman'=>$langs->trans("Genderwoman")); - print $form->selectarray('gender', $arraygender, GETPOST('gender')?GETPOST('gender'):$object->gender, 1); + $arraygender = array('man'=>$langs->trans("Genderman"), 'woman'=>$langs->trans("Genderwoman")); + print $form->selectarray('gender', $arraygender, GETPOST('gender') ?GETPOST('gender') : $object->gender, 1); print ''; // Photo @@ -1258,24 +1258,24 @@ else print ''; // EMail - print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED?'':'').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED?'':'').'email).'">'; + print ''.img_picto('', 'object_email').' '.($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').$langs->trans("EMail").($conf->global->ADHERENT_MAIL_REQUIRED ? '' : '').'email).'">'; // Address print ''.$langs->trans("Address").''; - print ''; + print ''; print ''; // Zip / Town print ''.$langs->trans("Zip").' / '.$langs->trans("Town").''; - print $formcompany->select_ziptown((isset($_POST["zipcode"])?GETPOST("zipcode", '', 2):$object->zip), 'zipcode', array('town','selectcountry_id','state_id'), 6); + print $formcompany->select_ziptown((isset($_POST["zipcode"]) ?GETPOST("zipcode", '', 2) : $object->zip), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6); print ' '; - print $formcompany->select_ziptown((isset($_POST["town"])?GETPOST("town", '', 2):$object->town), 'town', array('zipcode','selectcountry_id','state_id')); + print $formcompany->select_ziptown((isset($_POST["town"]) ?GETPOST("town", '', 2) : $object->town), 'town', array('zipcode', 'selectcountry_id', 'state_id')); print ''; // Country //$object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; // In edit mode we don't force to company country if not defined print ''.$langs->trans('Country').''; - print $form->select_country(isset($_POST["country_id"])?$_POST["country_id"]:$object->country_id, 'country_id'); + print $form->select_country(isset($_POST["country_id"]) ? $_POST["country_id"] : $object->country_id, 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -1283,23 +1283,23 @@ else if (empty($conf->global->MEMBER_DISABLE_STATE)) { print ''.$langs->trans('State').''; - print $formcompany->select_state($object->state_id, isset($_POST["country_id"])?GETPOST("country_id"):$object->country_id); + print $formcompany->select_state($object->state_id, isset($_POST["country_id"]) ?GETPOST("country_id") : $object->country_id); print ''; } // Pro phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'phone).'">'; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePro").'phone).'">'; // Personal phone - print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'phone_perso).'">'; + print ''.img_picto('', 'object_phoning').' '.$langs->trans("PhonePerso").'phone_perso).'">'; // Mobile phone - print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'phone_mobile).'">'; + print ''.img_picto('', 'object_phoning_mobile').' '.$langs->trans("PhoneMobile").'phone_mobile).'">'; - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if (!$value['active']) break; - print ''.$langs->trans($value['label']).''; + print ''.$langs->trans($value['label']).''; } } @@ -1310,13 +1310,13 @@ else // Public profil print "".$langs->trans("Public")."\n"; - print $form->selectyesno("public", (isset($_POST["public"])?GETPOST("public", '', 2):$object->public), 1); + print $form->selectyesno("public", (isset($_POST["public"]) ?GETPOST("public", '', 2) : $object->public), 1); print "\n"; // Categories - if (! empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print '' . $form->editfieldkey("Categories", 'memcats', '', $object, 0) . ''; + print ''.$form->editfieldkey("Categories", 'memcats', '', $object, 0).''; print ''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_MEMBER, null, null, null, null, 1); $c = new Categorie($db); @@ -1332,13 +1332,13 @@ else } // Third party Dolibarr - if (! empty($conf->societe->enabled)) + if (!empty($conf->societe->enabled)) { print ''.$langs->trans("LinkedToDolibarrThirdParty").''; if ($object->socid) { - $company=new Societe($db); - $result=$company->fetch($object->socid); + $company = new Societe($db); + $result = $company->fetch($object->socid); print $company->getNomUrl(1); } else @@ -1380,17 +1380,17 @@ else /* */ /* ************************************************************************** */ - $res=$object->fetch($id); + $res = $object->fetch($id); if ($res < 0) { dol_print_error($db, $object->error); exit; } - $res=$object->fetch_optionals(); + $res = $object->fetch_optionals(); if ($res < 0) { dol_print_error($db); exit; } $adht = new AdherentType($db); - $res=$adht->fetch($object->typeid); + $res = $adht->fetch($object->typeid); if ($res < 0) { dol_print_error($db); exit; } @@ -1406,24 +1406,24 @@ else // Confirm create user if ($action == 'create_user') { - $login=$object->login; + $login = $object->login; if (empty($login)) { // Full firstname and name separated with a dot : firstname.name include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - $login=dol_buildlogin($object->lastname, $object->firstname); + $login = dol_buildlogin($object->lastname, $object->firstname); } - if (empty($login)) $login=strtolower(substr($object->firstname, 0, 4)) . strtolower(substr($object->lastname, 0, 4)); + if (empty($login)) $login = strtolower(substr($object->firstname, 0, 4)).strtolower(substr($object->lastname, 0, 4)); // Create a form array - $formquestion=array( + $formquestion = array( array('label' => $langs->trans("LoginToCreate"), 'type' => 'text', 'name' => 'login', 'value' => $login) ); - $text=$langs->trans("ConfirmCreateLogin").'
'; - if (! empty($conf->societe->enabled)) + $text = $langs->trans("ConfirmCreateLogin").'
'; + if (!empty($conf->societe->enabled)) { - if ($object->socid > 0) $text.=$langs->trans("UserWillBeExternalUser"); - else $text.=$langs->trans("UserWillBeInternalUser"); + if ($object->socid > 0) $text .= $langs->trans("UserWillBeExternalUser"); + else $text .= $langs->trans("UserWillBeInternalUser"); } print $form->formconfirm($_SERVER["PHP_SELF"]."?rowid=".$object->id, $langs->trans("CreateDolibarrLogin"), $text, "confirm_create_user", $formquestion, 'yes'); } @@ -1431,22 +1431,22 @@ else // Confirm create third party if ($action == 'create_thirdparty') { - $companyalias=''; + $companyalias = ''; $fullname = $object->getFullName($langs); if ($object->morphy == 'mor') { - $companyname=$object->company; - if (! empty($fullname)) $companyalias=$fullname; + $companyname = $object->company; + if (!empty($fullname)) $companyalias = $fullname; } else { - $companyname=$fullname; - if (! empty($object->company)) $companyalias=$object->company; + $companyname = $fullname; + if (!empty($object->company)) $companyalias = $object->company; } // Create a form array - $formquestion=array( + $formquestion = array( array('label' => $langs->trans("NameToCreate"), 'type' => 'text', 'name' => 'companyname', 'value' => $companyname, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"'), array('label' => $langs->trans("AliasNames"), 'type' => 'text', 'name' => 'companyalias', 'value' => $companyalias, 'morecss' => 'minwidth300', 'moreattr' => 'maxlength="128"') ); @@ -1463,54 +1463,54 @@ else $adht->fetch($object->typeid); $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $tmp=$langs->trans("SendingAnEMailToMember"); - $tmp.='
'.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; - $tmp.='
'.$langs->trans("MailRecipient").': '.$object->email.''; - $helpcontent=''; - $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; - $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent.=''.$langs->trans("Subject").':
'."\n"; - $helpcontent.=$subjecttosend."\n"; - $helpcontent.="
"; - $helpcontent.=''.$langs->trans("Content").':
'; - $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; - $label=$form->textwithpicto($tmp, $helpcontent, 1, 'help'); + $tmp = $langs->trans("SendingAnEMailToMember"); + $tmp .= '
'.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp .= '
'.$langs->trans("MailRecipient").': '.$object->email.''; + $helpcontent = ''; + $helpcontent .= ''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent .= ''.$langs->trans("Subject").':
'."\n"; + $helpcontent .= $subjecttosend."\n"; + $helpcontent .= "
"; + $helpcontent .= ''.$langs->trans("Content").':
'; + $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; + $label = $form->textwithpicto($tmp, $helpcontent, 1, 'help'); // Create form popup - $formquestion=array(); - if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL?true:false)); - if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_MAILMAN)) { - $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"),'value'=>''); + $formquestion = array(); + if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => ($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL ?true:false)); + if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_MAILMAN)) { + $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroMailManEnabled"), 'value'=>''); } - if (! empty($conf->mailman->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) { - $formquestion[]=array('type'=>'other','label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"),'value'=>''); + if (!empty($conf->mailman->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) { + $formquestion[] = array('type'=>'other', 'label'=>$langs->transnoentitiesnoconv("SynchroSpipEnabled"), 'value'=>''); } print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ValidateMember"), $langs->trans("ConfirmValidateMember"), "confirm_valid", $formquestion, 'yes', 1, 220); } @@ -1524,58 +1524,58 @@ else $adht->fetch($object->typeid); $subject = ''; - $msg= ''; + $msg = ''; // Send subscription email include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; - $formmail=new FormMail($db); + $formmail = new FormMail($db); // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); // Load traductions files required by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template - $arraydefaultmessage=null; + $arraydefaultmessage = null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; - if (! empty($labeltouse)) $arraydefaultmessage=$formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); + if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (! empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } - $substitutionarray=getCommonSubstitutionArray($outputlangs, 0, null, $object); + $substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object); complete_substitutions_array($substitutionarray, $outputlangs, $object); $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $tmp=$langs->trans("SendingAnEMailToMember"); - $tmp.='
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; - $tmp.=$langs->trans("MailRecipient").': '.$object->email.')'; - $helpcontent=''; - $helpcontent.=''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; - $helpcontent.=''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; - $helpcontent.=''.$langs->trans("Subject").':
'."\n"; - $helpcontent.=$subjecttosend."\n"; - $helpcontent.="
"; - $helpcontent.=''.$langs->trans("Content").':
'; - $helpcontent.=dol_htmlentitiesbr($texttosend)."\n"; - $label=$form->textwithpicto($tmp, $helpcontent, 1, 'help'); + $tmp = $langs->trans("SendingAnEMailToMember"); + $tmp .= '
('.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.', '; + $tmp .= $langs->trans("MailRecipient").': '.$object->email.')'; + $helpcontent = ''; + $helpcontent .= ''.$langs->trans("MailFrom").': '.$conf->global->ADHERENT_MAIL_FROM.'
'."\n"; + $helpcontent .= ''.$langs->trans("MailRecipient").': '.$object->email.'
'."\n"; + $helpcontent .= ''.$langs->trans("Subject").':
'."\n"; + $helpcontent .= $subjecttosend."\n"; + $helpcontent .= "
"; + $helpcontent .= ''.$langs->trans("Content").':
'; + $helpcontent .= dol_htmlentitiesbr($texttosend)."\n"; + $label = $form->textwithpicto($tmp, $helpcontent, 1, 'help'); // Create an array - $formquestion=array(); - if ($object->email) $formquestion[]=array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (! empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL)?'true':'false')); - if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + $formquestion = array(); + if ($object->email) $formquestion[] = array('type' => 'checkbox', 'name' => 'send_mail', 'label' => $label, 'value' => (!empty($conf->global->ADHERENT_DEFAULT_SENDINFOBYMAIL) ? 'true' : 'false')); + if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); print $form->formconfirm("card.php?rowid=".$id, $langs->trans("ResiliateMember"), $langs->trans("ConfirmResiliateMember"), "confirm_resign", $formquestion, 'no', 1, 240); } // Confirm remove member if ($action == 'delete') { - $formquestion=array(); - if ($backtopage) $formquestion[]=array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); + $formquestion = array(); + if ($backtopage) $formquestion[] = array('type' => 'hidden', 'name' => 'backtopage', 'value' => ($backtopage != '1' ? $backtopage : $_SERVER["HTTP_REFERER"])); print $form->formconfirm("card.php?rowid=".$id, $langs->trans("DeleteMember"), $langs->trans("ConfirmDeleteMember"), "confirm_delete", $formquestion, 'no', 1); } @@ -1590,9 +1590,9 @@ else print $form->formconfirm("card.php?rowid=$id", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip'); } - $rowspan=17; + $rowspan = 17; if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++; - if (! empty($conf->societe->enabled)) $rowspan++; + if (!empty($conf->societe->enabled)) $rowspan++; $linkback = ''.$langs->trans("BackToList").''; @@ -1640,10 +1640,10 @@ else if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; else print $langs->trans("Hidden"); } - if ((! empty($object->pass) || ! empty($object->pass_crypted)) && empty($object->user_id)) + if ((!empty($object->pass) || !empty($object->pass_crypted)) && empty($object->user_id)) { $langs->load("errors"); - $htmltext=$langs->trans("WarningPasswordSetWithNoAccount"); + $htmltext = $langs->trans("WarningPasswordSetWithNoAccount"); print ' '.$form->textwithpicto('', $htmltext, 1, 'warning'); } print ''; @@ -1664,7 +1664,7 @@ else { print $langs->trans("SubscriptionNotNeeded"); } - elseif (! $adht->subscription) + elseif (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated @@ -1678,7 +1678,7 @@ else print ''; // Third party Dolibarr - if (! empty($conf->societe->enabled)) + if (!empty($conf->societe->enabled)) { print ''; $editenable = $user->rights->adherent->creer; @@ -1686,7 +1686,7 @@ else print ''; if ($action == 'editthirdparty') { - $htmlname='socid'; + $htmlname = 'socid'; print ''; print ''; print ''; @@ -1702,8 +1702,8 @@ else { if ($object->socid) { - $company=new Societe($db); - $result=$company->fetch($object->socid); + $company = new Societe($db); + $result = $company->fetch($object->socid); print $company->getNomUrl(1); } else @@ -1749,16 +1749,16 @@ else print ''.$langs->trans("Public").''.yn($object->public).''; // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { - print '' . $langs->trans("Categories") . ''; + print ''.$langs->trans("Categories").''; print ''; print $form->showCategories($object->id, 'member', 1); print ''; } // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print "\n"; @@ -1780,7 +1780,7 @@ else { // Send if ($object->statut == 1) { - print ''; + print ''; } // Send card by email @@ -1853,7 +1853,7 @@ else } // Create third party - if (! empty($conf->societe->enabled) && ! $object->socid) + if (!empty($conf->societe->enabled) && !$object->socid) { if ($user->rights->societe->creer) { @@ -1867,7 +1867,7 @@ else } // Create user - if (! $user->socid && ! $object->user_id) + if (!$user->socid && !$object->user_id) { if ($user->rights->user->user->creer) { @@ -1891,7 +1891,7 @@ else } // Action SPIP - if (! empty($conf->mailmanspip->enabled) && ! empty($conf->global->ADHERENT_USE_SPIP)) + if (!empty($conf->mailmanspip->enabled) && !empty($conf->global->ADHERENT_USE_SPIP)) { $isinspip = $mailmanspip->is_in_spip($object); @@ -1928,8 +1928,8 @@ else $filename = dol_sanitizeFileName($object->ref); //$filename = 'tmp_cards.php'; //$filedir = $conf->adherent->dir_output . '/' . get_exdir($object->id, 2, 0, 0, $object, 'member') . dol_sanitizeFileName($object->ref); - $filedir = $conf->adherent->dir_output . '/' . get_exdir(0, 0, 0, 0, $object, 'member'); - $urlsource = $_SERVER['PHP_SELF'] . '?id=' . $object->id; + $filedir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 0, $object, 'member'); + $urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id; $genallowed = $user->rights->adherent->lire; $delallowed = $user->rights->adherent->creer; @@ -1946,7 +1946,7 @@ else */ // Shon online payment link - $useonlinepayment = (! empty($conf->paypal->enabled) || ! empty($conf->stripe->enabled) || ! empty($conf->paybox->enabled)); + $useonlinepayment = (!empty($conf->paypal->enabled) || !empty($conf->stripe->enabled) || !empty($conf->paybox->enabled)); if ($useonlinepayment) { @@ -1961,11 +1961,11 @@ else $MAX = 10; $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; + $morehtmlright .= $langs->trans("SeeAll"); + $morehtmlright .= ''; // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'member', $socid, 1, 'listactions', $MAX, '', $morehtmlright); @@ -1973,8 +1973,8 @@ else } // Presend form - $modelmail='member'; - $defaulttopic='CardContent'; + $modelmail = 'member'; + $defaulttopic = 'CardContent'; $diroutput = $conf->adherent->dir_output; $trackid = 'mem'.$object->id; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index b8db7593ef8..45fe792c81a 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -78,54 +78,54 @@ if ($action == 'add' && ! empty($permissiontoadd)) } } - if (! $error) + if (!$error) { - $result=$object->create($user); + $result = $object->create($user); if ($result > 0) { // Creation OK $urltogo = $backtopage ? str_replace('__ID__', $result, $backtopage) : $backurlforlist; - $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation + $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); exit; } else { // Creation KO - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); - $action='create'; + $action = 'create'; } } else { - $action='create'; + $action = 'create'; } } // Action to update record -if ($action == 'update' && ! empty($permissiontoadd)) +if ($action == 'update' && !empty($permissiontoadd)) { foreach ($object->fields as $key => $val) { - if (! GETPOSTISSET($key)) continue; // The field was not submited to be edited - if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields + if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited + if (in_array($key, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat', 'fk_user_modif', 'import_key'))) continue; // Ignore special fields // Set value to update if (in_array($object->fields[$key]['type'], array('text', 'html'))) { $value = GETPOST($key, 'none'); - } elseif ($object->fields[$key]['type']=='date') { + } elseif ($object->fields[$key]['type'] == 'date') { $value = dol_mktime(12, 0, 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); - } elseif ($object->fields[$key]['type']=='datetime') { + } elseif ($object->fields[$key]['type'] == 'datetime') { $value = dol_mktime(GETPOST($key.'hour'), GETPOST($key.'min'), 0, GETPOST($key.'month'), GETPOST($key.'day'), GETPOST($key.'year')); } elseif (in_array($object->fields[$key]['type'], array('price', 'real'))) { $value = price2num(GETPOST($key)); } else { $value = GETPOST($key, 'alpha'); } - if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value=''; // This is an implicit foreign key field - if (! empty($object->fields[$key]['foreignkey']) && $value == '-1') $value=''; // This is an explicit foreign key field + if (preg_match('/^integer:/i', $object->fields[$key]['type']) && $value == '-1') $value = ''; // This is an implicit foreign key field + if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') $value = ''; // This is an explicit foreign key field - $object->$key=$value; + $object->$key = $value; if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) { $error++; @@ -133,28 +133,28 @@ if ($action == 'update' && ! empty($permissiontoadd)) } } - if (! $error) + if (!$error) { - $result=$object->update($user); + $result = $object->update($user); if ($result > 0) { - $action='view'; + $action = 'view'; } else { // Creation KO setEventMessages($object->error, $object->errors, 'errors'); - $action='edit'; + $action = 'edit'; } } else { - $action='edit'; + $action = 'edit'; } } // Action to update one extrafield -if ($action == "update_extras" && ! empty($permissiontoadd)) +if ($action == "update_extras" && !empty($permissiontoadd)) { $object->fetch(GETPOST('id', 'int')); @@ -162,7 +162,7 @@ if ($action == "update_extras" && ! empty($permissiontoadd)) $attributekeylong = 'options_'.$attributekey; $object->array_options['options_'.$attributekey] = GETPOST($attributekeylong, ' alpha'); - $result = $object->insertExtraFields(empty($triggermodname)?'':$triggermodname, $user); + $result = $object->insertExtraFields(empty($triggermodname) ? '' : $triggermodname, $user); if ($result > 0) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); @@ -176,15 +176,15 @@ if ($action == "update_extras" && ! empty($permissiontoadd)) } // Action to delete -if ($action == 'confirm_delete' && ! empty($permissiontodelete)) +if ($action == 'confirm_delete' && !empty($permissiontodelete)) { - if (! ($object->id > 0)) + if (!($object->id > 0)) { dol_print_error('', 'Error, object must be fetched before being deleted'); exit; } - $result=$object->delete($user); + $result = $object->delete($user); if ($result > 0) { // Delete OK @@ -194,13 +194,13 @@ if ($action == 'confirm_delete' && ! empty($permissiontodelete)) } else { - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } } // Remove a line -if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiontoadd)) +if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissiontoadd)) { $result = $object->deleteline($user, $lineid); if ($result > 0) @@ -216,7 +216,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && ! empty($permissiont { $newlang = $object->thirdparty->default_lang; } - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } @@ -248,11 +248,11 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -277,11 +277,11 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -320,11 +320,11 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -337,30 +337,30 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) } // Action clone object -if ($action == 'confirm_clone' && $confirm == 'yes' && ! empty($permissiontoadd)) +if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) { - if (1==0 && ! GETPOST('clone_content') && ! GETPOST('clone_receivers')) + if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } else { - $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid. + $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid. //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); // ... - $result=$objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id)); + $result = $objectutil->createFromClone($user, (($object->id > 0) ? $object->id : $id)); if (is_object($result) || $result > 0) { $newid = 0; if (is_object($result)) $newid = $result->id; else $newid = $result; - header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object + header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object exit; } else { setEventMessages($objectutil->error, $objectutil->errors, 'errors'); - $action=''; + $action = ''; } } } diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 05cbcb0ca14..22ba7b66ec8 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -41,13 +41,13 @@ class CMailFile public $sendmode; public $sendsetup; - public $subject; // Topic: Subject of email - public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '' or 'John Doe ' or ''). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). + public $subject; // Topic: Subject of email + public $addr_from; // From: Label and EMail of sender (must include '<>'). For example '' or 'John Doe ' or ''). Note that with gmail smtps, value here is forced by google to account (but not the reply-to). // Sender: Who send the email ("Sender" has sent emails on behalf of "From"). // Use it when the "From" is an email of a domain that is a SPF protected domain, and sending smtp server is not this domain. In such case, add Sender field with an email of the protected domain. // Return-Path: Email where to send bounds. - public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) - public $errors_to; // Errors-To: Email where to send errors. + public $reply_to; // Reply-To: Email where to send replies from mailer software (mailer use From if reply-to not defined, Gmail use gmail account if reply-to not defined) + public $errors_to; // Errors-To: Email where to send errors. public $addr_to; public $addr_cc; public $addr_bcc; @@ -64,10 +64,10 @@ class CMailFile /** * @var string Error code (or message) */ - public $error=''; + public $error = ''; - public $smtps; // Contains SMTPs object (if this method is used) - public $phpmailer; // Contains PHPMailer object (if this method is used) + public $smtps; // Contains SMTPs object (if this method is used) + public $phpmailer; // Contains PHPMailer object (if this method is used) /** * @var string CSS @@ -96,9 +96,9 @@ class CMailFile // Image public $html; public $image_boundary; - public $atleastoneimage=0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). - public $html_images=array(); - public $images_encoded=array(); + public $atleastoneimage = 0; // at least one image file with file=xxx.ext into content (TODO Debug this. How can this case be tested. Remove if not used). + public $html_images = array(); + public $images_encoded = array(); public $image_types = array( 'gif' => 'image/gif', 'jpg' => 'image/jpeg', @@ -162,28 +162,28 @@ class CMailFile { $this->sendmode = $conf->global->MAIN_MAIL_SENDMODE_EMAILING; } - if (empty($this->sendmode)) $this->sendmode=$conf->global->MAIN_MAIL_SENDMODE; - if (empty($this->sendmode)) $this->sendmode='mail'; + if (empty($this->sendmode)) $this->sendmode = $conf->global->MAIN_MAIL_SENDMODE; + if (empty($this->sendmode)) $this->sendmode = 'mail'; // We define end of line (RFC 821). - $this->eol="\r\n"; + $this->eol = "\r\n"; // We define end of line for header fields (RFC 822bis section 2.3 says header must contains \r\n). - $this->eol2="\r\n"; - if (! empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) + $this->eol2 = "\r\n"; + if (!empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)) { - $this->eol="\n"; - $this->eol2="\n"; + $this->eol = "\n"; + $this->eol2 = "\n"; $moreinheader = str_replace("\r\n", "\n", $moreinheader); } // On defini mixed_boundary - $this->mixed_boundary = "multipart_x." . time() . ".x_boundary"; + $this->mixed_boundary = "multipart_x.".time().".x_boundary"; // On defini related_boundary - $this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); // Force md5 hash (does not contains special chars) + $this->related_boundary = 'mul_'.dol_hash(uniqid("dolibarr2"), 3); // Force md5 hash (does not contains special chars) // On defini alternative_boundary - $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) + $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); @@ -191,13 +191,13 @@ class CMailFile if (empty($subject)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); - $this->error='ErrorSubjectIsRequired'; + $this->error = 'ErrorSubjectIsRequired'; return; } if (empty($msg)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty body"); - $msg='.'; // Avoid empty message (with empty message conten show a multipart structure) + $msg = '.'; // Avoid empty message (with empty message conten show a multipart structure) } // Detect if message is HTML (use fast method) @@ -214,21 +214,21 @@ class CMailFile global $dolibarr_main_url_root; // Define $urlwithroot - $urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); - $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file + $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); + $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Replace relative /viewimage to absolute path $msg = preg_replace('/src="'.preg_quote(DOL_URL_ROOT, '/').'\/viewimage\.php/ims', 'src="'.$urlwithroot.'/viewimage.php', $msg, -1, $nbrep); - if (! empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml=1; // To force to send everything with content type html. + if (!empty($conf->global->MAIN_MAIL_FORCE_CONTENT_TYPE_TO_HTML)) $this->msgishtml = 1; // To force to send everything with content type html. // Detect images if ($this->msgishtml) { $this->html = $msg; - if (! empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) + if (!empty($conf->global->MAIN_MAIL_ADD_INLINE_IMAGES_IF_IN_MEDIAS)) { $findimg = $this->findHtmlImages($dolibarr_main_data_root.'/medias'); } @@ -240,7 +240,7 @@ class CMailFile { if ($this->html_images[$i]) { - $this->atleastoneimage=1; + $this->atleastoneimage = 1; dol_syslog("CMailFile::CMailfile: html_images[$i]['name']=".$this->html_images[$i]['name'], LOG_DEBUG); } } @@ -254,14 +254,14 @@ class CMailFile { if ($filename_list[$i]) { - $this->atleastonefile=1; + $this->atleastonefile = 1; dol_syslog("CMailFile::CMailfile: filename_list[$i]=".$filename_list[$i].", mimetype_list[$i]=".$mimetype_list[$i]." mimefilename_list[$i]=".$mimefilename_list[$i], LOG_DEBUG); } } } // Add autocopy to (Note: Adding bcc for specific modules are also done from pages) - if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc.=($addr_bcc?', ':'').$conf->global->MAIN_MAIL_AUTOCOPY_TO; + if (!empty($conf->global->MAIN_MAIL_AUTOCOPY_TO)) $addr_bcc .= ($addr_bcc ? ', ' : '').$conf->global->MAIN_MAIL_AUTOCOPY_TO; // Action according to choosed sending method if ($this->sendmode == 'mail') @@ -276,17 +276,17 @@ class CMailFile // Define smtp_headers $smtp_headers = $this->write_smtpheaders(); - if (! empty($moreinheader)) $smtp_headers.=$moreinheader; // $moreinheader contains the \r\n + if (!empty($moreinheader)) $smtp_headers .= $moreinheader; // $moreinheader contains the \r\n // Define mime_headers $mime_headers = $this->write_mimeheaders($filename_list, $mimefilename_list); - if (! empty($this->html)) + if (!empty($this->html)) { if (!empty($css)) { $this->css = $css; - $this->buildCSS(); // Build a css style (mode = all) into this->styleCSS and this->bodyCSS + $this->buildCSS(); // Build a css style (mode = all) into this->styleCSS and this->bodyCSS } $msg = $this->html; @@ -302,15 +302,15 @@ class CMailFile } // We now define $this->headers and $this->message - $this->headers = $smtp_headers . $mime_headers; + $this->headers = $smtp_headers.$mime_headers; // On nettoie le header pour qu'il ne se termine pas par un retour chariot. // This avoid also empty lines at end that can be interpreted as mail injection by email servers. $this->headers = preg_replace("/([\r\n]+)$/i", "", $this->headers); //$this->message = $this->eol.'This is a message with multiple parts in MIME format.'.$this->eol; $this->message = 'This is a message with multiple parts in MIME format.'.$this->eol; - $this->message.= $text_body . $files_encoded; - $this->message.= "--" . $this->mixed_boundary . "--" . $this->eol; + $this->message .= $text_body.$files_encoded; + $this->message .= "--".$this->mixed_boundary."--".$this->eol; } elseif ($this->sendmode == 'smtps') { @@ -327,9 +327,9 @@ class CMailFile $smtps->setTrackId($trackid); $smtps->setReplyTo($this->getValidAddress($replyto, 0, 1)); - if (! empty($moreinheader)) $smtps->setMoreInHeader($moreinheader); + if (!empty($moreinheader)) $smtps->setMoreInHeader($moreinheader); - if (! empty($this->html)) + if (!empty($this->html)) { if (!empty($css)) { @@ -355,7 +355,7 @@ class CMailFile { foreach ($filename_list as $i => $val) { - $content=file_get_contents($filename_list[$i]); + $content = file_get_contents($filename_list[$i]); $smtps->setAttachment($content, $mimefilename_list[$i], $mimetype_list[$i]); } } @@ -365,7 +365,7 @@ class CMailFile $smtps->setErrorsTo($errors_to); $smtps->setDeliveryReceipt($deliveryreceipt); - $this->smtps=$smtps; + $this->smtps = $smtps; } elseif ($this->sendmode == 'swiftmailer') { @@ -385,8 +385,8 @@ class CMailFile //$this->message = new Swift_SignedMessage(); // Adding a trackid header to a message $headers = $this->message->getHeaders(); - $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid . '@' . $host); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; + $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid.'@'.$host); + $headerID = time().'.swiftmailer-dolibarr-'.$trackid.'@'.$host; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); @@ -396,12 +396,12 @@ class CMailFile try { $result = $this->message->setSubject($subject); } catch (Exception $e) { - $this->errors[] = $e->getMessage(); + $this->errors[] = $e->getMessage(); } // Set the From address with an associative array //$this->message->setFrom(array('john@doe.com' => 'John Doe')); - if (! empty($from)) { + if (!empty($from)) { try { $result = $this->message->setFrom($this->getArrayAddress($from)); } catch (Exception $e) { @@ -410,7 +410,7 @@ class CMailFile } // Set the To addresses with an associative array - if (! empty($to)) { + if (!empty($to)) { try { $result = $this->message->setTo($this->getArrayAddress($to)); } catch (Exception $e) { @@ -418,7 +418,7 @@ class CMailFile } } - if (! empty($replyto)) { + if (!empty($replyto)) { try { $result = $this->message->SetReplyTo($this->getArrayAddress($replyto)); } catch (Exception $e) { @@ -429,10 +429,10 @@ class CMailFile try { $result = $this->message->setCharSet($conf->file->character_set_client); } catch (Exception $e) { - $this->errors[] = $e->getMessage(); + $this->errors[] = $e->getMessage(); } - if (! empty($this->html)) { + if (!empty($this->html)) { if (!empty($css)) { $this->css = $css; $this->buildCSS(); @@ -474,8 +474,8 @@ class CMailFile } } - if (! empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); - if (! empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); + if (!empty($addr_cc)) $this->message->setCc($this->getArrayAddress($addr_cc)); + if (!empty($addr_bcc)) $this->message->setBcc($this->getArrayAddress($addr_bcc)); //if (! empty($errors_to)) $this->message->setErrorsTo($this->getArrayAddress($errors_to); if (isset($deliveryreceipt) && $deliveryreceipt == 1) $this->message->setReadReceiptTo($this->getArrayAddress($from)); } @@ -495,25 +495,25 @@ class CMailFile */ public function sendfile() { - global $conf,$db,$langs; + global $conf, $db, $langs; - $errorlevel=error_reporting(); + $errorlevel = error_reporting(); //error_reporting($errorlevel ^ E_WARNING); // Desactive warnings - $res=false; + $res = false; if (empty($conf->global->MAIN_DISABLE_ALL_MAILS) || !empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) { - require_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php'; $hookmanager = new HookManager($db); $hookmanager->initHooks(array('mail')); - $parameters=array(); $action=''; + $parameters = array(); $action = ''; $reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { - $this->error = "Error in hook maildao sendMail " . $reshook; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR); + $this->error = "Error in hook maildao sendMail ".$reshook; + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); return $reshook; } @@ -523,23 +523,23 @@ class CMailFile } $sendingmode = $this->sendmode; - if ($this->context == 'emailing' && ! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') + if ($this->context == 'emailing' && !empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // List of sending methods - $listofmethods=array(); - $listofmethods['mail']='PHP mail function'; + $listofmethods = array(); + $listofmethods['mail'] = 'PHP mail function'; //$listofmethods['simplemail']='Simplemail class'; - $listofmethods['smtps']='SMTP/SMTPS socket library'; + $listofmethods['smtps'] = 'SMTP/SMTPS socket library'; // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. // You ensure that every user is using its own SMTP server when using the mass emailing module. - $linktoadminemailbefore=''; - $linktoadminemailend=''; + $linktoadminemailbefore = ''; + $linktoadminemailend = ''; $this->error = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]); $this->errors[] = $langs->trans("MailSendSetupIs", $listofmethods[$sendingmode]); $this->error .= '
'.$langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); $this->errors[] = $langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']); - if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) + if (!empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) { $this->error .= '
'.$langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); $this->errors[] = $langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS); @@ -548,52 +548,52 @@ class CMailFile } // Check number of recipient is lower or equal than MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL=10; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL = 10; $tmparray1 = explode(',', $this->addr_to); if (count($tmparray1) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_TO_IN_SAME_EMAIL) { $this->error = 'Too much recipients in to:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL=10; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL = 10; $tmparray2 = explode(',', $this->addr_cc); if (count($tmparray2) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_CC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in cc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL=10; + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL = 10; $tmparray3 = explode(',', $this->addr_bcc); if (count($tmparray3) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_BCC_IN_SAME_EMAIL) { $this->error = 'Too much recipients in bcc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL=10; - if ((count($tmparray1)+count($tmparray2)+count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) + if (empty($conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL)) $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL = 10; + if ((count($tmparray1) + count($tmparray2) + count($tmparray3)) > $conf->global->MAIL_MAX_NB_OF_RECIPIENTS_IN_SAME_EMAIL) { $this->error = 'Too much recipients in to:, cc:, bcc:'; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_WARNING); + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_WARNING); return false; } - $keyforsmtpserver='MAIN_MAIL_SMTP_SERVER'; - $keyforsmtpport ='MAIN_MAIL_SMTP_PORT'; - $keyforsmtpid ='MAIN_MAIL_SMTPS_ID'; - $keyforsmtppw ='MAIN_MAIL_SMTPS_PW'; - $keyfortls ='MAIN_MAIL_EMAIL_TLS'; - $keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS'; + $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER'; + $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT'; + $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID'; + $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW'; + $keyfortls = 'MAIN_MAIL_EMAIL_TLS'; + $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS'; if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { - $keyforsmtpserver='MAIN_MAIL_SMTP_SERVER_EMAILING'; - $keyforsmtpport ='MAIN_MAIL_SMTP_PORT_EMAILING'; - $keyforsmtpid ='MAIN_MAIL_SMTPS_ID_EMAILING'; - $keyforsmtppw ='MAIN_MAIL_SMTPS_PW_EMAILING'; - $keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING'; - $keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; + $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_EMAILING'; + $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_EMAILING'; + $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_EMAILING'; + $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_EMAILING'; + $keyfortls = 'MAIN_MAIL_EMAIL_TLS_EMAILING'; + $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; } if (!empty($conf->global->MAIN_MAIL_FORCE_SENDTO)) @@ -620,64 +620,64 @@ class CMailFile } // Force parameters - if (! empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver); - if (! empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport); + if (!empty($conf->global->$keyforsmtpserver)) ini_set('SMTP', $conf->global->$keyforsmtpserver); + if (!empty($conf->global->$keyforsmtpport)) ini_set('smtp_port', $conf->global->$keyforsmtpport); - $res=true; - if ($res && ! $this->subject) + $res = true; + if ($res && !$this->subject) { - $this->error="Failed to send mail with php mail to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."
Subject is empty"; + $this->error = "Failed to send mail with php mail to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."
Subject is empty"; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } - $dest=$this->getValidAddress($this->addr_to, 2); - if ($res && ! $dest) + $dest = $this->getValidAddress($this->addr_to, 2); + if ($res && !$dest) { - $this->error="Failed to send mail with php mail to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."
Recipient address '$dest' invalid"; + $this->error = "Failed to send mail with php mail to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port')."
Recipient address '$dest' invalid"; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } if ($res) { - $additionnalparam = ''; // By default - if (! empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) + $additionnalparam = ''; // By default + if (!empty($conf->global->MAIN_MAIL_ALLOW_SENDMAIL_F)) { // le "Return-Path" (retour des messages bounced) dans les header ne fonctionne pas avec tous les MTA // Le forcage de la valeur grace à l'option -f de sendmail est donc possible si la constante MAIN_MAIL_ALLOW_SENDMAIL_F est definie. // Having this variable defined may create problems with some sendmail (option -f refused) // Having this variable not defined may create problems with some other sendmail (option -f required) - $additionnalparam .= ($additionnalparam?' ':'').(! empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f' . $this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f' . $this->getValidAddress($this->addr_from, 2) : '') ); + $additionnalparam .= ($additionnalparam ? ' ' : '').(!empty($conf->global->MAIN_MAIL_ERRORS_TO) ? '-f'.$this->getValidAddress($conf->global->MAIN_MAIL_ERRORS_TO, 2) : ($this->addr_from != '' ? '-f'.$this->getValidAddress($this->addr_from, 2) : '')); } - if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender + if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) // To force usage of -ba option. This option tells sendmail to read From: or Sender: to setup sender { - $additionnalparam .= ($additionnalparam?' ':'').'-ba'; + $additionnalparam .= ($additionnalparam ? ' ' : '').'-ba'; } - if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam?' ':'').'-U '.$additionnalparam; // Use -U to add additionnal params + if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_ADDPARAM)) $additionnalparam .= ($additionnalparam ? ' ' : '').'-U '.$additionnalparam; // Use -U to add additionnal params dol_syslog("CMailFile::sendfile: mail start HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port').", additionnal_parameters=".$additionnalparam, LOG_DEBUG); - $this->message=stripslashes($this->message); + $this->message = stripslashes($this->message); - if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); + if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); - if (! empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam); + if (!empty($additionnalparam)) $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers, $additionnalparam); else $res = mail($dest, $this->encodetorfc2822($this->subject), $this->message, $this->headers); - if (! $res) + if (!$res) { $langs->load("errors"); - $this->error="Failed to send mail with php mail"; - $linuxlike=1; - if (preg_match('/^win/i', PHP_OS)) $linuxlike=0; - if (preg_match('/^mac/i', PHP_OS)) $linuxlike=0; - if (! $linuxlike) + $this->error = "Failed to send mail with php mail"; + $linuxlike = 1; + if (preg_match('/^win/i', PHP_OS)) $linuxlike = 0; + if (preg_match('/^mac/i', PHP_OS)) $linuxlike = 0; + if (!$linuxlike) { - $this->error.=" to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems + $this->error .= " to HOST=".ini_get('SMTP').", PORT=".ini_get('smtp_port'); // This values are value used only for non linuxlike systems } - $this->error.=".
"; - $this->error.=$langs->trans("ErrorPhpMailDelivery"); + $this->error .= ".
"; + $this->error .= $langs->trans("ErrorPhpMailDelivery"); dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); } else @@ -692,86 +692,86 @@ class CMailFile } // Restore parameters - if (! empty($conf->global->$keyforsmtpserver)) ini_restore('SMTP'); - if (! empty($conf->global->$keyforsmtpport)) ini_restore('smtp_port'); + if (!empty($conf->global->$keyforsmtpserver)) ini_restore('SMTP'); + if (!empty($conf->global->$keyforsmtpport)) ini_restore('smtp_port'); } elseif ($this->sendmode == 'smtps') { - if (! is_object($this->smtps)) + if (!is_object($this->smtps)) { - $this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Constructor of object CMailFile was not initialized without errors."; + $this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Constructor of object CMailFile was not initialized without errors."; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); return false; } // Use SMTPS library // ------------------------------------------ - $this->smtps->setTransportType(0); // Only this method is coded in SMTPs library + $this->smtps->setTransportType(0); // Only this method is coded in SMTPs library // Clean parameters - if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP'); - if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port'); + if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver = ini_get('SMTP'); + if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport = ini_get('smtp_port'); // If we use SSL/TLS - $server=$conf->global->$keyforsmtpserver; - $secure=''; - if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure='ssl'; - if (! empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure='tls'; - $server=($secure?$secure.'://':'').$server; + $server = $conf->global->$keyforsmtpserver; + $secure = ''; + if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure = 'ssl'; + if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure = 'tls'; + $server = ($secure ? $secure.'://' : '').$server; - $port=$conf->global->$keyforsmtpport; + $port = $conf->global->$keyforsmtpport; $this->smtps->setHost($server); $this->smtps->setPort($port); // 25, 465...; - $loginid=''; $loginpass=''; - if (! empty($conf->global->$keyforsmtpid)) + $loginid = ''; $loginpass = ''; + if (!empty($conf->global->$keyforsmtpid)) { $loginid = $conf->global->$keyforsmtpid; $this->smtps->setID($loginid); } - if (! empty($conf->global->$keyforsmtppw)) + if (!empty($conf->global->$keyforsmtppw)) { $loginpass = $conf->global->$keyforsmtppw; $this->smtps->setPW($loginpass); } - $res=true; - $from=$this->smtps->getFrom('org'); - if ($res && ! $from) + $res = true; + $from = $this->smtps->getFrom('org'); + if ($res && !$from) { - $this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Sender address '$from' invalid"; + $this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Sender address '$from' invalid"; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } - $dest=$this->smtps->getTo(); - if ($res && ! $dest) + $dest = $this->smtps->getTo(); + if ($res && !$dest) { - $this->error="Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Recipient address '$dest' invalid"; + $this->error = "Failed to send mail with smtps lib to HOST=".$server.", PORT=".$conf->global->$keyforsmtpport."
Recipient address '$dest' invalid"; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } if ($res) { - if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true); + if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->smtps->setDebug(true); - $result=$this->smtps->sendMsg(); + $result = $this->smtps->sendMsg(); //print $result; - if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); + if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); - $result=$this->smtps->getErrors(); + $result = $this->smtps->getErrors(); if (empty($this->error) && empty($result)) { dol_syslog("CMailFile::sendfile: mail end success", LOG_DEBUG); - $res=true; + $res = true; } else { - if (empty($this->error)) $this->error=$result; + if (empty($this->error)) $this->error = $result; dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } } } @@ -782,19 +782,19 @@ class CMailFile require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; // Clean parameters - if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver=ini_get('SMTP'); - if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport=ini_get('smtp_port'); + if (empty($conf->global->$keyforsmtpserver)) $conf->global->$keyforsmtpserver = ini_get('SMTP'); + if (empty($conf->global->$keyforsmtpport)) $conf->global->$keyforsmtpport = ini_get('smtp_port'); // If we use SSL/TLS $server = $conf->global->$keyforsmtpserver; $secure = ''; - if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure='ssl'; - if (! empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure='tls'; + if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) $secure = 'ssl'; + if (!empty($conf->global->$keyforstarttls) && function_exists('openssl_open')) $secure = 'tls'; $this->transport = new Swift_SmtpTransport($server, $conf->global->$keyforsmtpport, $secure); - if (! empty($conf->global->$keyforsmtpid)) $this->transport->setUsername($conf->global->$keyforsmtpid); - if (! empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw); + if (!empty($conf->global->$keyforsmtpid)) $this->transport->setUsername($conf->global->$keyforsmtpid); + if (!empty($conf->global->$keyforsmtppw)) $this->transport->setPassword($conf->global->$keyforsmtppw); //$smtps->_msgReplyTo = 'reply@web.com'; // Create the Mailer using your created Transport @@ -809,7 +809,7 @@ class CMailFile $this->message->attachSigner($signer->ignoreHeader('Return-Path')); } - if (! empty($conf->global->MAIN_MAIL_DEBUG)) { + if (!empty($conf->global->MAIN_MAIL_DEBUG)) { // To use the ArrayLogger $this->logger = new Swift_Plugins_Loggers_ArrayLogger(); // Or to use the Echo Logger @@ -820,14 +820,14 @@ class CMailFile try { $result = $this->mailer->send($this->message); } catch (Exception $e) { - $this->error = $e->getMessage(); + $this->error = $e->getMessage(); } - if (! empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); + if (!empty($conf->global->MAIN_MAIL_DEBUG)) $this->dump_mail(); $res = true; - if (! empty($this->error) || ! $result) { + if (!empty($this->error) || !$result) { dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); - $res=false; + $res = false; } else { @@ -842,23 +842,23 @@ class CMailFile return 'Bad value for sendmode'; } - $parameters=array(); $action=''; + $parameters = array(); $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { - $this->error = "Error in hook maildao sendMailAfter " . $reshook; - dol_syslog("CMailFile::sendfile: mail end error=" . $this->error, LOG_ERR); + $this->error = "Error in hook maildao sendMailAfter ".$reshook; + dol_syslog("CMailFile::sendfile: mail end error=".$this->error, LOG_ERR); return $reshook; } } else { - $this->error='No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; + $this->error = 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; dol_syslog("CMailFile::sendfile: ".$this->error, LOG_WARNING); } - error_reporting($errorlevel); // Reactive niveau erreur origine + error_reporting($errorlevel); // Reactive niveau erreur origine return $res; } @@ -885,17 +885,17 @@ class CMailFile private function _encode_file($sourcefile) { // phpcs:enable - $newsourcefile=dol_osencode($sourcefile); + $newsourcefile = dol_osencode($sourcefile); if (is_readable($newsourcefile)) { - $contents = file_get_contents($newsourcefile); // Need PHP 4.3 - $encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047 + $contents = file_get_contents($newsourcefile); // Need PHP 4.3 + $encoded = chunk_split(base64_encode($contents), 76, $this->eol); // 76 max is defined into http://tools.ietf.org/html/rfc2047 return $encoded; } else { - $this->error="Error: Can't read file '".$sourcefile."' into _encode_file"; + $this->error = "Error: Can't read file '".$sourcefile."' into _encode_file"; dol_syslog("CMailFile::encode_file: ".$this->error, LOG_ERR); return -1; } @@ -913,30 +913,30 @@ class CMailFile public function dump_mail() { // phpcs:enable - global $conf,$dolibarr_main_data_root; + global $conf, $dolibarr_main_data_root; if (@is_writeable($dolibarr_main_data_root)) // Avoid fatal error on fopen with open_basedir { - $outputfile=$dolibarr_main_data_root."/dolibarr_mail.log"; + $outputfile = $dolibarr_main_data_root."/dolibarr_mail.log"; $fp = fopen($outputfile, "w"); if ($this->sendmode == 'mail') { fputs($fp, $this->headers); - fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log + fputs($fp, $this->eol); // This eol is added by the mail function, so we add it in log fputs($fp, $this->message); } elseif ($this->sendmode == 'smtps') { - fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on + fputs($fp, $this->smtps->log); // this->smtps->log is filled only if MAIN_MAIL_DEBUG was set to on } elseif ($this->sendmode == 'swiftmailer') { - fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on + fputs($fp, $this->logger->dump()); // this->logger is filled only if MAIN_MAIL_DEBUG was set to on } fclose($fp); - if (! empty($conf->global->MAIN_UMASK)) + if (!empty($conf->global->MAIN_UMASK)) @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); } } @@ -953,12 +953,12 @@ class CMailFile if (!preg_match('/^[\s\t]*styleCSS)) $out.= $this->styleCSS; - $out.= "bodyCSS)) $out.= $this->bodyCSS; - $out.= ">"; - $out.= $msg; - $out.= ""; + if (!empty($this->styleCSS)) $out .= $this->styleCSS; + $out .= "bodyCSS)) $out .= $this->bodyCSS; + $out .= ">"; + $out .= $msg; + $out .= ""; } else { @@ -975,24 +975,24 @@ class CMailFile */ public function buildCSS() { - if (! empty($this->css)) + if (!empty($this->css)) { // Style CSS $this->styleCSS = ''; + $this->styleCSS .= '}'; + $this->styleCSS .= ''; } } @@ -1013,48 +1013,48 @@ class CMailFile // Sender //$out.= "Sender: ".getValidAddress($this->addr_from,2)).$this->eol2; - $out.= "From: ".$this->getValidAddress($this->addr_from, 3, 1).$this->eol2; - if (! empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) + $out .= "From: ".$this->getValidAddress($this->addr_from, 3, 1).$this->eol2; + if (!empty($conf->global->MAIN_MAIL_SENDMAIL_FORCE_BA)) { - $out.= "To: ".$this->getValidAddress($this->addr_to, 0, 1).$this->eol2; + $out .= "To: ".$this->getValidAddress($this->addr_to, 0, 1).$this->eol2; } // Return-Path is important because it is used by SPF. Some MTA does not read Return-Path from header but from command line. See option MAIN_MAIL_ALLOW_SENDMAIL_F for that. - $out.= "Return-Path: ".$this->getValidAddress($this->addr_from, 0, 1).$this->eol2; - if (isset($this->reply_to) && $this->reply_to) $out.= "Reply-To: ".$this->getValidAddress($this->reply_to, 2).$this->eol2; - if (isset($this->errors_to) && $this->errors_to) $out.= "Errors-To: ".$this->getValidAddress($this->errors_to, 2).$this->eol2; + $out .= "Return-Path: ".$this->getValidAddress($this->addr_from, 0, 1).$this->eol2; + if (isset($this->reply_to) && $this->reply_to) $out .= "Reply-To: ".$this->getValidAddress($this->reply_to, 2).$this->eol2; + if (isset($this->errors_to) && $this->errors_to) $out .= "Errors-To: ".$this->getValidAddress($this->errors_to, 2).$this->eol2; // Receiver - if (isset($this->addr_cc) && $this->addr_cc) $out.= "Cc: ".$this->getValidAddress($this->addr_cc, 2).$this->eol2; - if (isset($this->addr_bcc) && $this->addr_bcc) $out.= "Bcc: ".$this->getValidAddress($this->addr_bcc, 2).$this->eol2; // TODO Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ? + if (isset($this->addr_cc) && $this->addr_cc) $out .= "Cc: ".$this->getValidAddress($this->addr_cc, 2).$this->eol2; + if (isset($this->addr_bcc) && $this->addr_bcc) $out .= "Bcc: ".$this->getValidAddress($this->addr_bcc, 2).$this->eol2; // TODO Question: bcc must not be into header, only into SMTP command "RCPT TO". Does php mail support this ? // Delivery receipt - if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out.= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from, 2).$this->eol2; + if (isset($this->deliveryreceipt) && $this->deliveryreceipt == 1) $out .= "Disposition-Notification-To: ".$this->getValidAddress($this->addr_from, 2).$this->eol2; //$out.= "X-Priority: 3".$this->eol2; - $out.= 'Date: ' . date("r") . $this->eol2; + $out .= 'Date: '.date("r").$this->eol2; $trackid = $this->trackid; if ($trackid) { // References is kept in response and Message-ID is returned into In-Reply-To: - $out.= 'Message-ID: <' . time() . '.phpmail-dolibarr-'. $trackid . '@' . $host . ">" . $this->eol2; // Uppercase seems replaced by phpmail - $out.= 'References: <' . time() . '.phpmail-dolibarr-'. $trackid . '@' . $host . ">" . $this->eol2; - $out.= 'X-Dolibarr-TRACKID: ' . $trackid . '@' . $host. $this->eol2; + $out .= 'Message-ID: <'.time().'.phpmail-dolibarr-'.$trackid.'@'.$host.">".$this->eol2; // Uppercase seems replaced by phpmail + $out .= 'References: <'.time().'.phpmail-dolibarr-'.$trackid.'@'.$host.">".$this->eol2; + $out .= 'X-Dolibarr-TRACKID: '.$trackid.'@'.$host.$this->eol2; } else { - $out.= 'Message-ID: <' . time() . '.phpmail@' . $host . ">" . $this->eol2; + $out .= 'Message-ID: <'.time().'.phpmail@'.$host.">".$this->eol2; } - if (! empty($_SERVER['REMOTE_ADDR'])) $out.= "X-RemoteAddr: " . $_SERVER['REMOTE_ADDR']. $this->eol2; - $out.= "X-Mailer: Dolibarr version " . DOL_VERSION ." (using php mail)".$this->eol2; - $out.= "Mime-Version: 1.0".$this->eol2; + if (!empty($_SERVER['REMOTE_ADDR'])) $out .= "X-RemoteAddr: ".$_SERVER['REMOTE_ADDR'].$this->eol2; + $out .= "X-Mailer: Dolibarr version ".DOL_VERSION." (using php mail)".$this->eol2; + $out .= "Mime-Version: 1.0".$this->eol2; //$out.= "From: ".$this->getValidAddress($this->addr_from,3,1).$this->eol; - $out.= "Content-Type: multipart/mixed;".$this->eol2." boundary=\"".$this->mixed_boundary."\"".$this->eol2; - $out.= "Content-Transfer-Encoding: 8bit".$this->eol2; // TODO Seems to be ignored. Header is 7bit once received. + $out .= "Content-Type: multipart/mixed;".$this->eol2." boundary=\"".$this->mixed_boundary."\"".$this->eol2; + $out .= "Content-Transfer-Encoding: 8bit".$this->eol2; // TODO Seems to be ignored. Header is 7bit once received. dol_syslog("CMailFile::write_smtpheaders smtp_header=\n".$out); return $out; @@ -1072,18 +1072,18 @@ class CMailFile public function write_mimeheaders($filename_list, $mimefilename_list) { // phpcs:enable - $mimedone=0; + $mimedone = 0; $out = ""; if (is_array($filename_list)) { - $filename_list_size=count($filename_list); - for($i=0;$i < $filename_list_size;$i++) + $filename_list_size = count($filename_list); + for ($i = 0; $i < $filename_list_size; $i++) { if ($filename_list[$i]) { if ($mimefilename_list[$i]) $filename_list[$i] = $mimefilename_list[$i]; - $out.= "X-attachments: $filename_list[$i]".$this->eol2; + $out .= "X-attachments: $filename_list[$i]".$this->eol2; } } } @@ -1104,22 +1104,22 @@ class CMailFile // phpcs:enable global $conf; - $out=''; + $out = ''; - $out.= "--" . $this->mixed_boundary . $this->eol; + $out .= "--".$this->mixed_boundary.$this->eol; if ($this->atleastoneimage) { - $out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol; - $out.= $this->eol; - $out.= "--" . $this->alternative_boundary . $this->eol; + $out .= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol; + $out .= $this->eol; + $out .= "--".$this->alternative_boundary.$this->eol; } // Make RFC821 Compliant, replace bare linefeeds - $strContent = preg_replace("/(?global->MAIN_FIX_FOR_BUGGED_MTA)) + $strContent = preg_replace("/(?global->MAIN_FIX_FOR_BUGGED_MTA)) { - $strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars + $strContent = preg_replace("/\r\n/si", "\n", $strContent); // PCRE modifier /s means new lines are common chars } $strContentAltText = ''; @@ -1128,7 +1128,7 @@ class CMailFile // Similar code to forge a text from html is also in smtps.class.php $strContentAltText = preg_replace("/]*>/", " ", $strContent); $strContentAltText = html_entity_decode(strip_tags($strContentAltText)); - $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n")); + $strContentAltText = trim(wordwrap($strContentAltText, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // Check if html header already in message, if not complete the message $strContent = $this->checkIfHTML($strContent); @@ -1137,57 +1137,57 @@ class CMailFile // Make RFC2045 Compliant, split lines //$strContent = rtrim(chunk_split($strContent)); // Function chunck_split seems ko if not used on a base64 content // TODO Encode main content into base64 and use the chunk_split, or quoted-printable - $strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA)?"\r\n":"\n")); // TODO Using this method creates unexpected line break on text/plain content. + $strContent = rtrim(wordwrap($strContent, 75, empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA) ? "\r\n" : "\n")); // TODO Using this method creates unexpected line break on text/plain content. if ($this->msgishtml) { if ($this->atleastoneimage) { - $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; + $out .= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; //$out.= "Content-Transfer-Encoding: 7bit".$this->eol; - $out.= $this->eol.($strContentAltText?$strContentAltText:strip_tags($strContent)).$this->eol; // Add plain text message - $out.= "--" . $this->alternative_boundary . $this->eol; - $out.= "Content-Type: multipart/related;".$this->eol." boundary=\"".$this->related_boundary."\"".$this->eol; - $out.= $this->eol; - $out.= "--" . $this->related_boundary . $this->eol; + $out .= $this->eol.($strContentAltText ? $strContentAltText : strip_tags($strContent)).$this->eol; // Add plain text message + $out .= "--".$this->alternative_boundary.$this->eol; + $out .= "Content-Type: multipart/related;".$this->eol." boundary=\"".$this->related_boundary."\"".$this->eol; + $out .= $this->eol; + $out .= "--".$this->related_boundary.$this->eol; } - if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part + if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part before html part { - $out.= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol; - $out.= $this->eol; - $out.= "--" . $this->alternative_boundary . $this->eol; - $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; + $out .= "Content-Type: multipart/alternative;".$this->eol." boundary=\"".$this->alternative_boundary."\"".$this->eol; + $out .= $this->eol; + $out .= "--".$this->alternative_boundary.$this->eol; + $out .= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; //$out.= "Content-Transfer-Encoding: 7bit".$this->eol; - $out.= $this->eol.$strContentAltText.$this->eol; - $out.= "--" . $this->alternative_boundary . $this->eol; + $out .= $this->eol.$strContentAltText.$this->eol; + $out .= "--".$this->alternative_boundary.$this->eol; } - $out.= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol; + $out .= "Content-Type: text/html; charset=".$conf->file->character_set_client.$this->eol; //$out.= "Content-Transfer-Encoding: 7bit".$this->eol; // TODO Use base64 - $out.= $this->eol.$strContent.$this->eol; + $out .= $this->eol.$strContent.$this->eol; - if (! $this->atleastoneimage && $strContentAltText && ! empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part + if (!$this->atleastoneimage && $strContentAltText && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) // Add plain text message part after html part { - $out.= "--" . $this->alternative_boundary . "--". $this->eol; + $out .= "--".$this->alternative_boundary."--".$this->eol; } } else { - $out.= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; + $out .= "Content-Type: text/plain; charset=".$conf->file->character_set_client.$this->eol; //$out.= "Content-Transfer-Encoding: 7bit".$this->eol; - $out.= $this->eol.$strContent.$this->eol; + $out .= $this->eol.$strContent.$this->eol; } - $out.= $this->eol; + $out .= $this->eol; // Encode images if ($this->atleastoneimage) { $out .= $this->write_images($this->images_encoded); // always end related and end alternative after inline images - $out .= "--" . $this->related_boundary . "--" . $this->eol; - $out .= $this->eol . "--" . $this->alternative_boundary . "--" . $this->eol; + $out .= "--".$this->related_boundary."--".$this->eol; + $out .= $this->eol."--".$this->alternative_boundary."--".$this->eol; $out .= $this->eol; } @@ -1208,8 +1208,8 @@ class CMailFile // phpcs:enable $out = ''; - $filename_list_size=count($filename_list); - for($i=0;$i < $filename_list_size;$i++) + $filename_list_size = count($filename_list); + for ($i = 0; $i < $filename_list_size; $i++) { if ($filename_list[$i]) { @@ -1218,18 +1218,18 @@ class CMailFile if ($encoded >= 0) { if ($mimefilename_list[$i]) $filename_list[$i] = $mimefilename_list[$i]; - if (! $mimetype_list[$i]) { + if (!$mimetype_list[$i]) { $mimetype_list[$i] = "application/octet-stream"; } - $out.= "--" . $this->mixed_boundary . $this->eol; - $out.= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol; - $out.= "Content-Type: " . $mimetype_list[$i] . "; name=\"".$filename_list[$i]."\"".$this->eol; - $out.= "Content-Transfer-Encoding: base64".$this->eol; - $out.= "Content-Description: ".$filename_list[$i].$this->eol; - $out.= $this->eol; - $out.= $encoded; - $out.= $this->eol; + $out .= "--".$this->mixed_boundary.$this->eol; + $out .= "Content-Disposition: attachment; filename=\"".$filename_list[$i]."\"".$this->eol; + $out .= "Content-Type: ".$mimetype_list[$i]."; name=\"".$filename_list[$i]."\"".$this->eol; + $out .= "Content-Transfer-Encoding: base64".$this->eol; + $out .= "Content-Description: ".$filename_list[$i].$this->eol; + $out .= $this->eol; + $out .= $encoded; + $out .= $this->eol; //$out.= $this->eol; } else @@ -1261,14 +1261,14 @@ class CMailFile { dol_syslog("CMailFile::write_images: ".$img["name"]); - $out.= "--" . $this->related_boundary . $this->eol; // always related for an inline image - $out.= "Content-Type: " . $img["content_type"] . "; name=\"".$img["name"]."\"".$this->eol; - $out.= "Content-Transfer-Encoding: base64".$this->eol; - $out.= "Content-Disposition: inline; filename=\"".$img["name"]."\"".$this->eol; - $out.= "Content-ID: <".$img["cid"].">".$this->eol; - $out.= $this->eol; - $out.= $img["image_encoded"]; - $out.= $this->eol; + $out .= "--".$this->related_boundary.$this->eol; // always related for an inline image + $out .= "Content-Type: ".$img["content_type"]."; name=\"".$img["name"]."\"".$this->eol; + $out .= "Content-Transfer-Encoding: base64".$this->eol; + $out .= "Content-Disposition: inline; filename=\"".$img["name"]."\"".$this->eol; + $out .= "Content-ID: <".$img["cid"].">".$this->eol; + $out .= $this->eol; + $out .= $img["image_encoded"]; + $out .= $this->eol; } } @@ -1289,39 +1289,39 @@ class CMailFile // phpcs:enable global $conf; - $_retVal=0; - $timeout=5; // Timeout in seconds + $_retVal = 0; + $timeout = 5; // Timeout in seconds if (function_exists('fsockopen')) { - $keyforsmtpserver='MAIN_MAIL_SMTP_SERVER'; - $keyforsmtpport ='MAIN_MAIL_SMTP_PORT'; - $keyforsmtpid ='MAIN_MAIL_SMTPS_ID'; - $keyforsmtppw ='MAIN_MAIL_SMTPS_PW'; - $keyfortls ='MAIN_MAIL_EMAIL_TLS'; - $keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS'; + $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER'; + $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT'; + $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID'; + $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW'; + $keyfortls = 'MAIN_MAIL_EMAIL_TLS'; + $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS'; if ($this->sendcontext == 'emailing' && !empty($conf->global->MAIN_MAIL_SENDMODE_EMAILING) && $conf->global->MAIN_MAIL_SENDMODE_EMAILING != 'default') { - $keyforsmtpserver='MAIN_MAIL_SMTP_SERVER_EMAILING'; - $keyforsmtpport ='MAIN_MAIL_SMTP_PORT_EMAILING'; - $keyforsmtpid ='MAIN_MAIL_SMTPS_ID_EMAILING'; - $keyforsmtppw ='MAIN_MAIL_SMTPS_PW_EMAILING'; - $keyfortls ='MAIN_MAIL_EMAIL_TLS_EMAILING'; - $keyforstarttls ='MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; + $keyforsmtpserver = 'MAIN_MAIL_SMTP_SERVER_EMAILING'; + $keyforsmtpport = 'MAIN_MAIL_SMTP_PORT_EMAILING'; + $keyforsmtpid = 'MAIN_MAIL_SMTPS_ID_EMAILING'; + $keyforsmtppw = 'MAIN_MAIL_SMTPS_PW_EMAILING'; + $keyfortls = 'MAIN_MAIL_EMAIL_TLS_EMAILING'; + $keyforstarttls = 'MAIN_MAIL_EMAIL_STARTTLS_EMAILING'; } // If we use SSL/TLS - if (! empty($conf->global->$keyfortls) && function_exists('openssl_open')) $host='ssl://'.$host; + if (!empty($conf->global->$keyfortls) && function_exists('openssl_open')) $host = 'ssl://'.$host; // tls smtp start with no encryption //if (! empty($conf->global->MAIN_MAIL_EMAIL_STARTTLS) && function_exists('openssl_open')) $host='tls://'.$host; dol_syslog("Try socket connection to host=".$host." port=".$port); //See if we can connect to the SMTP server if ($socket = @fsockopen( - $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. - $port, // which Port number to use - $errno, // actual system level error - $errstr, // and any text that goes with the error + $host, // Host to test, IP or domain. Add ssl:// for SSL/TLS. + $port, // which Port number to use + $errno, // actual system level error + $errstr, // and any text that goes with the error $timeout // timeout for reading/writing data over the socket )) { // Windows still does not have support for this timeout function @@ -1334,7 +1334,7 @@ class CMailFile } else { - $this->error = utf8_check('Error '.$errno.' - '.$errstr)?'Error '.$errno.' - '.$errstr:utf8_encode('Error '.$errno.' - '.$errstr); + $this->error = utf8_check('Error '.$errno.' - '.$errstr) ? 'Error '.$errno.' - '.$errstr : utf8_encode('Error '.$errno.' - '.$errstr); } } return $_retVal; @@ -1352,21 +1352,21 @@ class CMailFile public function server_parse($socket, $response) { // phpcs:enable - $_retVal = true; // Indicates if Object was created or not + $_retVal = true; // Indicates if Object was created or not $server_response = ''; while (substr($server_response, 3, 1) != ' ') { - if (! ($server_response = fgets($socket, 256)) ) + if (!($server_response = fgets($socket, 256))) { - $this->error="Couldn't get mail server response codes"; + $this->error = "Couldn't get mail server response codes"; return false; } } - if( !( substr($server_response, 0, 3) == $response ) ) + if (!(substr($server_response, 0, 3) == $response)) { - $this->error="Ran into problems sending Mail.\r\nResponse: $server_response"; + $this->error = "Ran into problems sending Mail.\r\nResponse: $server_response"; $_retVal = false; } @@ -1385,11 +1385,11 @@ class CMailFile $extensions = array_keys($this->image_types); $matches = array(); - preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found + preg_match_all('/(?:"|\')([^"\']+\.('.implode('|', $extensions).'))(?:"|\')/Ui', $this->html, $matches); // If "xxx.ext" or 'xxx.ext' found - if (! empty($matches)) + if (!empty($matches)) { - $i=0; + $i = 0; foreach ($matches[1] as $full) { if (preg_match('/file=([A-Za-z0-9_\-\/]+[\.]?[A-Za-z0-9]+)?$/i', $full, $regs)) // If xxx is 'file=aaa' @@ -1410,12 +1410,12 @@ class CMailFile // Content type if (preg_match('/^.+\.(\w{3,4})$/', $img, $reg)) { - $ext=strtolower($reg[1]); + $ext = strtolower($reg[1]); $this->html_images[$i]["content_type"] = $this->image_types[$ext]; } // cid - $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars) + $this->html_images[$i]["cid"] = dol_hash(uniqid(time()), 3); // Force md5 hash (does not contains special chars) $this->html = preg_replace("/src=\"$src\"|src='$src'/i", "src=\"cid:".$this->html_images[$i]["cid"]."\"", $this->html); } $i++; @@ -1426,7 +1426,7 @@ class CMailFile { $inline = array(); - $i=0; + $i = 0; foreach ($this->html_images as $img) { @@ -1485,13 +1485,13 @@ class CMailFile { global $conf; - $ret=''; + $ret = ''; - $arrayaddress=explode(',', $address); + $arrayaddress = explode(',', $address); // Boucle sur chaque composant de l'adresse - $i=0; - foreach($arrayaddress as $val) + $i = 0; + foreach ($arrayaddress as $val) { if (preg_match('/^(.*)<(.*)>$/i', trim($val), $regs)) { @@ -1508,36 +1508,36 @@ class CMailFile { $i++; - $newemail=''; + $newemail = ''; if ($format == 5) { - $newemail = $name?$name:$email; + $newemail = $name ? $name : $email; $newemail = ''.$newemail.''; } if ($format == 4) { - $newemail = $name?$name:$email; + $newemail = $name ? $name : $email; } if ($format == 2) { - $newemail=$email; + $newemail = $email; } if ($format == 1 || $format == 3) { - $newemail='<'.$email.'>'; + $newemail = '<'.$email.'>'; } if ($format == 0 || $format == 3) { - if (! empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) $newemail='<'.$email.'>'; - elseif (! $name) $newemail='<'.$email.'>'; - else $newemail=($format==3?'"':'').($encode?self::encodetorfc2822($name):$name).($format==3?'"':'').' <'.$email.'>'; + if (!empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)) $newemail = '<'.$email.'>'; + elseif (!$name) $newemail = '<'.$email.'>'; + else $newemail = ($format == 3 ? '"' : '').($encode ?self::encodetorfc2822($name) : $name).($format == 3 ? '"' : '').' <'.$email.'>'; } - $ret=($ret ? $ret.',' : '').$newemail; + $ret = ($ret ? $ret.',' : '').$newemail; // Stop if we have too much records if ($maxnumberofemail && $i >= $maxnumberofemail) { - if (count($arrayaddress) > $maxnumberofemail) $ret.='...'; + if (count($arrayaddress) > $maxnumberofemail) $ret .= '...'; break; } } @@ -1556,12 +1556,12 @@ class CMailFile { global $conf; - $ret=array(); + $ret = array(); - $arrayaddress=explode(',', $address); + $arrayaddress = explode(',', $address); // Boucle sur chaque composant de l'adresse - foreach($arrayaddress as $val) + foreach ($arrayaddress as $val) { if (preg_match('/^(.*)<(.*)>$/i', trim($val), $regs)) { @@ -1574,7 +1574,7 @@ class CMailFile $email = trim($val); } - $ret[$email]=empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL)?$name:null; + $ret[$email] = empty($conf->global->MAIN_MAIL_NO_FULL_EMAIL) ? $name : null; } return $ret; diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 258f87d2d9f..5cb869c6817 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -27,48 +27,48 @@ */ require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formfile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php'; -require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php'; -require_once DOL_DOCUMENT_ROOT . '/ecm/class/ecmfiles.class.php'; -require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/expensereport.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/price.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/lib/images.lib.php'; -require_once DOL_DOCUMENT_ROOT . '/core/modules/expensereport/modules_expensereport.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/expensereport.class.php'; -require_once DOL_DOCUMENT_ROOT . '/expensereport/class/paymentexpensereport.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php'; -require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php'; -if (! empty($conf->accounting->enabled)) { - require_once DOL_DOCUMENT_ROOT . '/accountancy/class/accountingjournal.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/expensereport.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/modules/expensereport/modules_expensereport.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/expensereport/class/paymentexpensereport.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; +if (!empty($conf->accounting->enabled)) { + require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; } // Load translation files required by the page -$langs->loadLangs(array("trips","bills","mails")); +$langs->loadLangs(array("trips", "bills", "mails")); -$action=GETPOST('action', 'aZ09'); -$cancel=GETPOST('cancel', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $date_start = dol_mktime(0, 0, 0, GETPOST('date_debutmonth', 'int'), GETPOST('date_debutday', 'int'), GETPOST('date_debutyear', 'int')); $date_end = dol_mktime(0, 0, 0, GETPOST('date_finmonth', 'int'), GETPOST('date_finday', 'int'), GETPOST('date_finyear', 'int')); $date = dol_mktime(0, 0, 0, GETPOST('datemonth', 'int'), GETPOST('dateday', 'int'), GETPOST('dateyear', 'int')); -$fk_project=GETPOST('fk_project', 'int'); -$vatrate=GETPOST('vatrate', 'alpha'); -$ref=GETPOST("ref", 'alpha'); -$comments=GETPOST('comments', 'none'); -$fk_c_type_fees=GETPOST('fk_c_type_fees', 'int'); -$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('socid_id', 'int'); +$fk_project = GETPOST('fk_project', 'int'); +$vatrate = GETPOST('vatrate', 'alpha'); +$ref = GETPOST("ref", 'alpha'); +$comments = GETPOST('comments', 'none'); +$fk_c_type_fees = GETPOST('fk_c_type_fees', 'int'); +$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('socid_id', 'int'); $childids = $user->getAllChildIds(1); // Security check -$id=GETPOST("id", 'int'); -if ($user->socid) $socid=$user->socid; +$id = GETPOST("id", 'int'); +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); @@ -76,38 +76,38 @@ $result = restrictedArea($user, 'expensereport', $id, 'expensereport'); $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; // If multicompany module is enabled, we redefine the root of data -if (! empty($conf->multicompany->enabled) && ! empty($conf->entity) && $conf->entity > 1) +if (!empty($conf->multicompany->enabled) && !empty($conf->entity) && $conf->entity > 1) { - $rootfordata.='/'.$conf->entity; + $rootfordata .= '/'.$conf->entity; } $conf->expensereport->dir_output = $rootfordata.'/expensereport'; // Define $urlwithroot -$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); -$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file +$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root)); +$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // PDF -$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); -$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); -$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); +$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0)); +$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0)); +$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0)); -$object=new ExpenseReport($db); +$object = new ExpenseReport($db); $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('expensereportcard','globalcard')); +$hookmanager->initHooks(array('expensereportcard', 'globalcard')); -$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->expensereport->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->expensereport->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->expensereport->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->expensereport->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $upload_dir = $conf->expensereport->dir_output.'/'.dol_sanitizeFileName($object->ref); @@ -117,9 +117,9 @@ if ($object->id > 0) { // Check current user can read this expense report $canread = 0; - if (! empty($user->rights->expensereport->readall)) $canread=1; - if (! empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread=1; - if (! $canread) + if (!empty($user->rights->expensereport->readall)) $canread = 1; + if (!empty($user->rights->expensereport->lire) && in_array($object->fk_user_author, $childids)) $canread = 1; + if (!$canread) { accessforbidden(); } @@ -138,43 +138,43 @@ if (empty($reshook)) { if ($cancel) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } - $action=''; + $action = ''; - $fk_project=''; - $date_start=''; - $date_end=''; - $date=''; - $comments=''; - $vatrate=''; - $value_unit_ht=''; - $value_unit=''; - $qty=1; - $fk_c_type_fees=-1; + $fk_project = ''; + $date_start = ''; + $date_end = ''; + $date = ''; + $comments = ''; + $vatrate = ''; + $value_unit_ht = ''; + $value_unit = ''; + $qty = 1; + $fk_c_type_fees = -1; } include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php'; if (GETPOSTISSET('sendit')) // If we just submit a file { - if ($action == 'updateline') $action='editline'; // To avoid to make the updateline now - else $action=''; // To avoid to make the addline now + if ($action == 'updateline') $action = 'editline'; // To avoid to make the updateline now + else $action = ''; // To avoid to make the addline now } - include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once + include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once - include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once - include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once + include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->expensereport->creer) { - if (1==0 && ! GETPOST('clone_content', 'alpha') && ! GETPOST('clone_receivers', 'alpha')) + if (1 == 0 && !GETPOST('clone_content', 'alpha') && !GETPOST('clone_receivers', 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } @@ -185,7 +185,7 @@ if (empty($reshook)) // Because createFromClone modifies the object, we must clone it so that we can restore it later if it fails $orig = clone $object; - $result=$object->createFromClone($user, GETPOST('fk_user_author', 'int')); + $result = $object->createFromClone($user, GETPOST('fk_user_author', 'int')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); @@ -195,7 +195,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $object = $orig; - $action=''; + $action = ''; } } } @@ -224,32 +224,32 @@ if (empty($reshook)) $object->date_debut = $date_start; $object->date_fin = $date_end; - $object->fk_user_author = GETPOST('fk_user_author', 'int'); - if (! ($object->fk_user_author > 0)) $object->fk_user_author = $user->id; + $object->fk_user_author = GETPOST('fk_user_author', 'int'); + if (!($object->fk_user_author > 0)) $object->fk_user_author = $user->id; - $fuser=new User($db); + $fuser = new User($db); $fuser->fetch($object->fk_user_author); $object->fk_statut = 1; - $object->fk_c_paiement = GETPOST('fk_c_paiement', 'int'); - $object->fk_user_validator = GETPOST('fk_user_validator', 'int'); - $object->note_public = GETPOST('note_public', 'none'); - $object->note_private = GETPOST('note_private', 'none'); + $object->fk_c_paiement = GETPOST('fk_c_paiement', 'int'); + $object->fk_user_validator = GETPOST('fk_user_validator', 'int'); + $object->note_public = GETPOST('note_public', 'none'); + $object->note_private = GETPOST('note_private', 'none'); // Fill array 'array_options' with data from add form - if (! $error) + if (!$error) { $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; } - if (! $error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) + if (!$error && empty($conf->global->EXPENSEREPORT_ALLOW_OVERLAPPING_PERIODS) && $object->periode_existe($fuser, $object->date_debut, $object->date_fin)) { $error++; setEventMessages($langs->trans("ErrorDoubleDeclaration"), null, 'errors'); - $action='create'; + $action = 'create'; } - if (! $error) + if (!$error) { $db->begin(); @@ -259,7 +259,7 @@ if (empty($reshook)) $error++; } - if (! $error) + if (!$error) { $db->commit(); Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); @@ -269,7 +269,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); - $action='create'; + $action = 'create'; } } } @@ -282,7 +282,7 @@ if (empty($reshook)) $object->date_debut = $date_start; $object->date_fin = $date_end; - if($object->fk_statut < 3) + if ($object->fk_statut < 3) { $object->fk_user_validator = GETPOST('fk_user_validator', 'int'); } @@ -312,7 +312,7 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; - if (! $error) + if (!$error) { // Actions on extra fields $result = $object->insertExtraFields('EXPENSEREPORT_MODIFY'); @@ -347,11 +347,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -363,7 +363,7 @@ if (empty($reshook)) $error++; } - if (! $error && $result > 0 && $object->fk_user_validator > 0) + if (!$error && $result > 0 && $object->fk_user_validator > 0) { $langs->load("mails"); @@ -379,11 +379,11 @@ if (empty($reshook)) if ($emailTo && $emailFrom) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportWaitingForApproval"); @@ -409,10 +409,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); } else @@ -420,9 +420,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -434,17 +434,17 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } - if (! $error) + if (!$error) { $db->commit(); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); @@ -471,11 +471,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -498,11 +498,11 @@ if (empty($reshook)) if ($emailFrom && $emailTo) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportWaitingForReApproval"); @@ -533,10 +533,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -546,9 +546,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -560,13 +560,13 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } else @@ -592,11 +592,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -614,7 +614,7 @@ if (empty($reshook)) // CC $emailCC = $conf->global->NDF_CC_EMAILS; - if (empty($emailTo)) $emailTo=$emailCC; + if (empty($emailTo)) $emailTo = $emailCC; // FROM $expediteur = new User($db); @@ -623,11 +623,11 @@ if (empty($reshook)) if ($emailFrom && $emailTo) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportApproved"); @@ -655,10 +655,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -668,9 +668,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -682,23 +682,23 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("FailedtoSetToApprove"), null, 'warnings'); - $action=''; + $action = ''; } } - if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->approve) + if ($action == "confirm_refuse" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->approve) { $object = new ExpenseReport($db); $object->fetch($id); @@ -714,11 +714,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -741,11 +741,11 @@ if (empty($reshook)) if ($emailFrom && $emailTo) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportRefused"); @@ -774,10 +774,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -787,9 +787,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -801,26 +801,26 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("FailedtoSetToDeny"), null, 'warnings'); - $action=''; + $action = ''; } } //var_dump($user->id == $object->fk_user_validator);exit; - if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->creer) + if ($action == "confirm_cancel" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { - if (! GETPOST('detail_cancel', 'alpha')) + if (!GETPOST('detail_cancel', 'alpha')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } @@ -842,11 +842,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -869,11 +869,11 @@ if (empty($reshook)) if ($emailFrom && $emailTo) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportCanceled"); @@ -902,10 +902,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -915,9 +915,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -929,19 +929,19 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("FailedToSetToCancel"), null, 'warnings'); - $action=''; + $action = ''; } } else @@ -951,7 +951,7 @@ if (empty($reshook)) } } - if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha')=="yes" && $id > 0 && $user->rights->expensereport->creer) + if ($action == "confirm_setdraft" && GETPOST('confirm', 'alpha') == "yes" && $id > 0 && $user->rights->expensereport->creer) { $object = new ExpenseReport($db); $object->fetch($id); @@ -968,11 +968,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1011,11 +1011,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1039,11 +1039,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1067,11 +1067,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1094,11 +1094,11 @@ if (empty($reshook)) if ($emailFrom && $emailTo) { - $filename=array(); $filedir=array(); $mimetype=array(); + $filename = array(); $filedir = array(); $mimetype = array(); // SUBJECT $societeName = $conf->global->MAIN_INFO_SOCIETE_NOM; - if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; + if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $societeName = $conf->global->MAIN_APPLICATION_TITLE; $subject = $societeName." - ".$langs->transnoentities("ExpenseReportPaid"); @@ -1116,10 +1116,10 @@ if (empty($reshook)) if ($mailfile) { // SEND - $result=$mailfile->sendfile(); + $result = $mailfile->sendfile(); if ($result) { - $mesg=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); + $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; @@ -1129,9 +1129,9 @@ if (empty($reshook)) $langs->load("other"); if ($mailfile->error) { - $mesg=''; - $mesg.=$langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); - $mesg.='
'.$mailfile->error; + $mesg = ''; + $mesg .= $langs->trans('ErrorFailedToSendMail', $emailFrom, $emailTo); + $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } else @@ -1143,19 +1143,19 @@ if (empty($reshook)) else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); - $action=''; + $action = ''; } } else { setEventMessages($langs->trans("FailedToSetPaid"), null, 'warnings'); - $action=''; + $action = ''; } } @@ -1167,12 +1167,12 @@ if (empty($reshook)) $fk_ecm_files = 0; if (GETPOSTISSET('attachfile')) { - $arrayoffiles=GETPOST('attachfile', 'array'); - if (is_array($arrayoffiles) && ! empty($arrayoffiles[0])) + $arrayoffiles = GETPOST('attachfile', 'array'); + if (is_array($arrayoffiles) && !empty($arrayoffiles[0])) { include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $relativepath='expensereport/'.$object->ref.'/'.$arrayoffiles[0]; - $ecmfiles=new EcmFiles($db); + $relativepath = 'expensereport/'.$object->ref.'/'.$arrayoffiles[0]; + $ecmfiles = new EcmFiles($db); $ecmfiles->fetch(0, '', $relativepath); $fk_ecm_files = $ecmfiles->id; } @@ -1182,8 +1182,8 @@ if (empty($reshook)) if (empty($vatrate)) $vatrate = "0.000"; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); - $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); - $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); + $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); + $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); if (empty($value_unit)) { $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); @@ -1192,24 +1192,24 @@ if (empty($reshook)) $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat', 'int'); $qty = GETPOST('qty', 'int'); - if (empty($qty)) $qty=1; + if (empty($qty)) $qty = 1; - if (! ($fk_c_type_fees > 0)) + if (!($fk_c_type_fees > 0)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $action=''; + $action = ''; } if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("VAT")), null, 'errors'); - $action=''; + $action = ''; } // Si aucune date n'est rentrée - if (empty($date) || $date=="--") + if (empty($date) || $date == "--") { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); @@ -1227,9 +1227,9 @@ if (empty($reshook)) setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings'); } - if (! $error) + if (!$error) { - $type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees + $type = 0; // TODO What if service ? We should take the type product/service from the type of expense report llx_c_type_fees // Insert line $result = $object->addline($qty, $value_unit, $fk_c_type_fees, $vatrate, $date, $comments, $fk_project, $fk_c_exp_tax_cat, $type, $fk_ecm_files); @@ -1241,9 +1241,9 @@ if (empty($reshook)) // Define output language $outputlangs = $langs; $newlang = GETPOST('lang_id', 'alpha'); - if (! empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) + if (!empty($conf->global->MAIN_MULTILANGS) && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } @@ -1265,7 +1265,7 @@ if (empty($reshook)) } } - $action=''; + $action = ''; } if ($action == 'confirm_delete_line' && GETPOST("confirm", 'alpha') == "yes" && $user->rights->expensereport->creer) @@ -1278,7 +1278,7 @@ if (empty($reshook)) $total_ht = $object_ligne->total_ht; $total_tva = $object_ligne->total_tva; - $result=$object->deleteline(GETPOST("rowid", 'int'), $user); + $result = $object->deleteline(GETPOST("rowid", 'int'), $user); if ($result >= 0) { if ($result > 0) @@ -1290,11 +1290,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1320,12 +1320,12 @@ if (empty($reshook)) $fk_ecm_files = 0; if (GETPOSTISSET('attachfile')) { - $arrayoffiles=GETPOST('attachfile', 'array'); - if (is_array($arrayoffiles) && ! empty($arrayoffiles[0])) + $arrayoffiles = GETPOST('attachfile', 'array'); + if (is_array($arrayoffiles) && !empty($arrayoffiles[0])) { include_once DOL_DOCUMENT_ROOT.'/ecm/class/ecmfiles.class.php'; - $relativepath='expensereport/'.$object->ref.'/'.$arrayoffiles[0]; - $ecmfiles=new EcmFiles($db); + $relativepath = 'expensereport/'.$object->ref.'/'.$arrayoffiles[0]; + $ecmfiles = new EcmFiles($db); $ecmfiles->fetch(0, '', $relativepath); $fk_ecm_files = $ecmfiles->id; } @@ -1343,24 +1343,24 @@ if (empty($reshook)) if (empty($vatrate)) $vatrate = "0.000"; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $vatrate)); - $value_unit_ht=price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); - $value_unit=price2num(GETPOST('value_unit', 'alpha'), 'MU'); + $value_unit_ht = price2num(GETPOST('value_unit_ht', 'alpha'), 'MU'); + $value_unit = price2num(GETPOST('value_unit', 'alpha'), 'MU'); if (empty($value_unit)) { $value_unit = price2num($value_unit_ht + ($value_unit_ht * $tmpvat / 100), 'MU'); } - if (! GETPOST('fk_c_type_fees', 'int') > 0) + if (!GETPOST('fk_c_type_fees', 'int') > 0) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - $action=''; + $action = ''; } if ((int) $tmpvat < 0 || $tmpvat == '') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Vat")), null, 'errors'); - $action=''; + $action = ''; } // Warning if date out of range if ($date < $object->date_debut || $date > ($object->date_fin + (24 * 3600 - 1))) @@ -1369,7 +1369,7 @@ if (empty($reshook)) setEventMessages($langs->trans("WarningDateOfLineMustBeInExpenseReportRange"), null, 'warnings'); } - if (! $error) + if (!$error) { // TODO Use update method of ExpenseReportLine $result = $object->updateline($rowid, $type_fees_id, $projet_id, $vatrate, $comments, $qty, $value_unit, $date, $id, $fk_c_exp_tax_cat, $fk_ecm_files); @@ -1384,11 +1384,11 @@ if (empty($reshook)) $newlang = ''; if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->thirdparty->default_lang; - if (! empty($newlang)) { + if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); } - $model=$object->modelpdf; + $model = $object->modelpdf; $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); @@ -1411,9 +1411,9 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to send emails - $trigger_name='EXPENSEREPORT_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_EXPENSEREPORT_TO'; - $trackid='exp'.$object->id; + $trigger_name = 'EXPENSEREPORT_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_EXPENSEREPORT_TO'; + $trackid = 'exp'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc @@ -1427,15 +1427,15 @@ if (empty($reshook)) * View */ -$title=$langs->trans("ExpenseReport") . " - " . $langs->trans("Card"); -$helpurl="EN:Module_Expense_Reports"; +$title = $langs->trans("ExpenseReport")." - ".$langs->trans("Card"); +$helpurl = "EN:Module_Expense_Reports"; llxHeader("", $title, $helpurl); $form = new Form($db); $formfile = new FormFile($db); $formproject = new FormProjets($db); $projecttmp = new Project($db); -$paymentexpensereportstatic=new PaymentExpenseReport($db); +$paymentexpensereportstatic = new PaymentExpenseReport($db); $bankaccountstatic = new Account($db); $ecmfilesstatic = new EcmFiles($db); @@ -1457,7 +1457,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("DateStart").''; print ''; - print $form->selectDate($date_start?$date_start:-1, 'date_debut', 0, 0, 0, '', 1, 1); + print $form->selectDate($date_start ? $date_start : -1, 'date_debut', 0, 0, 0, '', 1, 1); print ''; print ''; @@ -1465,7 +1465,7 @@ if ($action == 'create') print ''; print ''.$langs->trans("DateEnd").''; print ''; - print $form->selectDate($date_end?$date_end:-1, 'date_fin', 0, 0, 0, '', 1, 1); + print $form->selectDate($date_end ? $date_end : -1, 'date_fin', 0, 0, 0, '', 1, 1); print ''; print ''; @@ -1473,11 +1473,11 @@ if ($action == 'create') print ''; print ''.$langs->trans("User").''; print ''; - $defaultselectuser=$user->id; - if (GETPOST('fk_user_author', 'int') > 0) $defaultselectuser=GETPOST('fk_user_author', 'int'); + $defaultselectuser = $user->id; + if (GETPOST('fk_user_author', 'int') > 0) $defaultselectuser = GETPOST('fk_user_author', 'int'); $include_users = 'hierarchyme'; - if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->expensereport->writeall_advance)) $include_users=array(); - $s=$form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); + if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expensereport->writeall_advance)) $include_users = array(); + $s = $form->select_dolusers($defaultselectuser, "fk_user_author", 0, "", 0, $include_users, '', '0,'.$conf->entity); print $s; print ''; print ''; @@ -1491,17 +1491,17 @@ if ($action == 'create') if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport"); else { - $defaultselectuser=(empty($user->fk_user_expense_validator) ? $user->fk_user : $user->fk_user_expense_validator); // Will work only if supervisor has permission to approve so is inside include_users - if (! empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser=$conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver - if (GETPOST('fk_user_validator', 'int') > 0) $defaultselectuser=GETPOST('fk_user_validator', 'int'); - $s=$form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE))?0:1), $include_users); + $defaultselectuser = (empty($user->fk_user_expense_validator) ? $user->fk_user : $user->fk_user_expense_validator); // Will work only if supervisor has permission to approve so is inside include_users + if (!empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser = $conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver + if (GETPOST('fk_user_validator', 'int') > 0) $defaultselectuser = GETPOST('fk_user_validator', 'int'); + $s = $form->select_dolusers($defaultselectuser, "fk_user_validator", 1, "", ((empty($defaultselectuser) || empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR_UNCHANGEABLE)) ? 0 : 1), $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); } print ''; print ''; // Payment mode - if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) + if (!empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) { print ''; print ''.$langs->trans("ModePaiement").''; @@ -1513,7 +1513,7 @@ if ($action == 'create') // Public note print ''; - print '' . $langs->trans('NotePublic') . ''; + print ''.$langs->trans('NotePublic').''; print ''; $doleditor = new DolEditor('note_public', $note_public, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -1523,7 +1523,7 @@ if ($action == 'create') // Private note if (empty($user->socid)) { print ''; - print '' . $langs->trans('NotePrivate') . ''; + print ''.$langs->trans('NotePrivate').''; print ''; $doleditor = new DolEditor('note_private', $note_private, '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, '90%'); @@ -1553,7 +1553,7 @@ if ($action == 'create') } else { - if($id > 0 || $ref) + if ($id > 0 || $ref) { $result = $object->fetch($id, $ref); @@ -1561,7 +1561,7 @@ else if ($result > 0) { - if (! in_array($object->fk_user_author, $user->getAllChildIds(1))) + if (!in_array($object->fk_user_author, $user->getAllChildIds(1))) { if (empty($user->rights->expensereport->readall) && empty($user->rights->expensereport->lire_tous) && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || empty($user->rights->expensereport->writeall_advance))) @@ -1582,7 +1582,7 @@ else $head = expensereport_prepare_head($object); - if ($action == 'edit' && ($object->fk_statut < 3 || $object->fk_statut==99)) + if ($action == 'edit' && ($object->fk_statut < 3 || $object->fk_statut == 99)) { print "\n"; print ''; @@ -1590,7 +1590,7 @@ else dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), 0, 'trip'); - if($object->fk_statut==99) + if ($object->fk_statut == 99) { print ''; } @@ -1599,14 +1599,14 @@ else print ''; } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; print ''; print ''; print ''; print ''; print ''; - if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) + if (!empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) { print ''; print ''; @@ -1642,13 +1642,13 @@ else print ''; } - if($object->fk_statut<3) + if ($object->fk_statut < 3) { print ''; - print ''; // Approbator + print ''; // Approbator print ''; print ''; @@ -1658,18 +1658,18 @@ else print ''; print ''; print ''; } - if ($object->fk_statut==6) + if ($object->fk_statut == 6) { print ''; print ''; print ''; @@ -1697,70 +1697,70 @@ else // Clone confirmation if ($action == 'clone') { // Create an array for form - $criteriaforfilter='hierarchyme'; - if (! empty($user->rights->expensereport->readall)) $criteriaforfilter=''; + $criteriaforfilter = 'hierarchyme'; + if (!empty($user->rights->expensereport->readall)) $criteriaforfilter = ''; $formquestion = array( 'text' => '', - array('type' => 'other','name' => 'fk_user_author','label' => $langs->trans("SelectTargetUser"),'value' => $form->select_dolusers((GETPOST('fk_user_author', 'int')> 0 ? GETPOST('fk_user_author', 'int') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter)) + array('type' => 'other', 'name' => 'fk_user_author', 'label' => $langs->trans("SelectTargetUser"), 'value' => $form->select_dolusers((GETPOST('fk_user_author', 'int') > 0 ? GETPOST('fk_user_author', 'int') : $user->id), 'fk_user_author', 0, null, 0, $criteriaforfilter)) ); // Paiement incomplet. On demande si motif = escompte ou autre - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneExpenseReport', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } if ($action == 'save') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("SaveTrip"), $langs->trans("ConfirmSaveTrip"), "confirm_validate", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("SaveTrip"), $langs->trans("ConfirmSaveTrip"), "confirm_validate", "", "", 1); } if ($action == 'save_from_refuse') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("SaveTrip"), $langs->trans("ConfirmSaveTrip"), "confirm_save_from_refuse", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("SaveTrip"), $langs->trans("ConfirmSaveTrip"), "confirm_save_from_refuse", "", "", 1); } if ($action == 'delete') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("DeleteTrip"), $langs->trans("ConfirmDeleteTrip"), "confirm_delete", "", "", 1); } if ($action == 'validate') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("ValideTrip"), $langs->trans("ConfirmValideTrip"), "confirm_approve", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("ValideTrip"), $langs->trans("ConfirmValideTrip"), "confirm_approve", "", "", 1); } if ($action == 'paid') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("PaidTrip"), $langs->trans("ConfirmPaidTrip"), "confirm_paid", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("PaidTrip"), $langs->trans("ConfirmPaidTrip"), "confirm_paid", "", "", 1); } if ($action == 'cancel') { - $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text",'label'=>''.$langs->trans("Comment").'','name'=>"detail_cancel",'value'=>"")); - $formconfirm=$form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1); + $array_input = array('text'=>$langs->trans("ConfirmCancelTrip"), array('type'=>"text", 'label'=>''.$langs->trans("Comment").'', 'name'=>"detail_cancel", 'value'=>"")); + $formconfirm = $form->formconfirm($_SEVER["PHP_SELF"]."?id=".$id, $langs->trans("Cancel"), "", "confirm_cancel", $array_input, "", 1); } if ($action == 'setdraft') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("BrouillonnerTrip"), $langs->trans("ConfirmBrouillonnerTrip"), "confirm_setdraft", "", "", 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("BrouillonnerTrip"), $langs->trans("ConfirmBrouillonnerTrip"), "confirm_setdraft", "", "", 1); } if ($action == 'refuse') // Deny { - $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text",'label'=>$langs->trans("Comment"),'name'=>"detail_refuse",'value'=>"")); - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1); + $array_input = array('text'=>$langs->trans("ConfirmRefuseTrip"), array('type'=>"text", 'label'=>$langs->trans("Comment"), 'name'=>"detail_refuse", 'value'=>"")); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id, $langs->trans("Deny"), '', "confirm_refuse", $array_input, "yes", 1); } if ($action == 'delete_line') { - $formconfirm=$form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid', 'int'), $langs->trans("DeleteLine"), $langs->trans("ConfirmDeleteLine"), "confirm_delete_line", '', 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$id."&rowid=".GETPOST('rowid', 'int'), $langs->trans("DeleteLine"), $langs->trans("ConfirmDeleteLine"), "confirm_delete_line", '', 'yes', 1); } // Print form confirm print $formconfirm; // Expense report card - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref='
'; + $morehtmlref = '
'; /* // Ref customer $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', 0, 1); @@ -1799,7 +1799,7 @@ else } } }*/ - $morehtmlref.='
'; + $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -1815,8 +1815,8 @@ else print ''; print ''; - if (! empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) + if (!empty($conf->global->EXPENSEREPORT_ASK_PAYMENTMODE_ON_CREATION)) { print ''; print ''; @@ -1849,14 +1849,14 @@ else if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) // informed { print ''; - print ''; // approver + print ''; // approver print ''; } - elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) + elseif ($object->fk_statut == ExpenseReport::STATUS_CANCELED) { print ''; print ''; print ''; } - if ($object->fk_statut==99 || !empty($object->detail_refuse)) + if ($object->fk_statut == 99 || !empty($object->detail_refuse)) { print ''; print ''; print ''; @@ -1923,7 +1923,7 @@ else print ''; } - if($object->fk_statut==6) + if ($object->fk_statut == 6) { /* TODO this fields are not yet filled print ''; @@ -1942,7 +1942,7 @@ else // Other attributes $cols = 2; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'.$langs->trans("User").''; - $userfee=new User($db); + $userfee = new User($db); if ($object->fk_user_author > 0) { $userfee->fetch($object->fk_user_author); @@ -1632,7 +1632,7 @@ else print '
'.$langs->trans("ModePaiement").'
'.$langs->trans("VALIDATOR").''.$langs->trans("VALIDATOR").''; $include_users = $object->fetch_users_approver_expensereport(); - $s=$form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, "", 0, $include_users); + $s = $form->select_dolusers($object->fk_user_validator, "fk_user_validator", 1, "", 0, $include_users); print $form->textwithpicto($s, $langs->trans("AnyOtherInThisListCanValidate")); print '
'.$langs->trans("VALIDOR").''; - $userfee=new User($db); + $userfee = new User($db); $userfee->fetch($object->fk_user_valid); print $userfee->getNomUrl(-1); print '
'.$langs->trans("AUTHORPAIEMENT").''; - $userfee=new User($db); + $userfee = new User($db); $userfee->fetch($user->id); print $userfee->getNomUrl(-1); print '
'; if ($object->fk_user_author > 0) { - $userauthor=new User($db); - $result=$userauthor->fetch($object->fk_user_author); + $userauthor = new User($db); + $result = $userauthor->fetch($object->fk_user_author); if ($result < 0) dol_print_error('', $userauthor->error); elseif ($result > 0) print $userauthor->getNomUrl(-1); } @@ -1828,7 +1828,7 @@ else print get_date_range($object->date_debut, $object->date_fin, 'day', $langs, 0); print '
'.$langs->trans("ModePaiement").'
'.$langs->trans("VALIDATOR").''.$langs->trans("VALIDATOR").''; if ($object->fk_user_validator > 0) { - $userfee=new User($db); + $userfee = new User($db); $result = $userfee->fetch($object->fk_user_validator); if ($result > 0) print $userfee->getNomUrl(-1); - if (empty($userfee->email) || ! isValidEmail($userfee->email)) + if (empty($userfee->email) || !isValidEmail($userfee->email)) { $langs->load("errors"); print img_warning($langs->trans("ErrorBadEMail", $userfee->email)); @@ -1864,14 +1864,14 @@ else } print '
'.$langs->trans("CANCEL_USER").''; if ($object->fk_user_cancel > 0) { - $userfee=new User($db); + $userfee = new User($db); $result = $userfee->fetch($object->fk_user_cancel); if ($result > 0) print $userfee->getNomUrl(-1); } @@ -1893,7 +1893,7 @@ else print ''; if ($object->fk_user_approve > 0) { - $userapp=new User($db); + $userapp = new User($db); $result = $userapp->fetch($object->fk_user_approve); if ($result > 0) print $userapp->getNomUrl(-1); } @@ -1905,12 +1905,12 @@ else print '
'.$langs->trans("REFUSEUR").''; - $userfee=new User($db); + $userfee = new User($db); $result = $userfee->fetch($object->fk_user_refuse); if ($result > 0) print $userfee->getNomUrl(-1); print '
'; @@ -1959,10 +1959,10 @@ else print ''.price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency).''; $rowspan = 5; if ($object->fk_statut <= ExpenseReport::STATUS_VALIDATED) $rowspan++; - elseif($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan+=2; - else $rowspan+=2; - if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan+=2; - if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan+=2; + elseif ($object->fk_statut == ExpenseReport::STATUS_CANCELED) $rowspan += 2; + else $rowspan += 2; + if ($object->fk_statut == ExpenseReport::STATUS_REFUSED || !empty($object->detail_refuse)) $rowspan += 2; + if ($object->fk_statut == ExpenseReport::STATUS_CLOSED) $rowspan += 2; print ""; print ''; @@ -1978,36 +1978,36 @@ else // List of payments already done $nbcols = 3; - if (! empty($conf->banque->enabled)) { - $nbrows ++; - $nbcols ++; + if (!empty($conf->banque->enabled)) { + $nbrows++; + $nbcols++; } print ''; print ''; - print ''; - print ''; - print ''; - if (! empty($conf->banque->enabled)) { - print ''; + print ''; + print ''; + print ''; + if (!empty($conf->banque->enabled)) { + print ''; } - print ''; + print ''; print ''; print ''; // Payments already done (from payment on this expensereport) $sql = "SELECT p.rowid, p.num_payment, p.datep as dp, p.amount, p.fk_bank,"; - $sql.= "c.code as p_code, c.libelle as payment_type,"; - $sql.= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; - $sql.= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; - $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank as b ON p.fk_bank = b.rowid'; - $sql.= ' LEFT JOIN ' . MAIN_DB_PREFIX . 'bank_account as ba ON b.fk_account = ba.rowid'; - $sql.= " WHERE e.rowid = '".$id."'"; - $sql.= " AND p.fk_expensereport = e.rowid"; - $sql.= ' AND e.entity IN ('.getEntity('expensereport').')'; - $sql.= " ORDER BY dp"; + $sql .= "c.code as p_code, c.libelle as payment_type,"; + $sql .= "ba.rowid as baid, ba.ref as baref, ba.label, ba.number as banumber, ba.account_number, ba.fk_accountancy_journal"; + $sql .= " FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."payment_expensereport as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON p.fk_typepayment = c.id"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank as b ON p.fk_bank = b.rowid'; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'bank_account as ba ON b.fk_account = ba.rowid'; + $sql .= " WHERE e.rowid = '".$id."'"; + $sql .= " AND p.fk_expensereport = e.rowid"; + $sql .= ' AND e.entity IN ('.getEntity('expensereport').')'; + $sql .= " ORDER BY dp"; $resql = $db->query($sql); if ($resql) @@ -2029,16 +2029,16 @@ else print $paymentexpensereportstatic->getNomUrl(1); print ''; print '\n"; - $labeltype=$langs->trans("PaymentType".$objp->p_code)!=("PaymentType".$objp->p_code)?$langs->trans("PaymentType".$objp->p_code):$objp->payment_type; + $labeltype = $langs->trans("PaymentType".$objp->p_code) != ("PaymentType".$objp->p_code) ? $langs->trans("PaymentType".$objp->p_code) : $objp->payment_type; print "\n"; - if (! empty($conf->banque->enabled)) + if (!empty($conf->banque->enabled)) { $bankaccountstatic->id = $objp->baid; $bankaccountstatic->ref = $objp->baref; $bankaccountstatic->label = $objp->baref; $bankaccountstatic->number = $objp->banumber; - if (! empty($conf->accounting->enabled)) { + if (!empty($conf->accounting->enabled)) { $bankaccountstatic->account_number = $objp->account_number; $accountingjournal = new AccountingJournal($db); @@ -2057,9 +2057,9 @@ else $totalpaid += $objp->amount; $i++; } - if (! is_null($totalpaid)) + if (!is_null($totalpaid)) { - $totalpaid = price2num($totalpaid); // Round $totalpaid to fix floating problem after addition into loop + $totalpaid = price2num($totalpaid); // Round $totalpaid to fix floating problem after addition into loop } $remaintopay = price2num($object->total_ttc - $totalpaid); @@ -2076,11 +2076,11 @@ else { $cssforamountpaymentcomplete = 'amountpaymentneutral'; } - print ''; - print ''; + print ''; + print ''; - print ''; - print ''; + print ''; + print ''; $db->free($resql); } @@ -2098,8 +2098,8 @@ else print '
'; - $actiontouse='updateline'; - if (($object->fk_statut==0 || $object->fk_statut==99) && $action != 'editline') $actiontouse='addline'; + $actiontouse = 'updateline'; + if (($object->fk_statut == 0 || $object->fk_statut == 99) && $action != 'editline') $actiontouse = 'addline'; print ''; print ''; @@ -2112,13 +2112,13 @@ else if (!empty($object->lines)) { - $i = 0;$total = 0; + $i = 0; $total = 0; print ''; print ''; //print ''; print ''; - if (! empty($conf->projet->enabled)) print ''; + if (!empty($conf->projet->enabled)) print ''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print ''; print ''; print ''; @@ -2155,14 +2155,14 @@ else // Date print ''; // Project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { print ''; @@ -2185,7 +2185,7 @@ else print ''; // Unit price HT print ''; @@ -2312,7 +2312,7 @@ else print $numline; print ''; - print ''; - $filenamelinked=''; + $filenamelinked = ''; if ($line->fk_ecm_files > 0) { $result = $ecmfilesstatic->fetch($line->fk_ecm_files); @@ -2355,7 +2355,7 @@ else } } - $tredited='tredited'; + $tredited = 'tredited'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_addfile.tpl.php'; include DOL_DOCUMENT_ROOT.'/expensereport/tpl/expensereport_linktofile.tpl.php'; @@ -2369,7 +2369,7 @@ else print ''; // Select project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { print ''; // Unit price @@ -2441,8 +2441,8 @@ else && $user->rights->expensereport->creer) { $colspan = 11; - if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; - if (! empty($conf->projet->enabled)) $colspan++; + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; + if (!empty($conf->projet->enabled)) $colspan++; if ($action != 'editline') $colspan++; $nbFiles = $nbLinks = 0; @@ -2452,10 +2452,10 @@ else require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; - $upload_dir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref); - $arrayoffiles=dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$'); + $upload_dir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); + $arrayoffiles = dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png|'.preg_quote(dol_sanitizeFileName($object->ref.'.pdf'), '/').')$'); $nbFiles = count($arrayoffiles); - $nbLinks=Link::count($db, $object->element, $object->id); + $nbLinks = Link::count($db, $object->element, $object->id); } // Add line with link to add new file or attach to an existing file @@ -2499,7 +2499,7 @@ else print ''; print ''; print ''; - if (! empty($conf->projet->enabled)) print ''; + if (!empty($conf->projet->enabled)) print ''; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) print ''; print ''; print ''; @@ -2520,18 +2520,18 @@ else // Select date print ''; // Select project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { print ''; } - if (! empty($conf->global->MAIN_USE_EXPENSE_IK)) + if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) { print ''; // Unit price net @@ -2568,7 +2568,7 @@ else // Quantity print ''; // Picture @@ -2634,7 +2634,7 @@ if ($action != 'create' && $action != 'edit') // Send if ($object->fk_statut > ExpenseReport::STATUS_DRAFT) { //if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->expensereport->expensereport_advance->send)) { - print ''; + print ''; //} else // print ''; } @@ -2665,7 +2665,7 @@ if ($action != 'create' && $action != 'edit') * ET fk_user_author == user courant * Afficher : "Enregistrer" / "Modifier" / "Supprimer" */ - if($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED) + if ($user->rights->expensereport->creer && $object->fk_statut == ExpenseReport::STATUS_REFUSED) { if ($user->id == $object->fk_user_author || $user->id == $object->fk_user_valid) { @@ -2729,16 +2729,16 @@ if ($action != 'create' && $action != 'edit') } // If bank module is used - if ($user->rights->expensereport->to_paid && ! empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) + if ($user->rights->expensereport->to_paid && !empty($conf->banque->enabled) && $object->fk_statut == ExpenseReport::STATUS_APPROVED) { // Pay if ($remaintopay == 0) { - print '
' . $langs->trans('DoPayment') . '
'; + print '
'.$langs->trans('DoPayment').'
'; } else { - print ''; + print ''; } } @@ -2748,7 +2748,7 @@ if ($action != 'create' && $action != 'edit') //if ((round($remaintopay) == 0 || empty($conf->banque->enabled)) && $object->paid == 0) if ($object->paid == 0) { - print '"; + print '"; } } @@ -2773,7 +2773,7 @@ if ($action != 'create' && $action != 'edit') // Clone if ($user->rights->expensereport->creer) { - print ''; + print ''; } /* If draft, validated, cancel, and user can create, he can always delete its card before it is approved */ @@ -2782,7 +2782,7 @@ if ($action != 'create' && $action != 'edit') // Delete print ''; } - elseif($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED) + elseif ($user->rights->expensereport->supprimer && $object->fk_statut != ExpenseReport::STATUS_CLOSED) { // Delete print ''; @@ -2809,14 +2809,14 @@ if ($action != 'presend') print '
'; print ''; // ancre - if($user->rights->expensereport->creer && $action != 'create' && $action != 'edit') + if ($user->rights->expensereport->creer && $action != 'create' && $action != 'edit') { - $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->expensereport->dir_output . "/" . dol_sanitizeFileName($object->ref); - $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed = $user->rights->expensereport->creer; - $delallowed = $user->rights->expensereport->creer; - $var = true; + $filename = dol_sanitizeFileName($object->ref); + $filedir = $conf->expensereport->dir_output."/".dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = $user->rights->expensereport->creer; + $delallowed = $user->rights->expensereport->creer; + $var = true; print $formfile->showdocuments('expensereport', $filename, $filedir, $urlsource, $genallowed, $delallowed); $somethingshown = $formfile->numoffiles; } @@ -2832,7 +2832,7 @@ if ($action != 'presend') print '
'; // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'expensereport', null); @@ -2840,8 +2840,8 @@ if ($action != 'presend') } // Presend form -$modelmail='expensereport'; -$defaulttopic='SendExpenseReportRef'; +$modelmail = 'expensereport'; +$defaulttopic = 'SendExpenseReportRef'; $diroutput = $conf->expensereport->dir_output; $trackid = 'exp'.$object->id; diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 7644dbc1748..6b6cfb2911d 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -35,15 +35,15 @@ $allowinstall = 0; $allowupgrade = false; $checksok = 1; -$setuplang=GETPOST("selectlang", 'aZ09', 3)?GETPOST("selectlang", 'aZ09', 3):$langs->getDefaultLang(); +$setuplang = GETPOST("selectlang", 'aZ09', 3) ?GETPOST("selectlang", 'aZ09', 3) : $langs->getDefaultLang(); $langs->setDefaultLang($setuplang); $langs->load("install"); // Now we load forced/pre-set values from install.forced.php file. -$useforcedwizard=false; -$forcedfile="./install.forced.php"; -if ($conffile == "/etc/dolibarr/conf.php") $forcedfile="/etc/dolibarr/install.forced.php"; +$useforcedwizard = false; +$forcedfile = "./install.forced.php"; +if ($conffile == "/etc/dolibarr/conf.php") $forcedfile = "/etc/dolibarr/install.forced.php"; if (@file_exists($forcedfile)) { $useforcedwizard = true; include_once $forcedfile; @@ -56,7 +56,7 @@ dolibarr_install_syslog("- check: Dolibarr install/upgrade process started"); * View */ -pHeader('', ''); // No next step for navigation buttons. Next step is defined by click on links. +pHeader('', ''); // No next step for navigation buttons. Next step is defined by click on links. //print "
\n"; @@ -65,28 +65,28 @@ pHeader('', ''); // No next step for navigation buttons. Next step is define print '

Database '.$langs->trans("MiscellaneousChecks").":

\n"; // Check browser -$useragent=$_SERVER['HTTP_USER_AGENT']; -if (! empty($useragent)) +$useragent = $_SERVER['HTTP_USER_AGENT']; +if (!empty($useragent)) { - $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); - $browserversion=$tmp['browserversion']; - $browsername=$tmp['browsername']; + $tmp = getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); + $browserversion = $tmp['browserversion']; + $browsername = $tmp['browsername']; if ($browsername == 'ie' && $browserversion < 7) print 'Error '.$langs->trans("WarningBrowserTooOld")."
\n"; } // Check PHP version -$arrayphpminversionerror = array(5,5,0); -$arrayphpminversionwarning = array(5,5,0); +$arrayphpminversionerror = array(5, 5, 0); +$arrayphpminversionwarning = array(5, 5, 0); if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) // Minimum to use (error if lower) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); - $checksok=0; // 0=error, 1=warning + $checksok = 0; // 0=error, 1=warning } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) // Minimum supported (warning if lower) { print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); - $checksok=0; // 0=error, 1=warning + $checksok = 0; // 0=error, 1=warning } else { @@ -97,12 +97,12 @@ print "
\n"; // Check PHP support for $_POST -if (! isset($_GET["testget"]) && ! isset($_POST["testpost"])) +if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) { print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); print ' ('.$langs->trans("Recheck").')'; print "
\n"; - $checksok=0; + $checksok = 0; } else { @@ -111,10 +111,10 @@ else // Check if sessions enabled -if (! function_exists("session_id")) +if (!function_exists("session_id")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; - $checksok=0; + $checksok = 0; } else { @@ -123,7 +123,7 @@ else // Check if GD supported (we need GD for image conversion) -if (! function_exists("imagecreate")) +if (!function_exists("imagecreate")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; @@ -136,7 +136,7 @@ else // Check if Curl supported -if (! function_exists("curl_init")) +if (!function_exists("curl_init")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl")."
\n"; @@ -148,7 +148,7 @@ else } // Check if PHP calendar extension is available -if (! function_exists("easter_date")) +if (!function_exists("easter_date")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."
\n"; } @@ -159,7 +159,7 @@ else // Check if UTF8 supported -if (! function_exists("utf8_encode")) +if (!function_exists("utf8_encode")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."
\n"; @@ -174,7 +174,7 @@ else // Check if intl methods are supported if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') { - if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) + if (!function_exists("locale_get_primary_language") || !function_exists("locale_get_region")) { $langs->load("errors"); print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl")."
\n"; @@ -188,18 +188,18 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc // Check memory -$memrequiredorig='64M'; -$memrequired=64*1024*1024; -$memmaxorig=@ini_get("memory_limit"); -$memmax=@ini_get("memory_limit"); +$memrequiredorig = '64M'; +$memrequired = 64 * 1024 * 1024; +$memmaxorig = @ini_get("memory_limit"); +$memmax = @ini_get("memory_limit"); if ($memmaxorig != '') { preg_match('/([0-9]+)([a-zA-Z]*)/i', $memmax, $reg); if ($reg[2]) { - if (strtoupper($reg[2]) == 'G') $memmax=$reg[1]*1024*1024*1024; - if (strtoupper($reg[2]) == 'M') $memmax=$reg[1]*1024*1024; - if (strtoupper($reg[2]) == 'K') $memmax=$reg[1]*1024; + if (strtoupper($reg[2]) == 'G') $memmax = $reg[1] * 1024 * 1024 * 1024; + if (strtoupper($reg[2]) == 'M') $memmax = $reg[1] * 1024 * 1024; + if (strtoupper($reg[2]) == 'K') $memmax = $reg[1] * 1024; } if ($memmax >= $memrequired || $memmax == -1) { @@ -216,37 +216,37 @@ if ($memmaxorig != '') clearstatcache(); if (is_readable($conffile) && filesize($conffile) > 8) { - dolibarr_install_syslog("check: conf file '" . $conffile . "' already defined"); - $confexists=1; + dolibarr_install_syslog("check: conf file '".$conffile."' already defined"); + $confexists = 1; include_once $conffile; - $databaseok=1; + $databaseok = 1; if ($databaseok) { // Already installed for all parts (config and database). We can propose upgrade. - $allowupgrade=true; + $allowupgrade = true; } else { - $allowupgrade=false; + $allowupgrade = false; } } else { // If not, we create it - dolibarr_install_syslog("check: we try to create conf file '" . $conffile . "'"); - $confexists=0; + dolibarr_install_syslog("check: we try to create conf file '".$conffile."'"); + $confexists = 0; // First we try by copying example if (@copy($conffile.".example", $conffile)) { // Success - dolibarr_install_syslog("check: successfully copied file " . $conffile . ".example into " . $conffile); + dolibarr_install_syslog("check: successfully copied file ".$conffile.".example into ".$conffile); } else { // If failed, we try to create an empty file - dolibarr_install_syslog("check: failed to copy file " . $conffile . ".example into " . $conffile . ". We try to create it.", LOG_WARNING); + dolibarr_install_syslog("check: failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING); $fp = @fopen($conffile, "w"); if ($fp) @@ -255,17 +255,17 @@ else @fputs($fp, "\n"); fclose($fp); } - else dolibarr_install_syslog("check: failed to create a new file " . $conffile . " into current dir " . getcwd() . ". Please check permissions.", LOG_ERR); + else dolibarr_install_syslog("check: failed to create a new file ".$conffile." into current dir ".getcwd().". Please check permissions.", LOG_ERR); } // First install: no upgrade necessary/required - $allowupgrade=false; + $allowupgrade = false; } // File is missing and cannot be created -if (! file_exists($conffile)) +if (!file_exists($conffile)) { print 'Error '.$langs->trans("ConfFileDoesNotExistsAndCouldNotBeCreated", $conffiletoshow); print "

"; @@ -281,7 +281,7 @@ else { print 'Warning '.$langs->trans("ConfFileMustBeAFileNotADir", $conffiletoshow); - $allowinstall=0; + $allowinstall = 0; } // File exists but cannot be modified elseif (!is_writable($conffile)) @@ -298,7 +298,7 @@ else print 'Warning '.$langs->trans("ConfFileIsNotWritable", $conffiletoshow); print "
\n"; - $allowinstall=0; + $allowinstall = 0; } // File exists and can be modified else @@ -315,37 +315,37 @@ else print 'Ok '.$langs->trans("ConfFileIsWritable", $conffiletoshow); print "
\n"; - $allowinstall=1; + $allowinstall = 1; } print "
\n"; // Requirements met/all ok: display the next step button if ($checksok) { - $ok=0; + $ok = 0; // Try to create db connection if (file_exists($conffile)) { include_once $conffile; - if (! empty($dolibarr_main_db_type) && ! empty($dolibarr_main_document_root)) + if (!empty($dolibarr_main_db_type) && !empty($dolibarr_main_document_root)) { - if (! file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php")) + if (!file_exists($dolibarr_main_document_root."/core/lib/admin.lib.php")) { print 'A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.
'."\n"; - dol_syslog("A '" . $conffiletoshow . "' file exists with a dolibarr_main_document_root to " . $dolibarr_main_document_root . " that seems wrong. Try to fix or remove the '" . $conffiletoshow . "' file.", LOG_WARNING); + dol_syslog("A '".$conffiletoshow."' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '".$conffiletoshow."' file.", LOG_WARNING); } else { require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; // If password is encoded, we decode it - if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || ! empty($dolibarr_main_db_encrypted_pass)) + if (preg_match('/crypted:/i', $dolibarr_main_db_pass) || !empty($dolibarr_main_db_encrypted_pass)) { require_once $dolibarr_main_document_root.'/core/lib/security.lib.php'; if (preg_match('/crypted:/i', $dolibarr_main_db_pass)) { - $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted + $dolibarr_main_db_encrypted_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); // We need to set this as it is used to know the password was initially crypted $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); @@ -358,10 +358,10 @@ else $conf->db->name = $dolibarr_main_db_name; $conf->db->user = $dolibarr_main_db_user; $conf->db->pass = $dolibarr_main_db_pass; - $db=getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); + $db = getDoliDBInstance($conf->db->type, $conf->db->host, $conf->db->user, $conf->db->pass, $conf->db->name, $conf->db->port); if ($db->connected && $db->database_selected) { - $ok=true; + $ok = true; } } } @@ -370,26 +370,26 @@ else // If database access is available, we set more variables if ($ok) { - if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption=0; + if (empty($dolibarr_main_db_encryption)) $dolibarr_main_db_encryption = 0; $conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption; - if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey=''; + if (empty($dolibarr_main_db_cryptkey)) $dolibarr_main_db_cryptkey = ''; $conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey; $conf->setValues($db); // Reset forced setup after the setValues - if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE=constant('SYSLOG_FILE'); + if (defined('SYSLOG_FILE')) $conf->global->SYSLOG_FILE = constant('SYSLOG_FILE'); $conf->global->MAIN_ENABLE_LOG_TO_HTML = 1; // Current version is $conf->global->MAIN_VERSION_LAST_UPGRADE // Version to install is DOL_VERSION - $dolibarrlastupgradeversionarray=preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL)?$conf->global->MAIN_VERSION_LAST_INSTALL:'')); - $dolibarrversiontoinstallarray=versiondolibarrarray(); + $dolibarrlastupgradeversionarray = preg_split('/[\.-]/', isset($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_UPGRADE : (isset($conf->global->MAIN_VERSION_LAST_INSTALL) ? $conf->global->MAIN_VERSION_LAST_INSTALL : '')); + $dolibarrversiontoinstallarray = versiondolibarrarray(); } // Show title - if (! empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || ! empty($conf->global->MAIN_VERSION_LAST_INSTALL)) + if (!empty($conf->global->MAIN_VERSION_LAST_UPGRADE) || !empty($conf->global->MAIN_VERSION_LAST_INSTALL)) { - print $langs->trans("VersionLastUpgrade").': '.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE)?$conf->global->MAIN_VERSION_LAST_INSTALL:$conf->global->MAIN_VERSION_LAST_UPGRADE).' - '; + print $langs->trans("VersionLastUpgrade").': '.(empty($conf->global->MAIN_VERSION_LAST_UPGRADE) ? $conf->global->MAIN_VERSION_LAST_INSTALL : $conf->global->MAIN_VERSION_LAST_UPGRADE).' - '; print $langs->trans("VersionProgram").': '.DOL_VERSION.''; //print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired")); print '
'; @@ -400,7 +400,7 @@ else //print $langs->trans("InstallEasy")." "; print '

'.$langs->trans("ChooseYourSetupMode").'

'; - $foundrecommandedchoice=0; + $foundrecommandedchoice = 0; $available_choices = array(); $notavailable_choices = array(); @@ -417,7 +417,7 @@ else //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; // Ok '; - $foundrecommandedchoice=1; // To show only once + $foundrecommandedchoice = 1; // To show only once } $choice .= ''; @@ -441,14 +441,14 @@ else } // Show upgrade lines - $allowupgrade=true; + $allowupgrade = true; if (empty($dolibarr_main_db_host)) // This means install process was not run { - $allowupgrade=false; + $allowupgrade = false; } - if (defined("MAIN_NOT_INSTALLED")) $allowupgrade=false; - if (GETPOST('allowupgrade')) $allowupgrade=true; - $migrationscript=array( array('from'=>'3.0.0', 'to'=>'3.1.0'), + if (defined("MAIN_NOT_INSTALLED")) $allowupgrade = false; + if (GETPOST('allowupgrade')) $allowupgrade = true; + $migrationscript = array(array('from'=>'3.0.0', 'to'=>'3.1.0'), array('from'=>'3.1.0', 'to'=>'3.2.0'), array('from'=>'3.2.0', 'to'=>'3.3.0'), array('from'=>'3.3.0', 'to'=>'3.4.0'), @@ -467,26 +467,26 @@ else array('from'=>'10.0.0', 'to'=>'11.0.0') ); - $count=0; + $count = 0; foreach ($migrationscript as $migarray) { $choice = ''; $count++; $recommended_choice = false; - $version=DOL_VERSION; - $versionfrom=$migarray['from']; - $versionto=$migarray['to']; - $versionarray=preg_split('/[\.-]/', $version); - $dolibarrversionfromarray=preg_split('/[\.-]/', $versionfrom); - $dolibarrversiontoarray=preg_split('/[\.-]/', $versionto); + $version = DOL_VERSION; + $versionfrom = $migarray['from']; + $versionto = $migarray['to']; + $versionarray = preg_split('/[\.-]/', $version); + $dolibarrversionfromarray = preg_split('/[\.-]/', $versionfrom); + $dolibarrversiontoarray = preg_split('/[\.-]/', $versionto); // Define string newversionxxx that are used for text to show - $newversionfrom=preg_replace('/(\.[0-9]+)$/i', '.*', $versionfrom); - $newversionto=preg_replace('/(\.[0-9]+)$/i', '.*', $versionto); - $newversionfrombis=''; + $newversionfrom = preg_replace('/(\.[0-9]+)$/i', '.*', $versionfrom); + $newversionto = preg_replace('/(\.[0-9]+)$/i', '.*', $versionto); + $newversionfrombis = ''; if (versioncompare($dolibarrversiontoarray, $versionarray) < -2) // From x.y.z -> x.y.z+1 { - $newversionfrombis=' '.$langs->trans("or").' '.$versionto; + $newversionfrombis = ' '.$langs->trans("or").' '.$versionto; } if ($ok) @@ -498,7 +498,7 @@ else (versioncompare($dolibarrversiontoarray, $dolibarrlastupgradeversionarray) > 0 || versioncompare($dolibarrversiontoarray, $versionarray) < -2) ) { - $foundrecommandedchoice=1; // To show only once + $foundrecommandedchoice = 1; // To show only once $recommended_choice = true; } } @@ -519,7 +519,7 @@ else $choice .= '
'; //print $langs->trans("InstallChoiceRecommanded",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE); $choice .= '
'; - $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; + $choice .= '
'.$langs->trans("InstallChoiceSuggested").'
'; if ($count < count($migarray)) // There are other choices after { print $langs->trans("MigrateIsDoneStepByStep", DOL_VERSION); @@ -531,10 +531,10 @@ else $choice .= '
' . $langs->trans('Payments') . '' . $langs->trans('Date') . '' . $langs->trans('Type') . '' . $langs->trans('BankAccount') . ''.$langs->trans('Payments').''.$langs->trans('Date').''.$langs->trans('Type').''.$langs->trans('BankAccount').'' . $langs->trans('Amount') . ''.$langs->trans('Amount').' 
'.dol_print_date($db->jdate($objp->dp), 'day')."".$labeltype.' '.$objp->num_payment."
'.$langs->trans("AlreadyPaid").':'.price($totalpaid).'
'.$langs->trans("AmountExpected").':'.price($object->total_ttc).'
'.$langs->trans("AlreadyPaid").':'.price($totalpaid).'
'.$langs->trans("AmountExpected").':'.price($object->total_ttc).'
'.$langs->trans("RemainderToPay").':'.price($resteapayeraffiche).'
'.$langs->trans("RemainderToPay").':'.price($resteapayeraffiche).'
'.$langs->trans('LineNb').''.$langs->trans('Piece').''.$langs->trans('Date').''.$langs->trans('Project').''.$langs->trans('Project').''.$langs->trans('CarCategory').''.$langs->trans('Type').''.$langs->trans('Description').''.dol_print_date($db->jdate($line->date), 'day').''; if ($line->fk_project > 0) { - $projecttmp->id=$line->fk_project; - $projecttmp->ref=$line->projet_ref; - $projecttmp->title=$line->projet_title; + $projecttmp->id = $line->fk_project; + $projecttmp->ref = $line->projet_ref; + $projecttmp->title = $line->projet_title; print $projecttmp->getNomUrl(1); } print ''.vatrate($line->vatrate, true).''; - if (! empty($line->value_unit_ht)) + if (!empty($line->value_unit_ht)) { print price($line->value_unit_ht); } @@ -2211,33 +2211,33 @@ else print ''; if ($line->fk_ecm_files > 0) { - $modulepart='expensereport'; - $maxheightmini=32; + $modulepart = 'expensereport'; + $maxheightmini = 32; $result = $ecmfilesstatic->fetch($line->fk_ecm_files); if ($result > 0) { - $relativepath=preg_replace('/expensereport\//', '', $ecmfilesstatic->filepath); + $relativepath = preg_replace('/expensereport\//', '', $ecmfilesstatic->filepath); $fileinfo = pathinfo($ecmfilesstatic->filepath.'/'.$ecmfilesstatic->filename); if (image_format_supported($fileinfo['basename']) > 0) { - $minifile=getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original - if (! dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) $minifile=getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension + $minifile = getImageFileNameForSize($fileinfo['basename'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original + if (!dol_is_file($conf->expensereport->dir_output.'/'.$relativepath.'/'.$minifile)) $minifile = getImageFileNameForSize($fileinfo['basename'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension //print $file['path'].'/'.$minifile.'
'; - $urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity)?$object->entity:$conf->entity)); + $urlforhref = getAdvancedPreviewUrl($modulepart, $relativepath.'/'.$fileinfo['filename'].'.'.strtolower($fileinfo['extension']), 1, '&entity='.(!empty($object->entity) ? $object->entity : $conf->entity)); if (empty($urlforhref)) { - $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); + $urlforhref = DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); print ''; } else { print ''; } - print ''; + print ''; print ''; } else { - $modulepart='expensereport'; - $thumbshown=0; + $modulepart = 'expensereport'; + $thumbshown = 0; if (preg_match('/\.pdf$/i', $ecmfilesstatic->filename)) { $filepdf = $conf->expensereport->dir_output.'/'.$relativepath.'/'.$ecmfilesstatic->filename; @@ -2248,31 +2248,31 @@ else if ($pdfexists) { // Conversion du PDF en image png si fichier png non existant - if (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) + if (!file_exists($fileimage) || (filemtime($fileimage) < filemtime($filepdf))) { if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experience trouble with pdf thumb generation and imagick, you can disable here. { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png + $ret = dol_convert_file($filepdf, 'png', $fileimage, '0'); // Convert first page of PDF into a file _preview.png if ($ret < 0) $error++; } } } - if ($pdfexists && ! $error) + if ($pdfexists && !$error) { - $heightforphotref=70; - if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; + $heightforphotref = 70; + if (!empty($conf->dol_optimize_smallscreen)) $heightforphotref = 60; // If the preview file is found if (file_exists($fileimage)) { - $thumbshown=1; - print ''; + $thumbshown = 1; + print ''; } } } - if (! $thumbshown) + if (!$thumbshown) { print img_mime($ecmfilesstatic->filename); } @@ -2303,7 +2303,7 @@ else { // Add line with link to add new file or attach line to an existing file $colspan = 10; - if (! empty($conf->projet->enabled)) $colspan++; + if (!empty($conf->projet->enabled)) $colspan++; if (!empty($conf->global->MAIN_USE_EXPENSE_IK)) $colspan++; print '
'; + print ''; print ''.$langs->trans("UploadANewFileNow"); print img_picto($langs->trans("UploadANewFileNow"), 'chevron-down', '', false, 0, 0, '', 'marginleftonly'); print ''; @@ -2345,7 +2345,7 @@ else print ''."\n"; print '
'; $formproject->select_projects(-1, $line->fk_project, 'fk_project', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); @@ -2396,7 +2396,7 @@ else // VAT print ''; - print $form->load_tva('vatrate', (isset($_POST["vatrate"])?$_POST["vatrate"]:$line->vatrate), $mysoc, '', 0, 0, '', false, 1); + print $form->load_tva('vatrate', (isset($_POST["vatrate"]) ? $_POST["vatrate"] : $line->vatrate), $mysoc, '', 0, 0, '', false, 1); print '
'.$langs->trans('Date').''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''.$form->textwithpicto($langs->trans('Project'), $langs->trans("ClosedProjectsAreHidden")).''.$langs->trans('CarCategory').''.$langs->trans('Type').''.$langs->trans('Description').''; - print $form->selectDate($date?$date:-1, 'date', 0, 0, 0, '', 1, 1); + print $form->selectDate($date ? $date : -1, 'date', 0, 0, 0, '', 1, 1); print ''; $formproject->select_projects(-1, $fk_project, 'fk_project', 0, 0, 1, -1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print ''; $params = array('fk_expense' => $object->id); @@ -2551,9 +2551,9 @@ else // Select VAT print ''; - $defaultvat=-1; - if (! empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; - print $form->load_tva('vatrate', ($vatrate!=''?$vatrate:$defaultvat), $mysoc, '', 0, 0, '', false, 1); + $defaultvat = -1; + if (!empty($conf->global->EXPENSEREPORT_NO_DEFAULT_VAT)) $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS = 'none'; + print $form->load_tva('vatrate', ($vatrate != '' ? $vatrate : $defaultvat), $mysoc, '', 0, 0, '', false, 1); print ''; - print ''; // We must be able to enter decimal qty + print ''; // We must be able to enter decimal qty print ''; if ($allowupgrade) { - $disabled=false; + $disabled = false; if ($foundrecommandedchoice == 2) { - $disabled=true; + $disabled = true; } if ($foundrecommandedchoice == 1) { @@ -546,7 +546,7 @@ else } else { - $choice .= ''.$langs->trans("Start").''; + $choice .= ''.$langs->trans("Start").''; } } else @@ -566,8 +566,8 @@ else // If there is no choice at all, we show all of them. if (empty($available_choices)) { - $available_choices=$notavailable_choices; - $notavailable_choices=array(); + $available_choices = $notavailable_choices; + $notavailable_choices = array(); } // Array of install choices @@ -621,4 +621,4 @@ $(".runupgrade").click(function() { '; dolibarr_install_syslog("- check: end"); -pFooter(1); // Never display next button +pFooter(1); // Never display next button diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 49574ede476..efb3013bd6d 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -23,7 +23,7 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -89,27 +89,27 @@ class MyObject extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), - 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), - 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), - 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), + public $fields = array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'noteditable'=>1, 'notnull'=> 1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'noteditable'=>0, 'default'=>'', 'notnull'=> 1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>20), + 'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1), + 'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for amount'), + 'qty' =>array('type'=>'real', 'label'=>'Qty', 'enabled'=>1, 'visible'=>1, 'default'=>'0', 'position'=>45, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text for quantity', 'css'=>'maxwidth75imp'), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'visible'=> 1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'), 'fk_project' =>array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>1, 'visible'=>-1, 'position'=>52, 'notnull'=>-1, 'index'=>1), - 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60), - 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), - 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), - 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), + 'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>60), + 'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61), + 'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62), + 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 0, 'position'=>501), //'date_validation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'), - 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), + 'fk_user_creat' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=> 1, 'position'=>510, 'foreignkey'=>'user.rowid'), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), - 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), - 'status' =>array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'notnull'=>-1, 'position'=>1010), + 'status' =>array('type'=>'smallint', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=> 1, 'default'=>0, 'index'=>1, 'position'=>1000, 'arrayofkeyval'=>array(0=>'Draft', 1=>'Validated', 9=>'Canceled')), ); /** @@ -214,11 +214,11 @@ class MyObject extends CommonObject $this->db = $db; - if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible']=0; - if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled']=0; + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; // Unset fields that are disabled - foreach($this->fields as $key => $val) + foreach ($this->fields as $key => $val) { if (isset($val['enabled']) && empty($val['enabled'])) { @@ -274,7 +274,7 @@ class MyObject extends CommonObject // Load source object $result = $object->fetchCommon($fromid); - if ($result > 0 && ! empty($object->table_element_line)) $object->fetchLines(); + if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); // get lines so they will be clone //foreach($this->lines as $line) @@ -287,18 +287,18 @@ class MyObject extends CommonObject // Clear fields - $object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref: $this->fields['ref']['default']; - $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label: $this->fields['label']['default']; + $object->ref = empty($this->fields['ref']['default']) ? "copy_of_".$object->ref : $this->fields['ref']['default']; + $object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default']; $object->status = self::STATUS_DRAFT; // ... // Clear extrafields that are unique if (is_array($object->array_options) && count($object->array_options) > 0) { $extrafields->fetch_name_optionals_label($this->table_element); - foreach($object->array_options as $key => $option) + foreach ($object->array_options as $key => $option) { $shortkey = preg_replace('/options_/', '', $key); - if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + if (!empty($extrafields->attributes[$this->element]['unique'][$shortkey])) { //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; unset($object->array_options[$key]); @@ -315,7 +315,7 @@ class MyObject extends CommonObject $this->errors = $object->errors; } - if (! $error) + if (!$error) { // copy internal contacts if ($this->copy_linked_contact($object, 'internal') < 0) @@ -324,7 +324,7 @@ class MyObject extends CommonObject } } - if (! $error) + if (!$error) { // copy external contacts if same company if (property_exists($this, 'socid') && $this->socid == $object->socid) @@ -356,7 +356,7 @@ class MyObject extends CommonObject public function fetch($id, $ref = null) { $result = $this->fetchCommon($id, $ref); - if ($result > 0 && ! empty($this->table_element_line)) $this->fetchLines(); + if ($result > 0 && !empty($this->table_element_line)) $this->fetchLines(); return $result; } @@ -367,7 +367,7 @@ class MyObject extends CommonObject */ public function fetchLines() { - $this->lines=array(); + $this->lines = array(); $result = $this->fetchLinesCommon(); return $result; @@ -391,40 +391,40 @@ class MyObject extends CommonObject dol_syslog(__METHOD__, LOG_DEBUG); - $records=array(); + $records = array(); $sql = 'SELECT '; $sql .= $this->getFieldList(); - $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql .= ' WHERE t.entity IN ('.getEntity($this->table_element).')'; else $sql .= ' WHERE 1 = 1'; // Manage filter $sqlwhere = array(); if (count($filter) > 0) { foreach ($filter as $key => $value) { - if ($key=='t.rowid') { - $sqlwhere[] = $key . '='. $value; + if ($key == 't.rowid') { + $sqlwhere[] = $key.'='.$value; } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; } - elseif ($key=='customsql') { + elseif ($key == 'customsql') { $sqlwhere[] = $value; } else { - $sqlwhere[] = $key . ' LIKE \'%' . $this->db->escape($value) . '%\''; + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } } if (count($sqlwhere) > 0) { - $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; } if (!empty($sortfield)) { $sql .= $this->db->order($sortfield, $sortorder); } if (!empty($limit)) { - $sql .= ' ' . $this->db->plimit($limit, $offset); + $sql .= ' '.$this->db->plimit($limit, $offset); } $resql = $this->db->query($sql); @@ -446,8 +446,8 @@ class MyObject extends CommonObject return $records; } else { - $this->errors[] = 'Error ' . $this->db->lasterror(); - dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); return -1; } @@ -587,51 +587,51 @@ class MyObject extends CommonObject { global $conf, $langs, $hookmanager; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips $result = ''; - $label = '' . $langs->trans("MyObject") . ''; - $label.= '
'; - $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + $label = ''.$langs->trans("MyObject").''; + $label .= '
'; + $label .= ''.$langs->trans('Ref').': '.$this->ref; $url = dol_buildpath('/mymodule/myobject_card.php', 1).'?id='.$this->id; if ($option != 'nolink') { // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; } - $linkclose=''; + $linkclose = ''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowMyObject"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowMyObject"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; } - else $linkclose = ($morecss?' class="'.$morecss.'"':''); + else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; - $linkend=''; + $linkstart .= $linkclose.'>'; + $linkend = ''; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); - global $action,$hookmanager; + global $action, $hookmanager; $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id, 'getnomurl'=>$result); - $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; @@ -687,10 +687,10 @@ class MyObject extends CommonObject public function info($id) { $sql = 'SELECT rowid, date_creation as datec, tms as datem,'; - $sql.= ' fk_user_creat, fk_user_modif'; - $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; - $sql.= ' WHERE t.rowid = '.$id; - $result=$this->db->query($sql); + $sql .= ' fk_user_creat, fk_user_modif'; + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= ' WHERE t.rowid = '.$id; + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) @@ -701,7 +701,7 @@ class MyObject extends CommonObject { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_author); - $this->user_creation = $cuser; + $this->user_creation = $cuser; } if ($obj->fk_user_valid) @@ -715,7 +715,7 @@ class MyObject extends CommonObject { $cluser = new User($this->db); $cluser->fetch($obj->fk_user_cloture); - $this->user_cloture = $cluser; + $this->user_cloture = $cluser; } $this->date_creation = $this->db->jdate($obj->datec); @@ -749,7 +749,7 @@ class MyObject extends CommonObject */ public function getLinesArray() { - $this->lines=array(); + $this->lines = array(); $objectline = new MyObjectLine($this->db); $result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_myobject = '.$this->id)); @@ -780,16 +780,16 @@ class MyObject extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf,$langs; + global $conf, $langs; $langs->load("mymodule@mymodule"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'standard'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->MYOBJECT_ADDON_PDF)) { + } elseif (!empty($conf->global->MYOBJECT_ADDON_PDF)) { $modele = $conf->global->MYOBJECT_ADDON_PDF; } } @@ -814,7 +814,7 @@ class MyObject extends CommonObject $error = 0; $this->output = ''; - $this->error=''; + $this->error = ''; dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index d65f311acbb..c4ec988b269 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -35,21 +35,21 @@ require_once DOL_DOCUMENT_ROOT.'/product/stock/class/productlot.class.php'; $langs->loadLangs(array('stock', 'other', 'productbatch')); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha'); $batch = GETPOST('batch', 'alpha'); $productid = GETPOST('productid', 'int'); -$ref = GETPOST('ref', 'alpha'); // ref is productid_batch +$ref = GETPOST('ref', 'alpha'); // ref is productid_batch -$search_entity=GETPOST('search_entity', 'int'); -$search_fk_product=GETPOST('search_fk_product', 'int'); -$search_batch=GETPOST('search_batch', 'alpha'); -$search_fk_user_creat=GETPOST('search_fk_user_creat', 'int'); -$search_fk_user_modif=GETPOST('search_fk_user_modif', 'int'); -$search_import_key=GETPOST('search_import_key', 'int'); +$search_entity = GETPOST('search_entity', 'int'); +$search_fk_product = GETPOST('search_fk_product', 'int'); +$search_batch = GETPOST('search_batch', 'alpha'); +$search_fk_user_creat = GETPOST('search_fk_user_creat', 'int'); +$search_fk_user_modif = GETPOST('search_fk_user_modif', 'int'); +$search_import_key = GETPOST('search_import_key', 'int'); -if (empty($action) && empty($id) && empty($ref)) $action='list'; +if (empty($action) && empty($id) && empty($ref)) $action = 'list'; // Protection if external user @@ -73,21 +73,21 @@ if ($id || $ref) { if ($ref) { - $tmp=explode('_', $ref); - $productid=$tmp[0]; - $batch=$tmp[1]; + $tmp = explode('_', $ref); + $productid = $tmp[0]; + $batch = $tmp[1]; } $object->fetch($id, $productid, $batch); $object->ref = $object->batch; // For document management ( it use $object->ref) } // Initialize technical object to manage hooks of modules. Note that conf->hooks_modules contains array array -$hookmanager->initHooks(array('productlotcard','globalcard')); +$hookmanager->initHooks(array('productlotcard', 'globalcard')); -$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php -$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php -$permissiontoadd = $user->rights->stock->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->stock->creer; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->stock->creer; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->stock->creer; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $usercanread = $user->rights->produit->lire; $usercancreate = $user->rights->produit->creer; @@ -97,8 +97,8 @@ $usercandelete = $user->rights->produit->supprimer; * Actions */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -112,7 +112,7 @@ if (empty($reshook)) if ($action == 'setsellby' && $user->rights->stock->creer) { - $newvalue=dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); + $newvalue = dol_mktime(12, 0, 0, $_POST['sellbymonth'], $_POST['sellbyday'], $_POST['sellbyyear']); $result = $object->setValueFrom('sellby', $newvalue, '', null, 'date', '', $user, 'PRODUCTLOT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); } @@ -125,7 +125,7 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; - if (! $error) + if (!$error) { // Actions on extra fields $result = $object->insertExtraFields('PRODUCT_LOT_MODIFY'); @@ -145,21 +145,21 @@ if (empty($reshook)) { if (GETPOST('cancel', 'alpha')) { - $urltogo=$backtopage?$backtopage:dol_buildpath('/stock/list.php', 1); + $urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1); header("Location: ".$urltogo); exit; } - $error=0; + $error = 0; /* object_prop_getpost_prop */ - $object->entity=GETPOST('entity', 'int'); - $object->fk_product=GETPOST('fk_product', 'int'); - $object->batch=GETPOST('batch', 'alpha'); - $object->fk_user_creat=GETPOST('fk_user_creat', 'int'); - $object->fk_user_modif=GETPOST('fk_user_modif', 'int'); - $object->import_key=GETPOST('import_key', 'int'); + $object->entity = GETPOST('entity', 'int'); + $object->fk_product = GETPOST('fk_product', 'int'); + $object->batch = GETPOST('batch', 'alpha'); + $object->fk_user_creat = GETPOST('fk_user_creat', 'int'); + $object->fk_user_modif = GETPOST('fk_user_modif', 'int'); + $object->import_key = GETPOST('import_key', 'int'); if (empty($object->ref)) { @@ -167,43 +167,43 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors'); } - if (! $error) + if (!$error) { - $result=$object->create($user); + $result = $object->create($user); if ($result > 0) { // Creation OK - $urltogo=$backtopage?$backtopage:dol_buildpath('/stock/list.php', 1); + $urltogo = $backtopage ? $backtopage : dol_buildpath('/stock/list.php', 1); header("Location: ".$urltogo); exit; } { // Creation KO - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); - $action='create'; + $action = 'create'; } } else { - $action='create'; + $action = 'create'; } } // Cancel - if ($action == 'update' && GETPOST('cancel', 'alpha')) $action='view'; + if ($action == 'update' && GETPOST('cancel', 'alpha')) $action = 'view'; // Action to update record - if ($action == 'update' && ! GETPOST('cancel', 'alpha')) + if ($action == 'update' && !GETPOST('cancel', 'alpha')) { - $error=0; + $error = 0; - $object->entity=GETPOST('entity', 'int'); - $object->fk_product=GETPOST('fk_product', 'int'); - $object->batch=GETPOST('batch', 'alpha'); - $object->fk_user_creat=GETPOST('fk_user_creat', 'int'); - $object->fk_user_modif=GETPOST('fk_user_modif', 'int'); - $object->import_key=GETPOST('import_key', 'int'); + $object->entity = GETPOST('entity', 'int'); + $object->fk_product = GETPOST('fk_product', 'int'); + $object->batch = GETPOST('batch', 'alpha'); + $object->fk_user_creat = GETPOST('fk_user_creat', 'int'); + $object->fk_user_modif = GETPOST('fk_user_modif', 'int'); + $object->import_key = GETPOST('import_key', 'int'); if (empty($object->ref)) { @@ -211,31 +211,31 @@ if (empty($reshook)) setEventMessages($langs->transnoentitiesnoconv("ErrorFieldRequired", $langs->transnoentitiesnoconv("Ref")), null, 'errors'); } - if (! $error) + if (!$error) { - $result=$object->update($user); + $result = $object->update($user); if ($result > 0) { - $action='view'; + $action = 'view'; } else { // Creation KO - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); - $action='edit'; + $action = 'edit'; } } else { - $action='edit'; + $action = 'edit'; } } // Action to delete if ($action == 'confirm_delete') { - $result=$object->delete($user); + $result = $object->delete($user); if ($result > 0) { // Delete OK @@ -245,7 +245,7 @@ if (empty($reshook)) } else { - if (! empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); + if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } } @@ -265,7 +265,7 @@ if (empty($reshook)) llxHeader('', 'ProductLot', ''); -$form=new Form($db); +$form = new Form($db); // Part to create @@ -310,15 +310,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteBatch'), $langs->trans('ConfirmDeleteBatch'), 'confirm_delete', '', 0, 1); print $formconfirm; } - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; $shownav = 1; - if ($user->socid && ! in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav=0; + if ($user->socid && !in_array('batch', explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL))) $shownav = 0; dol_banner_tab($object, 'id', $linkback, $shownav, 'rowid', 'batch'); @@ -352,7 +352,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Other attributes $cols = 2; - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; @@ -363,8 +363,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) @@ -403,12 +403,12 @@ if (empty($action)) // Documents $filedir = $conf->productbatch->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 0, $object, 'product_batch').dol_sanitizeFileName($object->ref); - $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; - $genallowed=$usercanread; - $delallowed=$usercancreate; + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = $usercanread; + $delallowed = $usercancreate; print $formfile->showdocuments('product_batch', dol_sanitizeFileName($object->ref), $filedir, $urlsource, $genallowed, $delallowed, '', 0, 0, 0, 28, 0, '', 0, '', $object->default_lang, '', $object); - $somethingshown=$formfile->numoffiles; + $somethingshown = $formfile->numoffiles; print '
'; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index c10e9915c3b..bc122367312 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -35,17 +35,17 @@ class Task extends CommonObject /** * @var string ID to identify managed object */ - public $element='project_task'; + public $element = 'project_task'; /** * @var string Name of table without prefix where object is stored */ - public $table_element='projet_task'; + public $table_element = 'projet_task'; /** * @var int Field with ID of parent key if this field has a parent */ - public $fk_element='fk_task'; + public $fk_element = 'fk_task'; /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -55,7 +55,7 @@ class Task extends CommonObject /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables=array('projet_task_time'); + protected $childtables = array('projet_task_time'); /** * @var int ID parent task @@ -72,7 +72,7 @@ class Task extends CommonObject */ public $description; - public $duration_effective; // total of time spent on this task + public $duration_effective; // total of time spent on this task public $planned_workload; public $date_c; public $date_start; @@ -111,8 +111,8 @@ class Task extends CommonObject public $timespent_duration; public $timespent_old_duration; public $timespent_date; - public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) - public $timespent_withhour; // 1 = we entered also start hours for timesheet line + public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) + public $timespent_withhour; // 1 = we entered also start hours for timesheet line public $timespent_fk_user; public $timespent_note; @@ -143,7 +143,7 @@ class Task extends CommonObject { global $conf, $langs; - $error=0; + $error = 0; // Clean parameters $this->label = trim($this->label); @@ -154,56 +154,56 @@ class Task extends CommonObject // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task ("; - $sql.= "fk_projet"; - $sql.= ", ref"; - $sql.= ", fk_task_parent"; - $sql.= ", label"; - $sql.= ", description"; - $sql.= ", datec"; - $sql.= ", fk_user_creat"; - $sql.= ", dateo"; - $sql.= ", datee"; - $sql.= ", planned_workload"; - $sql.= ", progress"; - $sql.= ") VALUES ("; - $sql.= $this->fk_project; - $sql.= ", ".(!empty($this->ref)?"'".$this->db->escape($this->ref)."'":'null'); - $sql.= ", ".$this->fk_task_parent; - $sql.= ", '".$this->db->escape($this->label)."'"; - $sql.= ", '".$this->db->escape($this->description)."'"; - $sql.= ", '".$this->db->idate($this->date_c)."'"; - $sql.= ", ".$user->id; - $sql.= ", ".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null'); - $sql.= ", ".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null'); - $sql.= ", ".(($this->planned_workload!='' && $this->planned_workload >= 0)?$this->planned_workload:'null'); - $sql.= ", ".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null'); - $sql.= ")"; + $sql .= "fk_projet"; + $sql .= ", ref"; + $sql .= ", fk_task_parent"; + $sql .= ", label"; + $sql .= ", description"; + $sql .= ", datec"; + $sql .= ", fk_user_creat"; + $sql .= ", dateo"; + $sql .= ", datee"; + $sql .= ", planned_workload"; + $sql .= ", progress"; + $sql .= ") VALUES ("; + $sql .= $this->fk_project; + $sql .= ", ".(!empty($this->ref) ? "'".$this->db->escape($this->ref)."'" : 'null'); + $sql .= ", ".$this->fk_task_parent; + $sql .= ", '".$this->db->escape($this->label)."'"; + $sql .= ", '".$this->db->escape($this->description)."'"; + $sql .= ", '".$this->db->idate($this->date_c)."'"; + $sql .= ", ".$user->id; + $sql .= ", ".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null'); + $sql .= ", ".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null'); + $sql .= ", ".(($this->planned_workload != '' && $this->planned_workload >= 0) ? $this->planned_workload : 'null'); + $sql .= ", ".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null'); + $sql .= ")"; $this->db->begin(); dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + $resql = $this->db->query($sql); + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error) + if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task"); - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_CREATE', $user); + $result = $this->call_trigger('TASK_CREATE', $user); if ($result < 0) { $error++; } // End call triggers } } // Update extrafield - if (! $error) + if (!$error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -214,13 +214,13 @@ class Task extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -243,41 +243,41 @@ class Task extends CommonObject global $langs, $conf; $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.ref,"; - $sql.= " t.fk_projet as fk_project,"; - $sql.= " t.fk_task_parent,"; - $sql.= " t.label,"; - $sql.= " t.description,"; - $sql.= " t.duration_effective,"; - $sql.= " t.planned_workload,"; - $sql.= " t.datec,"; - $sql.= " t.dateo,"; - $sql.= " t.datee,"; - $sql.= " t.fk_user_creat,"; - $sql.= " t.fk_user_valid,"; - $sql.= " t.fk_statut,"; - $sql.= " t.progress,"; - $sql.= " t.priority,"; - $sql.= " t.note_private,"; - $sql.= " t.note_public,"; - $sql.= " t.rang"; - if (! empty($loadparentdata)) + $sql .= " t.rowid,"; + $sql .= " t.ref,"; + $sql .= " t.fk_projet as fk_project,"; + $sql .= " t.fk_task_parent,"; + $sql .= " t.label,"; + $sql .= " t.description,"; + $sql .= " t.duration_effective,"; + $sql .= " t.planned_workload,"; + $sql .= " t.datec,"; + $sql .= " t.dateo,"; + $sql .= " t.datee,"; + $sql .= " t.fk_user_creat,"; + $sql .= " t.fk_user_valid,"; + $sql .= " t.fk_statut,"; + $sql .= " t.progress,"; + $sql .= " t.priority,"; + $sql .= " t.note_private,"; + $sql .= " t.note_public,"; + $sql .= " t.rang"; + if (!empty($loadparentdata)) { - $sql.=", t2.ref as task_parent_ref"; - $sql.=", t2.rang as task_parent_position"; + $sql .= ", t2.ref as task_parent_ref"; + $sql .= ", t2.rang as task_parent_position"; } - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as t"; - if (! empty($loadparentdata)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t2 ON t.fk_task_parent = t2.rowid"; - $sql.= " WHERE "; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as t"; + if (!empty($loadparentdata)) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t2 ON t.fk_task_parent = t2.rowid"; + $sql .= " WHERE "; if (!empty($ref)) { - $sql.="t.ref = '".$this->db->escape($ref)."'"; - }else { - $sql.="t.rowid = ".$id; + $sql .= "t.ref = '".$this->db->escape($ref)."'"; + } else { + $sql .= "t.rowid = ".$id; } dol_syslog(get_class($this)."::fetch", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $num_rows = $this->db->num_rows($resql); @@ -286,27 +286,27 @@ class Task extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; - $this->ref = $obj->ref; - $this->fk_project = $obj->fk_project; - $this->fk_task_parent = $obj->fk_task_parent; - $this->label = $obj->label; - $this->description = $obj->description; - $this->duration_effective = $obj->duration_effective; - $this->planned_workload = $obj->planned_workload; - $this->date_c = $this->db->jdate($obj->datec); - $this->date_start = $this->db->jdate($obj->dateo); + $this->id = $obj->rowid; + $this->ref = $obj->ref; + $this->fk_project = $obj->fk_project; + $this->fk_task_parent = $obj->fk_task_parent; + $this->label = $obj->label; + $this->description = $obj->description; + $this->duration_effective = $obj->duration_effective; + $this->planned_workload = $obj->planned_workload; + $this->date_c = $this->db->jdate($obj->datec); + $this->date_start = $this->db->jdate($obj->dateo); $this->date_end = $this->db->jdate($obj->datee); $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_valid = $obj->fk_user_valid; $this->fk_statut = $obj->fk_statut; $this->progress = $obj->progress; $this->priority = $obj->priority; - $this->note_private = $obj->note_private; - $this->note_public = $obj->note_public; - $this->rang = $obj->rang; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->rang = $obj->rang; - if (! empty($loadparentdata)) + if (!empty($loadparentdata)) { $this->task_parent_ref = $obj->task_parent_ref; $this->task_parent_position = $obj->task_parent_position; @@ -321,13 +321,13 @@ class Task extends CommonObject if ($num_rows) { return 1; - }else { + } else { return 0; } } else { - $this->error="Error ".$this->db->lasterror(); + $this->error = "Error ".$this->db->lasterror(); return -1; } } @@ -343,46 +343,46 @@ class Task extends CommonObject public function update($user = null, $notrigger = 0) { global $conf, $langs; - $error=0; + $error = 0; // Clean parameters - if (isset($this->fk_project)) $this->fk_project=trim($this->fk_project); - if (isset($this->ref)) $this->ref=trim($this->ref); + if (isset($this->fk_project)) $this->fk_project = trim($this->fk_project); + if (isset($this->ref)) $this->ref = trim($this->ref); if (isset($this->fk_task_parent)) $this->fk_task_parent = (int) $this->fk_task_parent; - if (isset($this->label)) $this->label=trim($this->label); - if (isset($this->description)) $this->description=trim($this->description); - if (isset($this->duration_effective)) $this->duration_effective=trim($this->duration_effective); - if (isset($this->planned_workload)) $this->planned_workload=trim($this->planned_workload); + if (isset($this->label)) $this->label = trim($this->label); + if (isset($this->description)) $this->description = trim($this->description); + if (isset($this->duration_effective)) $this->duration_effective = trim($this->duration_effective); + if (isset($this->planned_workload)) $this->planned_workload = trim($this->planned_workload); // Check parameters // Put here code to add control on parameters values // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET"; - $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; - $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"'".$this->db->escape($this->id)."'").","; - $sql.= " fk_task_parent=".(isset($this->fk_task_parent)?$this->fk_task_parent:"null").","; - $sql.= " label=".(isset($this->label)?"'".$this->db->escape($this->label)."'":"null").","; - $sql.= " description=".(isset($this->description)?"'".$this->db->escape($this->description)."'":"null").","; - $sql.= " duration_effective=".(isset($this->duration_effective)?$this->duration_effective:"null").","; - $sql.= " planned_workload=".((isset($this->planned_workload) && $this->planned_workload != '')?$this->planned_workload:"null").","; - $sql.= " dateo=".($this->date_start!=''?"'".$this->db->idate($this->date_start)."'":'null').","; - $sql.= " datee=".($this->date_end!=''?"'".$this->db->idate($this->date_end)."'":'null').","; - $sql.= " progress=".(($this->progress!='' && $this->progress >= 0)?$this->progress:'null').","; - $sql.= " rang=".((!empty($this->rang))?$this->rang:"0"); - $sql.= " WHERE rowid=".$this->id; + $sql .= " fk_projet=".(isset($this->fk_project) ? $this->fk_project : "null").","; + $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "'".$this->db->escape($this->id)."'").","; + $sql .= " fk_task_parent=".(isset($this->fk_task_parent) ? $this->fk_task_parent : "null").","; + $sql .= " label=".(isset($this->label) ? "'".$this->db->escape($this->label)."'" : "null").","; + $sql .= " description=".(isset($this->description) ? "'".$this->db->escape($this->description)."'" : "null").","; + $sql .= " duration_effective=".(isset($this->duration_effective) ? $this->duration_effective : "null").","; + $sql .= " planned_workload=".((isset($this->planned_workload) && $this->planned_workload != '') ? $this->planned_workload : "null").","; + $sql .= " dateo=".($this->date_start != '' ? "'".$this->db->idate($this->date_start)."'" : 'null').","; + $sql .= " datee=".($this->date_end != '' ? "'".$this->db->idate($this->date_end)."'" : 'null').","; + $sql .= " progress=".(($this->progress != '' && $this->progress >= 0) ? $this->progress : 'null').","; + $sql .= " rang=".((!empty($this->rang)) ? $this->rang : "0"); + $sql .= " WHERE rowid=".$this->id; $this->db->begin(); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } // Update extrafield - if (! $error) { + if (!$error) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -390,18 +390,18 @@ class Task extends CommonObject } } - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_MODIFY', $user); + $result = $this->call_trigger('TASK_MODIFY', $user); if ($result < 0) { $error++; } // End call triggers } } - if (! $error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) + if (!$error && (is_object($this->oldcopy) && $this->oldcopy->ref !== $this->ref)) { // We remove directory if ($conf->projet->dir_output) @@ -413,12 +413,12 @@ class Task extends CommonObject $newdir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($project->ref).'/'.dol_sanitizeFileName($this->ref); if (file_exists($olddir)) { - include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; - $res=dol_move($olddir, $newdir); - if (! $res) + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $res = dol_move($olddir, $newdir); + if (!$res) { $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToRenameDir', $olddir, $newdir); + $this->error = $langs->trans('ErrorFailToRenameDir', $olddir, $newdir); $error++; } } @@ -428,13 +428,13 @@ class Task extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -455,75 +455,75 @@ class Task extends CommonObject { global $conf, $langs; - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $error=0; + $error = 0; $this->db->begin(); if ($this->hasChildren() > 0) { dol_syslog(get_class($this)."::delete Can't delete record as it has some sub tasks", LOG_WARNING); - $this->error='ErrorRecordHasSubTasks'; + $this->error = 'ErrorRecordHasSubTasks'; $this->db->rollback(); return 0; } $objectisused = $this->isObjectUsed($this->id); - if (! empty($objectisused)) + if (!empty($objectisused)) { dol_syslog(get_class($this)."::delete Can't delete record as it has some child", LOG_WARNING); - $this->error='ErrorRecordHasChildren'; + $this->error = 'ErrorRecordHasChildren'; $this->db->rollback(); return 0; } - if (! $error) + if (!$error) { // Delete linked contacts $res = $this->delete_linked_contact(); if ($res < 0) { - $this->error='ErrorFailToDeleteLinkedContact'; + $this->error = 'ErrorFailToDeleteLinkedContact'; //$error++; $this->db->rollback(); return 0; } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " WHERE fk_task=".$this->id; + $sql .= " WHERE fk_task=".$this->id; $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_extrafields"; - $sql.= " WHERE fk_object=".$this->id; + $sql .= " WHERE fk_object=".$this->id; $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task"; - $sql.= " WHERE rowid=".$this->id; + $sql .= " WHERE rowid=".$this->id; $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_DELETE', $user); + $result = $this->call_trigger('TASK_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } @@ -532,27 +532,27 @@ class Task extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { //Delete associated link file if ($conf->projet->dir_output) { - $projectstatic=new Project($this->db); + $projectstatic = new Project($this->db); $projectstatic->fetch($this->fk_project); - $dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($projectstatic->ref) . '/' . dol_sanitizeFileName($this->id); + $dir = $conf->projet->dir_output."/".dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($this->id); dol_syslog(get_class($this)."::delete dir=".$dir, LOG_DEBUG); if (file_exists($dir)) { - require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $res = @dol_delete_dir_recursive($dir); if (!$res) { @@ -576,24 +576,24 @@ class Task extends CommonObject */ public function hasChildren() { - $error=0; - $ret=0; + $error = 0; + $ret = 0; $sql = "SELECT COUNT(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task"; - $sql.= " WHERE fk_task_parent=".$this->id; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task"; + $sql .= " WHERE fk_task_parent=".$this->id; dol_syslog(get_class($this)."::hasChildren", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } else { - $obj=$this->db->fetch_object($resql); - if ($obj) $ret=$obj->nb; + $obj = $this->db->fetch_object($resql); + if ($obj) $ret = $obj->nb; $this->db->free($resql); } - if (! $error) + if (!$error) { return $ret; } @@ -610,24 +610,24 @@ class Task extends CommonObject */ public function hasTimeSpent() { - $error=0; - $ret=0; + $error = 0; + $ret = 0; $sql = "SELECT COUNT(*) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " WHERE fk_task=".$this->id; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time"; + $sql .= " WHERE fk_task=".$this->id; dol_syslog(get_class($this)."::hasTimeSpent", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } else { - $obj=$this->db->fetch_object($resql); - if ($obj) $ret=$obj->nb; + $obj = $this->db->fetch_object($resql); + if ($obj) $ret = $obj->nb; $this->db->free($resql); } - if (! $error) + if (!$error) { return $ret; } @@ -654,48 +654,48 @@ class Task extends CommonObject { global $conf, $langs, $user; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $result=''; - $label = '' . $langs->trans("ShowTask") . ''; - if (! empty($this->ref)) - $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; - if (! empty($this->label)) - $label .= '
' . $langs->trans('LabelTask') . ': ' . $this->label; + $result = ''; + $label = ''.$langs->trans("ShowTask").''; + if (!empty($this->ref)) + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + if (!empty($this->label)) + $label .= '
'.$langs->trans('LabelTask').': '.$this->label; if ($this->date_start || $this->date_end) { $label .= "
".get_date_range($this->date_start, $this->date_end, '', $langs, 0); } - $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option=='withproject'?'&withproject=1':''); + $url = DOL_URL_ROOT.'/projet/tasks/'.$mode.'.php?id='.$this->id.($option == 'withproject' ? '&withproject=1' : ''); // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + $add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) $add_save_lastsearch_values = 1; + if ($add_save_lastsearch_values) $url .= '&save_lastsearch_values=1'; $linkclose = ''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowTask"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowTask"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; } $linkstart = ''; - $linkend=''; + $linkstart .= $linkclose.'>'; + $linkend = ''; - $picto='projecttask'; + $picto = 'projecttask'; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), $picto, ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= $this->ref; $result .= $linkend; - if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + if ($withpicto != 2) $result .= (($addlabel && $this->label) ? $sep.dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); return $result; } @@ -709,17 +709,17 @@ class Task extends CommonObject */ public function initAsSpecimen() { - $this->id=0; + $this->id = 0; - $this->fk_project=''; - $this->ref='TK01'; - $this->fk_task_parent=null; - $this->label='Specimen task TK01'; - $this->duration_effective=''; - $this->fk_user_creat=null; - $this->progress='25'; - $this->fk_statut=null; - $this->note='This is a specimen task not'; + $this->fk_project = ''; + $this->ref = 'TK01'; + $this->fk_task_parent = null; + $this->label = 'Specimen task TK01'; + $this->duration_effective = ''; + $this->fk_user_creat = null; + $this->progress = '25'; + $this->fk_statut = null; + $this->note = 'This is a specimen task not'; } /** @@ -750,123 +750,123 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT "; - if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql.= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task - $sql.= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; - $sql.= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; - $sql.= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; - $sql.= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; - $sql.= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; + if ($filteronprojuser > 0 || $filterontaskuser > 0) $sql .= " DISTINCT"; // We may get several time the same record if user has several roles on same project/task + $sql .= " p.rowid as projectid, p.ref, p.title as plabel, p.public, p.fk_statut as projectstatus, p.usage_bill_time,"; + $sql .= " t.rowid as taskid, t.ref as taskref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut as status,"; + $sql .= " t.dateo as date_start, t.datee as date_end, t.planned_workload, t.rang,"; + $sql .= " s.rowid as thirdparty_id, s.nom as thirdparty_name, s.email as thirdparty_email,"; + $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; if (!empty($extrafields->attributes['projet']['label'])) { - foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key.' as options_'.$key : ''); + foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key.' as options_'.$key : ''); } if (!empty($extrafields->attributes['projet_task']['label'])) { - foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key.' as options_'.$key : ''); + foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql .= ($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key.' as options_'.$key : ''); } if ($includebilltime) { - $sql.=", SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; + $sql .= ", SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "1", "0").") as tobill, SUM(tt.task_duration * ".$this->db->ifsql("invoice_id IS NULL", "0", "1").") as billed"; } - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as efp ON (p.rowid = efp.fk_object)"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_extrafields as efp ON (p.rowid = efp.fk_object)"; if ($mode == 0) { if ($filteronprojuser > 0) { - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; } - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if ($includebilltime) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } if ($filterontaskuser > 0) { - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; } - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; - $sql.= " WHERE p.entity IN (".getEntity('project').")"; - $sql.= " AND t.fk_projet = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; + $sql .= " WHERE p.entity IN (".getEntity('project').")"; + $sql .= " AND t.fk_projet = p.rowid"; } elseif ($mode == 1) { if ($filteronprojuser > 0) { - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; } if ($filterontaskuser > 0) { - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; if ($includebilltime) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec2"; - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; } else { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; if ($includebilltime) { - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_time as tt ON tt.fk_task = t.rowid"; } } - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; - $sql.= " WHERE p.entity IN (".getEntity('project').")"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; + $sql .= " WHERE p.entity IN (".getEntity('project').")"; } else return 'BadValueForParameterMode'; if ($filteronprojuser > 0) { - $sql.= " AND p.rowid = ec.element_id"; - $sql.= " AND ctc.rowid = ec.fk_c_type_contact"; - $sql.= " AND ctc.element = 'project'"; - $sql.= " AND ec.fk_socpeople = ".$filteronprojuser; - $sql.= " AND ec.statut = 4"; - $sql.= " AND ctc.source = 'internal'"; + $sql .= " AND p.rowid = ec.element_id"; + $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; + $sql .= " AND ctc.element = 'project'"; + $sql .= " AND ec.fk_socpeople = ".$filteronprojuser; + $sql .= " AND ec.statut = 4"; + $sql .= " AND ctc.source = 'internal'"; } if ($filterontaskuser > 0) { - $sql.= " AND t.fk_projet = p.rowid"; - $sql.= " AND p.rowid = ec2.element_id"; - $sql.= " AND ctc2.rowid = ec2.fk_c_type_contact"; - $sql.= " AND ctc2.element = 'project_task'"; - $sql.= " AND ec2.fk_socpeople = ".$filterontaskuser; - $sql.= " AND ec2.statut = 4"; - $sql.= " AND ctc2.source = 'internal'"; + $sql .= " AND t.fk_projet = p.rowid"; + $sql .= " AND p.rowid = ec2.element_id"; + $sql .= " AND ctc2.rowid = ec2.fk_c_type_contact"; + $sql .= " AND ctc2.element = 'project_task'"; + $sql .= " AND ec2.fk_socpeople = ".$filterontaskuser; + $sql .= " AND ec2.statut = 4"; + $sql .= " AND ctc2.source = 'internal'"; } - if ($socid) $sql.= " AND p.fk_soc = ".$socid; - if ($projectid) $sql.= " AND p.rowid in (".$projectid.")"; - if ($filteronproj) $sql.= natural_search(array("p.ref", "p.title"), $filteronproj); - if ($filteronprojstatus && $filteronprojstatus != '-1') $sql.= " AND p.fk_statut IN (".$filteronprojstatus.")"; - if ($morewherefilter) $sql.=$morewherefilter; + if ($socid) $sql .= " AND p.fk_soc = ".$socid; + if ($projectid) $sql .= " AND p.rowid in (".$projectid.")"; + if ($filteronproj) $sql .= natural_search(array("p.ref", "p.title"), $filteronproj); + if ($filteronprojstatus && $filteronprojstatus != '-1') $sql .= " AND p.fk_statut IN (".$filteronprojstatus.")"; + if ($morewherefilter) $sql .= $morewherefilter; if ($includebilltime) { - $sql.=" GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; - $sql.=" t.datec, t.dateo, t.datee, t.tms,"; - $sql.=" t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; - $sql.=" t.dateo, t.datee, t.planned_workload, t.rang,"; - $sql.=" s.rowid, s.nom, s.email,"; - $sql.=" p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; + $sql .= " GROUP BY p.rowid, p.ref, p.title, p.public, p.fk_statut, p.usage_bill_time,"; + $sql .= " t.datec, t.dateo, t.datee, t.tms,"; + $sql .= " t.rowid, t.ref, t.label, t.description, t.fk_task_parent, t.duration_effective, t.progress, t.fk_statut,"; + $sql .= " t.dateo, t.datee, t.planned_workload, t.rang,"; + $sql .= " s.rowid, s.nom, s.email,"; + $sql .= " p.fk_opp_status, p.opp_amount, p.opp_percent, p.budget_amount"; if (!empty($extrafields->attributes['projet']['label'])) { - foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql.=($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); + foreach ($extrafields->attributes['projet']['label'] as $key => $val) $sql .= ($extrafields->attributes['projet']['type'][$key] != 'separate' ? ",efp.".$key : ''); } if (!empty($extrafields->attributes['projet_task']['label'])) { - foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql.=($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); + foreach ($extrafields->attributes['projet_task']['label'] as $key => $val) $sql .= ($extrafields->attributes['projet_task']['type'][$key] != 'separate' ? ",efpt.".$key : ''); } } - $sql.= " ORDER BY p.ref, t.rang, t.dateo"; + $sql .= " ORDER BY p.ref, t.rang, t.dateo"; //print $sql;exit; dol_syslog(get_class($this)."::getTasksArray", LOG_DEBUG); @@ -878,56 +878,56 @@ class Task extends CommonObject // Loop on each record found, so each couple (project id, task id) while ($i < $num) { - $error=0; + $error = 0; $obj = $this->db->fetch_object($resql); - if ((! $obj->public) && (is_object($userp))) // If not public project and we ask a filter on project owned by a user + if ((!$obj->public) && (is_object($userp))) // If not public project and we ask a filter on project owned by a user { - if (! $this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) + if (!$this->getUserRolesForProjectsOrTasks($userp, 0, $obj->projectid, 0)) { $error++; } } if (is_object($usert)) // If we ask a filter on a user affected to a task { - if (! $this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) + if (!$this->getUserRolesForProjectsOrTasks(0, $usert, $obj->projectid, $obj->taskid)) { $error++; } } - if (! $error) + if (!$error) { $tasks[$i] = new Task($this->db); - $tasks[$i]->id = $obj->taskid; - $tasks[$i]->ref = $obj->taskref; + $tasks[$i]->id = $obj->taskid; + $tasks[$i]->ref = $obj->taskref; $tasks[$i]->fk_project = $obj->projectid; $tasks[$i]->projectref = $obj->ref; - $tasks[$i]->projectlabel = $obj->plabel; - $tasks[$i]->projectstatus = $obj->projectstatus; - $tasks[$i]->usage_bill_time = $obj->usage_bill_time; - $tasks[$i]->label = $obj->label; - $tasks[$i]->description = $obj->description; - $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated - $tasks[$i]->fk_task_parent = $obj->fk_task_parent; + $tasks[$i]->projectlabel = $obj->plabel; + $tasks[$i]->projectstatus = $obj->projectstatus; + $tasks[$i]->usage_bill_time = $obj->usage_bill_time; + $tasks[$i]->label = $obj->label; + $tasks[$i]->description = $obj->description; + $tasks[$i]->fk_parent = $obj->fk_task_parent; // deprecated + $tasks[$i]->fk_task_parent = $obj->fk_task_parent; $tasks[$i]->duration = $obj->duration_effective; - $tasks[$i]->planned_workload= $obj->planned_workload; + $tasks[$i]->planned_workload = $obj->planned_workload; $tasks[$i]->tobill = $obj->tobill; - $tasks[$i]->billed = $obj->billed; + $tasks[$i]->billed = $obj->billed; $tasks[$i]->progress = $obj->progress; - $tasks[$i]->fk_statut = $obj->status; - $tasks[$i]->public = $obj->public; - $tasks[$i]->date_start = $this->db->jdate($obj->date_start); + $tasks[$i]->fk_statut = $obj->status; + $tasks[$i]->public = $obj->public; + $tasks[$i]->date_start = $this->db->jdate($obj->date_start); $tasks[$i]->date_end = $this->db->jdate($obj->date_end); $tasks[$i]->rang = $obj->rang; - $tasks[$i]->socid = $obj->thirdparty_id; // For backward compatibility - $tasks[$i]->thirdparty_id = $obj->thirdparty_id; + $tasks[$i]->socid = $obj->thirdparty_id; // For backward compatibility + $tasks[$i]->thirdparty_id = $obj->thirdparty_id; $tasks[$i]->thirdparty_name = $obj->thirdparty_name; - $tasks[$i]->thirdparty_email= $obj->thirdparty_email; + $tasks[$i]->thirdparty_email = $obj->thirdparty_email; $tasks[$i]->fk_opp_status = $obj->fk_opp_status; @@ -986,41 +986,41 @@ class Task extends CommonObject // We want role of user for a projet or role of user for a task. Both are not possible. if (empty($userp) && empty($usert)) { - $this->error="CallWithWrongParameters"; + $this->error = "CallWithWrongParameters"; return -1; } - if (! empty($userp) && ! empty($usert)) + if (!empty($userp) && !empty($usert)) { - $this->error="CallWithWrongParameters"; + $this->error = "CallWithWrongParameters"; return -1; } /* Liste des taches et role sur les projets ou taches */ $sql = "SELECT pt.rowid as pid, ec.element_id, ctc.code, ctc.source"; - if ($userp) $sql.= " FROM ".MAIN_DB_PREFIX."projet as pt"; - if ($usert && $filteronprojstatus > -1) $sql.= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt"; - if ($usert && $filteronprojstatus <= -1) $sql.= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; - $sql.= ", ".MAIN_DB_PREFIX."element_contact as ec"; - $sql.= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; - $sql.= " WHERE pt.rowid = ec.element_id"; - if ($userp && $filteronprojstatus > -1) $sql.= " AND pt.fk_statut = ".$filteronprojstatus; - if ($usert && $filteronprojstatus > -1) $sql.= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".$filteronprojstatus; - if ($userp) $sql.= " AND ctc.element = 'project'"; - if ($usert) $sql.= " AND ctc.element = 'project_task'"; - $sql.= " AND ctc.rowid = ec.fk_c_type_contact"; - if ($userp) $sql.= " AND ec.fk_socpeople = ".$userp->id; - if ($usert) $sql.= " AND ec.fk_socpeople = ".$usert->id; - $sql.= " AND ec.statut = 4"; - $sql.= " AND ctc.source = 'internal'"; + if ($userp) $sql .= " FROM ".MAIN_DB_PREFIX."projet as pt"; + if ($usert && $filteronprojstatus > -1) $sql .= " FROM ".MAIN_DB_PREFIX."projet as p, ".MAIN_DB_PREFIX."projet_task as pt"; + if ($usert && $filteronprojstatus <= -1) $sql .= " FROM ".MAIN_DB_PREFIX."projet_task as pt"; + $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; + $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; + $sql .= " WHERE pt.rowid = ec.element_id"; + if ($userp && $filteronprojstatus > -1) $sql .= " AND pt.fk_statut = ".$filteronprojstatus; + if ($usert && $filteronprojstatus > -1) $sql .= " AND pt.fk_projet = p.rowid AND p.fk_statut = ".$filteronprojstatus; + if ($userp) $sql .= " AND ctc.element = 'project'"; + if ($usert) $sql .= " AND ctc.element = 'project_task'"; + $sql .= " AND ctc.rowid = ec.fk_c_type_contact"; + if ($userp) $sql .= " AND ec.fk_socpeople = ".$userp->id; + if ($usert) $sql .= " AND ec.fk_socpeople = ".$usert->id; + $sql .= " AND ec.statut = 4"; + $sql .= " AND ctc.source = 'internal'"; if ($projectid) { - if ($userp) $sql.= " AND pt.rowid in (".$projectid.")"; - if ($usert) $sql.= " AND pt.fk_projet in (".$projectid.")"; + if ($userp) $sql .= " AND pt.rowid in (".$projectid.")"; + if ($usert) $sql .= " AND pt.fk_projet in (".$projectid.")"; } if ($taskid) { - if ($userp) $sql.= " ERROR SHOULD NOT HAPPENS"; - if ($usert) $sql.= " AND pt.rowid = ".$taskid; + if ($userp) $sql .= " ERROR SHOULD NOT HAPPENS"; + if ($usert) $sql .= " AND pt.rowid = ".$taskid; } //print $sql; @@ -1034,7 +1034,7 @@ class Task extends CommonObject { $obj = $this->db->fetch_object($resql); if (empty($arrayroles[$obj->pid])) $arrayroles[$obj->pid] = $obj->code; - else $arrayroles[$obj->pid].=','.$obj->code; + else $arrayroles[$obj->pid] .= ','.$obj->code; $i++; } $this->db->free($resql); @@ -1059,7 +1059,7 @@ class Task extends CommonObject $contactAlreadySelected = array(); $tab = $this->liste_contact(-1, $source); //var_dump($tab); - $num=count($tab); + $num = count($tab); $i = 0; while ($i < $num) { @@ -1080,14 +1080,14 @@ class Task extends CommonObject */ public function addTimeSpent($user, $notrigger = 0) { - global $conf,$langs; + global $conf, $langs; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); $ret = 0; // Check parameters - if (! is_object($user)) + if (!is_object($user)) { dol_print_error('', "Method addTimeSpent was called with wrong parameter user"); return -1; @@ -1100,41 +1100,41 @@ class Task extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."projet_task_time ("; - $sql.= "fk_task"; - $sql.= ", task_date"; - $sql.= ", task_datehour"; - $sql.= ", task_date_withhour"; - $sql.= ", task_duration"; - $sql.= ", fk_user"; - $sql.= ", note"; - $sql.= ") VALUES ("; - $sql.= $this->id; - $sql.= ", '".$this->db->idate($this->timespent_date)."'"; - $sql.= ", '".$this->db->idate($this->timespent_datehour)."'"; - $sql.= ", ".(empty($this->timespent_withhour)?0:1); - $sql.= ", ".$this->timespent_duration; - $sql.= ", ".$this->timespent_fk_user; - $sql.= ", ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); - $sql.= ")"; + $sql .= "fk_task"; + $sql .= ", task_date"; + $sql .= ", task_datehour"; + $sql .= ", task_date_withhour"; + $sql .= ", task_duration"; + $sql .= ", fk_user"; + $sql .= ", note"; + $sql .= ") VALUES ("; + $sql .= $this->id; + $sql .= ", '".$this->db->idate($this->timespent_date)."'"; + $sql .= ", '".$this->db->idate($this->timespent_datehour)."'"; + $sql .= ", ".(empty($this->timespent_withhour) ? 0 : 1); + $sql .= ", ".$this->timespent_duration; + $sql .= ", ".$this->timespent_fk_user; + $sql .= ", ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); + $sql .= ")"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $tasktime_id = $this->db->last_insert_id(MAIN_DB_PREFIX."projet_task_time"); $ret = $tasktime_id; $this->timespent_id = $ret; - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_TIMESPENT_CREATE', $user); - if ($result < 0) { $ret=-1; } + $result = $this->call_trigger('TASK_TIMESPENT_CREATE', $user); + if ($result < 0) { $ret = -1; } // End call triggers } } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $ret = -1; } @@ -1142,30 +1142,30 @@ class Task extends CommonObject { // Recalculate amount of time spent for task and update denormalized field $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; - $sql.= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->id.")"; - if (isset($this->progress)) $sql.= ", progress = " . $this->progress; // Do not overwrite value if not provided - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->id.")"; + if (isset($this->progress)) $sql .= ", progress = ".$this->progress; // Do not overwrite value if not provided + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); - if (! $this->db->query($sql) ) + if (!$this->db->query($sql)) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $ret = -2; } $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user - $sql.= " WHERE rowid = ".$tasktime_id; + $sql .= " SET thm = (SELECT thm FROM ".MAIN_DB_PREFIX."user WHERE rowid = ".$this->timespent_fk_user.")"; // set average hour rate of user + $sql .= " WHERE rowid = ".$tasktime_id; dol_syslog(get_class($this)."::addTimeSpent", LOG_DEBUG); - if (! $this->db->query($sql) ) + if (!$this->db->query($sql)) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $ret = -2; } } - if ($ret >0) + if ($ret > 0) { $this->db->commit(); } @@ -1187,47 +1187,47 @@ class Task extends CommonObject { global $langs; - if (is_object($userobj)) $userid=$userobj->id; - else $userid=$userobj; // old method + if (is_object($userobj)) $userid = $userobj->id; + else $userid = $userobj; // old method - $id=$this->id; + $id = $this->id; if (empty($id) && empty($userid)) { dol_syslog("getSummaryOfTimeSpent called on a not loaded task without user param defined", LOG_ERR); return -1; } - $result=array(); + $result = array(); $sql = "SELECT"; - $sql.= " MIN(t.task_datehour) as min_date,"; - $sql.= " MAX(t.task_datehour) as max_date,"; - $sql.= " SUM(t.task_duration) as total_duration,"; - $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as total_amount,"; - $sql.= " COUNT(t.rowid) as nblines,"; - $sql.= " SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; - $sql.= " WHERE 1 = 1"; - if ($morewherefilter) $sql.=$morewherefilter; - if ($id > 0) $sql.= " AND t.fk_task = ".$id; - if ($userid > 0) $sql.=" AND t.fk_user = ".$userid; + $sql .= " MIN(t.task_datehour) as min_date,"; + $sql .= " MAX(t.task_datehour) as max_date,"; + $sql .= " SUM(t.task_duration) as total_duration,"; + $sql .= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as total_amount,"; + $sql .= " COUNT(t.rowid) as nblines,"; + $sql .= " SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql .= " WHERE 1 = 1"; + if ($morewherefilter) $sql .= $morewherefilter; + if ($id > 0) $sql .= " AND t.fk_task = ".$id; + if ($userid > 0) $sql .= " AND t.fk_user = ".$userid; dol_syslog(get_class($this)."::getSummaryOfTimeSpent", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); - $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead - $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead - $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead + $result['min_date'] = $obj->min_date; // deprecated. use the ->timespent_xxx instead + $result['max_date'] = $obj->max_date; // deprecated. use the ->timespent_xxx instead + $result['total_duration'] = $obj->total_duration; // deprecated. use the ->timespent_xxx instead - $this->timespent_min_date=$this->db->jdate($obj->min_date); - $this->timespent_max_date=$this->db->jdate($obj->max_date); - $this->timespent_total_duration=$obj->total_duration; - $this->timespent_total_amount=$obj->total_amount; - $this->timespent_nblinesnull=($obj->nblinesnull?$obj->nblinesnull:0); - $this->timespent_nblines=($obj->nblines?$obj->nblines:0); + $this->timespent_min_date = $this->db->jdate($obj->min_date); + $this->timespent_max_date = $this->db->jdate($obj->max_date); + $this->timespent_total_duration = $obj->total_duration; + $this->timespent_total_amount = $obj->total_amount; + $this->timespent_nblinesnull = ($obj->nblinesnull ? $obj->nblinesnull : 0); + $this->timespent_nblines = ($obj->nblines ? $obj->nblines : 0); $this->db->free($resql); } @@ -1250,33 +1250,33 @@ class Task extends CommonObject { global $langs; - if (empty($id)) $id=$this->id; + if (empty($id)) $id = $this->id; - $result=array(); + $result = array(); $sql = "SELECT"; - $sql.= " SUM(t.task_duration) as nbseconds,"; - $sql.= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; - $sql.= " WHERE t.fk_task = ".$id; + $sql .= " SUM(t.task_duration) as nbseconds,"; + $sql .= " SUM(t.task_duration / 3600 * ".$this->db->ifsql("t.thm IS NULL", 0, "t.thm").") as amount, SUM(".$this->db->ifsql("t.thm IS NULL", 1, 0).") as nblinesnull"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql .= " WHERE t.fk_task = ".$id; if (is_object($fuser) && $fuser->id > 0) { - $sql.=" AND fk_user = ".$fuser->id; + $sql .= " AND fk_user = ".$fuser->id; } if ($dates > 0) { - $datefieldname="task_datehour"; - $sql.=" AND (".$datefieldname." >= '".$this->db->idate($dates)."' OR ".$datefieldname." IS NULL)"; + $datefieldname = "task_datehour"; + $sql .= " AND (".$datefieldname." >= '".$this->db->idate($dates)."' OR ".$datefieldname." IS NULL)"; } if ($datee > 0) { - $datefieldname="task_datehour"; - $sql.=" AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; + $datefieldname = "task_datehour"; + $sql .= " AND (".$datefieldname." <= '".$this->db->idate($datee)."' OR ".$datefieldname." IS NULL)"; } //print $sql; dol_syslog(get_class($this)."::getSumOfAmount", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -1306,35 +1306,35 @@ class Task extends CommonObject global $langs; $sql = "SELECT"; - $sql.= " t.rowid,"; - $sql.= " t.fk_task,"; - $sql.= " t.task_date,"; - $sql.= " t.task_datehour,"; - $sql.= " t.task_date_withhour,"; - $sql.= " t.task_duration,"; - $sql.= " t.fk_user,"; - $sql.= " t.thm,"; - $sql.= " t.note"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; - $sql.= " WHERE t.rowid = ".$id; + $sql .= " t.rowid,"; + $sql .= " t.fk_task,"; + $sql .= " t.task_date,"; + $sql .= " t.task_datehour,"; + $sql .= " t.task_date_withhour,"; + $sql .= " t.task_duration,"; + $sql .= " t.fk_user,"; + $sql .= " t.thm,"; + $sql .= " t.note"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as t"; + $sql .= " WHERE t.rowid = ".$id; dol_syslog(get_class($this)."::fetchTimeSpent", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if ($this->db->num_rows($resql)) { $obj = $this->db->fetch_object($resql); - $this->timespent_id = $obj->rowid; - $this->id = $obj->fk_task; - $this->timespent_date = $this->db->jdate($obj->task_date); + $this->timespent_id = $obj->rowid; + $this->id = $obj->fk_task; + $this->timespent_date = $this->db->jdate($obj->task_date); $this->timespent_datehour = $this->db->jdate($obj->task_datehour); $this->timespent_withhour = $obj->task_date_withhour; - $this->timespent_duration = $obj->task_duration; + $this->timespent_duration = $obj->task_duration; $this->timespent_fk_user = $obj->fk_user; - $this->timespent_thm = $obj->thm; // hourly rate - $this->timespent_note = $obj->note; + $this->timespent_thm = $obj->thm; // hourly rate + $this->timespent_note = $obj->note; } $this->db->free($resql); @@ -1343,7 +1343,7 @@ class Task extends CommonObject } else { - $this->error="Error ".$this->db->lasterror(); + $this->error = "Error ".$this->db->lasterror(); return -1; } } @@ -1359,41 +1359,41 @@ class Task extends CommonObject { global $langs; - $arrayres=array(); + $arrayres = array(); $sql = "SELECT"; - $sql.= " s.rowid as socid,"; - $sql.= " s.nom as thirdparty_name,"; - $sql.= " s.email as thirdparty_email,"; - $sql.= " ptt.rowid,"; - $sql.= " ptt.fk_task,"; - $sql.= " ptt.task_date,"; - $sql.= " ptt.task_datehour,"; - $sql.= " ptt.task_date_withhour,"; - $sql.= " ptt.task_duration,"; - $sql.= " ptt.fk_user,"; - $sql.= " ptt.note,"; - $sql.= " pt.rowid as task_id,"; - $sql.= " pt.ref as task_ref,"; - $sql.= " pt.label as task_label,"; - $sql.= " p.rowid as project_id,"; - $sql.= " p.ref as project_ref,"; - $sql.= " p.title as project_label,"; - $sql.= " p.public as public"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; - $sql.= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid"; - $sql.= " AND ptt.fk_user = ".$userobj->id; - $sql.= " AND pt.entity IN (".getEntity('project').")"; - if ($morewherefilter) $sql.=$morewherefilter; + $sql .= " s.rowid as socid,"; + $sql .= " s.nom as thirdparty_name,"; + $sql .= " s.email as thirdparty_email,"; + $sql .= " ptt.rowid,"; + $sql .= " ptt.fk_task,"; + $sql .= " ptt.task_date,"; + $sql .= " ptt.task_datehour,"; + $sql .= " ptt.task_date_withhour,"; + $sql .= " ptt.task_duration,"; + $sql .= " ptt.fk_user,"; + $sql .= " ptt.note,"; + $sql .= " pt.rowid as task_id,"; + $sql .= " pt.ref as task_ref,"; + $sql .= " pt.label as task_label,"; + $sql .= " p.rowid as project_id,"; + $sql .= " p.ref as project_ref,"; + $sql .= " p.title as project_label,"; + $sql .= " p.public as public"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet_task_time as ptt, ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON p.fk_soc = s.rowid"; + $sql .= " WHERE ptt.fk_task = pt.rowid AND pt.fk_projet = p.rowid"; + $sql .= " AND ptt.fk_user = ".$userobj->id; + $sql .= " AND pt.entity IN (".getEntity('project').")"; + if ($morewherefilter) $sql .= $morewherefilter; dol_syslog(get_class($this)."::fetchAllTimeSpent", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -1406,20 +1406,20 @@ class Task extends CommonObject $newobj->fk_project = $obj->project_id; $newobj->project_ref = $obj->project_ref; - $newobj->project_label = $obj->project_label; + $newobj->project_label = $obj->project_label; $newobj->public = $obj->project_public; $newobj->fk_task = $obj->task_id; - $newobj->task_ref = $obj->task_ref; - $newobj->task_label = $obj->task_label; + $newobj->task_ref = $obj->task_ref; + $newobj->task_label = $obj->task_label; - $newobj->timespent_id = $obj->rowid; - $newobj->timespent_date = $this->db->jdate($obj->task_date); + $newobj->timespent_id = $obj->rowid; + $newobj->timespent_date = $this->db->jdate($obj->task_date); $newobj->timespent_datehour = $this->db->jdate($obj->task_datehour); $newobj->timespent_withhour = $obj->task_date_withhour; $newobj->timespent_duration = $obj->task_duration; - $newobj->timespent_fk_user = $obj->fk_user; - $newobj->timespent_note = $obj->note; + $newobj->timespent_fk_user = $obj->fk_user; + $newobj->timespent_note = $obj->note; $arrayres[] = $newobj; @@ -1431,7 +1431,7 @@ class Task extends CommonObject else { dol_print_error($this->db); - $this->error="Error ".$this->db->lasterror(); + $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -1447,7 +1447,7 @@ class Task extends CommonObject */ public function updateTimeSpent($user, $notrigger = 0) { - global $conf,$langs; + global $conf, $langs; $ret = 0; @@ -1457,7 +1457,7 @@ class Task extends CommonObject $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")); return -1; } - if (! ($this->timespent_fk_user > 0)) + if (!($this->timespent_fk_user > 0)) { $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("User")); return -1; @@ -1470,21 +1470,21 @@ class Task extends CommonObject $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task_time SET"; - $sql.= " task_date = '".$this->db->idate($this->timespent_date)."',"; - $sql.= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; - $sql.= " task_date_withhour = ".(empty($this->timespent_withhour)?0:1).","; - $sql.= " task_duration = ".$this->timespent_duration.","; - $sql.= " fk_user = ".$this->timespent_fk_user.","; - $sql.= " note = ".(isset($this->timespent_note)?"'".$this->db->escape($this->timespent_note)."'":"null"); - $sql.= " WHERE rowid = ".$this->timespent_id; + $sql .= " task_date = '".$this->db->idate($this->timespent_date)."',"; + $sql .= " task_datehour = '".$this->db->idate($this->timespent_datehour)."',"; + $sql .= " task_date_withhour = ".(empty($this->timespent_withhour) ? 0 : 1).","; + $sql .= " task_duration = ".$this->timespent_duration.","; + $sql .= " fk_user = ".$this->timespent_fk_user.","; + $sql .= " note = ".(isset($this->timespent_note) ? "'".$this->db->escape($this->timespent_note)."'" : "null"); + $sql .= " WHERE rowid = ".$this->timespent_id; dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); - if ($this->db->query($sql) ) + if ($this->db->query($sql)) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_TIMESPENT_MODIFY', $user); + $result = $this->call_trigger('TASK_TIMESPENT_MODIFY', $user); if ($result < 0) { $this->db->rollback(); @@ -1497,7 +1497,7 @@ class Task extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $this->db->rollback(); $ret = -1; } @@ -1507,13 +1507,13 @@ class Task extends CommonObject $newDuration = $this->timespent_duration - $this->timespent_old_duration; $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; - $sql.= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->db->escape($this->id).")"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET duration_effective = (SELECT SUM(task_duration) FROM ".MAIN_DB_PREFIX."projet_task_time as ptt where ptt.fk_task = ".$this->db->escape($this->id).")"; + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::updateTimeSpent", LOG_DEBUG); - if (! $this->db->query($sql) ) + if (!$this->db->query($sql)) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $this->db->rollback(); $ret = -2; } @@ -1534,42 +1534,42 @@ class Task extends CommonObject { global $conf, $langs; - $error=0; + $error = 0; $this->db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."projet_task_time"; - $sql.= " WHERE rowid = ".$this->timespent_id; + $sql .= " WHERE rowid = ".$this->timespent_id; dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('TASK_TIMESPENT_DELETE', $user); + $result = $this->call_trigger('TASK_TIMESPENT_DELETE', $user); if ($result < 0) { $error++; } // End call triggers } } - if (! $error) + if (!$error) { $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task"; - $sql.= " SET duration_effective = duration_effective - ".$this->db->escape($this->timespent_duration?$this->timespent_duration:0); - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET duration_effective = duration_effective - ".$this->db->escape($this->timespent_duration ? $this->timespent_duration : 0); + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::delTimeSpent", LOG_DEBUG); - if ($this->db->query($sql) ) + if ($this->db->query($sql)) { $result = 0; } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $result = -2; } } @@ -1577,13 +1577,13 @@ class Task extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delTimeSpent ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -1608,19 +1608,19 @@ class Task extends CommonObject */ public function createFromClone(User $user, $fromid, $project_id, $parent_task_id, $clone_change_dt = false, $clone_affectation = false, $clone_time = false, $clone_file = false, $clone_note = false, $clone_prog = false) { - global $langs,$conf; + global $langs, $conf; - $error=0; + $error = 0; //Use 00:00 of today if time is use on task. - $now=dol_mktime(0, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); + $now = dol_mktime(0, 0, 0, dol_print_date(dol_now(), '%m'), dol_print_date(dol_now(), '%d'), dol_print_date(dol_now(), '%Y')); $datec = $now; - $clone_task=new Task($this->db); - $origin_task=new Task($this->db); + $clone_task = new Task($this->db); + $origin_task = new Task($this->db); - $clone_task->context['createfromclone']='createfromclone'; + $clone_task->context['createfromclone'] = 'createfromclone'; $this->db->begin(); @@ -1631,11 +1631,11 @@ class Task extends CommonObject $origin_task->fetch($fromid); - $defaultref=''; - $obj = empty($conf->global->PROJECT_TASK_ADDON)?'mod_task_simple':$conf->global->PROJECT_TASK_ADDON; - if (! empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) + $defaultref = ''; + $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.".php")) { - require_once DOL_DOCUMENT_ROOT ."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; + require_once DOL_DOCUMENT_ROOT."/core/modules/project/task/".$conf->global->PROJECT_TASK_ADDON.'.php'; $modTask = new $obj; $defaultref = $modTask->getNextValue(0, $clone_task); } @@ -1644,16 +1644,16 @@ class Task extends CommonObject $clone_task->id = 0; $clone_task->ref = $defaultref; - $clone_task->fk_project = $project_id; - $clone_task->fk_task_parent = $parent_task_id; - $clone_task->date_c = $datec; - $clone_task->planned_workload = $origin_task->planned_workload; - $clone_task->rang = $origin_task->rang; + $clone_task->fk_project = $project_id; + $clone_task->fk_task_parent = $parent_task_id; + $clone_task->date_c = $datec; + $clone_task->planned_workload = $origin_task->planned_workload; + $clone_task->rang = $origin_task->rang; //Manage Task Date if ($clone_change_dt) { - $projectstatic=new Project($this->db); + $projectstatic = new Project($this->db); $projectstatic->fetch($ori_project_id); //Origin project strat date @@ -1662,50 +1662,50 @@ class Task extends CommonObject //Calcultate new task start date with difference between origin proj start date and origin task start date if (!empty($clone_task->date_start)) { - $clone_task->date_start = $now + $clone_task->date_start - $orign_project_dt_start; + $clone_task->date_start = $now + $clone_task->date_start - $orign_project_dt_start; } //Calcultate new task end date with difference between origin proj end date and origin task end date if (!empty($clone_task->date_end)) { - $clone_task->date_end = $now + $clone_task->date_end - $orign_project_dt_start; + $clone_task->date_end = $now + $clone_task->date_end - $orign_project_dt_start; } } if (!$clone_prog) { - $clone_task->progress=0; + $clone_task->progress = 0; } // Create clone - $result=$clone_task->create($user); + $result = $clone_task->create($user); // Other options if ($result < 0) { - $this->error=$clone_task->error; + $this->error = $clone_task->error; $error++; } // End - if (! $error) + if (!$error) { - $clone_task_id=$clone_task->id; + $clone_task_id = $clone_task->id; $clone_task_ref = $clone_task->ref; //Note Update if (!$clone_note) { - $clone_task->note_private=''; - $clone_task->note_public=''; + $clone_task->note_private = ''; + $clone_task->note_public = ''; } else { $this->db->begin(); - $res=$clone_task->update_note(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES), '_public'); + $res = $clone_task->update_note(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES), '_public'); if ($res < 0) { - $this->error.=$clone_task->error; + $this->error .= $clone_task->error; $error++; $this->db->rollback(); } @@ -1715,10 +1715,10 @@ class Task extends CommonObject } $this->db->begin(); - $res=$clone_task->update_note(dol_html_entity_decode($clone_task->note_private, ENT_QUOTES), '_private'); + $res = $clone_task->update_note(dol_html_entity_decode($clone_task->note_private, ENT_QUOTES), '_private'); if ($res < 0) { - $this->error.=$clone_task->error; + $this->error .= $clone_task->error; $error++; $this->db->rollback(); } @@ -1734,39 +1734,39 @@ class Task extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; //retreive project origin ref to know folder to copy - $projectstatic=new Project($this->db); + $projectstatic = new Project($this->db); $projectstatic->fetch($ori_project_id); - $ori_project_ref=$projectstatic->ref; + $ori_project_ref = $projectstatic->ref; - if ($ori_project_id!=$project_id) + if ($ori_project_id != $project_id) { $projectstatic->fetch($project_id); - $clone_project_ref=$projectstatic->ref; + $clone_project_ref = $projectstatic->ref; } else { - $clone_project_ref=$ori_project_ref; + $clone_project_ref = $ori_project_ref; } - $clone_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($clone_project_ref). "/" . dol_sanitizeFileName($clone_task_ref); - $ori_task_dir = $conf->projet->dir_output . "/" . dol_sanitizeFileName($ori_project_ref). "/" . dol_sanitizeFileName($fromid); + $clone_task_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($clone_project_ref)."/".dol_sanitizeFileName($clone_task_ref); + $ori_task_dir = $conf->projet->dir_output."/".dol_sanitizeFileName($ori_project_ref)."/".dol_sanitizeFileName($fromid); - $filearray=dol_dir_list($ori_task_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); - foreach($filearray as $key => $file) + $filearray = dol_dir_list($ori_task_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', '', SORT_ASC, 1); + foreach ($filearray as $key => $file) { if (!file_exists($clone_task_dir)) { if (dol_mkdir($clone_task_dir) < 0) { - $this->error.=$langs->trans('ErrorInternalErrorDetected').':dol_mkdir'; + $this->error .= $langs->trans('ErrorInternalErrorDetected').':dol_mkdir'; $error++; } } - $rescopy = dol_copy($ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name'], 0, 1); + $rescopy = dol_copy($ori_task_dir.'/'.$file['name'], $clone_task_dir.'/'.$file['name'], 0, 1); if (is_numeric($rescopy) && $rescopy < 0) { - $this->error.=$langs->trans("ErrorFailToCopyFile", $ori_task_dir . '/' . $file['name'], $clone_task_dir . '/' . $file['name']); + $this->error .= $langs->trans("ErrorFailToCopyFile", $ori_task_dir.'/'.$file['name'], $clone_task_dir.'/'.$file['name']); $error++; } } @@ -1778,10 +1778,10 @@ class Task extends CommonObject $origin_task = new Task($this->db); $origin_task->fetch($fromid); - foreach(array('internal','external') as $source) + foreach (array('internal', 'external') as $source) { $tab = $origin_task->liste_contact(-1, $source); - $num=count($tab); + $num = count($tab); $i = 0; while ($i < $num) { @@ -1789,14 +1789,14 @@ class Task extends CommonObject if ($clone_task->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); - $this->error.=$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); + $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); $error++; } else { - if ($clone_task->error!='') + if ($clone_task->error != '') { - $this->error.=$clone_task->error; + $this->error .= $clone_task->error; $error++; } } @@ -1805,7 +1805,7 @@ class Task extends CommonObject } } - if($clone_time) + if ($clone_time) { //TODO clone time of affectation } @@ -1813,7 +1813,7 @@ class Task extends CommonObject unset($clone_task->context['createfromclone']); - if (! $error) + if (!$error) { $this->db->commit(); return $clone_task_id; @@ -1821,7 +1821,7 @@ class Task extends CommonObject else { $this->db->rollback(); - dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : " . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : ".$this->error, LOG_ERR); return -1; } } @@ -1852,16 +1852,16 @@ class Task extends CommonObject global $langs; // list of Statut of the task - $this->statuts[0]='Draft'; - $this->statuts[1]='ToDo'; - $this->statuts[2]='Running'; - $this->statuts[3]='Finish'; - $this->statuts[4]='Transfered'; - $this->statuts_short[0]='Draft'; - $this->statuts_short[1]='ToDo'; - $this->statuts_short[2]='Running'; - $this->statuts_short[3]='Completed'; - $this->statuts_short[4]='Transfered'; + $this->statuts[0] = 'Draft'; + $this->statuts[1] = 'ToDo'; + $this->statuts[2] = 'Running'; + $this->statuts[3] = 'Finish'; + $this->statuts[4] = 'Transfered'; + $this->statuts_short[0] = 'Draft'; + $this->statuts_short[1] = 'ToDo'; + $this->statuts_short[2] = 'Running'; + $this->statuts_short[3] = 'Completed'; + $this->statuts_short[4] = 'Transfered'; if ($mode == 0) { @@ -1873,30 +1873,30 @@ class Task extends CommonObject } elseif ($mode == 2) { - if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); - elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); - elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]); - elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); + if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); + elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); } elseif ($mode == 3) { - if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); - elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); - elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3'); - elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); + if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); + elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); + elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3'); + elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); + elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); } elseif ($mode == 4) { - if ($status==0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); - elseif ($status==1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); - elseif ($status==2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]); - elseif ($status==3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - elseif ($status==4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - elseif ($status==5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); + if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); + elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); + elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut3').' '.$langs->trans($this->statuts[$status]); + elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); + elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); } elseif ($mode == 5) { @@ -1936,16 +1936,16 @@ class Task extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf,$langs; + global $conf, $langs; $langs->load("projects"); - if (! dol_strlen($modele)) { + if (!dol_strlen($modele)) { $modele = 'nodefault'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) { + } elseif (!empty($conf->global->PROJECT_TASK_ADDON_PDF)) { $modele = $conf->global->PROJECT_TASK_ADDON_PDF; } } @@ -1976,38 +1976,38 @@ class Task extends CommonObject // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT p.rowid as projectid, p.fk_statut as projectstatus,"; - $sql.= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; - $sql.= " t.dateo as date_start, t.datee as datee"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; + $sql .= " t.rowid as taskid, t.progress as progress, t.fk_statut as status,"; + $sql .= " t.dateo as date_start, t.datee as datee"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; //if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; - $sql.= " WHERE p.entity IN (".getEntity('project', 0).')'; - $sql.= " AND p.fk_statut = 1"; - $sql.= " AND t.fk_projet = p.rowid"; - $sql.= " AND t.progress < 100"; // tasks to do - if (! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; + $sql .= " WHERE p.entity IN (".getEntity('project', 0).')'; + $sql .= " AND p.fk_statut = 1"; + $sql .= " AND t.fk_projet = p.rowid"; + $sql .= " AND t.progress < 100"; // tasks to do + if (!$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser // if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; //print $sql; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $task_static = new Task($this->db); $response = new WorkboardResponse(); - $response->warning_delay = $conf->projet->task->warning_delay/60/60/24; + $response->warning_delay = $conf->projet->task->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("OpenedTasks"); if ($user->rights->projet->all->lire) $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mainmenu=project'; else $response->url = DOL_URL_ROOT.'/projet/tasks/list.php?mode=mine&mainmenu=project'; $response->img = img_object('', "task"); // This assignment in condition is not a bug. It allows walking the results. - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { $response->nbtodo++; @@ -2025,7 +2025,7 @@ class Task extends CommonObject } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -2042,32 +2042,32 @@ class Task extends CommonObject // phpcs:enable global $user; - $mine=0; $socid=$user->socid; + $mine = 0; $socid = $user->socid; $projectstatic = new Project($this->db); $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, $mine, 1, $socid); // List of tasks (does not care about permissions. Filtering will be done later) $sql = "SELECT count(p.rowid) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."projet as p"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; - if (! $user->rights->societe->client->voir && ! $socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; - $sql.= ", ".MAIN_DB_PREFIX."projet_task as t"; - $sql.= " WHERE p.entity IN (".getEntity('project', 0).')'; - $sql.= " AND t.fk_projet = p.rowid"; // tasks to do - if ($mine || ! $user->rights->projet->all->lire) $sql.= " AND p.rowid IN (".$projectsListId.")"; + $sql .= " FROM ".MAIN_DB_PREFIX."projet as p"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s on p.fk_soc = s.rowid"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON sc.fk_soc = s.rowid"; + $sql .= ", ".MAIN_DB_PREFIX."projet_task as t"; + $sql .= " WHERE p.entity IN (".getEntity('project', 0).')'; + $sql .= " AND t.fk_projet = p.rowid"; // tasks to do + if ($mine || !$user->rights->projet->all->lire) $sql .= " AND p.rowid IN (".$projectsListId.")"; // No need to check company, as filtering of projects must be done by getProjectsAuthorizedForUser //if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if ($socid) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; - if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id.") OR (s.rowid IS NULL))"; + if ($socid) $sql .= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")"; + if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND ((s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id.") OR (s.rowid IS NULL))"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { // This assignment in condition is not a bug. It allows walking the results. - while ($obj=$this->db->fetch_object($resql)) + while ($obj = $this->db->fetch_object($resql)) { - $this->nb["tasks"]=$obj->nb; + $this->nb["tasks"] = $obj->nb; } $this->db->free($resql); return 1; @@ -2075,7 +2075,7 @@ class Task extends CommonObject else { dol_print_error($this->db); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -2089,7 +2089,7 @@ class Task extends CommonObject { global $conf; - if (! ($this->progress >= 0 && $this->progress < 100)) { + if (!($this->progress >= 0 && $this->progress < 100)) { return false; } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index c2eb7fde29e..e43782c2603 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -34,8 +34,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT."/core/class/commonobjectline.class.php"; -if (! empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; -if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +if (!empty($conf->propal->enabled)) require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; +if (!empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; /** @@ -43,11 +43,11 @@ if (! empty($conf->commande->enabled)) require_once DOL_DOCUMENT_ROOT.'/commande */ class Reception extends CommonObject { - public $element="reception"; - public $fk_element="fk_reception"; - public $table_element="reception"; - public $table_element_line="commande_fournisseur_dispatch"; - protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $element = "reception"; + public $fk_element = "fk_reception"; + public $table_element = "reception"; + public $table_element_line = "commande_fournisseur_dispatch"; + protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -59,7 +59,7 @@ class Reception extends CommonObject public $ref_int; public $brouillon; public $entrepot_id; - public $lines=array(); + public $lines = array(); public $tracking_number; public $tracking_url; public $billed; @@ -76,7 +76,7 @@ class Reception extends CommonObject // A denormalized value public $trueSize; - public $date_delivery; // Date delivery planed + public $date_delivery; // Date delivery planed /** @@ -95,7 +95,7 @@ class Reception extends CommonObject public $date_valid; public $meths; - public $listmeths; // List of carriers + public $listmeths; // List of carriers const STATUS_DRAFT = 0; @@ -155,10 +155,10 @@ class Reception extends CommonObject $dir = dol_buildpath($reldir."core/modules/reception/"); // Load file with numbering class (if found) - $mybool|=@include_once $dir.$file; + $mybool |= @include_once $dir.$file; } - if (! $mybool) + if (!$mybool) { dol_print_error('', "Failed to include file ".$file); return ''; @@ -169,7 +169,7 @@ class Reception extends CommonObject $numref = ""; $numref = $obj->getNextValue($soc, $this); - if ( $numref != "") + if ($numref != "") { return $numref; } @@ -197,9 +197,9 @@ class Reception extends CommonObject { global $conf, $hookmanager; - $now=dol_now(); + $now = dol_now(); - require_once DOL_DOCUMENT_ROOT .'/product/stock/class/mouvementstock.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $error = 0; // Clean parameters @@ -213,82 +213,82 @@ class Reception extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."reception ("; - $sql.= "ref"; - $sql.= ", entity"; - $sql.= ", ref_supplier"; - $sql.= ", ref_int"; - $sql.= ", date_creation"; - $sql.= ", fk_user_author"; - $sql.= ", date_reception"; - $sql.= ", date_delivery"; - $sql.= ", fk_soc"; - $sql.= ", fk_projet"; - $sql.= ", fk_shipping_method"; - $sql.= ", tracking_number"; - $sql.= ", weight"; - $sql.= ", size"; - $sql.= ", width"; - $sql.= ", height"; - $sql.= ", weight_units"; - $sql.= ", size_units"; - $sql.= ", note_private"; - $sql.= ", note_public"; - $sql.= ", model_pdf"; - $sql.= ", fk_incoterms, location_incoterms"; - $sql.= ") VALUES ("; - $sql.= "'(PROV)'"; - $sql.= ", ".$conf->entity; - $sql.= ", ".($this->ref_supplier?"'".$this->db->escape($this->ref_supplier)."'":"null"); - $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); - $sql.= ", '".$this->db->idate($now)."'"; - $sql.= ", ".$user->id; - $sql.= ", ".($this->date_reception>0?"'".$this->db->idate($this->date_reception)."'":"null"); - $sql.= ", ".($this->date_delivery>0?"'".$this->db->idate($this->date_delivery)."'":"null"); - $sql.= ", ".$this->socid; - $sql.= ", ".$this->fk_project; - $sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:"null"); - $sql.= ", '".$this->db->escape($this->tracking_number)."'"; - $sql.= ", ".$this->weight; - $sql.= ", ".$this->sizeS; // TODO Should use this->trueDepth - $sql.= ", ".$this->sizeW; // TODO Should use this->trueWidth - $sql.= ", ".$this->sizeH; // TODO Should use this->trueHeight - $sql.= ", ".$this->weight_units; - $sql.= ", ".$this->size_units; - $sql.= ", ".(!empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); - $sql.= ", ".(!empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); - $sql.= ", ".(!empty($this->model_pdf)?"'".$this->db->escape($this->model_pdf)."'":"null"); - $sql.= ", ".(int) $this->fk_incoterms; - $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ")"; + $sql .= "ref"; + $sql .= ", entity"; + $sql .= ", ref_supplier"; + $sql .= ", ref_int"; + $sql .= ", date_creation"; + $sql .= ", fk_user_author"; + $sql .= ", date_reception"; + $sql .= ", date_delivery"; + $sql .= ", fk_soc"; + $sql .= ", fk_projet"; + $sql .= ", fk_shipping_method"; + $sql .= ", tracking_number"; + $sql .= ", weight"; + $sql .= ", size"; + $sql .= ", width"; + $sql .= ", height"; + $sql .= ", weight_units"; + $sql .= ", size_units"; + $sql .= ", note_private"; + $sql .= ", note_public"; + $sql .= ", model_pdf"; + $sql .= ", fk_incoterms, location_incoterms"; + $sql .= ") VALUES ("; + $sql .= "'(PROV)'"; + $sql .= ", ".$conf->entity; + $sql .= ", ".($this->ref_supplier ? "'".$this->db->escape($this->ref_supplier)."'" : "null"); + $sql .= ", ".($this->ref_int ? "'".$this->db->escape($this->ref_int)."'" : "null"); + $sql .= ", '".$this->db->idate($now)."'"; + $sql .= ", ".$user->id; + $sql .= ", ".($this->date_reception > 0 ? "'".$this->db->idate($this->date_reception)."'" : "null"); + $sql .= ", ".($this->date_delivery > 0 ? "'".$this->db->idate($this->date_delivery)."'" : "null"); + $sql .= ", ".$this->socid; + $sql .= ", ".$this->fk_project; + $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : "null"); + $sql .= ", '".$this->db->escape($this->tracking_number)."'"; + $sql .= ", ".$this->weight; + $sql .= ", ".$this->sizeS; // TODO Should use this->trueDepth + $sql .= ", ".$this->sizeW; // TODO Should use this->trueWidth + $sql .= ", ".$this->sizeH; // TODO Should use this->trueHeight + $sql .= ", ".$this->weight_units; + $sql .= ", ".$this->size_units; + $sql .= ", ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null"); + $sql .= ", ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null"); + $sql .= ", ".(!empty($this->model_pdf) ? "'".$this->db->escape($this->model_pdf)."'" : "null"); + $sql .= ", ".(int) $this->fk_incoterms; + $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; + $sql .= ")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."reception"); $sql = "UPDATE ".MAIN_DB_PREFIX."reception"; - $sql.= " SET ref = '(PROV".$this->id.")'"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET ref = '(PROV".$this->id.")'"; + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::create", LOG_DEBUG); if ($this->db->query($sql)) { // Insert of lines - $num=count($this->lines); + $num = count($this->lines); for ($i = 0; $i < $num; $i++) { $this->lines[$i]->fk_reception = $this->id; - if (! $this->lines[$i]->create($user) > 0) + if (!$this->lines[$i]->create($user) > 0) { $error++; } } - if (! $error && $this->id && $this->origin_id) + if (!$error && $this->id && $this->origin_id) { $ret = $this->add_object_linked(); if (!$ret) @@ -299,15 +299,15 @@ class Reception extends CommonObject // Actions on extra fields (by external module or standard code) // TODO le hook fait double emploi avec le trigger !! - $action='add'; + $action = 'add'; $hookmanager->initHooks(array('receptiondao')); - $parameters=array('socid'=>$this->id); - $reshook=$hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('socid'=>$this->id); + $reshook = $hookmanager->executeHooks('insertExtraFields', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; @@ -316,33 +316,33 @@ class Reception extends CommonObject } elseif ($reshook < 0) $error++; - if (! $error && ! $notrigger) + if (!$error && !$notrigger) { // Call trigger - $result=$this->call_trigger('RECEPTION_CREATE', $user); + $result = $this->call_trigger('RECEPTION_CREATE', $user); if ($result < 0) { $error++; } // End call triggers - if (! $error) + if (!$error) { $this->db->commit(); return $this->id; } else { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } } else { $error++; - $this->error=$this->db->lasterror()." - sql=$sql"; + $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } @@ -350,7 +350,7 @@ class Reception extends CommonObject else { $error++; - $this->error=$this->db->lasterror()." - sql=$sql"; + $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } @@ -358,7 +358,7 @@ class Reception extends CommonObject else { $error++; - $this->error=$this->db->error()." - sql=$sql"; + $this->error = $this->db->error()." - sql=$sql"; $this->db->rollback(); return -1; } @@ -383,21 +383,21 @@ class Reception extends CommonObject if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1; $sql = "SELECT e.rowid, e.ref, e.fk_soc as socid, e.date_creation, e.ref_supplier, e.ref_ext, e.ref_int, e.fk_user_author, e.fk_statut"; - $sql.= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; - $sql.= ", e.date_reception as date_reception, e.model_pdf, e.date_delivery"; - $sql.= ", e.fk_shipping_method, e.tracking_number"; - $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; - $sql.= ", e.note_private, e.note_public"; - $sql.= ', e.fk_incoterms, e.location_incoterms'; - $sql.= ', i.libelle as label_incoterms'; - $sql.= " FROM ".MAIN_DB_PREFIX."reception as e"; - $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; - $sql.= " WHERE e.entity IN (".getEntity('reception').")"; - if ($id) $sql.= " AND e.rowid=".$id; - if ($ref) $sql.= " AND e.ref='".$this->db->escape($ref)."'"; - if ($ref_ext) $sql.= " AND e.ref_ext='".$this->db->escape($ref_ext)."'"; - if ($ref_int) $sql.= " AND e.ref_int='".$this->db->escape($ref_int)."'"; + $sql .= ", e.weight, e.weight_units, e.size, e.size_units, e.width, e.height"; + $sql .= ", e.date_reception as date_reception, e.model_pdf, e.date_delivery"; + $sql .= ", e.fk_shipping_method, e.tracking_number"; + $sql .= ", el.fk_source as origin_id, el.sourcetype as origin"; + $sql .= ", e.note_private, e.note_public"; + $sql .= ', e.fk_incoterms, e.location_incoterms'; + $sql .= ', i.libelle as label_incoterms'; + $sql .= " FROM ".MAIN_DB_PREFIX."reception as e"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; + $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; + $sql .= " WHERE e.entity IN (".getEntity('reception').")"; + if ($id) $sql .= " AND e.rowid=".$id; + if ($ref) $sql .= " AND e.ref='".$this->db->escape($ref)."'"; + if ($ref_ext) $sql .= " AND e.ref_ext='".$this->db->escape($ref_ext)."'"; + if ($ref_int) $sql .= " AND e.ref_int='".$this->db->escape($ref_int)."'"; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $result = $this->db->query($sql); @@ -410,23 +410,23 @@ class Reception extends CommonObject $this->id = $obj->rowid; $this->ref = $obj->ref; $this->socid = $obj->socid; - $this->ref_supplier = $obj->ref_supplier; + $this->ref_supplier = $obj->ref_supplier; $this->ref_ext = $obj->ref_ext; $this->ref_int = $obj->ref_int; $this->statut = $obj->fk_statut; $this->user_author_id = $obj->fk_user_author; $this->date_creation = $this->db->jdate($obj->date_creation); - $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated - $this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated - $this->date_reception = $this->db->jdate($obj->date_reception); // Date real - $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed + $this->date = $this->db->jdate($obj->date_reception); // TODO deprecated + $this->date_reception = $this->db->jdate($obj->date_reception); // TODO deprecated + $this->date_reception = $this->db->jdate($obj->date_reception); // Date real + $this->date_delivery = $this->db->jdate($obj->date_delivery); // Date planed $this->fk_delivery_address = $obj->fk_address; $this->modelpdf = $obj->model_pdf; - $this->shipping_method_id = $obj->fk_shipping_method; + $this->shipping_method_id = $obj->fk_shipping_method; $this->tracking_number = $obj->tracking_number; - $this->origin = ($obj->origin?$obj->origin:'commande'); // For compatibility + $this->origin = ($obj->origin ? $obj->origin : 'commande'); // For compatibility $this->origin_id = $obj->origin_id; - $this->billed = ($obj->fk_statut==2?1:0); + $this->billed = ($obj->fk_statut == 2 ? 1 : 0); $this->trueWeight = $obj->weight; $this->weight_units = $obj->weight_units; @@ -442,8 +442,8 @@ class Reception extends CommonObject $this->note_private = $obj->note_private; // A denormalized value - $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; - $this->size_units = $obj->size_units; + $this->trueSize = $obj->size."x".$obj->width."x".$obj->height; + $this->size_units = $obj->size_units; //Incoterms $this->fk_incoterms = $obj->fk_incoterms; @@ -454,7 +454,7 @@ class Reception extends CommonObject if ($this->statut == 0) $this->brouillon = 1; - $file = $conf->reception->dir_output . "/" .get_exdir($this->id, 2, 0, 0, $this, 'reception') . "/" . $this->id.".pdf"; + $file = $conf->reception->dir_output."/".get_exdir($this->id, 2, 0, 0, $this, 'reception')."/".$this->id.".pdf"; $this->pdf_filename = $file; // Tracking url @@ -463,20 +463,20 @@ class Reception extends CommonObject /* * Thirdparty */ - $result=$this->fetch_thirdparty(); + $result = $this->fetch_thirdparty(); // Retrieve all extrafields for reception // fetch optionals attributes and labels require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; - $extrafields=new ExtraFields($this->db); + $extrafields = new ExtraFields($this->db); $extrafields->fetch_name_optionals_label($this->table_element, true); $this->fetch_optionals($this->id); /* * Lines */ - $result=$this->fetch_lines(); + $result = $this->fetch_lines(); if ($result < 0) { return -3; @@ -487,13 +487,13 @@ class Reception extends CommonObject else { dol_syslog(get_class($this).'::Fetch no reception found', LOG_ERR); - $this->error='Delivery with id '.$id.' not found'; + $this->error = 'Delivery with id '.$id.' not found'; return 0; } } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -520,10 +520,10 @@ class Reception extends CommonObject return 0; } - if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->reception->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->reception->reception_advance->validate)))) + if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)))) { - $this->error='Permission denied'; + $this->error = 'Permission denied'; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; } @@ -538,7 +538,7 @@ class Reception extends CommonObject // Define new ref - if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $numref = $this->getNextNumRef($soc); } @@ -548,25 +548,25 @@ class Reception extends CommonObject $this->newref = $numref; - $now=dol_now(); + $now = dol_now(); // Validate $sql = "UPDATE ".MAIN_DB_PREFIX."reception SET"; - $sql.= " ref='".$this->db->escape($numref)."'"; - $sql.= ", fk_statut = 1"; - $sql.= ", date_valid = '".$this->db->idate($now)."'"; - $sql.= ", fk_user_valid = ".$user->id; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " ref='".$this->db->escape($numref)."'"; + $sql .= ", fk_statut = 1"; + $sql .= ", date_valid = '".$this->db->idate($now)."'"; + $sql .= ", fk_user_valid = ".$user->id; + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::valid update reception", LOG_DEBUG); - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } // If stock increment is done on reception (recommanded choice) - if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) + if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -575,15 +575,15 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO in future, reception lines may not be linked to order line $sql = "SELECT cd.fk_product, cd.subprice,"; - $sql.= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql.= " ed.eatby, ed.sellby, ed.batch"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; - $sql.= " WHERE ed.fk_reception = ".$this->id; - $sql.= " AND cd.rowid = ed.fk_commandefourndet"; + $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; + $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; + $sql .= " WHERE ed.fk_reception = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_commandefourndet"; dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); @@ -605,10 +605,10 @@ class Reception extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref)); if ($result < 0) { $error++; - $this->errors[]=$mouvS->error; + $this->errors[] = $mouvS->error; $this->errors = array_merge($this->errors, $mouvS->errors); break; } @@ -619,10 +619,10 @@ class Reception extends CommonObject // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. // Note: ->fk_origin_stock = id into table llx_product_batch (may be rename into llx_product_stock_batch in another version) - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionValidatedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $error++; - $this->errors[]=$mouvS->error; + $this->errors[] = $mouvS->error; $this->errors = array_merge($this->errors, $mouvS->errors); break; } @@ -632,7 +632,7 @@ class Reception extends CommonObject else { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -2; } } @@ -640,20 +640,20 @@ class Reception extends CommonObject // Change status of order to "reception in process" $ret = $this->setStatut(4, $this->origin_id, 'commande_fournisseur'); - if (! $ret) + if (!$ret) { $error++; } - if (! $error && ! $notrigger) + if (!$error && !$notrigger) { // Call trigger - $result=$this->call_trigger('RECEPTION_VALIDATE', $user); + $result = $this->call_trigger('RECEPTION_VALIDATE', $user); if ($result < 0) { $error++; } // End call triggers } - if (! $error) + if (!$error) { $this->oldref = $this->ref; @@ -661,17 +661,17 @@ class Reception extends CommonObject if (preg_match('/^[\(]?PROV/i', $this->ref)) { // Now we rename also files into index - $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref)+1).")), filepath = 'reception/".$this->db->escape($this->newref)."'"; - $sql.= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'reception/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; + $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'reception/".$this->db->escape($this->newref)."'"; + $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'reception/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->error = $this->db->lasterror(); } + if (!$resql) { $error++; $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments $oldref = dol_sanitizeFileName($this->ref); $newref = dol_sanitizeFileName($numref); $dirsource = $conf->reception->dir_output.'/'.$oldref; $dirdest = $conf->reception->dir_output.'/'.$newref; - if (! $error && file_exists($dirsource)) + if (!$error && file_exists($dirsource)) { dol_syslog(get_class($this)."::valid rename dir ".$dirsource." into ".$dirdest); @@ -679,13 +679,13 @@ class Reception extends CommonObject { dol_syslog("Rename ok"); // Rename docs starting with $oldref with $newref - $listoffiles=dol_dir_list($conf->reception->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); - foreach($listoffiles as $fileentry) + $listoffiles = dol_dir_list($conf->reception->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/')); + foreach ($listoffiles as $fileentry) { - $dirsource=$fileentry['name']; - $dirdest=preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); - $dirsource=$fileentry['path'].'/'.$dirsource; - $dirdest=$fileentry['path'].'/'.$dirdest; + $dirsource = $fileentry['name']; + $dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource); + $dirsource = $fileentry['path'].'/'.$dirsource; + $dirdest = $fileentry['path'].'/'.$dirdest; @rename($dirsource, $dirdest); } } @@ -694,26 +694,26 @@ class Reception extends CommonObject } // Set new ref and current status - if (! $error) + if (!$error) { $this->ref = $numref; $this->statut = 1; } - if (! $error) + if (!$error) { $this->db->commit(); return 1; } else { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } } @@ -748,31 +748,31 @@ class Reception extends CommonObject $supplierorderline = new CommandeFournisseurLigne($this->db); $supplierorderline->fetch($id); - if (! empty($conf->stock->enabled) && ! empty($supplierorderline->fk_product)) + if (!empty($conf->stock->enabled) && !empty($supplierorderline->fk_product)) { $fk_product = $supplierorderline->fk_product; - if (! ($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS)) + if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_RECEPTIONS)) { $langs->load("errors"); - $this->error=$langs->trans("ErrorWarehouseRequiredIntoReceptionLine"); + $this->error = $langs->trans("ErrorWarehouseRequiredIntoReceptionLine"); return -1; } } // extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options)>0) // For avoid conflicts if trigger used + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && is_array($array_options) && count($array_options) > 0) // For avoid conflicts if trigger used $line->array_options = $array_options; $line->fk_product = $fk_product; - $line->fk_commande = $supplierorderline->fk_commande ; - $line->fk_user = $user->id ; + $line->fk_commande = $supplierorderline->fk_commande; + $line->fk_user = $user->id; $line->comment = $comment; $line->batch = $batch; $line->eatby = $eatby; $line->sellby = $sellby; - $line->status=1; - $line->fk_reception=$this->id; + $line->status = 1; + $line->fk_reception = $this->id; $this->lines[$num] = $line; } @@ -788,29 +788,29 @@ class Reception extends CommonObject public function update($user = null, $notrigger = 0) { global $conf; - $error=0; + $error = 0; // Clean parameters - if (isset($this->ref)) $this->ref=trim($this->ref); - if (isset($this->entity)) $this->entity=trim($this->entity); - if (isset($this->ref_supplier)) $this->ref_supplier=trim($this->ref_supplier); - if (isset($this->socid)) $this->socid=trim($this->socid); - if (isset($this->fk_user_author)) $this->fk_user_author=trim($this->fk_user_author); - if (isset($this->fk_user_valid)) $this->fk_user_valid=trim($this->fk_user_valid); - if (isset($this->fk_delivery_address)) $this->fk_delivery_address=trim($this->fk_delivery_address); - if (isset($this->shipping_method_id)) $this->shipping_method_id=trim($this->shipping_method_id); - if (isset($this->tracking_number)) $this->tracking_number=trim($this->tracking_number); - if (isset($this->statut)) $this->statut=(int) $this->statut; - if (isset($this->trueDepth)) $this->trueDepth=trim($this->trueDepth); - if (isset($this->trueWidth)) $this->trueWidth=trim($this->trueWidth); - if (isset($this->trueHeight)) $this->trueHeight=trim($this->trueHeight); - if (isset($this->size_units)) $this->size_units=trim($this->size_units); - if (isset($this->weight_units)) $this->weight_units=trim($this->weight_units); - if (isset($this->trueWeight)) $this->weight=trim($this->trueWeight); - if (isset($this->note_private)) $this->note=trim($this->note_private); - if (isset($this->note_public)) $this->note=trim($this->note_public); - if (isset($this->modelpdf)) $this->modelpdf=trim($this->modelpdf); + if (isset($this->ref)) $this->ref = trim($this->ref); + if (isset($this->entity)) $this->entity = trim($this->entity); + if (isset($this->ref_supplier)) $this->ref_supplier = trim($this->ref_supplier); + if (isset($this->socid)) $this->socid = trim($this->socid); + if (isset($this->fk_user_author)) $this->fk_user_author = trim($this->fk_user_author); + if (isset($this->fk_user_valid)) $this->fk_user_valid = trim($this->fk_user_valid); + if (isset($this->fk_delivery_address)) $this->fk_delivery_address = trim($this->fk_delivery_address); + if (isset($this->shipping_method_id)) $this->shipping_method_id = trim($this->shipping_method_id); + if (isset($this->tracking_number)) $this->tracking_number = trim($this->tracking_number); + if (isset($this->statut)) $this->statut = (int) $this->statut; + if (isset($this->trueDepth)) $this->trueDepth = trim($this->trueDepth); + if (isset($this->trueWidth)) $this->trueWidth = trim($this->trueWidth); + if (isset($this->trueHeight)) $this->trueHeight = trim($this->trueHeight); + if (isset($this->size_units)) $this->size_units = trim($this->size_units); + if (isset($this->weight_units)) $this->weight_units = trim($this->weight_units); + if (isset($this->trueWeight)) $this->weight = trim($this->trueWeight); + if (isset($this->note_private)) $this->note = trim($this->note_private); + if (isset($this->note_public)) $this->note = trim($this->note_public); + if (isset($this->modelpdf)) $this->modelpdf = trim($this->modelpdf); // Check parameters @@ -819,44 +819,44 @@ class Reception extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."reception SET"; - $sql.= " tms=".(dol_strlen($this->tms)!=0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; - $sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").","; - $sql.= " ref_supplier=".(isset($this->ref_supplier)?"'".$this->db->escape($this->ref_supplier)."'":"null").","; - $sql.= " fk_soc=".(isset($this->socid)?$this->socid:"null").","; - $sql.= " date_creation=".(dol_strlen($this->date_creation)!=0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; - $sql.= " fk_user_author=".(isset($this->fk_user_author)?$this->fk_user_author:"null").","; - $sql.= " date_valid=".(dol_strlen($this->date_valid)!=0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').","; - $sql.= " fk_user_valid=".(isset($this->fk_user_valid)?$this->fk_user_valid:"null").","; - $sql.= " date_reception=".(dol_strlen($this->date_reception)!=0 ? "'".$this->db->idate($this->date_reception)."'" : 'null').","; - $sql.= " date_delivery=".(dol_strlen($this->date_delivery)!=0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; - $sql.= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0)?$this->shipping_method_id:"null").","; - $sql.= " tracking_number=".(isset($this->tracking_number)?"'".$this->db->escape($this->tracking_number)."'":"null").","; - $sql.= " fk_statut=".(isset($this->statut)?$this->statut:"null").","; - $sql.= " height=".(($this->trueHeight != '')?$this->trueHeight:"null").","; - $sql.= " width=".(($this->trueWidth != '')?$this->trueWidth:"null").","; - $sql.= " size_units=".(isset($this->size_units)?$this->size_units:"null").","; - $sql.= " size=".(($this->trueDepth != '')?$this->trueDepth:"null").","; - $sql.= " weight_units=".(isset($this->weight_units)?$this->weight_units:"null").","; - $sql.= " weight=".(($this->trueWeight != '')?$this->trueWeight:"null").","; - $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; - $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; - $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").","; - $sql.= " entity=".$conf->entity; + $sql .= " tms=".(dol_strlen($this->tms) != 0 ? "'".$this->db->idate($this->tms)."'" : 'null').","; + $sql .= " ref=".(isset($this->ref) ? "'".$this->db->escape($this->ref)."'" : "null").","; + $sql .= " ref_supplier=".(isset($this->ref_supplier) ? "'".$this->db->escape($this->ref_supplier)."'" : "null").","; + $sql .= " fk_soc=".(isset($this->socid) ? $this->socid : "null").","; + $sql .= " date_creation=".(dol_strlen($this->date_creation) != 0 ? "'".$this->db->idate($this->date_creation)."'" : 'null').","; + $sql .= " fk_user_author=".(isset($this->fk_user_author) ? $this->fk_user_author : "null").","; + $sql .= " date_valid=".(dol_strlen($this->date_valid) != 0 ? "'".$this->db->idate($this->date_valid)."'" : 'null').","; + $sql .= " fk_user_valid=".(isset($this->fk_user_valid) ? $this->fk_user_valid : "null").","; + $sql .= " date_reception=".(dol_strlen($this->date_reception) != 0 ? "'".$this->db->idate($this->date_reception)."'" : 'null').","; + $sql .= " date_delivery=".(dol_strlen($this->date_delivery) != 0 ? "'".$this->db->idate($this->date_delivery)."'" : 'null').","; + $sql .= " fk_shipping_method=".((isset($this->shipping_method_id) && $this->shipping_method_id > 0) ? $this->shipping_method_id : "null").","; + $sql .= " tracking_number=".(isset($this->tracking_number) ? "'".$this->db->escape($this->tracking_number)."'" : "null").","; + $sql .= " fk_statut=".(isset($this->statut) ? $this->statut : "null").","; + $sql .= " height=".(($this->trueHeight != '') ? $this->trueHeight : "null").","; + $sql .= " width=".(($this->trueWidth != '') ? $this->trueWidth : "null").","; + $sql .= " size_units=".(isset($this->size_units) ? $this->size_units : "null").","; + $sql .= " size=".(($this->trueDepth != '') ? $this->trueDepth : "null").","; + $sql .= " weight_units=".(isset($this->weight_units) ? $this->weight_units : "null").","; + $sql .= " weight=".(($this->trueWeight != '') ? $this->trueWeight : "null").","; + $sql .= " note_private=".(isset($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null").","; + $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; + $sql .= " model_pdf=".(isset($this->modelpdf) ? "'".$this->db->escape($this->modelpdf)."'" : "null").","; + $sql .= " entity=".$conf->entity; - $sql.= " WHERE rowid=".$this->id; + $sql .= " WHERE rowid=".$this->id; $this->db->begin(); dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); - if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - if (! $error) + if (!$error) { - if (! $notrigger) + if (!$notrigger) { // Call trigger - $result=$this->call_trigger('RECEPTION_MODIFY', $user); + $result = $this->call_trigger('RECEPTION_MODIFY', $user); if ($result < 0) { $error++; } // End call triggers } @@ -865,13 +865,13 @@ class Reception extends CommonObject // Commit or rollback if ($error) { - foreach($this->errors as $errmsg) + foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); - $this->error.=($this->error?', '.$errmsg:$errmsg); + $this->error .= ($this->error ? ', '.$errmsg : $errmsg); } $this->db->rollback(); - return -1*$error; + return -1 * $error; } else { @@ -891,8 +891,8 @@ class Reception extends CommonObject global $conf, $langs, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $error=0; - $this->error=''; + $error = 0; + $this->error = ''; $this->db->begin(); @@ -906,13 +906,13 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement $sql = "SELECT cd.fk_product, cd.subprice, ed.qty, ed.fk_entrepot, ed.eatby, ed.sellby, ed.batch, ed.rowid as commande_fournisseur_dispatch_id"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; - $sql.= " WHERE ed.fk_reception = ".$this->id; - $sql.= " AND cd.rowid = ed.fk_commandefourndet"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; + $sql .= " WHERE ed.fk_reception = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_commandefourndet"; dol_syslog(get_class($this)."::delete select details", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); @@ -925,42 +925,42 @@ class Reception extends CommonObject // we do not log origin because it will be deleted $mouvS->origin = null; - $result=$mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed + $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed } } else { - $error++;$this->errors[]="Error ".$this->db->lasterror(); + $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseur_dispatch"; - $sql.= " WHERE fk_reception = ".$this->id; + $sql .= " WHERE fk_reception = ".$this->id; - if ( $this->db->query($sql) ) + if ($this->db->query($sql)) { // Delete linked object $res = $this->deleteObjectLinked(); if ($res < 0) $error++; - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."reception"; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " WHERE rowid = ".$this->id; if ($this->db->query($sql)) { // Call trigger - $result=$this->call_trigger('RECEPTION_DELETE', $user); + $result = $this->call_trigger('RECEPTION_DELETE', $user); if ($result < 0) { $error++; } // End call triggers - if (! empty($this->origin) && $this->origin_id > 0) + if (!empty($this->origin) && $this->origin_id > 0) { $this->fetch_origin(); - $origin=$this->origin; + $origin = $this->origin; if ($this->$origin->statut == 4) // If order source of reception is "partially received" { // Check if there is no more reception. If not, we can move back status of order to "validated" instead of "reception in progress" @@ -973,19 +973,19 @@ class Reception extends CommonObject } } - if (! $error) + if (!$error) { $this->db->commit(); // We delete PDFs $ref = dol_sanitizeFileName($this->ref); - if (! empty($conf->reception->dir_output)) + if (!empty($conf->reception->dir_output)) { - $dir = $conf->reception->dir_output . '/' . $ref ; - $file = $dir . '/' . $ref . '.pdf'; + $dir = $conf->reception->dir_output.'/'.$ref; + $file = $dir.'/'.$ref.'.pdf'; if (file_exists($file)) { - if (! dol_delete_file($file)) + if (!dol_delete_file($file)) { return 0; } @@ -994,7 +994,7 @@ class Reception extends CommonObject { if (!dol_delete_dir_recursive($dir)) { - $this->error=$langs->trans("ErrorCanNotDeleteDir", $dir); + $this->error = $langs->trans("ErrorCanNotDeleteDir", $dir); return 0; } } @@ -1010,21 +1010,21 @@ class Reception extends CommonObject } else { - $this->error=$this->db->lasterror()." - sql=$sql"; + $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } } else { - $this->error=$this->db->lasterror()." - sql=$sql"; + $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } } else { - $this->error=$this->db->lasterror()." - sql=$sql"; + $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; } @@ -1050,41 +1050,41 @@ class Reception extends CommonObject $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'commande_fournisseur_dispatch WHERE fk_reception='.$this->id; $resql = $db->query($sql); - if(!empty($resql)){ + if (!empty($resql)) { $this->lines = array(); - while ($obj = $resql->fetch_object()){ + while ($obj = $resql->fetch_object()) { $line = new CommandeFournisseurDispatch($db); $line->fetch($obj->rowid); $line->fetch_product(); $sql_commfourndet = 'SELECT qty, ref, label, tva_tx, vat_src_code, subprice, multicurrency_subprice, remise_percent FROM llx_commande_fournisseurdet WHERE rowid='.$line->fk_commandefourndet; $resql_commfourndet = $db->query($sql_commfourndet); - if(!empty($resql_commfourndet)){ + if (!empty($resql_commfourndet)) { $obj = $db->fetch_object($resql_commfourndet); $line->qty_asked = $obj->qty; $line->description = $line->comment; - $line->desc = $line->comment; + $line->desc = $line->comment; $line->tva_tx = $obj->tva_tx; $line->vat_src_code = $obj->vat_src_code; $line->subprice = $obj->subprice; $line->multicurrency_subprice = $obj->multicurrency_subprice; $line->remise_percent = $obj->remise_percent; - $line->label = !empty($obj->label)?$obj->label:$line->product->label; + $line->label = !empty($obj->label) ? $obj->label : $line->product->label; $line->ref_supplier = $obj->ref; - }else { + } else { $line->qty_asked = 0; $line->description = ''; $line->label = $obj->label; } - $pu_ht=($line->subprice*$line->qty)*(100-$line->remise_percent)/100; - $tva = $pu_ht*$line->tva_tx/100; + $pu_ht = ($line->subprice * $line->qty) * (100 - $line->remise_percent) / 100; + $tva = $pu_ht * $line->tva_tx / 100; $this->total_ht += $pu_ht; - $this->total_tva += $pu_ht*$line->tva_tx/100; + $this->total_tva += $pu_ht * $line->tva_tx / 100; - $this->total_ttc += $pu_ht+$tva; + $this->total_ttc += $pu_ht + $tva; - $this->lines[]=$line; + $this->lines[] = $line; } return 1; @@ -1107,35 +1107,35 @@ class Reception extends CommonObject public function getNomUrl($withpicto = 0, $option = 0, $max = 0, $short = 0, $notooltip = 0) { global $langs; - $result=''; - $label = '' . $langs->trans("ShowReception") . ''; - $label .= '
' . $langs->trans('Ref') . ': '.$this->ref; + $result = ''; + $label = ''.$langs->trans("ShowReception").''; + $label .= '
'.$langs->trans('Ref').': '.$this->ref; $label .= '
'.$langs->trans('RefSupplier').': '.($this->ref_supplier ? $this->ref_supplier : $this->ref_client); $url = DOL_URL_ROOT.'/reception/card.php?id='.$this->id; if ($short) return $url; - $linkclose=''; + $linkclose = ''; if (empty($notooltip)) { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowReception"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowReception"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip"'; } $linkstart = ''; - $linkend=''; + $linkend = ''; - $picto='sending'; + $picto = 'sending'; - if ($withpicto) $result.=($linkstart.img_object(($notooltip?'':$label), $picto, ($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - $result.=$linkstart.$this->ref.$linkend; + if ($withpicto) $result .= ($linkstart.img_object(($notooltip ? '' : $label), $picto, ($notooltip ? '' : 'class="classfortooltip"'), 0, 0, $notooltip ? 0 : 1).$linkend); + if ($withpicto && $withpicto != 2) $result .= ' '; + $result .= $linkstart.$this->ref.$linkend; return $result; } @@ -1186,7 +1186,7 @@ class Reception extends CommonObject include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.dispatch.class.php'; - $now=dol_now(); + $now = dol_now(); dol_syslog(get_class($this)."::initAsSpecimen"); @@ -1194,8 +1194,8 @@ class Reception extends CommonObject $num_prods = 0; $prodids = array(); $sql = "SELECT rowid"; - $sql.= " FROM ".MAIN_DB_PREFIX."product"; - $sql.= " WHERE entity IN (".getEntity('product').")"; + $sql .= " FROM ".MAIN_DB_PREFIX."product"; + $sql .= " WHERE entity IN (".getEntity('product').")"; $resql = $this->db->query($sql); if ($resql) { @@ -1209,20 +1209,20 @@ class Reception extends CommonObject } } - $order=new CommandeFournisseur($this->db); + $order = new CommandeFournisseur($this->db); $order->initAsSpecimen(); // Initialise parametres - $this->id=0; + $this->id = 0; $this->ref = 'SPECIMEN'; - $this->specimen=1; + $this->specimen = 1; $this->statut = 1; $this->livraison_id = 0; $this->date = $now; $this->date_creation = $now; $this->date_valid = $now; $this->date_delivery = $now; - $this->date_reception = $now + 24*3600; + $this->date_reception = $now + 24 * 3600; $this->entrepot_id = 0; $this->fk_delivery_address = 0; @@ -1241,14 +1241,14 @@ class Reception extends CommonObject $xnbp = 0; while ($xnbp < $nbp) { - $line=new CommandeFournisseurDispatch($this->db); - $line->desc=$langs->trans("Description")." ".$xnbp; - $line->libelle=$langs->trans("Description")." ".$xnbp; - $line->qty=10; + $line = new CommandeFournisseurDispatch($this->db); + $line->desc = $langs->trans("Description")." ".$xnbp; + $line->libelle = $langs->trans("Description")." ".$xnbp; + $line->qty = 10; - $line->fk_product=$this->commande->lines[$xnbp]->fk_product; + $line->fk_product = $this->commande->lines[$xnbp]->fk_product; - $this->lines[]=$line; + $this->lines[] = $line; $xnbp++; } } @@ -1267,11 +1267,11 @@ class Reception extends CommonObject if ($user->rights->reception->creer) { $sql = "UPDATE ".MAIN_DB_PREFIX."reception"; - $sql.= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET date_delivery = ".($date_livraison ? "'".$this->db->idate($date_livraison)."'" : 'null'); + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::set_date_livraison", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->date_delivery = $date_livraison; @@ -1279,7 +1279,7 @@ class Reception extends CommonObject } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } } @@ -1302,17 +1302,17 @@ class Reception extends CommonObject $this->meths = array(); $sql = "SELECT em.rowid, em.code, em.libelle"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; - $sql.= " WHERE em.active = 1"; - $sql.= " ORDER BY em.libelle ASC"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; + $sql .= " WHERE em.active = 1"; + $sql .= " ORDER BY em.libelle ASC"; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { - $label=$langs->trans('ReceptionMethod'.$obj->code); - $this->meths[$obj->rowid] = ($label != 'ReceptionMethod'.$obj->code?$label:$obj->libelle); + $label = $langs->trans('ReceptionMethod'.$obj->code); + $this->meths[$obj->rowid] = ($label != 'ReceptionMethod'.$obj->code ? $label : $obj->libelle); } } } @@ -1330,19 +1330,19 @@ class Reception extends CommonObject global $langs; $this->listmeths = array(); - $i=0; + $i = 0; $sql = "SELECT em.rowid, em.code, em.libelle, em.description, em.tracking, em.active"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; - if ($id!='') $sql.= " WHERE em.rowid=".$id; + $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; + if ($id != '') $sql .= " WHERE em.rowid=".$id; $resql = $this->db->query($sql); if ($resql) { while ($obj = $this->db->fetch_object($resql)) { $this->listmeths[$i]['rowid'] = $obj->rowid; $this->listmeths[$i]['code'] = $obj->code; - $label=$langs->trans('ReceptionMethod'.$obj->code); - $this->listmeths[$i]['libelle'] = ($label != 'ReceptionMethod'.$obj->code?$label:$obj->libelle); + $label = $langs->trans('ReceptionMethod'.$obj->code); + $this->listmeths[$i]['libelle'] = ($label != 'ReceptionMethod'.$obj->code ? $label : $obj->libelle); $this->listmeths[$i]['description'] = $obj->description; $this->listmeths[$i]['tracking'] = $obj->tracking; $this->listmeths[$i]['active'] = $obj->active; @@ -1362,20 +1362,20 @@ class Reception extends CommonObject public function update_delivery_method($id = '') { // phpcs:enable - if ($id=='') + if ($id == '') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; - $sql.=" VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')"; + $sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')"; $resql = $this->db->query($sql); } else { $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET"; - $sql.= " code='".$this->db->escape($this->update['code'])."'"; - $sql.= ",libelle='".$this->db->escape($this->update['libelle'])."'"; - $sql.= ",description='".$this->db->escape($this->update['description'])."'"; - $sql.= ",tracking='".$this->db->escape($this->update['tracking'])."'"; - $sql.= " WHERE rowid=".$id; + $sql .= " code='".$this->db->escape($this->update['code'])."'"; + $sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'"; + $sql .= ",description='".$this->db->escape($this->update['description'])."'"; + $sql .= ",tracking='".$this->db->escape($this->update['tracking'])."'"; + $sql .= " WHERE rowid=".$id; $resql = $this->db->query($sql); } if ($resql < 0) dol_print_error($this->db, ''); @@ -1393,7 +1393,7 @@ class Reception extends CommonObject { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=1'; - $sql.= ' WHERE rowid='.$id; + $sql .= ' WHERE rowid='.$id; $resql = $this->db->query($sql); } @@ -1410,7 +1410,7 @@ class Reception extends CommonObject { // phpcs:enable $sql = 'UPDATE '.MAIN_DB_PREFIX.'c_shipment_mode SET active=0'; - $sql.= ' WHERE rowid='.$id; + $sql .= ' WHERE rowid='.$id; $resql = $this->db->query($sql); } @@ -1424,11 +1424,11 @@ class Reception extends CommonObject */ public function getUrlTrackingStatus($value = '') { - if (! empty($this->shipping_method_id)) + if (!empty($this->shipping_method_id)) { $sql = "SELECT em.code, em.tracking"; - $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; - $sql.= " WHERE em.rowid = ".$this->shipping_method_id; + $sql .= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as em"; + $sql .= " WHERE em.rowid = ".$this->shipping_method_id; $resql = $this->db->query($sql); if ($resql) @@ -1443,7 +1443,7 @@ class Reception extends CommonObject if (!empty($tracking) && !empty($value)) { $url = str_replace('{TRACKID}', $value, $tracking); - $this->tracking_url = sprintf(''.($value?$value:'url').'', $url, $url); + $this->tracking_url = sprintf(''.($value ? $value : 'url').'', $url, $url); } else { @@ -1458,16 +1458,16 @@ class Reception extends CommonObject */ public function setClosed() { - global $conf,$langs,$user; + global $conf, $langs, $user; - $error=0; + $error = 0; $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET fk_statut='.self::STATUS_CLOSED; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { // Set order billed if 100% of order is received (qty in reception lines match qty in order lines) @@ -1476,17 +1476,17 @@ class Reception extends CommonObject $order = new CommandeFournisseur($this->db); $order->fetch($this->origin_id); - $order->loadReceptions(self::STATUS_CLOSED); // Fill $order->receptions = array(orderlineid => qty) + $order->loadReceptions(self::STATUS_CLOSED); // Fill $order->receptions = array(orderlineid => qty) $receptions_match_order = 1; - foreach($order->lines as $line) + foreach ($order->lines as $line) { $lineid = $line->id; $qty = $line->qty; - if (($line->product_type == 0 || ! empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $order->receptions[$lineid] < $qty) + if (($line->product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) && $order->receptions[$lineid] < $qty) { $receptions_match_order = 0; - $text='Qty for order line id '.$lineid.' is '.$qty.'. However in the receptions with status Reception::STATUS_CLOSED='.self::STATUS_CLOSED.' we have qty = '.$order->receptions[$lineid].', so we can t close order'; + $text = 'Qty for order line id '.$lineid.' is '.$qty.'. However in the receptions with status Reception::STATUS_CLOSED='.self::STATUS_CLOSED.' we have qty = '.$order->receptions[$lineid].', so we can t close order'; dol_syslog($text); break; } @@ -1498,11 +1498,11 @@ class Reception extends CommonObject } } - $this->statut=self::STATUS_CLOSED; + $this->statut = self::STATUS_CLOSED; // If stock increment is done on closing - if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) + if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -1511,15 +1511,15 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO possibilite de receptionner a partir d'une propale ou autre origine ? $sql = "SELECT cd.fk_product, cd.subprice,"; - $sql.= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql.= " ed.eatby, ed.sellby, ed.batch"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; - $sql.= " WHERE ed.fk_reception = ".$this->id; - $sql.= " AND cd.rowid = ed.fk_commandefourndet"; + $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; + $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; + $sql .= " WHERE ed.fk_reception = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_commandefourndet"; dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { @@ -1541,7 +1541,7 @@ class Reception extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref)); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1553,7 +1553,7 @@ class Reception extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, $qty, $obj->subprice, $langs->trans("ReceptionClassifyClosedInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $this->error = $mouvS->error; @@ -1565,15 +1565,15 @@ class Reception extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } } // Call trigger - if (! $error) + if (!$error) { - $result=$this->call_trigger('RECEPTION_CLOSED', $user); + $result = $this->call_trigger('RECEPTION_CLOSED', $user); if ($result < 0) { $error++; } @@ -1585,7 +1585,7 @@ class Reception extends CommonObject $error++; } - if (! $error) + if (!$error) { $this->db->commit(); return 1; @@ -1607,7 +1607,7 @@ class Reception extends CommonObject { // phpcs:enable global $user; - $error=0; + $error = 0; $this->db->begin(); @@ -1616,20 +1616,20 @@ class Reception extends CommonObject $sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET billed=1'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $this->statut=2; - $this->billed=1; + $this->statut = 2; + $this->billed = 1; // Call trigger - $result=$this->call_trigger('RECEPTION_BILLED', $user); + $result = $this->call_trigger('RECEPTION_BILLED', $user); if ($result < 0) { $error++; } } else { $error++; - $this->errors[]=$this->db->lasterror; + $this->errors[] = $this->db->lasterror; } if (empty($error)) { @@ -1650,23 +1650,23 @@ class Reception extends CommonObject */ public function reOpen() { - global $conf,$langs,$user; + global $conf, $langs, $user; - $error=0; + $error = 0; $this->db->begin(); $sql = 'UPDATE '.MAIN_DB_PREFIX.'reception SET fk_statut=1, billed=0'; $sql .= ' WHERE rowid = '.$this->id.' AND fk_statut > 0'; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $this->statut=1; - $this->billed=0; + $this->statut = 1; + $this->billed = 0; // If stock increment is done on closing - if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) + if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; $numref = $this->ref; @@ -1675,15 +1675,15 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO possibilite de receptionner a partir d'une propale ou autre origine $sql = "SELECT ed.fk_product, cd.subprice,"; - $sql.= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql.= " ed.eatby, ed.sellby, ed.batch"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; - $sql.= " WHERE ed.fk_reception = ".$this->id; - $sql.= " AND cd.rowid = ed.fk_commandefourndet"; + $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; + $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; + $sql .= " WHERE ed.fk_reception = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_commandefourndet"; dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); @@ -1706,7 +1706,7 @@ class Reception extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref)); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1718,7 +1718,7 @@ class Reception extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionUnClassifyCloseddInDolibarr", $numref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch, $obj->fk_origin_stock); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1729,31 +1729,31 @@ class Reception extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } } - if (! $error) + if (!$error) { // Call trigger - $result=$this->call_trigger('RECEPTION_REOPEN', $user); + $result = $this->call_trigger('RECEPTION_REOPEN', $user); if ($result < 0) { $error++; } } - if($this->origin == 'order_supplier'){ + if ($this->origin == 'order_supplier') { $commande = new CommandeFournisseur($this->db); $commande->fetch($this->origin_id); $commande->setStatus($user, 4); } } else { $error++; - $this->errors[]=$this->db->lasterror(); + $this->errors[] = $this->db->lasterror(); } - if (! $error) + if (!$error) { $this->db->commit(); return 1; @@ -1774,9 +1774,9 @@ class Reception extends CommonObject public function setDraft($user) { // phpcs:enable - global $conf,$langs; + global $conf, $langs; - $error=0; + $error = 0; // Protection if ($this->statut <= self::STATUS_DRAFT) @@ -1784,24 +1784,24 @@ class Reception extends CommonObject return 0; } - if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->reception->creer)) - || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->reception->reception_advance->validate)))) + if (!((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) + || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate)))) { - $this->error='Permission denied'; + $this->error = 'Permission denied'; return -1; } $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."reception"; - $sql.= " SET fk_statut = ".self::STATUS_DRAFT; - $sql.= " WHERE rowid = ".$this->id; + $sql .= " SET fk_statut = ".self::STATUS_DRAFT; + $sql .= " WHERE rowid = ".$this->id; dol_syslog(__METHOD__, LOG_DEBUG); if ($this->db->query($sql)) { // If stock increment is done on closing - if (! $error && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) + if (!$error && !empty($conf->stock->enabled) && !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION)) { require_once DOL_DOCUMENT_ROOT.'/product/stock/class/mouvementstock.class.php'; @@ -1810,15 +1810,15 @@ class Reception extends CommonObject // Loop on each product line to add a stock movement // TODO possibilite de receptionner a partir d'une propale ou autre origine $sql = "SELECT cd.fk_product, cd.subprice,"; - $sql.= " ed.rowid, ed.qty, ed.fk_entrepot,"; - $sql.= " ed.eatby, ed.sellby, ed.batch"; - $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; - $sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; - $sql.= " WHERE ed.fk_reception = ".$this->id; - $sql.= " AND cd.rowid = ed.fk_commandefourndet"; + $sql .= " ed.rowid, ed.qty, ed.fk_entrepot,"; + $sql .= " ed.eatby, ed.sellby, ed.batch"; + $sql .= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as cd,"; + $sql .= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as ed"; + $sql .= " WHERE ed.fk_reception = ".$this->id; + $sql .= " AND cd.rowid = ed.fk_commandefourndet"; dol_syslog(get_class($this)."::valid select details", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $cpt = $this->db->num_rows($resql); @@ -1841,7 +1841,7 @@ class Reception extends CommonObject // line without batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref)); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref)); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1854,7 +1854,7 @@ class Reception extends CommonObject // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record - $result=$mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); + $result = $mouvS->reception($user, $obj->fk_product, $obj->fk_entrepot, -$qty, $obj->subprice, $langs->trans("ReceptionBackToDraftInDolibarr", $this->ref), $this->db->jdate($obj->eatby), $this->db->jdate($obj->sellby), $obj->batch); if ($result < 0) { $this->error = $mouvS->error; $this->errors = $mouvS->errors; @@ -1865,14 +1865,14 @@ class Reception extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $error++; } } if (!$error) { // Call trigger - $result=$this->call_trigger('RECEPTION_UNVALIDATE', $user); + $result = $this->call_trigger('RECEPTION_UNVALIDATE', $user); if ($result < 0) $error++; } if ($this->origin == 'order_supplier') @@ -1907,7 +1907,7 @@ class Reception extends CommonObject } if (!$error) { - $this->statut=self::STATUS_DRAFT; + $this->statut = self::STATUS_DRAFT; $this->db->commit(); return 1; } else { @@ -1917,7 +1917,7 @@ class Reception extends CommonObject } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); $this->db->rollback(); return -1; } @@ -1935,17 +1935,17 @@ class Reception extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { - global $conf,$langs; + global $conf, $langs; $langs->load("receptions"); - if (! dol_strlen($modele)) + if (!dol_strlen($modele)) { $modele = 'squille'; if ($this->modelpdf) { $modele = $this->modelpdf; - } elseif (! empty($conf->global->RECEPTION_ADDON_PDF)) { + } elseif (!empty($conf->global->RECEPTION_ADDON_PDF)) { $modele = $conf->global->RECEPTION_ADDON_PDF; } } diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 6b375679052..cfd3e7f8b95 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -45,24 +45,24 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; -if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; +if (!empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $langs->loadLangs(array("companies", "commercial", "bills", "banks", "users")); -if (! empty($conf->adherent->enabled)) $langs->load("members"); -if (! empty($conf->categorie->enabled)) $langs->load("categories"); -if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); -if (! empty($conf->notification->enabled)) $langs->load("mails"); +if (!empty($conf->adherent->enabled)) $langs->load("members"); +if (!empty($conf->categorie->enabled)) $langs->load("categories"); +if (!empty($conf->incoterm->enabled)) $langs->load("incoterm"); +if (!empty($conf->notification->enabled)) $langs->load("mails"); -$mesg=''; $error=0; $errors=array(); +$mesg = ''; $error = 0; $errors = array(); $action = (GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'); $cancel = GETPOST('cancel', 'alpha'); -$backtopage = GETPOST('backtopage', 'alpha'); +$backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); -$socid = GETPOST('socid', 'int')?GETPOST('socid', 'int'):GETPOST('id', 'int'); -if ($user->socid) $socid=$user->socid; -if (empty($socid) && $action == 'view') $action='create'; +$socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); +if ($user->socid) $socid = $user->socid; +if (empty($socid) && $action == 'view') $action = 'create'; $object = new Societe($db); $extrafields = new ExtraFields($db); @@ -73,11 +73,11 @@ $extrafields->fetch_name_optionals_label($object->table_element); $socialnetworks = getArrayOfSocialNetworks(); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('thirdpartycard','globalcard')); +$hookmanager->initHooks(array('thirdpartycard', 'globalcard')); if ($socid > 0) $object->fetch($socid); -if (! ($object->id > 0) && $action == 'view') +if (!($object->id > 0) && $action == 'view') { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); @@ -86,9 +86,9 @@ if (! ($object->id > 0) && $action == 'view') // Get object canvas (By default, this is not defined, so standard usage of dolibarr) $object->getCanvas($socid); -$canvas = $object->canvas?$object->canvas:GETPOST("canvas"); -$objcanvas=null; -if (! empty($canvas)) +$canvas = $object->canvas ? $object->canvas : GETPOST("canvas"); +$objcanvas = null; +if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); @@ -103,16 +103,16 @@ $result = restrictedArea($user, 'societe', $socid, '&societe', '', 'fk_soc', 'ro * Actions */ -$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { if ($cancel) { - $action=''; - if (! empty($backtopage)) + $action = ''; + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -148,7 +148,7 @@ if (empty($reshook)) // Recopy some data $object->client = $object->client | $soc_origin->client; $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; - $listofproperties=array( + $listofproperties = array( 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'twitter', 'facebook', 'linkedin', 'socialnetworks', 'url', 'barcode', 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'remise_supplier_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', @@ -162,7 +162,7 @@ if (empty($reshook)) } // Concat some data - $listofproperties=array( + $listofproperties = array( 'note_public', 'note_private' ); foreach ($listofproperties as $property) @@ -213,7 +213,7 @@ if (empty($reshook)) } // Move links - if (! $error) + if (!$error) { $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', @@ -253,7 +253,7 @@ if (empty($reshook)) } // External modules should update their ones too - if (! $error) + if (!$error) { $reshook = $hookmanager->executeHooks('replaceThirdparty', array( 'soc_origin' => $soc_origin->id, @@ -268,12 +268,12 @@ if (empty($reshook)) } - if (! $error) + if (!$error) { - $object->context=array('merge'=>1, 'mergefromid'=>$soc_origin->id); + $object->context = array('merge'=>1, 'mergefromid'=>$soc_origin->id); // Call trigger - $result=$object->call_trigger('COMPANY_MODIFY', $user); + $result = $object->call_trigger('COMPANY_MODIFY', $user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -309,28 +309,28 @@ if (empty($reshook)) if (GETPOST('getcustomercode')) { // We defined value code_client - $_POST["customer_code"]="Acompleter"; + $_POST["customer_code"] = "Acompleter"; } if (GETPOST('getsuppliercode')) { // We defined value code_fournisseur - $_POST["supplier_code"]="Acompleter"; + $_POST["supplier_code"] = "Acompleter"; } - if($action=='set_localtax1') + if ($action == 'set_localtax1') { //obtidre selected del combobox - $value=GETPOST('lt1'); + $value = GETPOST('lt1'); $object->fetch($socid); - $res=$object->setValueFrom('localtax1_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); + $res = $object->setValueFrom('localtax1_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); } - if($action=='set_localtax2') + if ($action == 'set_localtax2') { //obtidre selected del combobox - $value=GETPOST('lt2'); + $value = GETPOST('lt2'); $object->fetch($socid); - $res=$object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); + $res = $object->setValueFrom('localtax2_value', $value, '', null, 'text', '', $user, 'COMPANY_MODIFY'); } if ($action == 'update_extras') { @@ -344,7 +344,7 @@ if (empty($reshook)) $ret = $extrafields->setOptionalsFromPost(null, $object, GETPOST('attribute', 'none')); if ($ret < 0) $error++; - if (! $error) + if (!$error) { $result = $object->insertExtraFields('COMPANY_MODIFY'); if ($result < 0) @@ -358,12 +358,12 @@ if (empty($reshook)) } // Add new or update third party - if ((! GETPOST('getcustomercode') && ! GETPOST('getsuppliercode')) + if ((!GETPOST('getcustomercode') && !GETPOST('getsuppliercode')) && ($action == 'add' || $action == 'update') && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - if (! GETPOST('name')) + if (!GETPOST('name')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ThirdPartyName")), null, 'errors'); $error++; @@ -379,51 +379,51 @@ if (empty($reshook)) $error++; } - if (! $error) + if (!$error) { if ($action == 'update') { - $ret=$object->fetch($socid); + $ret = $object->fetch($socid); $object->oldcopy = clone $object; } - else $object->canvas=$canvas; + else $object->canvas = $canvas; if (GETPOST("private", 'int') == 1) // Ask to create a contact { $object->particulier = GETPOST("private"); - $object->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('name', 'alpha')); - $object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int + $object->name = dolGetFirstLastname(GETPOST('firstname', 'alpha'), GETPOST('name', 'alpha')); + $object->civility_id = GETPOST('civility_id'); // Note: civility id is a code, not an int // Add non official properties - $object->name_bis = GETPOST('name', 'alpha'); - $object->firstname = GETPOST('firstname', 'alpha'); + $object->name_bis = GETPOST('name', 'alpha'); + $object->firstname = GETPOST('firstname', 'alpha'); } else { - $object->name = GETPOST('name', 'alpha'); + $object->name = GETPOST('name', 'alpha'); } - $object->entity = (GETPOSTISSET('entity')?GETPOST('entity', 'int'):$conf->entity); - $object->name_alias = GETPOST('name_alias'); + $object->entity = (GETPOSTISSET('entity') ?GETPOST('entity', 'int') : $conf->entity); + $object->name_alias = GETPOST('name_alias'); $object->address = GETPOST('address'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = GETPOST('country_id', 'int'); - $object->state_id = GETPOST('state_id', 'int'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id', 'int'); + $object->state_id = GETPOST('state_id', 'int'); //$object->skype = GETPOST('skype', 'alpha'); //$object->twitter = GETPOST('twitter', 'alpha'); //$object->facebook = GETPOST('facebook', 'alpha'); //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); } } } - $object->phone = GETPOST('phone', 'alpha'); + $object->phone = GETPOST('phone', 'alpha'); $object->fax = GETPOST('fax', 'alpha'); - $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); + $object->email = trim(GETPOST('email', 'custom', 0, FILTER_SANITIZE_EMAIL)); $object->url = trim(GETPOST('url', 'custom', 0, FILTER_SANITIZE_URL)); $object->idprof1 = trim(GETPOST('idprof1', 'alpha')); $object->idprof2 = trim(GETPOST('idprof2', 'alpha')); @@ -432,14 +432,14 @@ if (empty($reshook)) $object->idprof5 = trim(GETPOST('idprof5', 'alpha')); $object->idprof6 = trim(GETPOST('idprof6', 'alpha')); $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->code_client = GETPOSTISSET('customer_code')?GETPOST('customer_code', 'alpha'):GETPOST('code_client', 'alpha'); - $object->code_fournisseur = GETPOSTISSET('supplier_code')?GETPOST('supplier_code', 'alpha'):GETPOST('code_fournisseur', 'alpha'); + $object->code_client = GETPOSTISSET('customer_code') ?GETPOST('customer_code', 'alpha') : GETPOST('code_client', 'alpha'); + $object->code_fournisseur = GETPOSTISSET('supplier_code') ?GETPOST('supplier_code', 'alpha') : GETPOST('code_fournisseur', 'alpha'); $object->capital = GETPOST('capital', 'alpha'); $object->barcode = GETPOST('barcode', 'alpha'); $object->tva_intra = GETPOST('tva_intra', 'alpha'); $object->tva_assuj = GETPOST('assujtva_value', 'alpha'); - $object->status = GETPOST('status', 'alpha'); + $object->status = GETPOST('status', 'alpha'); // Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'alpha'); @@ -448,17 +448,17 @@ if (empty($reshook)) $object->localtax1_value = GETPOST('lt1', 'alpha'); $object->localtax2_value = GETPOST('lt2', 'alpha'); - $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); + $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); - $object->typent_id = GETPOST('typent_id', 'int'); + $object->typent_id = GETPOST('typent_id', 'int'); - $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type + $object->typent_code = dol_getIdFromCode($db, $object->typent_id, 'c_typent', 'id', 'code'); // Force typent_code too so check in verify() will be done on new type - $object->client = GETPOST('client', 'int'); + $object->client = GETPOST('client', 'int'); $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->commercial_id = GETPOST('commercial_id', 'int'); - $object->default_lang = GETPOST('default_lang'); + $object->commercial_id = GETPOST('commercial_id', 'int'); + $object->default_lang = GETPOST('default_lang'); // Webservices url/key $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); @@ -467,8 +467,8 @@ if (empty($reshook)) // Incoterms if (!empty($conf->incoterm->enabled)) { - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); } // Multicurrency @@ -485,46 +485,46 @@ if (empty($reshook)) } if (GETPOST('deletephoto')) $object->logo = ''; - elseif (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); + elseif (!empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']); // Check parameters - if (! GETPOST('cancel', 'alpha')) + if (!GETPOST('cancel', 'alpha')) { - if (! empty($object->email) && ! isValidEMail($object->email)) + if (!empty($object->email) && !isValidEMail($object->email)) { $langs->load("errors"); $error++; setEventMessages('', $langs->trans("ErrorBadEMail", $object->email), 'errors'); } - if (! empty($object->url) && ! isValidUrl($object->url)) + if (!empty($object->url) && !isValidUrl($object->url)) { $langs->load("errors"); setEventMessages('', $langs->trans("ErrorBadUrl", $object->url), 'errors'); } - if (! empty($object->webservices_url)) { + if (!empty($object->webservices_url)) { //Check if has transport, without any the soap client will give error if (strpos($object->webservices_url, "http") === false) { $object->webservices_url = "http://".$object->webservices_url; } - if (! isValidUrl($object->webservices_url)) { + if (!isValidUrl($object->webservices_url)) { $langs->load("errors"); $error++; $errors[] = $langs->trans("ErrorBadUrl", $object->webservices_url); } } // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id')!=''?GETPOST('country_id'):$mysoc->country_id; + $object->country_id = GETPOST('country_id') != '' ?GETPOST('country_id') : $mysoc->country_id; if ($object->country_id) { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; + $tmparray = getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; } } } - if (! $error) + if (!$error) { if ($action == 'add') { @@ -532,8 +532,8 @@ if (empty($reshook)) $db->begin(); - if (empty($object->client)) $object->code_client=''; - if (empty($object->fournisseur)) $object->code_fournisseur=''; + if (empty($object->client)) $object->code_client = ''; + if (empty($object->fournisseur)) $object->code_fournisseur = ''; $result = $object->create($user); @@ -542,7 +542,7 @@ if (empty($reshook)) if ($object->particulier) { dol_syslog("We ask to create a contact/address too", LOG_DEBUG); - $result=$object->create_individual($user); + $result = $object->create_individual($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -588,10 +588,10 @@ if (empty($reshook)) if (@is_dir($dir)) { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - if (! $result > 0) + if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; } @@ -605,7 +605,7 @@ if (empty($reshook)) } else { - switch($_FILES['photo']['error']) + switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form @@ -631,22 +631,22 @@ if (empty($reshook)) $error++; } - if ($result >= 0 && ! $error) + if ($result >= 0 && !$error) { $db->commit(); - if (! empty($backtopage)) + if (!empty($backtopage)) { - $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation - if (preg_match('/\?/', $backtopage)) $backtopage.='&socid='.$object->id; // Old method + $backtopage = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $backtopage); // New method to autoselect project after a New on another form object creation + if (preg_match('/\?/', $backtopage)) $backtopage .= '&socid='.$object->id; // Old method header("Location: ".$backtopage); exit; } else { - $url=$_SERVER["PHP_SELF"]."?socid=".$object->id; // Old method - if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url=DOL_URL_ROOT."/comm/card.php?socid=".$object->id; - elseif ($object->fournisseur == 1) $url=DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; + $url = $_SERVER["PHP_SELF"]."?socid=".$object->id; // Old method + if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url = DOL_URL_ROOT."/comm/card.php?socid=".$object->id; + elseif ($object->fournisseur == 1) $url = DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; header("Location: ".$url); exit; @@ -655,7 +655,7 @@ if (empty($reshook)) else { $db->rollback(); - $action='create'; + $action = 'create'; } } @@ -665,7 +665,7 @@ if (empty($reshook)) if (GETPOST('cancel', 'alpha')) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -678,13 +678,13 @@ if (empty($reshook)) } // To not set code if third party is not concerned. But if it had values, we keep them. - if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client=''; - if (empty($object->fournisseur)&& empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur=''; + if (empty($object->client) && empty($object->oldcopy->code_client)) $object->code_client = ''; + if (empty($object->fournisseur) && empty($object->oldcopy->code_fournisseur)) $object->code_fournisseur = ''; //var_dump($object);exit; $result = $object->update($socid, $user, 1, $object->oldcopy->codeclient_modifiable(), $object->oldcopy->codefournisseur_modifiable(), 'update', 0); - if ($result <= 0) + if ($result <= 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -700,7 +700,7 @@ if (empty($reshook)) } // Prevent thirdparty's emptying if a user hasn't rights $user->rights->categorie->lire (in such a case, post of 'custcats' is not defined) - if (! $error && !empty($user->rights->categorie->lire)) + if (!$error && !empty($user->rights->categorie->lire)) { // Customer categories association $categories = GETPOST('custcats', 'array'); @@ -726,8 +726,8 @@ if (empty($reshook)) $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); if (GETPOST('deletephoto') && $object->logo) { - $fileimg=$dir.'/'.$object->logo; - $dirthumbs=$dir.'/thumbs'; + $fileimg = $dir.'/'.$object->logo; + $dirthumbs = $dir.'/thumbs'; dol_delete_file($fileimg); dol_delete_dir_recursive($dirthumbs); } @@ -739,10 +739,10 @@ if (empty($reshook)) if (@is_dir($dir)) { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - if (! $result > 0) + if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; } @@ -752,9 +752,9 @@ if (empty($reshook)) $object->addThumbs($newfile); // Index file in database - if (! empty($conf->global->THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD)) + if (!empty($conf->global->THIRDPARTY_LOGO_ALLOW_EXTERNAL_DOWNLOAD)) { - require_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; // the dir dirname($newfile) is directory of logo, so we should have only one file at once into index, so we delete indexes for the dir deleteFilesIntoDatabaseIndex(dirname($newfile), '', ''); // now we index the uploaded logo file @@ -770,7 +770,7 @@ if (empty($reshook)) } else { - switch($_FILES['photo']['error']) + switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form @@ -785,11 +785,11 @@ if (empty($reshook)) // Update linked member - if (! $error && $object->fk_soc > 0) + if (!$error && $object->fk_soc > 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; - $sql.= " SET fk_soc = NULL WHERE fk_soc = " . $id; - if (! $object->db->query($sql)) + $sql .= " SET fk_soc = NULL WHERE fk_soc = ".$id; + if (!$object->db->query($sql)) { $error++; $object->error .= $object->db->lasterror(); @@ -797,9 +797,9 @@ if (empty($reshook)) } } - if (! $error && ! count($errors)) + if (!$error && !count($errors)) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -813,13 +813,13 @@ if (empty($reshook)) else { $object->id = $socid; - $action= "edit"; + $action = "edit"; } } } else { - $action = ($action=='add'?'create':'edit'); + $action = ($action == 'add' ? 'create' : 'edit'); } } @@ -840,7 +840,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; - $action=''; + $action = ''; } } @@ -858,20 +858,20 @@ if (empty($reshook)) $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); } - $id=$socid; + $id = $socid; $object->fetch($socid); // Actions to send emails - $trigger_name='COMPANY_SENTBYMAIL'; - $paramname='socid'; - $mode='emailfromthirdparty'; - $trackid='thi'.$object->id; + $trigger_name = 'COMPANY_SENTBYMAIL'; + $paramname = 'socid'; + $mode = 'emailfromthirdparty'; + $trackid = 'thi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Actions to build doc $id = $socid; $upload_dir = $conf->societe->dir_output; - $permissiontoadd=$user->rights->societe->creer; + $permissiontoadd = $user->rights->societe->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -887,24 +887,24 @@ $formcompany = new FormCompany($db); if ($socid > 0 && empty($object->id)) { - $result=$object->fetch($socid); + $result = $object->fetch($socid); if ($result <= 0) dol_print_error('', $object->error); } -$title=$langs->trans("ThirdParty"); -if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$langs->trans('Card'); -$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +$title = $langs->trans("ThirdParty"); +if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/', $conf->global->MAIN_HTML_TITLE) && $object->name) $title = $object->name." - ".$langs->trans('Card'); +$help_url = 'EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('', $title, $help_url); -$countrynotdefined=$langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; +$countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates - $objcanvas->display_canvas($action); // Show template + $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates + $objcanvas->display_canvas($action); // Show template } else { @@ -916,82 +916,82 @@ else /* * Creation */ - $private=GETPOST("private", "int"); - if (! empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && ! isset($_GET['private']) && ! isset($_POST['private'])) $private=1; - if (empty($private)) $private=0; + $private = GETPOST("private", "int"); + if (!empty($conf->global->THIRDPARTY_DEFAULT_CREATE_CONTACT) && !isset($_GET['private']) && !isset($_POST['private'])) $private = 1; + if (empty($private)) $private = 0; // Load object modCodeTiers - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module)-4); + $module = substr($module, 0, dol_strlen($module) - 4); } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $modCodeClient = new $module; // Load object modCodeFournisseur - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module)-4); + $module = substr($module, 0, dol_strlen($module) - 4); } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $modCodeFournisseur = new $module; // Define if customer/prospect or supplier status is set or not - if (GETPOST("type")!='f') + if (GETPOST("type") != 'f') { - $object->client=-1; - if (! empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client=3; } + $object->client = -1; + if (!empty($conf->global->THIRDPARTY_CUSTOMERPROSPECT_BY_DEFAULT)) { $object->client = 3; } } // Prospect / Customer - if (GETPOST("type")=='c') { - if (! empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { - $object->client=$conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; + if (GETPOST("type") == 'c') { + if (!empty($conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT)) { + $object->client = $conf->global->THIRDPARTY_CUSTOMERTYPE_BY_DEFAULT; } else { - $object->client=3; + $object->client = 3; } } - if (GETPOST("type")=='p') { $object->client=2; } - if (! empty($conf->fournisseur->enabled) && (GETPOST("type")=='f' || (GETPOST("type")=='' && ! empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur=1; } + if (GETPOST("type") == 'p') { $object->client = 2; } + if (!empty($conf->fournisseur->enabled) && (GETPOST("type") == 'f' || (GETPOST("type") == '' && !empty($conf->global->THIRDPARTY_SUPPLIER_BY_DEFAULT)))) { $object->fournisseur = 1; } - $object->name = GETPOST('name', 'alpha'); - $object->firstname = GETPOST('firstname', 'alpha'); + $object->name = GETPOST('name', 'alpha'); + $object->firstname = GETPOST('firstname', 'alpha'); $object->particulier = $private; $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->client = GETPOST('client', 'int')?GETPOST('client', 'int'):$object->client; + $object->client = GETPOST('client', 'int') ?GETPOST('client', 'int') : $object->client; if (empty($duplicate_code_error)) { $object->code_client = GETPOST('customer_code', 'alpha'); - $object->fournisseur = GETPOST('fournisseur')?GETPOST('fournisseur'):$object->fournisseur; - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->fournisseur = GETPOST('fournisseur') ?GETPOST('fournisseur') : $object->fournisseur; + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); } else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings'); } - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->state_id = GETPOST('state_id', 'int'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->state_id = GETPOST('state_id', 'int'); //$object->skype = GETPOST('skype', 'alpha'); //$object->twitter = GETPOST('twitter', 'alpha'); //$object->facebook = GETPOST('facebook', 'alpha'); //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); } } @@ -1008,30 +1008,30 @@ else $object->idprof4 = GETPOST('idprof4', 'alpha'); $object->idprof5 = GETPOST('idprof5', 'alpha'); $object->idprof6 = GETPOST('idprof6', 'alpha'); - $object->typent_id = GETPOST('typent_id', 'int'); + $object->typent_id = GETPOST('typent_id', 'int'); $object->effectif_id = GETPOST('effectif_id', 'int'); $object->civility_id = GETPOST('civility_id', 'alpha'); - $object->tva_assuj = GETPOST('assujtva_value', 'int'); - $object->status = GETPOST('status', 'int'); + $object->tva_assuj = GETPOST('assujtva_value', 'int'); + $object->status = GETPOST('status', 'int'); //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value', 'int'); $object->localtax2_assuj = GETPOST('localtax2assuj_value', 'int'); - $object->localtax1_value =GETPOST('lt1', 'int'); - $object->localtax2_value =GETPOST('lt2', 'int'); + $object->localtax1_value = GETPOST('lt1', 'int'); + $object->localtax2_value = GETPOST('lt2', 'int'); - $object->tva_intra = GETPOST('tva_intra', 'alpha'); + $object->tva_intra = GETPOST('tva_intra', 'alpha'); - $object->commercial_id = GETPOST('commercial_id', 'int'); - $object->default_lang = GETPOST('default_lang'); + $object->commercial_id = GETPOST('commercial_id', 'int'); + $object->default_lang = GETPOST('default_lang'); - $object->logo = (isset($_FILES['photo'])?dol_sanitizeFileName($_FILES['photo']['name']):''); + $object->logo = (isset($_FILES['photo']) ?dol_sanitizeFileName($_FILES['photo']['name']) : ''); // Gestion du logo de la société $dir = $conf->societe->multidir_output[$conf->entity]."/".$object->id."/logos"; - $file_OK = (isset($_FILES['photo'])?is_uploaded_file($_FILES['photo']['tmp_name']):false); + $file_OK = (isset($_FILES['photo']) ?is_uploaded_file($_FILES['photo']['tmp_name']) : false); if ($file_OK) { if (image_format_supported($_FILES['photo']['name'])) @@ -1040,10 +1040,10 @@ else if (@is_dir($dir)) { - $newfile=$dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); + $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); $result = dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1); - if (! $result > 0) + if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; } @@ -1057,20 +1057,20 @@ else } // We set country_id, country_code and country for the selected country - $object->country_id=GETPOST('country_id')?GETPOST('country_id'):$mysoc->country_id; + $object->country_id = GETPOST('country_id') ?GETPOST('country_id') : $mysoc->country_id; if ($object->country_id) { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code=$tmparray['code']; - $object->country=$tmparray['label']; + $tmparray = getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; } - $object->forme_juridique_code=GETPOST('forme_juridique_code'); + $object->forme_juridique_code = GETPOST('forme_juridique_code'); /* Show create form */ - $linkback=""; + $linkback = ""; print load_fiche_titre($langs->trans("NewThirdParty"), $linkback, 'building'); - if (! empty($conf->use_javascript_ajax) && ! empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) + if (!empty($conf->use_javascript_ajax) && !empty($conf->global->THIRDPARTY_SUGGEST_ALSO_ADDRESS_CREATION)) { print "\n".''; print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { - $s.='country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + $s .= 'country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } print $s; @@ -1435,30 +1435,30 @@ else // Local Taxes //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); + print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1 : 0), 1); print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); + print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2 : 0), 1); print ''; } - elseif($mysoc->localtax1_assuj=="1") + elseif ($mysoc->localtax1_assuj == "1") { print ''.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1:0), 1); + print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1 : 0), 1); print ''; } - elseif($mysoc->localtax2_assuj=="1") + elseif ($mysoc->localtax2_assuj == "1") { print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; - print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2)?$conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2:0), 1); + print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2 : 0), 1); print ''; } // Type - Size print ''.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''."\n"; - $sortparam=(empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. + $sortparam = (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT); // NONE means we keep sort of original array, so we sort on position. ASC, means next function will sort on label. print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, $sortparam); if ($user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; @@ -1485,10 +1485,10 @@ else print ' '; print ''.$langs->trans("Currency".$conf->currency).''; - if (! empty($conf->global->MAIN_MULTILANGS)) + if (!empty($conf->global->MAIN_MULTILANGS)) { print ''.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; - print $formadmin->select_language(GETPOST('default_lang', 'alpha')?GETPOST('default_lang', 'alpha'):($object->default_lang?$object->default_lang:''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print $formadmin->select_language(GETPOST('default_lang', 'alpha') ?GETPOST('default_lang', 'alpha') : ($object->default_lang ? $object->default_lang : ''), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); print ''; print ''; } @@ -1499,18 +1499,18 @@ else print ''; print ''.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; print ''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); print ''; } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { $langs->load('categories'); // Customer //if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print '' . $form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0) . ''; + print ''.$form->editfieldkey('CustomersProspectsCategoriesShort', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, 'parent', null, null, 1); print $form->multiselectarray('custcats', $cate_arbo, GETPOST('custcats', 'array'), null, null, null, null, "90%"); print ""; @@ -1518,7 +1518,7 @@ else // Supplier //if ($object->fournisseur) { - print '' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . ''; + print ''.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, 'parent', null, null, 1); print $form->multiselectarray('suppcats', $cate_arbo, GETPOST('suppcats', 'array'), null, null, null, null, "90%"); print ""; @@ -1526,7 +1526,7 @@ else } // Multicurrency - if (! empty($conf->multicurrency->enabled)) + if (!empty($conf->multicurrency->enabled)) { print ''; print ''.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''; @@ -1536,8 +1536,8 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -1550,7 +1550,7 @@ else print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); // Note: If user has no right to "see all thirdparties", we force selection of sale representative to him, so after creation he can see the record. - $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir)?array($user->id):array()))); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir) ? array($user->id) : array()))); print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%"); print ''; @@ -1568,7 +1568,7 @@ else print '
'; print ''; - if (! empty($backtopage)) + if (!empty($backtopage)) { print '     '; print ''; @@ -1576,7 +1576,7 @@ else else { print '     '; - print ''; + print ''; } print '
'."\n"; @@ -1588,21 +1588,21 @@ else if ($socid) { - $res=$object->fetch_optionals(); + $res = $object->fetch_optionals(); //if ($res < 0) { dol_print_error($db); exit; } $head = societe_prepare_head($object); // Load object modCodeTiers - $module=(! empty($conf->global->SOCIETE_CODECLIENT_ADDON)?$conf->global->SOCIETE_CODECLIENT_ADDON:'mod_codeclient_leopard'); + $module = (!empty($conf->global->SOCIETE_CODECLIENT_ADDON) ? $conf->global->SOCIETE_CODECLIENT_ADDON : 'mod_codeclient_leopard'); if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module)-4); + $module = substr($module, 0, dol_strlen($module) - 4); } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $modCodeClient = new $module($db); @@ -1611,15 +1611,15 @@ else { $prefixCustomerIsUsed = $modCodeClient->verif_prefixIsUsed(); } - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; if (substr($module, 0, 15) == 'mod_codeclient_' && substr($module, -3) == 'php') { - $module = substr($module, 0, dol_strlen($module)-4); + $module = substr($module, 0, dol_strlen($module) - 4); } - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $modCodeFournisseur = new $module($db); @@ -1634,25 +1634,25 @@ else if (GETPOSTISSET('name')) { // We overwrite with values if posted - $object->name = GETPOST('name', 'alpha'); + $object->name = GETPOST('name', 'alpha'); $object->prefix_comm = GETPOST('prefix_comm', 'alpha'); - $object->client = GETPOST('client', 'int'); + $object->client = GETPOST('client', 'int'); $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur', 'int'); - $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - $object->address = GETPOST('address', 'alpha'); - $object->zip = GETPOST('zipcode', 'alpha'); - $object->town = GETPOST('town', 'alpha'); - $object->country_id = GETPOST('country_id')?GETPOST('country_id', 'int'):$mysoc->country_id; - $object->state_id = GETPOST('state_id', 'int'); + $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); + $object->address = GETPOST('address', 'alpha'); + $object->zip = GETPOST('zipcode', 'alpha'); + $object->town = GETPOST('town', 'alpha'); + $object->country_id = GETPOST('country_id') ?GETPOST('country_id', 'int') : $mysoc->country_id; + $object->state_id = GETPOST('state_id', 'int'); //$object->skype = GETPOST('skype', 'alpha'); //$object->twitter = GETPOST('twitter', 'alpha'); //$object->facebook = GETPOST('facebook', 'alpha'); //$object->linkedin = GETPOST('linkedin', 'alpha'); $object->socialnetworks = array(); - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { - if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml')!='') { + if (GETPOSTISSET($key) && GETPOST($key, 'alphanohtml') != '') { $object->socialnetworks[$key] = GETPOST($key, 'alphanohtml'); } } @@ -1668,15 +1668,15 @@ else $object->idprof4 = GETPOST('idprof4', 'alpha'); $object->idprof5 = GETPOST('idprof5', 'alpha'); $object->idprof6 = GETPOST('idprof6', 'alpha'); - $object->typent_id = GETPOST('typent_id', 'int'); - $object->effectif_id = GETPOST('effectif_id', 'int'); + $object->typent_id = GETPOST('typent_id', 'int'); + $object->effectif_id = GETPOST('effectif_id', 'int'); $object->barcode = GETPOST('barcode', 'alpha'); - $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); - $object->default_lang = GETPOST('default_lang', 'alpha'); + $object->forme_juridique_code = GETPOST('forme_juridique_code', 'int'); + $object->default_lang = GETPOST('default_lang', 'alpha'); $object->tva_assuj = GETPOST('assujtva_value', 'int'); $object->tva_intra = GETPOST('tva_intra', 'alpha'); - $object->status = GETPOST('status', 'int'); + $object->status = GETPOST('status', 'int'); // Webservices url/key $object->webservices_url = GETPOST('webservices_url', 'custom', 0, FILTER_SANITIZE_URL); @@ -1685,32 +1685,32 @@ else //Incoterms if (!empty($conf->incoterm->enabled)) { - $object->fk_incoterms = GETPOST('incoterm_id', 'int'); - $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); + $object->fk_incoterms = GETPOST('incoterm_id', 'int'); + $object->location_incoterms = GETPOST('lcoation_incoterms', 'alpha'); } //Local Taxes $object->localtax1_assuj = GETPOST('localtax1assuj_value'); $object->localtax2_assuj = GETPOST('localtax2assuj_value'); - $object->localtax1_value =GETPOST('lt1'); - $object->localtax2_value =GETPOST('lt2'); + $object->localtax1_value = GETPOST('lt1'); + $object->localtax2_value = GETPOST('lt2'); // We set country_id, and country_code label of the chosen country if ($object->country_id > 0) { - $tmparray=getCountry($object->country_id, 'all'); - $object->country_code = $tmparray['code']; - $object->country = $tmparray['label']; + $tmparray = getCountry($object->country_id, 'all'); + $object->country_code = $tmparray['code']; + $object->country = $tmparray['label']; } } - if($object->localtax1_assuj==0){ - $sub=0; - }else{$sub=1;} - if($object->localtax2_assuj==0){ - $sub2=0; - }else{$sub2=1;} + if ($object->localtax1_assuj == 0) { + $sub = 0; + } else {$sub = 1; } + if ($object->localtax2_assuj == 0) { + $sub2 = 0; + } else {$sub2 = 1; } if ($conf->use_javascript_ajax) { @@ -1755,7 +1755,7 @@ else }); function init_customer_categ() { console.log("is customer or prospect = "+jQuery("#customerprospect").val()); - if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || '.(empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER)?'1':'0').')) + if (jQuery("#customerprospect").val() == 0 && (jQuery("#fournisseur").val() == 0 || '.(empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER) ? '1' : '0').')) { jQuery(".visibleifcustomer").hide(); } @@ -1804,7 +1804,7 @@ else print ''; // Ref/ID - if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) + if (!empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) { print ''; // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print ''; // Supplier - if ((! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) - || (! empty($conf->supplier_proposal->enabled) && ! empty($user->rights->supplier_proposal->lire))) + if ((!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) + || (!empty($conf->supplier_proposal->enabled) && !empty($user->rights->supplier_proposal->lire))) { print ''; print ''; print ''; print ''; // Address @@ -1936,14 +1936,14 @@ else // Country print ''; // State if (empty($conf->global->SOCIETE_DISABLE_STATE)) { - if(!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) + if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - print ''; + print ''; print ''; - print ''; + print ''; // EMail / Web - print ''; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; - if (! empty($conf->socialnetworks->enabled)) { + if (!empty($conf->socialnetworks->enabled)) { foreach ($socialnetworks as $key => $value) { if ($value['active']) { print ''; @@ -2011,18 +2011,18 @@ else // } // Prof ids - $i=1; $j=0; + $i = 1; $j = 0; while ($i <= 6) { - $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof!='-') + $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof != '-') { - $key='idprof'.$i; + $key = 'idprof'.$i; if (($j % 2) == 0) print ''; - $idprof_mandatory ='SOCIETE_IDPROF'.($i).'_MANDATORY'; - print ''; if (($j % 2) == 1) print ''; @@ -2039,11 +2039,11 @@ else // Local Taxes //TODO: Place into a function to control showing by country or study better option - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { print ''; } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { print ''; } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { print ''; print ''; print ''; // Default language - if (! empty($conf->global->MAIN_MULTILANGS)) + if (!empty($conf->global->MAIN_MULTILANGS)) { print ''; print ''; print ''; } // Categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { // Customer - print ''; + print ''; print '"; // Supplier - print ''; + print ''; print ''; print ''; @@ -2200,8 +2200,8 @@ else } // Other attributes - $parameters=array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array('colspan' => ' colspan="3"', 'colspanvalue' => '3'); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -2221,7 +2221,7 @@ else print ''; print ''; // Supplier - if (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)) + if (!empty($conf->fournisseur->enabled) || !empty($conf->supplier_proposal->enabled)) { print ''; print ''; @@ -2337,7 +2337,7 @@ else } // Supplier code - if (! empty($conf->fournisseur->enabled) && $object->fournisseur && ! empty($user->rights->fournisseur->lire)) + if (!empty($conf->fournisseur->enabled) && $object->fournisseur && !empty($user->rights->fournisseur->lire)) { print ''; print ''; print ''; - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { print ''; print ''; print ''; print ''; - if($action == 'editRE') + if ($action == 'editRE') { print ''; } - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { print ''; print ''; print ''; print ''; - if($action == 'editIRPF'){ + if ($action == 'editIRPF') { print ''; - }else{ + } else { print ''; } print ''; } } - elseif($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj!="1") + elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { print ''; - if($object->localtax1_assuj=="1" && (! isOnlyOneLocalTax(1))) + if ($object->localtax1_assuj == "1" && (!isOnlyOneLocalTax(1))) { print ''; print ''; print ''; print ''; - if($action == 'editRE'){ + if ($action == 'editRE') { print ''; - }else{ + } else { print ''; } print ''; } } - elseif($mysoc->localtax2_assuj=="1" && $mysoc->localtax1_assuj!="1") + elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { print ''; - if($object->localtax2_assuj=="1" && (! isOnlyOneLocalTax(2))) + if ($object->localtax2_assuj == "1" && (!isOnlyOneLocalTax(2))) { print ''; print ''; print ''; print ''; - if($action == 'editIRPF'){ + if ($action == 'editIRPF') { print ''; - }else{ + } else { print ''; } print ''; @@ -2492,18 +2492,18 @@ else print ''; print ''; @@ -2544,11 +2544,11 @@ else print '
'.$langs->trans("ID").''; print $object->ref; @@ -1820,7 +1820,7 @@ else print '
'.$form->editfieldkey('Prefix', 'prefix', '', $object, 0).''; // It does not change the prefix mode using the auto numbering prefix @@ -1846,9 +1846,9 @@ else print '
'; if ((!$object->code_client || $object->code_client == -1) && $modCodeClient->code_auto) { - $tmpcode=$object->code_client; - if (empty($tmpcode) && ! empty($object->oldcopy->code_client)) $tmpcode=$object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - if (empty($tmpcode) && ! empty($modCodeClient->code_auto)) $tmpcode=$modCodeClient->getNextValue($object, 0); + $tmpcode = $object->code_client; + if (empty($tmpcode) && !empty($object->oldcopy->code_client)) $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. + if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); print ''; } elseif ($object->codeclient_modifiable()) @@ -1861,34 +1861,34 @@ else print ''; } print ''; - $s=$modCodeClient->getToolTip($langs, $object, 0); + $s = $modCodeClient->getToolTip($langs, $object, 0); print $form->textwithpicto('', $s, 1); print '
'; print '
'.$form->editfieldkey('Supplier', 'fournisseur', '', $object, 0, 'string', '', 1).''; print $form->selectyesno("fournisseur", $object->fournisseur, 1); print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) { print $form->editfieldkey('SupplierCode', 'supplier_code', '', $object, 0); } print ''; - if (! empty($conf->fournisseur->enabled) && ! empty($user->rights->fournisseur->lire)) + if (!empty($conf->fournisseur->enabled) && !empty($user->rights->fournisseur->lire)) { print '
'; if ((!$object->code_fournisseur || $object->code_fournisseur == -1) && $modCodeFournisseur->code_auto) { - $tmpcode=$object->code_fournisseur; - if (empty($tmpcode) && ! empty($object->oldcopy->code_fournisseur)) $tmpcode=$object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. - if (empty($tmpcode) && ! empty($modCodeFournisseur->code_auto)) $tmpcode=$modCodeFournisseur->getNextValue($object, 1); + $tmpcode = $object->code_fournisseur; + if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. + if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); print ''; } elseif ($object->codefournisseur_modifiable()) @@ -1901,7 +1901,7 @@ else print ''; } print ''; - $s=$modCodeFournisseur->getToolTip($langs, $object, 1); + $s = $modCodeFournisseur->getToolTip($langs, $object, 1); print $form->textwithpicto('', $s, 1); print '
'; } @@ -1909,7 +1909,7 @@ else } // Barcode - if (! empty($conf->barcode->enabled)) + if (!empty($conf->barcode->enabled)) { print '
'.$form->editfieldkey('Gencod', 'barcode', '', $object, 0).''; @@ -1918,7 +1918,7 @@ else // Status print '
'.$form->editfieldkey('Status', 'status', '', $object, 0).''; - print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->status); + print $form->selectarray('status', array('0'=>$langs->trans('ActivityCeased'), '1'=>$langs->trans('InActivity')), $object->status); print '
'.$form->editfieldkey('Country', 'selectcounty_id', '', $object, 0).''; - print $form->select_country((GETPOST('country_id')!=''?GETPOST('country_id'):$object->country_id), 'country_id'); + print $form->select_country((GETPOST('country_id') != '' ?GETPOST('country_id') : $object->country_id), 'country_id'); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } @@ -1958,17 +1958,17 @@ else // Phone / Fax print '
'.img_picto('', 'object_phoning').' '.$form->editfieldkey('Phone', 'phone', GETPOST('phone', 'alpha'), $object, 0).''.img_picto('', 'object_phoning_fax').' '.$form->editfieldkey('Fax', 'fax', GETPOST('fax', 'alpha'), $object, 0).'
'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (! empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.img_picto('', 'object_email').' '.$form->editfieldkey('EMail', 'email', GETPOST('email', 'alpha'), $object, 0, 'string', '', (!empty($conf->global->SOCIETE_EMAIL_MANDATORY))).'
'.img_picto('', 'globe').' '.$form->editfieldkey('Web', 'url', GETPOST('url', 'alpha'), $object, 0).'
'.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', ! (empty($conf->global->$idprof_mandatory) || ! $object->isACompany())).''; + $idprof_mandatory = 'SOCIETE_IDPROF'.($i).'_MANDATORY'; + print ''.$form->editfieldkey($idprof, $key, '', $object, 0, 'string', '', !(empty($conf->global->$idprof_mandatory) || !$object->isACompany())).''; print $formcompany->get_input_id_prof($i, $key, $object->$key, $object->country_code); print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); - if(! isOnlyOneLocalTax(1)) + if (!isOnlyOneLocalTax(1)) { print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); @@ -2053,7 +2053,7 @@ else print ''.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); - if (! isOnlyOneLocalTax(2)) + if (!isOnlyOneLocalTax(2)) { print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); @@ -2061,11 +2061,11 @@ else } print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); - if(! isOnlyOneLocalTax(1)) + if (!isOnlyOneLocalTax(1)) { print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); @@ -2073,11 +2073,11 @@ else } print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); - if(! isOnlyOneLocalTax(2)) + if (!isOnlyOneLocalTax(2)) { print ' '.$langs->transcountry("Type", $mysoc->country_code).': '; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); @@ -2089,16 +2089,16 @@ else // VAT Code print '
'.$form->editfieldkey('VATIntra', 'intra_vat', '', $object, 0).''; - $s =''; + $s = ''; if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { - $s.='   '; + $s .= '   '; if ($conf->use_javascript_ajax) { $widthpopup = 600; - if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + if (!empty($conf->dol_use_jmobile)) $widthpopup = 350; $heightpopup = 400; print "\n"; print ''; print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { - $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } print $s; @@ -2121,7 +2121,7 @@ else // Type - Size print '
'.$form->editfieldkey('ThirdPartyType', 'typent_id', '', $object, 0).''; - print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + print $form->selectarray("typent_id", $formcompany->typent_array(0), $object->typent_id, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT) ? 'ASC' : $conf->global->SOCIETE_SORT_ON_TYPEENT)); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''.$form->editfieldkey('Staff', 'effectif_id', '', $object, 0).''; @@ -2141,7 +2141,7 @@ else print '"> '.$langs->trans("Currency".$conf->currency).'
'.$form->editfieldkey('DefaultLang', 'default_lang', '', $object, 0).''."\n"; print $formadmin->select_language($object->default_lang, 'default_lang', 0, 0, 1); @@ -2155,20 +2155,20 @@ else print '
'.$form->editfieldkey('IncotermLabel', 'incoterm_id', '', $object, 0).''; - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : '')); print '
' . $form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0) . '
'.$form->editfieldkey('CustomersCategoriesShort', 'custcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_CUSTOMER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_CUSTOMER); - $arrayselected=array(); + $arrayselected = array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } @@ -2176,12 +2176,12 @@ else print "
' . $form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0) . '
'.$form->editfieldkey('SuppliersCategoriesShort', 'suppcats', '', $object, 0).''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_SUPPLIER, null, null, null, null, 1); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_SUPPLIER); - $arrayselected=array(); + $arrayselected = array(); foreach ($cats as $cat) { $arrayselected[] = $cat->id; } @@ -2190,7 +2190,7 @@ else } // Multicurrency - if (! empty($conf->multicurrency->enabled)) + if (!empty($conf->multicurrency->enabled)) { print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).''.$form->editfieldkey('Logo', 'photoinput', '', $object, 0).''; if ($object->logo) print $form->showphoto('societe', $object); - $caneditfield=1; + $caneditfield = 1; if ($caneditfield) { if ($object->logo) print "
\n"; @@ -2264,7 +2264,7 @@ else * View */ - if (!empty($object->id)) $res=$object->fetch_optionals(); + if (!empty($object->id)) $res = $object->fetch_optionals(); //if ($res < 0) { dol_print_error($db); exit; } @@ -2292,11 +2292,11 @@ else print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id, $langs->trans("MergeThirdparties"), $langs->trans("ConfirmMergeThirdparties"), "confirm_merge", $formquestion, 'no', 1, 250); } - dol_htmloutput_mesg(is_numeric($error)?'':$error, $errors, 'error'); + dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error'); $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -2311,7 +2311,7 @@ else print '
'.$langs->trans('Supplier').''; print yn($object->fournisseur); @@ -2319,7 +2319,7 @@ else } // Prefix - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; print $langs->trans('SupplierCode').''; @@ -2348,7 +2348,7 @@ else } // Barcode - if (! empty($conf->barcode->enabled)) + if (!empty($conf->barcode->enabled)) { print '
'; print $langs->trans('Gencod').''.$object->barcode; @@ -2357,16 +2357,16 @@ else } // Prof ids - $i=1; $j=0; + $i = 1; $j = 0; while ($i <= 6) { - $idprof=$langs->transcountry('ProfId'.$i, $object->country_code); - if ($idprof!='-') + $idprof = $langs->transcountry('ProfId'.$i, $object->country_code); + if ($idprof != '-') { //if (($j % 2) == 0) print '
'.$idprof.''; - $key='idprof'.$i; + $key = 'idprof'.$i; print $object->$key; if ($object->$key) { @@ -2399,9 +2399,9 @@ else } // Local Taxes - if ($object->fournisseur || $mysoc->country_code=='ES') + if ($object->fournisseur || $mysoc->country_code == 'ES') { - if($mysoc->localtax1_assuj=="1" && $mysoc->localtax2_assuj=="1") + if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print yn($object->localtax1_assuj); @@ -2409,13 +2409,13 @@ else print yn($object->localtax2_assuj); print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); @@ -2427,59 +2427,59 @@ else } print '
'.$langs->transcountry("Localtax2", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); print ''.$object->localtax2_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print yn($object->localtax1_assuj); print '
'.$langs->transcountry("Localtax1", $mysoc->country_code).'id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print yn($object->localtax2_assuj); print '
'.$langs->transcountry("Localtax2", $mysoc->country_code).' id.'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).''; $formcompany->select_localtax(2, $object->localtax2_value, "lt2"); print ''.$object->localtax2_value.'
'.$langs->trans('VATIntra').''; if ($object->tva_intra) { - $s=''; - $s.=$object->tva_intra; - $s.=''; + $s = ''; + $s .= $object->tva_intra; + $s .= ''; if (empty($conf->global->MAIN_DISABLEVATCHECK) && isInEEC($object)) { - $s.='   '; + $s .= '   '; if ($conf->use_javascript_ajax) { $widthpopup = 600; - if (! empty($conf->dol_use_jmobile)) $widthpopup = 350; + if (!empty($conf->dol_use_jmobile)) $widthpopup = 350; $heightpopup = 400; print "\n"; print ''; print "\n"; - $s.=''.$langs->trans("VATIntraCheck").''; + $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } else { - $s.='country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; + $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } print $s; @@ -2531,7 +2531,7 @@ else // Type + Staff $arr = $formcompany->typent_array(1); - $object->typent= $arr[$object->typent_code]; + $object->typent = $arr[$object->typent_code]; print '
'.$langs->trans("ThirdPartyType").''.$object->typent.'
'.$langs->trans("Staff").''.$object->effectif.'
'; // Tags / categories - if (! empty($conf->categorie->enabled) && ! empty($user->rights->categorie->lire)) + if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { // Customer - if ($object->prospect || $object->client || (! $object->fournisseur && ! empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { - print ''; + if ($object->prospect || $object->client || (!$object->fournisseur && !empty($conf->global->THIRDPARTY_CAN_HAVE_CATEGORY_EVEN_IF_NOT_CUSTOMER_PROSPECT_SUPPLIER))) { + print ''; print '"; @@ -2556,7 +2556,7 @@ else // Supplier if ($object->fournisseur) { - print ''; + print ''; print '"; @@ -2573,14 +2573,14 @@ else print ''; // Default language - if (! empty($conf->global->MAIN_MULTILANGS)) + if (!empty($conf->global->MAIN_MULTILANGS)) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; } @@ -2603,13 +2603,13 @@ else } else { - print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?socid='.$object->id); + print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id); } print ''; } // Multicurrency - if (! empty($conf->multicurrency->enabled)) + if (!empty($conf->multicurrency->enabled)) { print ''; print ''; @@ -2619,8 +2619,8 @@ else } // Other attributes - $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $parameters = array('socid'=>$socid, 'colspan' => ' colspan="3"', 'colspanvalue' => '3'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; // Parent company if (empty($conf->global->SOCIETE_DISABLE_PARENTCOMPANY)) @@ -2648,16 +2648,16 @@ else include DOL_DOCUMENT_ROOT.'/societe/tpl/linesalesrepresentative.tpl.php'; // Module Adherent - if (! empty($conf->adherent->enabled)) + if (!empty($conf->adherent->enabled)) { $langs->load("members"); print ''; print ''; } @@ -827,18 +827,18 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($object->check_codeclient() <> 0) print ' ('.$langs->trans("WrongCustomerCode").')'; print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; - $resql=$db->query($sql); + $resql = $db->query($sql); if (!$resql) dol_print_error($db); $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; - $thirdTypeArray['customer']=$langs->trans("customer"); - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); + $thirdTypeArray['customer'] = $langs->trans("customer"); + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); + if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); - if (! empty($conf->stripe->enabled)) + if (!empty($conf->stripe->enabled)) { $permissiontowrite = $user->rights->societe->creer; // Stripe customer key 'cu_....' stored into llx_societe_account @@ -846,14 +846,14 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $form->editfieldkey("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); print ''; $sql = "SELECT count(*) as nb from ".MAIN_DB_PREFIX."facture where fk_soc = ".$socid; - $resql=$db->query($sql); + $resql = $db->query($sql); if (!$resql) dol_print_error($db); $obj = $db->fetch_object($resql); $nbFactsClient = $obj->nb; - $thirdTypeArray['customer']=$langs->trans("customer"); - if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal']=$langs->transnoentitiesnoconv('Proposals'); - if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order']=$langs->transnoentitiesnoconv('Orders'); - if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice']=$langs->transnoentitiesnoconv('Invoices'); - if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract']=$langs->transnoentitiesnoconv('Contracts'); + $thirdTypeArray['customer'] = $langs->trans("customer"); + if ($conf->propal->enabled && $user->rights->propal->lire) $elementTypeArray['propal'] = $langs->transnoentitiesnoconv('Proposals'); + if ($conf->commande->enabled && $user->rights->commande->lire) $elementTypeArray['order'] = $langs->transnoentitiesnoconv('Orders'); + if ($conf->facture->enabled && $user->rights->facture->lire) $elementTypeArray['invoice'] = $langs->transnoentitiesnoconv('Invoices'); + if ($conf->contrat->enabled && $user->rights->contrat->lire) $elementTypeArray['contract'] = $langs->transnoentitiesnoconv('Contracts'); } - if (! empty($conf->stripe->enabled) && ! empty($conf->stripeconnect->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2) + if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $conf->global->MAIN_FEATURES_LEVEL >= 2) { $permissiontowrite = $user->rights->societe->creer; - $stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here) + $stripesupplieracc = $stripe->getStripeAccount($service, $object->id); // Get Stripe OAuth connect account (no network access here) // Stripe customer key 'cu_....' stored into llx_societe_account print ''; print ''; // Hook fields - $parameters=array('arrayfields'=>array(),'param'=>'','sortfield'=>'','sortorder'=>'', 'linetype'=>'stripetitle'); - $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>array(), 'param'=>'', 'sortfield'=>'', 'sortorder'=>'', 'linetype'=>'stripetitle'); + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column print ""; @@ -1018,15 +1018,15 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $arrayofstripecard = array(); // Show local sources - if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { //$societeaccount = new SocieteAccount($db); $companypaymentmodetemp = new CompanyPaymentMode($db); - $sql='SELECT rowid FROM '.MAIN_DB_PREFIX."societe_rib"; - $sql.=" WHERE type in ('card')"; - $sql.=" AND fk_soc = ".$object->id; - $sql.=" AND status = ".$servicestatus; + $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX."societe_rib"; + $sql .= " WHERE type in ('card')"; + $sql .= " AND fk_soc = ".$object->id; + $sql .= " AND status = ".$servicestatus; $resql = $db->query($sql); if ($resql) @@ -1034,7 +1034,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $num_rows = $db->num_rows($resql); if ($num_rows) { - $i=0; + $i = 0; while ($i < $num_rows) { $nblocal++; @@ -1044,7 +1044,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $companypaymentmodetemp->fetch($obj->rowid); - $arrayofstripecard[$companypaymentmodetemp->stripe_card_ref]=$companypaymentmodetemp->stripe_card_ref; + $arrayofstripecard[$companypaymentmodetemp->stripe_card_ref] = $companypaymentmodetemp->stripe_card_ref; print ''; print ''; // Fields from hook - $parameters=array('arrayfields'=>array(), 'obj'=>$obj, 'linetype'=>'stripecard'); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>array(), 'obj'=>$obj, 'linetype'=>'stripecard'); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column print ''; // Local ID - if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { print ''; } // Src ID print ''; // Img of credit card print ''; print ''; // Fields from hook - $parameters=array('arrayfields'=>array(), 'stripesource'=>$src, 'linetype'=>'stripecardremoteonly'); - $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $parameters = array('arrayfields'=>array(), 'stripesource'=>$src, 'linetype'=>'stripecardremoteonly'); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column print ''; } print "
' . $langs->trans("CustomersCategoriesShort") . '
'.$langs->trans("CustomersCategoriesShort").''; print $form->showCategories($object->id, 'customer', 1); print "
' . $langs->trans("SuppliersCategoriesShort") . '
'.$langs->trans("SuppliersCategoriesShort").''; print $form->showCategories($object->id, 'supplier', 1); print "
'.$langs->trans("DefaultLang").''; //$s=picto_from_langcode($object->default_lang); //print ($s?$s.' ':''); $langs->load("languages"); - $labellang = ($object->default_lang?$langs->trans('Language_'.$object->default_lang):''); + $labellang = ($object->default_lang ? $langs->trans('Language_'.$object->default_lang) : ''); print $labellang; print '
'.$form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0).'
'.$langs->trans("LinkedToDolibarrMember").''; - $adh=new Adherent($db); - $result=$adh->fetch('', '', $object->id); + $adh = new Adherent($db); + $result = $adh->fetch('', '', $object->id); if ($result > 0) { - $adh->ref=$adh->getFullName($langs); + $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); } else @@ -2690,8 +2690,8 @@ else { print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $at_least_one_email_contact = false; @@ -2705,7 +2705,7 @@ else } } - if (! empty($object->email) || $at_least_one_email_contact) + if (!empty($object->email) || $at_least_one_email_contact) { $langs->load("mails"); print ''.$langs->trans('SendMail').''; @@ -2721,11 +2721,11 @@ else print ''.$langs->trans("Modify").''."\n"; } - if (! empty($conf->adherent->enabled)) + if (!empty($conf->adherent->enabled)) { $adh = new Adherent($db); - $result=$adh->fetch('', '', $object->id); - if ($result == 0 && ($object->client == 1 || $object->client == 3) && ! empty($conf->global->MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS)) + $result = $adh->fetch('', '', $object->id); + if ($result == 0 && ($object->client == 1 || $object->client == 3) && !empty($conf->global->MEMBER_CAN_CONVERT_CUSTOMERS_TO_MEMBERS)) { print ''.$langs->trans("NewMember").''; } @@ -2768,10 +2768,10 @@ else /* * Documents generes */ - $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; - $genallowed=$user->rights->societe->lire; - $delallowed=$user->rights->societe->creer; + $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed = $user->rights->societe->lire; + $delallowed = $user->rights->societe->creer; print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); } @@ -2779,7 +2779,7 @@ else // Subsidiaries list if (empty($conf->global->SOCIETE_DISABLE_SUBSIDIARIES)) { - $result=show_subsidiaries($conf, $langs, $db, $object); + $result = show_subsidiaries($conf, $langs, $db, $object); } print '
'; @@ -2789,31 +2789,31 @@ else $morehtmlright = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-list-alt', DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id); // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty + $somethingshown = $formactions->showactions($object, '', $socid, 1, '', $MAXEVENT, '', $morehtmlright); // Show all action for thirdparty print '
'; - if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) + if (!empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) { // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { - $result=show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + $result = show_contacts($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); } // Addresses list - if (! empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) + if (!empty($conf->global->SOCIETE_ADDRESSES_MANAGEMENT)) { - $result=show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); + $result = show_addresses($conf, $langs, $db, $object, $_SERVER["PHP_SELF"].'?socid='.$object->id); } } } // Presend form - $modelmail='thirdparty'; - $defaulttopic='Information'; + $modelmail = 'thirdparty'; + $defaulttopic = 'Information'; $diroutput = $conf->societe->dir_output; $trackid = 'thi'.$object->id; diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 027527d20d7..788fc45ee7e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -47,7 +47,7 @@ class Societe extends CommonObject /** * @var string ID to identify managed object */ - public $element='societe'; + public $element = 'societe'; /** * @var string Name of table without prefix where object is stored @@ -57,18 +57,18 @@ class Societe extends CommonObject /** * @var int Field with ID of parent key if this field has a parent */ - public $fk_element='fk_soc'; + public $fk_element = 'fk_soc'; - public $fieldsforcombobox='nom,name_alias'; + public $fieldsforcombobox = 'nom,name_alias'; /** * @var array List of child tables. To test if we can delete object. */ - protected $childtables=array("supplier_proposal"=>'SupplierProposal',"propal"=>'Proposal',"commande"=>'Order',"facture"=>'Invoice',"facture_rec"=>'RecurringInvoiceTemplate',"contrat"=>'Contract',"fichinter"=>'Fichinter',"facture_fourn"=>'SupplierInvoice',"commande_fournisseur"=>'SupplierOrder',"projet"=>'Project',"expedition"=>'Shipment',"prelevement_lignes"=>'DirectDebitRecord'); + protected $childtables = array("supplier_proposal"=>'SupplierProposal', "propal"=>'Proposal', "commande"=>'Order', "facture"=>'Invoice', "facture_rec"=>'RecurringInvoiceTemplate', "contrat"=>'Contract', "fichinter"=>'Fichinter', "facture_fourn"=>'SupplierInvoice', "commande_fournisseur"=>'SupplierOrder', "projet"=>'Project', "expedition"=>'Shipment', "prelevement_lignes"=>'DirectDebitRecord'); /** * @var array List of child tables. To know object to delete on cascade. */ - protected $childtablesoncascade=array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); + protected $childtablesoncascade = array("societe_prices", "societe_log", "societe_address", "product_fournisseur_price", "product_customer_price_log", "product_customer_price", "socpeople", "adherent", "societe_account", "societe_rib", "societe_remise", "societe_remise_except", "societe_commerciaux", "categorie", "notify", "notify_def", "actioncomm"); /** * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png @@ -92,20 +92,20 @@ class Societe extends CommonObject /** * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. */ - public $fields=array( - 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), - 'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), - 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), - 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), - 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), - 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), - 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + public $fields = array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'nom' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'name_alias' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), - 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), - 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), - 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000), ); @@ -147,7 +147,7 @@ class Societe extends CommonObject * Thirdparty status : 0=activity ceased, 1= in activity * @var int */ - public $status=1; + public $status = 1; /** * Id of department @@ -285,7 +285,7 @@ class Societe extends CommonObject public $prefix_comm; - public $tva_assuj=1; + public $tva_assuj = 1; /** * Intracommunitary VAT ID * @var string @@ -300,12 +300,12 @@ class Societe extends CommonObject public $managers; public $capital; - public $typent_id=0; + public $typent_id = 0; public $typent_code; public $effectif; - public $effectif_id=0; + public $effectif_id = 0; public $forme_juridique_code; - public $forme_juridique=0; + public $forme_juridique = 0; public $remise_percent; public $remise_supplier_percent; @@ -350,12 +350,12 @@ class Societe extends CommonObject * 0=no customer, 1=customer, 2=prospect, 3=customer and prospect * @var int */ - public $client=0; + public $client = 0; /** * 0=no prospect, 1=prospect * @var int */ - public $prospect=0; + public $prospect = 0; /** * 0=no supplier, 1=supplier * @var int @@ -501,7 +501,7 @@ class Societe extends CommonObject public $fk_incoterms; public $location_incoterms; - public $label_incoterms; //Used into tooltip + public $label_incoterms; //Used into tooltip // Multicurrency /** @@ -527,9 +527,9 @@ class Societe extends CommonObject $this->client = 0; $this->prospect = 0; $this->fournisseur = 0; - $this->typent_id = 0; - $this->effectif_id = 0; - $this->forme_juridique_code = 0; + $this->typent_id = 0; + $this->effectif_id = 0; + $this->forme_juridique_code = 0; $this->tva_assuj = 1; $this->status = 1; } @@ -544,17 +544,17 @@ class Societe extends CommonObject */ public function create(User $user) { - global $langs,$conf,$mysoc; + global $langs, $conf, $mysoc; - $error=0; + $error = 0; // Clean parameters - if (empty($this->status)) $this->status=0; - $this->name=$this->name?trim($this->name):trim($this->nom); - if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->name=ucwords($this->name); - $this->nom=$this->name; // For backward compatibility - if (empty($this->client)) $this->client=0; - if (empty($this->fournisseur)) $this->fournisseur=0; + if (empty($this->status)) $this->status = 0; + $this->name = $this->name ?trim($this->name) : trim($this->nom); + if (!empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->name = ucwords($this->name); + $this->nom = $this->name; // For backward compatibility + if (empty($this->client)) $this->client = 0; + if (empty($this->fournisseur)) $this->fournisseur = 0; $this->import_key = trim($this->import_key); if (!empty($this->multicurrency_code)) $this->fk_multicurrency = MultiCurrency::getIdFromCode($this->db, $this->multicurrency_code); @@ -566,7 +566,7 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::create ".$this->name); - $now=dol_now(); + $now = dol_now(); $this->db->begin(); @@ -580,24 +580,24 @@ class Societe extends CommonObject if ($result >= 0) { - $this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity); + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, name_alias, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, fk_incoterms, location_incoterms ,import_key, fk_multicurrency, multicurrency_code)"; - $sql.= " VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'"; - $sql.= ", ".(! empty($user->id) ? "'".$user->id."'":"null"); - $sql.= ", ".(! empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'":"null"); - $sql.= ", ".$this->status; - $sql.= ", ".(! empty($this->ref_int) ? "'".$this->db->escape($this->ref_int)."'":"null"); - $sql.= ", ".(! empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'":"null"); - $sql.= ", 0"; - $sql.= ", ".(int) $this->fk_incoterms; - $sql.= ", '".$this->db->escape($this->location_incoterms)."'"; - $sql.= ", ".(! empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'":"null"); - $sql.= ", ".(int) $this->fk_multicurrency; - $sql.= ", '".$this->db->escape($this->multicurrency_code)."')"; + $sql .= " VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$this->db->escape($this->entity).", '".$this->db->idate($now)."'"; + $sql .= ", ".(!empty($user->id) ? "'".$user->id."'" : "null"); + $sql .= ", ".(!empty($this->canvas) ? "'".$this->db->escape($this->canvas)."'" : "null"); + $sql .= ", ".$this->status; + $sql .= ", ".(!empty($this->ref_int) ? "'".$this->db->escape($this->ref_int)."'" : "null"); + $sql .= ", ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); + $sql .= ", 0"; + $sql .= ", ".(int) $this->fk_incoterms; + $sql .= ", '".$this->db->escape($this->location_incoterms)."'"; + $sql .= ", ".(!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : "null"); + $sql .= ", ".(int) $this->fk_multicurrency; + $sql .= ", '".$this->db->escape($this->multicurrency_code)."')"; dol_syslog(get_class($this)."::create", LOG_DEBUG); - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe"); @@ -618,13 +618,13 @@ class Societe extends CommonObject if ($ret >= 0) { // Call trigger - $result=$this->call_trigger('COMPANY_CREATE', $user); + $result = $this->call_trigger('COMPANY_CREATE', $user); if ($result < 0) $error++; // End call triggers } else $error++; - if (! $error) + if (!$error) { dol_syslog(get_class($this)."::Create success id=".$this->id); $this->db->commit(); @@ -641,13 +641,13 @@ class Societe extends CommonObject { if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { - $this->error=$langs->trans("ErrorCompanyNameAlreadyExists", $this->name); // duplicate on a field (code or profid or ...) - $result=-1; + $this->error = $langs->trans("ErrorCompanyNameAlreadyExists", $this->name); // duplicate on a field (code or profid or ...) + $result = -1; } else { - $this->error=$this->db->lasterror(); - $result=-2; + $this->error = $this->db->lasterror(); + $result = -2; } $this->db->rollback(); return $result; @@ -673,12 +673,12 @@ class Societe extends CommonObject { // phpcs:enable require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; - $contact=new Contact($this->db); + $contact = new Contact($this->db); $contact->name = $this->name_bis; $contact->firstname = $this->firstname; $contact->civility_id = $this->civility_id; - $contact->socid = $this->id; // fk_soc + $contact->socid = $this->id; // fk_soc $contact->statut = 1; $contact->priv = 0; $contact->country_id = $this->country_id; @@ -694,7 +694,7 @@ class Societe extends CommonObject { $this->error = $contact->error; $this->errors = $contact->errors; - dol_syslog(get_class($this)."::create_individual ERROR:" . $this->error, LOG_ERR); + dol_syslog(get_class($this)."::create_individual ERROR:".$this->error, LOG_ERR); } return $result; @@ -711,13 +711,13 @@ class Societe extends CommonObject global $conf, $langs, $mysoc; $error = 0; - $this->errors=array(); + $this->errors = array(); $result = 0; - $this->name = trim($this->name); - $this->nom=$this->name; // For backward compatibility + $this->name = trim($this->name); + $this->nom = $this->name; // For backward compatibility - if (! $this->name) + if (!$this->name) { $this->errors[] = 'ErrorBadThirdPartyName'; $result = -2; @@ -774,12 +774,12 @@ class Societe extends CommonObject } // Check for duplicate or mandatory fields defined into setup - $array_to_check=array('IDPROF1','IDPROF2','IDPROF3','IDPROF4','IDPROF5','IDPROF6','EMAIL'); - foreach($array_to_check as $key) + $array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL'); + foreach ($array_to_check as $key) { - $keymin=strtolower($key); - $i=(int) preg_replace('/[^0-9]/', '', $key); - $vallabel=$this->$keymin; + $keymin = strtolower($key); + $i = (int) preg_replace('/[^0-9]/', '', $key); + $vallabel = $this->$keymin; if ($i > 0) { @@ -788,8 +788,8 @@ class Societe extends CommonObject // Check for mandatory prof id (but only if country is same than ours) if ($mysoc->country_id > 0 && $this->country_id == $mysoc->country_id) { - $idprof_mandatory ='SOCIETE_'.$key.'_MANDATORY'; - if (! $vallabel && ! empty($conf->global->$idprof_mandatory)) + $idprof_mandatory = 'SOCIETE_'.$key.'_MANDATORY'; + if (!$vallabel && !empty($conf->global->$idprof_mandatory)) { $langs->load("errors"); $error++; @@ -799,7 +799,7 @@ class Societe extends CommonObject } // Check for unicity - if (! $error && $vallabel && $this->id_prof_verifiable($i)) + if (!$error && $vallabel && $this->id_prof_verifiable($i)) { if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { @@ -816,7 +816,7 @@ class Societe extends CommonObject if ($key == 'EMAIL') { // Check for mandatory - if (! empty($conf->global->SOCIETE_EMAIL_MANDATORY) && ! isValidEMail($this->email)) + if (!empty($conf->global->SOCIETE_EMAIL_MANDATORY) && !isValidEMail($this->email)) { $langs->load("errors"); $error++; @@ -824,7 +824,7 @@ class Societe extends CommonObject } // Check for unicity - if (! $error && $vallabel && ! empty($conf->global->SOCIETE_EMAIL_UNIQUE)) + if (!$error && $vallabel && !empty($conf->global->SOCIETE_EMAIL_UNIQUE)) { if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) { @@ -855,47 +855,47 @@ class Societe extends CommonObject */ public function update($id, $user = '', $call_trigger = 1, $allowmodcodeclient = 0, $allowmodcodefournisseur = 0, $action = 'update', $nosyncmember = 1) { - global $langs,$conf,$hookmanager; + global $langs, $conf, $hookmanager; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; if (empty($id)) $id = $this->id; - $error=0; + $error = 0; dol_syslog(get_class($this)."::Update id=".$id." call_trigger=".$call_trigger." allowmodcodeclient=".$allowmodcodeclient." allowmodcodefournisseur=".$allowmodcodefournisseur); - $now=dol_now(); + $now = dol_now(); // Clean parameters - $this->id = $id; - $this->entity = ((isset($this->entity) && is_numeric($this->entity))?$this->entity:$conf->entity); - $this->name = $this->name?trim($this->name):trim($this->nom); - $this->nom = $this->name; // For backward compatibility - $this->name_alias = trim($this->name_alias); + $this->id = $id; + $this->entity = ((isset($this->entity) && is_numeric($this->entity)) ? $this->entity : $conf->entity); + $this->name = $this->name ?trim($this->name) : trim($this->nom); + $this->nom = $this->name; // For backward compatibility + $this->name_alias = trim($this->name_alias); $this->ref_ext = trim($this->ref_ext); - $this->address = $this->address?trim($this->address):trim($this->address); - $this->zip = $this->zip?trim($this->zip):trim($this->zip); - $this->town = $this->town?trim($this->town):trim($this->town); - $this->state_id = trim($this->state_id); - $this->country_id = ($this->country_id > 0)?$this->country_id:0; + $this->address = $this->address ?trim($this->address) : trim($this->address); + $this->zip = $this->zip ?trim($this->zip) : trim($this->zip); + $this->town = $this->town ?trim($this->town) : trim($this->town); + $this->state_id = trim($this->state_id); + $this->country_id = ($this->country_id > 0) ? $this->country_id : 0; $this->phone = trim($this->phone); $this->phone = preg_replace("/\s/", "", $this->phone); $this->phone = preg_replace("/\./", "", $this->phone); $this->fax = trim($this->fax); $this->fax = preg_replace("/\s/", "", $this->fax); $this->fax = preg_replace("/\./", "", $this->fax); - $this->email = trim($this->email); - $this->url = $this->url?clean_url($this->url, 0):''; + $this->email = trim($this->email); + $this->url = $this->url ?clean_url($this->url, 0) : ''; $this->note_private = trim($this->note_private); $this->note_public = trim($this->note_public); $this->idprof1 = trim($this->idprof1); $this->idprof2 = trim($this->idprof2); $this->idprof3 = trim($this->idprof3); $this->idprof4 = trim($this->idprof4); - $this->idprof5 = (! empty($this->idprof5)?trim($this->idprof5):''); - $this->idprof6 = (! empty($this->idprof6)?trim($this->idprof6):''); - $this->prefix_comm = trim($this->prefix_comm); + $this->idprof5 = (!empty($this->idprof5) ?trim($this->idprof5) : ''); + $this->idprof6 = (!empty($this->idprof6) ?trim($this->idprof6) : ''); + $this->prefix_comm = trim($this->prefix_comm); $this->outstanding_limit = price2num($this->outstanding_limit); $this->order_min_amount = price2num($this->order_min_amount); $this->supplier_order_min_amount = price2num($this->supplier_order_min_amount); @@ -912,64 +912,64 @@ class Societe extends CommonObject } // Local taxes - $this->localtax1_assuj=trim($this->localtax1_assuj); - $this->localtax2_assuj=trim($this->localtax2_assuj); + $this->localtax1_assuj = trim($this->localtax1_assuj); + $this->localtax2_assuj = trim($this->localtax2_assuj); - $this->localtax1_value=trim($this->localtax1_value); - $this->localtax2_value=trim($this->localtax2_value); + $this->localtax1_value = trim($this->localtax1_value); + $this->localtax2_value = trim($this->localtax2_value); - if ($this->capital != '') $this->capital=price2num(trim($this->capital)); - if (! is_numeric($this->capital)) $this->capital = ''; // '' = undef + if ($this->capital != '') $this->capital = price2num(trim($this->capital)); + if (!is_numeric($this->capital)) $this->capital = ''; // '' = undef - $this->effectif_id=trim($this->effectif_id); - $this->forme_juridique_code=trim($this->forme_juridique_code); + $this->effectif_id = trim($this->effectif_id); + $this->forme_juridique_code = trim($this->forme_juridique_code); //Gencod - $this->barcode=trim($this->barcode); + $this->barcode = trim($this->barcode); // For automatic creation if ($this->code_client == -1 || $this->code_client === 'auto') $this->get_codeclient($this, 0); if ($this->code_fournisseur == -1 || $this->code_fournisseur === 'auto') $this->get_codefournisseur($this, 1); - $this->code_compta=trim($this->code_compta); - $this->code_compta_fournisseur=trim($this->code_compta_fournisseur); + $this->code_compta = trim($this->code_compta); + $this->code_compta_fournisseur = trim($this->code_compta_fournisseur); // Check parameters. More tests are done later in the ->verify() - if (! is_numeric($this->client) && ! is_numeric($this->fournisseur)) + if (!is_numeric($this->client) && !is_numeric($this->fournisseur)) { $langs->load("errors"); $this->error = $langs->trans("BadValueForParameterClientOrSupplier"); return -1; } - $customer=false; - if (! empty($allowmodcodeclient) && ! empty($this->client)) + $customer = false; + if (!empty($allowmodcodeclient) && !empty($this->client)) { // Attention get_codecompta peut modifier le code suivant le module utilise if (empty($this->code_compta)) { - $ret=$this->get_codecompta('customer'); + $ret = $this->get_codecompta('customer'); if ($ret < 0) return -1; } - $customer=true; + $customer = true; } - $supplier=false; - if (! empty($allowmodcodefournisseur) && ! empty($this->fournisseur)) + $supplier = false; + if (!empty($allowmodcodefournisseur) && !empty($this->fournisseur)) { // Attention get_codecompta peut modifier le code suivant le module utilise if ($this->code_compta_fournisseur == "") { - $ret=$this->get_codecompta('supplier'); + $ret = $this->get_codecompta('supplier'); if ($ret < 0) return -1; } - $supplier=true; + $supplier = true; } //Web services - $this->webservices_url = $this->webservices_url?clean_url($this->webservices_url, 0):''; + $this->webservices_url = $this->webservices_url ?clean_url($this->webservices_url, 0) : ''; $this->webservices_key = trim($this->webservices_key); //Incoterms @@ -993,11 +993,11 @@ class Societe extends CommonObject { if (in_array('ErrorBadCustomerCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_client == $this->code_client) { - if (($key = array_search('ErrorBadCustomerCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message + if (($key = array_search('ErrorBadCustomerCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message } if (in_array('ErrorBadSupplierCodeSyntax', $this->errors) && is_object($this->oldcopy) && $this->oldcopy->code_fournisseur == $this->code_fournisseur) { - if (($key = array_search('ErrorBadSupplierCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message + if (($key = array_search('ErrorBadSupplierCodeSyntax', $this->errors)) !== false) unset($this->errors[$key]); // Remove error message } if (empty($this->errors)) // If there is no more error, we can make like if there is no error at all { @@ -1011,117 +1011,117 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::update verify ok or not done"); $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; - $sql .= "entity = " . $this->db->escape($this->entity); - $sql .= ",nom = '" . $this->db->escape($this->name) ."'"; // Required - $sql .= ",name_alias = '" . $this->db->escape($this->name_alias) ."'"; - $sql .= ",ref_ext = " .(! empty($this->ref_ext)?"'".$this->db->escape($this->ref_ext) ."'":"null"); - $sql .= ",address = '" . $this->db->escape($this->address) ."'"; + $sql .= "entity = ".$this->db->escape($this->entity); + $sql .= ",nom = '".$this->db->escape($this->name)."'"; // Required + $sql .= ",name_alias = '".$this->db->escape($this->name_alias)."'"; + $sql .= ",ref_ext = ".(!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : "null"); + $sql .= ",address = '".$this->db->escape($this->address)."'"; - $sql .= ",zip = ".(! empty($this->zip)?"'".$this->db->escape($this->zip)."'":"null"); - $sql .= ",town = ".(! empty($this->town)?"'".$this->db->escape($this->town)."'":"null"); + $sql .= ",zip = ".(!empty($this->zip) ? "'".$this->db->escape($this->zip)."'" : "null"); + $sql .= ",town = ".(!empty($this->town) ? "'".$this->db->escape($this->town)."'" : "null"); - $sql .= ",fk_departement = '" . (! empty($this->state_id)?$this->state_id:'0') ."'"; - $sql .= ",fk_pays = '" . (! empty($this->country_id)?$this->country_id:'0') ."'"; + $sql .= ",fk_departement = '".(!empty($this->state_id) ? $this->state_id : '0')."'"; + $sql .= ",fk_pays = '".(!empty($this->country_id) ? $this->country_id : '0')."'"; - $sql .= ",phone = ".(! empty($this->phone)?"'".$this->db->escape($this->phone)."'":"null"); - $sql .= ",fax = ".(! empty($this->fax)?"'".$this->db->escape($this->fax)."'":"null"); - $sql .= ",email = ".(! empty($this->email)?"'".$this->db->escape($this->email)."'":"null"); + $sql .= ",phone = ".(!empty($this->phone) ? "'".$this->db->escape($this->phone)."'" : "null"); + $sql .= ",fax = ".(!empty($this->fax) ? "'".$this->db->escape($this->fax)."'" : "null"); + $sql .= ",email = ".(!empty($this->email) ? "'".$this->db->escape($this->email)."'" : "null"); $sql .= ", socialnetworks = '".$this->db->escape(json_encode($this->socialnetworks))."'"; - $sql .= ",url = ".(! empty($this->url)?"'".$this->db->escape($this->url)."'":"null"); + $sql .= ",url = ".(!empty($this->url) ? "'".$this->db->escape($this->url)."'" : "null"); - $sql .= ",parent = " . ($this->parent > 0 ? $this->parent : "null"); + $sql .= ",parent = ".($this->parent > 0 ? $this->parent : "null"); - $sql .= ",note_private = ".(! empty($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); - $sql .= ",note_public = ".(! empty($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null"); + $sql .= ",note_private = ".(!empty($this->note_private) ? "'".$this->db->escape($this->note_private)."'" : "null"); + $sql .= ",note_public = ".(!empty($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null"); - $sql .= ",siren = '". $this->db->escape($this->idprof1) ."'"; - $sql .= ",siret = '". $this->db->escape($this->idprof2) ."'"; - $sql .= ",ape = '". $this->db->escape($this->idprof3) ."'"; - $sql .= ",idprof4 = '". $this->db->escape($this->idprof4) ."'"; - $sql .= ",idprof5 = '". $this->db->escape($this->idprof5) ."'"; - $sql .= ",idprof6 = '". $this->db->escape($this->idprof6) ."'"; + $sql .= ",siren = '".$this->db->escape($this->idprof1)."'"; + $sql .= ",siret = '".$this->db->escape($this->idprof2)."'"; + $sql .= ",ape = '".$this->db->escape($this->idprof3)."'"; + $sql .= ",idprof4 = '".$this->db->escape($this->idprof4)."'"; + $sql .= ",idprof5 = '".$this->db->escape($this->idprof5)."'"; + $sql .= ",idprof6 = '".$this->db->escape($this->idprof6)."'"; - $sql .= ",tva_assuj = ".($this->tva_assuj!=''?"'".$this->db->escape($this->tva_assuj)."'":"null"); - $sql .= ",tva_intra = '" . $this->db->escape($this->tva_intra) ."'"; - $sql .= ",status = " .$this->status; + $sql .= ",tva_assuj = ".($this->tva_assuj != '' ? "'".$this->db->escape($this->tva_assuj)."'" : "null"); + $sql .= ",tva_intra = '".$this->db->escape($this->tva_intra)."'"; + $sql .= ",status = ".$this->status; // Local taxes - $sql .= ",localtax1_assuj = ".($this->localtax1_assuj!=''?"'".$this->db->escape($this->localtax1_assuj)."'":"null"); - $sql .= ",localtax2_assuj = ".($this->localtax2_assuj!=''?"'".$this->db->escape($this->localtax2_assuj)."'":"null"); - if($this->localtax1_assuj==1) + $sql .= ",localtax1_assuj = ".($this->localtax1_assuj != '' ? "'".$this->db->escape($this->localtax1_assuj)."'" : "null"); + $sql .= ",localtax2_assuj = ".($this->localtax2_assuj != '' ? "'".$this->db->escape($this->localtax2_assuj)."'" : "null"); + if ($this->localtax1_assuj == 1) { - if($this->localtax1_value!='') + if ($this->localtax1_value != '') { - $sql .=",localtax1_value =".$this->localtax1_value; + $sql .= ",localtax1_value =".$this->localtax1_value; } - else $sql .=",localtax1_value =0.000"; + else $sql .= ",localtax1_value =0.000"; } - else $sql .=",localtax1_value =0.000"; + else $sql .= ",localtax1_value =0.000"; - if($this->localtax2_assuj==1) + if ($this->localtax2_assuj == 1) { - if($this->localtax2_value!='') + if ($this->localtax2_value != '') { - $sql .=",localtax2_value =".$this->localtax2_value; + $sql .= ",localtax2_value =".$this->localtax2_value; } - else $sql .=",localtax2_value =0.000"; + else $sql .= ",localtax2_value =0.000"; } - else $sql .=",localtax2_value =0.000"; + else $sql .= ",localtax2_value =0.000"; $sql .= ",capital = ".($this->capital == '' ? "null" : $this->capital); - $sql .= ",prefix_comm = ".(! empty($this->prefix_comm)?"'".$this->db->escape($this->prefix_comm)."'":"null"); + $sql .= ",prefix_comm = ".(!empty($this->prefix_comm) ? "'".$this->db->escape($this->prefix_comm)."'" : "null"); - $sql .= ",fk_effectif = ".(! empty($this->effectif_id)?"'".$this->db->escape($this->effectif_id)."'":"null"); + $sql .= ",fk_effectif = ".(!empty($this->effectif_id) ? "'".$this->db->escape($this->effectif_id)."'" : "null"); if (isset($this->stcomm_id)) { - $sql .= ",fk_stcomm=".(!empty($this->stcomm_id) ? $this->stcomm_id : "0"); + $sql .= ",fk_stcomm=".(!empty($this->stcomm_id) ? $this->stcomm_id : "0"); } - $sql .= ",fk_typent = ".(! empty($this->typent_id)?"'".$this->db->escape($this->typent_id)."'":"0"); + $sql .= ",fk_typent = ".(!empty($this->typent_id) ? "'".$this->db->escape($this->typent_id)."'" : "0"); - $sql .= ",fk_forme_juridique = ".(! empty($this->forme_juridique_code)?"'".$this->db->escape($this->forme_juridique_code)."'":"null"); + $sql .= ",fk_forme_juridique = ".(!empty($this->forme_juridique_code) ? "'".$this->db->escape($this->forme_juridique_code)."'" : "null"); - $sql .= ",mode_reglement = ".(! empty($this->mode_reglement_id)?"'".$this->db->escape($this->mode_reglement_id)."'":"null"); - $sql .= ",cond_reglement = ".(! empty($this->cond_reglement_id)?"'".$this->db->escape($this->cond_reglement_id)."'":"null"); - $sql .= ",mode_reglement_supplier = ".(! empty($this->mode_reglement_supplier_id)?"'".$this->db->escape($this->mode_reglement_supplier_id)."'":"null"); - $sql .= ",cond_reglement_supplier = ".(! empty($this->cond_reglement_supplier_id)?"'".$this->db->escape($this->cond_reglement_supplier_id)."'":"null"); - $sql .= ",fk_shipping_method = ".(! empty($this->shipping_method_id)?"'".$this->db->escape($this->shipping_method_id)."'":"null"); + $sql .= ",mode_reglement = ".(!empty($this->mode_reglement_id) ? "'".$this->db->escape($this->mode_reglement_id)."'" : "null"); + $sql .= ",cond_reglement = ".(!empty($this->cond_reglement_id) ? "'".$this->db->escape($this->cond_reglement_id)."'" : "null"); + $sql .= ",mode_reglement_supplier = ".(!empty($this->mode_reglement_supplier_id) ? "'".$this->db->escape($this->mode_reglement_supplier_id)."'" : "null"); + $sql .= ",cond_reglement_supplier = ".(!empty($this->cond_reglement_supplier_id) ? "'".$this->db->escape($this->cond_reglement_supplier_id)."'" : "null"); + $sql .= ",fk_shipping_method = ".(!empty($this->shipping_method_id) ? "'".$this->db->escape($this->shipping_method_id)."'" : "null"); - $sql .= ",client = " . (! empty($this->client)?$this->client:0); - $sql .= ",fournisseur = " . (! empty($this->fournisseur)?$this->fournisseur:0); - $sql .= ",barcode = ".(! empty($this->barcode)?"'".$this->db->escape($this->barcode)."'":"null"); - $sql .= ",default_lang = ".(! empty($this->default_lang)?"'".$this->db->escape($this->default_lang)."'":"null"); - $sql .= ",logo = ".(! empty($this->logo)?"'".$this->db->escape($this->logo)."'":"null"); - $sql .= ",logo_squarred = ".(! empty($this->logo_squarred)?"'".$this->db->escape($this->logo_squarred)."'":"null"); - $sql .= ",outstanding_limit= ".($this->outstanding_limit!=''?$this->outstanding_limit:'null'); - $sql .= ",order_min_amount= ".($this->order_min_amount!=''?$this->order_min_amount:'null'); - $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount!=''?$this->supplier_order_min_amount:'null'); + $sql .= ",client = ".(!empty($this->client) ? $this->client : 0); + $sql .= ",fournisseur = ".(!empty($this->fournisseur) ? $this->fournisseur : 0); + $sql .= ",barcode = ".(!empty($this->barcode) ? "'".$this->db->escape($this->barcode)."'" : "null"); + $sql .= ",default_lang = ".(!empty($this->default_lang) ? "'".$this->db->escape($this->default_lang)."'" : "null"); + $sql .= ",logo = ".(!empty($this->logo) ? "'".$this->db->escape($this->logo)."'" : "null"); + $sql .= ",logo_squarred = ".(!empty($this->logo_squarred) ? "'".$this->db->escape($this->logo_squarred)."'" : "null"); + $sql .= ",outstanding_limit= ".($this->outstanding_limit != '' ? $this->outstanding_limit : 'null'); + $sql .= ",order_min_amount= ".($this->order_min_amount != '' ? $this->order_min_amount : 'null'); + $sql .= ",supplier_order_min_amount= ".($this->supplier_order_min_amount != '' ? $this->supplier_order_min_amount : 'null'); $sql .= ",fk_prospectlevel='".$this->db->escape($this->fk_prospectlevel)."'"; - $sql .= ",webservices_url = ".(! empty($this->webservices_url)?"'".$this->db->escape($this->webservices_url)."'":"null"); - $sql .= ",webservices_key = ".(! empty($this->webservices_key)?"'".$this->db->escape($this->webservices_key)."'":"null"); + $sql .= ",webservices_url = ".(!empty($this->webservices_url) ? "'".$this->db->escape($this->webservices_url)."'" : "null"); + $sql .= ",webservices_key = ".(!empty($this->webservices_key) ? "'".$this->db->escape($this->webservices_key)."'" : "null"); //Incoterms - $sql.= ", fk_incoterms = ".$this->fk_incoterms; - $sql.= ", location_incoterms = ".(! empty($this->location_incoterms)?"'".$this->db->escape($this->location_incoterms)."'":"null"); + $sql .= ", fk_incoterms = ".$this->fk_incoterms; + $sql .= ", location_incoterms = ".(!empty($this->location_incoterms) ? "'".$this->db->escape($this->location_incoterms)."'" : "null"); if ($customer) { - $sql .= ", code_client = ".(! empty($this->code_client)?"'".$this->db->escape($this->code_client)."'":"null"); - $sql .= ", code_compta = ".(! empty($this->code_compta)?"'".$this->db->escape($this->code_compta)."'":"null"); + $sql .= ", code_client = ".(!empty($this->code_client) ? "'".$this->db->escape($this->code_client)."'" : "null"); + $sql .= ", code_compta = ".(!empty($this->code_compta) ? "'".$this->db->escape($this->code_compta)."'" : "null"); } if ($supplier) { - $sql .= ", code_fournisseur = ".(! empty($this->code_fournisseur)?"'".$this->db->escape($this->code_fournisseur)."'":"null"); - $sql .= ", code_compta_fournisseur = ".(($this->code_compta_fournisseur != "")?"'".$this->db->escape($this->code_compta_fournisseur)."'":"null"); + $sql .= ", code_fournisseur = ".(!empty($this->code_fournisseur) ? "'".$this->db->escape($this->code_fournisseur)."'" : "null"); + $sql .= ", code_compta_fournisseur = ".(($this->code_compta_fournisseur != "") ? "'".$this->db->escape($this->code_compta_fournisseur)."'" : "null"); } - $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id:"null"); + $sql .= ", fk_user_modif = ".($user->id > 0 ? $user->id : "null"); $sql .= ", fk_multicurrency = ".(int) $this->fk_multicurrency; $sql .= ", multicurrency_code = '".$this->db->escape($this->multicurrency_code)."'"; - $sql .= " WHERE rowid = " . (int) $id; + $sql .= " WHERE rowid = ".(int) $id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { if (is_object($this->oldcopy)) // If we have information on old values @@ -1139,7 +1139,7 @@ class Societe extends CommonObject } else { - unset($this->country_code); // We clean this, in the doubt, because it may have been changed after an update of country_id + unset($this->country_code); // We clean this, in the doubt, because it may have been changed after an update of country_id unset($this->country); unset($this->state_code); unset($this->state); @@ -1147,33 +1147,33 @@ class Societe extends CommonObject $nbrowsaffected = $this->db->affected_rows($resql); - if (! $error && $nbrowsaffected) + if (!$error && $nbrowsaffected) { // Update information on linked member if it is an update - if (! $nosyncmember && ! empty($conf->adherent->enabled)) + if (!$nosyncmember && !empty($conf->adherent->enabled)) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; dol_syslog(get_class($this)."::update update linked member"); - $lmember=new Adherent($this->db); - $result=$lmember->fetch(0, 0, $this->id); + $lmember = new Adherent($this->db); + $result = $lmember->fetch(0, 0, $this->id); if ($result > 0) { - $lmember->company=$this->name; + $lmember->company = $this->name; //$lmember->firstname=$this->firstname?$this->firstname:$lmember->firstname; // We keep firstname and lastname of member unchanged //$lmember->lastname=$this->lastname?$this->lastname:$lmember->lastname; // We keep firstname and lastname of member unchanged - $lmember->address=$this->address; - $lmember->zip=$this->zip; - $lmember->town=$this->town; - $lmember->email=$this->email; - $lmember->socialnetworks=$this->socialnetworks; - $lmember->phone=$this->phone; - $lmember->state_id=$this->state_id; - $lmember->country_id=$this->country_id; + $lmember->address = $this->address; + $lmember->zip = $this->zip; + $lmember->town = $this->town; + $lmember->email = $this->email; + $lmember->socialnetworks = $this->socialnetworks; + $lmember->phone = $this->phone; + $lmember->state_id = $this->state_id; + $lmember->country_id = $this->country_id; - $result=$lmember->update($user, 0, 1, 1, 1); // Use nosync to 1 to avoid cyclic updates + $result = $lmember->update($user, 0, 1, 1, 1); // Use nosync to 1 to avoid cyclic updates if ($result < 0) { $this->error = $lmember->error; @@ -1184,33 +1184,33 @@ class Societe extends CommonObject } elseif ($result < 0) { - $this->error=$lmember->error; + $this->error = $lmember->error; $error++; } } } - $action='update'; + $action = 'update'; // Actions on extra fields - if (! $error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used + if (!$error && empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { - $result=$this->insertExtraFields(); + $result = $this->insertExtraFields(); if ($result < 0) { $error++; } } - if (! $error && $call_trigger) + if (!$error && $call_trigger) { // Call trigger - $result=$this->call_trigger('COMPANY_MODIFY', $user); + $result = $this->call_trigger('COMPANY_MODIFY', $user); if ($result < 0) $error++; // End call triggers } - if (! $error) + if (!$error) { dol_syslog(get_class($this)."::Update success"); $this->db->commit(); @@ -1323,13 +1323,13 @@ class Societe extends CommonObject if ($idprof6) $sql .= " AND s.idprof6 = '".$this->db->escape($idprof6)."'"; if ($email) $sql .= " AND s.email = '".$this->db->escape($email)."'"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $num=$this->db->num_rows($resql); + $num = $this->db->num_rows($resql); if ($num > 1) { - $this->error='Fetch found several records. Rename one of thirdparties to avoid duplicate.'; + $this->error = 'Fetch found several records. Rename one of thirdparties to avoid duplicate.'; dol_syslog($this->error, LOG_ERR); $result = -2; } @@ -1339,11 +1339,11 @@ class Societe extends CommonObject $this->id = $obj->rowid; $this->entity = $obj->entity; - $this->canvas = $obj->canvas; + $this->canvas = $obj->canvas; $this->ref = $obj->rowid; - $this->name = $obj->name; - $this->nom = $obj->name; // deprecated + $this->name = $obj->name; + $this->nom = $obj->name; // deprecated $this->name_alias = $obj->name_alias; $this->ref_ext = $obj->ref_ext; $this->ref_int = $obj->ref_int; @@ -1353,22 +1353,22 @@ class Societe extends CommonObject $this->user_creation = $obj->fk_user_creat; $this->user_modification = $obj->fk_user_modif; - $this->address = $obj->address; + $this->address = $obj->address; $this->zip = $obj->zip; $this->town = $obj->town; $this->country_id = $obj->country_id; - $this->country_code = $obj->country_id?$obj->country_code:''; - $this->country = $obj->country_id?($langs->transnoentities('Country'.$obj->country_code)!='Country'.$obj->country_code?$langs->transnoentities('Country'.$obj->country_code):$obj->country):''; + $this->country_code = $obj->country_id ? $obj->country_code : ''; + $this->country = $obj->country_id ? ($langs->transnoentities('Country'.$obj->country_code) != 'Country'.$obj->country_code ? $langs->transnoentities('Country'.$obj->country_code) : $obj->country) : ''; $this->state_id = $obj->state_id; $this->state_code = $obj->state_code; - $this->state = ($obj->state!='-'?$obj->state:''); + $this->state = ($obj->state != '-' ? $obj->state : ''); - $transcode=$langs->trans('StatusProspect'.$obj->fk_stcomm); - $label = ($transcode!='StatusProspect'.$obj->fk_stcomm ? $transcode : $obj->stcomm); - $this->stcomm_id = $obj->fk_stcomm; // id status prospect - $this->status_prospect_label = $label; // label status prospect + $transcode = $langs->trans('StatusProspect'.$obj->fk_stcomm); + $label = ($transcode != 'StatusProspect'.$obj->fk_stcomm ? $transcode : $obj->stcomm); + $this->stcomm_id = $obj->fk_stcomm; // id status prospect + $this->status_prospect_label = $label; // label status prospect $this->email = $obj->email; $this->socialnetworks = (array) json_decode($obj->socialnetworks, true); @@ -1377,7 +1377,7 @@ class Societe extends CommonObject $this->phone = $obj->phone; $this->fax = $obj->fax; - $this->parent = $obj->parent; + $this->parent = $obj->parent; $this->idprof1 = $obj->idprof1; $this->idprof2 = $obj->idprof2; @@ -1386,7 +1386,7 @@ class Societe extends CommonObject $this->idprof5 = $obj->idprof5; $this->idprof6 = $obj->idprof6; - $this->capital = $obj->capital; + $this->capital = $obj->capital; $this->code_client = $obj->code_client; $this->code_fournisseur = $obj->code_fournisseur; @@ -1411,23 +1411,23 @@ class Societe extends CommonObject $this->typent_code = $obj->typent_code; $this->effectif_id = $obj->effectif_id; - $this->effectif = $obj->effectif_id?$obj->effectif:''; + $this->effectif = $obj->effectif_id ? $obj->effectif : ''; - $this->forme_juridique_code= $obj->forme_juridique_code; - $this->forme_juridique = $obj->forme_juridique_code?$obj->forme_juridique:''; + $this->forme_juridique_code = $obj->forme_juridique_code; + $this->forme_juridique = $obj->forme_juridique_code ? $obj->forme_juridique : ''; $this->fk_prospectlevel = $obj->fk_prospectlevel; $this->prefix_comm = $obj->prefix_comm; - $this->remise_percent = price2num($obj->remise_client); // 0.000000 must be 0 - $this->remise_supplier_percent = $obj->remise_supplier; + $this->remise_percent = price2num($obj->remise_client); // 0.000000 must be 0 + $this->remise_supplier_percent = $obj->remise_supplier; $this->mode_reglement_id = $obj->mode_reglement; $this->cond_reglement_id = $obj->cond_reglement; $this->mode_reglement_supplier_id = $obj->mode_reglement_supplier; $this->cond_reglement_supplier_id = $obj->cond_reglement_supplier; - $this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null; - $this->fk_account = $obj->fk_account; + $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; + $this->fk_account = $obj->fk_account; $this->client = $obj->client; $this->fournisseur = $obj->fournisseur; @@ -1445,7 +1445,7 @@ class Societe extends CommonObject $this->outstanding_limit = $obj->outstanding_limit; $this->order_min_amount = $obj->order_min_amount; - $this->supplier_order_min_amount = $obj->supplier_order_min_amount; + $this->supplier_order_min_amount = $obj->supplier_order_min_amount; // multiprix $this->price_level = $obj->price_level; @@ -1475,12 +1475,12 @@ class Societe extends CommonObject } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); $result = -3; } // Use first price level if level not defined for third party - if ((! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && empty($this->price_level)) $this->price_level=1; + if ((!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && empty($this->price_level)) $this->price_level = 1; return $result; } @@ -1497,11 +1497,11 @@ class Societe extends CommonObject { global $langs, $conf, $user; - if (empty($fuser)) $fuser=$user; + if (empty($fuser)) $fuser = $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $entity=isset($this->entity)?$this->entity:$conf->entity; + $entity = isset($this->entity) ? $this->entity : $conf->entity; dol_syslog(get_class($this)."::delete", LOG_DEBUG); $error = 0; @@ -1513,15 +1513,15 @@ class Societe extends CommonObject $this->db->begin(); // User is mandatory for trigger call - if (! $error && $call_trigger) + if (!$error && $call_trigger) { // Call trigger - $result=$this->call_trigger('COMPANY_DELETE', $fuser); + $result = $this->call_trigger('COMPANY_DELETE', $fuser); if ($result < 0) $error++; // End call triggers } - if (! $error) + if (!$error) { require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $static_cat = new Categorie($this->db); @@ -1549,11 +1549,11 @@ class Societe extends CommonObject foreach ($this->childtablesoncascade as $tabletodelete) { - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX.$tabletodelete; - $sql.= " WHERE fk_soc = " . $id; - if (! $this->db->query($sql)) + $sql .= " WHERE fk_soc = ".$id; + if (!$this->db->query($sql)) { $error++; $this->errors[] = $this->db->lasterror(); @@ -1562,9 +1562,9 @@ class Societe extends CommonObject } // Removed extrafields - if ((! $error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used + if ((!$error) && (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used { - $result=$this->deleteExtraFields(); + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; @@ -1573,12 +1573,12 @@ class Societe extends CommonObject } // Remove links to subsidiaries companies - if (! $error) + if (!$error) { $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; - $sql.= " SET parent = NULL"; - $sql.= " WHERE parent = " . $id; - if (! $this->db->query($sql)) + $sql .= " SET parent = NULL"; + $sql .= " WHERE parent = ".$id; + if (!$this->db->query($sql)) { $error++; $this->errors[] = $this->db->lasterror(); @@ -1586,25 +1586,25 @@ class Societe extends CommonObject } // Remove third party - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe"; - $sql.= " WHERE rowid = " . $id; - if (! $this->db->query($sql)) + $sql .= " WHERE rowid = ".$id; + if (!$this->db->query($sql)) { $error++; $this->errors[] = $this->db->lasterror(); } } - if (! $error) + if (!$error) { $this->db->commit(); // Delete directory - if (! empty($conf->societe->multidir_output[$entity])) + if (!empty($conf->societe->multidir_output[$entity])) { - $docdir = $conf->societe->multidir_output[$entity] . "/" . $id; + $docdir = $conf->societe->multidir_output[$entity]."/".$id; if (dol_is_dir($docdir)) { dol_delete_dir_recursive($docdir); @@ -1635,13 +1635,13 @@ class Societe extends CommonObject // phpcs:enable if ($this->id) { - $newclient=1; - if ($this->client == 2 || $this->client == 3) $newclient=3; //If prospect, we keep prospect tag + $newclient = 1; + if ($this->client == 2 || $this->client == 3) $newclient = 3; //If prospect, we keep prospect tag $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; - $sql.= " SET client = ".$newclient; - $sql.= " WHERE rowid = " . $this->id; + $sql .= " SET client = ".$newclient; + $sql .= " WHERE rowid = ".$this->id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->client = $newclient; @@ -1667,10 +1667,10 @@ class Societe extends CommonObject global $conf, $langs; // Parameter cleaning - $note=trim($note); - if (! $note) + $note = trim($note); + if (!$note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } @@ -1680,33 +1680,33 @@ class Societe extends CommonObject { $this->db->begin(); - $now=dol_now(); + $now = dol_now(); // Position current discount $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; - $sql.= " SET remise_client = '".$this->db->escape($remise)."'"; - $sql.= " WHERE rowid = " . $this->id; - $resql=$this->db->query($sql); - if (! $resql) + $sql .= " SET remise_client = '".$this->db->escape($remise)."'"; + $sql .= " WHERE rowid = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise"; - $sql.= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; - $sql.= " '".$this->db->escape($note)."',"; - $sql.= " ".$user->id; - $sql.= ")"; + $sql .= " (entity, datec, fk_soc, remise_client, note, fk_user_author)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; + $sql .= " '".$this->db->escape($note)."',"; + $sql .= " ".$user->id; + $sql .= ")"; - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { $this->db->rollback(); - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } @@ -1730,10 +1730,10 @@ class Societe extends CommonObject global $conf, $langs; // Parameter cleaning - $note=trim($note); - if (! $note) + $note = trim($note); + if (!$note) { - $this->error=$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); + $this->error = $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NoteReason")); return -2; } @@ -1743,33 +1743,33 @@ class Societe extends CommonObject { $this->db->begin(); - $now=dol_now(); + $now = dol_now(); // Position current discount $sql = "UPDATE ".MAIN_DB_PREFIX."societe "; - $sql.= " SET remise_supplier = '".$this->db->escape($remise)."'"; - $sql.= " WHERE rowid = " . $this->id; - $resql=$this->db->query($sql); - if (! $resql) + $sql .= " SET remise_supplier = '".$this->db->escape($remise)."'"; + $sql .= " WHERE rowid = ".$this->id; + $resql = $this->db->query($sql); + if (!$resql) { $this->db->rollback(); - $this->error=$this->db->error(); + $this->error = $this->db->error(); return -1; } // Writes trace in discount history $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_supplier"; - $sql.= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; - $sql.= " '".$this->db->escape($note)."',"; - $sql.= " ".$user->id; - $sql.= ")"; + $sql .= " (entity, datec, fk_soc, remise_supplier, note, fk_user_author)"; + $sql .= " VALUES (".$conf->entity.", '".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($remise)."',"; + $sql .= " '".$this->db->escape($note)."',"; + $sql .= " ".$user->id; + $sql .= ")"; - $resql=$this->db->query($sql); - if (! $resql) + $resql = $this->db->query($sql); + if (!$resql) { $this->db->rollback(); - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return -1; } @@ -1799,14 +1799,14 @@ class Societe extends CommonObject $desc = trim($desc); // Check parameters - if (! $remise > 0) + if (!$remise > 0) { - $this->error=$langs->trans("ErrorWrongValueForParameter", "1"); + $this->error = $langs->trans("ErrorWrongValueForParameter", "1"); return -1; } - if (! $desc) + if (!$desc) { - $this->error=$langs->trans("ErrorWrongValueForParameter", "3"); + $this->error = $langs->trans("ErrorWrongValueForParameter", "3"); return -2; } @@ -1815,25 +1815,25 @@ class Societe extends CommonObject require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; $discount = new DiscountAbsolute($this->db); - $discount->fk_soc=$this->id; + $discount->fk_soc = $this->id; - $discount->discount_type=$discount_type; + $discount->discount_type = $discount_type; - $discount->amount_ht=$discount->multicurrency_amount_ht=price2num($remise, 'MT'); - $discount->amount_tva=$discount->multicurrency_amount_tva=price2num($remise*$tva_tx/100, 'MT'); - $discount->amount_ttc=$discount->multicurrency_amount_ttc=price2num($discount->amount_ht+$discount->amount_tva, 'MT'); + $discount->amount_ht = $discount->multicurrency_amount_ht = price2num($remise, 'MT'); + $discount->amount_tva = $discount->multicurrency_amount_tva = price2num($remise * $tva_tx / 100, 'MT'); + $discount->amount_ttc = $discount->multicurrency_amount_ttc = price2num($discount->amount_ht + $discount->amount_tva, 'MT'); - $discount->tva_tx=price2num($tva_tx, 'MT'); - $discount->description=$desc; + $discount->tva_tx = price2num($tva_tx, 'MT'); + $discount->description = $desc; - $result=$discount->create($user); + $result = $discount->create($user); if ($result > 0) { return $result; } else { - $this->error=$discount->error; + $this->error = $discount->error; return -3; } } @@ -1853,15 +1853,15 @@ class Societe extends CommonObject { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; - $discountstatic=new DiscountAbsolute($this->db); - $result=$discountstatic->getAvailableDiscounts($this, $user, $filter, $maxvalue, $discount_type); + $discountstatic = new DiscountAbsolute($this->db); + $result = $discountstatic->getAvailableDiscounts($this, $user, $filter, $maxvalue, $discount_type); if ($result >= 0) { return $result; } else { - $this->error=$discountstatic->error; + $this->error = $discountstatic->error; return -1; } } @@ -1877,47 +1877,47 @@ class Societe extends CommonObject { global $conf; - $reparray=array(); + $reparray = array(); $sql = "SELECT DISTINCT u.rowid, u.login, u.lastname, u.firstname, u.office_phone, u.job, u.email, u.statut, u.entity, u.photo"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; - if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) + $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."user as u"; + if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { - $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; - $sql.= " WHERE ((ug.fk_user = sc.fk_user"; - $sql.= " AND ug.entity = ".$conf->entity.")"; - $sql.= " OR u.admin = 1)"; + $sql .= ", ".MAIN_DB_PREFIX."usergroup_user as ug"; + $sql .= " WHERE ((ug.fk_user = sc.fk_user"; + $sql .= " AND ug.entity = ".$conf->entity.")"; + $sql .= " OR u.admin = 1)"; } else - $sql.= " WHERE entity in (0, ".$conf->entity.")"; + $sql .= " WHERE entity in (0, ".$conf->entity.")"; - $sql.= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".$this->id; + $sql .= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".$this->id; $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i=0; + $i = 0; while ($i < $num) { $obj = $this->db->fetch_object($resql); if (empty($mode)) { - $reparray[$i]['id']=$obj->rowid; - $reparray[$i]['lastname']=$obj->lastname; - $reparray[$i]['firstname']=$obj->firstname; - $reparray[$i]['email']=$obj->email; - $reparray[$i]['phone']=$obj->office_phone; - $reparray[$i]['job']=$obj->job; - $reparray[$i]['statut']=$obj->statut; - $reparray[$i]['entity']=$obj->entity; - $reparray[$i]['login']=$obj->login; - $reparray[$i]['photo']=$obj->photo; + $reparray[$i]['id'] = $obj->rowid; + $reparray[$i]['lastname'] = $obj->lastname; + $reparray[$i]['firstname'] = $obj->firstname; + $reparray[$i]['email'] = $obj->email; + $reparray[$i]['phone'] = $obj->office_phone; + $reparray[$i]['job'] = $obj->job; + $reparray[$i]['statut'] = $obj->statut; + $reparray[$i]['entity'] = $obj->entity; + $reparray[$i]['login'] = $obj->login; + $reparray[$i]['photo'] = $obj->photo; } else { - $reparray[]=$obj->rowid; + $reparray[] = $obj->rowid; } $i++; } @@ -1942,13 +1942,13 @@ class Societe extends CommonObject // phpcs:enable if ($this->id) { - $now=dol_now(); + $now = dol_now(); $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; $sql .= " SET price_level = '".$this->db->escape($price_level)."'"; - $sql .= " WHERE rowid = " . $this->id; + $sql .= " WHERE rowid = ".$this->id; - if (! $this->db->query($sql)) + if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; @@ -1958,7 +1958,7 @@ class Societe extends CommonObject $sql .= " (datec, fk_soc, price_level, fk_user_author)"; $sql .= " VALUES ('".$this->db->idate($now)."', ".$this->id.", '".$this->db->escape($price_level)."', ".$user->id.")"; - if (! $this->db->query($sql)) + if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; @@ -1979,51 +1979,51 @@ class Societe extends CommonObject public function add_commercial(User $user, $commid) { // phpcs:enable - $error=0; + $error = 0; if ($this->id > 0 && $commid > 0) { $this->db->begin(); - if (! $error) + if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux"; - $sql.= " WHERE fk_soc = ".$this->id." AND fk_user =".$commid; + $sql .= " WHERE fk_soc = ".$this->id." AND fk_user =".$commid; $resql = $this->db->query($sql); - if (! $resql) + if (!$resql) { dol_syslog(get_class($this)."::add_commercial Error ".$this->db->lasterror()); $error++; } } - if (! $error) + if (!$error) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_commerciaux"; - $sql.= " (fk_soc, fk_user)"; - $sql.= " VALUES (".$this->id.", ".$commid.")"; + $sql .= " (fk_soc, fk_user)"; + $sql .= " VALUES (".$this->id.", ".$commid.")"; $resql = $this->db->query($sql); - if (! $resql) + if (!$resql) { dol_syslog(get_class($this)."::add_commercial Error ".$this->db->lasterror()); $error++; } } - if (! $error) + if (!$error) { - $this->context=array('commercial_modified'=>$commid); + $this->context = array('commercial_modified'=>$commid); - $result=$this->call_trigger('COMPANY_LINK_SALE_REPRESENTATIVE', $user); + $result = $this->call_trigger('COMPANY_LINK_SALE_REPRESENTATIVE', $user); if ($result < 0) { $error++; } } - if (! $error) + if (!$error) { $this->db->commit(); return 1; @@ -2049,10 +2049,10 @@ class Societe extends CommonObject public function del_commercial(User $user, $commid) { // phpcs:enable - $error=0; - $this->context=array('commercial_modified'=>$commid); + $error = 0; + $this->context = array('commercial_modified'=>$commid); - $result=$this->call_trigger('COMPANY_UNLINK_SALE_REPRESENTATIVE', $user); + $result = $this->call_trigger('COMPANY_UNLINK_SALE_REPRESENTATIVE', $user); if ($result < 0) $error++; if ($this->id > 0 && $commid > 0) @@ -2060,7 +2060,7 @@ class Societe extends CommonObject $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_commerciaux "; $sql .= " WHERE fk_soc = ".$this->id." AND fk_user =".$commid; - if (! $this->db->query($sql) ) + if (!$this->db->query($sql)) { dol_syslog(get_class($this)."::del_commercial Erreur"); } @@ -2082,160 +2082,160 @@ class Societe extends CommonObject { global $conf, $langs, $hookmanager; - if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + if (!empty($conf->dol_no_mouse_hover)) $notooltip = 1; // Force disable tooltips - $name=$this->name?$this->name:$this->nom; + $name = $this->name ? $this->name : $this->nom; - if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)){ + if (!empty($conf->global->SOCIETE_ON_SEARCH_AND_LIST_GO_ON_CUSTOMER_OR_SUPPLIER_CARD)) { if (empty($option) && $this->client > 0) $option = 'customer'; if (empty($option) && $this->fournisseur > 0) $option = 'supplier'; } - if (! empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) + if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST) && (!empty($withpicto))) { $code = ''; - if (($this->client) && (! empty($this->code_client)) + if (($this->client) && (!empty($this->code_client)) && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 2 ) ) { - $code = $this->code_client . ' - '; + $code = $this->code_client.' - '; } - if (($this->fournisseur) && (! empty($this->code_fournisseur)) - && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 + if (($this->fournisseur) && (!empty($this->code_fournisseur)) + && ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1 || $conf->global->SOCIETE_ADD_REF_IN_LIST == 3 ) ) { - $code .= $this->code_fournisseur . ' - '; + $code .= $this->code_fournisseur.' - '; } if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) { - $name =$code.' '.$name; + $name = $code.' '.$name; } else { - $name =$code; + $name = $code; } } if (!empty($this->name_alias)) $name .= ' ('.$this->name_alias.')'; - $result=''; $label=''; - $linkstart=''; $linkend=''; + $result = ''; $label = ''; + $linkstart = ''; $linkend = ''; - if (! empty($this->logo) && class_exists('Form')) + if (!empty($this->logo) && class_exists('Form')) { - $label.= '
'; - $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. - $label.= '
'; + $label .= '
'; + $label .= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. + $label .= '
'; } - elseif (! empty($this->logo_squarred) && class_exists('Form')) + elseif (!empty($this->logo_squarred) && class_exists('Form')) { /*$label.= '
'; $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. $label.= '
';*/ } - $label.= '
'; + $label .= '
'; if ($option == 'customer' || $option == 'compta' || $option == 'category' || $option == 'category_supplier') { - $label.= '' . $langs->trans("ShowCustomer") . ''; + $label .= ''.$langs->trans("ShowCustomer").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowProspect").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowSupplier").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowAgenda").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowProject").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowMargin").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowContacts").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowBan").''; $linkstart = ''; + $label .= ''.$langs->trans("ShowCompany").''; $linkstart = 'global->MAIN_OPTIMIZEFORTEXTBROWSER)) + if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - $label=$langs->trans("ShowCompany"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + $label = $langs->trans("ShowCompany"); + $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip refurl"'; + $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose .= ' class="classfortooltip refurl"'; /* $hookmanager->initHooks(array('thirdpartydao')); @@ -2244,25 +2244,25 @@ class Societe extends CommonObject if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ } - $linkstart.=$linkclose.'>'; - $linkend=''; + $linkstart .= $linkclose.'>'; + $linkend = ''; global $user; - if (! $user->rights->societe->client->voir && $user->socid > 0 && $this->id != $user->socid) + if (!$user->rights->societe->client->voir && $user->socid > 0 && $this->id != $user->socid) { - $linkstart=''; - $linkend=''; + $linkstart = ''; + $linkend = ''; } - $result.=$linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valignmiddle"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.=($maxlen?dol_trunc($name, $maxlen):$name); - $result.=$linkend; + $result .= $linkstart; + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valignmiddle"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($name, $maxlen) : $name); + $result .= $linkend; global $action; $hookmanager->initHooks(array('thirdpartydao')); - $parameters=array('id'=>$this->id, 'getnomurl'=>$result); - $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('id'=>$this->id, 'getnomurl'=>$result); + $reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $result = $hookmanager->resPrint; else $result .= $hookmanager->resPrint; @@ -2323,8 +2323,8 @@ class Societe extends CommonObject $contact_emails = $this->contact_property_array('email', 1); if ($this->email && $addthirdparty) { - if (empty($this->name)) $this->name=$this->nom; - $contact_emails['thirdparty']=$langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name, 16)." <".$this->email.">"; + if (empty($this->name)) $this->name = $this->nom; + $contact_emails['thirdparty'] = $langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name, 16)." <".$this->email.">"; } //var_dump($contact_emails) return $contact_emails; @@ -2343,11 +2343,11 @@ class Societe extends CommonObject $contact_phone = $this->contact_property_array('mobile'); - if (! empty($this->phone)) // If a phone of thirdparty is defined, we add it ot mobile of contacts + if (!empty($this->phone)) // If a phone of thirdparty is defined, we add it ot mobile of contacts { - if (empty($this->name)) $this->name=$this->nom; + if (empty($this->name)) $this->name = $this->nom; // TODO: Tester si tel non deja present dans tableau contact - $contact_phone['thirdparty']=$langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name, 16)." <".$this->phone.">"; + $contact_phone['thirdparty'] = $langs->transnoentitiesnoconv("ThirdParty").': '.dol_trunc($this->name, 16)." <".$this->phone.">"; } return $contact_phone; } @@ -2369,46 +2369,46 @@ class Societe extends CommonObject $sql = "SELECT rowid, email, statut, phone_mobile, lastname, poste, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople"; - $sql.= " WHERE fk_soc = ".$this->id; - $sql.= " ORDER BY lastname, firstname"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople"; + $sql .= " WHERE fk_soc = ".$this->id; + $sql .= " ORDER BY lastname, firstname"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $nump = $this->db->num_rows($resql); if ($nump) { - $sepa="("; $sepb=")"; + $sepa = "("; $sepb = ")"; if ($mode == 'email') { //$sepa="<"; $sepb=">"; - $sepa="<"; $sepb=">"; + $sepa = "<"; $sepb = ">"; } $i = 0; while ($i < $nump) { $obj = $this->db->fetch_object($resql); - if ($mode == 'email') $property=$obj->email; - elseif ($mode == 'mobile') $property=$obj->phone_mobile; - else $property=$obj->$mode; + if ($mode == 'email') $property = $obj->email; + elseif ($mode == 'mobile') $property = $obj->phone_mobile; + else $property = $obj->$mode; // Show all contact. If hidedisabled is 1, showonly contacts with status = 1 if ($obj->statut == 1 || empty($hidedisabled)) { if (empty($property)) { - if ($mode == 'email') $property=$langs->transnoentitiesnoconv("NoEMail"); - elseif ($mode == 'mobile') $property=$langs->transnoentitiesnoconv("NoMobilePhone"); + if ($mode == 'email') $property = $langs->transnoentitiesnoconv("NoEMail"); + elseif ($mode == 'mobile') $property = $langs->transnoentitiesnoconv("NoMobilePhone"); } if (!empty($obj->poste)) { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).($obj->poste?" - ".$obj->poste:"").(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).($obj->poste ? " - ".$obj->poste : "").(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); } else { - $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).(($mode != 'poste' && $property)?" ".$sepa.$property.$sepb:''); + $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); } } $i++; @@ -2435,7 +2435,7 @@ class Societe extends CommonObject $contacts = array(); $sql = "SELECT rowid, lastname, firstname FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$this->id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $nump = $this->db->num_rows($resql); @@ -2466,11 +2466,11 @@ class Societe extends CommonObject public function contact_array_objects() { // phpcs:enable - require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $contacts = array(); $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = ".$this->id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $nump = $this->db->num_rows($resql); @@ -2505,15 +2505,15 @@ class Societe extends CommonObject public function contact_get_property($rowid, $mode) { // phpcs:enable - $contact_property=''; + $contact_property = ''; if (empty($rowid)) return ''; $sql = "SELECT rowid, email, phone_mobile, lastname, firstname"; - $sql.= " FROM ".MAIN_DB_PREFIX."socpeople"; - $sql.= " WHERE rowid = '".$rowid."'"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople"; + $sql .= " WHERE rowid = '".$rowid."'"; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $nump = $this->db->num_rows($resql); @@ -2544,7 +2544,7 @@ class Societe extends CommonObject public function display_rib($mode = 'label') { // phpcs:enable - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $bac = new CompanyBankAccount($this->db); $bac->fetch(0, $this->id); @@ -2557,7 +2557,7 @@ class Societe extends CommonObject { if (empty($bac->rum)) { - require_once DOL_DOCUMENT_ROOT . '/compta/prelevement/class/bonprelevement.class.php'; + require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; $prelevement = new BonPrelevement($this->db); $bac->fetch_thirdparty(); $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id); @@ -2581,7 +2581,7 @@ class Societe extends CommonObject public function get_all_rib() { // phpcs:enable - require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; + require_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."societe_rib WHERE type='ban' AND fk_soc = ".$this->id; $result = $this->db->query($sql); if (!$result) { @@ -2615,14 +2615,14 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $mod = new $module(); @@ -2647,14 +2647,14 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $mod = new $module(); @@ -2676,23 +2676,23 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $mod = new $module(); dol_syslog(get_class($this)."::codeclient_modifiable code_client=".$this->code_client." module=".$module); - if ($mod->code_modifiable_null && ! $this->code_client) return 1; + if ($mod->code_modifiable_null && !$this->code_client) return 1; if ($mod->code_modifiable_invalide && $this->check_codeclient() < 0) return 1; - if ($mod->code_modifiable) return 1; // A mettre en dernier + if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; } else @@ -2712,23 +2712,23 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } $mod = new $module(); dol_syslog(get_class($this)."::codefournisseur_modifiable code_founisseur=".$this->code_fournisseur." module=".$module); - if ($mod->code_modifiable_null && ! $this->code_fournisseur) return 1; + if ($mod->code_modifiable_null && !$this->code_fournisseur) return 1; if ($mod->code_modifiable_invalide && $this->check_codefournisseur() < 0) return 1; - if ($mod->code_modifiable) return 1; // A mettre en dernier + if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; } else @@ -2752,14 +2752,14 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } @@ -2789,14 +2789,14 @@ class Societe extends CommonObject { // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECLIENT_ADDON)) + if (!empty($conf->global->SOCIETE_CODECLIENT_ADDON)) { - $module=$conf->global->SOCIETE_CODECLIENT_ADDON; + $module = $conf->global->SOCIETE_CODECLIENT_ADDON; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$module.'.php'); + $res = dol_include_once($dirroot.$module.'.php'); if ($res) break; } @@ -2826,13 +2826,13 @@ class Societe extends CommonObject // phpcs:enable global $conf; - if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) + if (!empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) { - $res=false; - $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); + $res = false; + $dirsociete = array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - $res=dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php'); + $res = dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php'); if ($res) break; } @@ -2877,10 +2877,10 @@ class Societe extends CommonObject if ($this->id) { $sql = "UPDATE ".MAIN_DB_PREFIX."societe"; - $sql.= " SET parent = ".($id > 0 ? $id : "null"); - $sql.= " WHERE rowid = " . $this->id; + $sql .= " SET parent = ".($id > 0 ? $id : "null"); + $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this).'::set_parent', LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->parent = $id; @@ -2906,28 +2906,28 @@ class Societe extends CommonObject // phpcs:enable global $conf; - switch($idprof) + switch ($idprof) { case 1: - $ret=(!$conf->global->SOCIETE_IDPROF1_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF1_UNIQUE ?false:true); break; case 2: - $ret=(!$conf->global->SOCIETE_IDPROF2_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF2_UNIQUE ?false:true); break; case 3: - $ret=(!$conf->global->SOCIETE_IDPROF3_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF3_UNIQUE ?false:true); break; case 4: - $ret=(!$conf->global->SOCIETE_IDPROF4_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF4_UNIQUE ?false:true); break; case 5: - $ret=(!$conf->global->SOCIETE_IDPROF5_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF5_UNIQUE ?false:true); break; case 6: - $ret=(!$conf->global->SOCIETE_IDPROF6_UNIQUE?false:true); + $ret = (!$conf->global->SOCIETE_IDPROF6_UNIQUE ?false:true); break; default: - $ret=false; + $ret = false; } return $ret; @@ -2947,35 +2947,35 @@ class Societe extends CommonObject // phpcs:enable $field = $idprof; - switch($idprof) // For backward compatibility + switch ($idprof) // For backward compatibility { case '1': case 'idprof1': - $field="siren"; + $field = "siren"; break; case '2': case 'idprof2': - $field="siret"; + $field = "siret"; break; case '3': case 'idprof3': - $field="ape"; + $field = "ape"; break; case '4': case 'idprof4': - $field="idprof4"; + $field = "idprof4"; break; case '5': - $field="idprof5"; + $field = "idprof5"; break; case '6': - $field="idprof6"; + $field = "idprof6"; break; } //Verify duplicate entries - $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."' AND entity IN (".getEntity('societe').")"; - if($socid) $sql .= " AND rowid <> ".$socid; + $sql = "SELECT COUNT(*) as idprof FROM ".MAIN_DB_PREFIX."societe WHERE ".$field." = '".$value."' AND entity IN (".getEntity('societe').")"; + if ($socid) $sql .= " AND rowid <> ".$socid; $resql = $this->db->query($sql); if ($resql) { @@ -3007,15 +3007,15 @@ class Societe extends CommonObject // phpcs:enable global $conf; - $ok=1; + $ok = 1; - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1; + if (!empty($conf->global->MAIN_DISABLEPROFIDRULES)) return 1; // Check SIREN if country FR if ($idprof == 1 && $soc->country_code == 'FR') { - $chaine=trim($this->idprof1); - $chaine=preg_replace('/(\s)/', '', $chaine); + $chaine = trim($this->idprof1); + $chaine = preg_replace('/(\s)/', '', $chaine); if (!is_numeric($chaine)) return -1; if (dol_strlen($chaine) != 9) return -1; @@ -3025,7 +3025,7 @@ class Societe extends CommonObject // on double sa valeur et si cette dernière est supérieure à 9, on lui retranche 9 // on ajoute cette valeur à la somme totale - for ($index = 0; $index < 9; $index ++) + for ($index = 0; $index < 9; $index++) { $number = (int) $chaine[$index]; if (($index % 2) != 0) { if (($number *= 2) > 9) $number -= 9; } @@ -3039,8 +3039,8 @@ class Societe extends CommonObject // Verifie SIRET si pays FR if ($idprof == 2 && $soc->country_code == 'FR') { - $chaine=trim($this->idprof2); - $chaine=preg_replace('/(\s)/', '', $chaine); + $chaine = trim($this->idprof2); + $chaine = preg_replace('/(\s)/', '', $chaine); if (!is_numeric($chaine)) return -1; if (dol_strlen($chaine) != 14) return -1; @@ -3050,7 +3050,7 @@ class Societe extends CommonObject // on double sa valeur et si cette dernière est supérieure à 9, on lui retranche 9 // on ajoute cette valeur à la somme totale - for ($index = 0; $index < 14; $index ++) + for ($index = 0; $index < 14; $index++) { $number = (int) $chaine[$index]; if (($index % 2) == 0) { if (($number *= 2) > 9) $number -= 9; } @@ -3065,8 +3065,8 @@ class Societe extends CommonObject //Returns: 1 if NIF ok, 2 if CIF ok, 3 if NIE ok, -1 if NIF bad, -2 if CIF bad, -3 if NIE bad, 0 if unexpected bad if ($idprof == 1 && $soc->country_code == 'ES') { - $string=trim($this->idprof1); - $string=preg_replace('/(\s)/', '', $string); + $string = trim($this->idprof1); + $string = preg_replace('/(\s)/', '', $string); $string = strtoupper($string); //Check format @@ -3074,7 +3074,7 @@ class Societe extends CommonObject return 0; $num = array(); - for ($i = 0; $i < 9; $i ++) + for ($i = 0; $i < 9; $i++) { $num[$i] = substr($string, $i, 1); } @@ -3115,7 +3115,7 @@ class Societe extends CommonObject //Check NIE XYZ if (preg_match('/^[XYZ]{1}/', $string)) - if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X','Y','Z'), array('0','1','2'), $string), 0, 8) % 23, 1)) + if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X', 'Y', 'Z'), array('0', '1', '2'), $string), 0, 8) % 23, 1)) return 3; else return -3; @@ -3128,10 +3128,10 @@ class Societe extends CommonObject //Returns: 1 if NIF ok, -1 if NIF bad, 0 if unexpected bad if ($idprof == 1 && $soc->country_code == 'PT') { - $string=trim($this->idprof1); - $string=preg_replace('/(\s)/', '', $string); + $string = trim($this->idprof1); + $string = preg_replace('/(\s)/', '', $string); - for ($i = 0; $i < 9; $i ++) { + for ($i = 0; $i < 9; $i++) { $num[$i] = substr($string, $i, 1); } @@ -3159,35 +3159,35 @@ class Societe extends CommonObject public function id_prof_url($idprof, $thirdparty) { // phpcs:enable - global $conf,$langs,$hookmanager; + global $conf, $langs, $hookmanager; - $url=''; + $url = ''; $action = ''; $hookmanager->initHooks(array('idprofurl')); - $parameters=array('idprof'=>$idprof, 'company'=>$thirdparty); - $reshook=$hookmanager->executeHooks('getIdProfUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + $parameters = array('idprof'=>$idprof, 'company'=>$thirdparty); + $reshook = $hookmanager->executeHooks('getIdProfUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if (empty($reshook)) { - if (! empty($conf->global->MAIN_DISABLEPROFIDRULES)) { + if (!empty($conf->global->MAIN_DISABLEPROFIDRULES)) { return ''; } // TODO Move links to validate professional ID into a dictionary table "country" + "link" $strippedIdProf1 = str_replace(' ', '', $thirdparty->idprof1); if ($idprof == 1 && $thirdparty->country_code == 'FR') { - $url='http://www.societe.com/cgi-bin/search?champs='.$strippedIdProf1; // See also http://avis-situation-sirene.insee.fr/ + $url = 'http://www.societe.com/cgi-bin/search?champs='.$strippedIdProf1; // See also http://avis-situation-sirene.insee.fr/ } if ($idprof == 1 && ($thirdparty->country_code == 'GB' || $thirdparty->country_code == 'UK')) { - $url='https://beta.companieshouse.gov.uk/company/'.$strippedIdProf1; + $url = 'https://beta.companieshouse.gov.uk/company/'.$strippedIdProf1; } if ($idprof == 1 && $thirdparty->country_code == 'ES') { - $url='http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$strippedIdProf1; + $url = 'http://www.e-informa.es/servlet/app/portal/ENTP/screen/SProducto/prod/ETIQUETA_EMPRESA/nif/'.$strippedIdProf1; } if ($idprof == 1 && $thirdparty->country_code == 'IN') { - $url='http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$strippedIdProf1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; + $url = 'http://www.tinxsys.com/TinxsysInternetWeb/dealerControllerServlet?tinNumber='.$strippedIdProf1.';&searchBy=TIN&backPage=searchByTin_Inter.jsp'; } if ($idprof == 1 && $thirdparty->country_code == 'PT') { - $url='http://www.nif.pt/'.$strippedIdProf1; + $url = 'http://www.nif.pt/'.$strippedIdProf1; } if ($url) { @@ -3210,7 +3210,7 @@ class Societe extends CommonObject public function has_projects() { // phpcs:enable - $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = ' . $this->id; + $sql = 'SELECT COUNT(*) as numproj FROM '.MAIN_DB_PREFIX.'projet WHERE fk_soc = '.$this->id; $resql = $this->db->query($sql); if ($resql) { @@ -3236,11 +3236,11 @@ class Societe extends CommonObject public function info($id) { $sql = "SELECT s.rowid, s.nom as name, s.datec as date_creation, tms as date_modification,"; - $sql.= " fk_user_creat, fk_user_modif"; - $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - $sql.= " WHERE s.rowid = ".$id; + $sql .= " fk_user_creat, fk_user_modif"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; + $sql .= " WHERE s.rowid = ".$id; - $result=$this->db->query($sql); + $result = $this->db->query($sql); if ($result) { if ($this->db->num_rows($result)) @@ -3252,7 +3252,7 @@ class Societe extends CommonObject if ($obj->fk_user_creat) { $cuser = new User($this->db); $cuser->fetch($obj->fk_user_creat); - $this->user_creation = $cuser; + $this->user_creation = $cuser; } if ($obj->fk_user_modif) { @@ -3261,7 +3261,7 @@ class Societe extends CommonObject $this->user_modification = $muser; } - $this->ref = $obj->name; + $this->ref = $obj->name; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); } @@ -3284,14 +3284,14 @@ class Societe extends CommonObject global $conf; // Define if third party is treated as company (or not) when nature is unknown - $isacompany=empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES)?0:1; // 0 by default - if (! empty($this->tva_intra)) { + $isacompany = empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES) ? 0 : 1; // 0 by default + if (!empty($this->tva_intra)) { $isacompany = 1; } - elseif (! empty($this->idprof1) || ! empty($this->idprof2) || ! empty($this->idprof3) || ! empty($this->idprof4) || ! empty($this->idprof5) || ! empty($this->idprof6)) { + elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { $isacompany = 1; } - elseif (! empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') + elseif (!empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') { // TODO Add a field is_a_company into dictionary if (preg_match('/^TE_PRIVATE/', $this->typent_code)) $isacompany = 0; @@ -3323,13 +3323,13 @@ class Societe extends CommonObject // phpcs:enable $this->SupplierCategories = array(); $sql = "SELECT rowid, label"; - $sql.= " FROM ".MAIN_DB_PREFIX."categorie"; - $sql.= " WHERE type = ".Categorie::TYPE_SUPPLIER; + $sql .= " FROM ".MAIN_DB_PREFIX."categorie"; + $sql .= " WHERE type = ".Categorie::TYPE_SUPPLIER; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - while ($obj = $this->db->fetch_object($resql) ) + while ($obj = $this->db->fetch_object($resql)) { $this->SupplierCategories[$obj->rowid] = $obj->label; } @@ -3354,9 +3354,9 @@ class Societe extends CommonObject if ($categorie_id > 0 && $this->id > 0) { $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie_fournisseur (fk_categorie, fk_soc) "; - $sql.= " VALUES (".$categorie_id.", ".$this->id.")"; + $sql .= " VALUES (".$categorie_id.", ".$this->id.")"; - if ($resql=$this->db->query($sql)) return 0; + if ($resql = $this->db->query($sql)) return 0; } else { @@ -3379,43 +3379,43 @@ class Societe extends CommonObject public function create_from_member(Adherent $member, $socname = '', $socalias = '', $customercode = '') { // phpcs:enable - global $user,$langs; + global $user, $langs; dol_syslog(get_class($this)."::create_from_member", LOG_DEBUG); - $name = $socname?$socname:$member->societe; - if (empty($name)) $name=$member->getFullName($langs); + $name = $socname ? $socname : $member->societe; + if (empty($name)) $name = $member->getFullName($langs); - $alias = $socalias?$socalias:''; + $alias = $socalias ? $socalias : ''; // Positionne parametres - $this->nom=$name; // TODO deprecated - $this->name=$name; - $this->name_alias=$alias; - $this->address=$member->address; - $this->zip=$member->zip; - $this->town=$member->town; - $this->country_code=$member->country_code; - $this->country_id=$member->country_id; - $this->phone=$member->phone; // Prof phone - $this->email=$member->email; + $this->nom = $name; // TODO deprecated + $this->name = $name; + $this->name_alias = $alias; + $this->address = $member->address; + $this->zip = $member->zip; + $this->town = $member->town; + $this->country_code = $member->country_code; + $this->country_id = $member->country_id; + $this->phone = $member->phone; // Prof phone + $this->email = $member->email; $this->socialnetworks = $member->socialnetworks; - $this->client = 1; // A member is a customer by default - $this->code_client = ($customercode?$customercode:-1); + $this->client = 1; // A member is a customer by default + $this->code_client = ($customercode ? $customercode : -1); $this->code_fournisseur = -1; $this->db->begin(); // Cree et positionne $this->id - $result=$this->create($user); + $result = $this->create($user); if ($result >= 0) { $sql = "UPDATE ".MAIN_DB_PREFIX."adherent"; - $sql.= " SET fk_soc=".$this->id; - $sql.= " WHERE rowid=".$member->id; + $sql .= " SET fk_soc=".$this->id; + $sql .= " WHERE rowid=".$member->id; - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $this->db->commit(); @@ -3423,7 +3423,7 @@ class Societe extends CommonObject } else { - $this->error=$this->db->error(); + $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3449,96 +3449,96 @@ class Societe extends CommonObject { global $langs; - $this->id=0; - $this->name=empty($conf->global->MAIN_INFO_SOCIETE_NOM)?'':$conf->global->MAIN_INFO_SOCIETE_NOM; - $this->address=empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS)?'':$conf->global->MAIN_INFO_SOCIETE_ADDRESS; - $this->zip=empty($conf->global->MAIN_INFO_SOCIETE_ZIP)?'':$conf->global->MAIN_INFO_SOCIETE_ZIP; - $this->town=empty($conf->global->MAIN_INFO_SOCIETE_TOWN)?'':$conf->global->MAIN_INFO_SOCIETE_TOWN; - $this->region_code=empty($conf->global->MAIN_INFO_SOCIETE_REGION)?'':$conf->global->MAIN_INFO_SOCIETE_REGION; - $this->object=empty($conf->global->MAIN_INFO_SOCIETE_OBJECT)?'':$conf->global->MAIN_INFO_SOCIETE_OBJECT; + $this->id = 0; + $this->name = empty($conf->global->MAIN_INFO_SOCIETE_NOM) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOM; + $this->address = empty($conf->global->MAIN_INFO_SOCIETE_ADDRESS) ? '' : $conf->global->MAIN_INFO_SOCIETE_ADDRESS; + $this->zip = empty($conf->global->MAIN_INFO_SOCIETE_ZIP) ? '' : $conf->global->MAIN_INFO_SOCIETE_ZIP; + $this->town = empty($conf->global->MAIN_INFO_SOCIETE_TOWN) ? '' : $conf->global->MAIN_INFO_SOCIETE_TOWN; + $this->region_code = empty($conf->global->MAIN_INFO_SOCIETE_REGION) ? '' : $conf->global->MAIN_INFO_SOCIETE_REGION; + $this->object = empty($conf->global->MAIN_INFO_SOCIETE_OBJECT) ? '' : $conf->global->MAIN_INFO_SOCIETE_OBJECT; - $this->note_private=empty($conf->global->MAIN_INFO_SOCIETE_NOTE)?'':$conf->global->MAIN_INFO_SOCIETE_NOTE; + $this->note_private = empty($conf->global->MAIN_INFO_SOCIETE_NOTE) ? '' : $conf->global->MAIN_INFO_SOCIETE_NOTE; - $this->nom=$this->name; // deprecated + $this->nom = $this->name; // deprecated // We define country_id, country_code and country - $country_id=$country_code=$country_label=''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) + $country_id = $country_code = $country_label = ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_COUNTRY); - $country_id=$tmp[0]; - if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" + $tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_COUNTRY); + $country_id = $tmp[0]; + if (!empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_COUNTRY is "id:code:label" { - $country_code=$tmp[1]; - $country_label=$tmp[2]; + $country_code = $tmp[1]; + $country_label = $tmp[2]; } else // For backward compatibility { dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $country_code=getCountry($country_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore - $country_label=getCountry($country_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $country_code = getCountry($country_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $country_label = getCountry($country_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore } } - $this->country_id=$country_id; - $this->country_code=$country_code; - $this->country=$country_label; - if (is_object($langs)) $this->country=($langs->trans('Country'.$country_code)!='Country'.$country_code)?$langs->trans('Country'.$country_code):$country_label; + $this->country_id = $country_id; + $this->country_code = $country_code; + $this->country = $country_label; + if (is_object($langs)) $this->country = ($langs->trans('Country'.$country_code) != 'Country'.$country_code) ? $langs->trans('Country'.$country_code) : $country_label; //TODO This could be replicated for region but function `getRegion` didn't exist, so I didn't added it. // We define state_id, state_code and state - $state_id=0;$state_code=$state_label=''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + $state_id = 0; $state_code = $state_label = ''; + if (!empty($conf->global->MAIN_INFO_SOCIETE_STATE)) { - $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); - $state_id=$tmp[0]; - if (! empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label" + $tmp = explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id = $tmp[0]; + if (!empty($tmp[1])) // If $conf->global->MAIN_INFO_SOCIETE_STATE is "id:code:label" { - $state_code=$tmp[1]; - $state_label=$tmp[2]; + $state_code = $tmp[1]; + $state_label = $tmp[2]; } else // For backward compatibility { dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; - $state_code=getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore - $state_label=getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $state_code = getState($state_id, 2, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore + $state_label = getState($state_id, 0, $this->db); // This need a SQL request, but it's the old feature that should not be used anymore } } - $this->state_id=$state_id; - $this->state_code=$state_code; - $this->state=$state_label; - if (is_object($langs)) $this->state=($langs->trans('State'.$state_code)!='State'.$state_code)?$langs->trans('State'.$state_code):$state_label; + $this->state_id = $state_id; + $this->state_code = $state_code; + $this->state = $state_label; + if (is_object($langs)) $this->state = ($langs->trans('State'.$state_code) != 'State'.$state_code) ? $langs->trans('State'.$state_code) : $state_label; - $this->phone=empty($conf->global->MAIN_INFO_SOCIETE_TEL)?'':$conf->global->MAIN_INFO_SOCIETE_TEL; - $this->fax=empty($conf->global->MAIN_INFO_SOCIETE_FAX)?'':$conf->global->MAIN_INFO_SOCIETE_FAX; - $this->url=empty($conf->global->MAIN_INFO_SOCIETE_WEB)?'':$conf->global->MAIN_INFO_SOCIETE_WEB; + $this->phone = empty($conf->global->MAIN_INFO_SOCIETE_TEL) ? '' : $conf->global->MAIN_INFO_SOCIETE_TEL; + $this->fax = empty($conf->global->MAIN_INFO_SOCIETE_FAX) ? '' : $conf->global->MAIN_INFO_SOCIETE_FAX; + $this->url = empty($conf->global->MAIN_INFO_SOCIETE_WEB) ? '' : $conf->global->MAIN_INFO_SOCIETE_WEB; // Id prof generiques - $this->idprof1=empty($conf->global->MAIN_INFO_SIREN)?'':$conf->global->MAIN_INFO_SIREN; - $this->idprof2=empty($conf->global->MAIN_INFO_SIRET)?'':$conf->global->MAIN_INFO_SIRET; - $this->idprof3=empty($conf->global->MAIN_INFO_APE)?'':$conf->global->MAIN_INFO_APE; - $this->idprof4=empty($conf->global->MAIN_INFO_RCS)?'':$conf->global->MAIN_INFO_RCS; - $this->idprof5=empty($conf->global->MAIN_INFO_PROFID5)?'':$conf->global->MAIN_INFO_PROFID5; - $this->idprof6=empty($conf->global->MAIN_INFO_PROFID6)?'':$conf->global->MAIN_INFO_PROFID6; - $this->tva_intra=empty($conf->global->MAIN_INFO_TVAINTRA)?'':$conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA. - $this->managers=empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS)?'':$conf->global->MAIN_INFO_SOCIETE_MANAGERS; - $this->capital=empty($conf->global->MAIN_INFO_CAPITAL)?'':$conf->global->MAIN_INFO_CAPITAL; - $this->forme_juridique_code=empty($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE)?'':$conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE; - $this->email=empty($conf->global->MAIN_INFO_SOCIETE_MAIL)?'':$conf->global->MAIN_INFO_SOCIETE_MAIL; - $this->default_lang = (empty($conf->global->MAIN_LANG_DEFAULT)?'auto':$conf->global->MAIN_LANG_DEFAULT); - $this->logo=empty($conf->global->MAIN_INFO_SOCIETE_LOGO)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO; - $this->logo_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; - $this->logo_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; - $this->logo_squarred=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; - $this->logo_squarred_small=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; - $this->logo_squarred_mini=empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; + $this->idprof1 = empty($conf->global->MAIN_INFO_SIREN) ? '' : $conf->global->MAIN_INFO_SIREN; + $this->idprof2 = empty($conf->global->MAIN_INFO_SIRET) ? '' : $conf->global->MAIN_INFO_SIRET; + $this->idprof3 = empty($conf->global->MAIN_INFO_APE) ? '' : $conf->global->MAIN_INFO_APE; + $this->idprof4 = empty($conf->global->MAIN_INFO_RCS) ? '' : $conf->global->MAIN_INFO_RCS; + $this->idprof5 = empty($conf->global->MAIN_INFO_PROFID5) ? '' : $conf->global->MAIN_INFO_PROFID5; + $this->idprof6 = empty($conf->global->MAIN_INFO_PROFID6) ? '' : $conf->global->MAIN_INFO_PROFID6; + $this->tva_intra = empty($conf->global->MAIN_INFO_TVAINTRA) ? '' : $conf->global->MAIN_INFO_TVAINTRA; // VAT number, not necessarly INTRA. + $this->managers = empty($conf->global->MAIN_INFO_SOCIETE_MANAGERS) ? '' : $conf->global->MAIN_INFO_SOCIETE_MANAGERS; + $this->capital = empty($conf->global->MAIN_INFO_CAPITAL) ? '' : $conf->global->MAIN_INFO_CAPITAL; + $this->forme_juridique_code = empty($conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE) ? '' : $conf->global->MAIN_INFO_SOCIETE_FORME_JURIDIQUE; + $this->email = empty($conf->global->MAIN_INFO_SOCIETE_MAIL) ? '' : $conf->global->MAIN_INFO_SOCIETE_MAIL; + $this->default_lang = (empty($conf->global->MAIN_LANG_DEFAULT) ? 'auto' : $conf->global->MAIN_LANG_DEFAULT); + $this->logo = empty($conf->global->MAIN_INFO_SOCIETE_LOGO) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO; + $this->logo_small = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SMALL; + $this->logo_mini = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_MINI; + $this->logo_squarred = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED; + $this->logo_squarred_small = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_SMALL; + $this->logo_squarred_mini = empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ? '' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI; // Define if company use vat or not - $this->tva_assuj=$conf->global->FACTURE_TVAOPTION; + $this->tva_assuj = $conf->global->FACTURE_TVAOPTION; // Define if company use local taxes - $this->localtax1_assuj=((isset($conf->global->FACTURE_LOCAL_TAX1_OPTION) && ($conf->global->FACTURE_LOCAL_TAX1_OPTION=='1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on'))?1:0); - $this->localtax2_assuj=((isset($conf->global->FACTURE_LOCAL_TAX2_OPTION) && ($conf->global->FACTURE_LOCAL_TAX2_OPTION=='1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION=='localtax2on'))?1:0); + $this->localtax1_assuj = ((isset($conf->global->FACTURE_LOCAL_TAX1_OPTION) && ($conf->global->FACTURE_LOCAL_TAX1_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX1_OPTION == 'localtax1on')) ? 1 : 0); + $this->localtax2_assuj = ((isset($conf->global->FACTURE_LOCAL_TAX2_OPTION) && ($conf->global->FACTURE_LOCAL_TAX2_OPTION == '1' || $conf->global->FACTURE_LOCAL_TAX2_OPTION == 'localtax2on')) ? 1 : 0); } /** @@ -3550,51 +3550,51 @@ class Societe extends CommonObject */ public function initAsSpecimen() { - $now=dol_now(); + $now = dol_now(); // Initialize parameters - $this->id=0; + $this->id = 0; $this->name = 'THIRDPARTY SPECIMEN '.dol_print_date($now, 'dayhourlog'); - $this->nom = $this->name; // For backward compatibility + $this->nom = $this->name; // For backward compatibility $this->ref_ext = 'Ref ext'; - $this->specimen=1; - $this->address='21 jump street'; - $this->zip='99999'; - $this->town='MyTown'; - $this->state_id=1; - $this->state_code='AA'; - $this->state='MyState'; - $this->country_id=1; - $this->country_code='FR'; - $this->email='specimen@specimen.com'; + $this->specimen = 1; + $this->address = '21 jump street'; + $this->zip = '99999'; + $this->town = 'MyTown'; + $this->state_id = 1; + $this->state_code = 'AA'; + $this->state = 'MyState'; + $this->country_id = 1; + $this->country_code = 'FR'; + $this->email = 'specimen@specimen.com'; $this->socialnetworks = array( 'skype' => 'tom.hanson', 'twitter' => 'tomhanson', 'facebook' => 'tomhanson', 'linkedin' => 'tomhanson', ); - $this->url='http://www.specimen.com'; + $this->url = 'http://www.specimen.com'; - $this->phone='0909090901'; - $this->fax='0909090909'; + $this->phone = '0909090901'; + $this->fax = '0909090909'; - $this->code_client='CC-'.dol_print_date($now, 'dayhourlog'); - $this->code_fournisseur='SC-'.dol_print_date($now, 'dayhourlog'); - $this->capital=10000; - $this->client=1; - $this->prospect=1; - $this->fournisseur=1; - $this->tva_assuj=1; - $this->tva_intra='EU1234567'; - $this->note_public='This is a comment (public)'; - $this->note_private='This is a comment (private)'; + $this->code_client = 'CC-'.dol_print_date($now, 'dayhourlog'); + $this->code_fournisseur = 'SC-'.dol_print_date($now, 'dayhourlog'); + $this->capital = 10000; + $this->client = 1; + $this->prospect = 1; + $this->fournisseur = 1; + $this->tva_assuj = 1; + $this->tva_intra = 'EU1234567'; + $this->note_public = 'This is a comment (public)'; + $this->note_private = 'This is a comment (private)'; - $this->idprof1='idprof1'; - $this->idprof2='idprof2'; - $this->idprof3='idprof3'; - $this->idprof4='idprof4'; - $this->idprof5='idprof5'; - $this->idprof6='idprof6'; + $this->idprof1 = 'idprof1'; + $this->idprof2 = 'idprof2'; + $this->idprof3 = 'idprof3'; + $this->idprof4 = 'idprof4'; + $this->idprof5 = 'idprof5'; + $this->idprof6 = 'idprof6'; return 1; } @@ -3615,7 +3615,7 @@ class Societe extends CommonObject elseif ($localTaxNum == 2) $sql .= " AND t.localtax2_type <> '0'"; dol_syslog("useLocalTax", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { return ($this->db->num_rows($resql) > 0); @@ -3636,7 +3636,7 @@ class Societe extends CommonObject $sql .= " AND t.active = 1 AND t.recuperableonly = 1"; dol_syslog("useNPR", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { return ($this->db->num_rows($resql) > 0); @@ -3657,15 +3657,15 @@ class Societe extends CommonObject $sql .= " AND r.active = 1"; dol_syslog("useRevenueStamp", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { - $obj=$this->db->fetch_object($resql); - return (($obj->nb > 0)?true:false); + $obj = $this->db->fetch_object($resql); + return (($obj->nb > 0) ?true:false); } else { - $this->error=$this->db->lasterror(); + $this->error = $this->db->lasterror(); return false; } } @@ -3692,11 +3692,11 @@ class Societe extends CommonObject // phpcs:enable global $langs; - $lib=$langs->trans("ProspectLevel".$fk_prospectlevel); + $lib = $langs->trans("ProspectLevel".$fk_prospectlevel); // If lib not found in language file, we get label from cache/databse if ($lib == $langs->trans("ProspectLevel".$fk_prospectlevel)) { - $lib=$langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label'); + $lib = $langs->getLabelFromKey($this->db, $fk_prospectlevel, 'c_prospectlevel', 'code', 'label'); } return $lib; } @@ -3746,10 +3746,10 @@ class Societe extends CommonObject if ($mode == 2) { if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1).' '.$langs->trans("StatusProspect-1"); - elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0"); - elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); - elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); - elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); + elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0"); + elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); + elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); + elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label); @@ -3758,10 +3758,10 @@ class Societe extends CommonObject if ($mode == 3) { if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1); - elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0); - elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1); - elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2); - elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3); + elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0); + elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1); + elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2); + elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3); else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0); @@ -3770,10 +3770,10 @@ class Societe extends CommonObject if ($mode == 4) { if ($status == '-1' || $status == 'ST_NO') return img_action($langs->trans("StatusProspect-1"), -1).' '.$langs->trans("StatusProspect-1"); - elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0"); - elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); - elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); - elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); + elseif ($status == '0' || $status == 'ST_NEVER') return img_action($langs->trans("StatusProspect0"), 0).' '.$langs->trans("StatusProspect0"); + elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); + elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); + elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label); @@ -3805,11 +3805,11 @@ class Societe extends CommonObject */ public function getOutstandingProposals($mode = 'customer') { - $table='propal'; + $table = 'propal'; if ($mode == 'supplier') $table = 'supplier_proposal'; $sql = "SELECT rowid, total_ht, total as total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + $sql .= " WHERE fk_soc = ".$this->id; if ($mode == 'supplier') { $sql .= " AND entity IN (".getEntity('supplier_proposal').")"; } else { @@ -3817,21 +3817,21 @@ class Societe extends CommonObject } dol_syslog("getOutstandingProposals", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $outstandingOpened = 0; $outstandingTotal = 0; $outstandingTotalIncTax = 0; - while($obj=$this->db->fetch_object($resql)) { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; + while ($obj = $this->db->fetch_object($resql)) { + $outstandingTotal += $obj->total_ht; + $outstandingTotalIncTax += $obj->total_ttc; if ($obj->fk_statut != 0) // Not a draft { - $outstandingOpened+=$obj->total_ttc; + $outstandingOpened += $obj->total_ttc; } } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } else return array(); @@ -3845,11 +3845,11 @@ class Societe extends CommonObject */ public function getOutstandingOrders($mode = 'customer') { - $table='commande'; + $table = 'commande'; if ($mode == 'supplier') $table = 'commande_fournisseur'; $sql = "SELECT rowid, total_ht, total_ttc, fk_statut FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + $sql .= " WHERE fk_soc = ".$this->id; if ($mode == 'supplier') { $sql .= " AND entity IN (".getEntity('supplier_order').")"; } else { @@ -3857,21 +3857,21 @@ class Societe extends CommonObject } dol_syslog("getOutstandingOrders", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $outstandingOpened = 0; $outstandingTotal = 0; $outstandingTotalIncTax = 0; - while($obj=$this->db->fetch_object($resql)) { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; + while ($obj = $this->db->fetch_object($resql)) { + $outstandingTotal += $obj->total_ht; + $outstandingTotalIncTax += $obj->total_ttc; if ($obj->fk_statut != 0) // Not a draft { - $outstandingOpened+=$obj->total_ttc; + $outstandingOpened += $obj->total_ttc; } } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } else return array(); @@ -3885,7 +3885,7 @@ class Societe extends CommonObject */ public function getOutstandingBills($mode = 'customer') { - $table='facture'; + $table = 'facture'; if ($mode == 'supplier') $table = 'facture_fourn'; /* Accurate value of remain to pay is to sum remaintopay for each invoice @@ -3895,9 +3895,9 @@ class Societe extends CommonObject $alreadypayed=price2num($paiement + $creditnotes + $deposits,'MT'); $remaintopay=price2num($invoice->total_ttc - $paiement - $creditnotes - $deposits,'MT'); */ - if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; - else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; - $sql .= " WHERE fk_soc = ". $this->id; + if ($mode == 'supplier') $sql = "SELECT rowid, total_ht as total_ht, total_ttc, paye, type, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; + else $sql = "SELECT rowid, total as total_ht, total_ttc, paye, fk_statut, close_code FROM ".MAIN_DB_PREFIX.$table." as f"; + $sql .= " WHERE fk_soc = ".$this->id; if ($mode == 'supplier') { $sql .= " AND entity IN (".getEntity('facture_fourn').")"; } else { @@ -3905,7 +3905,7 @@ class Societe extends CommonObject } dol_syslog("getOutstandingBills", LOG_DEBUG); - $resql=$this->db->query($sql); + $resql = $this->db->query($sql); if ($resql) { $outstandingOpened = 0; @@ -3914,22 +3914,22 @@ class Societe extends CommonObject if ($mode == 'supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; - $tmpobject=new FactureFournisseur($this->db); + $tmpobject = new FactureFournisseur($this->db); } else { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; - $tmpobject=new Facture($this->db); + $tmpobject = new Facture($this->db); } - while($obj=$this->db->fetch_object($resql)) { - $tmpobject->id=$obj->rowid; + while ($obj = $this->db->fetch_object($resql)) { + $tmpobject->id = $obj->rowid; if ($obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft - && ! ($obj->fk_statut == $tmpobject::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice + && !($obj->fk_statut == $tmpobject::STATUS_ABANDONED && $obj->close_code == 'replaced') // Not a replaced invoice ) { - $outstandingTotal+= $obj->total_ht; - $outstandingTotalIncTax+= $obj->total_ttc; + $outstandingTotal += $obj->total_ht; + $outstandingTotalIncTax += $obj->total_ttc; } if ($obj->paye == 0 && $obj->fk_statut != $tmpobject::STATUS_DRAFT // Not a draft @@ -3941,17 +3941,17 @@ class Societe extends CommonObject $creditnotes = $tmpobject->getSumCreditNotesUsed(); $deposits = $tmpobject->getSumDepositsUsed(); - $outstandingOpened+=$obj->total_ttc - $paiement - $creditnotes - $deposits; + $outstandingOpened += $obj->total_ttc - $paiement - $creditnotes - $deposits; } //if credit note is converted but not used // TODO Do this also for customer ? - if($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed()) + if ($mode == 'supplier' && $obj->type == FactureFournisseur::TYPE_CREDIT_NOTE && $tmpobject->isCreditNoteUsed()) { - $outstandingOpened-=$tmpobject->getSumFromThisCreditNotesNotUsed(); + $outstandingOpened -= $tmpobject->getSumFromThisCreditNotesNotUsed(); } } - return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' + return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } else { @@ -3982,10 +3982,10 @@ class Societe extends CommonObject global $langs; $langs->load('companies'); - if ($status==0) return $langs->trans("NorProspectNorCustomer"); - elseif ($status==1) return $langs->trans("Customer"); - elseif ($status==2) return $langs->trans("Prospect"); - elseif ($status==3) return $langs->trans("ProspectCustomer"); + if ($status == 0) return $langs->trans("NorProspectNorCustomer"); + elseif ($status == 1) return $langs->trans("Customer"); + elseif ($status == 2) return $langs->trans("Prospect"); + elseif ($status == 3) return $langs->trans("ProspectCustomer"); } @@ -4002,24 +4002,24 @@ class Societe extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { - global $conf,$user,$langs; + global $conf, $user, $langs; - if (! empty($moreparams) && ! empty($moreparams['use_companybankid'])) + if (!empty($moreparams) && !empty($moreparams['use_companybankid'])) { $modelpath = "core/modules/bank/doc/"; include_once DOL_DOCUMENT_ROOT.'/societe/class/companybankaccount.class.php'; $companybankaccount = new CompanyBankAccount($this->db); $result = $companybankaccount->fetch($moreparams['use_companybankid']); - if (! $result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); - $result=$companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + if (!$result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); + $result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } else { // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) + if (!dol_strlen($modele)) { - if (! empty($conf->global->COMPANY_ADDON_PDF)) + if (!empty($conf->global->COMPANY_ADDON_PDF)) { $modele = $conf->global->COMPANY_ADDON_PDF; } @@ -4032,7 +4032,7 @@ class Societe extends CommonObject $modelpath = "core/modules/societe/doc/"; - $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + $result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } return $result; @@ -4052,11 +4052,11 @@ class Societe extends CommonObject */ public function setCategories($categories, $type_categ) { - require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; // Decode type - if (! in_array($type_categ, array(Categorie::TYPE_CUSTOMER, Categorie::TYPE_SUPPLIER))) { - dol_syslog(__METHOD__ . ': Type ' . $type_categ . 'is an unknown company category type. Done nothing.', LOG_ERR); + if (!in_array($type_categ, array(Categorie::TYPE_CUSTOMER, Categorie::TYPE_SUPPLIER))) { + dol_syslog(__METHOD__.': Type '.$type_categ.'is an unknown company category type. Done nothing.', LOG_ERR); return -1; } diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 5636f09b3a4..20721dd28ab 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -39,19 +39,19 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/prelevement/class/bonprelevement.class.php'; require_once DOL_DOCUMENT_ROOT.'/stripe/class/stripe.class.php'; -$langs->loadLangs(array("companies","commercial","banks","bills",'paypal','stripe','withdrawals')); +$langs->loadLangs(array("companies", "commercial", "banks", "bills", 'paypal', 'stripe', 'withdrawals')); // Security check $socid = GETPOST("socid", "int"); -if ($user->socid) $socid=$user->socid; +if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'societe', '', ''); -$id=GETPOST("id", "int"); -$source=GETPOST("source", "alpha"); // source can be a source or a paymentmode -$ribid=GETPOST("ribid", "int"); -$action=GETPOST("action", 'alpha', 3); -$cancel=GETPOST('cancel', 'alpha'); +$id = GETPOST("id", "int"); +$source = GETPOST("source", "alpha"); // source can be a source or a paymentmode +$ribid = GETPOST("ribid", "int"); +$action = GETPOST("action", 'alpha', 3); +$cancel = GETPOST('cancel', 'alpha'); $object = new Societe($db); $object->fetch($socid); @@ -66,22 +66,22 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$hookmanager->initHooks(array('thirdpartybancard','globalcard')); +$hookmanager->initHooks(array('thirdpartybancard', 'globalcard')); -if (! empty($conf->stripe->enabled)) +if (!empty($conf->stripe->enabled)) { $service = 'StripeTest'; $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; $servicestatus = 1; } $stripe = new Stripe($db); - $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account (no network access here) - $stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus); // Get remote Stripe customer 'cus_...' (no network access here) + $stripeacc = $stripe->getStripeAccount($service); // Get Stripe OAuth connect account (no network access here) + $stripecu = $stripe->getStripeCustomerAccount($object->id, $servicestatus); // Get remote Stripe customer 'cus_...' (no network access here) } @@ -92,19 +92,19 @@ if (! empty($conf->stripe->enabled)) if ($cancel) { - $action=''; + $action = ''; } -$parameters=array('id'=>$socid, 'objcanvas'=>$objcanvas); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array('id'=>$socid, 'objcanvas'=>$objcanvas); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { if ($cancel) { - $action=''; - if (! empty($backtopage)) + $action = ''; + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -114,31 +114,31 @@ if (empty($reshook)) if ($action == 'update') { // Modification - if (! GETPOST('label', 'alpha') || ! GETPOST('bank', 'alpha')) + if (!GETPOST('label', 'alpha') || !GETPOST('bank', 'alpha')) { - if (! GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - if (! GETPOST('bank', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - $action='edit'; + if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + if (!GETPOST('bank', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); + $action = 'edit'; $error++; } if ($companybankaccount->needIBAN() == 1) { - if (! GETPOST('iban')) + if (!GETPOST('iban')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); - $action='edit'; + $action = 'edit'; $error++; } - if (! GETPOST('bic')) + if (!GETPOST('bic')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); - $action='edit'; + $action = 'edit'; $error++; } } $companybankaccount->fetch($id); - if (! $error) + if (!$error) { $companybankaccount->socid = $object->id; @@ -168,7 +168,7 @@ if (empty($reshook)) } $result = $companybankaccount->update($user); - if (! $result) + if (!$result) { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } @@ -177,10 +177,10 @@ if (empty($reshook)) // If this account is the default bank account, we disable others if ($companybankaccount->default_rib) { - $companybankaccount->setAsDefault($id); // This will make sure there is only one default rib + $companybankaccount->setAsDefault($id); // This will make sure there is only one default rib } - $url=$_SERVER["PHP_SELF"].'?socid='.$object->id; + $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; } @@ -190,19 +190,19 @@ if (empty($reshook)) if ($action == 'updatecard') { // Modification - if (! GETPOST('label', 'alpha') || ! GETPOST('proprio', 'alpha') || ! GETPOST('cardnumber', 'alpha') || ! GETPOST('exp_date_month', 'alpha') || ! GETPOST('exp_date_year', 'alpha') || ! GETPOST('cvn', 'alpha')) + if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha')) { - if (! GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - if (! GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors'); - if (! GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors'); - if (! (GETPOST('exp_date_month', 'alpha') > 0) || ! (GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors'); - if (! GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors'); - $action='createcard'; + if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors'); + if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors'); + if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors'); + if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors'); + $action = 'createcard'; $error++; } $companypaymentmode->fetch($id); - if (! $error) + if (!$error) { $companypaymentmode->fk_soc = $object->id; @@ -219,7 +219,7 @@ if (empty($reshook)) $companypaymentmode->stripe_card_ref = GETPOST('stripe_card_ref', 'alpha'); $result = $companypaymentmode->update($user); - if (! $result) + if (!$result) { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } @@ -228,10 +228,10 @@ if (empty($reshook)) // If this account is the default bank account, we disable others if ($companypaymentmode->default_rib) { - $companypaymentmode->setAsDefault($id); // This will make sure there is only one default rib + $companypaymentmode->setAsDefault($id); // This will make sure there is only one default rib } - $url=$_SERVER["PHP_SELF"].'?socid='.$object->id; + $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; } @@ -240,17 +240,17 @@ if (empty($reshook)) if ($action == 'add') { - $error=0; + $error = 0; - if (! GETPOST('label', 'alpha') || ! GETPOST('bank', 'alpha')) + if (!GETPOST('label', 'alpha') || !GETPOST('bank', 'alpha')) { - if (! GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - if (! GETPOST('bank', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); - $action='create'; + if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + if (!GETPOST('bank', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BankName")), null, 'errors'); + $action = 'create'; $error++; } - if (! $error) + if (!$error) { // Ajout $companybankaccount = new CompanyBankAccount($db); @@ -273,7 +273,7 @@ if (empty($reshook)) $companybankaccount->frstrecur = GETPOST('frstrecur'); $companybankaccount->rum = GETPOST('rum', 'alpha'); $companybankaccount->date_rum = dol_mktime(0, 0, 0, GETPOST('date_rummonth'), GETPOST('date_rumday'), GETPOST('date_rumyear')); - $companybankaccount->datec = dol_now(); + $companybankaccount->datec = dol_now(); $companybankaccount->status = 1; $db->begin(); @@ -281,28 +281,28 @@ if (empty($reshook)) // This test can be done only once properties were set if ($companybankaccount->needIBAN() == 1) { - if (! GETPOST('iban')) + if (!GETPOST('iban')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("IBAN")), null, 'errors'); - $action='create'; + $action = 'create'; $error++; } - if (! GETPOST('bic')) + if (!GETPOST('bic')) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("BIC")), null, 'errors'); - $action='create'; + $action = 'create'; $error++; } } - if (! $error) + if (!$error) { $result = $companybankaccount->create($user); if ($result < 0) { $error++; setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); - $action='create'; // Force chargement page création + $action = 'create'; // Force chargement page création } if (empty($companybankaccount->rum)) @@ -312,22 +312,22 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { - $result = $companybankaccount->update($user); // This will set the UMR number. + $result = $companybankaccount->update($user); // This will set the UMR number. if ($result < 0) { $error++; setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); - $action='create'; + $action = 'create'; } } - if (! $error) + if (!$error) { $db->commit(); - $url=$_SERVER["PHP_SELF"].'?socid='.$object->id; + $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; } @@ -340,20 +340,20 @@ if (empty($reshook)) if ($action == 'addcard') { - $error=0; + $error = 0; - if (! GETPOST('label', 'alpha') || ! GETPOST('proprio', 'alpha') || ! GETPOST('cardnumber', 'alpha') || ! GETPOST('exp_date_month', 'alpha') || ! GETPOST('exp_date_year', 'alpha') || ! GETPOST('cvn', 'alpha')) + if (!GETPOST('label', 'alpha') || !GETPOST('proprio', 'alpha') || !GETPOST('cardnumber', 'alpha') || !GETPOST('exp_date_month', 'alpha') || !GETPOST('exp_date_year', 'alpha') || !GETPOST('cvn', 'alpha')) { - if (! GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); - if (! GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors'); - if (! GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors'); - if (! (GETPOST('exp_date_month', 'alpha') > 0) || ! (GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors'); - if (! GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors'); - $action='createcard'; + if (!GETPOST('label', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Label")), null, 'errors'); + if (!GETPOST('proprio', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("NameOnCard")), null, 'errors'); + if (!GETPOST('cardnumber', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CardNumber")), null, 'errors'); + if (!(GETPOST('exp_date_month', 'alpha') > 0) || !(GETPOST('exp_date_year', 'alpha') > 0)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("ExpiryDate")), null, 'errors'); + if (!GETPOST('cvn', 'alpha')) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CVN")), null, 'errors'); + $action = 'createcard'; $error++; } - if (! $error) + if (!$error) { // Ajout $companypaymentmode = new CompanyPaymentMode($db); @@ -377,22 +377,22 @@ if (empty($reshook)) $db->begin(); - if (! $error) + if (!$error) { $result = $companypaymentmode->create($user); if ($result < 0) { $error++; setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); - $action='createcard'; // Force chargement page création + $action = 'createcard'; // Force chargement page création } } - if (! $error) + if (!$error) { $db->commit(); - $url=$_SERVER["PHP_SELF"].'?socid='.$object->id; + $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; } @@ -409,7 +409,7 @@ if (empty($reshook)) $res = $companybankaccount->setAsDefault(GETPOST('ribid', 'int')); if ($res) { - $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; + $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; } @@ -422,7 +422,7 @@ if (empty($reshook)) if ($action == 'confirm_deletecard' && GETPOST('confirm', 'alpha') == 'yes') { $companypaymentmode = new CompanyPaymentMode($db); - if ($companypaymentmode->fetch($ribid?$ribid:$id)) + if ($companypaymentmode->fetch($ribid ? $ribid : $id)) { /*if ($companypaymentmode->stripe_card_ref && preg_match('/pm_/', $companypaymentmode->stripe_card_ref)) { @@ -453,7 +453,7 @@ if (empty($reshook)) if ($action == 'confirm_delete' && GETPOST('confirm', 'alpha') == 'yes') { $companybankaccount = new CompanyBankAccount($db); - if ($companybankaccount->fetch($ribid?$ribid:$id)) + if ($companybankaccount->fetch($ribid ? $ribid : $id)) { $result = $companybankaccount->delete($user); if ($result > 0) @@ -473,7 +473,7 @@ if (empty($reshook)) } } - $savid=$id; + $savid = $id; // Actions to build doc if ($action == 'builddocrib') @@ -484,18 +484,18 @@ if (empty($reshook)) 'force_dir_output'=>$conf->societe->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->id) ); $_POST['lang_id'] = GETPOST('lang_idrib'.GETPOST('companybankid', 'int'), 'alpha'); - $_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid', 'int'), 'alpha'); + $_POST['model'] = GETPOST('modelrib'.GETPOST('companybankid', 'int'), 'alpha'); } $id = $socid; $upload_dir = $conf->societe->multidir_output[$object->entity]; - $permissiontoadd=$user->rights->societe->creer; + $permissiontoadd = $user->rights->societe->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; $id = $savid; // Action for stripe - if (! empty($conf->stripe->enabled) && class_exists('Stripe')) + if (!empty($conf->stripe->enabled) && class_exists('Stripe')) { if ($action == 'synccustomertostripe') { @@ -508,7 +508,7 @@ if (empty($reshook)) { // Creation of Stripe customer + update of societe_account $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus, 1); - if (! $cu) + if (!$cu) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); @@ -533,17 +533,17 @@ if (empty($reshook)) { // Get the Stripe customer $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); - if (! $cu) + if (!$cu) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); } - if (! $error) + if (!$error) { // Creation of Stripe card + update of societe_account $card = $stripe->cardStripe($cu, $companypaymentmode, $stripeacc, $servicestatus, 1); - if (! $card) + if (!$card) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); @@ -565,11 +565,11 @@ if (empty($reshook)) $db->begin(); if (empty($newcu)) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; } else { $sql = 'UPDATE '.MAIN_DB_PREFIX."societe_account"; - $sql.= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; - $sql.= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! + $sql .= " SET key_account = '".$db->escape(GETPOST('key_account', 'alpha'))."'"; + $sql .= " WHERE site = 'stripe' AND fk_soc = ".$object->id." AND status = ".$servicestatus." AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! } $resql = $db->query($sql); @@ -590,7 +590,7 @@ if (empty($reshook)) } } - if (! $error) + if (!$error) { $stripecu = $newcu; $db->commit(); @@ -610,16 +610,16 @@ if (empty($reshook)) $db->begin(); if (empty($newsup)) { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; + $sql = "DELETE FROM ".MAIN_DB_PREFIX."oauth_token WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; } else { try { $stripesup = \Stripe\Account::retrieve($db->escape(GETPOST('key_account_supplier', 'alpha'))); $tokenstring['stripe_user_id'] = $stripesup->id; $tokenstring['type'] = $stripesup->type; $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token"; - $sql.= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; - $sql.= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! - } catch(Exception $e) { + $sql .= " SET tokenstring = '".dol_json_encode($tokenstring)."'"; + $sql .= " WHERE fk_soc = ".$object->id." AND service = '".$service."' AND entity = ".$conf->entity; // Keep = here for entity. Only 1 record must be modified ! + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } @@ -635,14 +635,14 @@ if (empty($reshook)) $tokenstring['type'] = $stripesup->type; $sql = "INSERT INTO ".MAIN_DB_PREFIX."oauth_token (service, fk_soc, entity, tokenstring)"; $sql .= " VALUES ('".$service."', ".$object->id.", ".$conf->entity.", '".dol_json_encode($tokenstring)."')"; - } catch(Exception $e) { + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } $resql = $db->query($sql); } - if (! $error) + if (!$error) { $stripesupplieracc = $newsup; $db->commit(); @@ -658,11 +658,11 @@ if (empty($reshook)) try { $companypaymentmode->setAsDefault($id); - $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; + $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; } - catch(Exception $e) + catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); @@ -671,22 +671,22 @@ if (empty($reshook)) elseif ($action == 'setassourcedefault') // Set as default when payment mode defined remotely only { try { - $cu=$stripe->customerStripe($object, $stripeacc, $servicestatus); + $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); if (preg_match('/pm_/', $source)) { - $cu->invoice_settings->default_payment_method = (string) $source; // New + $cu->invoice_settings->default_payment_method = (string) $source; // New } else { - $cu->default_source = (string) $source; // Old + $cu->default_source = (string) $source; // Old } $result = $cu->save(); - $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; + $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; } - catch(Exception $e) + catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); @@ -717,11 +717,11 @@ if (empty($reshook)) } } - $url=DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; + $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; } - catch(Exception $e) + catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); @@ -742,20 +742,20 @@ $formfile = new FormFile($db); llxHeader(); -$head=societe_prepare_head($object); +$head = societe_prepare_head($object); // Show sandbox warning /*if (! empty($conf->paypal->enabled) && (! empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox','alpha'))) // We can force sand box with param 'forcesandbox' { dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode','Paypal'),'','warning'); }*/ -if (! empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) +if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha'))) { dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } // Load Bank account -if (! $id) +if (!$id) { $companybankaccount->fetch(0, $object->id); $companypaymentmode->fetch(0, null, $object->id, 'card'); @@ -765,14 +765,14 @@ else $companybankaccount->fetch($id); $companypaymentmode->fetch($id); } -if (empty($companybankaccount->socid)) $companybankaccount->socid=$object->id; +if (empty($companybankaccount->socid)) $companybankaccount->socid = $object->id; if ($socid && ($action == 'edit' || $action == 'editcard') && $user->rights->societe->creer) { print '
'; print ''; - $actionforadd='update'; - if ($action == 'editcard') $actionforadd='updatecard'; + $actionforadd = 'update'; + if ($action == 'editcard') $actionforadd = 'updatecard'; print ''; print ''; } @@ -780,8 +780,8 @@ if ($socid && ($action == 'create' || $action == 'createcard') && $user->rights- { print ''; print ''; - $actionforadd='add'; - if ($action == 'createcard') $actionforadd='addcard'; + $actionforadd = 'add'; + if ($action == 'createcard') $actionforadd = 'addcard'; print ''; } @@ -794,20 +794,20 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Confirm delete ban if ($action == 'delete') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid?$ribid:$id), $langs->trans("DeleteARib"), $langs->trans("ConfirmDeleteRib", $companybankaccount->getRibLabel()), "confirm_delete", '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid ? $ribid : $id), $langs->trans("DeleteARib"), $langs->trans("ConfirmDeleteRib", $companybankaccount->getRibLabel()), "confirm_delete", '', 0, 1); } // Confirm delete card if ($action == 'deletecard') { - print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid?$ribid:$id), $langs->trans("DeleteACard"), $langs->trans("ConfirmDeleteCard", $companybankaccount->getRibLabel()), "confirm_deletecard", '', 0, 1); + print $form->formconfirm($_SERVER["PHP_SELF"]."?socid=".$object->id."&ribid=".($ribid ? $ribid : $id), $langs->trans("DeleteACard"), $langs->trans("ConfirmDeleteCard", $companybankaccount->getRibLabel()), "confirm_deletecard", '', 0, 1); } $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); - if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field + if (!empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field { print '
'.$langs->trans('Prefix').''.$object->prefix_comm.'
'; print $form->editfieldval("StripeCustomerId", 'key_account', $stripecu, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); - if (! empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account') + if (!empty($conf->stripe->enabled) && $stripecu && $action != 'editkey_account') { - $connect=''; - if (!empty($stripeacc)) $connect=$stripeacc.'/'; - $url='https://dashboard.stripe.com/'.$connect.'test/customers/'.$stripecu; + $connect = ''; + if (!empty($stripeacc)) $connect = $stripeacc.'/'; + $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$stripecu; if ($servicestatus) { - $url='https://dashboard.stripe.com/'.$connect.'customers/'.$stripecu; + $url = 'https://dashboard.stripe.com/'.$connect.'customers/'.$stripecu; } print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; } @@ -879,35 +879,35 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($object->check_codefournisseur() <> 0) print ' ('.$langs->trans("WrongSupplierCode").')'; print '
'; print $form->editfieldkey("StripeConnectAccount", 'key_account_supplier', $stripesupplieracc, $object, $permissiontowrite, 'string', '', 0, 2, 'socid'); print ''; print $form->editfieldval("StripeConnectAccount", 'key_account_supplier', $stripesupplieracc, $object, $permissiontowrite, 'string', '', null, null, '', 2, '', 'socid'); - if (! empty($conf->stripe->enabled) && $stripesupplieracc && $action != 'editkey_account_supplier') + if (!empty($conf->stripe->enabled) && $stripesupplieracc && $action != 'editkey_account_supplier') { - $connect=''; + $connect = ''; - $url='https://dashboard.stripe.com/test/connect/accounts/'.$stripesupplieracc; + $url = 'https://dashboard.stripe.com/test/connect/accounts/'.$stripesupplieracc; if ($servicestatus) { - $url='https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc; + $url = 'https://dashboard.stripe.com/connect/accounts/'.$stripesupplieracc; } print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; } @@ -933,31 +933,31 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'; // List of Stripe payment modes - if (! (empty($conf->stripe->enabled)) && $object->client) + if (!(empty($conf->stripe->enabled)) && $object->client) { - $morehtmlright=''; - if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) + $morehtmlright = ''; + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) { - $morehtmlright.= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=createcard'); + $morehtmlright .= dolGetButtonTitle($langs->trans('Add'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?socid='.$object->id.'&action=createcard'); } - print load_fiche_titre($langs->trans('StripePaymentModes').($stripeacc?' (Stripe connection with StripeConnect account '.$stripeacc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); + print load_fiche_titre($langs->trans('StripePaymentModes').($stripeacc ? ' (Stripe connection with StripeConnect account '.$stripeacc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); $listofsources = array(); if (is_object($stripe)) { try { - $customerstripe=$stripe->customerStripe($object, $stripeacc, $servicestatus); + $customerstripe = $stripe->customerStripe($object, $stripeacc, $servicestatus); if ($customerstripe->id) { // When using the Charge API architecture if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { - $listofsources=$customerstripe->sources->data; + $listofsources = $customerstripe->sources->data; } else { $service = 'StripeTest'; $servicestatus = 0; - if (! empty($conf->global->STRIPE_LIVE) && ! GETPOST('forcesandbox', 'alpha')) + if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) { $service = 'StripeLive'; $servicestatus = 1; @@ -976,7 +976,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $listofsources = $paymentmethodobjs->data; } - catch(Exception $e) + catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); @@ -1006,8 +1006,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print '
'.$langs->trans('Note').''.$langs->trans('DateModification').'
'; @@ -1054,12 +1054,12 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print $companypaymentmodetemp->stripe_card_ref; if ($companypaymentmodetemp->stripe_card_ref) { - $connect=''; - if (!empty($stripeacc)) $connect=$stripeacc.'/'; - $url='https://dashboard.stripe.com/'.$connect.'test/search?query='.$companypaymentmodetemp->stripe_card_ref; + $connect = ''; + if (!empty($stripeacc)) $connect = $stripeacc.'/'; + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$companypaymentmodetemp->stripe_card_ref; if ($servicestatus) { - $url='https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$companypaymentmodetemp->stripe_card_ref; } print ' '.img_picto($langs->trans('ShowInStripe'), 'globe').''; } @@ -1073,8 +1073,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; if ($companypaymentmodetemp->country_code) { - $img=picto_from_langcode($companypaymentmodetemp->country_code); - print $img?$img.' ':''; + $img = picto_from_langcode($companypaymentmodetemp->country_code); + print $img ? $img.' ' : ''; print getCountry($companypaymentmodetemp->country_code, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; @@ -1083,7 +1083,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; if (empty($companypaymentmodetemp->default_rib)) { - print ''; + print ''; print img_picto($langs->trans("Default"), 'off'); print ''; } else { @@ -1098,8 +1098,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print dol_print_date($companypaymentmodetemp->tms, 'dayhour'); print ''; @@ -1110,11 +1110,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''.$langs->trans("CreateCardOnStripe").''; } - print ''; + print ''; print img_picto($langs->trans("Modify"), 'edit'); print ''; print ' '; - print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& + print ''; // source='.$companypaymentmodetemp->stripe_card_ref.'& print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1133,113 +1133,113 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($listofsources as $src) { - if (! empty($arrayofstripecard[$src->id])) continue; // Already in previous list + if (!empty($arrayofstripecard[$src->id])) continue; // Already in previous list $nbremote++; print '
'; print ''; - $connect=''; + $connect = ''; print $src->id; - if (!empty($stripeacc)) $connect=$stripeacc.'/'; + if (!empty($stripeacc)) $connect = $stripeacc.'/'; //$url='https://dashboard.stripe.com/'.$connect.'test/sources/'.$src->id; - $url='https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'test/search?query='.$src->id; if ($servicestatus) { //$url='https://dashboard.stripe.com/'.$connect.'sources/'.$src->id; - $url='https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; + $url = 'https://dashboard.stripe.com/'.$connect.'search?query='.$src->id; } print " ".img_picto($langs->trans('ShowInStripe'), 'globe').""; print ''; - if ($src->object=='card') + if ($src->object == 'card') { print img_credit_card($src->brand); } - elseif ($src->object=='source' && $src->type=='card') + elseif ($src->object == 'source' && $src->type == 'card') { print img_credit_card($src->card->brand); } - elseif ($src->object=='source' && $src->type=='sepa_debit') + elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print ''; } - elseif ($src->object=='payment_method' && $src->type=='card') + elseif ($src->object == 'payment_method' && $src->type == 'card') { print img_credit_card($src->card->brand); } - elseif ($src->object=='payment_method' && $src->type=='sepa_debit') + elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print ''; } print''; - if ($src->object=='card') + if ($src->object == 'card') { print '....'.$src->last4.' - '.$src->exp_month.'/'.$src->exp_year.''; print ''; if ($src->country) { - $img=picto_from_langcode($src->country); - print $img?$img.' ':''; + $img = picto_from_langcode($src->country); + print $img ? $img.' ' : ''; print getCountry($src->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - elseif ($src->object=='source' && $src->type=='card') + elseif ($src->object == 'source' && $src->type == 'card') { print $src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '
'; if ($src->card->country) { - $img=picto_from_langcode($src->card->country); - print $img?$img.' ':''; + $img = picto_from_langcode($src->card->country); + print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - elseif ($src->object=='source' && $src->type=='sepa_debit') + elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print 'info sepa'; print ''; if ($src->sepa_debit->country) { - $img=picto_from_langcode($src->sepa_debit->country); - print $img?$img.' ':''; + $img = picto_from_langcode($src->sepa_debit->country); + print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - elseif ($src->object=='payment_method' && $src->type=='card') + elseif ($src->object == 'payment_method' && $src->type == 'card') { print $src->billing_details->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print '
'; if ($src->card->country) { - $img=picto_from_langcode($src->card->country); - print $img?$img.' ':''; + $img = picto_from_langcode($src->card->country); + print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } - elseif ($src->object=='payment_method' && $src->type=='sepa_debit') + elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print 'info sepa'; print ''; if ($src->sepa_debit->country) { - $img=picto_from_langcode($src->sepa_debit->country); - print $img?$img.' ':''; + $img = picto_from_langcode($src->sepa_debit->country); + print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; @@ -1251,9 +1251,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // Default print ''; if ((empty($customerstripe->invoice_settings) && $customerstripe->default_source != $src->id) || - (! empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) + (!empty($customerstripe->invoice_settings) && $customerstripe->invoice_settings->default_payment_method != $src->id)) { - print ''; + print ''; print img_picto($langs->trans("Default"), 'off'); print ''; } else { @@ -1269,14 +1269,14 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; print ''; if ($user->rights->societe->creer) { - print ''; + print ''; print img_picto($langs->trans("Delete"), 'delete'); print ''; } @@ -1288,8 +1288,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($nbremote == 0 && $nblocal == 0) { - $colspan=8; - if (! empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) $colspan++; + $colspan = 8; + if (!empty($conf->global->STRIPE_ALLOW_LOCAL_CARD)) $colspan++; print '
'.$langs->trans("None").'
"; @@ -1298,9 +1298,9 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } // List of Stripe payment modes - if (! empty($conf->stripe->enabled) && ! empty($conf->stripeconnect->enabled) && $object->fournisseur && ! empty($stripesupplieracc)) + if (!empty($conf->stripe->enabled) && !empty($conf->stripeconnect->enabled) && $object->fournisseur && !empty($stripesupplieracc)) { - print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc?' (Stripe connection with StripeConnect account '.$stripesupplieracc.')':' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); + print load_fiche_titre($langs->trans('StripeBalance').($stripesupplieracc ? ' (Stripe connection with StripeConnect account '.$stripesupplieracc.')' : ' (Stripe connection with keys from Stripe module setup)'), $morehtmlright, ''); $balance = \Stripe\Balance::retrieve(array("stripe_account" => $stripesupplieracc)); print ''."\n"; print ''; @@ -1315,13 +1315,13 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($balance->available as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->available=$cpt->amount / 100; + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (!in_array($cpt->currency, $arrayzerounitcurrency)) { + $currencybalance[$cpt->currency]->available = $cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->available=$cpt->amount; + $currencybalance[$cpt->currency]->available = $cpt->amount; } - $currencybalance[$cpt->currency]->currency=$cpt->currency; + $currencybalance[$cpt->currency]->currency = $cpt->currency; } } @@ -1329,11 +1329,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($balance->pending as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount / 100; + $arrayzerounitcurrency = array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (!in_array($cpt->currency, $arrayzerounitcurrency)) { + $currencybalance[$cpt->currency]->pending = $currencybalance[$cpt->currency]->available + $cpt->amount / 100; } else { - $currencybalance[$cpt->currency]->pending=$currencybalance[$cpt->currency]->available+$cpt->amount; + $currencybalance[$cpt->currency]->pending = $currencybalance[$cpt->currency]->available + $cpt->amount; } } } @@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''; + print ''; } } @@ -1368,7 +1368,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print_liste_field_titre("RIB"); print_liste_field_titre("IBAN"); print_liste_field_titre("BIC"); - if (! empty($conf->prelevement->enabled)) + if (!empty($conf->prelevement->enabled)) { print_liste_field_titre("RUM"); print_liste_field_titre("DateRUM"); @@ -1388,7 +1388,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; // Account number print ''; // IBAN print ''; // BIC print ''; - if (! empty($conf->prelevement->enabled)) + if (!empty($conf->prelevement->enabled)) { // RUM //print ''; @@ -1460,54 +1460,54 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''; @@ -1533,8 +1533,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (count($rib_list) == 0) { - $colspan=9; - if (! empty($conf->prelevement->enabled)) $colspan+=2; + $colspan = 9; + if (!empty($conf->prelevement->enabled)) $colspan += 2; print ''; } @@ -1555,15 +1555,15 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' /* * Documents generes */ - $filedir=$conf->societe->multidir_output[$object->entity].'/'.$object->id; - $urlsource=$_SERVER["PHP_SELF"]."?socid=".$object->id; - $genallowed=$user->rights->societe->lire; - $delallowed=$user->rights->societe->creer; + $filedir = $conf->societe->multidir_output[$object->entity].'/'.$object->id; + $urlsource = $_SERVER["PHP_SELF"]."?socid=".$object->id; + $genallowed = $user->rights->societe->lire; + $delallowed = $user->rights->societe->creer; print $formfile->showdocuments('company', $object->id, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 0, 0, 0, 28, 0, 'entity='.$object->entity, 0, '', $object->default_lang); // Show direct download link - if (! empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) + if (!empty($conf->global->BANK_ACCOUNT_ALLOW_EXTERNAL_DOWNLOAD)) { $companybankaccounttemp = new CompanyBankAccount($db); $companypaymentmodetemp = new CompanyPaymentMode($db); @@ -1615,7 +1615,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -1630,7 +1630,7 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) // Show fields of bank account foreach ($companybankaccount->getFieldsToShow(1) as $val) { - $require=false; + $require = false; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; @@ -1651,15 +1651,15 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) $name = 'iban'; $size = 30; $content = $companybankaccount->iban; - if ($companybankaccount->needIBAN()) $require=true; + if ($companybankaccount->needIBAN()) $require = true; } elseif ($val == 'BIC') { $name = 'bic'; $size = 12; $content = $companybankaccount->bic; - if ($companybankaccount->needIBAN()) $require=true; + if ($companybankaccount->needIBAN()) $require = true; } - print '
'.$langs->trans($val).''; + print ''.$langs->trans($val).''; print ''; print ''; } @@ -1693,11 +1693,11 @@ if ($socid && $action == 'edit' && $user->rights->societe->creer) print ''; print ''; - print ''; + print ''; print ''; print '
'.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'
'.$langs->trans("Currency".strtoupper($cpt->currency)).''.price($cpt->available, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).''.price($cpt->available + $cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt->currency)).'
'.$rib->bank.''; - $string=''; + $string = ''; foreach ($rib->getFieldsToShow() as $val) { if ($val == 'BankCode') { $string .= $rib->code_banque.' '; @@ -1406,11 +1406,11 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' // $string .= $rib->iban.' ';*/ //} } - if (! empty($rib->label) && $rib->number) { - if (! checkBanForAccount($rib)) { - $string.= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning'); + if (!empty($rib->label) && $rib->number) { + if (!checkBanForAccount($rib)) { + $string .= ' '.img_picto($langs->trans("ValueIsNotValid"), 'warning'); } else { - $string.= ' '.img_picto($langs->trans("ValueIsValid"), 'info'); + $string .= ' '.img_picto($langs->trans("ValueIsValid"), 'info'); } } @@ -1418,22 +1418,22 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' print ''.$rib->iban; - if (! empty($rib->iban)) { - if (! checkIbanForAccount($rib)) { + if (!empty($rib->iban)) { + if (!checkIbanForAccount($rib)) { print ' '.img_picto($langs->trans("IbanNotValid"), 'warning'); } } print ''.$rib->bic; - if (! empty($rib->bic)) { - if (! checkSwiftForAccount($rib)) { + if (!empty($rib->bic)) { + if (!checkSwiftForAccount($rib)) { print ' '.img_picto($langs->trans("SwiftNotValid"), 'warning'); } } print ''.$prelevement->buildRumNumber($object->code_client, $rib->datec, $rib->id).''; $buttonlabel = $langs->trans("BuildDoc"); - $forname='builddocrib'.$rib->id; + $forname = 'builddocrib'.$rib->id; include_once DOL_DOCUMENT_ROOT.'/core/modules/bank/modules_bank.php'; - $modellist=ModeleBankAccountDoc::liste_modeles($db); + $modellist = ModeleBankAccountDoc::liste_modeles($db); $out = ''; if (is_array($modellist) && count($modellist)) { - $out.= ''; - $out.= ''; - $out.= ''; - $out.= ''; - $out.= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; if (is_array($modellist) && count($modellist) == 1) // If there is only one element { - $arraykeys=array_keys($modellist); - $modelselected=$arraykeys[0]; + $arraykeys = array_keys($modellist); + $modelselected = $arraykeys[0]; } - if (! empty($conf->global->BANKADDON_PDF)) $modelselected = $conf->global->BANKADDON_PDF; + if (!empty($conf->global->BANKADDON_PDF)) $modelselected = $conf->global->BANKADDON_PDF; - $out.= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); - $out.= ajax_combobox('modelrib'.$rib->id); + $out .= $form->selectarray('modelrib'.$rib->id, $modellist, $modelselected, $showempty, 0, 0, '', 0, 0, 0, '', 'minwidth100'); + $out .= ajax_combobox('modelrib'.$rib->id); // Language code (if multilang) if ($conf->global->MAIN_MULTILANGS) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; - $formadmin=new FormAdmin($db); - $defaultlang=$codelang?$codelang:$langs->getDefaultLang(); - $morecss='maxwidth150'; - if ($conf->browser->layout == 'phone') $morecss='maxwidth100'; - $out.= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); + $formadmin = new FormAdmin($db); + $defaultlang = $codelang ? $codelang : $langs->getDefaultLang(); + $morecss = 'maxwidth150'; + if ($conf->browser->layout == 'phone') $morecss = 'maxwidth100'; + $out .= $formadmin->select_language($defaultlang, 'lang_idrib'.$rib->id, 0, 0, 0, 0, 0, $morecss); } // Button $genbutton = 'dol_no_mouse_hover) && $modulepart != 'unpaid') + $genbutton .= ' type="submit" value="'.$buttonlabel.'"'; + if (!$allowgenifempty && !is_array($modellist) && empty($modellist)) $genbutton .= ' disabled'; + $genbutton .= '>'; + if ($allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') { $langs->load("errors"); - $genbutton.= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); + $genbutton .= ' '.img_warning($langs->transnoentitiesnoconv("WarningNoDocumentModelActivated")); } - if (! $allowgenifempty && ! is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton=''; - if (empty($modellist) && ! $showempty && $modulepart != 'unpaid') $genbutton=''; - $out.= $genbutton; - $out.= ''; + if (!$allowgenifempty && !is_array($modellist) && empty($modellist) && empty($conf->dol_no_mouse_hover) && $modulepart != 'unpaid') $genbutton = ''; + if (empty($modellist) && !$showempty && $modulepart != 'unpaid') $genbutton = ''; + $out .= $genbutton; + $out .= ''; } print $out; print '
'.$langs->trans("NoBANRecord").'
'.$langs->trans("DateRUM").''.$form->selectDate(GETPOST('date_rum')?GETPOST('date_rum'):$companybankaccount->date_rum, 'date_rum', 0, 0, 1, 'date_rum').'
'.$form->selectDate(GETPOST('date_rum') ?GETPOST('date_rum') : $companybankaccount->date_rum, 'date_rum', 0, 0, 1, 'date_rum').'
'.$langs->trans("WithdrawMode").''; $tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR")); - print $form->selectarray("frstrecur", $tblArraychoice, dol_escape_htmltag(GETPOST('frstrecur', 'alpha')?GETPOST('frstrecur', 'alpha'):$companybankaccount->frstrecur), 0); + print $form->selectarray("frstrecur", $tblArraychoice, dol_escape_htmltag(GETPOST('frstrecur', 'alpha') ?GETPOST('frstrecur', 'alpha') : $companybankaccount->frstrecur), 0); print '
'; @@ -1721,7 +1721,7 @@ if ($socid && $action == 'editcard' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -1769,7 +1769,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; @@ -1784,7 +1784,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) // Show fields of bank account foreach ($companybankaccount->getFieldsToShow(1) as $val) { - $require=false; + $require = false; if ($val == 'BankCode') { $name = 'code_banque'; $size = 8; @@ -1800,14 +1800,14 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) } elseif ($val == 'IBAN') { $name = 'iban'; $size = 30; - if ($companybankaccount->needIBAN()) $require=true; + if ($companybankaccount->needIBAN()) $require = true; } elseif ($val == 'BIC') { $name = 'bic'; $size = 12; - if ($companybankaccount->needIBAN()) $require=true; + if ($companybankaccount->needIBAN()) $require = true; } - print ''.$langs->trans($val).''; + print ''.$langs->trans($val).''; print ''; print ''; } @@ -1843,7 +1843,7 @@ if ($socid && $action == 'create' && $user->rights->societe->creer) print ''.$langs->trans("WithdrawMode").''; $tblArraychoice = array("FRST" => $langs->trans("FRST"), "RECUR" => $langs->trans("RECUR")); - print $form->selectarray("frstrecur", $tblArraychoice, (isset($_POST['frstrecur'])?GETPOST('frstrecur'):'FRST'), 0); + print $form->selectarray("frstrecur", $tblArraychoice, (isset($_POST['frstrecur']) ?GETPOST('frstrecur') : 'FRST'), 0); print ''; print ''; @@ -1869,7 +1869,7 @@ if ($socid && $action == 'createcard' && $user->rights->societe->creer) $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'socid', $linkback, ($user->socid?0:1), 'rowid', 'nom'); + dol_banner_tab($object, 'socid', $linkback, ($user->socid ? 0 : 1), 'rowid', 'nom'); print '
'; From d10be4f1699ba8f3aa8978ed5c53160e5aacd9da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 18:40:24 +0100 Subject: [PATCH 31/36] FIX #12409 FIX #12408 --- htdocs/projet/tasks/time.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index fa7efdfa2a5..54736ebc40f 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -390,7 +390,7 @@ if ($action == 'confirm_generateinvoice') // Define qty per hour $qtyhour = round($value['timespent'] / 3600, 2); - $qtyhourtext = convertSecondToTime($value['timespent']); + $qtyhourtext = convertSecondToTime($value['timespent'], 'all', $conf->global->MAIN_DURATION_OF_WORKDAY); // If no unit price known if (empty($pu_ht)) From cc70ffd1b36dc8b25398d7bfd9361570d1cb4ac8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 18:47:35 +0100 Subject: [PATCH 32/36] Update list.php --- htdocs/societe/list.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index a62dde1d79d..da5d4c268fd 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -232,9 +232,7 @@ if ($action == "change") // Change customer for TakePOS $place = (GETPOST('place', 'int') > 0 ? GETPOST('place', 'int') : 0); // $place is id of table for Ba or Restaurant // Check if draft invoice already exists, if not create it - $sql = 'SELECT * FROM '.MAIN_DB_PREFIX.'facture - where ref=\'(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')\' - AND entity IN ('.getEntity('invoice').')'; + $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")' AND entity IN (".getEntity('invoice').")"; $result = $db->query($sql); $num_lines = $db->num_rows($result); if ($num_lines==0) From a14042e4b21b04566dedde76830d26f2c1ac6d9f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 18:48:39 +0100 Subject: [PATCH 33/36] Update list.php --- htdocs/societe/list.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index da5d4c268fd..504ccb37a25 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -239,7 +239,8 @@ if ($action == "change") // Change customer for TakePOS { require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; $invoice = new Facture($db); - $invoice->socid = $conf->global->{'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]}; + $constforthirdpartyid = 'CASHDESK_ID_THIRDPARTY'.$_SESSION["takeposterminal"]; + $invoice->socid = $conf->global->$constforthirdpartyid; $invoice->date = dol_now(); $invoice->module_source = 'takepos'; $invoice->pos_source = $_SESSION["takeposterminal"]; From 366dfc0e5cfc01b2747cb5180b7c27e2584e24ee Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 13 Nov 2019 18:15:19 +0000 Subject: [PATCH 34/36] Fixing style errors. --- htdocs/societe/paymentmodes.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 25d38692ee0..fc9068b8127 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1318,10 +1318,10 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); if (! in_array($cpt->currency, $arrayzerounitcurrency)) { $currencybalance[$cpt->currency]['available'] = $cpt->amount / 100; - } else { - $currencybalance[$cpt->currency]['available'] = $cpt->amount; - } - $currencybalance[$cpt->currency]['currency'] = $cpt->currency; + } else { + $currencybalance[$cpt->currency]['available'] = $cpt->amount; + } + $currencybalance[$cpt->currency]['currency'] = $cpt->currency; } } @@ -1329,8 +1329,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($balance->pending as $cpt) { - $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) { + $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); + if (! in_array($cpt->currency, $arrayzerounitcurrency)) { $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount / 100; } else { $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount; @@ -1342,7 +1342,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { foreach ($currencybalance as $cpt) { - print ''.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''; + print ''.$langs->trans("Currency".strtoupper($cpt['currency'])).''.price($cpt['available'], 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''.price($cpt['available']+$cpt->pending, 0, '', 1, - 1, - 1, strtoupper($cpt['currency'])).''; } } From 16c50c212cdd5ca88c7068c1af60cc14cd0f1817 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 19:16:10 +0100 Subject: [PATCH 35/36] Update paymentmodes.php --- htdocs/societe/paymentmodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index fc9068b8127..23a7c30f77e 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -1316,7 +1316,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' foreach ($balance->available as $cpt) { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) { + if (!in_array($cpt->currency, $arrayzerounitcurrency)) { $currencybalance[$cpt->currency]['available'] = $cpt->amount / 100; } else { $currencybalance[$cpt->currency]['available'] = $cpt->amount; @@ -1330,7 +1330,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' foreach ($balance->pending as $cpt) { $arrayzerounitcurrency=array('BIF', 'CLP', 'DJF', 'GNF', 'JPY', 'KMF', 'KRW', 'MGA', 'PYG', 'RWF', 'VND', 'VUV', 'XAF', 'XOF', 'XPF'); - if (! in_array($cpt->currency, $arrayzerounitcurrency)) { + if (!in_array($cpt->currency, $arrayzerounitcurrency)) { $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount / 100; } else { $currencybalance[$cpt->currency]['pending'] = $currencybalance[$cpt->currency]['available']+$cpt->amount; From 545c2207b27338e329b4729502212a2244658703 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 13 Nov 2019 19:32:27 +0100 Subject: [PATCH 36/36] Fix on exact date when we don't know the second is useless --- htdocs/core/tpl/extrafields_list_search_input.tpl.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index fb0a0dea3aa..141ae5ac34d 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -34,12 +34,8 @@ if (! empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_ } elseif (in_array($typeofextrafield, array('datetime','timestamp'))) { - // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') - $morecss=''; - if ($typeofextrafield == 'sellist') $morecss='maxwidth200'; - $keyprefix=$search_options_pattern; - if (substr($search_options_pattern, -8) === 'options_') $keyprefix = substr($search_options_pattern, 0, -8); - echo $extrafields->showInputField($key, $search_array_options[$search_options_pattern.$tmpkey], '', '', $keyprefix, $morecss); + // TODO + // Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes } else {