diff --git a/.mailmap b/.mailmap index 436b557ee63..ae4b0eb7146 100644 --- a/.mailmap +++ b/.mailmap @@ -21,9 +21,9 @@ Florian Henry FHenry Florian HENRY Florian Henry FHenry Florian Henry HENRY Florian -Alexandre Spangaro aspangaro -Alexandre Spangaro Spangaro Alexandre -Alexandre Spangaro Alexandre SPANGARO +Alexandre Spangaro aspangaro +Alexandre Spangaro Spangaro Alexandre +Alexandre Spangaro Alexandre SPANGARO Raphaël Doursenaud Raphaël Doursenaud Philippe Grand Grand Philippe Philippe Grand Philippe GRAND diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index b7c5ecb6230..18068087804 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -11,9 +11,9 @@ LaunchProgram=Launch %1 AssocFileExtension=&Associate %1 with the %2 file extension AssocingFileExtension=Associating %1 with the %2 file extension... -YouWillInstallDoliWamp=You will install or upgrade DoliWamp (Apache+Mysql+PHP+Dolibarr) on your computer. -ThisAssistantInstallOrUpgrade=This assistant installs or upgrades Dolibarr ERP-CRM and all required third party softwares (Apache, Mysql and PHP) optimized for a Dolibarr usage. -IfYouHaveTechnicalKnowledge=If you are looking for a hosted version in the Cloud, you should look at https://saas.dolibarr.org. If you have technical knowledge and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing Apache, Mysql and PHP installation. +YouWillInstallDoliWamp=You will install or upgrade DoliWamp (so Dolibarr + all required third party softwares like Apache, Mysql and PHP) on your computer. +ThisAssistantInstallOrUpgrade=WARNING: Using an ERP CRM installed on a local computer can be dangerous: if your computer break down, you can lose all your data. Do this if you are ready to manage backup yourself seriously. If not, use an installation in Saas instead (see https://saas.dolibarr.org). +IfYouHaveTechnicalKnowledge=Moreover, if you have technical knowledges and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing server with Apache, Mysql and PHP. ButIfYouLook=But if you look for an automatic setup on your local computer, you''re on the good way... DoYouWantToStart=Do you want to start installation/upgrade process ? @@ -32,7 +32,7 @@ PortAlreadyInUse=Port %1 seems to be already in use. You should cancel to go bac FirefoxDetected=Firefox has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? ChromeDetected=Chrome has been detected on your computer. Would you like to use it as the default browser for Dolibarr ? -ChooseDefaultBrowser=Please choose your default browser. If you are not sure, just click Open : +ChooseDefaultBrowser=Please choose your default browser (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). If you are not sure, just click Open : LaunchNow=Launch Dolibarr now @@ -43,5 +43,5 @@ DoliWampWillStartApacheMysql=DoliWamp installer will now start or restart Apache OldVersionFoundAndMoveInNew=An old database version has been found and moved to be used by new Dolibarr version OldVersionFoundButFailedToMoveInNew=An old database version has been found but could not be moved to be used with new Dolibarr version -DLLMissing=The "Visual C++ Redistributable for Visual Studio 2012" component is missing. Please install the 32-bit version (vcredit_x86.exe) first from https://www.microsoft.com/en-us/download/details.aspx?id=30679 and restart DoliWamp installation/upgrade. +DLLMissing=Your Windows installation is missing The "Micrsoft Visual C++ Redistributable for Visual Studio 2012" component. Please install the 32-bit version (vcredist_x86.exe) first (you can find it at https://www.microsoft.com/en-us/download/) and restart DoliWamp installation/upgrade after. ContinueAnyway=Continue anyway (install process may fails without this prerequisite) diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 8c7cff0bb42..2e93a44081e 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -11,10 +11,10 @@ LaunchProgram=Ex AssocFileExtension=&Associer %1 avec l'extension de fichier %2 AssocingFileExtension=Associe %1 avec l'extension de fichier %2... -YouWillInstallDoliWamp=Vous allez installer ou mettre jour DoliWamp (Apache+Mysql+PHP+Dolibarr) sur votre ordinateur. -ThisAssistantInstallOrUpgrade=Cet assistant installe ou met jour Dolibarr ERP-CRM et tous ses composants prrequis (Apache, Mysql et PHP) optimiss pour une utilisation de Dolibarr. -IfYouHaveTechnicalKnowledge=Si vous cherchez un hbergement dans le Cloud, aller voir sur https://saas.dolibarr.org. Si vous avez des comptences techniques et voulez grer vous mme Apache, Mysql et PHP, vous ne devriez pas utiliser cet assistant mais faire plutt une installation manuelle de Dolibarr sur votre socle Apache, Mysql et PHP existant. -ButIfYouLook=Mais si vous recherchez une installation automatise locale sur votre ordinateur, cl en main, vous tes sur la bonne voie... +YouWillInstallDoliWamp=Vous allez installer ou mettre jour DoliWamp sur votre ordinateur (donc Dolibarr + tous ses composants prrequis comme Apache, Mysql et PHP). +ThisAssistantInstallOrUpgrade=AVERTISSEMENT: L'utilisation d'un ERP CRM install sur un ordinateur local peut tre dangereuse: si votre ordinateur tombe en panne, vous pouvez perdre toutes vos donnes. Faites-le si vous tes prt grer les sauvegardes vous-mme srieusement. Sinon, utilisez plutt une installation en Saas (voir https://saas.dolibarr.org). +IfYouHaveTechnicalKnowledge=De plus, si vous avez des comptences techniques et envisagez de partager votre Apache, Mysql et PHP avec d''autres applications que Dolibarr, vous ne devriez pas utiliser cet assistant mais faire plutt une installation manuelle de Dolibarr sur un serveur existant quip de Apache, Mysql et PHP. +ButIfYouLook=Mais si vous recherchez une installation cl en main automatise sur une poste local, vous tes sur la bonne voie... DoYouWantToStart=Voulez-vous dmarrer le processus d'installation/mise jour ? TechnicalParameters=Paramtres techniques @@ -33,7 +33,7 @@ PortAlreadyInUse=Le port %1 semble d FirefoxDetected=Firefox a t dtect sur votre ordinateur. Voulez-vous en faire votre navigateur par dfaut pour Dolibarr ? ChromeDetected=Chrome a t dtect sur votre ordinateur. Voulez-vous en faire votre navigateur par dfaut pour Dolibarr ? -ChooseDefaultBrowser=Merci de choisir votre navigateur par dfaut. Si vous n'tes pas sr, cliquez simplement sur Ouvrir : +ChooseDefaultBrowser=Merci de choisir votre navigateur par dfaut (iexplore.exe, firefox.exe, chrome.exe, MicrosoftEdge.exe...). Si vous n'tes pas sr, cliquez simplement sur Ouvrir : LaunchNow=Lancer Dolibarr maintenant @@ -44,3 +44,5 @@ DoliWampWillStartApacheMysql=L'installeur DoliWamp va maintenant d OldVersionFoundAndMoveInNew=Une ancienne version de base a t trouve et dplace pour fonctionner avec la nouvelle version de Dolibarr. OldVersionFoundButFailedToMoveInNew=Une ancienne version de base a t trouve mais ne peut tre dplace pour tre utilise avec la nouvelle version de Dolibarr. +DLLMissing=L'installation de votre Windows est incomplte. Il manque le composant "Micrsoft Visual C++ Redistributable for Visual Studio 2012". Installer la version 32-bit (vcredist_x86.exe) d'abord (vous pourrez le trouver https://www.microsoft.com/fr-fr/download/) puis relancer l'installation de DoliWamp aprs. +ContinueAnyway=Continuer malgr tout (le process d'installaton chouera) diff --git a/build/exe/doliwamp/rundoliadmin.bat.install b/build/exe/doliwamp/rundoliadmin.bat.install index aa882b2335c..dcd113f4ab5 100644 --- a/build/exe/doliwamp/rundoliadmin.bat.install +++ b/build/exe/doliwamp/rundoliadmin.bat.install @@ -3,4 +3,4 @@ REM Launch Dolibarr Admin center REM ---------------------------- REM Go to admin center page -start "DoliWamp admin" "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/ +start "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/ diff --git a/build/exe/doliwamp/rundolihelp.bat.install b/build/exe/doliwamp/rundolihelp.bat.install index d0adbe3b4d7..eed5346de9f 100644 --- a/build/exe/doliwamp/rundolihelp.bat.install +++ b/build/exe/doliwamp/rundolihelp.bat.install @@ -4,4 +4,4 @@ REM --------------------------- REM Go to help center page echo Please wait... -start "Dolibarr Help center" "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/support/ +start "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/support/ diff --git a/build/exe/doliwamp/rundoliwamp.bat.install b/build/exe/doliwamp/rundoliwamp.bat.install index cbda6c86aba..c576c5d240b 100644 --- a/build/exe/doliwamp/rundoliwamp.bat.install +++ b/build/exe/doliwamp/rundoliwamp.bat.install @@ -3,7 +3,7 @@ REM Launch Dolibarr REM --------------- REM If no lock file, we call install process -IF NOT EXIST dolibarr_documents\install.lock start "Dolibarr" "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/install/ +IF NOT EXIST dolibarr_documents\install.lock start "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/install/ REM If lock file exists, we call home page -IF EXIST dolibarr_documents\install.lock start "Dolibarr" "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/ +IF EXIST dolibarr_documents\install.lock start "WAMPBROWSER" http://localhost:WAMPAPACHEPORT/dolibarr/ diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index f8e0ba23011..4e6669de03c 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -80,7 +80,7 @@ if ($idobject > 0) dol_print_error($db,$obj->error); } } -else if ($obj->error == 'ErrorLoginAlreadyExists') +elseif ($obj->error == 'ErrorLoginAlreadyExists') { print "User with login ".$obj->login." already exists\n"; } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 5e53fa752a2..e0adb2a256e 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -220,4 +220,3 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) dol_print_error($db,$object->error); } } - diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 393d5c5ce3d..f1b6c25e92a 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -96,5 +96,3 @@ for ($s = 0 ; $s < GEN_NUMBER_PRODUIT ; $s++) if ($ret < 0) print "Error $ret - ".$produit->error."\n"; else print " OK with ref ".$produit->ref."\n"; } - - diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 7f2c3e2055d..3744abeae7c 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -127,5 +127,3 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++) print "Error: ".$soc->error."\n"; } } - - diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 2bdf200225b..63a10d84bc5 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -275,4 +275,3 @@ else } $db->close(); - diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 879d791b8e9..b5c1ae5b6a9 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -65,7 +65,7 @@ 0 - + @@ -392,6 +401,7 @@ + @@ -419,4 +429,8 @@ + + + + diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 123b7f6157d..569bcc9dfd4 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -50,7 +50,7 @@ class autoTranslator * @param string $_apikey Api key * @return void */ - function __construct($_destlang,$_refLang,$_langDir,$_limittofile,$_apikey) + function __construct($_destlang, $_refLang, $_langDir, $_limittofile, $_apikey) { // Set enviorment variables @@ -156,7 +156,7 @@ class autoTranslator * @param string $my_destlang Target language code * @return void */ - private function updateTranslationFile($destPath,$file,$my_destlang) + private function updateTranslationFile($destPath, $file, $my_destlang) { $this->_time_end = date('Y-m-d H:i:s'); @@ -183,7 +183,7 @@ class autoTranslator * @param string $my_destlang Target language code * @return void */ - private function createTranslationFile($path,$my_destlang) + private function createTranslationFile($path, $my_destlang) { $fp = fopen($path, 'w+'); fwrite($fp, "/*\n"); @@ -205,7 +205,7 @@ class autoTranslator * @param string $my_destlang Language code (ie: fr_FR) * @return int 0=Nothing translated, 1=Record translated */ - private function translateFileLine($content,$file,$key,$value,$my_destlang) + private function translateFileLine($content, $file, $key, $value, $my_destlang) { //print "key =".$key."\n"; @@ -221,8 +221,8 @@ class autoTranslator } if ($key == 'CHARSET') $val=$this->_outputpagecode; - else if (preg_match('/^Format/',$key)) $val=$value; - else if ($value=='-') $val=$value; + elseif (preg_match('/^Format/',$key)) $val=$value; + elseif ($value=='-') $val=$value; else { // If not translated then translate diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 0e3b2c7513f..556a0fce254 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -215,8 +215,8 @@ foreach ($dups as $string => $pages) $s.="\n"; if ($duplicateinsamefile) $sduplicateinsamefile .= $s; - else if ($inmain) $sinmainandother .= $s; - else if ($inadmin) $sininstallandadmin .= $s; + elseif ($inmain) $sinmainandother .= $s; + elseif ($inadmin) $sininstallandadmin .= $s; else $sother .= $s; } @@ -388,4 +388,3 @@ if ($web) } exit; - diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index 92233d71b98..685626d6c11 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -310,7 +310,7 @@ foreach($filesToProcess as $fileToProcess) { //print "Key $key is a key we always want to see into secondary file (line: $cnt).\n"; } - else if ( ! array_key_exists($key, $aSecondary)) + elseif ( ! array_key_exists($key, $aSecondary)) { //print "Key $key does NOT exist in secondary language (line: $cnt).\n"; continue; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index c9b72d9cc4c..6a6e1f44a6a 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2016-2018 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify @@ -162,7 +162,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($accounting->error, $accounting->errors, 'errors'); } - } else if ($action == 'enable') { + } elseif ($action == 'enable') { if ($accounting->fetch($id)) { $result = $accounting->account_activate($id); } @@ -298,7 +298,7 @@ if ($resql) if (! empty($arrayfields['aa.pcg_type']['checked'])) print ''; if (! empty($arrayfields['aa.pcg_subtype']['checked'])) print ''; if (! empty($arrayfields['aa.active']['checked'])) print ' '; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons($massactionbutton?1:0, 'checkforselect', 1); print $searchpicto; print ''; diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index e8f6b8e43b7..637d9548eb9 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * @@ -221,10 +221,10 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) setEventMessages($langs->transnoentities("ErrorFieldRequired",$langs->transnoentities("Country")), null, 'errors'); } } - if ($id == 3 && ! is_numeric($_POST["code"])) + if (! is_numeric($_POST["code"])) { $ok=0; - setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric",$langs->transnoentities("Code")), null, 'errors'); + setEventMessages($langs->transnoentities("ErrorFieldMustBeANumeric", $langs->transnoentities("Code")), null, 'errors'); } // Clean some parameters @@ -270,7 +270,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - else if ($value == 'entity') { + elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; @@ -318,7 +318,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - else if ($field == 'entity') { + elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; @@ -462,11 +462,6 @@ $linkback=''; print load_fiche_titre($titre,$linkback,'title_accountancy'); -if (empty($id)) -{ - print $langs->trans("DictionaryDesc"); - print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; -} print "
\n"; @@ -522,7 +517,7 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $class="left"; if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { @@ -540,7 +535,7 @@ if ($id) { print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); + elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; print ''; } @@ -578,7 +573,7 @@ if ($id) fieldListAccountModel($fieldlist,$obj,$tabname[$id],'add'); } - print ''; + print ''; print ''; print ''; print ""; @@ -611,7 +606,7 @@ if ($id) // There is several pages if ($num > $listlimit) { - print ''; + print ''; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print ''; } @@ -639,7 +634,7 @@ if ($id) } } print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -652,7 +647,7 @@ if ($id) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees $showfield=1; // By defaut - $align="left"; + $class="left"; $sortable=1; $valuetoshow=''; /* @@ -707,7 +702,7 @@ if ($id) if (empty($reshook)) fieldListAccountModel($fieldlist,$obj,$tabname[$id],'edit'); - print ' '; + print ' '; print ' '; } else @@ -724,7 +719,7 @@ if ($id) { $showfield=1; - $align="left"; + $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; if ($value == 'type_template') { @@ -734,14 +729,14 @@ if ($id) { $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; } - else if ($value == 'source') + elseif ($value == 'source') { $valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow; } - else if ($valuetoshow=='all') { + elseif ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); } - else if ($fieldlist[$field]=='country') { + elseif ($fieldlist[$field]=='country') { if (empty($obj->country_code)) { $valuetoshow='-'; @@ -752,7 +747,7 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='country_id') { + elseif ($fieldlist[$field]=='country_id') { $showfield=0; } @@ -816,7 +811,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ -function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') +function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf,$langs,$db; global $form; @@ -879,4 +874,3 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') } } } - diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index a2ec757b212..449d425b846 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * * This program is free software; you can redistribute it and/or modify @@ -124,7 +124,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) exit; } } -} else if ($action == 'edit' && $user->rights->accounting->chartofaccount) { +} elseif ($action == 'edit' && $user->rights->accounting->chartofaccount) { if (! $cancel) { $result = $object->fetch($id); @@ -177,7 +177,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) header("Location: " . $urltogo); exit(); } -} else if ($action == 'delete' && $user->rights->accounting->chartofaccount) { +} elseif ($action == 'delete' && $user->rights->accounting->chartofaccount) { $result = $object->fetch($id); if (! empty($object->id)) { @@ -272,7 +272,7 @@ if ($action == 'create') { print ''; } -else if ($id > 0 || $ref) { +elseif ($id > 0 || $ref) { $result = $object->fetch($id, $ref, 1); diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index 290aa93c0b7..14eec9fa58a 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -1,6 +1,6 @@ - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 1f10403f798..e18be1b8d60 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2011-2017 Alexandre Spangaro + * Copyright (C) 2011-2017 Alexandre Spangaro * * 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 @@ -268,7 +268,7 @@ if (GETPOST('actionadd','alpha') || GETPOST('actionmodify','alpha')) if ($field == 'fk_country' && $_POST['country'] > 0) { $_POST[$listfieldvalue[$i]] = $_POST['country']; } - else if ($field == 'entity') { + elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; @@ -467,7 +467,7 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $class="left"; if ($fieldlist[$field]=='type') { if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"),$langs->trans("TypePaymentDesc"),2,1,img_help(1,'')); else $valuetoshow=$langs->trans("Type"); @@ -492,7 +492,7 @@ if ($id) { print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); + elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; print ''; } @@ -531,7 +531,7 @@ if ($id) fieldListAccountingCategories($fieldlist,$obj,$tabname[$id],'add'); } - print ''; + print ''; print ''; print ''; print ""; @@ -559,7 +559,7 @@ if ($id) // There is several pages if ($num > $listlimit) { - print ''; + print ''; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print ''; } @@ -607,7 +607,7 @@ if ($id) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees $showfield=1; // By defaut - $align="left"; + $class="left"; $sortable=1; $valuetoshow=''; @@ -693,16 +693,16 @@ if ($id) { $showfield=1; - $align="left"; + $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; if ($value == 'category_type') { $valuetoshow = yn($valuetoshow); } - else if ($valuetoshow=='all') { + elseif ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); } - else if ($fieldlist[$field]=='country') { + elseif ($fieldlist[$field]=='country') { if (empty($obj->country_code)) { $valuetoshow='-'; @@ -713,20 +713,20 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { $key=$langs->trans("Country".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { $langs->loadLangs(array("propal")); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { $key=$langs->trans("Action".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { + elseif ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } @@ -813,7 +813,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ -function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $context='') +function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf,$langs,$db; global $form, $mysoc; @@ -873,4 +873,3 @@ function fieldListAccountingCategories($fieldlist, $obj='', $tabname='', $contex } } } - diff --git a/htdocs/accountancy/admin/defaultaccounts.php b/htdocs/accountancy/admin/defaultaccounts.php index 2f41dfa4bfd..1cd00627aa3 100644 --- a/htdocs/accountancy/admin/defaultaccounts.php +++ b/htdocs/accountancy/admin/defaultaccounts.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent @@ -55,6 +55,8 @@ $list_account_main = array ( $list_account = array ( 'ACCOUNTING_PRODUCT_BUY_ACCOUNT', 'ACCOUNTING_PRODUCT_SOLD_ACCOUNT', + 'ACCOUNTING_PRODUCT_SOLD_INTRA_ACCOUNT', + 'ACCOUNTING_PRODUCT_SOLD_EXPORT_ACCOUNT', 'ACCOUNTING_SERVICE_BUY_ACCOUNT', 'ACCOUNTING_SERVICE_SOLD_ACCOUNT', 'ACCOUNTING_VAT_BUY_ACCOUNT', diff --git a/htdocs/accountancy/admin/export.php b/htdocs/accountancy/admin/export.php index 6ef4bdda90b..21fef9a1930 100644 --- a/htdocs/accountancy/admin/export.php +++ b/htdocs/accountancy/admin/export.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index 26620c635e2..06641d7d0a9 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2013-2018 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index 297a3026b02..19f6da0c922 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -73,7 +73,7 @@ if ($action == 'confirm_delete' && $confirm == "yes") { } } -else if ($action == 'add') { +elseif ($action == 'add') { if (! GETPOST('cancel', 'alpha')) { $error = 0; @@ -118,7 +118,7 @@ else if ($action == 'add') { } // Update record -else if ($action == 'update') { +elseif ($action == 'update') { if (! GETPOST('cancel', 'alpha')) { $result = $object->fetch($id); @@ -198,7 +198,7 @@ if ($action == 'create') print ''; print ''; -} else if ($id) { +} elseif ($id) { $result = $object->fetch($id); if ($result > 0) { $head = fiscalyear_prepare_head($object); diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index 3141a624194..9dfa7a681e2 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2016 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/admin/importaccounts.php b/htdocs/accountancy/admin/importaccounts.php index d3a62b5a6ab..236ca09cfee 100644 --- a/htdocs/accountancy/admin/importaccounts.php +++ b/htdocs/accountancy/admin/importaccounts.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2018 Frédéric France * diff --git a/htdocs/accountancy/admin/index.php b/htdocs/accountancy/admin/index.php index 536b3c38148..b3b8a67241b 100644 --- a/htdocs/accountancy/admin/index.php +++ b/htdocs/accountancy/admin/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014 Marcos García * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index 49745676eb3..f8f7a5f7a54 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -270,7 +270,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - else if ($field == 'entity') { + elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = $conf->entity; } if ($i) $sql.=","; @@ -429,7 +429,7 @@ if ($id) // dans les dictionnaires de donnees $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - $align="left"; + $class="left"; if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { @@ -441,7 +441,7 @@ if ($id) { print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); + elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; print ''; } @@ -480,7 +480,7 @@ if ($id) fieldListJournal($fieldlist,$obj,$tabname[$id],'add'); } - print ''; + print ''; print ''; print ''; print ""; @@ -508,7 +508,7 @@ if ($id) // There is several pages if ($num > $listlimit) { - print ''; + print ''; print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), ''); print ''; } @@ -537,7 +537,7 @@ if ($id) // Determine le nom du champ par rapport aux noms possibles // dans les dictionnaires de donnees $showfield=1; // By defaut - $align="left"; + $class="left"; $sortable=1; $valuetoshow=''; /* @@ -606,16 +606,16 @@ if ($id) { $showfield=1; - $align="left"; + $class="left"; $valuetoshow=$obj->{$fieldlist[$field]}; if ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); } - else if ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { + elseif ($fieldlist[$field]=='nature' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { $key=$langs->trans("AccountingJournalType".strtoupper($obj->nature)); $valuetoshow=($obj->nature && $key != "AccountingJournalType".strtoupper($langs->trans($obj->nature))?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'accounting_journal') { $valuetoshow=$langs->trans($obj->label); } @@ -630,8 +630,8 @@ if ($id) if (isset($obj->code) && $id != 10) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } + elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } + elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } } $canbemodified=$iserasable; @@ -696,7 +696,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ -function fieldListJournal($fieldlist, $obj='', $tabname='', $context='') +function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf,$langs,$db; global $form, $mysoc; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index bce4f12e559..78d2ac08e14 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 6a323121a6e..86d513d059a 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -1,7 +1,7 @@ * Copyright (C) 2016 Florian Henry - * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2016-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -235,7 +235,7 @@ if ($action != 'export_csv') print $langs->trans('to'); print $formaccounting->select_account($search_accountancy_code_end, 'search_accountancy_code_end', 1, array(), 1, 1, ''); print ''; - print ''; + print ''; $searchpicto=$form->showFilterAndCheckAddButtons(0); print $searchpicto; print ''; @@ -245,9 +245,9 @@ if ($action != 'export_csv') print ''; print_liste_field_titre("AccountAccounting", $_SERVER['PHP_SELF'], "t.numero_compte", "", $param, "", $sortfield, $sortorder); print_liste_field_titre("Label", $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder); - print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder); - print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'align="right"', $sortfield, $sortorder); + print_liste_field_titre("Debit", $_SERVER['PHP_SELF'], "t.debit", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Credit", $_SERVER['PHP_SELF'], "t.credit", "", $param, 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Balance", $_SERVER["PHP_SELF"], "", $param, "", 'class="right"', $sortfield, $sortorder); print_liste_field_titre('', $_SERVER["PHP_SELF"], "", $param, "", 'width="60" align="center"', $sortfield, $sortorder); print "\n"; @@ -274,7 +274,7 @@ if ($action != 'export_csv') { // Affiche un Sous-Total par compte comptable if ($displayed_account != "") { - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; print " \n"; print ''; } @@ -305,11 +305,11 @@ if ($action != 'export_csv') $sous_total_credit += $line->credit; } - print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; + print '' . $langs->trans("SubTotal") . ':' . price($sous_total_debit) . '' . price($sous_total_credit) . '' . price(price2num($sous_total_credit - $sous_total_debit)) . ''; print " \n"; print ''; - print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_credit - $total_debit)) . ''; + print '' . $langs->trans("AccountBalance") . ':' . price($total_debit) . '' . price($total_credit) . '' . price(price2num($total_credit - $total_debit)) . ''; print " \n"; print ''; diff --git a/htdocs/accountancy/bookkeeping/balancebymonth.php b/htdocs/accountancy/bookkeeping/balancebymonth.php index a01c42b285a..c2e34270438 100644 --- a/htdocs/accountancy/bookkeeping/balancebymonth.php +++ b/htdocs/accountancy/bookkeeping/balancebymonth.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry * @@ -117,19 +117,19 @@ if ($resql) { $row = $db->fetch_row($resql); print '' . length_accountg($row[0]) . ''; - print '' . price($row[1]) . ''; - print '' . price($row[2]) . ''; - print '' . price($row[3]) . ''; - print '' . price($row[4]) . ''; - print '' . price($row[5]) . ''; - print '' . price($row[6]) . ''; - print '' . price($row[7]) . ''; - print '' . price($row[8]) . ''; - print '' . price($row[9]) . ''; - print '' . price($row[10]) . ''; - print '' . price($row[11]) . ''; - print '' . price($row[12]) . ''; - print '' . price($row[13]) . ''; + print '' . price($row[1]) . ''; + print '' . price($row[2]) . ''; + print '' . price($row[3]) . ''; + print '' . price($row[4]) . ''; + print '' . price($row[5]) . ''; + print '' . price($row[6]) . ''; + print '' . price($row[7]) . ''; + print '' . price($row[8]) . ''; + print '' . price($row[9]) . ''; + print '' . price($row[10]) . ''; + print '' . price($row[11]) . ''; + print '' . price($row[12]) . ''; + print '' . price($row[13]) . ''; print ''; $i ++; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 6e48fd13d5f..105c87409c1 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2017 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * @@ -140,7 +140,7 @@ if ($action == "confirm_update") { } } -else if ($action == "add") { +elseif ($action == "add") { $error = 0; if ((floatval($debit) != 0.0) && (floatval($credit) != 0.0)) @@ -171,8 +171,8 @@ else if ($action == "add") { $object->doc_ref = GETPOST('doc_ref','alpha'); $object->code_journal = $journal_code; $object->journal_label = $journal_label; - $object->fk_doc = GETPOST('fk_doc','alpha'); - $object->fk_docdet = GETPOST('fk_docdet','alpha'); + $object->fk_doc = GETPOST('fk_doc','int'); + $object->fk_docdet = GETPOST('fk_docdet','int'); if (floatval($debit) != 0.0) { $object->montant = $debit; @@ -201,7 +201,7 @@ else if ($action == "add") { } } -else if ($action == "confirm_delete") { +elseif ($action == "confirm_delete") { $object = new BookKeeping($db); $result = $object->fetch($id, null, $mode); @@ -218,7 +218,7 @@ else if ($action == "confirm_delete") { $action = ''; } -else if ($action == "confirm_create") { +elseif ($action == "confirm_create") { $error = 0; $object = new BookKeeping($db); diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 509dcd88abe..41939ffd0ce 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2016-2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index c2991ce2598..34481d7680d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -2,7 +2,7 @@ /* Copyright (C) 2016 Neil Orley * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php index 19e0dcbaaac..7ca432bbbc1 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_customer.php @@ -3,7 +3,7 @@ * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php index 27d04962e1b..f9489040c36 100644 --- a/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php +++ b/htdocs/accountancy/bookkeeping/thirdparty_lettering_supplier.php @@ -3,7 +3,7 @@ * Copyright (C) 2005 Laurent Destailleur * Copyright (C) 2013 Olivier Geffroy * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index 5b3282a3b29..6885df63b61 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016-2017 Alexandre Spangaro + * Copyright (C) 2016-2017 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -142,7 +142,7 @@ class AccountancyCategory // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -239,7 +239,7 @@ class AccountancyCategory // extends CommonObject * @param string $label Label * @return int <0 if KO, >0 if OK */ - function fetch($id, $code='', $label='') + function fetch($id, $code = '', $label = '') { $sql = "SELECT"; $sql.= " t.rowid,"; @@ -299,7 +299,7 @@ class AccountancyCategory // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -379,7 +379,7 @@ class AccountancyCategory // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -726,7 +726,7 @@ class AccountancyCategory // extends CommonObject * @param int $year Specifig year - Can be empty * @return integer <0 if KO, >= 0 if OK */ - public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code='nofilter', $month=0, $year=0) + public function getSumDebitCredit($cpt, $date_start, $date_end, $sens, $thirdparty_code = 'nofilter', $month = 0, $year = 0) { global $conf; @@ -796,7 +796,7 @@ class AccountancyCategory // extends CommonObject * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups * @return array|int Array of groups or -1 if error */ - public function getCats($categorytype=-1) + public function getCats($categorytype = -1) { global $conf, $mysoc; @@ -853,7 +853,7 @@ class AccountancyCategory // extends CommonObject * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts * @return array|int Array of accounting accounts or -1 if error */ - public function getCptsCat($cat_id, $predefinedgroupwhere='') + public function getCptsCat($cat_id, $predefinedgroupwhere = '') { global $conf, $mysoc; $sql = ''; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 6f9c0534d2f..d61932884dc 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Pierre-Henry Favre - * Copyright (C) 2016-2018 Alexandre Spangaro + * Copyright (C) 2016-2018 Alexandre Spangaro * Copyright (C) 2013-2017 Olivier Geffroy * Copyright (C) 2017 Elarifr. Ari Elbaz * Copyright (C) 2017 Frédéric France diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index b70fa7238bb..65852258867 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/class/accountingaccount.class.php b/htdocs/accountancy/class/accountingaccount.class.php index 886e19577fb..681073332d7 100644 --- a/htdocs/accountancy/class/accountingaccount.class.php +++ b/htdocs/accountancy/class/accountingaccount.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Ari Elbaz (elarifr) @@ -466,7 +466,7 @@ class AccountingAccount extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user; require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -632,7 +632,7 @@ class AccountingAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -645,7 +645,7 @@ class AccountingAccount extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 9bd21a4a5c4..2a2d050af7b 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -213,7 +213,7 @@ class AccountingJournal extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle='',$notooltip=0) + function getNomUrl($withpicto = 0, $withlabel = 0, $nourl = 0, $moretitle = '', $notooltip = 0) { global $langs, $conf, $user; @@ -270,7 +270,7 @@ class AccountingJournal extends CommonObject * @param int $mode 0=libelle long, 1=libelle court * @return string Label of type */ - function getLibType($mode=0) + function getLibType($mode = 0) { return $this->LibType($this->nature,$mode); } @@ -283,7 +283,7 @@ class AccountingJournal extends CommonObject * @param int $mode 0=libelle long, 1=libelle court * @return string Label of type */ - function LibType($nature,$mode=0) + function LibType($nature, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 297fe0e3e9c..2aaf918b197 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2015-2017 Florian Henry * Copyright (C) 2018 Frédéric France * @@ -411,7 +411,7 @@ class BookKeeping extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -470,7 +470,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, Id of created object if OK */ - public function createStd(User $user, $notrigger = false, $mode='') + public function createStd(User $user, $notrigger = false, $mode = '') { global $conf; @@ -641,7 +641,7 @@ class BookKeeping extends CommonObject * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref = null, $mode='') + public function fetch($id, $ref = null, $mode = '') { global $conf; @@ -1090,7 +1090,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function update(User $user, $notrigger = false, $mode='') + public function update(User $user, $notrigger = false, $mode = '') { $error = 0; @@ -1225,7 +1225,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return number <0 if KO, >0 if OK */ - public function updateByMvt($piece_num='', $field='', $value='', $mode='') + public function updateByMvt($piece_num = '', $field = '', $value = '', $mode = '') { $error=0; @@ -1260,7 +1260,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function delete(User $user, $notrigger = false, $mode='') + public function delete(User $user, $notrigger = false, $mode = '') { dol_syslog(__METHOD__, LOG_DEBUG); @@ -1338,7 +1338,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function deleteByYearAndJournal($delyear='', $journal='', $mode='') + function deleteByYearAndJournal($delyear = '', $journal = '', $mode = '') { global $conf; @@ -1500,7 +1500,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - public function fetchPerMvt($piecenum, $mode='') + public function fetchPerMvt($piecenum, $mode = '') { global $conf; @@ -1536,7 +1536,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return string Next numero to use */ - public function getNextNumMvt($mode='') + public function getNextNumMvt($mode = '') { global $conf; @@ -1565,7 +1565,7 @@ class BookKeeping extends CommonObject * @param string $mode Mode * @return int <0 if KO, >0 if OK */ - function fetchAllPerMvt($piecenum, $mode='') + function fetchAllPerMvt($piecenum, $mode = '') { global $conf; @@ -1687,7 +1687,7 @@ class BookKeeping extends CommonObject * @param string $piece_num Piece num * @return int int <0 if KO, >0 if OK */ - public function transformTransaction($direction=0,$piece_num='') + public function transformTransaction($direction = 0, $piece_num = '') { $error = 0; diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index 1130020b01d..83a018a24cc 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2013 Olivier Geffroy - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -314,4 +314,3 @@ class Lettering extends BookKeeping } } } - diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 7d506c6c72c..5c1dfc5ccbb 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * * 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 diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index 36f840315aa..9c9d0db38a4 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 46ebb8b4bc8..0a4065762aa 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2014-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -219,12 +219,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index c6c12a26f31..a6818ecdfd1 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2019 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -212,7 +212,8 @@ if (empty($chartaccountcode)) $sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,"; $sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,"; $sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,"; -$sql.= " aa.rowid as aarowid,"; +$sql.= " p.accountancy_code_sell_intra as code_sell_intra, p.accountancy_code_sell_export as code_sell_export,"; +$sql.= " aa.rowid as aarowid, aa2.rowid as aarowid_intra, aa3.rowid as aarowid_export,"; $sql.= " co.code as country_code, co.label as country,"; $sql.= " s.tva_intra"; $parameters=array(); @@ -257,12 +258,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } @@ -437,7 +438,9 @@ if ($result) { $code_sell_p_notset = ''; $objp->aarowid_suggest = $objp->aarowid; - if ($objp->type_l == 1) { + $isinEEC = isInEEC($objp->country_code); + + if ($objp->type_l == 1) { $objp->code_sell_l = (! empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : ''); if ($objp->aarowid == '') { $objp->aarowid_suggest = $aarowid_s; @@ -450,8 +453,19 @@ if ($result) { } if ($objp->code_sell_l == -1) $objp->code_sell_l=''; + if ($objp->country_sell == '1') { + $objp->code_sell_p = $objp->code_sell; + $objp->aarowid_suggest = $objp->aarowid; + } elseif ($isinEEC == true) { + $objp->code_sell_p = $objp->code_sell_intra; + $objp->aarowid_suggest = $objp->aarowid_intra; + } else { + $objp->code_sell_p = $objp->code_sell_export; + $objp->aarowid_suggest = $objp->aarowid_export; + } + if (! empty($objp->code_sell)) { - $objp->code_sell_p = $objp->code_sell; // Code on product + //$objp->code_sell_p = $objp->code_sell; // Code on product } else { $code_sell_p_notset = 'color:orange'; } diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index b245e2539a7..eb620d7bf14 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index f34456a95b9..81b1f81416a 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index c617f984af3..12182bdaa43 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -190,12 +190,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 6977d76845d..c0d77fc753a 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -219,12 +219,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND erd.date BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(erd.date, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND erd.date BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 40fca78ab3b..b6b5137fe34 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -8,7 +8,8 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2018 Frédéric France - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Eric Seigne * * 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 @@ -289,18 +290,18 @@ if ($result) { $paymentstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentstatic->getNomUrl(2, '', ''); // TODO Do not include list of invoice in tooltip, the dol_string_nohtmltag is ko with this $tabpay[$obj->rowid]["paymentid"] = $paymentstatic->id; - } else if ($links[$key]['type'] == 'payment_supplier') { + } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsupplierstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsupplierid"] = $paymentsupplierstatic->id; - } else if ($links[$key]['type'] == 'company') { + } elseif ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; $societestatic->name = $links[$key]['label']; $societestatic->email = $tabcompany[$obj->rowid]['email']; $tabpay[$obj->rowid]["soclib"] = $societestatic->getNomUrl(1, '', 30); if ($compta_soc) $tabtp[$obj->rowid][$compta_soc] += $obj->amount; - } else if ($links[$key]['type'] == 'user') { + } elseif ($links[$key]['type'] == 'user') { $userstatic->id = $links[$key]['url_id']; $userstatic->name = $links[$key]['label']; $userstatic->email = $tabuser[$obj->rowid]['email']; @@ -309,7 +310,7 @@ if ($result) { if ($userstatic->id > 0) $tabpay[$obj->rowid]["soclib"] = $userstatic->getNomUrl(1, '', 30); else $tabpay[$obj->rowid]["soclib"] = '???'; // Should not happen, but happens with old data when id of user was not saved on expense report payment. if ($compta_user) $tabtp[$obj->rowid][$compta_user] += $obj->amount; - } else if ($links[$key]['type'] == 'sc') { + } elseif ($links[$key]['type'] == 'sc') { $chargestatic->id = $links[$key]['url_id']; $chargestatic->ref = $links[$key]['url_id']; @@ -338,14 +339,14 @@ if ($result) { $objmid = $db->fetch_object($resultmid); $tabtp[$obj->rowid][$objmid->accountancy_code] += $obj->amount; } - } else if ($links[$key]['type'] == 'payment_donation') { + } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonstatic->id = $links[$key]['url_id']; $paymentdonstatic->ref = $links[$key]['url_id']; $paymentdonstatic->fk_donation = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentdonstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentdonationid"] = $paymentdonstatic->id; $tabtp[$obj->rowid][$account_pay_donation] += $obj->amount; - } else if ($links[$key]['type'] == 'member') { + } elseif ($links[$key]['type'] == 'member') { $paymentsubscriptionstatic->id = $links[$key]['url_id']; $paymentsubscriptionstatic->ref = $links[$key]['url_id']; $paymentsubscriptionstatic->label = $links[$key]['label']; @@ -353,24 +354,24 @@ if ($result) { $tabpay[$obj->rowid]["paymentsubscriptionid"] = $paymentsubscriptionstatic->id; $paymentsubscriptionstatic->fetch($paymentsubscriptionstatic->id); $tabtp[$obj->rowid][$account_pay_subscription] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_vat') { // Payment VAT + } elseif ($links[$key]['type'] == 'payment_vat') { // Payment VAT $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; $paymentvatstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentvatstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentvatid"] = $paymentvatstatic->id; $tabtp[$obj->rowid][$account_pay_vat] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_salary') { + } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; $paymentsalstatic->label = $links[$key]['label']; $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentsalstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentsalid"] = $paymentsalstatic->id; - } else if ($links[$key]['type'] == 'payment_expensereport') { + } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $tabpay[$obj->rowid]["lib"] .= $paymentexpensereportstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentexpensereport"] = $paymentexpensereportstatic->id; - } else if ($links[$key]['type'] == 'payment_various') { + } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->ref = $links[$key]['url_id']; $paymentvariousstatic->label = $links[$key]['label']; @@ -379,7 +380,7 @@ if ($result) { $paymentvariousstatic->fetch($paymentvariousstatic->id); $account_various = (! empty($paymentvariousstatic->accountancy_code) ? $paymentvariousstatic->accountancy_code : 'NotDefined'); // NotDefined is a reserved word $tabtp[$obj->rowid][$account_various] += $obj->amount; - } else if ($links[$key]['type'] == 'payment_loan') { + } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->ref = $links[$key]['url_id']; $paymentloanstatic->fk_loan = $links[$key]['url_id']; @@ -398,7 +399,7 @@ if ($result) { $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] -= $objmid->amount_insurance; $tabtp[$obj->rowid][$objmid->accountancy_account_interest] -= $objmid->amount_interest; } - } else if ($links[$key]['type'] == 'banktransfert') { + } elseif ($links[$key]['type'] == 'banktransfert') { $accountLinestatic->fetch($links[$key]['url_id']); $tabpay[$obj->rowid]["lib"] .= ' '.$langs->trans("BankTransfer").'- ' .$accountLinestatic ->getNomUrl(1); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; @@ -566,68 +567,68 @@ if (! $error && $action == 'writebookkeeping') { $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice + } elseif ($tabtype[$key] == 'payment_supplier') { // If payment is payment of supplier invoice, we get ref of invoice $bookkeeping->subledger_account = $tabcompany[$key]['code_compta']; $bookkeeping->subledger_label = $tabcompany[$key]['name']; $bookkeeping->numero_compte = $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER; $accountingaccount->fetch(null, $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_expensereport') { + } elseif ($tabtype[$key] == 'payment_expensereport') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_salary') { + } elseif ($tabtype[$key] == 'payment_salary') { $bookkeeping->subledger_account = $tabuser[$key]['accountancy_code']; $bookkeeping->subledger_label = $tabuser[$key]['name']; $bookkeeping->numero_compte = $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT; $accountingaccount->fetch(null, $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution + } elseif (in_array($tabtype[$key], array('sc', 'payment_sc'))) { // If payment is payment of social contribution $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $bookkeeping->label_compte = $objmid->labelc; - } else if ($tabtype[$key] == 'payment_vat') { + } elseif ($tabtype[$key] == 'payment_vat') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_donation') { + } elseif ($tabtype[$key] == 'payment_donation') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'member') { + } elseif ($tabtype[$key] == 'member') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_loan') { + } elseif ($tabtype[$key] == 'payment_loan') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'payment_various') { + } elseif ($tabtype[$key] == 'payment_various') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; $accountingaccount->fetch(null, $k, true); $bookkeeping->label_compte = $accountingaccount->label; - } else if ($tabtype[$key] == 'banktransfert') { + } elseif ($tabtype[$key] == 'banktransfert') { $bookkeeping->subledger_account = ''; $bookkeeping->subledger_label = ''; $bookkeeping->numero_compte = $k; @@ -785,17 +786,17 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; // CSV header line - print '"' . $langs->trans("BankId").'"' . $sep; - print '"' . $langs->trans("Date") . '"' . $sep; - print '"' . $langs->trans("PaymentMode") . '"' . $sep; - print '"' . $langs->trans("AccountAccounting") . '"' . $sep; - print '"' . $langs->trans("LedgerAccount") . '"' . $sep; - print '"' . $langs->trans("SubledgerAccount") . '"' . $sep; - print '"' . $langs->trans("Label"). '"' . $sep; - print '"' . $langs->trans("Debit") . '"' . $sep; - print '"' . $langs->trans("Credit") . '"' . $sep; - print '"' . $langs->trans("Journal") . '"' . $sep; - print '"' . $langs->trans("Note") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("BankId").'"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("PaymentMode") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("LedgerAccount") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("SubledgerAccount") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Label"). '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Journal") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Note") . '"' . $sep; print "\n"; @@ -844,11 +845,11 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; if ($tabtype[$key] == 'payment_supplier') { print '"' . $conf->global->ACCOUNTING_ACCOUNT_SUPPLIER . '"' . $sep; - } else if($tabtype[$key] == 'payment') { + } elseif($tabtype[$key] == 'payment') { print '"' . $conf->global->ACCOUNTING_ACCOUNT_CUSTOMER . '"' . $sep; - } else if($tabtype[$key] == 'payment_expensereport') { + } elseif($tabtype[$key] == 'payment_expensereport') { print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; - } else if($tabtype[$key] == 'payment_salary') { + } elseif($tabtype[$key] == 'payment_salary') { print '"' . $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT . '"' . $sep; } else { print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index fc5d4062b43..34a8d219b90 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -3,10 +3,11 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018 Eric Seigne * * 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 @@ -425,115 +426,67 @@ $form = new Form($db); $userstatic = new User($db); // Export -/*if ($action == 'exportcsv') { // ISO and not UTF8 ! +if ($action == 'exportcsv') { // ISO and not UTF8 ! $sep = $conf->global->ACCOUNTING_EXPORT_SEPARATORCSV; $filename = 'journal'; $type_export = 'journal'; include DOL_DOCUMENT_ROOT . '/accountancy/tpl/export_journal.tpl.php'; - // Model Cegid Expert Export - if ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 2) { - $sep = ";"; + // CSV header line + print '"' . $langs->transnoentitiesnoconv("Date") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Piece") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("AccountAccounting") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("LabelOperation") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Debit") . '"' . $sep; + print '"' . $langs->transnoentitiesnoconv("Credit") . '"' . $sep; + print "\n"; - foreach ( $taber as $key => $val ) { - $date = dol_print_date($val["date"], '%d%m%Y'); - - // Fees - foreach ( $tabht[$key] as $k => $mt ) { - $userstatic->id = $tabuser[$key]['id']; - $userstatic->name = $tabuser[$key]['name']; - $userstatic->client = $tabuser[$key]['code_client']; - - if ($mt) { - print $date . $sep; - print $journal . $sep; - print length_accountg(html_entity_decode($k)) . $sep; - print $sep; - print ($mt < 0 ? 'C' : 'D') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print dol_trunc($val["comments"], 32) . $sep; - print $val["ref"]; - print "\n"; - } - } - - // VAT - foreach ( $tabtva[$key] as $k => $mt ) { - if ($mt) { - print $date . $sep; - print $journal . $sep; - print length_accountg(html_entity_decode($k)) . $sep; - print $sep; - print ($mt < 0 ? 'C' : 'D') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $langs->trans("VAT") . $sep; - print $val["ref"]; - print "\n"; - } - } - - foreach ( $tabttc[$key] as $k => $mt ) { - print $date . $sep; - print $journal . $sep; - print length_accountg($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) . $sep; - print length_accounta(html_entity_decode($k)) . $sep; - print ($mt < 0 ? 'D' : 'C') . $sep; - print ($mt <= 0 ? price(- $mt) : $mt) . $sep; - print $userstatic->name . $sep; - print $val["ref"]; - print "\n"; - } - } - } elseif ($conf->global->ACCOUNTING_EXPORT_MODELCSV == 1) { - // Model Classic Export - foreach ( $taber as $key => $val ) { - $date = dol_print_date($val["date"], 'day'); - - $userstatic->id = $tabuser[$key]['id']; - $userstatic->name = $tabuser[$key]['name']; - - // Fees - foreach ( $tabht[$key] as $k => $mt ) { - $accountingaccount = new AccountingAccount($db); - $accountingaccount->fetch(null, $k, true); - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; - } - } - // VAT - foreach ( $tabtva[$key] as $k => $mt ) { - if ($mt) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; - print "\n"; - } - } - - // Third party - foreach ( $tabttc[$key] as $k => $mt ) { - print '"' . $date . '"' . $sep; - print '"' . $val["ref"] . '"' . $sep; - print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; - print '"' . dol_trunc($userstatic->name) . '"' . $sep; - print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; - print '"' . ($mt >= 0 ? price($mt) : '') . '"'; - } - print "\n"; - } + foreach ( $taber as $key => $val ) { + $date = dol_print_date($val["date"], 'day'); + + $userstatic->id = $tabuser[$key]['id']; + $userstatic->name = $tabuser[$key]['name']; + + // Fees + foreach ( $tabht[$key] as $k => $mt ) { + $accountingaccount = new AccountingAccount($db); + $accountingaccount->fetch(null, $k, true); + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($accountingaccount->label, 32) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } + } + // VAT + foreach ( $tabtva[$key] as $k => $mt ) { + if ($mt) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accountg(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($langs->trans("VAT")) . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"'; + print "\n"; + } + } + + // Third party + foreach ( $tabttc[$key] as $k => $mt ) { + print '"' . $date . '"' . $sep; + print '"' . $val["ref"] . '"' . $sep; + print '"' . length_accounta(html_entity_decode($k)) . '"' . $sep; + print '"' . dol_trunc($userstatic->name) . '"' . $sep; + print '"' . ($mt < 0 ? price(- $mt) : '') . '"' . $sep; + print '"' . ($mt >= 0 ? price($mt) : '') . '"'; + } + print "\n"; } } -*/ if (empty($action) || $action == 'view') { @@ -560,6 +513,8 @@ if (empty($action) || $action == 'view') { print ' : '.$langs->trans("AccountancyAreaDescMisc", 4, ''.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("MenuAccountancy").'-'.$langs->transnoentitiesnoconv("Setup")."-".$langs->transnoentitiesnoconv("MenuDefaultAccounts").''); } print '
'; + + if (! empty($conf->global->ACCOUNTING_ENABLE_EXPORT_DRAFT_JOURNAL)) print ''; if (empty($conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT) || $conf->global->SALARIES_ACCOUNTING_ACCOUNT_PAYMENT == '-1') { print ''; } @@ -567,7 +522,6 @@ if (empty($action) || $action == 'view') { if ($in_bookkeeping == 'notyet') print ''; else print '' . $langs->trans("WriteBookKeeping") . ''; } - //print ''; print '
'; // TODO Avoid using js. We can use a direct link with $param diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 37f1f9d9eae..54024fe6471 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2018 Frédéric France @@ -879,7 +879,7 @@ if (empty($action) || $action == 'view') { $accountoshow = length_accounta($conf->global->ACCOUNTING_ACCOUNT_SUPPLIER); if (($accountoshow == "") || $accountoshow == 'NotDefined') { - print ''.$langs->trans("MainAccountForSupplierssNotDefined").''; + print ''.$langs->trans("MainAccountForSuppliersNotDefined").''; } else print $accountoshow; print ''; diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index 09bc9a18e9a..9526bc763ec 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -4,7 +4,7 @@ * Copyright (C) 2011 Juanjo Menent * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Christophe Battarel - * Copyright (C) 2013-2018 Alexandre Spangaro + * Copyright (C) 2013-2018 Alexandre Spangaro * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2013-2016 Olivier Geffroy * Copyright (C) 2014 Raphaël Doursenaud diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 8de24e09a9e..10e52d6c029 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -1,7 +1,7 @@ * Copyright (C) 2005 Simon TOSSER - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index d63f8ee52fa..fcc6bbecd81 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2013-2014 Florian Henry - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index 051562c656e..cf5d36d6e80 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2016 Florian Henry * Copyright (C) 2014 Juanjo Menent @@ -214,12 +214,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 4ca53d4bcab..e04be12df3b 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2013-2017 Alexandre Spangaro + * Copyright (C) 2013-2017 Alexandre Spangaro * Copyright (C) 2014-2015 Ari Elbaz (elarifr) * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2014 Juanjo Menent s @@ -256,12 +256,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.datef BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(f.datef, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND f.datef BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index ca3c9c49ea0..97f0da548ca 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2018 Alexandre Spangaro * Copyright (C) 2016 Charlie Benke * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index cad250a60d0..02364a3a1d8 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -136,7 +136,7 @@ if ($conf->use_javascript_ajax) } -print $langs->trans("BlankSubscriptionFormDesc").'

'; +print ''.$langs->trans("BlankSubscriptionFormDesc").'

'; $enabledisablehtml = $langs->trans("EnablePublicSubscriptionForm").' '; diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 2f2c5f9dde8..7a6898da9d3 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2018 Regis Houssin * Copyright (C) 2012 Marcos García * Copyright (C) 2012-2018 Philippe Grand - * Copyright (C) 2015-2018 Alexandre Spangaro + * Copyright (C) 2015-2018 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 3a698c6b042..959dacba2c1 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2004 Sebastien Di Cintio * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2009-2017 Regis Houssin - * Copyright (C) 2014-2018 Alexandre Spangaro + * Copyright (C) 2014-2018 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2015-2018 Frédéric France * Copyright (C) 2015 Raphaël Doursenaud @@ -246,7 +246,7 @@ class Adherent extends CommonObject * @param string $moreinheader Add more html headers * @return int <0 if KO, >0 if OK */ - function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='', $moreinheader='') + function send_an_email($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '') { // phpcs:enable global $conf,$langs; @@ -358,7 +358,7 @@ class Adherent extends CommonObject * @param string $morphy Nature of the adherent (physical or moral) * @return string Label */ - function getmorphylib($morphy='') + function getmorphylib($morphy = '') { global $langs; if (! $morphy) { $morphy=$this->morphy; } @@ -374,7 +374,7 @@ class Adherent extends CommonObject * @param int $notrigger 1 ne declenche pas les triggers, 0 sinon * @return int <0 if KO, >0 if OK */ - function create($user,$notrigger=0) + function create($user, $notrigger = 0) { global $conf,$langs; @@ -500,7 +500,7 @@ class Adherent extends CommonObject * @param string $action Current action for hookmanager * @return int <0 if KO, >0 if OK */ - function update($user,$notrigger=0,$nosyncuser=0,$nosyncuserpass=0,$nosyncthirdparty=0,$action='update') + function update($user, $notrigger = 0, $nosyncuser = 0, $nosyncuserpass = 0, $nosyncthirdparty = 0, $action = 'update') { global $conf, $langs, $hookmanager; @@ -817,7 +817,7 @@ class Adherent extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, 0=nothing to do, >0 if OK */ - function delete($rowid, $user, $notrigger=0) + function delete($rowid, $user, $notrigger = 0) { global $conf, $langs; @@ -927,7 +927,7 @@ class Adherent extends CommonObject * @param int $nosyncuser Do not synchronize linked user * @return string If OK return clear password, 0 if no change, < 0 if error */ - function setPassword($user, $password='', $isencrypted=0, $notrigger=0, $nosyncuser=0) + function setPassword($user, $password = '', $isencrypted = 0, $notrigger = 0, $nosyncuser = 0) { global $conf, $langs; @@ -1147,7 +1147,7 @@ class Adherent extends CommonObject * @param string $lastname Lastname * @return void */ - function fetch_name($firstname,$lastname) + function fetch_name($firstname, $lastname) { // phpcs:enable global $conf; @@ -1183,7 +1183,7 @@ class Adherent extends CommonObject * @param bool $fetch_subscriptions To load member subscriptions * @return int >0 if OK, 0 if not found, <0 if KO */ - function fetch($rowid,$ref='',$fk_soc='',$ref_ext='',$fetch_optionals=true,$fetch_subscriptions=true) + function fetch($rowid, $ref = '', $fk_soc = '', $ref_ext = '', $fetch_optionals = true, $fetch_subscriptions = true) { global $langs; @@ -1400,7 +1400,7 @@ class Adherent extends CommonObject * @param int $datesubend Date end subscription * @return int rowid of record added, <0 if KO */ - function subscription($date, $amount, $accountid=0, $operation='', $label='', $num_chq='', $emetteur_nom='', $emetteur_banque='', $datesubend=0) + function subscription($date, $amount, $accountid = 0, $operation = '', $label = '', $num_chq = '', $emetteur_nom = '', $emetteur_banque = '', $datesubend = 0) { global $conf,$langs,$user; @@ -1486,7 +1486,7 @@ class Adherent extends CommonObject * @param string $autocreatethirdparty Auto create new thirdparty if member not yet linked to a thirdparty and we request an option that generate invoice. * @return int <0 if KO, >0 if OK */ - function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom='', $emetteur_banque='', $autocreatethirdparty=0) + function subscriptionComplementaryActions($subscriptionid, $option, $accountid, $datesubscription, $paymentdate, $operation, $label, $amount, $num_chq, $emetteur_nom = '', $emetteur_banque = '', $autocreatethirdparty = 0) { global $conf, $langs, $user, $mysoc; @@ -2018,7 +2018,7 @@ class Adherent extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpictoimg=0, $maxlen=0, $option='card', $mode='', $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpictoimg = 0, $maxlen = 0, $option = 'card', $mode = '', $morecss = '', $save_lastsearch_value = -1) { global $conf, $langs; @@ -2109,7 +2109,7 @@ class Adherent extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$this->need_subscription,$this->datefin,$mode); } @@ -2124,7 +2124,7 @@ class Adherent extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - function LibStatut($statut,$need_subscription,$date_end_subscription,$mode=0) + function LibStatut($statut, $need_subscription, $date_end_subscription, $mode = 0) { // phpcs:enable global $langs; @@ -2307,7 +2307,7 @@ class Adherent extends CommonObject * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$langs; @@ -2400,7 +2400,7 @@ class Adherent extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - function _load_ldap_dn($info,$mode=0) + function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; @@ -2487,7 +2487,7 @@ class Adherent extends CommonObject if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) } // Set LDAP password if possible - else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password + elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password { if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) { @@ -2502,7 +2502,7 @@ class Adherent extends CommonObject } } // Use $this->pass_indatabase value if exists - else if (! empty($this->pass_indatabase)) + elseif (! empty($this->pass_indatabase)) { if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte if (! empty($conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_MEMBER_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption @@ -2694,7 +2694,7 @@ class Adherent extends CommonObject * @param string $daysbeforeendlist Nb of days before end of subscription (negative number = after subscription). Can be a list of delay, separated by a semicolon, for example '10;5;0;-5' * @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK) */ - public function sendReminderForExpiredSubscription($daysbeforeendlist='10') + public function sendReminderForExpiredSubscription($daysbeforeendlist = '10') { global $conf, $langs, $mysoc, $user; diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 984cf49d44d..263012df782 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -103,7 +103,7 @@ class AdherentType extends CommonObject * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int >0 if OK, < 0 if KO */ - function create($user,$notrigger=0) + function create($user, $notrigger = 0) { global $conf; @@ -170,7 +170,7 @@ class AdherentType extends CommonObject * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int >0 if OK, < 0 if KO */ - function update($user,$notrigger=0) + function update($user, $notrigger = 0) { global $conf, $hookmanager; @@ -356,7 +356,7 @@ class AdherentType extends CommonObject * 2=Return array of members id only * @return mixed Array of members or -1 on error */ - function listMembersForMemberType($excludefilter='', $mode=0) + function listMembersForMemberType($excludefilter = '', $mode = 0) { global $conf, $user; @@ -411,7 +411,7 @@ class AdherentType extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0) + function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) { global $langs; @@ -449,7 +449,7 @@ class AdherentType extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - function _load_ldap_dn($info,$mode=0) + function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; diff --git a/htdocs/adherents/class/adherentstats.class.php b/htdocs/adherents/class/adherentstats.class.php index 310a40c52b3..f5ef24fb465 100644 --- a/htdocs/adherents/class/adherentstats.class.php +++ b/htdocs/adherents/class/adherentstats.class.php @@ -52,7 +52,7 @@ class AdherentStats extends Stats * @param int $socid Id third party * @param int $userid Id user for filter */ - function __construct($db, $socid=0, $userid=0) + function __construct($db, $socid = 0, $userid = 0) { global $user, $conf; @@ -85,7 +85,7 @@ class AdherentStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of nb each month */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { global $user; @@ -126,7 +126,7 @@ class AdherentStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of amount each month */ - function getAmountByMonth($year, $format=0) + function getAmountByMonth($year, $format = 0) { global $user; diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 2da35df7e2c..9ced878a68e 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -213,7 +213,7 @@ class Members extends DolibarrApi if ($result < 0) { throw new RestException(500, 'Error when resiliating member: '.$member->error); } - } else if ($value == '1') { + } elseif ($value == '1') { $result = $member->validate(DolibarrApiAccess::$user); if ($result < 0) { throw new RestException(500, 'Error when validating member: '.$member->error); @@ -361,7 +361,7 @@ class Members extends DolibarrApi * * @url POST {id}/subscriptions */ - function createSubscription($id, $start_date, $end_date, $amount, $label='') + function createSubscription($id, $start_date, $end_date, $amount, $label = '') { if(! DolibarrApiAccess::$user->rights->adherent->cotisation->creer) { throw new RestException(401); diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index 96876eb82b6..319dbb1f75b 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -207,7 +207,7 @@ $type=$this->fk_type; * @param int $notrigger 0=Disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update($user, $notrigger = 0) { $error = 0; @@ -263,7 +263,7 @@ $type=$this->fk_type; * @param bool $notrigger false=launch triggers after, true=disable triggers * @return int <0 if KO, 0 if not found, >0 if OK */ - function delete($user, $notrigger=false) + function delete($user, $notrigger = false) { $error = 0; @@ -356,7 +356,7 @@ $type=$this->fk_type; * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $notooltip=0, $option='', $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $notooltip = 0, $option = '', $morecss = '', $save_lastsearch_value = -1) { global $langs; @@ -395,7 +395,7 @@ $type=$this->fk_type; * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return ''; } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 8a8186fcd2b..d27c2365f47 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2014-2016 Juanjo Menent - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 8da764179a4..1a52c9226f5 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -210,9 +210,9 @@ if ($mode && ! count($data)) else { if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'
'; - else if ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'
'; - else if ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'
'; - else if ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'
';//+ + elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'
'; + elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'
'; + elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'
';//+ else { print $langs->trans("MembersStatisticsDesc").'
'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index e476492fdfa..0c5618ca1d9 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -3,7 +3,7 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2012-2017 Regis Houssin - * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -793,8 +793,8 @@ if ($rowid > 0) else { if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankviainvoice' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $bankviainvoice=1; - else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1; - else if (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1; + elseif (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'bankdirect' && ! empty($conf->banque->enabled)) $bankdirect=1; + elseif (! empty($conf->global->ADHERENT_BANK_USE) && $conf->global->ADHERENT_BANK_USE == 'invoiceonly' && ! empty($conf->banque->enabled) && ! empty($conf->societe->enabled) && ! empty($conf->facture->enabled)) $invoiceonly=1; } print "\n\n\n"; diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c32c7f6de61..499f41dce3e 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2013 Florian Henry - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * * 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 @@ -57,6 +57,7 @@ if (! $sortorder) { $sortorder="DESC"; } if (! $sortfield) { $sortfield="d.lastname"; } $label=GETPOST("label","alpha"); +$statut=GETPOST("statut","int"); $subscription=GETPOST("subscription","int"); $vote=GETPOST("vote","int"); $comment=GETPOST("comment",'alphanohtml'); @@ -104,7 +105,8 @@ if ($cancel) { if ($action == 'add' && $user->rights->adherent->configurer) { $object->label = trim($label); - $object->subscription = (int) trim($subscription); + $object->statut = (int) $statut; + $object->subscription = (int) $subscription; $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (boolean) trim($vote); @@ -157,7 +159,8 @@ if ($action == 'update' && $user->rights->adherent->configurer) $object->oldcopy = clone $object; $object->label = trim($label); - $object->subscription = (int) trim($subscription); + $object->statut = (int) $statut; + $object->subscription = (int) $subscription; $object->note = trim($comment); $object->mail_valid = trim($mail_valid); $object->vote = (boolean) trim($vote); @@ -214,7 +217,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') { //dol_fiche_head(''); - $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote"; + $sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote, d.statut"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d"; $sql.= " WHERE d.entity IN (".getEntity('member_type').")"; @@ -242,7 +245,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''; print ''; - print ''; + print ''; print ''; print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, $newcardbutton, '', $limit); @@ -257,6 +260,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''.$langs->trans("Label").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("VoteAllowed").''; + print ''.$langs->trans("Status").''; print ' '; print "\n"; @@ -278,6 +282,13 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''.dol_escape_htmltag($objp->label).''; print ''.yn($objp->subscription).''; print ''.yn($objp->vote).''; + print ''; + if ( !empty($objp->statut) ) { + print img_picto($langs->trans("InActivity"),'statut4'); + } else { + print img_picto($langs->trans("ActivityCeased"),'statut5'); + } + print ''; if ($user->rights->adherent->configurer) print 'rowid.'">'.img_edit().''; else @@ -319,7 +330,11 @@ if ($action == 'create') print ''.$langs->trans("Label").''; - print ''.$langs->trans("SubscriptionRequired").''; + print ''.$langs->trans("Status").''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),1); + print ''; + + print ''.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",1,1); print ''; @@ -392,6 +407,14 @@ if ($rowid > 0) print ''; + print ''; + print ''; @@ -427,7 +450,12 @@ if ($rowid > 0) } // Add - print ''; + if ( $user->rights->adherent->configurer && !empty($object->statut) ) + { + print ''; + } else { + print ''; + } // Delete if ($user->rights->adherent->configurer) @@ -516,11 +544,11 @@ if ($rowid > 0) if ($status != '') { if ($status == '-1,1') { $titre=$langs->trans("MembersListQualified"); } - else if ($status == '-1') { $titre=$langs->trans("MembersListToValid"); } - else if ($status == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); } - else if ($status == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); } - else if ($status == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } - else if ($status == '0') { $titre=$langs->trans("MembersListResiliated"); } + elseif ($status == '-1') { $titre=$langs->trans("MembersListToValid"); } + elseif ($status == '1' && ! $filter) { $titre=$langs->trans("MembersListValid"); } + elseif ($status == '1' && $filter=='uptodate') { $titre=$langs->trans("MembersListUpToDate"); } + elseif ($status == '1' && $filter=='outofdate') { $titre=$langs->trans("MembersListNotUpToDate"); } + elseif ($status == '0') { $titre=$langs->trans("MembersListResiliated"); } } elseif ($action == 'search') { @@ -723,7 +751,11 @@ if ($rowid > 0) print ''; - print ''; + + print ''; @@ -743,7 +775,7 @@ if ($rowid > 0) // Other attributes $parameters=array(); $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$act,$action); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; + print $hookmanager->resPrint; if (empty($reshook)) { print $object->showOptionals($extrafields,'edit'); diff --git a/htdocs/admin/accountant.php b/htdocs/admin/accountant.php index 92d80464088..7b24260cd8d 100644 --- a/htdocs/admin/accountant.php +++ b/htdocs/admin/accountant.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 236483f5ed4..66f18308931 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -196,7 +196,7 @@ print ""; print ""; print "'; print "'; -print ''; +print ''; print ""; $i=1; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 2a370cdf580..639671b4647 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -35,7 +35,7 @@ if (!$user->admin) accessforbidden(); // Load translation files required by the page -$langs->loadLangs(array('admin', 'other', 'agenda')); +$langs->loadLangs(array('admin', 'other', 'agenda', 'users')); $action = GETPOST('action','alpha'); $value = GETPOST('value','alpha'); @@ -86,7 +86,7 @@ if ($action == 'set') dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } -else if ($action == 'specimen') // For orders +elseif ($action == 'specimen') // For orders { $modele=GETPOST('module','alpha'); @@ -133,13 +133,13 @@ else if ($action == 'specimen') // For orders } // Activate a model -else if ($action == 'setmodel') +elseif ($action == 'setmodel') { //print "sssd".$value; $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -149,7 +149,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -331,7 +331,7 @@ print '
'.$langs->trans("Status").''; + if ( !empty($object->statut) ) { + print img_picto($langs->trans('TypeStatusActive'),'statut4').' '.$langs->trans("InActivity"); + } else { + print img_picto($langs->trans('TypeStatusInactive'),'statut5').' '.$langs->trans("ActivityCeased"); + } + print '
'.$langs->trans("SubscriptionRequired").''; print yn($object->subscription); print '
'.$langs->trans("Label").'
'.$langs->trans("SubscriptionRequired").''; + print '
'.$langs->trans("Status").''; + print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); + print '
'.$langs->trans("SubscriptionRequired").''; print $form->selectyesno("subscription",$object->subscription,1); print '
".$langs->trans("Parameter")."".$langs->trans("Name")."".$langs->trans("ExtSiteUrlAgenda")." (".$langs->trans("Example").': http://yoursite/agenda/agenda.ics)".$form->textwithpicto($langs->trans("FixTZ"), $langs->trans("FillFixTZOnlyIfRequired"), 1).''.$langs->trans("Color").''.$langs->trans("Color").'
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; // Manual or automatic @@ -339,7 +339,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; // AGENDA_DEFAULT_VIEW print ''."\n"; -print ''."\n"; +$htmltext=$langs->trans("ThisValueCanOverwrittenOnUserLevel", $langs->transnoentitiesnoconv("UserGUISetup")); +print ''."\n"; print ''."\n"; -print ''."\n"; @@ -367,7 +368,7 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; } @@ -376,7 +377,7 @@ if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; @@ -385,7 +386,7 @@ print ''."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 269880236cb..10d716a1af6 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -81,7 +81,7 @@ if ($action == 'set') dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); } -else if ($action == 'specimen') // For orders +elseif ($action == 'specimen') // For orders { $modele=GETPOST('module','alpha'); @@ -128,13 +128,13 @@ else if ($action == 'specimen') // For orders } // Activate a model -else if ($action == 'setmodel') +elseif ($action == 'setmodel') { //print "sssd".$value; $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -144,7 +144,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "ACTION_EVENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -186,7 +186,7 @@ print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").''.$langs->trans("Value").'
'.$langs->trans("AGENDA_USE_EVENT_TYPE").' '."\n"; +print ''."\n"; //print ajax_constantonoff('AGENDA_USE_EVENT_TYPE'); Do not use ajax here, we need to reload page to change other combo list if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { @@ -353,9 +353,10 @@ print '
'.$langs->trans("AGENDA_DEFAULT_VIEW").''.$form->textwithpicto($langs->trans("AGENDA_DEFAULT_VIEW"), $htmltext).' '."\n"; +print ''."\n"; $tmplist=array(''=>' ', 'show_list'=>$langs->trans("ViewList"), 'show_month'=>$langs->trans("ViewCal"), 'show_week'=>$langs->trans("ViewWeek"), 'show_day'=>$langs->trans("ViewDay"), 'show_peruser'=>$langs->trans("ViewPerUser")); print $form->selectarray('AGENDA_DEFAULT_VIEW', $tmplist, $conf->global->AGENDA_DEFAULT_VIEW); print '
'.$langs->trans("AGENDA_USE_EVENT_TYPE_DEFAULT").' '."\n"; + print ''."\n"; $formactions->select_type_actions($conf->global->AGENDA_USE_EVENT_TYPE_DEFAULT, "AGENDA_USE_EVENT_TYPE_DEFAULT", 'systemauto', 0, 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").' '."\n"; +print ''."\n"; $formactions->select_type_actions($conf->global->AGENDA_DEFAULT_FILTER_TYPE, "AGENDA_DEFAULT_FILTER_TYPE", '', (empty($conf->global->AGENDA_USE_EVENT_TYPE) ? 1 : -1), 1); print '
'.$langs->trans("AGENDA_DEFAULT_FILTER_STATUS").' '."\n"; +print ''."\n"; $formactions->form_select_status_action('agenda', $conf->global->AGENDA_DEFAULT_FILTER_STATUS, 1, 'AGENDA_DEFAULT_FILTER_STATUS', 1, 2, 'minwidth100'); print '
'."\n"; print ''."\n"; print ''."\n"; print ''."\n"; -print ''."\n"; +print ''."\n"; print ''."\n"; @@ -196,7 +196,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; print ''."\n"; print ''."\n"; - print ''."\n"; print ''."\n"; print ''."\n"; - print '\n"; print '
'.$langs->trans("Parameters").' '.$langs->trans("Value").''.$langs->trans("Value").'
'.$langs->trans('AGENDA_REMINDER_EMAIL', $langs->transnoentities("Module2300Name")).' '."\n"; + print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_EMAIL)) { print ''.img_picto($langs->trans('Disabled'),'switch_off').''; @@ -213,7 +213,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '
'.$langs->trans('AGENDA_REMINDER_BROWSER').' '."\n"; + print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER)) { print ''.img_picto($langs->trans('Disabled'),'switch_off').''; @@ -225,7 +225,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL > 0) print '
'.$langs->trans('AGENDA_REMINDER_BROWSER_SOUND').' '."\n"; + print ''."\n"; if (empty($conf->global->AGENDA_REMINDER_BROWSER_SOUND)) { print ''.img_picto($langs->trans('Disabled'),'switch_off').''; diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index 031e4200268..34becb49ada 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -133,7 +133,7 @@ if ($action == 'specimen') { if ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') { +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) { if ($conf->global->BANKADDON_PDF == "$value") @@ -141,7 +141,7 @@ else if ($action == 'del') { } } // Set default model -else if ($action == 'setdoc') { +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "BANKADDON_PDF", $value, 'chaine', 0, '', $conf->entity)) { // The constant that was read before the new set diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c0480bb7e50..c5bc3f596b4 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -289,14 +289,14 @@ if ($resql) $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } - else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) + elseif (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) { $box_order = "B0".$record['box_order']; $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } } - else if (dol_strlen($record['box_order']) == 2) + elseif (dol_strlen($record['box_order']) == 2) { if (preg_match("/[13579]{1}/",substr($record['box_order'],-1))) { @@ -304,7 +304,7 @@ if ($resql) $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; $resql = $db->query($sql); } - else if (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) + elseif (preg_match("/[02468]{1}/",substr($record['box_order'],-1))) { $box_order = "B".$record['box_order']; $sql="UPDATE ".MAIN_DB_PREFIX."boxes SET box_order = '".$box_order."' WHERE entity = ".$conf->entity." AND box_order = '".$record['box_order']."'"; diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index f85018c03b8..013b140ee60 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -267,7 +267,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "
'; diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index d4d7b789974..42ea60d0f9f 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -73,7 +73,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') +elseif ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -119,12 +119,12 @@ else if ($action == 'specimen') } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -134,7 +134,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -151,7 +151,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Check if numbering module chosen can be activated // by calling method canBeActivated @@ -159,7 +159,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "COMMANDE_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_COMMANDE_DRAFT_WATERMARK') +elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK') { $draft = GETPOST("COMMANDE_DRAFT_WATERMARK"); $res = dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); @@ -176,7 +176,7 @@ else if ($action == 'set_COMMANDE_DRAFT_WATERMARK') } } -else if ($action == 'set_ORDER_FREE_TEXT') +elseif ($action == 'set_ORDER_FREE_TEXT') { $freetext = GETPOST("ORDER_FREE_TEXT",'none'); // No alpha here, we want exact string @@ -195,7 +195,7 @@ else if ($action == 'set_ORDER_FREE_TEXT') } // Activate Set Shippable Icon In List -else if ($action=="setshippableiconinlist") { +elseif ($action=="setshippableiconinlist") { $setshippableiconinlist = GETPOST('value','int'); $res = dolibarr_set_const($db, "SHIPPABLE_ORDER_ICON_IN_LIST", $setshippableiconinlist,'yesno',0,'',$conf->entity); if (! $res > 0) $error++; @@ -207,7 +207,7 @@ else if ($action=="setshippableiconinlist") { } // Activate ask for payment bank -else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') +elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') { $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ORDER",$value,'chaine',0,'',$conf->entity); @@ -224,7 +224,7 @@ else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') } // Activate ask for warehouse -else if ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') +elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') { $res = dolibarr_set_const($db, "WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER",$value,'chaine',0,'',$conf->entity); @@ -556,7 +556,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -570,7 +570,7 @@ print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftOrders"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ''; @@ -674,7 +674,7 @@ print "\n"; print ''; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index 15af65fbb8d..c0599a666dc 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -4,7 +4,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2010-2014 Juanjo Menent * Copyright (C) 2011-2017 Philippe Grand - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2017 Rui Strecht * * This program is free software; you can redistribute it and/or modify @@ -137,7 +137,7 @@ if ( ($action == 'update' && ! GETPOST("cancel",'alpha')) } else dol_syslog("ErrorImageFormatNotSupported",LOG_WARNING); } - else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) + elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) { $error++; $langs->load("errors"); @@ -602,7 +602,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; print ''; print ''; - print ''; + print ''; print "\n"; @@ -635,7 +635,7 @@ if ($action == 'edit' || $action == 'updateedit') print '
'.$langs->trans("VATManagement").''.$langs->trans("Description").'  
'; print ''; print ''; - print ''; + print ''; print "\n"; // Note: When option is not set, it must not appears as set on on, because there is no default value for this option @@ -678,7 +678,7 @@ if ($action == 'edit' || $action == 'updateedit') print '
'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).''.$langs->trans("Description").'  
'; print ''; print ''; - print ''; + print ''; print "\n"; @@ -821,7 +821,7 @@ else { print '  '; } - else if ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + elseif ($mysoc->logo_mini && is_file($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { print ''; } @@ -1040,7 +1040,7 @@ else print '
'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).''.$langs->trans("Description").'  
'; print ''; print ''; - print ''; + print ''; print "\n"; @@ -1077,7 +1077,7 @@ else print '
'.$langs->trans("VATManagement").''.$langs->trans("Description").'  
'; print ''; print ''; - print ''; + print ''; print "\n"; @@ -1097,11 +1097,11 @@ else { print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); } - else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==1) + elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==1) { print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); } - else if($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ + elseif($conf->global->MAIN_INFO_LOCALTAX_CALC1==2){ print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); } @@ -1131,7 +1131,7 @@ else print '
'.$langs->transcountry("LocalTax1Management",$mysoc->country_code).''.$langs->trans("Description").'  
'; print ''; print ''; - print ''; + print ''; print "\n"; @@ -1151,11 +1151,11 @@ else { print $langs->trans("CalcLocaltax1").' - '.$langs->trans("CalcLocaltax1Desc"); } - else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==1) + elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==1) { print $langs->trans("CalcLocaltax2").' - '.$langs->trans("CalcLocaltax2Desc"); } - else if($conf->global->MAIN_INFO_LOCALTAX_CALC2==2) + elseif($conf->global->MAIN_INFO_LOCALTAX_CALC2==2) { print $langs->trans("CalcLocaltax3").' - '.$langs->trans("CalcLocaltax3Desc"); } diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index 660f7c7c500..a54e1eb7aeb 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -71,7 +71,7 @@ if ($action == 'activate_delivery') header("Location: confexped.php"); exit; } -else if ($action == 'disable_delivery') +elseif ($action == 'disable_delivery') { dolibarr_del_const($db, "MAIN_SUBMODULE_LIVRAISON",$conf->entity); header("Location: confexped.php"); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index cfda870e9da..fedccb49642 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -233,7 +233,7 @@ $sql.= ", entity"; $sql.= " FROM ".MAIN_DB_PREFIX."const"; $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")"; if ((empty($user->entity) || $user->admin) && $debug) {} // to force for superadmin to debug -else if (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits +elseif (! GETPOST('visible') || GETPOST('visible') != 'all') $sql.= " AND visible = 1"; // We must always have this. Otherwise, array is too large and submitting data fails due to apache POST or GET limits if (GETPOST('name')) $sql.=natural_search("name", GETPOST('name')); $sql.= " ORDER BY entity, name ASC"; diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index 60be9e062ba..0a704ce5ee8 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -69,7 +69,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') // For contract +elseif ($action == 'specimen') // For contract { $modele= GETPOST('module','alpha'); @@ -115,12 +115,12 @@ else if ($action == 'specimen') // For contract } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -130,7 +130,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "CONTRACT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -147,7 +147,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -155,7 +155,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "CONTRACT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_other') +elseif ($action == 'set_other') { $freetext= GETPOST('CONTRACT_FREE_TEXT','none'); // No alpha here, we want exact string $res1 = dolibarr_set_const($db, "CONTRACT_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index fc3b8f15f39..8a52a4346f8 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * @@ -728,7 +728,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($value == 'price' || preg_match('/^amount/i',$value) || $value == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - else if ($value == 'entity') { + elseif ($value == 'entity') { $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]); } if ($i) $sql.=","; @@ -780,7 +780,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) if ($field == 'price' || preg_match('/^amount/i',$field) || $field == 'taux') { $_POST[$listfieldvalue[$i]] = price2num($_POST[$listfieldvalue[$i]],'MU'); } - else if ($field == 'entity') { + elseif ($field == 'entity') { $_POST[$listfieldvalue[$i]] = getEntity($tabname[$id]); } if ($i) $sql.=","; @@ -1125,7 +1125,7 @@ if ($id) { print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); + elseif (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]); else print $valuetoshow; print ''; } @@ -1409,14 +1409,14 @@ if ($id) { $valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow; } - else if ($value == 'source') + elseif ($value == 'source') { $valuetoshow = isset($sourceList[$valuetoshow])?$sourceList[$valuetoshow]:$valuetoshow; } - else if ($valuetoshow=='all') { + elseif ($valuetoshow=='all') { $valuetoshow=$langs->trans('All'); } - else if ($fieldlist[$field]=='country') { + elseif ($fieldlist[$field]=='country') { if (empty($obj->country_code)) { $valuetoshow='-'; @@ -1427,143 +1427,143 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + elseif ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { $valuetoshow=yn($valuetoshow); $align="center"; } - else if ($fieldlist[$field]=='type_cdr') { + elseif ($fieldlist[$field]=='type_cdr') { if(empty($valuetoshow)) $valuetoshow = $langs->trans('None'); elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); $align="center"; } - else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) { + elseif ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) { $valuetoshow=price($valuetoshow); } if ($value == 'private') { $valuetoshow = yn($elementList[$valuetoshow]); } - else if ($fieldlist[$field]=='libelle_facture') { + elseif ($fieldlist[$field]=='libelle_facture') { $langs->load("bills"); $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); $valuetoshow=nl2br($valuetoshow); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { $key=$langs->trans("Country".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { $langs->load("propal"); $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { $key=$langs->trans("Action".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { + elseif (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { $key=$langs->trans("Currency".strtoupper($obj->code_iso)); $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { $key=$langs->trans(strtoupper($obj->code)); $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { $key=$langs->trans(strtoupper($obj->code)); $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') { $key=$langs->trans("Civility".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { $langs->load('agenda'); $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { $langs->load("bills"); $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { $langs->load("bills"); $key=$langs->trans("PaymentType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { + elseif ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { $langs->load("orders"); $key=$langs->trans($obj->code); $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]}; } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { + elseif ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { $langs->load("sendings"); $key=$langs->trans("SendingMethod".strtoupper($obj->code)); $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') + elseif ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') { $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') + elseif ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') { $langs->load('trips'); $key = $langs->trans(strtoupper($obj->code)); $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { + elseif ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - else if ($fieldlist[$field]=='unicode') { + elseif ($fieldlist[$field]=='unicode') { $valuetoshow = $langs->getCurrencySymbol($obj->code,1); } - else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { + elseif ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { $langs->load("products"); $valuetoshow=$langs->trans($obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { + elseif ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { $langs->load("products"); $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); } - else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) + elseif (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) { $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); } - else if ($fieldlist[$field]=='localtax1' || $fieldlist[$field]=='localtax2') { + elseif ($fieldlist[$field]=='localtax1' || $fieldlist[$field]=='localtax2') { $align="center"; } - else if ($fieldlist[$field]=='localtax1_type') { + elseif ($fieldlist[$field]=='localtax1_type') { if ($obj->localtax1 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; $align="center"; } - else if ($fieldlist[$field]=='localtax2_type') { + elseif ($fieldlist[$field]=='localtax2_type') { if ($obj->localtax2 != 0) $valuetoshow=$localtax_typeList[$valuetoshow]; else $valuetoshow = ''; $align="center"; } - else if ($fieldlist[$field]=='taux') { + elseif ($fieldlist[$field]=='taux') { $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); $align="center"; } - else if (in_array($fieldlist[$field],array('recuperableonly'))) + elseif (in_array($fieldlist[$field],array('recuperableonly'))) { $align="center"; } - else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') { + elseif ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') { $valuetoshow = length_accountg($valuetoshow); } elseif ($fieldlist[$field] == 'fk_tva') @@ -1604,8 +1604,8 @@ if ($id) if (isset($obj->code) && $id != 10) { if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } + elseif ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } + elseif ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } } if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; } @@ -1639,8 +1639,8 @@ if ($id) else { if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); - else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); - else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption"); + elseif (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated"); + elseif (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption"); else print $langs->trans("AlwaysActive"); } print ""; @@ -1755,7 +1755,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return string '' or value of entity into table */ -function fieldList($fieldlist, $obj='', $tabname='', $context='') +function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf,$langs,$db,$mysoc; global $form; @@ -1990,4 +1990,3 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') return $withentity; } - diff --git a/htdocs/admin/dolistore/ajax/image.php b/htdocs/admin/dolistore/ajax/image.php index c1bb4e997dc..1fac509705c 100644 --- a/htdocs/admin/dolistore/ajax/image.php +++ b/htdocs/admin/dolistore/ajax/image.php @@ -53,6 +53,6 @@ try { // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) die('Bad ID'); - else if ($trace[0]['args'][0] == 401) die('Bad auth key'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); else die('Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV); } diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index 553ce2e54e0..a21eb56cb2c 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -54,7 +54,7 @@ class Dolistore * * @param boolean $debug Enable debug of request on screen */ - function __construct($debug=false) + function __construct($debug = false) { global $conf, $langs; @@ -154,7 +154,7 @@ class Dolistore // Here we are dealing with errors $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) die('Bad ID'); - else if ($trace[0]['args'][0] == 401) die('Bad auth key'); + elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); else { print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 3126f432938..e058778155a 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -100,7 +100,7 @@ else { print ''.img_picto($langs->trans("Disabled"),'off').''; } - else if(! empty($conf->global->USER_MAIL_REQUIRED)) + elseif(! empty($conf->global->USER_MAIL_REQUIRED)) { print ''.img_picto($langs->trans("Enabled"),'on').''; } diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index eaef18c9543..12dd01d20f8 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -404,7 +404,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } else { - //$morehtmlstatus .= imap_num_msg($connection).'
'; $morehtml .= imap_num_msg($connection); } @@ -449,7 +448,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; - print ''; + print ''; print ''; // List filters foreach($object->filters as $rulefilter) @@ -462,7 +461,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $langs->trans($arrayoftypes[$rulefilter['type']]); print ''; print ''; - print ''; @@ -492,7 +491,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $form->textwithpicto('', $htmltext); print ''; print ''; - print ''; + print ''; print ''; // List operations $nboflines = count($object->actions); @@ -509,7 +508,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print $langs->trans($arrayoftypes[$ruleaction['type']]); print ''; print ''; - print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index 7e72a5ce003..f388cea8b55 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -503,7 +503,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''; + if (! empty($totalarray['pos'][$i])) print ''; else { if ($i == 1) diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index 2ae3a7cad99..2dec14f0a24 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -74,7 +74,7 @@ if ($action == 'updateMask') } } -else if ($action == 'set_param') +elseif ($action == 'set_param') { $freetext=GETPOST('SHIPPING_FREE_TEXT','none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "SHIPPING_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); @@ -98,7 +98,7 @@ else if ($action == 'set_param') } } -else if ($action == 'specimen') +elseif ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -144,12 +144,12 @@ else if ($action == 'specimen') } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -159,7 +159,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "EXPEDITION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -176,7 +176,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmodel') +elseif ($action == 'setmodel') { dolibarr_set_const($db, "EXPEDITION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index f8429069611..23d2571b256 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -70,7 +70,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') // For fiche inter +elseif ($action == 'specimen') // For fiche inter { $modele= GETPOST('module','alpha'); @@ -118,7 +118,7 @@ else if ($action == 'specimen') // For fiche inter } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); if ($ret > 0 && empty($conf->global->EXPENSEREPORT_ADDON_PDF)) @@ -127,7 +127,7 @@ else if ($action == 'set') } } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -137,7 +137,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "EXPENSEREPORT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -154,7 +154,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -162,7 +162,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "EXPENSEREPORT_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'setoptions') +elseif ($action == 'setoptions') { $db->begin(); diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index d3937a98ba7..0f01fa7a750 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -154,7 +154,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) echo ''; // Action - echo ''; echo ''; echo ''; - echo ''; + echo ''; echo ''; echo '
'.$langs->transcountry("LocalTax2Management",$mysoc->country_code).''.$langs->trans("Description").'  
'; print ''; print '
'.$rulefilter['rulevalue'].''; + print ''; //print $rulefilterobj->getLibStatut(3); print ' '.img_delete().''; print '
'.$ruleaction['actionparam'].''; + print ''; //print $ruleactionobj->getLibStatut(3); print ' '.img_delete().''; print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''.price($totalarray['val'][$totalarray['pos'][$i]]).''.$langs->trans('expenseReportPrintExample', price($range->ik->offset + 5 * $range->ik->coef)).''; + echo ''; if ($range->range_active == 1) { if ($action == 'edit' && $range->ik->id == $id && $range->rowid == $fk_range && $range->fk_c_exp_tax_cat == $fk_c_exp_tax_cat) diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index 7b2baf0ed94..8594d060951 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -187,7 +187,7 @@ if ($action != 'edit') echo ''.$form->selectDate(strtotime(date('Y-m-t', dol_now())), 'end', '', '', 0, '', 1, 0).''.$conf->currency.''.$form->selectyesno('restrictive', 0, 1).'
'; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 048d002a3b7..c289c64b217 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -259,7 +259,7 @@ if ($resql) print ""; print "".$langs->trans("RSS")." ".($i+1).""; - print ''; + print ''; print "trans("Modify")."\">"; print "   "; print "trans("Delete")."\">"; diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 683453023b9..6e9ccf792b0 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -124,12 +124,12 @@ if ($action == 'specimen') } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -139,7 +139,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "FACTURE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -156,7 +156,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -619,7 +619,7 @@ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)) // Hidden conf print ''; print ''.$langs->trans("Type").''; print ''.$langs->trans("Name").''; - print ''; + print ''; print "\n"; $listtype=array( @@ -662,7 +662,7 @@ print ''; print ''; print ''; print $langs->trans("PaymentMode").''; -print ''; +print ''; print "\n"; print ''; @@ -762,7 +762,7 @@ print ''; print $langs->trans("ForceInvoiceDate"); print ''; print $form->selectyesno("forcedate",$conf->global->FAC_FORCE_DATE_VALIDATION,1); -print ''; +print ''; print ''; print "\n"; print ''; @@ -789,7 +789,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -802,7 +802,7 @@ print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftBill"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ''; @@ -842,7 +842,7 @@ print "\n"; print ''; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 8751d906918..e975a2f0ff8 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -167,7 +167,7 @@ else { print ''.img_picto($langs->trans("Disabled"),'switch_off').''; } - else if ($value == 1) + elseif ($value == 1) { print ''.img_picto($langs->trans("Enabled"),'switch_on').''; } diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 7fd349363e1..7e263a5e285 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -70,7 +70,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') // For fiche inter +elseif ($action == 'specimen') // For fiche inter { $modele= GETPOST('module','alpha'); @@ -116,12 +116,12 @@ else if ($action == 'specimen') // For fiche inter } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -131,7 +131,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "FICHEINTER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -148,7 +148,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -156,7 +156,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "FICHEINTER_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_FICHINTER_FREE_TEXT') +elseif ($action == 'set_FICHINTER_FREE_TEXT') { $freetext= GETPOST('FICHINTER_FREE_TEXT','none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "FICHINTER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); @@ -173,7 +173,7 @@ else if ($action == 'set_FICHINTER_FREE_TEXT') } } -else if ($action == 'set_FICHINTER_DRAFT_WATERMARK') +elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') { $draft= GETPOST('FICHINTER_DRAFT_WATERMARK','alpha'); $res = dolibarr_set_const($db, "FICHINTER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity); @@ -554,7 +554,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -567,7 +567,7 @@ print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftInterventionCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ''; @@ -581,7 +581,7 @@ print 'global->FICHINTER_PRINT_PRODUCTS) print 'checked '; print '/>'; -print ''; +print ''; print ''; print "\n"; print ''; @@ -596,7 +596,7 @@ print ''; print ''; print 'global->FICHINTER_USE_SERVICE_DURATION?' checked':'') . '>'; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -612,7 +612,7 @@ print ''; print ''; print 'global->FICHINTER_WITHOUT_DURATION?' checked':'') . '>'; print ''; -print ''; +print ''; print ''; print ''; print ''; @@ -628,7 +628,7 @@ print ''; print ''; print 'global->FICHINTER_DATE_WITHOUT_HOUR?' checked':'') . '>'; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index 47c51069299..98ab10a988e 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -102,7 +102,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index c687a6fbc2d..62fe6631a60 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -71,7 +71,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') // For contract +elseif ($action == 'specimen') // For contract { $modele= GETPOST('module','alpha'); @@ -117,12 +117,12 @@ else if ($action == 'specimen') // For contract } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -132,7 +132,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -149,7 +149,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -157,7 +157,7 @@ else if ($action == 'setmod') dolibarr_set_const($db, "HOLIDAY_ADDON",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'set_other') +elseif ($action == 'set_other') { $freetext= GETPOST('HOLIDAY_FREE_TEXT','none'); // No alpha here, we want exact string $res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index e2168ec2d76..84ce38f9757 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -173,7 +173,7 @@ if ($action == 'update') { dolibarr_set_const($db, "MAIN_LOGIN_BACKGROUND",$original_file,'chaine',0,'',$conf->entity); } - else if (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) + elseif (preg_match('/^ErrorFileIsInfectedWithAVirus/',$result)) { $error++; $langs->load("errors"); diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index f5f5f868801..56866fdaea7 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -143,105 +143,105 @@ print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("PathToGeoIPMaxmindCountryDataFile").'
'; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Common name print ''; -print '"; +print '"; print ''; // Name print ''; -print '"; +print '"; print ''; // Firstname print ''; -print '"; +print '"; print ''; // Company print ''; -print '"; +print '"; print ''; // Mail print ''; -print '"; +print '"; print ''; // Phone pro print ''; -print '"; +print '"; print ''; // Phone home print ''; -print '"; +print '"; print ''; // Mobile print ''; -print '"; +print '"; print ''; // Skype print ''; -print '"; +print '"; print ''; // Fax print ''; -print '"; +print '"; print ''; // Address print ''; -print '"; +print '"; print ''; // ZIP print ''; -print '"; +print '"; print ''; // TOWN print ''; -print '"; +print '"; print ''; // COUNTRY print ''; -print '"; +print '"; print ''; print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPLdapMapping").''.$langs->trans("LDAPNamingAttribute").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FULLNAME?' checked':'').">
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_NAME?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FIRSTNAME?' checked':'').">
'.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COMPANY?' checked':'').">
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MAIL?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_PHONE?' checked':'').">
'.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_HOMEPHONE?' checked':'').">
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_MOBILE?' checked':'').">
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_SKYPE?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_SKYPE?' checked':'').">
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_FAX?' checked':'').">
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ADDRESS?' checked':'').">
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_ZIP?' checked':'').">
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").'global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_TOWN?' checked':'').">
'.$langs->trans("LDAPFieldCountry").''; print ''; print ' global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'').">global->LDAP_KEY_CONTACTS && $conf->global->LDAP_KEY_CONTACTS==$conf->global->LDAP_CONTACT_FIELD_COUNTRY?' checked':'').">
'; @@ -321,4 +321,3 @@ if (function_exists("ldap_connect")) // End of page llxFooter(); $db->close(); - diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index 247ecfb28aa..43f66147123 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -135,7 +135,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Filtre @@ -144,7 +144,7 @@ print "\n"; print ''; -print '"; +print '"; print ''; // Name @@ -152,7 +152,7 @@ print ''; print ''; -print '"; +print '"; print ''; */ @@ -160,14 +160,14 @@ print ''; print ''; -print '"; +print '"; print ''; // User group print ''; -print '"; +print '"; print ''; print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPLdapMapping").''.$langs->trans("LDAPNamingAttribute").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldCommonNameExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME)?' checked':'').">global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_NAME?' checked':'').">global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_NAME?' checked':'').">
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION)?' checked':'').">global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_DESCRIPTION)?' checked':'').">
'.$langs->trans("LDAPFieldGroupMembers").''; print ''; print ''.$langs->trans("LDAPFieldGroupMembersExample").'global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'').">global->LDAP_KEY_GROUPS && $conf->global->LDAP_KEY_GROUPS==$conf->global->LDAP_GROUP_FIELD_GROUPMEMBERS)?' checked':'').">
'; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index 818ec5aaff6..48d2aace5d7 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -167,7 +167,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Filtre @@ -176,63 +176,63 @@ print "\n"; print ''; -print '"; +print '"; print ''; // Name print ''; -print '"; +print '"; print ''; // Firstname print ''; -print ''; +print ''; print ''; // Login unix print ''; -print '"; +print '"; print ''; // Login samba print ''; -print '"; +print '"; print ''; // Password not crypted print ''; -print ''; +print ''; print ''; // Password crypted print ''; -print ''; +print ''; print ''; // Mail print ''; -print '"; +print '"; print ''; // Phone pro print ''; -print ''; +print ''; print ''; // Phone perso @@ -240,77 +240,77 @@ print ''; print ''; -print ''; +print ''; print ''; // Mobile print ''; -print ''; +print ''; print ''; // Skype print ''; -print ''; +print ''; print ''; // Fax print ''; -print ''; +print ''; print ''; // Company print ''; -print ''; +print ''; print ''; // Address print ''; -print ''; +print ''; print ''; // ZIP print ''; -print ''; +print ''; print ''; // TOWN print ''; -print ''; +print ''; print ''; // COUNTRY print ''; -print ''; +print ''; print ''; // Description print ''; -print ''; +print ''; print ''; // Public Note print ''; -print ''; +print ''; print ''; // Birthday @@ -318,14 +318,14 @@ print ''; print ''; -print ''; +print ''; print ''; // Status print ''; -print ''; +print ''; print ''; // First subscription date @@ -333,35 +333,35 @@ print ''; print ''; -print ''; +print ''; print ''; // First subscription amount print ''; -print ''; +print ''; print ''; // Last subscription date print ''; -print ''; +print ''; print ''; // Last subscription amount print ''; -print ''; +print ''; print ''; // End last subscriptions print ''; -print ''; +print ''; print ''; print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPLdapMapping").''.$langs->trans("LDAPNamingAttribute").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME)?' checked':'').">global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME)?' checked':'').">global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_NAME)?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'  
'.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN)?' checked':'').">global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN)?' checked':'').">
'.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA)?' checked':'').">global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_LOGIN_SAMBA)?' checked':'').">
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'  
'.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'  
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL)?' checked':'').">global->LDAP_KEY_MEMBERS && $conf->global->LDAP_KEY_MEMBERS==$conf->global->LDAP_MEMBER_FIELD_MAIL)?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'  
'.$langs->trans("LDAPFieldHomePhone").''; print ''; print ''.$langs->trans("LDAPFieldHomePhoneExample").'  
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'  
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").'  
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'  
'.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").'  
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").'  
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").'  
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").'  
'.$langs->trans("LDAPFieldCountry").''; print ''; print '   
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'  
'.$langs->trans("LDAPFieldNotePublic").''; print ''; print ''.$langs->trans("LDAPFieldNotePublicExample").'  
'.$langs->trans("LDAPFieldBirthdate").''; print ''; print '   
'.$langs->trans("LDAPFieldStatus").''; print ''; print '   
'.$langs->trans("LDAPFieldFirstSubscriptionDate").''; print ''; print '   
'.$langs->trans("LDAPFieldFirstSubscriptionAmount").''; print ''; print '   
'.$langs->trans("LDAPFieldLastSubscriptionDate").''; print ''; print '   
'.$langs->trans("LDAPFieldLastSubscriptionAmount").''; print ''; print '   
'.$langs->trans("LDAPFieldEndLastSubscription").''; print ''; print '   
'; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 912d4ee3ea9..b07bf0b1484 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -134,7 +134,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Filtre @@ -143,21 +143,21 @@ print "\n"; print ''; -print '"; +print '"; print ''; // Description print ''; -print '"; +print '"; print ''; // User group print ''; -print '"; +print '"; print ''; print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPLdapMapping").''.$langs->trans("LDAPNamingAttribute").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldCommonNameExample").'global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)?' checked':'').">global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldDescription").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBER_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)?' checked':'').">global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBER_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_DESCRIPTION)?' checked':'').">
'.$langs->trans("LDAPFieldGroupMembers").''; print ''; print ''.$langs->trans("LDAPFieldGroupMembersExample").'global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)?' checked':'').">global->LDAP_KEY_MEMBERS_TYPES && $conf->global->LDAP_KEY_MEMBERS_TYPES==$conf->global->LDAP_MEMBER_TYPE_FIELD_GROUPMEMBERS)?' checked':'').">
'; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 934fcf8e03e..124bec14f6d 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -158,147 +158,147 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; // Common name print ''; -print '"; +print '"; print ''; // Name print ''; -print '"; +print '"; print ''; // Firstname print ''; -print '"; +print '"; print ''; // Login unix print ''; -print '"; +print '"; print ''; // Login samba print ''; -print '"; +print '"; print ''; // Password not crypted print ''; -print ''; +print ''; print ''; // Password crypted print ''; -print ''; +print ''; print ''; // Mail print ''; -print '"; +print '"; print ''; // Phone print ''; -print '"; +print '"; print ''; // Mobile print ''; -print '"; +print '"; print ''; // Skype print ''; -print '"; +print '"; print ''; // Fax print ''; -print '"; +print '"; print ''; // Company print ''; -print ''; +print ''; print ''; // Address print ''; -print ''; +print ''; print ''; // ZIP print ''; -print ''; +print ''; print ''; // TOWN print ''; -print ''; +print ''; print ''; // COUNTRY print ''; -print ''; +print ''; print ''; // Title print ''; -print ''; +print ''; print ''; // Note print ''; -print ''; +print ''; print ''; // Sid print ''; -print '"; +print '"; print ''; print '
'.$langs->trans("LDAPDolibarrMapping").''.$langs->trans("LDAPLdapMapping").''.$langs->trans("LDAPNamingAttribute").''.$langs->trans("LDAPNamingAttribute").'
'.$langs->trans("LDAPFieldFullname").''; print ''; print ''.$langs->trans("LDAPFieldFullnameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FULLNAME)?' checked':'').">
'.$langs->trans("LDAPFieldName").''; print ''; print ''.$langs->trans("LDAPFieldNameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_NAME)?' checked':'').">
'.$langs->trans("LDAPFieldFirstName").''; print ''; print ''.$langs->trans("LDAPFieldFirstNameExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FIRSTNAME)?' checked':'').">
'.$langs->trans("LDAPFieldLoginUnix").''; print ''; print ''.$langs->trans("LDAPFieldLoginExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN)?' checked':'').">
'.$langs->trans("LDAPFieldLoginSamba").''; print ''; print ''.$langs->trans("LDAPFieldLoginSambaExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_LOGIN_SAMBA)?' checked':'').">
'.$langs->trans("LDAPFieldPasswordNotCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'  
'.$langs->trans("LDAPFieldPasswordCrypted").''; print ''; print ''.$langs->trans("LDAPFieldPasswordExample").'  
'.$langs->trans("LDAPFieldMail").''; print ''; print ''.$langs->trans("LDAPFieldMailExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MAIL)?' checked':'').">
'.$langs->trans("LDAPFieldPhone").''; print ''; print ''.$langs->trans("LDAPFieldPhoneExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_PHONE)?' checked':'').">
'.$langs->trans("LDAPFieldMobile").''; print ''; print ''.$langs->trans("LDAPFieldMobileExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_MOBILE)?' checked':'').">
'.$langs->trans("LDAPFieldSkype").''; print ''; print ''.$langs->trans("LDAPFieldSkypeExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SKYPE)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SKYPE)?' checked':'').">
'.$langs->trans("LDAPFieldFax").''; print ''; print ''.$langs->trans("LDAPFieldFaxExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_FAX)?' checked':'').">
'.$langs->trans("LDAPFieldCompany").''; print ''; print ''.$langs->trans("LDAPFieldCompanyExample").'  
'.$langs->trans("LDAPFieldAddress").''; print ''; print ''.$langs->trans("LDAPFieldAddressExample").'  
'.$langs->trans("LDAPFieldZip").''; print ''; print ''.$langs->trans("LDAPFieldZipExample").'  
'.$langs->trans("LDAPFieldTown").''; print ''; print ''.$langs->trans("LDAPFieldTownExample").'  
'.$langs->trans("LDAPFieldCountry").''; print ''; print '   
'.$langs->trans("LDAPFieldTitle").''; print ''; print ''.$langs->trans("LDAPFieldTitleExample").'  
'.$langs->trans("Note").''; print ''; print ''.$langs->trans("LDAPFieldDescriptionExample").'  
'.$langs->trans("LDAPFieldSid").''; print ''; print ''.$langs->trans("LDAPFieldSidExample").'global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'').">global->LDAP_KEY_USERS && $conf->global->LDAP_KEY_USERS==$conf->global->LDAP_FIELD_SID)?' checked':'').">
'; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 6342f731347..ad41d7bd945 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -139,20 +139,20 @@ else print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_UNIT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_MAX_DECIMALS_UNIT.''; + print ''.$conf->global->MAIN_MAX_DECIMALS_UNIT.''; print ''; print $form->textwithpicto($langs->trans("MAIN_MAX_DECIMALS_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_MAX_DECIMALS_TOT.''; + print ''.$conf->global->MAIN_MAX_DECIMALS_TOT.''; - print ''.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.$conf->global->MAIN_MAX_DECIMALS_SHOWN.''; + print ''.$langs->trans("MAIN_MAX_DECIMALS_SHOWN").''.$conf->global->MAIN_MAX_DECIMALS_SHOWN.''; print ''; print $form->textwithpicto($langs->trans("MAIN_ROUNDING_RULE_TOT"),$langs->trans("ParameterActiveForNextInputOnly")); - print ''.$conf->global->MAIN_ROUNDING_RULE_TOT.''; + print ''.$conf->global->MAIN_ROUNDING_RULE_TOT.''; print ''; diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index bc82d03d8d7..e49ef792700 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -471,7 +471,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -481,4 +481,3 @@ print ''; // End of page llxFooter(); $db->close(); - diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index 419f6efbee9..20e0b59199a 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2017 Alexandre Spangaro * * 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 diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 33b6d83e0da..d7eb804fa4d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -673,11 +673,11 @@ else { print $langs->trans('RobotEmail'); } - else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') + elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'user') { print $langs->trans('UserEmail'); } - else if ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') + elseif ($conf->global->MAIN_MAIL_DEFAULT_FROMTYPE === 'company') { print $langs->trans('CompanyEmail').' '.dol_escape_htmltag('<'.$mysoc->email.'>'); } diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index bbfc2ee2363..12703d5d38a 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -462,7 +462,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; + if (! empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; else { if ($i == 1) diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 289a3ecd081..ab79bfec0fa 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015 Ferran Marcet * Copyright (C) 2016 Raphaël Doursenaud * Copyright (C) 2018 Frédéric France @@ -479,7 +479,7 @@ foreach ($fieldlist as $field => $value) { print ''; if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print ''.$valuetoshow.' '.img_help(1,$valuetoshow).''; - else if (! empty($tabhelp[$id][$value])) + elseif (! empty($tabhelp[$id][$value])) { if (in_array($value, array('topic'))) print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2, $value); // Tooltip on click else print $form->textwithpicto($valuetoshow, $tabhelp[$id][$value], 1, 'help', '', 0, 2); // Tooltip on hover @@ -525,7 +525,7 @@ if (empty($reshook)) } } -print ''; +print ''; print ''; print ""; @@ -552,7 +552,7 @@ foreach ($fieldsforcontent as $tmpfieldlist) if ($tmpfieldlist == 'topic') { print ''; } - else if ($tmpfieldlist == 'joinfiles') { + elseif ($tmpfieldlist == 'joinfiles') { print ''; } else @@ -947,7 +947,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ -function fieldList($fieldlist, $obj='', $tabname='', $context='') +function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf, $langs, $user, $db; global $form; @@ -1065,4 +1065,3 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='') } } } - diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index 6e5f0d77b4b..d85218dbd5a 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -42,7 +42,7 @@ if ($action == 'activate_hidemenu') header("Location: ".$_SERVER["PHP_SELF"]); exit; } -else if ($action == 'disable_hidemenu') +elseif ($action == 'disable_hidemenu') { dolibarr_del_const($db, "MAIN_MENU_HIDE_UNAUTHORIZED",$conf->entity); header("Location: ".$_SERVER["PHP_SELF"]); diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 4694021c233..df1d1d48c90 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -142,6 +142,12 @@ if ($action=='install') setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors'); $error++; } + if (empty($_FILES['fileinstall']['tmp_name'])) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors'); + $error++; + } } if (! $error) @@ -152,14 +158,14 @@ if ($action=='install') dol_mkdir($conf->admin->dir_temp.'/'.$original_file); } - $tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir'; + $tmpdir=preg_replace('/\.zip$/i','',$original_file).'.dir'; if ($tmpdir) { @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir); dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir); } - $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']); + $result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']); if ($result > 0) { $result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir); @@ -207,6 +213,7 @@ if ($action=='install') } else { + setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors'); $error++; } } @@ -244,7 +251,7 @@ if ($action == 'set' && $user->admin) header("Location: ".$_SERVER["PHP_SELF"]."?mode=".$mode.$param.($page_y?'&page_y='.$page_y:'')); exit; } -else if ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') +elseif ($action == 'reset' && $user->admin && GETPOST('confirm') == 'yes') { $result=unActivateModule($value); if ($result) setEventMessages($result, null, 'errors'); @@ -698,7 +705,7 @@ if ($mode == 'common') { print $langs->trans("Disabled"); } - else if (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1))) + elseif (! empty($objMod->always_enabled) || ((! empty($conf->multicompany->enabled) && $objMod->core_enabled) && ($user->entity || $conf->entity!=1))) { if (method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) print $langs->trans("Used"); else { @@ -761,7 +768,7 @@ if ($mode == 'common') } print "\n"; } - else if (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) + elseif (preg_match('/^([^@]+)@([^@]+)$/i',$objMod->config_page_url,$regs)) { print ''.img_picto($langs->trans("Setup"),"setup",'style="padding-right: 6px"').''; } @@ -783,7 +790,7 @@ if ($mode == 'common') { // Should never happened } - else if (! empty($objMod->disabled)) + elseif (! empty($objMod->disabled)) { print $langs->trans("Disabled"); } @@ -1012,6 +1019,7 @@ if ($mode == 'deploy') print '
'; print '
'; + print ''; print ''; print ''; @@ -1047,6 +1055,20 @@ if ($mode == 'deploy') print ''; + if (! empty($conf->global->MAIN_UPLOAD_DOC)) + { + if ($user->admin) + { + $langs->load('other'); + print ' '; + print info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1); + } + } + else + { + print ' ('.$langs->trans("UploadDisabled").')'; + } + print '
'; print '
'; diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 0a64145e9a4..fbf6603d139 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -193,7 +193,7 @@ print ''; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_buyPriceInCurrency").''; -print ''; +print ''; print '
'; print ''; print ''; @@ -207,7 +207,7 @@ print ''; print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_modifyRateApplication").''; -print ''; +print ''; print ''; print ''; print ''; @@ -229,7 +229,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize")).''."\n"; - print ''; + print ''; print ''; print ''; print ''; @@ -240,7 +240,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_appId").''; - print ''; + print ''; print ''; print ''; print ''; @@ -252,7 +252,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_appCurrencySource").''; - print ''; + print ''; print ''; print ''; print ''; @@ -263,7 +263,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").''; - print ''; + print ''; print ''; print ''; print ''; @@ -289,7 +289,7 @@ print ''; print ''; print ''; print ''.$form->selectCurrency('', 'code').''; -print ''; +print ''; print ''; print ''; print ' '; @@ -300,7 +300,7 @@ print '
'; print ''; print ''.$conf->currency.$form->textwithpicto(' ', $langs->trans("BaseCurrency")).''; -print '1'; +print '1'; print ''; foreach ($TCurrency as &$currency) @@ -309,7 +309,7 @@ foreach ($TCurrency as &$currency) print ''; print ''.$currency->code.' - '.$currency->name.''; - print ''; + print ''; print '
'; print ''; print ''; diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 92ba0bec200..4a4e07d35f9 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -71,7 +71,7 @@ if ($action == 'setvalue' && $user->admin) $newval=GETPOST($shortkey.'_key'); //print $newkey.' - '.$newval.'
'; } - else if (preg_match('/^NOTIF_(.*)_new_key/',$key,$reg)) + elseif (preg_match('/^NOTIF_(.*)_new_key/',$key,$reg)) { // Add a new entry $newkey='NOTIFICATION_FIXEDEMAIL_'.$reg[1].'_THRESHOLD_HIGHER_'.((int) GETPOST($shortkey.'_amount')); @@ -151,7 +151,7 @@ print ''; print ''.$langs->trans("Label").''; /*print ''.$langs->trans("Code").''; print ''.$langs->trans("Label").'';*/ -//print ''.$langs->trans("NbOfTargetedContacts").''; +//print ''.$langs->trans("NbOfTargetedContacts").''; print "\n"; // Load array of available notifications diff --git a/htdocs/admin/openinghours.php b/htdocs/admin/openinghours.php index 19225273bfc..da5aed70c81 100644 --- a/htdocs/admin/openinghours.php +++ b/htdocs/admin/openinghours.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index 816ab8344ce..f01794c6c17 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -247,7 +247,7 @@ print ''; print $langs->trans("PaymentOnDifferentThirdBills"); print ''; print $form->selectyesno("FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS",$conf->global->FACTURE_PAYMENTS_ON_DIFFERENT_THIRDPARTIES_BILLS,1); -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 37c836043a0..3d9a6984f88 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -86,7 +86,7 @@ if ($action == 'activate_pdfsecurity') header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); exit; } -else if ($action == 'disable_pdfsecurity') +elseif ($action == 'disable_pdfsecurity') { dolibarr_del_const($db, "PDF_SECURITY_ENCRYPTION",$conf->entity); header("Location: ".$_SERVER["PHP_SELF"]."?mainmenu=home&leftmenu=setup"); diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index a56e8ad6def..a6c5c54a40f 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -96,9 +96,7 @@ if ($action == "set") { $res = dolibarr_set_const($db, "PRELEVEMENT_ADDDAYS", GETPOST("PRELEVEMENT_ADDDAYS"),'chaine',0,'',$conf->entity); if (! $res > 0) $error++; - } else - - if (! $error) + } elseif (! $error) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); @@ -495,7 +493,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print ''; print ''.$langs->trans("User").''; print ''.$langs->trans("Value").''; - print ''.$langs->trans("Action").''; + print ''.$langs->trans("Action").''; print "\n"; print ''; @@ -506,7 +504,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print $form->selectarray('action',$actions);// select_dolusers(0,'user',0); print ''; - print ''; + print ''; // List of current notifications for objet_type='withdraw' $sql = "SELECT u.lastname, u.firstname,"; @@ -532,7 +530,7 @@ if (! empty($conf->global->MAIN_MODULE_NOTIFICATION)) print ''.dolGetFirstLastname($obj->firstname,$obj->lastname).''; $label=($langs->trans("Notify_".$obj->code)!="Notify_".$obj->code?$langs->trans("Notify_".$obj->code):$obj->label); print ''.$label.''; - print 'rowid.'">'.img_delete().''; + print 'rowid.'">'.img_delete().''; print ''; $i++; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index cf860cd64ba..b9fe6bca9d0 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -188,7 +188,7 @@ if ($action == 'set') $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -197,7 +197,7 @@ else if ($action == 'del') } } -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "PROPALE_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -212,7 +212,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -522,7 +522,7 @@ print ""; print ''; print ''.$langs->trans("DefaultProposalDurationValidity").''; print ''."global->PROPALE_VALIDITY_DURATION."\">"; -print ''; +print ''; print ''; print ''; @@ -534,7 +534,7 @@ print ''; print $langs->trans("UseCustomerContactAsPropalRecipientIfExist"); print ''; print $form->selectyesno("value",$conf->global->PROPALE_USE_CUSTOMER_CONTACT_AS_RECIPIENT,1); -print ''; +print ''; print ''; print "\n"; print ''; @@ -562,7 +562,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -575,7 +575,7 @@ print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ''; @@ -585,7 +585,7 @@ if ($conf->banque->enabled) { print ''; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL'); @@ -644,7 +644,7 @@ print "\n"; print ''; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/proxy.php b/htdocs/admin/proxy.php index 9490a291729..5a4581e7e83 100644 --- a/htdocs/admin/proxy.php +++ b/htdocs/admin/proxy.php @@ -132,7 +132,7 @@ print "\n"; print ''; -print ''.$langs->trans("ConnectionTimeout").''; +print ''.$langs->trans("ConnectionTimeout").''; print ''; print ''; print 'global->MAIN_USE_CONNECT_TIMEOUT).'">'; @@ -142,7 +142,7 @@ print ''; print ''; -print ''.$langs->trans("ResponseTimeout").''; +print ''.$langs->trans("ResponseTimeout").''; print ''; print ''; print ''; @@ -152,7 +152,7 @@ print ''; print ''; -print ''.$langs->trans("MAIN_PROXY_USE").''; +print ''.$langs->trans("MAIN_PROXY_USE").''; print ''; print ''; print $form->selectyesno('MAIN_PROXY_USE',$conf->global->MAIN_PROXY_USE,1); @@ -161,7 +161,7 @@ print ''; print ''; -print ''.$langs->trans("MAIN_PROXY_HOST").''; +print ''.$langs->trans("MAIN_PROXY_HOST").''; print ''; print ''; print ''; @@ -170,7 +170,7 @@ print ''; print ''; -print ''.$langs->trans("MAIN_PROXY_PORT").''; +print ''.$langs->trans("MAIN_PROXY_PORT").''; print ''; print ''; print ''; @@ -179,7 +179,7 @@ print ''; print ''; -print ''.$langs->trans("MAIN_PROXY_USER").''; +print ''.$langs->trans("MAIN_PROXY_USER").''; print ''; print ''; print ''; @@ -188,7 +188,7 @@ print ''; print ''; -print ''.$langs->trans("MAIN_PROXY_PASS").''; +print ''.$langs->trans("MAIN_PROXY_PASS").''; print ''; print ''; print ''; diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 4aa362932af..07781551eb6 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -80,7 +80,7 @@ if ($action == 'updateMask') } } -else if ($action == 'set_param') +elseif ($action == 'set_param') { $freetext=GETPOST('RECEPTION_FREE_TEXT','none'); // No alpha here, we want exact string $res = dolibarr_set_const($db, "RECEPTION_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity); @@ -104,7 +104,7 @@ else if ($action == 'set_param') } } -else if ($action == 'specimen') +elseif ($action == 'specimen') { $modele=GETPOST('module','alpha'); @@ -150,12 +150,12 @@ else if ($action == 'specimen') } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -165,7 +165,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "RECEPTION_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -182,7 +182,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmodel') +elseif ($action == 'setmodel') { dolibarr_set_const($db, "RECEPTION_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index 566e57e587b..c70d8c08a91 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -103,7 +103,7 @@ else ); print $form->selectarray("activate_RESOURCE_USE_SEARCH_TO_SELECT",$arrval,$conf->global->RESOURCE_USE_SEARCH_TO_SELECT); print ''; - print ''; + print ''; print ''; print ''; } diff --git a/htdocs/admin/salaries.php b/htdocs/admin/salaries.php index f724bd9e50c..057c2cfa3db 100644 --- a/htdocs/admin/salaries.php +++ b/htdocs/admin/salaries.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2015 Alexandre Spangaro * * 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 diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index 26dcdc85b8d..7a4581ac8ec 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -108,7 +108,7 @@ if ($action == 'activate_encrypt') dol_print_error($db,''); } } -else if ($action == 'disable_encrypt') +elseif ($action == 'disable_encrypt') { //On n'autorise pas l'annulation de l'encryption car les mots de passe ne peuvent pas etre decodes //Do not allow "disable encryption" as passwords cannot be decrypted @@ -137,7 +137,7 @@ if ($action == 'activate_encryptdbpassconf') setEventMessages($langs->trans('InstrucToEncodePass',dol_encode($dolibarr_main_db_pass)), null, 'warnings'); } } -else if ($action == 'disable_encryptdbpassconf') +elseif ($action == 'disable_encryptdbpassconf') { $result = encodedecode_dbpassconf(0); if ($result > 0) @@ -161,7 +161,7 @@ if ($action == 'activate_MAIN_SECURITY_DISABLEFORGETPASSLINK') header("Location: security.php"); exit; } -else if ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') +elseif ($action == 'disable_MAIN_SECURITY_DISABLEFORGETPASSLINK') { dolibarr_del_const($db, "MAIN_SECURITY_DISABLEFORGETPASSLINK",$conf->entity); header("Location: security.php"); diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 87e0d6dd941..f3449e12885 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -67,7 +67,7 @@ if ($action == 'updateform') // Delete file -else if ($action == 'delete') +elseif ($action == 'delete') { $langs->load("other"); $file = $conf->admin->dir_temp . '/' . GETPOST('urlfile','alpha'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). @@ -126,7 +126,7 @@ print ''; print ''; -print ''.$langs->trans("UMask").''; +print ''.$langs->trans("UMask").''; print $form->textwithpicto('',$langs->trans("UMaskExplanation")); print ''; print ''; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index b1e4f745560..99684305cec 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -57,7 +57,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i',$action,$reg)) } } -else if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) +elseif (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) { $code=$reg[1]; if (dolibarr_del_const($db, $code, $conf->entity) > 0) @@ -71,7 +71,7 @@ else if (preg_match('/del_([a-z0-9_\-]+)/i',$action,$reg)) } } -else if ($action == 'updateform') +elseif ($action == 'updateform') { $res1=dolibarr_set_const($db, "MAIN_APPLICATION_TITLE", $_POST["MAIN_APPLICATION_TITLE"],'chaine',0,'',$conf->entity); $res2=dolibarr_set_const($db, "MAIN_SESSION_TIMEOUT", $_POST["MAIN_SESSION_TIMEOUT"],'chaine',0,'',$conf->entity); @@ -109,13 +109,13 @@ dol_fiche_head($head, 'misc', $langs->trans("Security"), -1); print ''; print ''; print ''; -print ''; +print ''; print ''; // Enable Captcha code print ''; print ''; -print ''; // Enable advanced perms print ''; print ''; -print '\n"; $sessiontimeout=ini_get("session.gc_maxlifetime"); if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=$sessiontimeout; print ''; -print ''; print ''; $sessiontimeout=ini_get("session.gc_maxlifetime"); if (empty($conf->global->MAIN_APPLICATION_TITLE)) $conf->global->MAIN_APPLICATION_TITLE=""; print ''; -print ''; print ''; print ''; - print ''; print ''; - print '\n"; @@ -514,7 +516,7 @@ print "\n"; print '\n"; print '
'.$langs->trans("Parameters").''.$langs->trans("Status").''.$langs->trans("Status").'
'.$langs->trans("UseCaptchaCode").''; +print ''; if (function_exists("imagecreatefrompng")) { if (! empty($conf->use_javascript_ajax)) @@ -144,7 +144,7 @@ print '
'.$langs->trans("UseAdvancedPerms").''; +print ''; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); @@ -179,7 +179,7 @@ print "
'.$langs->trans("SessionTimeOut").''; +print ''.$langs->trans("SessionTimeOut").''; print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor"))); print ''; @@ -191,7 +191,7 @@ print '
'.$langs->trans("MAIN_APPLICATION_TITLE").''; +print ''.$langs->trans("MAIN_APPLICATION_TITLE").''; print ''; print ' '; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 7a60d234405..f358d3310da 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -454,7 +454,7 @@ if (! empty($conf->fournisseur->enabled) && !empty($conf->global->STOCK_CALCULAT print '
'.$langs->trans("UseDispatchStatus").''; + print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); } else { @@ -522,7 +522,7 @@ if ($conf->global->PRODUIT_SOUSPRODUITS) print '
'.$langs->trans("IndependantSubProductStock").''; + print ''; print "
"; print ''; print ""; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 45d588fb031..b6214232971 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -43,6 +43,8 @@ accessforbidden(); $type=GETPOST('type', 'alpha'); $value=GETPOST('value', 'alpha'); $action=GETPOST('action', 'alpha'); + +$label = GETPOST('label', 'alpha'); $scandir = GETPOST('scan_dir','alpha'); $specimenthirdparty=new Societe($db); @@ -122,12 +124,12 @@ if ($action == 'specimen') // For invoices } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -137,7 +139,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "INVOICE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -153,7 +155,7 @@ else if ($action == 'setdoc') $ret = addDocumentModel($value, $type, $label, $scandir); } } -else if ($action == 'unsetdoc') +elseif ($action == 'unsetdoc') { dolibarr_del_const($db, "INVOICE_SUPPLIER_ADDON_PDF", $conf->entity); } @@ -491,7 +493,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print '
'; +print ''; print ''; print "
'; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print '
'; +print ''; print "
'; diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index 88cb18d5d80..69d582ff90a 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -73,7 +73,7 @@ if ($action == 'updateMask') } } -else if ($action == 'specimen') // For orders +elseif ($action == 'specimen') // For orders { $modele=GETPOST('module','alpha'); @@ -120,12 +120,12 @@ else if ($action == 'specimen') // For orders } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -135,7 +135,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -152,7 +152,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -160,13 +160,13 @@ else if ($action == 'setmod') dolibarr_set_const($db, "COMMANDE_SUPPLIER_ADDON_NUMBER",$value,'chaine',0,'',$conf->entity); } -else if ($action == 'addcat') +elseif ($action == 'addcat') { $fourn = new Fournisseur($db); $fourn->CreateCategory($user,$_POST["cat"]); } -else if ($action == 'set_SUPPLIER_ORDER_OTHER') +elseif ($action == 'set_SUPPLIER_ORDER_OTHER') { $freetext = GETPOST('SUPPLIER_ORDER_FREE_TEXT','none'); // No alpha here, we want exact string $doubleapproval = GETPOST('SUPPLIER_ORDER_3_STEPS_TO_BE_APPROVED','alpha'); @@ -206,7 +206,7 @@ else if ($action == 'set_SUPPLIER_ORDER_OTHER') } // Activate ask for payment bank -else if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') +elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') { $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER",$value,'chaine',0,'',$conf->entity); @@ -503,7 +503,7 @@ $var=false; print $langs->trans("IfSetToYesDontForgetPermission"); print ''; print ''; - print ''; + print ''; print ''; print "\n"; @@ -560,7 +560,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; @@ -584,7 +584,7 @@ print "\n"; print ''; print $langs->trans("YouMayFindNotificationsFeaturesIntoModuleNotification").'
'; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 77f2a95070e..ecb7b455657 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -61,18 +61,18 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("Error"), null, 'errors'); } -}else if ($action == 'setmod') +}elseif ($action == 'setmod') { dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON", $value, 'chaine', 0, '', $conf->entity); } // Activate a model -else if ($action == 'set') +elseif ($action == 'set') { $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -82,7 +82,7 @@ else if ($action == 'del') } // Set default model -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "SUPPLIER_PAYMENT_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -99,7 +99,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'specimen') +elseif ($action == 'specimen') { $modele=GETPOST('module','alpha'); diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index 056982c4d08..430bd3b8436 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -169,7 +169,7 @@ if ($action == 'set') $ret = addDocumentModel($value, $type, $label, $scandir); } -else if ($action == 'del') +elseif ($action == 'del') { $ret = delDocumentModel($value, $type); if ($ret > 0) @@ -178,7 +178,7 @@ else if ($action == 'del') } } -else if ($action == 'setdoc') +elseif ($action == 'setdoc') { if (dolibarr_set_const($db, "SUPPLIER_PROPOSAL_ADDON_PDF",$value,'chaine',0,'',$conf->entity)) { @@ -193,7 +193,7 @@ else if ($action == 'setdoc') } } -else if ($action == 'setmod') +elseif ($action == 'setmod') { // TODO Verifier si module numerotation choisi peut etre active // par appel methode canBeActivated @@ -517,7 +517,7 @@ else $doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes'); print $doleditor->Create(); } -print ''; +print ''; print ''; print "\n"; print ''; @@ -530,7 +530,7 @@ print ''; print $form->textwithpicto($langs->trans("WatermarkOnDraftProposal"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'
'; print ''; print ''; -print ''; +print ''; print ''; print "\n"; print ''; @@ -539,7 +539,7 @@ if ($conf->banque->enabled) { print ''; - print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; + print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '; if (! empty($conf->use_javascript_ajax)) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); @@ -585,4 +585,3 @@ print "\n
"; // End of page llxFooter(); $db->close(); - diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index a3cceda40da..9c857964a3c 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -230,7 +230,7 @@ foreach ($syslogModules as $moduleName) if (! empty($tmpoption)) { if (isset($_POST[$tmpoption])) $value=$_POST[$tmpoption]; - else if (! empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption; + elseif (! empty($conf->global->$tmpoption)) $value = $conf->global->$tmpoption; } else $value = (isset($option['default']) ? $option['default'] : ''); @@ -275,7 +275,7 @@ print ''; print ''; print ''; print ''; -print ''; +print ''; print "\n"; print ''; diff --git a/htdocs/admin/system/constall.php b/htdocs/admin/system/constall.php index fef49bd5c12..645abf36ce8 100644 --- a/htdocs/admin/system/constall.php +++ b/htdocs/admin/system/constall.php @@ -183,7 +183,7 @@ foreach($configfileparameters as $key) // Value print ""; diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index c19c7075784..2436807b584 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -56,17 +56,17 @@ if (preg_match('/mysql/i',$conf->db->type)) $sql = "SHOW TABLE STATUS"; $base=1; } -else if ($conf->db->type == 'pgsql') +elseif ($conf->db->type == 'pgsql') { $sql = "SELECT conname, contype FROM pg_constraint;"; $base=2; } -else if ($conf->db->type == 'mssql') +elseif ($conf->db->type == 'mssql') { //$sqls[0] = ""; //$base=3; } -else if ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3') +elseif ($conf->db->type == 'sqlite' || $conf->db->type == 'sqlite3') { //$sql = "SELECT name, type FROM sqlite_master"; $base = 4; diff --git a/htdocs/admin/system/dbtable.php b/htdocs/admin/system/dbtable.php index 2cf249c0f74..9f9cc63505d 100644 --- a/htdocs/admin/system/dbtable.php +++ b/htdocs/admin/system/dbtable.php @@ -50,7 +50,7 @@ if (preg_match('/mysql/i',$conf->db->type)) $sql = "SHOW TABLE STATUS LIKE '".$db->escape($table)."'"; $base=1; } -else if ($conf->db->type == 'pgsql') +elseif ($conf->db->type == 'pgsql') { $sql = "SELECT conname,contype FROM pg_constraint"; $base=2; diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index f81053e1631..a8b5b2da401 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -374,8 +374,8 @@ foreach($configfileparameters as $key => $value) // Value print "'; $out.=''; $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''."\n"; $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename'); if (is_array($tmpfilelist2) && count($tmpfilelist2)) @@ -1097,8 +1097,8 @@ class Setup extends DolibarrApi $out.='' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } $out.=''; @@ -1106,8 +1106,8 @@ class Setup extends DolibarrApi $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } else @@ -1130,8 +1130,8 @@ class Setup extends DolibarrApi $out.=''; $out.=''; $out.=''; - $out.=''; - $out.=''; + $out.=''; + $out.=''; $out.=''."\n"; $tmpfilelist3 = dol_sort_array($file_list['added'], 'filename'); if (is_array($tmpfilelist3) && count($tmpfilelist3)) @@ -1147,8 +1147,8 @@ class Setup extends DolibarrApi $out.='' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); $totalsize += $size; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } $out.=''; @@ -1156,8 +1156,8 @@ class Setup extends DolibarrApi $out.='' . "\n"; $out.='' . "\n"; $out.='' . "\n"; - $out.='' . "\n"; - $out.='' . "\n"; + $out.='' . "\n"; + $out.='' . "\n"; $out.="\n"; } else diff --git a/htdocs/asset/admin/assets_extrafields.php b/htdocs/asset/admin/assets_extrafields.php index f220d5cb849..2735981b564 100644 --- a/htdocs/asset/admin/assets_extrafields.php +++ b/htdocs/asset/admin/assets_extrafields.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/admin/assets_type_extrafields.php b/htdocs/asset/admin/assets_type_extrafields.php index a791078f37b..7038f6df5a0 100644 --- a/htdocs/asset/admin/assets_type_extrafields.php +++ b/htdocs/asset/admin/assets_type_extrafields.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/admin/setup.php b/htdocs/asset/admin/setup.php index 57738309abd..236315b52d8 100644 --- a/htdocs/asset/admin/setup.php +++ b/htdocs/asset/admin/setup.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index d8b8f3aa056..e24e6a96c83 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 335a9f6e9d1..aafdbacc791 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 @@ -312,7 +312,7 @@ class Asset extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -369,7 +369,7 @@ class Asset extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -382,7 +382,7 @@ class Asset extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - static function LibStatut($status,$mode=0) + static function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index 51d76d75155..29851185391 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 @@ -89,7 +89,7 @@ class AssetType extends CommonObject * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int >0 if OK, < 0 if KO */ - function create($user,$notrigger=0) + function create($user, $notrigger = 0) { global $conf; @@ -166,7 +166,7 @@ class AssetType extends CommonObject * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int >0 if OK, < 0 if KO */ - function update($user,$notrigger=0) + function update($user, $notrigger = 0) { global $conf, $hookmanager; @@ -350,7 +350,7 @@ class AssetType extends CommonObject * 2=Return array of asset id only * @return mixed Array of asset or -1 on error */ - function listAssetForAssetType($excludefilter='', $mode=0) + function listAssetForAssetType($excludefilter = '', $mode = 0) { global $conf, $user; @@ -405,7 +405,7 @@ class AssetType extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0) + function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0) { global $langs; diff --git a/htdocs/asset/document.php b/htdocs/asset/document.php index c1332ed10a2..6433b30a543 100644 --- a/htdocs/asset/document.php +++ b/htdocs/asset/document.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/info.php b/htdocs/asset/info.php index e01316ae685..3c6260ffde7 100644 --- a/htdocs/asset/info.php +++ b/htdocs/asset/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index cb0a8cca7b2..c6710f290cc 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -469,7 +469,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print ''; + if (! empty($totalarray['pos'][$i])) print ''; else { if ($i == 1) diff --git a/htdocs/asset/note.php b/htdocs/asset/note.php index f76c6ea028f..7e74ec0a805 100644 --- a/htdocs/asset/note.php +++ b/htdocs/asset/note.php @@ -1,6 +1,6 @@ - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * * 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 diff --git a/htdocs/asset/type.php b/htdocs/asset/type.php index b8a282430cc..31c328d9326 100644 --- a/htdocs/asset/type.php +++ b/htdocs/asset/type.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * * 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 @@ -299,9 +299,9 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; if ($user->rights->asset->write) - print ''; + print ''; else - print ''; + print ''; print ""; $i++; } diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 49a4daa3b3f..c899e9d78c2 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -105,7 +105,7 @@ if ($action === 'downloadblockchain') { exit; } -else if (GETPOST('downloadcsv','alpha')) +elseif (GETPOST('downloadcsv','alpha')) { $error = 0; @@ -498,7 +498,7 @@ if (is_array($blocks)) print ''.$object_link.''; // Amount - print ''; + print ''; // Details link print ''; diff --git a/htdocs/blockedlog/ajax/authority.php b/htdocs/blockedlog/ajax/authority.php index 1104eeb3c02..1b002dda574 100644 --- a/htdocs/blockedlog/ajax/authority.php +++ b/htdocs/blockedlog/ajax/authority.php @@ -69,5 +69,3 @@ elseif(!empty($newblock)){ else{ echo 'idontunderstandwhatihavetodo'; } - - diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index 0d0fc183b6c..afdacdaa0a6 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -142,7 +142,7 @@ class BlockedLogAuthority * @param string $signature Signature of object to load * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($id, $signature='') + public function fetch($id, $signature = '') { global $langs; @@ -161,7 +161,7 @@ class BlockedLogAuthority $sql.= " FROM ".MAIN_DB_PREFIX."blockedlog_authority as b"; if ($id) $sql.= " WHERE b.rowid = ". $id; - else if($signature)$sql.= " WHERE b.signature = '". $this->db->escape( $signature ) ."'" ; + elseif($signature)$sql.= " WHERE b.signature = '". $this->db->escape( $signature ) ."'" ; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index bc65c72260d..0d24b71b343 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -208,7 +208,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'payment') { + elseif($this->element === 'payment') { require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; $object = new Paiement($this->db); @@ -219,7 +219,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'payment_supplier') { + elseif($this->element === 'payment_supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; $object = new PaiementFourn($this->db); @@ -230,7 +230,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'payment_donation') { + elseif($this->element === 'payment_donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/paymentdonation.class.php'; $object = new PaymentDonation($this->db); @@ -241,7 +241,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'payment_various') { + elseif($this->element === 'payment_various') { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; $object = new PaymentVarious($this->db); @@ -252,7 +252,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'don' || $this->element === 'donation') { + elseif($this->element === 'don' || $this->element === 'donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; $object = new Don($this->db); @@ -263,7 +263,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'subscription') { + elseif($this->element === 'subscription') { require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; $object = new Subscription($this->db); @@ -274,7 +274,7 @@ class BlockedLog $this->error++; } } - else if($this->element === 'cashcontrol') { + elseif($this->element === 'cashcontrol') { require_once DOL_DOCUMENT_ROOT.'/compta/cashcontrol/class/cashcontrol.class.php'; $object = new CashControl($this->db); @@ -285,11 +285,11 @@ class BlockedLog $this->error++; } } - else if ($this->action == 'MODULE_SET') + elseif ($this->action == 'MODULE_SET') { return 'System to track events into unalterable logs were enabled'; } - else if ($this->action == 'MODULE_RESET') + elseif ($this->action == 'MODULE_RESET') { if ($this->signature == '0000000000') { @@ -385,7 +385,7 @@ class BlockedLog $this->object_data=new stdClass(); // Add fields to exclude $arrayoffieldstoexclude = array( - 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','civility_id','contact','contact_id', + 'table_element','fields','ref_previous','ref_next','origin','origin_id','oldcopy','picto','error','errors','modelpdf','last_main_doc','civility_id','contact','contact_id', 'table_element_line','ismultientitymanaged','isextrafieldmanaged', 'linkedObjectsIds','linkedObjects','fk_delivery_address', 'context', @@ -469,7 +469,7 @@ class BlockedLog } } } - else if (!is_object($value)) $this->object_data->{$key} = $value; + elseif (!is_object($value)) $this->object_data->{$key} = $value; } if (! empty($object->newref)) $this->object_data->ref = $object->newref; @@ -725,7 +725,7 @@ class BlockedLog * @param string $mode 0=unserialize, 1=json_decode * @return string Value unserialized */ - public function dolDecodeBlockedData($data, $mode=0) + public function dolDecodeBlockedData($data, $mode = 0) { try { @@ -763,7 +763,7 @@ class BlockedLog * @param int $forcesignature Force signature (for example '0000000000' when we disabled the module) * @return int <0 if KO, >0 if OK */ - public function create($user, $forcesignature='') + public function create($user, $forcesignature = '') { global $conf,$langs,$hookmanager; @@ -878,7 +878,7 @@ class BlockedLog * @param string $previoushash If previous signature hash is known, we can provide it to avoid to make a search of it in database. * @return boolean True if OK, False if KO */ - public function checkSignature($previoushash='') + public function checkSignature($previoushash = '') { if (empty($previoushash)) { @@ -921,7 +921,7 @@ class BlockedLog * @param int $beforeid ID of a record * @return string Hash of previous record (if beforeid is defined) or hash of last record (if beforeid is 0) */ - public function getPreviousHash($withlock=0, $beforeid=0) + public function getPreviousHash($withlock = 0, $beforeid = 0) { global $conf; @@ -972,7 +972,7 @@ class BlockedLog * @param string $search_code search code * @return array|int Array of object log or <0 if error */ - public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref='', $search_amount='', $search_code='') + public function getLog($element, $fk_object, $limit = 0, $sortfield = '', $sortorder = '', $search_fk_user = -1, $search_start = -1, $search_end = -1, $search_ref = '', $search_amount = '', $search_code = '') { global $conf, $cachedlogs; @@ -984,11 +984,11 @@ class BlockedLog $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity; } - else if ($element=='not_certified') { + elseif ($element=='not_certified') { $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity." AND certified = 0"; } - else if ($element=='just_certified') { + elseif ($element=='just_certified') { $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."blockedlog WHERE entity=".$conf->entity." AND certified = 1"; } @@ -1070,7 +1070,7 @@ class BlockedLog * @param int $ignoresystem Ignore system events for the test * @return bool */ - function alreadyUsed($ignoresystem=0) + function alreadyUsed($ignoresystem = 0) { global $conf; diff --git a/htdocs/bookmarks/bookmarks.lib.php b/htdocs/bookmarks/bookmarks.lib.php index abe562c5ad9..5dd55a95873 100644 --- a/htdocs/bookmarks/bookmarks.lib.php +++ b/htdocs/bookmarks/bookmarks.lib.php @@ -150,4 +150,3 @@ function printBookmarksList($aDb, $aLangs) return $ret; } - diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index cca978d748b..5cbd07393e3 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -179,7 +179,7 @@ if ($resql) print '"; // Position - print '"; + print '"; // Actions print ''; // Statut - //print ''; + //print ''; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("SyslogLevel").'"; if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey}); - else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); + elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); else print ${$newkey}; if ($newkey == 'dolibarr_main_url_root' && ${$newkey} != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')'; print ""; if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey}); - else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); - else if ($newkey == 'dolibarr_main_document_root_alt') + elseif ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT'); + elseif ($newkey == 'dolibarr_main_document_root_alt') { $tmparray=explode(',',${$newkey}); $i=0; diff --git a/htdocs/admin/taxes.php b/htdocs/admin/taxes.php index 76e7496cc4e..b3fd9ef4359 100644 --- a/htdocs/admin/taxes.php +++ b/htdocs/admin/taxes.php @@ -3,7 +3,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2011-2013 Juanjo Menent - * Copyright (C) 2015-2018 Alexandre Spangaro + * Copyright (C) 2015-2018 Alexandre Spangaro * * 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 diff --git a/htdocs/admin/tools/dolibarr_export.php b/htdocs/admin/tools/dolibarr_export.php index 55be556afb9..d74afcc90bc 100644 --- a/htdocs/admin/tools/dolibarr_export.php +++ b/htdocs/admin/tools/dolibarr_export.php @@ -166,7 +166,7 @@ print '
';
diff --git a/htdocs/admin/tools/dolibarr_import.php b/htdocs/admin/tools/dolibarr_import.php index 90220f1bb23..e1357a39fb5 100644 --- a/htdocs/admin/tools/dolibarr_import.php +++ b/htdocs/admin/tools/dolibarr_import.php @@ -106,7 +106,7 @@ print $langs->trans("RestoreDesc3",$dolibarr_main_db_name).'

';
@@ -164,7 +164,7 @@ if (in_array($type, array('mysql', 'mysqli')))
diff --git a/htdocs/admin/tools/eaccelerator.php b/htdocs/admin/tools/eaccelerator.php index 0dc6b16b8e7..353cd6b6b98 100644 --- a/htdocs/admin/tools/eaccelerator.php +++ b/htdocs/admin/tools/eaccelerator.php @@ -48,17 +48,17 @@ if (isset($_POST['caching'])) { } else { eaccelerator_caching(true); } -} else if (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) { +} elseif (isset($_POST['optimizer']) && function_exists('eaccelerator_optimizer')) { if ($info['optimizer']) { eaccelerator_optimizer(false); } else { eaccelerator_optimizer(true); } -} else if (isset($_POST['clear'])) { +} elseif (isset($_POST['clear'])) { eaccelerator_clear(); -} else if (isset($_POST['clean'])) { +} elseif (isset($_POST['clean'])) { eaccelerator_clean(); -} else if (isset($_POST['purge'])) { +} elseif (isset($_POST['purge'])) { eaccelerator_purge(); } $info = eaccelerator_info(); @@ -81,7 +81,7 @@ function compare($x, $y) if ( $x[$sortby] == $y[$sortby] ) { return 0; - } else if ($x[$sortby] < $y[$sortby]) { + } elseif ($x[$sortby] < $y[$sortby]) { return -1; } else { return 1; @@ -101,7 +101,7 @@ function revcompare($x, $y) if ($x[$sortby] == $y[$sortby]) { return 0; - } else if ($x[$sortby] < $y[$sortby]) { + } elseif ($x[$sortby] < $y[$sortby]) { return 1; } else { return -1; diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index 6b0ea790ab2..9f3caf91881 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -234,4 +234,3 @@ header("Location: dolibarr_export.php"); $time_end = time(); $db->close(); - diff --git a/htdocs/admin/tools/export_files.php b/htdocs/admin/tools/export_files.php index 809cea3b271..0aae9083565 100644 --- a/htdocs/admin/tools/export_files.php +++ b/htdocs/admin/tools/export_files.php @@ -163,4 +163,3 @@ header("Location: dolibarr_export.php"); $time_end = time(); $db->close(); - diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index 7cbb82fbe6e..759bf1dfc48 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -115,7 +115,7 @@ if ($action == 'purge') $formquestion=array(); print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('PurgeSessions'), $langs->trans('ConfirmPurgeSessions'),'confirm_purge',$formquestion,'no',2); } -else if ($action == 'lock') +elseif ($action == 'lock') { $formquestion=array(); print $form->formconfirm($_SERVER["PHP_SELF"].'?noparam=noparam', $langs->trans('LockNewSessions'), $langs->trans('ConfirmLockNewSessions',$user->login),'confirm_lock',$formquestion,'no',1); diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 6b893a4a78b..f857ab7ed11 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -520,7 +520,7 @@ if ($mode == 'searchkey') if ($i > ($offset + $limit)) break; print '
'.$langcode.''.$key.''; print dol_escape_htmltag($val); - print ''; + print ''; if (! empty($newlangfileonly->tab_translate[$key])) { if ($val != $newlangfileonly->tab_translate[$key]) @@ -543,7 +543,7 @@ if ($mode == 'searchkey') $htmltext = $langs->trans("OriginalValueWas", $newlangfileonly->tab_translate[$key]); print $form->textwithpicto('', $htmltext, 1, 'info'); } - else if (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) + elseif (!empty($conf->global->MAIN_ENABLE_OVERWRITE_TRANSLATION)) { //print $key.'-'.$val; print '' . img_edit_add($langs->trans("Overwrite")) . ''; diff --git a/htdocs/admin/website.php b/htdocs/admin/website.php index e36b8d59df3..3f52896b631 100644 --- a/htdocs/admin/website.php +++ b/htdocs/admin/website.php @@ -659,7 +659,7 @@ $db->close(); * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered * @return void */ -function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='') +function fieldListWebsites($fieldlist, $obj = '', $tabname = '', $context = '') { global $conf,$langs,$db; global $form; @@ -695,4 +695,3 @@ function fieldListWebsites($fieldlist, $obj='', $tabname='', $context='') } } } - diff --git a/htdocs/admin/website_options.php b/htdocs/admin/website_options.php index 9d724b86390..48c2bdcdd08 100644 --- a/htdocs/admin/website_options.php +++ b/htdocs/admin/website_options.php @@ -147,4 +147,3 @@ dol_fiche_end(); // End of page llxFooter(); $db->close(); - diff --git a/htdocs/api/admin/explorer.php b/htdocs/api/admin/explorer.php index c3b54e36b6c..951e88f63fc 100644 --- a/htdocs/api/admin/explorer.php +++ b/htdocs/api/admin/explorer.php @@ -221,4 +221,3 @@ print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules llxFooter(); $db->close(); - diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6d6ef4578cd..d79b34b8949 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -46,7 +46,7 @@ class DolibarrApi * @param string $cachedir Cache dir * @param boolean $refreshCache Update cache */ - function __construct($db, $cachedir='', $refreshCache=false) + function __construct($db, $cachedir = '', $refreshCache = false) { global $conf, $dolibarr_main_url_root; @@ -222,7 +222,7 @@ class DolibarrApi * @return bool * @throws RestException */ - static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') + static function _checkAccessToResource($resource, $resource_id = 0, $dbtablename = '', $feature2 = '', $dbt_keyfield = 'fk_soc', $dbt_select = 'rowid') { // Features/modules to check @@ -230,7 +230,7 @@ class DolibarrApi if (preg_match('/&/', $resource)) { $featuresarray = explode("&", $resource); } - else if (preg_match('/\|/', $resource)) { + elseif (preg_match('/\|/', $resource)) { $featuresarray = explode("|", $resource); } diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 86d1cfff87c..01b0fdd56da 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -55,7 +55,7 @@ class Login * @url GET / * @url POST / */ - public function index($login, $password, $entity='', $reset=0) + public function index($login, $password, $entity = '', $reset = 0) { global $conf, $dolibarr_main_authentication, $dolibarr_auto_user; diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 39c1f8d6db6..e9d69728979 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -202,7 +202,7 @@ class Setup extends DolibarrApi if ($country->fetch($id) < 0) { throw new RestException(503, 'Error when retrieving country : '.$country->error); } - else if ($country->fetch($id) == 0) { + elseif ($country->fetch($id) == 0) { throw new RestException(404, 'country not found'); } @@ -1080,8 +1080,8 @@ class Setup extends DolibarrApi $out.='' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
'.$file['md5'].''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'
'.$langs->trans("Total").''.dol_print_size($totalsize).''.dol_print_size($totalsize).'
' . $langs->trans("Filename") . '' . $langs->trans("ExpectedChecksum") . '' . $langs->trans("CurrentChecksum") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '' . $langs->trans("Size") . '' . $langs->trans("DateModification") . '
'.$file['md5'].''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').''.dol_print_size($size).''.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'
'.$langs->trans("Total").''.dol_print_size($totalsize).''.dol_print_size($totalsize).'
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.price($totalarray['val'][$totalarray['pos'][$i]]).'rowid.'">'.img_edit().'rowid.'">'.img_edit().'  
'.price($block->amounts).''.price($block->amounts).''.img_info($langs->trans('ShowDetails')).''.dol_print_date($db->jdate($obj->dateb),'day')."'.$obj->position."'.$obj->position."'; @@ -212,5 +212,3 @@ else // End of page llxFooter(); $db->close(); - - diff --git a/htdocs/cashdesk/class/Auth.class.php b/htdocs/cashdesk/class/Auth.class.php index 78b76e20d11..343204e7870 100644 --- a/htdocs/cashdesk/class/Auth.class.php +++ b/htdocs/cashdesk/class/Auth.class.php @@ -139,4 +139,3 @@ class Auth return $ret; } } - diff --git a/htdocs/cashdesk/class/Facturation.class.php b/htdocs/cashdesk/class/Facturation.class.php index ea6ac7a47bd..e92ce019418 100644 --- a/htdocs/cashdesk/class/Facturation.class.php +++ b/htdocs/cashdesk/class/Facturation.class.php @@ -283,14 +283,14 @@ class Facturation * @param int $aId Id * @return id */ - public function id($aId=null) + public function id($aId = null) { if ( !$aId ) { return $this->id; } - else if ( $aId == 'RESET' ) + elseif ( $aId == 'RESET' ) { $this->id = null; @@ -308,14 +308,14 @@ class Facturation * @param string $aRef Ref * @return string Ref */ - public function ref($aRef=null) + public function ref($aRef = null) { if (is_null($aRef)) { return $this->ref; } - else if ( $aRef == 'RESET' ) + elseif ( $aRef == 'RESET' ) { $this->ref = null; } @@ -331,13 +331,13 @@ class Facturation * @param int $aQte Qty * @return int Qty */ - public function qte($aQte=null) + public function qte($aQte = null) { if (is_null($aQte)) { return $this->qte; } - else if ( $aQte == 'RESET' ) + elseif ( $aQte == 'RESET' ) { $this->qte = null; @@ -354,14 +354,14 @@ class Facturation * @param string $aStock Stock * @return string Stock */ - public function stock($aStock=null) + public function stock($aStock = null) { if (is_null($aStock)) { return $this->stock; } - else if ( $aStock == 'RESET' ) + elseif ( $aStock == 'RESET' ) { $this->stock = null; } @@ -377,14 +377,14 @@ class Facturation * @param string $aRemisePercent Discount * @return string Discount */ - public function remisePercent($aRemisePercent=null) + public function remisePercent($aRemisePercent = null) { if (is_null($aRemisePercent)) { return $this->remise_percent; } - else if ($aRemisePercent == 'RESET') + elseif ($aRemisePercent == 'RESET') { $this->remise_percent = null; } @@ -400,13 +400,13 @@ class Facturation * @param int $aMontantRemise Amount * @return string Amount */ - public function montantRemise($aMontantRemise=null) + public function montantRemise($aMontantRemise = null) { if (is_null($aMontantRemise)) { return $this->montant_remise; - } else if ( $aMontantRemise == 'RESET' ) { + } elseif ( $aMontantRemise == 'RESET' ) { $this->montant_remise = null; } else { @@ -421,13 +421,13 @@ class Facturation * @param int $aPrix Price * @return string Stock */ - public function prix($aPrix=null) + public function prix($aPrix = null) { if (is_null($aPrix)) { return $this->prix; - } else if ( $aPrix == 'RESET' ) { + } elseif ( $aPrix == 'RESET' ) { $this->prix = null; } else { @@ -442,12 +442,12 @@ class Facturation * @param int $aTva Vat * @return int Vat */ - public function tva($aTva=null) + public function tva($aTva = null) { if (is_null($aTva)) { return $this->tva; - } else if ( $aTva == 'RESET' ) { + } elseif ( $aTva == 'RESET' ) { $this->tva = null; } else { @@ -462,12 +462,12 @@ class Facturation * @param string $aNumFacture Invoice ref * @return string Invoice ref */ - public function numInvoice($aNumFacture=null) + public function numInvoice($aNumFacture = null) { if (is_null($aNumFacture)) { return $this->num_facture; - } else if ( $aNumFacture == 'RESET' ) { + } elseif ( $aNumFacture == 'RESET' ) { $this->num_facture = null; } else { @@ -482,13 +482,13 @@ class Facturation * @param int $aModeReglement Payment mode * @return int Payment mode */ - public function getSetPaymentMode($aModeReglement=null) + public function getSetPaymentMode($aModeReglement = null) { if (is_null($aModeReglement)) { return $this->mode_reglement; - } else if ( $aModeReglement == 'RESET' ) { + } elseif ( $aModeReglement == 'RESET' ) { $this->mode_reglement = null; } else { @@ -503,13 +503,13 @@ class Facturation * @param int $aMontantEncaisse Amount * @return int Amount */ - public function montantEncaisse($aMontantEncaisse=null) + public function montantEncaisse($aMontantEncaisse = null) { if (is_null($aMontantEncaisse)) { return $this->montant_encaisse; - } else if ( $aMontantEncaisse == 'RESET' ) { + } elseif ( $aMontantEncaisse == 'RESET' ) { $this->montant_encaisse = null; } else { @@ -524,13 +524,13 @@ class Facturation * @param int $aMontantRendu Amount * @return int Amount */ - public function montantRendu($aMontantRendu=null) + public function montantRendu($aMontantRendu = null) { if (is_null($aMontantRendu)) { return $this->montant_rendu; - } else if ( $aMontantRendu == 'RESET' ) { + } elseif ( $aMontantRendu == 'RESET' ) { $this->montant_rendu = null; } else { @@ -545,12 +545,12 @@ class Facturation * @param date $aPaiementLe Date * @return date Date */ - public function paiementLe($aPaiementLe=null) + public function paiementLe($aPaiementLe = null) { if (is_null($aPaiementLe)) { return $this->paiement_le; - } else if ( $aPaiementLe == 'RESET' ) { + } elseif ( $aPaiementLe == 'RESET' ) { $this->paiement_le = null; } else { @@ -565,12 +565,12 @@ class Facturation * @param int $aTotalHt Total amount * @return int Total amount */ - public function prixTotalHt($aTotalHt=null) + public function prixTotalHt($aTotalHt = null) { if (is_null($aTotalHt)) { return $this->prix_total_ht; - } else if ( $aTotalHt == 'RESET' ) { + } elseif ( $aTotalHt == 'RESET' ) { $this->prix_total_ht = null; } else { @@ -585,12 +585,12 @@ class Facturation * @param int $aMontantTva Amount vat * @return int Amount vat */ - public function montantTva($aMontantTva=null) + public function montantTva($aMontantTva = null) { if (is_null($aMontantTva)) { return $this->montant_tva; - } else if ( $aMontantTva == 'RESET' ) { + } elseif ( $aMontantTva == 'RESET' ) { $this->montant_tva = null; } else { @@ -605,7 +605,7 @@ class Facturation * @param int $aTotalTtc Amount ttc * @return int Amount ttc */ - public function prixTotalTtc($aTotalTtc=null) + public function prixTotalTtc($aTotalTtc = null) { if (is_null($aTotalTtc)) { diff --git a/htdocs/cashdesk/deconnexion.php b/htdocs/cashdesk/deconnexion.php index 0602b577378..67fc4e9cbb6 100644 --- a/htdocs/cashdesk/deconnexion.php +++ b/htdocs/cashdesk/deconnexion.php @@ -34,4 +34,3 @@ unset($_SESSION['uid']); header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php'); exit; - diff --git a/htdocs/cashdesk/facturation.php b/htdocs/cashdesk/facturation.php index 4ca8a562659..ac78883bc4f 100644 --- a/htdocs/cashdesk/facturation.php +++ b/htdocs/cashdesk/facturation.php @@ -138,7 +138,7 @@ if ( $nbr_enreg > 1 ) $top_liste_produits = '----- '.$nbr_enreg.' '.$langs->transnoentitiesnoconv("CashDeskProducts").' '.$langs->trans("CashDeskOn").' '.$nbr_enreg.' -----'; } } -else if ( $nbr_enreg == 1 ) +elseif ( $nbr_enreg == 1 ) { $top_liste_produits = '----- 1 '.$langs->transnoentitiesnoconv("ProductFound"). ' -----'; } diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 6aa81d991df..a643a9197e2 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -51,7 +51,7 @@ switch($action) { $sql.= " AND p.rowid = ".$_POST['selProduit']; } - else if ( $_POST['hdnSource'] == 'REF' ) + elseif ( $_POST['hdnSource'] == 'REF' ) { $sql.= " AND p.ref = '".$_POST['txtRef']."'"; } @@ -163,7 +163,7 @@ switch($action) { $filtre = $ret['ref']; } - else if ( $_POST['hdnSource'] == 'REF' ) + elseif ( $_POST['hdnSource'] == 'REF' ) { $filtre = $_POST['txtRef']; } @@ -233,4 +233,3 @@ $_SESSION['serObjFacturation'] = serialize($obj_facturation); //var_dump($_SESSION['serObjFacturation']); header('Location: '.$redirection); exit; - diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 4490d4cf405..6442d1776e3 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -49,4 +49,3 @@ $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes // Add hidden option to force decrease of stock whatever is user setup if (! empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL=1; - diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index cd354293022..8976434b559 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -140,4 +140,3 @@ else header('Location: '.DOL_URL_ROOT.'/cashdesk/index.php?err='.urlencode($retour).'&user='.$username.'&socid='.$thirdpartyid.'&warehouseid='.$warehouseid); exit; } - diff --git a/htdocs/cashdesk/validation.php b/htdocs/cashdesk/validation.php index ff1219861e2..f52802f1f5d 100644 --- a/htdocs/cashdesk/validation.php +++ b/htdocs/cashdesk/validation.php @@ -25,4 +25,3 @@ $form=new Form($db); // Affichage des templates require 'tpl/validation1.tpl.php'; - diff --git a/htdocs/cashdesk/validation_ok.php b/htdocs/cashdesk/validation_ok.php index c8c83a91f18..78b66a3e502 100644 --- a/htdocs/cashdesk/validation_ok.php +++ b/htdocs/cashdesk/validation_ok.php @@ -23,4 +23,3 @@ // Affichage des templates require 'tpl/validation2.tpl.php'; - diff --git a/htdocs/cashdesk/validation_ticket.php b/htdocs/cashdesk/validation_ticket.php index a98b50b0bc9..9efad161821 100644 --- a/htdocs/cashdesk/validation_ticket.php +++ b/htdocs/cashdesk/validation_ticket.php @@ -40,4 +40,3 @@ if (empty($reshook)) $_SESSION['serObjFacturation'] = serialize($obj_facturation); - diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index e69ec4a852d..1cc510ee27f 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -89,32 +89,32 @@ if ($action == 'add' && $user->rights->categorie->creer) header("Location: ".$urlfrom); exit; } - else if ($idProdOrigin) + elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type); exit; } - else if ($idCompanyOrigin) + elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type); exit; } - else if ($idSupplierOrigin) + elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type); exit; } - else if ($idMemberOrigin) + elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type); exit; } - else if ($idContactOrigin) + elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type); exit; } - else if ($idProjectOrigin) + elseif ($idProjectOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type); exit; @@ -179,32 +179,32 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr header("Location: ".$backtopage); exit; } - else if ($idProdOrigin) + elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - else if ($idCompanyOrigin) + elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - else if ($idSupplierOrigin) + elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - else if ($idMemberOrigin) + elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - else if ($idContactOrigin) + elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; } - else if ($idProjectOrigin) + elseif ($idProjectOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index e4d95d490ed..d9da1eef35b 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -234,7 +234,7 @@ class Categorie extends CommonObject * @param string $type Type of category ('product', '...') or (0, 1, ...) * @return int <0 if KO, >0 if OK */ - function fetch($id, $label='', $type=null) + function fetch($id, $label = '', $type = null) { global $conf; @@ -501,7 +501,7 @@ class Categorie extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 KO >0 OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf,$langs; @@ -691,7 +691,7 @@ class Categorie extends CommonObject * * @return int 1 if OK, -1 if KO */ - function del_type($obj,$type) + function del_type($obj, $type) { // phpcs:enable global $user,$langs,$conf; @@ -749,7 +749,7 @@ class Categorie extends CommonObject * @return array|int -1 if KO, array of instance of object if OK * @see containsObject */ - function getObjectsInCateg($type, $onlyids=0) + function getObjectsInCateg($type, $onlyids = 0) { $objs = array(); @@ -821,7 +821,7 @@ class Categorie extends CommonObject * @param int $page Page number * @return array|int Array of categories, 0 if no cat, -1 on error */ - function getListForItem($id, $type='customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) + function getListForItem($id, $type = 'customer', $sortfield = "s.rowid", $sortorder = 'ASC', $limit = 0, $page = 0) { global $conf; @@ -990,7 +990,7 @@ class Categorie extends CommonObject * * @return array|int Array of categories. this->cats and this->motherof are set, -1 on error */ - function get_full_arbo($type, $markafterid=0) + function get_full_arbo($type, $markafterid = 0) { // phpcs:enable global $conf, $langs; @@ -1076,7 +1076,7 @@ class Categorie extends CommonObject * @param int $protection Deep counter to avoid infinite loop * @return void */ - function build_path_from_id_categ($id_categ,$protection=1000) + function build_path_from_id_categ($id_categ, $protection = 1000) { // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_categ id_categ=".$id_categ." protection=".$protection, LOG_DEBUG); @@ -1143,7 +1143,7 @@ class Categorie extends CommonObject * @param boolean $parent Just parent categories if true * @return array|int Table of Object Category, -1 on error */ - function get_all_categories($type=null, $parent=false) + function get_all_categories($type = null, $parent = false) { // phpcs:enable if (! is_numeric($type)) $type = $this->MAP_ID[$type]; @@ -1232,7 +1232,7 @@ class Categorie extends CommonObject * @param int $type Type of category (0, 1, ...) * @return array */ - function get_main_categories($type=null) + function get_main_categories($type = null) { // phpcs:enable return $this->get_all_categories($type, true); @@ -1248,7 +1248,7 @@ class Categorie extends CommonObject * @param int $nocolor 0 * @return array */ - function print_all_ways($sep = " >> ", $url='', $nocolor=0) + function print_all_ways($sep = " >> ", $url = '', $nocolor = 0) { // phpcs:enable $ways = array(); @@ -1376,7 +1376,7 @@ class Categorie extends CommonObject * labels, 'id'= Get array of category IDs * @return array|int Array of category objects or < 0 if KO */ - function containing($id, $type, $mode='object') + function containing($id, $type, $mode = 'object') { $cats = array(); @@ -1397,7 +1397,7 @@ class Categorie extends CommonObject { if ($mode == 'id') { $cats[] = $obj->rowid; - } else if ($mode == 'label') { + } elseif ($mode == 'label') { $cats[] = $obj->label; } else { $cat = new Categorie($this->db); @@ -1427,7 +1427,7 @@ class Categorie extends CommonObject { if ($mode == 'id') { $cats[] = $obj->rowid; - } else if ($mode == 'label') { + } elseif ($mode == 'label') { $cats[] = $obj->label; } else { $cat = new Categorie($this->db); @@ -1522,7 +1522,7 @@ class Categorie extends CommonObject * @param int $maxlength Max length of text * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$option='',$maxlength=0) + function getNomUrl($withpicto = 0, $option = '', $maxlength = 0) { global $langs; @@ -1608,7 +1608,7 @@ class Categorie extends CommonObject * @param int $nbmax Nombre maximum de photos (0=pas de max) * @return array Tableau de photos */ - function liste_photos($dir,$nbmax=0) + function liste_photos($dir, $nbmax = 0) { // phpcs:enable include_once DOL_DOCUMENT_ROOT .'/core/lib/files.lib.php'; @@ -1747,7 +1747,7 @@ class Categorie extends CommonObject return -1; } } - else if (isset($this->multilangs["$key"])) + elseif (isset($this->multilangs["$key"])) { if ($this->db->num_rows($result)) // si aucune ligne dans la base { diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index b7e99e50ca0..273a23f5b1e 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -178,7 +178,7 @@ foreach($fulltree as $key => $val) //print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1); print ''; -print ''; @@ -2259,7 +2259,7 @@ if ($action == 'create') print $langs->trans('BankAccount'); print ''; if ($action != 'editbankaccount' && $usercancreate) - print ''; + print ''; print '
'.$langs->trans("Categories").''; +print '
'.$langs->trans("Categories").''; if (! empty($conf->use_javascript_ajax)) { print ''; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index 6783b565b99..f683a791e72 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -270,7 +270,7 @@ if ($action == 'edit') print ''; } -else if ($action != 'add') +elseif ($action != 'add') { if ($cnt_trans) print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 2092c6c52c5..c2b94fcc473 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -86,40 +86,40 @@ if ($id > 0 && $removeelem > 0) $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; } - else if ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) + elseif ($type == Categorie::TYPE_SUPPLIER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'supplier'; } - else if ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) + elseif ($type == Categorie::TYPE_CUSTOMER && $user->rights->societe->creer) { $tmpobject = new Societe($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'customer'; } - else if ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) + elseif ($type == Categorie::TYPE_MEMBER && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; $tmpobject = new Adherent($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'member'; } - else if ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { + elseif ($type == Categorie::TYPE_CONTACT && $user->rights->societe->creer) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $tmpobject = new Contact($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'contact'; } - else if ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) + elseif ($type == Categorie::TYPE_ACCOUNT && $user->rights->banque->configurer) { require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; $tmpobject = new Account($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'account'; } - else if ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) + elseif ($type == Categorie::TYPE_PROJECT && $user->rights->projet->creer) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $tmpobject = new Project($db); @@ -278,7 +278,7 @@ else { print "
"; print "\n"; - print "\n"; print '\n"; // Link to delete from category - print '\n"; // Link to delete from category - print '\n"; // Link to delete from category - print '\n"; print '\n"; // Link to delete from category - print '\n"; // Link to delete from category - print '\n"; print '\n"; // Link to delete from category - print '\n"; print '\n"; // Link to delete from category - print ''; diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 05d5fa43c86..8ae44951ca5 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -293,7 +293,7 @@ class ActionComm extends CommonObject $this->type_id=$cactioncomm->id; $this->type_code=$cactioncomm->code; } - else if ($result == 0) + elseif ($result == 0) { $this->error='Failed to get record with id '.$this->type_id.' code '.$this->type_code.' from dictionary "type of events"'; return -1; @@ -566,7 +566,7 @@ class ActionComm extends CommonObject * @param string $ref_ext Ref ext to get * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='',$ref_ext='') + function fetch($id, $ref = '', $ref_ext = '') { global $langs; @@ -761,7 +761,7 @@ class ActionComm extends CommonObject * @param int $notrigger 1 = disable triggers, 0 = enable triggers * @return int <0 if KO, >0 if OK */ - function delete($notrigger=0) + function delete($notrigger = 0) { global $user,$langs,$conf; @@ -838,7 +838,7 @@ class ActionComm extends CommonObject * @param int $notrigger 1 = disable triggers, 0 = enable triggers * @return int <0 if KO, >0 if OK */ - function update($user,$notrigger=0) + function update($user, $notrigger = 0) { global $langs,$conf,$hookmanager; @@ -999,7 +999,7 @@ class ActionComm extends CommonObject * @param string $limit Limit number of answers * @return array or string Error string if KO, array with actions if OK */ - static function getActions($db, $socid=0, $fk_element=0, $elementtype='', $filter='', $sortfield='a.datep', $sortorder='DESC', $limit=0) + static function getActions($db, $socid = 0, $fk_element = 0, $elementtype = '', $filter = '', $sortfield = 'a.datep', $sortorder = 'DESC', $limit = 0) { global $conf, $langs; @@ -1051,7 +1051,7 @@ class ActionComm extends CommonObject * @param int $load_state_board Charge indicateurs this->nb de tableau de bord * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user, $load_state_board=0) + function load_board($user, $load_state_board = 0) { // phpcs:enable global $conf, $langs; @@ -1164,7 +1164,7 @@ class ActionComm extends CommonObject * @param int $hidenastatus 1=Show nothing if status is "Not applicable" * @return string String with status */ - function getLibStatut($mode,$hidenastatus=0) + function getLibStatut($mode, $hidenastatus = 0) { return $this->LibStatut($this->percentage,$mode,$hidenastatus,$this->datep); } @@ -1179,7 +1179,7 @@ class ActionComm extends CommonObject * @param int $datestart Date start of event * @return string Label */ - function LibStatut($percent,$mode,$hidenastatus=0,$datestart='') + function LibStatut($percent, $mode, $hidenastatus = 0, $datestart = '') { // phpcs:enable global $langs; @@ -1257,7 +1257,7 @@ class ActionComm extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $maxlength=0, $classname='', $option='', $overwritepicto=0, $notooltip=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $maxlength = 0, $classname = '', $option = '', $overwritepicto = 0, $notooltip = 0, $save_lastsearch_value = -1) { global $conf, $langs, $user, $hookmanager, $action; @@ -1391,7 +1391,7 @@ class ActionComm extends CommonObject * @param array $filters Array of filters. Exemple array('notolderthan'=>99, 'year'=>..., 'idfrom'=>..., 'notactiontype'=>'systemauto', 'project'=>123, ...) * @return int <0 if error, nb of events in new file if ok */ - function build_exportfile($format,$type,$cachedelay,$filename,$filters) + function build_exportfile($format, $type, $cachedelay, $filename, $filters) { // phpcs:enable global $conf,$langs,$dolibarr_main_url_root,$mysoc; diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 6631d0e375d..4d5536e50fc 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -178,7 +178,7 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -191,7 +191,7 @@ class ActionCommReminder extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - static function LibStatut($status,$mode=0) + static function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index d6c25f6d4c1..8efb6ab0515 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -130,7 +130,7 @@ class CActionComm * @param int $shortlabel 1=Get short label instead of long label * @return mixed Array of all event types if OK, <0 if KO. Key of array is id or code depending on parameter $idorcode. */ - function liste_array($active='',$idorcode='id',$excludetype='',$onlyautoornot=0, $morefilter='', $shortlabel=0) + function liste_array($active = '', $idorcode = 'id', $excludetype = '', $onlyautoornot = 0, $morefilter = '', $shortlabel = 0) { // phpcs:enable global $langs,$conf; @@ -223,7 +223,7 @@ class CActionComm * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Picto only * @return string Label of action type */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto = 0) { global $langs; diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index a73731699f2..4448fee5366 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -779,7 +779,7 @@ if (count($listofextcals)) $datecurstart=dol_stringtotime($icalevent['DTSTART;VALUE=DATE'],1); $datecurend=dol_stringtotime($icalevent['DTEND;VALUE=DATE'],1)-1; // We remove one second to get last second of day } - else if (is_array($icalevent['DTSTART']) && ! empty($icalevent['DTSTART']['unixtime'])) + elseif (is_array($icalevent['DTSTART']) && ! empty($icalevent['DTSTART']['unixtime'])) { $datecurstart=$icalevent['DTSTART']['unixtime']; $datecurend=$icalevent['DTEND']['unixtime']; @@ -1277,7 +1277,7 @@ $db->close(); * @param string $nonew 0=Add "new entry button", 1=No "new entry button", -1=Only "new entry button" * @return void */ -function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $nonew=0) +function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $nonew = 0) { global $user, $conf, $langs; global $action, $filter, $filtert, $status, $actioncode, $usergroup; // Filters used into search form @@ -1365,7 +1365,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa // We decide to choose color of owner of event (event->userownerid is user id of owner, event->userassigned contains all users assigned to event) if (! empty($cacheusers[$event->userownerid]->color)) $color=$cacheusers[$event->userownerid]->color; } - else if ($event->type_code == 'ICALEVENT') // Event come from external ical file + elseif ($event->type_code == 'ICALEVENT') // Event come from external ical file { $numical++; if (! empty($event->icalname)) { @@ -1378,7 +1378,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $color=($event->icalcolor?$event->icalcolor:-1); $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other'); } - else if ($event->type_code == 'BIRTHDAY') + elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unmovable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } @@ -1425,11 +1425,11 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { $cssclass.= " unmovable"; } - else if ($event->type_code == 'ICALEVENT') + elseif ($event->type_code == 'ICALEVENT') { $cssclass.= " unmovable"; } - else if ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar)) + elseif ($event->date_end_in_calendar && date('Ymd',$event->date_start_in_calendar) != date('Ymd',$event->date_end_in_calendar)) { $tmpyearend = date('Y',$event->date_end_in_calendar); $tmpmonthend = date('m',$event->date_end_in_calendar); diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index 67a4534ca14..2a5691279a1 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -757,7 +757,7 @@ $db->close(); * @param bool $var true or false for alternat style on tr/td * @return void */ -function show_day_events_pertype($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) +function show_day_events_pertype($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $showheader = false, $colorsbytype = array(), $var = false) { global $db; global $user, $conf, $langs, $hookmanager, $action; @@ -809,7 +809,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $nummytasks++; $cssclass='family_mytasks'; if (! empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color=$event->type_color; } - else if ($event->type_code == 'ICALEVENT') + elseif ($event->type_code == 'ICALEVENT') { $numical++; if (! empty($event->icalname)) @@ -823,7 +823,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $color=$event->icalcolor; $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') + elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } @@ -1026,7 +1026,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; } - else if (count($cases1[$h]) > 1) + elseif (count($cases1[$h]) > 1) { $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $color1='222222'; @@ -1039,7 +1039,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; } - else if (count($cases2[$h]) > 1) + elseif (count($cases2[$h]) > 1) { $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $color2='222222'; diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 9e2a7278a27..f208c25a058 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -905,7 +905,7 @@ $db->close(); * @param bool $var true or false for alternat style on tr/td * @return void */ -function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint=0, $maxnbofchar=16, $newparam='', $showinfo=0, $minheight=60, $showheader=false, $colorsbytype=array(), $var=false) +function show_day_events2($username, $day, $month, $year, $monthshown, $style, &$eventarray, $maxprint = 0, $maxnbofchar = 16, $newparam = '', $showinfo = 0, $minheight = 60, $showheader = false, $colorsbytype = array(), $var = false) { global $db; global $user, $conf, $langs, $hookmanager, $action; @@ -970,7 +970,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if (! empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) $color=$event->type_color; } - else if ($event->type_code == 'ICALEVENT') + elseif ($event->type_code == 'ICALEVENT') { $numical++; if (! empty($event->icalname)) @@ -984,7 +984,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $color=$event->icalcolor; $cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unsortable'); } - else if ($event->type_code == 'BIRTHDAY') + elseif ($event->type_code == 'BIRTHDAY') { $numbirthday++; $colorindex=2; $cssclass='family_birthday unsortable'; $color=sprintf("%02x%02x%02x",$theme_datacolor[$colorindex][0],$theme_datacolor[$colorindex][1],$theme_datacolor[$colorindex][2]); } @@ -1201,7 +1201,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($output[0]['string']) $title1.=($title1?' - ':'').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; } - else if (count($cases1[$h]) > 1) + elseif (count($cases1[$h]) > 1) { $title1=$langs->trans("Ref").' '.$ids1.($title1?' - '.$title1:''); $color1='222222'; @@ -1214,7 +1214,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if ($output[0]['string']) $title2.=($title2?' - ':'').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; } - else if (count($cases2[$h]) > 1) + elseif (count($cases2[$h]) > 1) { $title2=$langs->trans("Ref").' '.$ids2.($title2?' - '.$title2:''); $color2='222222'; diff --git a/htdocs/comm/address.php b/htdocs/comm/address.php index f9cf7dc5bf1..04b7cd3ad63 100644 --- a/htdocs/comm/address.php +++ b/htdocs/comm/address.php @@ -83,7 +83,7 @@ if ($action == 'add' || $action == 'update') header("Location: ".$backtopage); exit; } - else if ($origin == 'commande') + elseif ($origin == 'commande') { header("Location: ../commande/contact.php?action=editdelivery_adress&socid=".$socid."&id=".$originid); exit; @@ -112,7 +112,7 @@ if ($action == 'add' || $action == 'update') } // Update address - else if ($action == 'update') + elseif ($action == 'update') { $result = $object->update($id, $socid, $user); @@ -123,7 +123,7 @@ if ($action == 'add' || $action == 'update') header("Location: ".$backtopage); exit; } - else if ($origin == 'commande') + elseif ($origin == 'commande') { header("Location: ../commande/contact.php?id=".$originid); exit; @@ -153,7 +153,7 @@ if ($action == 'add' || $action == 'update') } } -else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) +elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->societe->supprimer) { $result = $object->delete($id, $socid); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index a9167c43c32..cc5a0e6e29a 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2010-2014 Juanjo Menent - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2015 Frederic France * Copyright (C) 2015 Marcos García * This program is free software; you can redistribute it and/or modify @@ -322,7 +322,7 @@ if ($object->id > 0) print '
".$langs->trans("SubCats").''; + print "
".$langs->trans("SubCats").''; if ($user->rights->categorie->creer) { print ""; @@ -366,7 +366,7 @@ if ($type == Categorie::TYPE_PRODUCT) print "'.$prod->label."'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -413,7 +413,7 @@ if ($type == Categorie::TYPE_SUPPLIER) print $soc->getNomUrl(1); print "'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -466,7 +466,7 @@ if($type == Categorie::TYPE_CUSTOMER) print $soc->getNomUrl(1); print "'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -519,7 +519,7 @@ if ($type == Categorie::TYPE_MEMBER) print ''.$member->lastname."'.$member->firstname."'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -569,7 +569,7 @@ if ($type == Categorie::TYPE_CONTACT) print $contact->getNomUrl(1,'category'); print "'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -621,7 +621,7 @@ if ($type == Categorie::TYPE_ACCOUNT) print ''.$account->bank."'.$account->number."'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; @@ -672,7 +672,7 @@ if ($type == Categorie::TYPE_PROJECT) print ''.$project->ref."'.$project->title."'; + print ''; $permission=0; if ($type == Categorie::TYPE_PRODUCT) $permission=($user->rights->produit->creer || $user->rights->service->creer); if ($type == Categorie::TYPE_SUPPLIER) $permission=$user->rights->societe->creer; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index d087655a9bd..053d6809c40 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -6,7 +6,7 @@ * Copyright (C) 2010-2013 Juanjo Menent * Copyright (C) 2013 Florian Henry * Copyright (C) 2014 Cedric GROSS - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -791,11 +791,11 @@ if ($action == 'create') print ''; $percent=-1; if (isset($_GET['status']) || isset($_POST['status'])) $percent=GETPOST('status'); - else if (isset($_GET['percentage']) || isset($_POST['percentage'])) $percent=GETPOST('percentage'); + elseif (isset($_GET['percentage']) || isset($_POST['percentage'])) $percent=GETPOST('percentage'); else { if (GETPOST('complete') == '0' || GETPOST("afaire") == 1) $percent='0'; - else if (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent=100; + elseif (GETPOST('complete') == 100 || GETPOST("afaire") == 2) $percent=100; } $formactions->form_select_status_action('formaction', $percent, 1, 'complete', 0, 0, 'maxwidth200'); print '
'; + if (($action != 'editconditions') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentConditions'); print ''; - if (($action != 'editconditions') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetConditions'),1).'id.'">'.img_edit($langs->trans('SetConditions'),1).'
'; print '
'; if ($action == 'editconditions') @@ -341,7 +341,7 @@ if ($object->id > 0) print ''; + if (($action != 'editmode') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentMode'); print ''; - if (($action != 'editmode') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print '
'; if ($action == 'editmode') @@ -362,7 +362,7 @@ if ($object->id > 0) print ''; + if (($action != 'editbankaccount') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('PaymentBankAccount'); print ''; - if (($action != 'editbankaccount') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; print '
'; if ($action == 'editbankaccount') @@ -381,7 +381,7 @@ if ($object->id > 0) print '
'; print ''; if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate) - print ''; + print ''; print '
'; print $langs->trans("CustomerRelativeDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -395,7 +395,7 @@ if ($object->id > 0) print ''; print ''; if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; print $langs->trans("CustomerAbsoluteDiscountShort"); - print ''; + print ''; if ($user->rights->societe->creer && !$user->societe_id > 0) { print ''.img_edit($langs->trans("Modify")).''; @@ -447,7 +447,7 @@ if ($object->id > 0) print '
'; print ''; if ($action != 'editmode' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; print $langs->trans("PriceLevel"); - print ''; + print ''; if ($user->rights->societe->creer) { print ''.img_edit($langs->trans("Modify")).''; @@ -467,7 +467,7 @@ if ($object->id > 0) print ''; + if (($action != 'editshipping') && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('SendingMethod'); print ''; - if (($action != 'editshipping') && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('SetMode'),1).'id.'">'.img_edit($langs->trans('SetMode'),1).'
'; print '
'; if ($action == 'editshipping') @@ -535,7 +535,7 @@ if ($object->id > 0) print ''; + if ($action != 'editlevel' && $user->rights->societe->creer) print ''; print '
'; print $langs->trans('ProspectLevel'); print ''; - if ($action != 'editlevel' && $user->rights->societe->creer) print 'id.'">'.img_edit($langs->trans('Modify'),1).'id.'">'.img_edit($langs->trans('Modify'),1).'
'; print '
'; if ($action == 'editlevel') @@ -691,8 +691,8 @@ if ($object->id > 0) print ''; print ''; - print ''; if ($action != 'editdemandreason' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; - print ''; + print ''; print ''; } @@ -714,9 +714,9 @@ if ($object->id > 0) if ( ($db->jdate($objp->datelimite) < ($now - $conf->propal->cloture->warning_delay)) && $objp->fk_statut == 1 ) { print " ".img_warning(); } - print '\n"; - print ''; - print ''; + print '\n"; + print ''; + print ''; $i++; } $db->free($resql); @@ -776,10 +776,10 @@ if ($object->id > 0) print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print '
'.$langs->trans("LastPropals",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllPropals").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.dol_print_date($db->jdate($objp->dp),'day')."'.price($objp->total_ht).''.$propal_static->LibStatut($objp->fk_statut,5).'
'.dol_print_date($db->jdate($objp->dp),'day')."'.price($objp->total_ht).''.$propal_static->LibStatut($objp->fk_statut,5).'
'; print ''; - print ''; if ($action != 'editshippingmethod' && $usercancreate) - print ''; + print ''; print '
'; - print ''; - //if($num2 > 0) print ''; - //else print ''; + print ''; print ''; } @@ -800,9 +800,9 @@ if ($object->id > 0) print ''; print '\n"; - print ''; - print ''; + print '\n"; + print ''; + print ''; $i++; } $db->free($resql); @@ -852,8 +852,8 @@ if ($object->id > 0) print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').''; + print ''; + //if($num2 > 0) print ''; + //else print ''; print '
'.$langs->trans("LastCustomerOrders",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllOrders").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.img_picto($langs->trans("CreateInvoiceForThisCustomer"),'object_bill').''.img_picto($langs->trans("NoOrdersToInvoice"),'object_bill').'
'; print $commande_static->getNomUrl(1); - print ''.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'
'.dol_print_date($db->jdate($objp->dc),'day')."'.price($objp->total_ht).''.$commande_static->LibStatut($objp->fk_statut,$objp->facture,5).'
'; print ''; - print ''; if ($action != 'editavailability' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; - print ''; + print ''; print ''; } @@ -871,9 +871,9 @@ if ($object->id > 0) print $sendingstatic->getNomUrl(1); print ''; if ($objp->date_creation > 0) { - print ''; + print ''; } else { - print ''; + print ''; } print ''; @@ -917,8 +917,8 @@ if ($object->id > 0) print ''; print ''; print ''; } @@ -939,8 +939,8 @@ if ($object->id > 0) print $contrat->getNomUrl(1,12); print "\n"; print '\n"; - print '\n"; - print '\n"; + print '\n"; + print '\n"; print ''; print ''; if ($action != 'editconditions' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print '
'.$langs->trans("LastSendings",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllSendings").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.dol_print_date($db->jdate($objp->date_creation),'day').''.dol_print_date($db->jdate($objp->date_creation),'day').'!!!!!!' . $sendingstatic->LibStatut($objp->statut, 5) . '
'; - print ''; - //print ''; + print ''; + //print ''; print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''.$langs->trans("AllContracts").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.dol_trunc($objp->refsup,12)."'.dol_print_date($db->jdate($objp->dc),'day')."'.dol_print_date($db->jdate($objp->dcon),'day')."'.dol_print_date($db->jdate($objp->dc),'day')."'.dol_print_date($db->jdate($objp->dcon),'day')." '; print $contrat->getLibStatut(4); @@ -986,8 +986,8 @@ if ($object->id > 0) print ''; print ''; - print ''; if ($action != 'editecheance' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; - print ''; + print ''; print ''; } @@ -1002,8 +1002,8 @@ if ($object->id > 0) print ''; print ''."\n"; - //print ''."\n"; - print ''."\n"; + //print ''."\n"; + print ''."\n"; print ''."\n"; print ''; @@ -1059,7 +1059,7 @@ if ($object->id > 0) print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.img_object($langs->trans("ShowPropal"),"propal").' '.$objp->ref.''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).''.dol_print_date($db->jdate($objp->startdate)).''.convertSecondToTime($objp->duration).''.$fichinter_static->getLibStatut(5).'
'; print ''; - print ''; print ''; print ''; - print ''; + print ''; $num = $db->num_rows($result); if ($num > 0) @@ -178,7 +178,7 @@ if ($result) print ''; print ''; $mailstatic=new Mailing($db); - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 7bbf727a517..aed6e0c53cb 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -149,7 +149,7 @@ if ($_socid > 0) print ''; print ''; print ''; - print ''; + print ''; print ''; $i = 0 ; $num = $db->num_rows($resql); @@ -163,7 +163,7 @@ if ($_socid > 0) print ''; $userstatic->id=$obj->uid; $userstatic->lastname=$obj->login; - print ''; + print ''; print ''; $i++; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 9605f413435..93511ce0513 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -205,7 +205,7 @@ if (empty($reshook)) } // Delete proposal - else if ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { $result = $object->delete($user); if ($result > 0) { @@ -218,7 +218,7 @@ if (empty($reshook)) } // Remove line - else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { $result = $object->deleteline($lineid); // reorder lines @@ -242,7 +242,7 @@ if (empty($reshook)) } // Validation - else if ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) + elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { $result = $object->valid($user); if ($result >= 0) @@ -269,7 +269,7 @@ if (empty($reshook)) } } - else if ($action == 'setdate' && $usercancreate) + elseif ($action == 'setdate' && $usercancreate) { $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -284,13 +284,13 @@ if (empty($reshook)) dol_print_error($db, $object->error); } } - else if ($action == 'setecheance' && $usercancreate) + elseif ($action == 'setecheance' && $usercancreate) { $result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear'])); if ($result < 0) dol_print_error($db, $object->error); } - else if ($action == 'setdate_livraison' && $usercancreate) + elseif ($action == 'setdate_livraison' && $usercancreate) { $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear'])); if ($result < 0) @@ -298,7 +298,7 @@ if (empty($reshook)) } // Positionne ref client - else if ($action == 'setref_client' && $usercancreate) + elseif ($action == 'setref_client' && $usercancreate) { $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) @@ -314,7 +314,7 @@ if (empty($reshook)) } // Create proposal - else if ($action == 'add' && $usercancreate) + elseif ($action == 'add' && $usercancreate) { $object->socid = $socid; $object->fetch_thirdparty(); @@ -619,7 +619,7 @@ if (empty($reshook)) } // Classify billed - else if ($action == 'classifybilled' && $usercanclose) + elseif ($action == 'classifybilled' && $usercanclose) { $db->begin(); @@ -641,7 +641,7 @@ if (empty($reshook)) } // Close proposal - else if ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel','alpha')) + elseif ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel','alpha')) { if (! (GETPOST('statut','int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors'); @@ -672,7 +672,7 @@ if (empty($reshook)) } // Reopen proposal - else if ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel','alpha')) + elseif ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel','alpha')) { // prevent browser refresh from reopening proposal several times if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) @@ -808,7 +808,7 @@ if (empty($reshook)) } } - else if ($action == "setabsolutediscount" && $usercancreate) { + elseif ($action == "setabsolutediscount" && $usercancreate) { if ($_POST["remise_id"]) { if ($object->id > 0) { $result = $object->insert_discount($_POST["remise_id"]); @@ -820,7 +820,7 @@ if (empty($reshook)) } // Add line - else if ($action == 'addline' && $usercancreate) { + elseif ($action == 'addline' && $usercancreate) { // Set if we used free entry or predefined product $predef=''; @@ -1184,7 +1184,7 @@ if (empty($reshook)) } // Update a line within proposal - else if ($action == 'updateline' && $usercancreate && GETPOST('save')) + elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { // Define info_bits $info_bits = 0; @@ -1320,66 +1320,66 @@ if (empty($reshook)) } } - else if ($action == 'updateline' && $usercancreate && GETPOST('cancel','alpha')) + elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel','alpha')) { header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition exit(); } // Set project - else if ($action == 'classin' && $usercancreate) { + elseif ($action == 'classin' && $usercancreate) { $object->setProject(GETPOST('projectid','int')); } // Delai de livraison - else if ($action == 'setavailability' && $usercancreate) { + elseif ($action == 'setavailability' && $usercancreate) { $result = $object->set_availability($user, GETPOST('availability_id','int')); } // Origine de la propale - else if ($action == 'setdemandreason' && $usercancreate) { + elseif ($action == 'setdemandreason' && $usercancreate) { $result = $object->set_demand_reason($user, GETPOST('demand_reason_id','int')); } // Conditions de reglement - else if ($action == 'setconditions' && $usercancreate) { + elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); } - else if ($action == 'setremisepercent' && $usercancreate) { + elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); } - else if ($action == 'setremiseabsolue' && $usercancreate) { + elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); } // Mode de reglement - else if ($action == 'setmode' && $usercancreate) { + elseif ($action == 'setmode' && $usercancreate) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); } // Multicurrency Code - else if ($action == 'setmulticurrencycode' && $usercancreate) { + elseif ($action == 'setmulticurrencycode' && $usercancreate) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } // Multicurrency rate - else if ($action == 'setmulticurrencyrate' && $usercancreate) { + elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } // bank account - else if ($action == 'setbankaccount' && $usercancreate) { + elseif ($action == 'setbankaccount' && $usercancreate) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); } // shipping method - else if ($action == 'setshippingmethod' && $usercancreate) { + elseif ($action == 'setshippingmethod' && $usercancreate) { $result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int')); } - else if ($action == 'update_extras') { + elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); // Fill array 'array_options' with data from update form @@ -1421,7 +1421,7 @@ if (empty($reshook)) } // Bascule du statut d'un contact - else if ($action == 'swapstatut') { + elseif ($action == 'swapstatut') { if ($object->fetch($id) > 0) { $result = $object->swapContactStatus(GETPOST('ligne')); } else { @@ -1430,7 +1430,7 @@ if (empty($reshook)) } // Efface un contact - else if ($action == 'deletecontact') { + elseif ($action == 'deletecontact') { $object->fetch($id); $result = $object->delete_contact($lineid); @@ -1909,22 +1909,22 @@ if ($action == 'create') } // Confirm delete - else if ($action == 'delete') { + elseif ($action == 'delete') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); } // Confirm reopen - else if ($action == 'reopen') { + elseif ($action == 'reopen') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1); } // Confirmation delete product/service line - else if ($action == 'ask_deleteline') { + elseif ($action == 'ask_deleteline') { $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); } // Confirm validate proposal - else if ($action == 'validate') { + elseif ($action == 'validate') { $error = 0; // We verifie whether the object is provisionally numbering @@ -2046,7 +2046,7 @@ if ($action == 'create') print $langs->trans('Date'); print ''; if ($action != 'editdate' && ! empty($object->brouillon) && $usercancreate) - print ''; + print ''; print '
'; + print ''; print ''; } @@ -1086,26 +1086,26 @@ if ($object->id > 0) print ''; if ($objp->frequency && $objp->date_last_gen > 0) { - print ''; + print ''; } else { if ($objp->dc > 0) { - print ''; + print ''; } else { - print ''; + print ''; } } - print ''; if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES)) { - print ''; } @@ -1164,8 +1164,8 @@ if ($object->id > 0) print '
'.$langs->trans("LatestCustomerTemplateInvoices",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllCustomerTemplateInvoices").' '.$num.''; print '
'.$langs->trans("LatestCustomerTemplateInvoices",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllCustomerTemplateInvoices").' '.$num.'
'.dol_print_date($db->jdate($objp->date_last_gen),'day').''.dol_print_date($db->jdate($objp->date_last_gen),'day').''.dol_print_date($db->jdate($objp->dc),'day').''.dol_print_date($db->jdate($objp->dc),'day').'!!!!!!'; + print ''; print price($objp->total_ht); print ''; + print ''; print price($objp->total_ttc); print '
'; print ''; - print ''; - print ''."\n"; if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; print ''."\n"; @@ -864,9 +863,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { print '"; } - else if ($total>0) + elseif ($total>0) { - print '"; + print '"; } print "
'; - print ''; + print ''; print ''; } @@ -1188,19 +1188,19 @@ if ($object->id > 0) print ''; if ($objp->df > 0) { - print ''; + print ''; } else { - print ''; + print ''; } - print ''; if (! empty($conf->global->MAIN_SHOW_PRICE_WITH_TAX_IN_SUMMARIES)) { - print ''; } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 81685f3fda8..bee64fb41d1 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -51,7 +51,7 @@ if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id; } -$max=5; +$max=3; $now=dol_now(); /* @@ -193,7 +193,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) if ($total>0) { - print '"; + print '"; } } else @@ -272,7 +272,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } if ($total>0) { - print '"; + print '"; } } else @@ -348,7 +348,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; } else { - print ''; + print ''; } $i++; $total += $obj->total_ttc; @@ -356,7 +356,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) if ($total>0) { - print '"; + print '"; } } else @@ -435,7 +435,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print ''; } else { - print ''; + print ''; } $i++; $total += $obj->total_ttc; @@ -443,7 +443,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande if ($total>0) { - print '"; + print '"; } } else @@ -464,7 +464,6 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande print '
'; -$NBMAX=3; $max=3; @@ -497,10 +496,10 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print '
'; print ''; - print ''; + print ''; print ''; if ($num) { @@ -515,10 +514,10 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $companystatic->canvas=$objp->canvas; print ''; print ''; - print '"; - print '"; + print '"; print ''; $i++; } @@ -560,7 +559,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print '
'.$langs->trans("LastCustomersBills",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllBills").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'.dol_print_date($db->jdate($objp->df),'day').''.dol_print_date($db->jdate($objp->df),'day').'!!!!!!'; + print ''; print price($objp->total_ht); print ''; + print ''; print price($objp->total_ttc); print '
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
'.price($obj->total_ht).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
'.price($obj->total_ht).'
'.price($obj->total_ttc).'
'.price($obj->total_ttc).'
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("Total").''.price($total)."
'; if (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastCustomersOrProspects",$max); - else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); + elseif (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); else print $langs->trans("BoxTitleLastModifiedCustomers",$max); print ''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.$companystatic->getNomUrl(1,'customer',48).''; + print ''; print $companystatic->getLibCustProspStatut(); print "'.dol_print_date($db->jdate($objp->tms),'day')."'.dol_print_date($db->jdate($objp->tms),'day')."
'; print ''; print ''; - print ''; + print ''; print ''; if ($num) { @@ -574,7 +573,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $companystatic->canvas=$objp->canvas; print ''; print ''; - print ''; + print ''; print ''; $i++; @@ -656,7 +655,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO $companystatic->canvas=$objp->canvas; print $companystatic->getNomUrl(1,'customer',44); print ''."\n"; - print "\n"; + print "\n"; $i++; } @@ -743,13 +742,13 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print ''; - print ''."\n"; if(! empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { - print ''; + print ''; } else { - print ''; + print ''; } print ''."\n"; print ''."\n"; @@ -760,9 +759,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { print '"; } - else if ($total>0) + elseif ($total>0) { - print '"; + print '"; } print "
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("FullList").''.$langs->trans("FullList").'
'.$companystatic->getNomUrl(1,'supplier',44).''.dol_print_date($db->jdate($objp->dm),'day').''.dol_print_date($db->jdate($objp->dm),'day').'
".$staticcontrat->LibStatut($obj->statut,3)."
".$staticcontrat->LibStatut($obj->statut,3)."
'; + print ''; print dol_print_date($db->jdate($obj->dp),'day').''.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->total_ttc).''.$propalstatic->LibStatut($obj->fk_statut,3).'
'.$langs->trans("XMoreLines", ($num - $nbofloop))."
'.$langs->trans("Total")."".price($total)." 
'.$langs->trans("Total")."".price($total)." 
"; print "
"; @@ -847,13 +846,13 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1, 'customer', 44); print '
'; + print ''; print dol_print_date($db->jdate($obj->dp),'day').''.price($obj->total_ht).''.price($obj->total_ht).''.price($obj->total_ttc).''.price($obj->total_ttc).''.$orderstatic->LibStatut($obj->fk_statut,$obj->billed,3).'
'.$langs->trans("XMoreLines", ($num - $nbofloop))."
'.$langs->trans("Total")."".price($total)." 
'.$langs->trans("Total")."".price($total)." 
"; print "
"; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 233f32d26be..5ce2b5c2f61 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -122,7 +122,7 @@ if (empty($reshook)) setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action=''; } - else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action=''; @@ -525,13 +525,13 @@ if (empty($reshook)) $upload_dir = $conf->mailing->dir_output . "/" . get_exdir($object->id,2,0,1,$object,'mailing'); if ($action == 'settitre') $object->titre = trim(GETPOST('titre','alpha')); - else if ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha')); - else if ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha')); - else if ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha')); - else if ($action == 'settitre' && empty($object->titre)) { + elseif ($action == 'setemail_from') $object->email_from = trim(GETPOST('email_from','alpha')); + elseif ($action == 'setemail_replyto') $object->email_replyto = trim(GETPOST('email_replyto','alpha')); + elseif ($action == 'setemail_errorsto') $object->email_errorsto = trim(GETPOST('email_errorsto','alpha')); + elseif ($action == 'settitre' && empty($object->titre)) { $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailTitle")); } - else if ($action == 'setfrom' && empty($object->email_from)) { + elseif ($action == 'setfrom' && empty($object->email_from)) { $mesg = $langs->trans("ErrorFieldRequired",$langs->transnoentities("MailFrom")); } @@ -803,12 +803,12 @@ else print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ValidMailing"),$langs->trans("ConfirmValidMailing"),"confirm_valid",'','',1); } // Confirm reset - else if ($action == 'reset') + elseif ($action == 'reset') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id,$langs->trans("ResetMailing"),$langs->trans("ConfirmResetMailing",$object->ref),"confirm_reset",'','',2); } // Confirm delete - else if ($action == 'delete') + elseif ($action == 'delete') { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id.(! empty($urlfrom) ? '&urlfrom='.urlencode($urlfrom) : ''),$langs->trans("DeleteAMailing"),$langs->trans("ConfirmDeleteMailing"),"confirm_delete",'','',1); } @@ -842,7 +842,7 @@ else if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } - else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); @@ -1008,7 +1008,7 @@ else { print ''.$langs->trans("ValidMailing").''; } - else if (empty($user->rights->mailing->valider)) + elseif (empty($user->rights->mailing->valider)) { print ''.$langs->trans("ValidMailing").''; } @@ -1024,7 +1024,7 @@ else { print ''.$langs->trans("SendMailing").''; } - else if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send) + elseif (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("SendMailing").''; } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 84c1f5954b9..0cb414be421 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -557,7 +557,7 @@ if ($object->fetch($id) >= 0) $objectstatic->fetch($obj->source_id); print $objectstatic->getNomUrl(1); } - else if ($obj->source_type == 'user') + elseif ($obj->source_type == 'user') { include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $objectstatic=new User($db); @@ -565,14 +565,14 @@ if ($object->fetch($id) >= 0) $objectstatic->id=$obj->source_id; print $objectstatic->getNomUrl(1); } - else if ($obj->source_type == 'thirdparty') + elseif ($obj->source_type == 'thirdparty') { include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $objectstatic=new Societe($db); $objectstatic->fetch($obj->source_id); print $objectstatic->getNomUrl(1); } - else if ($obj->source_type == 'contact') + elseif ($obj->source_type == 'contact') { include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $objectstatic=new Contact($db); @@ -602,7 +602,7 @@ if ($object->fetch($id) >= 0) } // Search Icon - print '
'; + print ''; if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index 83833304d44..0de2efbd9cf 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -108,7 +108,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -260,7 +260,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $id Id object * @return int <0 if KO, >0 if OK */ - function fetch_by_mailing($id=0) + function fetch_by_mailing($id = 0) { // phpcs:enable global $langs; @@ -327,7 +327,7 @@ class AdvanceTargetingMailing extends CommonObject * @param string $type_element Type target * @return int <0 if KO, >0 if OK */ - function fetch_by_element($id=0, $type_element='mailing') + function fetch_by_element($id = 0, $type_element = 'mailing') { // phpcs:enable global $langs; @@ -390,7 +390,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -466,7 +466,7 @@ class AdvanceTargetingMailing extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -525,7 +525,7 @@ class AdvanceTargetingMailing extends CommonObject * @param array $arrayquery All element to Query * @return int <0 if KO, >0 if OK */ - function savequery($user,$arrayquery) + function savequery($user, $arrayquery) { global $langs,$conf; @@ -785,12 +785,12 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_max'.'_cnct'])) { $sqlwhere[]= " (te.".$key." >= ".$arrayquery['options_'.$key.'_max'.'_cnct']." AND te.".$key." <= ".$arrayquery['options_'.$key.'_min'.'_cnct'].")"; } - } else if (($extrafields->attribute_type[$key] == 'date') || + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { if (!empty($arrayquery['options_'.$key.'_end_dt'.'_cnct'])){ $sqlwhere[]= " (te.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'.'_cnct'])."' AND te.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'.'_cnct'])."')"; } - }else if ($extrafields->attribute_type[$key] == 'boolean') { + }elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key.'_cnct']!=''){ if ($arrayquery['options_'.$key.'_cnct']==0) { $sqlwhere[]= " (te.".$key." = ".$arrayquery['options_'.$key.'_cnct']." OR ((te.".$key." IS NULL) AND (te.fk_object IS NOT NULL)))"; @@ -885,12 +885,12 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['options_'.$key.'_max'])) { $sqlwhere[]= " (tse.".$key." >= ".$arrayquery['options_'.$key.'_max']." AND tse.".$key." <= ".$arrayquery['options_'.$key.'_min'].")"; } - } else if (($extrafields->attribute_type[$key] == 'date') || + } elseif (($extrafields->attribute_type[$key] == 'date') || ($extrafields->attribute_type[$key] == 'datetime')) { if (!empty($arrayquery['options_'.$key.'_end_dt'])){ $sqlwhere[]= " (tse.".$key." >= '".$this->db->idate($arrayquery['options_'.$key.'_st_dt'])."' AND tse.".$key." <= '".$this->db->idate($arrayquery['options_'.$key.'_end_dt'])."')"; } - }else if ($extrafields->attribute_type[$key] == 'boolean') { + }elseif ($extrafields->attribute_type[$key] == 'boolean') { if ($arrayquery['options_'.$key]!=''){ $sqlwhere[]= " (tse.".$key." = ".$arrayquery['options_'.$key].")"; } @@ -946,7 +946,7 @@ class AdvanceTargetingMailing extends CommonObject * For exemple jean;joe;jim%%;!jimo;!jima%> will target all jean, joe, start with jim but not jimo and not everythnig taht start by jima * @return string Sql to use for the where condition */ - public function transformToSQL($column_to_test,$criteria) + public function transformToSQL($column_to_test, $criteria) { $return_sql_criteria = '('; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index 19b1ce3e9b4..369c0536a33 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -92,7 +92,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array or Code or Label of preselected country * @return string HTML string with select */ - function multiselectCountry($htmlname = 'country_id', $selected_array=array()) + function multiselectCountry($htmlname = 'country_id', $selected_array = array()) { global $conf, $langs; @@ -194,7 +194,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array selected array * @return string combo list code */ - function multiselectselectLanguage($htmlname='', $selected_array=array()) + function multiselectselectLanguage($htmlname = '', $selected_array = array()) { global $conf,$langs; @@ -290,7 +290,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array Array * @return string HTML combo */ - function multiselectCivility($htmlname='civilite_id',$selected_array = array()) + function multiselectCivility($htmlname = 'civilite_id', $selected_array = array()) { global $conf,$langs,$user; $langs->load("dict"); @@ -356,7 +356,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array value selected * @return string HTML combo */ - function multiselectCustomerCategories($htmlname='cust_cat',$selected_array = array()) + function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) { return $this->multiselectCategories($htmlname,$selected_array,2); } @@ -368,7 +368,7 @@ class FormAdvTargetEmailing extends Form * @param array $selected_array value selected * @return string HTML combo */ - function multiselectContactCategories($htmlname='contact_cat',$selected_array = array()) + function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) { return $this->multiselectCategories($htmlname,$selected_array,4); } @@ -381,7 +381,7 @@ class FormAdvTargetEmailing extends Form * @param int $type Type * @return string HTML combo */ - public function multiselectCategories($htmlname='',$selected_array = array(), $type=0) + public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0) { global $conf,$langs,$user; $langs->load("dict"); @@ -427,7 +427,7 @@ class FormAdvTargetEmailing extends Form * @param string $type_element Type element. Example: 'mailing' * @return string HTML combo */ - public function selectAdvtargetemailingTemplate($htmlname='template_id', $selected=0, $showempty=0, $type_element='mailing') + public function selectAdvtargetemailingTemplate($htmlname = 'template_id', $selected = 0, $showempty = 0, $type_element = 'mailing') { global $conf, $user, $langs; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index b807ea23334..7e1073a0f2a 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -271,7 +271,7 @@ class Mailing extends CommonObject * @param int $option2 Not used * @return int New id of clone */ - function createFromClone($fromid,$option1,$option2) + function createFromClone($fromid, $option1, $option2) { global $user,$langs; @@ -536,7 +536,7 @@ class Mailing extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -607,7 +607,7 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -620,7 +620,7 @@ class Mailing extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -670,7 +670,7 @@ class Mailing extends CommonObject * @param strin $desc Desc error * @return string Label */ - public static function libStatutDest($statut,$mode=0,$desc='') + public static function libStatutDest($statut, $mode = 0, $desc = '') { global $langs; $langs->load('mails'); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index cb062e00777..0c98800b3ea 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -118,7 +118,7 @@ if (is_resource($handle)) while ($i < $num ) { $obj = $db->fetch_object($result); - print ''.img_object('',$mailmodule->picto).' '.$obj->label.''.$obj->nb.''; + print ''.img_object('',$mailmodule->picto).' '.$obj->label.''.$obj->nb.''; $i++; } @@ -161,7 +161,7 @@ if ($result) print ''.$langs->trans("LastMailings",$limit).''.$langs->trans("DateCreation").''.$langs->trans("NbOfEMails").''.$langs->trans("AllEMailings").'
'.$langs->trans("AllEMailings").'
'.dol_print_date($db->jdate($obj->date_creat),'day').''.($obj->nbemail?$obj->nbemail:"0").''.$mailstatic->LibStatut($obj->statut,5).''.$mailstatic->LibStatut($obj->statut,5).'
'.$langs->trans("Date").''.$langs->trans("PriceLevel").''.$langs->trans("User").''.$langs->trans("User").'
'.$obj->price_level.' '.$userstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).'
id . '">' . img_edit($langs->trans('SetDate'), 1) . 'id . '">' . img_edit($langs->trans('SetDate'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editdate' && $usercancreate) { @@ -2072,7 +2072,7 @@ if ($action == 'create') print $langs->trans('DateEndPropal'); print 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . 'id . '">' . img_edit($langs->trans('SetConditions'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editecheance' && $usercancreate) { @@ -2100,7 +2100,7 @@ if ($action == 'create') print $langs->trans('PaymentConditionsShort'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editconditions' && $usercancreate) { @@ -2128,7 +2128,7 @@ if ($action == 'create') print ' (' . $langs->trans('AfterOrder') . ')'; print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editavailability' && $usercancreate) { @@ -2147,7 +2147,7 @@ if ($action == 'create') print $langs->trans('SendingMethod'); print 'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'id.'">'.img_edit($langs->trans('SetShippingMode'),1).'
'; print '
'; if ($action == 'editshippingmethod' && $usercancreate) { @@ -2165,7 +2165,7 @@ if ($action == 'create') print $langs->trans('Source'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editdemandreason' && $usercancreate) { @@ -2183,7 +2183,7 @@ if ($action == 'create') print $langs->trans('PaymentMode'); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) { @@ -2203,7 +2203,7 @@ if ($action == 'create') print $form->editfieldkey('Currency', 'multicurrency_code', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print '
'; if (! empty($object->brouillon) && $action == 'editmulticurrencycode' && $usercancreate) { @@ -2220,7 +2220,7 @@ if ($action == 'create') print $form->editfieldkey('CurrencyRate', 'multicurrency_tx', '', $object, 0); print 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . 'id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '
'; print '
'; if (! empty($object->brouillon) && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) { @@ -2244,7 +2244,7 @@ if ($action == 'create') // Outstanding Bill print '
'; print $langs->trans('OutstandingBill'); - print ''; + print ''; print price($soc->get_OutstandingBill()) . ' / '; print price($soc->outstanding_limit, 0, $langs, 1, - 1, - 1, $conf->currency); print 'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'id.'">'.img_edit($langs->trans('SetBankAccount'),1).'
'; print '
'; if ($action == 'editbankaccount') { @@ -2293,7 +2293,7 @@ if ($action == 'create') print '
'; print '
'; print $langs->trans('IncotermLabel'); - print ''; + print ''; if ($usercancreate) print ''.img_edit().''; else print ' '; print '
'; @@ -2370,7 +2370,7 @@ if ($action == 'create') print '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
' . $langs->trans('Status') . '' . $object->getLibStatut(4) . '
'; diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index a03624f3122..6ce38f8c432 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -559,7 +559,7 @@ class Proposals extends DolibarrApi * * @return array */ - function validate($id, $notrigger=0) + function validate($id, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); @@ -607,7 +607,7 @@ class Proposals extends DolibarrApi * * @return array */ - function close($id, $status, $note_private='', $notrigger=0) + function close($id, $status, $note_private = '', $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->propal->creer) { throw new RestException(401); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 55dd950abf2..b3da0634aee 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -239,7 +239,7 @@ class Propal extends CommonObject * @param int $socid Id third party * @param int $propalid Id proposal */ - function __construct($db, $socid="", $propalid=0) + function __construct($db, $socid = "", $propalid = 0) { global $conf,$langs; @@ -267,7 +267,7 @@ class Propal extends CommonObject * TODO Replace calls to this function by generation objet Ligne * inserted into table $this->products */ - function add_product($idproduct, $qty, $remise_percent=0) + function add_product($idproduct, $qty, $remise_percent = 0) { // phpcs:enable global $conf, $mysoc; @@ -434,7 +434,7 @@ class Propal extends CommonObject * @return int >0 if OK, <0 if KO * @see add_product */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=0, $pa_ht=0, $label='',$date_start='', $date_end='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise=0, $fk_remise_except=0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $fk_product = 0, $remise_percent = 0.0, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0, $fk_remise_except = 0) { global $mysoc, $conf, $langs; @@ -663,7 +663,7 @@ class Propal extends CommonObject * @param int $notrigger disable line update trigger * @return int 0 if OK, <0 if KO */ - function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $desc='', $price_base_type='HT', $info_bits=0, $special_code=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=0, $pa_ht=0, $label='', $type=0, $date_start='', $date_end='', $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0) + function updateline($rowid, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $desc = '', $price_base_type = 'HT', $info_bits = 0, $special_code = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = 0, $pa_ht = 0, $label = '', $type = 0, $date_start = '', $date_end = '', $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { global $mysoc; @@ -869,7 +869,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >=0 if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf,$hookmanager; $error=0; @@ -1216,7 +1216,7 @@ class Propal extends CommonObject * @param int $socid Id of thirdparty * @return int New id of clone */ - function createFromClone($socid=0) + function createFromClone($socid = 0) { global $user,$conf,$hookmanager; @@ -1340,7 +1340,7 @@ class Propal extends CommonObject * @param string $ref Ref of proposal * @return int >0 if OK, <0 if KO */ - function fetch($rowid,$ref='') + function fetch($rowid, $ref = '') { $sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc"; @@ -1504,7 +1504,7 @@ class Propal extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf; @@ -1599,7 +1599,7 @@ class Propal extends CommonObject * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - function fetch_lines($only_product=0) + function fetch_lines($only_product = 0) { // phpcs:enable $this->lines=array(); @@ -1718,7 +1718,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0=execute triggers * @return int <0 if KO, 0=Nothing done, >=0 if OK */ - function valid($user, $notrigger=0) + function valid($user, $notrigger = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -1842,7 +1842,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_date($user, $date, $notrigger=0) + function set_date($user, $date, $notrigger = 0) { // phpcs:enable if (empty($date)) @@ -1911,7 +1911,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_echeance($user, $date_fin_validite, $notrigger=0) + function set_echeance($user, $date_fin_validite, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -1973,7 +1973,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_date_livraison($user, $date_livraison, $notrigger=0) + function set_date_livraison($user, $date_livraison, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -2035,7 +2035,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_availability($user, $id, $notrigger=0) + function set_availability($user, $id, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2106,7 +2106,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_demand_reason($user, $id, $notrigger=0) + function set_demand_reason($user, $id, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer) && $this->statut >= self::STATUS_DRAFT) @@ -2179,7 +2179,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_ref_client($user, $ref_client, $notrigger=0) + function set_ref_client($user, $ref_client, $notrigger = 0) { // phpcs:enable if (! empty($user->rights->propal->creer)) @@ -2244,7 +2244,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise_percent($user, $remise, $notrigger=0) + function set_remise_percent($user, $remise, $notrigger = 0) { // phpcs:enable $remise=trim($remise)?trim($remise):0; @@ -2311,7 +2311,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise_absolue($user, $remise, $notrigger=0) + function set_remise_absolue($user, $remise, $notrigger = 0) { // phpcs:enable $remise=trim($remise)?trim($remise):0; @@ -2380,7 +2380,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function reopen($user, $statut, $note='', $notrigger=0) + function reopen($user, $statut, $note = '', $notrigger = 0) { $this->statut = $statut; @@ -2441,7 +2441,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - function cloture($user, $statut, $note="", $notrigger=0) + function cloture($user, $statut, $note = "", $notrigger = 0) { global $langs,$conf; @@ -2544,7 +2544,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - function classifyBilled(User $user, $notrigger=0) + function classifyBilled(User $user, $notrigger = 0) { $error=0; @@ -2600,7 +2600,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_draft($user, $notrigger=0) + function set_draft($user, $notrigger = 0) { // phpcs:enable $error=0; @@ -2665,7 +2665,7 @@ class Propal extends CommonObject * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist=0, $draft=0, $notcurrentuser=0, $socid=0, $limit=0, $offset=0, $sortfield='p.datep', $sortorder='DESC') + function liste_array($shortlist = 0, $draft = 0, $notcurrentuser = 0, $socid = 0, $limit = 0, $offset = 0, $sortfield = 'p.datep', $sortorder = 'DESC') { // phpcs:enable global $user; @@ -2706,7 +2706,7 @@ class Propal extends CommonObject { $ga[$obj->propalid] = $obj->ref; } - else if ($shortlist == 2) + elseif ($shortlist == 2) { $ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')'; } @@ -2833,7 +2833,7 @@ class Propal extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int 1 if ok, otherwise if error */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2957,7 +2957,7 @@ class Propal extends CommonObject * @return int >0 if OK, <0 if KO * @deprecated use set_availability */ - function availability($availability_id, $notrigger=0) + function availability($availability_id, $notrigger = 0) { global $user; @@ -3028,7 +3028,7 @@ class Propal extends CommonObject * @return int >0 si ok, <0 si ko * @deprecated use set_demand_reason */ - function demand_reason($demand_reason_id, $notrigger=0) + function demand_reason($demand_reason_id, $notrigger = 0) { // phpcs:enable global $user; @@ -3153,7 +3153,7 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut, $mode); } @@ -3166,7 +3166,7 @@ class Propal extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Short label, 3=Picto, 4=Picto + Long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - function LibStatut($statut,$mode=1) + function LibStatut($statut, $mode = 1) { // phpcs:enable global $conf; @@ -3213,7 +3213,7 @@ class Propal extends CommonObject * @param int $mode "opened" for proposal to close, "signed" for proposal to invoice * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user,$mode) + function load_board($user, $mode) { // phpcs:enable global $conf, $langs; @@ -3495,7 +3495,7 @@ class Propal extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $get_params='', $notooltip=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $get_params = '', $notooltip = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user; @@ -3585,7 +3585,7 @@ class Propal extends CommonObject * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$langs; @@ -3854,7 +3854,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function insert($notrigger=0) + function insert($notrigger = 0) { global $conf,$user; @@ -3997,7 +3997,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function delete(User $user, $notrigger=0) + function delete(User $user, $notrigger = 0) { global $conf; @@ -4051,7 +4051,7 @@ class PropaleLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function update($notrigger=0) + function update($notrigger = 0) { global $conf,$user; diff --git a/htdocs/comm/propal/class/propalestats.class.php b/htdocs/comm/propal/class/propalestats.class.php index bdd4a9dfba2..4286bb17448 100644 --- a/htdocs/comm/propal/class/propalestats.class.php +++ b/htdocs/comm/propal/class/propalestats.class.php @@ -56,7 +56,7 @@ class PropaleStats extends Stats * @param int $userid Id user for filter (creation user) * @param string $mode Option ('customer', 'supplier') */ - function __construct($db, $socid=0, $userid=0, $mode='customer') + function __construct($db, $socid = 0, $userid = 0, $mode = 'customer') { global $user, $conf; @@ -106,7 +106,7 @@ class PropaleStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with number by month */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { global $user; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index 7fc556a3b12..dc14324c293 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -56,7 +56,7 @@ if ($id > 0 || ! empty($ref)) setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); $error++; } - else if ($ret < 0) + elseif ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -105,7 +105,7 @@ if ($action == 'addcontact' && $user->rights->propale->creer) } // Toggle the status of a contact -else if ($action == 'swapstatut' && $user->rights->propale->creer) +elseif ($action == 'swapstatut' && $user->rights->propale->creer) { if ($object->id > 0) { @@ -114,7 +114,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer) } // Deletes a contact -else if ($action == 'deletecontact' && $user->rights->propale->creer) +elseif ($action == 'deletecontact' && $user->rights->propale->creer) { $result = $object->delete_contact($lineid); diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index f39f9efc54a..e708e0dac15 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -123,7 +123,7 @@ if ($resql) print ''; print ''.$propalstatic->LibStatut($status,0).''; - print ''.(isset($vals[$status])?$vals[$status]:0).''; + print ''.(isset($vals[$status])?$vals[$status]:0).''; print "\n"; } } @@ -144,8 +144,8 @@ if ($resql) print ''; } //if ($totalinprocess != $total) - //print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''; - print ''.$langs->trans("Total").''.$total.''; + //print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''; + print ''.$langs->trans("Total").''.$total.''; print "
"; } else @@ -260,7 +260,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->propal->multidir_output[$obj->entity] . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -276,7 +276,7 @@ if ($resql) print ''.$companystatic->getNomUrl(1,'customer').''; print ''.dol_print_date($db->jdate($obj->datec),'day').''; - print ''.$propalstatic->LibStatut($obj->fk_statut,5).''; + print ''.$propalstatic->LibStatut($obj->fk_statut,5).''; print ''; $i++; } @@ -355,9 +355,9 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $companystatic->canvas=$obj->canvas; print ''.$companystatic->getNomUrl(1,'customer',44).''."\n"; - print ''; + print ''; print dol_print_date($db->jdate($obj->dp),'day').''."\n"; - print ''.price($obj->total_ttc).''; + print ''.price($obj->total_ttc).''; print ''.$propalstatic->LibStatut($obj->fk_statut,3).''."\n"; print ''."\n"; $i++; @@ -367,7 +367,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; } - else if ($total>0) + elseif ($total>0) { print ''.$langs->trans("Total")."".price($total)." "; } @@ -441,7 +441,7 @@ if (! empty($conf->propal->enabled)) print ''.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($obj->name,24).''; - print ''.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).''; + print ''.$propalstatic->LibStatut($obj->fk_statut,$obj->facture,5).''; print ''; $i++; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 2d3917a0d47..193859cdd70 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -890,7 +890,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['p.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -898,7 +898,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['p.total_vat']['checked'])) { - print ''.price($obj->total_vat)."\n"; + print ''.price($obj->total_vat)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_vat; @@ -906,7 +906,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['p.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -940,7 +940,7 @@ if ($resql) print $nbofsalesrepresentative; print ''; } - else if ($nbofsalesrepresentative > 0) + elseif ($nbofsalesrepresentative > 0) { $userstatic=new User($db); $j=0; @@ -995,7 +995,7 @@ if ($resql) // Status if (! empty($arrayfields['p.fk_statut']['checked'])) { - print ''.$objectstatic->LibStatut($obj->fk_statut,5).''; + print ''.$objectstatic->LibStatut($obj->fk_statut,5).''; if (! $i) $totalarray['nbfield']++; } // Action column @@ -1033,14 +1033,14 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; elseif ($totalarray['totalizable']) { $printed = false; foreach ($totalarray['totalizable'] as $totalizable) { if ($totalizable['pos']==$i && ! $printed) { - print ''.price($totalizable['total']).''; + print ''.price($totalizable['total']).''; $printed = true; } } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 5c54baf7360..29afd62d780 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -280,12 +280,12 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; @@ -298,22 +298,22 @@ foreach ($data as $val) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } diff --git a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php index 0d8c2064010..118bc3fbd37 100644 --- a/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php +++ b/htdocs/comm/propal/tpl/linkedobjectblock.tpl.php @@ -82,9 +82,9 @@ if (count($linkedObjectBlock) > 1) - - - + + + id.'">'; print img_action($langs->trans("Show"),$obj->id).' '; print $langs->trans("StatusProspect".$obj->id); - print ''; + print ''; $i++; } print "
'.$langs->trans("Year").''.$langs->trans("NbOfProposals").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("NbOfProposals").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
0?'&userid='.$userid:'').'">'.$oldyear.'000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'],'MT'),1).''.round($val['total_diff']).''.price(price2num($val['avg'],'MT'),1).''.round($val['avg_diff']).''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'],'MT'),1).''.round($val['total_diff']).''.price(price2num($val['avg'],'MT'),1).''.round($val['avg_diff']).'
'.$obj->cc.'
'.$obj->cc.'

"; @@ -140,7 +140,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) print ''; print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; - print ''; + print ''; print price($obj->price); print ""; $i++; diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index fe002f81a97..1d3aa865460 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -434,9 +434,9 @@ if ($socid > 0) print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("AmountHT").''; + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("DiscountOfferedBy").''; print ' '; print ''; @@ -487,9 +487,9 @@ if ($socid > 0) print ''; } print ''.$langs->trans("NotConsumed").''; - print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; - print ''.price($obj->amount_ttc).''; + print ''.price($obj->amount_ht).''; + print ''.price2num($obj->tva_tx,'MU').'%'; + print ''.price($obj->amount_ttc).''; print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -573,9 +573,9 @@ if ($socid > 0) print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("AmountHT").''; + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("DiscountOfferedBy").''; print ' '; print ''; @@ -626,9 +626,9 @@ if ($socid > 0) print ''; } print ''.$langs->trans("NotConsumed").''; - print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; - print ''.price($obj->amount_ttc).''; + print ''.price($obj->amount_ht).''; + print ''.price2num($obj->tva_tx,'MU').'%'; + print ''.price($obj->amount_ttc).''; print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -746,9 +746,9 @@ if ($socid > 0) print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("AmountHT").''; + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("Author").''; print ' '; print ''; @@ -820,9 +820,9 @@ if ($socid > 0) print ''; } print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.''; - print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; - print ''.price($obj->amount_ttc).''; + print ''.price($obj->amount_ht).''; + print ''.price2num($obj->tva_tx,'MU').'%'; + print ''.price($obj->amount_ttc).''; print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; @@ -900,9 +900,9 @@ if ($socid > 0) print ''.$langs->trans("Date").''; // Need 120+ for format with AM/PM print ''.$langs->trans("ReasonDiscount").''; print ''.$langs->trans("ConsumedBy").''; - print ''.$langs->trans("AmountHT").''; - print ''.$langs->trans("VATRate").''; - print ''.$langs->trans("AmountTTC").''; + print ''.$langs->trans("AmountHT").''; + print ''.$langs->trans("VATRate").''; + print ''.$langs->trans("AmountTTC").''; print ''.$langs->trans("Author").''; print ' '; print ''; @@ -974,9 +974,9 @@ if ($socid > 0) print ''; } print ''.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.''; - print ''.price($obj->amount_ht).''; - print ''.price2num($obj->tva_tx,'MU').'%'; - print ''.price($obj->amount_ttc).''; + print ''.price($obj->amount_ht).''; + print ''.price2num($obj->tva_tx,'MU').'%'; + print ''.price($obj->amount_ttc).''; print ''; print ''.img_object($langs->trans("ShowUser"),'user').' '.$obj->login.''; print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 36dac7431af..08da5786589 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -159,7 +159,7 @@ if (empty($reshook)) } // Reopen a closed order - else if ($action == 'reopen' && $user->rights->commande->creer) + elseif ($action == 'reopen' && $user->rights->commande->creer) { if ($object->statut == Commande::STATUS_CANCELED || $object->statut == Commande::STATUS_CLOSED) { @@ -176,7 +176,7 @@ if (empty($reshook)) } // Remove order - else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->commande->supprimer) { $result = $object->delete($user); if ($result > 0) @@ -191,7 +191,7 @@ if (empty($reshook)) } // Remove a product line - else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->commande->creer) { $result = $object->deleteline($user, $lineid); if ($result > 0) @@ -222,13 +222,13 @@ if (empty($reshook)) } // Link to a project - else if ($action == 'classin' && $user->rights->commande->creer) + elseif ($action == 'classin' && $user->rights->commande->creer) { $object->setProject(GETPOST('projectid','int')); } // Add order - else if ($action == 'add' && $user->rights->commande->creer) + elseif ($action == 'add' && $user->rights->commande->creer) { $datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')); $datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -481,7 +481,7 @@ if (empty($reshook)) } } - else if ($action == 'classifybilled' && $user->rights->commande->creer) + elseif ($action == 'classifybilled' && $user->rights->commande->creer) { $ret=$object->classifyBilled($user); @@ -489,7 +489,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - else if ($action == 'classifyunbilled' && $user->rights->commande->creer) + elseif ($action == 'classifyunbilled' && $user->rights->commande->creer) { $ret=$object->classifyUnBilled(); if ($ret < 0) { @@ -498,7 +498,7 @@ if (empty($reshook)) } // Positionne ref commande client - else if ($action == 'setref_client' && $user->rights->commande->creer) { + elseif ($action == 'setref_client' && $user->rights->commande->creer) { $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) { @@ -506,7 +506,7 @@ if (empty($reshook)) } } - else if ($action == 'setremise' && $user->rights->commande->creer) { + elseif ($action == 'setremise' && $user->rights->commande->creer) { $result = $object->set_remise($user, GETPOST('remise')); if ($result < 0) { @@ -514,7 +514,7 @@ if (empty($reshook)) } } - else if ($action == 'setabsolutediscount' && $user->rights->commande->creer) { + elseif ($action == 'setabsolutediscount' && $user->rights->commande->creer) { if (GETPOST('remise_id')) { if ($object->id > 0) { $object->insert_discount(GETPOST('remise_id')); @@ -524,7 +524,7 @@ if (empty($reshook)) } } - else if ($action == 'setdate' && $user->rights->commande->creer) { + elseif ($action == 'setdate' && $user->rights->commande->creer) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $date = dol_mktime(0, 0, 0, GETPOST('order_month'), GETPOST('order_day'), GETPOST('order_year')); @@ -534,7 +534,7 @@ if (empty($reshook)) } } - else if ($action == 'setdate_livraison' && $user->rights->commande->creer) { + elseif ($action == 'setdate_livraison' && $user->rights->commande->creer) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; $datelivraison = dol_mktime(0, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year')); @@ -544,35 +544,35 @@ if (empty($reshook)) } } - else if ($action == 'setmode' && $user->rights->commande->creer) { + elseif ($action == 'setmode' && $user->rights->commande->creer) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } // Multicurrency Code - else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) { + elseif ($action == 'setmulticurrencycode' && $user->rights->commande->creer) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } // Multicurrency rate - else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) { + elseif ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); } - else if ($action == 'setavailability' && $user->rights->commande->creer) { + elseif ($action == 'setavailability' && $user->rights->commande->creer) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - else if ($action == 'setdemandreason' && $user->rights->commande->creer) { + elseif ($action == 'setdemandreason' && $user->rights->commande->creer) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - else if ($action == 'setconditions' && $user->rights->commande->creer) { + elseif ($action == 'setconditions' && $user->rights->commande->creer) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); if ($result < 0) { dol_print_error($db, $object->error); @@ -604,7 +604,7 @@ if (empty($reshook)) } // bank account - else if ($action == 'setbankaccount' && $user->rights->commande->creer) { + elseif ($action == 'setbankaccount' && $user->rights->commande->creer) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -612,7 +612,7 @@ if (empty($reshook)) } // shipping method - else if ($action == 'setshippingmethod' && $user->rights->commande->creer) { + elseif ($action == 'setshippingmethod' && $user->rights->commande->creer) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); @@ -620,23 +620,23 @@ if (empty($reshook)) } // warehouse - else if ($action == 'setwarehouse' && $user->rights->commande->creer) { + elseif ($action == 'setwarehouse' && $user->rights->commande->creer) { $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - else if ($action == 'setremisepercent' && $user->rights->commande->creer) { + elseif ($action == 'setremisepercent' && $user->rights->commande->creer) { $result = $object->set_remise($user, GETPOST('remise_percent')); } - else if ($action == 'setremiseabsolue' && $user->rights->commande->creer) { + elseif ($action == 'setremiseabsolue' && $user->rights->commande->creer) { $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); } // Add a new line - else if ($action == 'addline' && $user->rights->commande->creer) + elseif ($action == 'addline' && $user->rights->commande->creer) { $langs->load('errors'); $error = 0; @@ -998,7 +998,7 @@ if (empty($reshook)) /* * Update a line */ - else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save')) + elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('save')) { // Clean parameters $date_start=''; @@ -1134,12 +1134,12 @@ if (empty($reshook)) } } - else if ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) { + elseif ($action == 'updateline' && $user->rights->commande->creer && GETPOST('cancel','alpha') == $langs->trans('Cancel')) { header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition exit(); } - else if ($action == 'confirm_validate' && $confirm == 'yes' && + elseif ($action == 'confirm_validate' && $confirm == 'yes' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) ) @@ -1196,7 +1196,7 @@ if (empty($reshook)) } // Go back to draft status - else if ($action == 'confirm_modif' && $user->rights->commande->creer) { + elseif ($action == 'confirm_modif' && $user->rights->commande->creer) { $idwarehouse = GETPOST('idwarehouse'); $qualified_for_stock_change=0; @@ -1244,14 +1244,14 @@ if (empty($reshook)) } } - else if ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { + elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $user->rights->commande->cloturer) { $result = $object->cloture($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } } - else if ($action == 'confirm_cancel' && $confirm == 'yes' && + elseif ($action == 'confirm_cancel' && $confirm == 'yes' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->creer)) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->validate))) ) @@ -1441,7 +1441,7 @@ if (empty($reshook)) } // bascule du statut d'un contact - else if ($action == 'swapstatut') + elseif ($action == 'swapstatut') { if ($object->id > 0) { $result = $object->swapContactStatus(GETPOST('ligne')); @@ -1451,7 +1451,7 @@ if (empty($reshook)) } // Efface un contact - else if ($action == 'deletecontact') + elseif ($action == 'deletecontact') { $result = $object->delete_contact($lineid); diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 1135a5c2502..2c91990332b 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -496,7 +496,7 @@ class Orders extends DolibarrApi * * @return array */ - function validate($id, $idwarehouse=0, $notrigger=0) + function validate($id, $idwarehouse = 0, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -565,7 +565,7 @@ class Orders extends DolibarrApi $result = $this->commande->set_reopen(DolibarrApiAccess::$user); if( $result < 0) { throw new RestException(405, $this->commande->error); - }else if( $result == 0) { + }elseif( $result == 0) { throw new RestException(304); } @@ -629,7 +629,7 @@ class Orders extends DolibarrApi * * @return int */ - function close($id, $notrigger=0) + function close($id, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); @@ -675,7 +675,7 @@ class Orders extends DolibarrApi * * @return array */ - function settodraft($id, $idwarehouse=-1) + function settodraft($id, $idwarehouse = -1) { if(! DolibarrApiAccess::$user->rights->commande->creer) { throw new RestException(401); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 8934e293973..5c000ce6d2d 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -313,7 +313,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <=0 if OK, 0=Nothing done, >0 if KO */ - function valid($user, $idwarehouse=0, $notrigger=0) + function valid($user, $idwarehouse = 0, $notrigger = 0) { global $conf,$langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -474,7 +474,7 @@ class Commande extends CommonOrder * @param int $idwarehouse Warehouse ID to use for stock change (Used only if option STOCK_CALCULATE_ON_VALIDATE_ORDER is on) * @return int <0 if KO, >0 if OK */ - function set_draft($user, $idwarehouse=-1) + function set_draft($user, $idwarehouse = -1) { //phpcs:enable global $conf,$langs; @@ -617,7 +617,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - function cloture($user, $notrigger=0) + function cloture($user, $notrigger = 0) { global $conf; @@ -677,7 +677,7 @@ class Commande extends CommonOrder * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function cancel($idwarehouse=-1) + function cancel($idwarehouse = -1) { global $conf,$user,$langs; @@ -758,7 +758,7 @@ class Commande extends CommonOrder * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf,$langs; $error=0; @@ -1060,7 +1060,7 @@ class Commande extends CommonOrder * @param int $socid Id of thirdparty * @return int New id of clone */ - function createFromClone($socid=0) + function createFromClone($socid = 0) { global $user,$hookmanager; @@ -1302,7 +1302,7 @@ class Commande extends CommonOrder * par l'appelant par la methode get_default_tva(societe_vendeuse,societe_acheteuse,produit) * et le desc doit deja avoir la bonne valeur (a l'appelant de gerer le multilangue) */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $info_bits=0, $fk_remise_except=0, $price_base_type='HT', $pu_ttc=0, $date_start='', $date_end='', $type=0, $rang=-1, $special_code=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='',$array_options=0, $fk_unit=null, $origin='', $origin_id=0, $pu_ht_devise = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $info_bits = 0, $fk_remise_except = 0, $price_base_type = 'HT', $pu_ttc = 0, $date_start = '', $date_end = '', $type = 0, $rang = -1, $special_code = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $fk_unit = null, $origin = '', $origin_id = 0, $pu_ht_devise = 0) { global $mysoc, $conf, $langs, $user; @@ -1531,7 +1531,7 @@ class Commande extends CommonOrder * TODO Remplacer les appels a cette fonction par generation objet Ligne * insere dans tableau $this->products */ - function add_product($idproduct, $qty, $remise_percent=0.0, $date_start='', $date_end='') + function add_product($idproduct, $qty, $remise_percent = 0.0, $date_start = '', $date_end = '') { // phpcs:enable global $conf, $mysoc; @@ -1616,7 +1616,7 @@ class Commande extends CommonOrder * @param string $ref_int Internal reference of other object * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($id, $ref='', $ref_ext='', $ref_int='') + function fetch($id, $ref = '', $ref_ext = '', $ref_int = '') { // Check parameters @@ -1845,7 +1845,7 @@ class Commande extends CommonOrder * @param int $only_product Return only physical products * @return int <0 if KO, >0 if OK */ - function fetch_lines($only_product=0) + function fetch_lines($only_product = 0) { // phpcs:enable $this->lines=array(); @@ -2027,7 +2027,7 @@ class Commande extends CommonOrder * @param int $filtre_statut Filter on shipment status * @return int <0 if KO, Nb of lines found if OK */ - function loadExpeditions($filtre_statut=-1) + function loadExpeditions($filtre_statut = -1) { $this->expeditions = array(); @@ -2103,7 +2103,7 @@ class Commande extends CommonOrder * * TODO FONCTION NON FINIE A FINIR */ - function stock_array($filtre_statut=self::STATUS_CANCELED) + function stock_array($filtre_statut = self::STATUS_CANCELED) { // phpcs:enable $this->stocks = array(); @@ -2143,7 +2143,7 @@ class Commande extends CommonOrder * @param int $lineid Id of line to delete * @return int >0 if OK, 0 if nothing to do, <0 if KO */ - function deleteline($user=null, $lineid=0) + function deleteline($user = null, $lineid = 0) { if ($this->statut == self::STATUS_DRAFT) { @@ -2221,7 +2221,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise($user, $remise, $notrigger=0) + function set_remise($user, $remise, $notrigger = 0) { // phpcs:enable $remise=trim($remise)?trim($remise):0; @@ -2289,7 +2289,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise_absolue($user, $remise, $notrigger=0) + function set_remise_absolue($user, $remise, $notrigger = 0) { // phpcs:enable $remise=trim($remise)?trim($remise):0; @@ -2357,7 +2357,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_date($user, $date, $notrigger=0) + function set_date($user, $date, $notrigger = 0) { // phpcs:enable if ($user->rights->commande->creer) @@ -2423,7 +2423,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 si ko, >0 si ok */ - function set_date_livraison($user, $date_livraison, $notrigger=0) + function set_date_livraison($user, $date_livraison, $notrigger = 0) { // phpcs:enable if ($user->rights->commande->creer) @@ -2494,7 +2494,7 @@ class Commande extends CommonOrder * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='c.date_commande', $sortorder='DESC') + function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'c.date_commande', $sortorder = 'DESC') { // phpcs:enable global $user; @@ -2533,7 +2533,7 @@ class Commande extends CommonOrder { $ga[$obj->cid] = $obj->ref; } - else if ($shortlist == 2) + elseif ($shortlist == 2) { $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; } @@ -2562,7 +2562,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if OK, <0 if KO */ - function availability($availability_id, $notrigger=0) + function availability($availability_id, $notrigger = 0) { global $user; @@ -2633,7 +2633,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int >0 if ok, <0 if ko */ - function demand_reason($demand_reason_id, $notrigger=0) + function demand_reason($demand_reason_id, $notrigger = 0) { // phpcs:enable global $user; @@ -2706,7 +2706,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_ref_client($user, $ref_client, $notrigger=0) + function set_ref_client($user, $ref_client, $notrigger = 0) { // phpcs:enable if ($user->rights->commande->creer) @@ -2769,7 +2769,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function classifyBilled(User $user, $notrigger=0) + function classifyBilled(User $user, $notrigger = 0) { $error = 0; @@ -2904,7 +2904,7 @@ class Commande extends CommonOrder * @param int $notrigger disable line update trigger * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0.0,$txlocaltax2=0.0, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $fk_unit=null, $pu_ht_devise = 0, $notrigger=0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1 = 0.0, $txlocaltax2 = 0.0, $price_base_type = 'HT', $info_bits = 0, $date_start = '', $date_end = '', $type = 0, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { global $conf, $mysoc, $langs, $user; @@ -3094,7 +3094,7 @@ class Commande extends CommonOrder * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf; @@ -3189,7 +3189,7 @@ class Commande extends CommonOrder * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <=0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -3408,7 +3408,7 @@ class Commande extends CommonOrder * @param int $donotshowbilled Do not show billed status after order status * @return string Label of status */ - function LibStatut($statut,$billed,$mode,$donotshowbilled=0) + function LibStatut($statut, $billed, $mode, $donotshowbilled = 0) { // phpcs:enable global $langs, $conf; @@ -3501,7 +3501,7 @@ class Commande extends CommonOrder * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $notooltip=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $notooltip = 0, $save_lastsearch_value = -1) { global $conf, $langs, $user; @@ -3782,7 +3782,7 @@ class Commande extends CommonOrder * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$langs; @@ -4022,7 +4022,7 @@ class OrderLine extends CommonOrderLine * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 si ko, >0 si ok */ - function delete(User $user, $notrigger=0) + function delete(User $user, $notrigger = 0) { global $conf, $langs; @@ -4083,7 +4083,7 @@ class OrderLine extends CommonOrderLine * @param int $notrigger 1 = disable triggers * @return int <0 if KO, >0 if OK */ - function insert($user=null, $notrigger=0) + function insert($user = null, $notrigger = 0) { global $langs, $conf; @@ -4228,7 +4228,7 @@ class OrderLine extends CommonOrderLine * @param int $notrigger 1 = disable triggers * @return int <0 si ko, >0 si ok */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf,$langs; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index 3c6ec07c6cb..0300eb51df0 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -55,7 +55,7 @@ class CommandeStats extends Stats * @param string $mode Option ('customer', 'supplier') * @param int $userid Id user for filter (creation user) */ - function __construct($db, $socid, $mode, $userid=0) + function __construct($db, $socid, $mode, $userid = 0) { global $user, $conf; @@ -101,7 +101,7 @@ class CommandeStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with number by month */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { global $user; @@ -144,7 +144,7 @@ class CommandeStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with amount by month */ - function getAmountByMonth($year, $format=0) + function getAmountByMonth($year, $format = 0) { global $user; @@ -223,4 +223,3 @@ class CommandeStats extends Stats return $this->_getAllByProduct($sql); } } - diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index b40a284e728..9c5c1c183b0 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -79,7 +79,7 @@ if ($action == 'addcontact' && $user->rights->commande->creer) } // bascule du statut d'un contact -else if ($action == 'swapstatut' && $user->rights->commande->creer) +elseif ($action == 'swapstatut' && $user->rights->commande->creer) { if ($object->fetch($id)) { @@ -92,7 +92,7 @@ else if ($action == 'swapstatut' && $user->rights->commande->creer) } // Efface un contact -else if ($action == 'deletecontact' && $user->rights->commande->creer) +elseif ($action == 'deletecontact' && $user->rights->commande->creer) { $object->fetch($id); $result = $object->delete_contact($_GET["lineid"]); diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index ff9cb2c37fb..0b420eabac6 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -175,7 +175,7 @@ if ($resql) print ''.$obj->town.' '; print ''.$obj->code_client.' '; print ''.$obj->code_compta.' '; - print ''.dol_print_date($db->jdate($obj->datec)).''; + print ''.dol_print_date($db->jdate($obj->datec)).''; print "\n"; $i++; } @@ -193,4 +193,3 @@ else // End of page llxFooter(); $db->close(); - diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index a87c4d868bf..5c88a0597d0 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -145,7 +145,7 @@ if ($resql) { print ''; print ''.$commandestatic->LibStatut($status,$bool,0).''; - print ''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; + print ''.(isset($vals[$status.$bool])?$vals[$status.$bool]:0).' '; print $commandestatic->LibStatut($status,$bool,3); print ''; print ''; @@ -153,7 +153,7 @@ if ($resql) } } //if ($totalinprocess != $total) - print ''.$langs->trans("Total").''.$total.''; + print ''.$langs->trans("Total").''.$total.''; print "
"; } else @@ -289,7 +289,7 @@ if ($resql) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -302,7 +302,7 @@ if ($resql) print $companystatic->getNomUrl(1,'company',16); print ''; print ''.dol_print_date($db->jdate($obj->datem),'day').''; - print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; + print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; print ''; $i++; } @@ -369,7 +369,7 @@ if (! empty($conf->commande->enabled)) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -382,7 +382,7 @@ if (! empty($conf->commande->enabled)) print $companystatic->getNomUrl(1,'company',24); print ''; - print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; + print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; print ''; $i++; @@ -451,7 +451,7 @@ if (! empty($conf->commande->enabled)) print ' '; print ''; - print ''; + print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->commande->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid; @@ -464,7 +464,7 @@ if (! empty($conf->commande->enabled)) print $companystatic->getNomUrl(1,'company'); print ''; - print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; + print ''.$commandestatic->LibStatut($obj->fk_statut,$obj->facture,5).''; print ''; $i++; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 739e3699133..178f68ddd05 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -1025,7 +1025,7 @@ if ($resql) // Amount HT if (! empty($arrayfields['c.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalhtfield']=$totalarray['nbfield']; $totalarray['totalht'] += $obj->total_ht; @@ -1033,7 +1033,7 @@ if ($resql) // Amount VAT if (! empty($arrayfields['c.total_vat']['checked'])) { - print ''.price($obj->total_tva)."\n"; + print ''.price($obj->total_tva)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalvatfield']=$totalarray['nbfield']; $totalarray['totalvat'] += $obj->total_tva; @@ -1041,7 +1041,7 @@ if ($resql) // Amount TTC if (! empty($arrayfields['c.total_ttc']['checked'])) { - print ''.price($obj->total_ttc)."\n"; + print ''.price($obj->total_ttc)."\n"; if (! $i) $totalarray['nbfield']++; if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; @@ -1072,7 +1072,7 @@ if ($resql) // Status if (! empty($arrayfields['c.fk_statut']['checked'])) { - print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; + print ''.$generic_commande->LibStatut($obj->fk_statut, $obj->billed, 5, 1).''; if (! $i) $totalarray['nbfield']++; } // Billed @@ -1118,9 +1118,9 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; } - elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; - elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; - elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; + elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; + elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; else print ''; } print ''; diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 6fc778fb064..a57430f7ee8 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -306,12 +306,12 @@ print '
'; print ''; print ''; print ''; -print ''; -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; print ''; $oldyear=0; @@ -324,24 +324,24 @@ foreach ($data as $val) print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php index 392d2455e2a..840ba06980a 100644 --- a/htdocs/commande/tpl/linkedobjectblock.tpl.php +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -81,9 +81,9 @@ if (count($linkedObjectBlock) > 1) - - - + + + "; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print "\n"; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index a8d86c1a5f9..67e6deace4c 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -6,7 +6,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France * @@ -704,8 +704,8 @@ if ($resql) $form->select_comptes(GETPOST('add_account','int')?GETPOST('add_account','int'):$search_account,'add_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); print ''; //} - print ''; - print ''; + print ''; + print ''; /*if (! empty($conf->accounting->enabled)) { print ''; } if (! empty($arrayfields['b.debit']['checked'])) { - print ''; } if (! empty($arrayfields['b.credit']['checked'])) { - print ''; } if (! empty($arrayfields['balancebefore']['checked'])) { - print ''; } if (! empty($arrayfields['balance']['checked'])) { - print ''; @@ -1072,13 +1072,13 @@ if ($resql) if (! empty($arrayfields['balancebefore']['checked'])) { - print ''; } if (! empty($arrayfields['balance']['checked'])) { - print ''; } @@ -1126,7 +1126,7 @@ if ($resql) // Ref if (! empty($arrayfields['b.rowid']['checked'])) { - print ''; if (! $i) $totalarray['nbfield']++; @@ -1346,7 +1346,7 @@ if ($resql) // Bank account if (! empty($arrayfields['ba.ref']['checked'])) { - print '\n"; if (! $i) $totalarray['nbfield']++; @@ -1369,7 +1369,7 @@ if ($resql) // Credit if (! empty($arrayfields['b.credit']['checked'])) { - print ''; + print ''; } else { - print ''; + print ''; } } else @@ -1407,7 +1407,7 @@ if ($resql) { if ($balance >= 0) { - print ''; + print ''; } else { @@ -1523,8 +1523,8 @@ if ($resql) if ($num < $limit && empty($offset)) print ''; else print ''; } - elseif ($totalarray['totaldebfield'] == $i) print ''; - elseif ($totalarray['totalcredfield'] == $i) print ''; + elseif ($totalarray['totaldebfield'] == $i) print ''; + elseif ($totalarray['totalcredfield'] == $i) print ''; elseif ($i == $posconciliatecol) { print ''; + if (! empty($totalarray['pos'][$i])) print ''; else { if ($i == 1) diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index d0a10ec94da..946658208df 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -295,7 +295,7 @@ class CashControl extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - public function getLibStatut($mode=0) + public function getLibStatut($mode = 0) { return $this->LibStatut($this->status, $mode); } @@ -308,7 +308,7 @@ class CashControl extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - public function LibStatut($status, $mode=0) + public function LibStatut($status, $mode = 0) { // phpcs:enable if (empty($this->labelstatus)) @@ -364,7 +364,7 @@ class CashControl extends CommonObject * @param int $notooltip No tooltip * @return string String with URL */ - public function getNomUrl($withpicto=0, $option='', $maxlength=0, $save_lastsearch_value=-1, $notooltip=0) + public function getNomUrl($withpicto = 0, $option = '', $maxlength = 0, $save_lastsearch_value = -1, $notooltip = 0) { global $conf, $langs, $hookmanager; include_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 51f3c096f56..85ef39a6c97 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -6,7 +6,7 @@ * Copyright (C) 2014 Florian Henry * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Andreu Bisquerra * * This program is free software; you can redistribute it and/or modify @@ -172,7 +172,7 @@ if ($resql) { print ''; print ''; - print ''; + print ''; print ''; $first = "no"; }*/ @@ -180,7 +180,7 @@ if ($resql) print ''; // Ref - print ''; @@ -188,13 +188,13 @@ if ($resql) // Date ope - print '\n"; if (! $i) $totalarray['nbfield']++; // Bank account - print ''; else print ''; } - elseif ($totalarray['totaldebfield'] == $i) print ''; - elseif ($totalarray['totalcredfield'] == $i) print ''; + elseif ($totalarray['totaldebfield'] == $i) print ''; + elseif ($totalarray['totalcredfield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index c77805a4a73..9fe05e57bd9 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * @@ -185,7 +185,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) // Type print ''; // Expected to pay - print ''; + print ''; // Ref payment $payment_sc_static->id=$obj->pid; $payment_sc_static->ref=$obj->pid; @@ -215,7 +215,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; } // Paid - print ''; print ''; @@ -278,7 +278,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print_liste_field_titre("PeriodEndDate",$_SERVER["PHP_SELF"],"pv.datev","",$param,'width="140px"',$sortfield,$sortorder); print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("ExpectedToPay",$_SERVER["PHP_SELF"],"pv.amount","",$param,'class="right"',$sortfield,$sortorder); print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datev","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); @@ -298,7 +298,7 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print "\n"; - print '"; + print '"; // Ref payment $tva_static->id=$obj->rowid; @@ -333,18 +333,18 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) } // Paid - print '"; + print '"; print "\n"; $i++; } print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; - print '"; + print '"; print ""; print "
'.$langs->trans("Year").''.$langs->trans("NbOfOrders").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%'.$langs->trans("NbOfOrders").'%'.$langs->trans("AmountTotal").'%'.$langs->trans("AmountAverage").'%
0?'&userid='.$userid:'').'">'.$oldyear.'000000
0?'&userid='.$userid:'').'">'.$year.''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'],'MT'),1).''.round($val['total_diff']).''.price(price2num($val['avg'],'MT'),1).''.round($val['avg_diff']).''.$val['nb'].''.round($val['nb_diff']).''.price(price2num($val['total'],'MT'),1).''.round($val['total_diff']).''.price(price2num($val['avg'],'MT'),1).''.round($val['avg_diff']).'
'.$langs->trans("Total")."'.price($totsorties[$annee]).''.price($totentrees[$annee]).''.price($totsorties[$annee]).''.price($totentrees[$annee]).'
'; @@ -896,32 +896,32 @@ if ($resql) } if (! empty($arrayfields['ba.ref']['checked'])) { - print ''; + print ''; $form->select_comptes($search_account,'search_account',0,'',1, ($id > 0 || ! empty($ref)?' disabled="disabled"':'')); print ''; + print ''; print ''; print ''; + print ''; print ''; print ''; + print ''; $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); print $form->textwithpicto('', $htmltext, 1); print ''; + print ''; $htmltext=$langs->trans("BalanceVisibilityDependsOnSortAndFilters", $langs->transnoentitiesnoconv("DateValue")); print $form->textwithpicto('', $htmltext, 1); print ''; + print ''; print price(price2num($balance, 'MT'), 1, $langs); print ''; + print ''; print price(price2num($balance, 'MT'), 1, $langs); print ''; + print ''; print "rowid.'&save_lastsearch_values=1">'.img_object($langs->trans("ShowPayment").': '.$objp->rowid, 'account', 'class="classfortooltip"').' '.$objp->rowid."   "; print ''; + print ''; print $bankaccount->getNomUrl(1); print "'; + print ''; if ($objp->amount > 0) { print price($objp->amount); @@ -1387,11 +1387,11 @@ if ($resql) { if ($balancebefore >= 0) { - print ' '.price($balancebefore).' '.price($balancebefore).' '.price($balancebefore).' '.price($balancebefore).' '.price($balance).' '.price($balance).''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).''; diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 1d20c4a0d00..96d029407e2 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -49,9 +49,9 @@ print load_fiche_titre($langs->trans("BankTransactionByCategories"), '', 'title_ print ''; print ""; print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print "\n"; $sql = "SELECT sum(d.amount) as somme, count(*) as nombre, c.label, c.rowid "; @@ -76,9 +76,9 @@ if ($result) print ''; print ""; - print ''; - print '"; - print '"; + print ''; + print '"; + print '"; print ""; $i++; $total += abs($objp->somme); @@ -87,8 +87,8 @@ if ($result) $db->free($result); print ''; - print ''; - print ''; + print ''; + print ''; } else { diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 4e33a8c0aae..d20802dabbd 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -3,7 +3,7 @@ * Copyright (C) 2003 Jean-Louis Bergamo * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2014-2017 Alexandre Spangaro + * Copyright (C) 2014-2017 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Frédéric France @@ -364,7 +364,7 @@ if ($action == 'create') { $selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$object->country_code; } - else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; + elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; @@ -610,7 +610,7 @@ else print ''; @@ -846,7 +846,7 @@ else $object->country_id=$object->country_id?$object->country_id:$mysoc->country_id; $selectedcode=$object->country_code; if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"]; - else if (empty($selectedcode)) $selectedcode=$mysoc->country_code; + elseif (empty($selectedcode)) $selectedcode=$mysoc->country_code; $object->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules print ''; @@ -872,7 +872,7 @@ else print ''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 80a0c6f819b..7c72ad8c362 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2013 Florian Henry * Copyright (C) 2015-2016 Marcos García - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2016 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -352,7 +352,7 @@ class Account extends CommonObject * @param string $type To search using type * @return array|int Array of links array('url'=>, 'url_id'=>, 'label'=>, 'type'=> 'fk_bank'=> ) or -1 on error */ - function get_url($fk_bank='', $url_id='', $type='') + function get_url($fk_bank = '', $url_id = '', $type = '') { // phpcs:enable $lines = array(); @@ -417,7 +417,7 @@ class Account extends CommonObject * @param int $datev Date value * @return int Rowid of added entry, <0 if KO */ - function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur='',$banque='', $accountancycode='', $datev=null) + function addline($date, $oper, $label, $amount, $num_chq, $categorie, User $user, $emetteur = '', $banque = '', $accountancycode = '', $datev = null) { // Deprecation warning if (is_numeric($oper)) { @@ -525,7 +525,7 @@ class Account extends CommonObject * @param int $notrigger 1=Disable triggers * @return int < 0 if KO, > 0 if OK */ - function create(User $user, $notrigger=0) + function create(User $user, $notrigger = 0) { global $langs,$conf, $hookmanager; @@ -860,7 +860,7 @@ class Account extends CommonObject * @param string $ref Ref of bank account to get * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $ref = '') { global $conf; @@ -1076,7 +1076,7 @@ class Account extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->clos,$mode); } @@ -1163,7 +1163,7 @@ class Account extends CommonObject * @param int $option 1=Exclude future operation date (this is to exclude input made in advance and have real account sold) * @return int Current sold (value date <= today) */ - function solde($option=0) + function solde($option = 0) { $solde=0; @@ -1329,7 +1329,7 @@ class Account extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $mode='', $option='', $save_lastsearch_value=-1, $notooltip=0) + function getNomUrl($withpicto = 0, $mode = '', $option = '', $save_lastsearch_value = -1, $notooltip = 0) { global $conf, $langs, $user; @@ -1358,7 +1358,7 @@ class Account extends CommonObject { $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id; } - else if ($mode == 'receipts') + elseif ($mode == 'receipts') { $url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id; } @@ -1549,7 +1549,7 @@ class Account extends CommonObject * @return array * @see useDetailedBBAN */ - public function getFieldsToShow($includeibanbic=0) + public function getFieldsToShow($includeibanbic = 0) { //Get the required properties depending on the country $detailedBBAN = $this->useDetailedBBAN(); @@ -1765,7 +1765,7 @@ class AccountLine extends CommonObject * @param string $num External num to load (ex: num of transaction for paypal fee) * @return int <0 if KO, 0 if OK but not found, >0 if OK and found */ - function fetch($rowid,$ref='',$num='') + function fetch($rowid, $ref = '', $num = '') { global $conf; @@ -1783,7 +1783,7 @@ class AccountLine extends CommonObject $sql.= " WHERE b.fk_account = ba.rowid"; $sql.= " AND ba.entity IN (".getEntity('bank_account').")"; if ($num) $sql.= " AND b.num_chq='".$this->db->escape($num)."'"; - else if ($ref) $sql.= " AND b.rowid='".$this->db->escape($ref)."'"; + elseif ($ref) $sql.= " AND b.rowid='".$this->db->escape($ref)."'"; else $sql.= " AND b.rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); @@ -2011,7 +2011,7 @@ class AccountLine extends CommonObject * @param int $conciliated 1=Set transaction to conciliated, 0=Keep transaction non conciliated * @return int <0 if KO, >0 if OK */ - function update_conciliation(User $user, $cat, $conciliated=1) + function update_conciliation(User $user, $cat, $conciliated = 1) { // phpcs:enable global $conf,$langs; @@ -2075,7 +2075,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - function datev_change($rowid,$sign=1) + function datev_change($rowid, $sign = 1) { // phpcs:enable $sql = "SELECT datev FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2142,7 +2142,7 @@ class AccountLine extends CommonObject * @param int $sign 1 or -1 * @return int >0 if OK, 0 if KO */ - function dateo_change($rowid,$sign=1) + function dateo_change($rowid, $sign = 1) { // phpcs:enable $sql = "SELECT dateo FROM ".MAIN_DB_PREFIX."bank WHERE rowid = ".$rowid; @@ -2257,7 +2257,7 @@ class AccountLine extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlen=0,$option='',$notooltip=0) + function getNomUrl($withpicto = 0, $maxlen = 0, $option = '', $notooltip = 0) { global $langs; @@ -2298,7 +2298,7 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -2311,7 +2311,7 @@ class AccountLine extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index ffe01f41e7a..feaaccaa50f 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -325,7 +325,7 @@ class BankAccounts extends DolibarrApi * * @url POST {id}/lines */ - function addLine($id, $date, $type, $label, $amount, $category=0, $cheque_number='', $cheque_writer='', $cheque_bank='') + function addLine($id, $date, $type, $label, $amount, $category = 0, $cheque_number = '', $cheque_writer = '', $cheque_bank = '') { if (! DolibarrApiAccess::$user->rights->banque->modifier) { throw new RestException(401); diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 47edacb2410..e126937e95c 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -111,7 +111,7 @@ class PaymentVarious extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; @@ -181,7 +181,7 @@ class PaymentVarious extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=null) + function fetch($id, $user = null) { global $langs; $sql = "SELECT"; @@ -505,7 +505,7 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -518,7 +518,7 @@ class PaymentVarious extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -567,7 +567,7 @@ class PaymentVarious extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0) + function getNomUrl($withpicto = 0, $option = '', $save_lastsearch_value = -1, $notooltip = 0) { global $db, $conf, $langs, $hookmanager; global $langs; diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 958ff129a06..a94460b9f0d 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -804,7 +804,7 @@ dol_fiche_end(); print '
'.$langs->trans("Rubrique").''.$langs->trans("Nb").''.$langs->trans("Total").''.$langs->trans("Average").''.$langs->trans("Nb").''.$langs->trans("Total").''.$langs->trans("Average").'
rowid\">$objp->label'.$objp->nombre.''.price(abs($objp->somme))."'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."'.$objp->nombre.''.price(abs($objp->somme))."'.price(abs(price2num($objp->somme / $objp->nombre,'MT')))."
'.$langs->trans("Total").''.price($total).''.price($totalnb?price2num($total / $totalnb, 'MT'):0).'
'.price($total).''.price($totalnb?price2num($total / $totalnb, 'MT'):0).'
'.$langs->trans("BankAccountCountry").''; $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; - else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; + elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else print ($object->rappro==1 ? $langs->trans("Yes") : ($langs->trans("No").' ('.$langs->trans("ConciliationDisabled").')')); print '
'.$langs->trans("Country").''; $conciliate=$object->canBeConciliated(); if ($conciliate == -2) print $langs->trans("No").' ('.$langs->trans("CashAccount").')'; - else if ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; + elseif ($conciliate == -3) print $langs->trans("No").' ('.$langs->trans("Closed").')'; else print ' 0)?'':' checked="checked"').'"> '.$langs->trans("DisableConciliation"); print '
'; // Navigation links -print ''; + print ''; print ''; + print ''; print ''; else print ''; } - elseif ($totalarray['totalbalancefield'] == $i) print ''; + elseif ($totalarray['totalbalancefield'] == $i) print ''; else print ''; } print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index d355fcc4900..3d125248bb7 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -435,8 +435,8 @@ if (empty($numref)) print '
'.$morehtml.'     '; +print '
'.$morehtml.'     '; if ($mode == 'showalltime') { print ''; @@ -830,7 +830,7 @@ if ($mode == 'standard') // For month $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"').""; - print '
'.$link.'
'.$link.'
'; $file = "movement".$account."-".$year.$month.".png"; @@ -844,7 +844,7 @@ if ($mode == 'standard') // For year $prevyear=$year-1;$nextyear=$year+1; $link="".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"').""; - print '
'.$link.'
'.$link.'
'; print $show5; diff --git a/htdocs/compta/bank/ligne.php b/htdocs/compta/bank/ligne.php index d98db0ea998..f73073f2fe1 100644 --- a/htdocs/compta/bank/ligne.php +++ b/htdocs/compta/bank/ligne.php @@ -4,7 +4,7 @@ * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2004 Christophe Combelles * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2016 Marcos García * Copyright (C) 2018 Frédéric France @@ -351,7 +351,7 @@ if ($result) print '';*/ print $paymenttmp->getNomUrl(1); } - else if ($links[$key]['type']=='payment_supplier') { + elseif ($links[$key]['type']=='payment_supplier') { require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php'; $paymenttmp=new PaiementFourn($db); $paymenttmp->fetch($links[$key]['url_id']); @@ -362,72 +362,72 @@ if ($result) print '';*/ print $paymenttmp->getNomUrl(1); } - else if ($links[$key]['type']=='company') { + elseif ($links[$key]['type']=='company') { $societe=new Societe($db); $societe->fetch($links[$key]['url_id']); print $societe->getNomUrl(1); } - else if ($links[$key]['type']=='sc') { + elseif ($links[$key]['type']=='sc') { print ''; print img_object($langs->trans('ShowSocialContribution'),'bill').' '; print $langs->trans("SocialContribution").($links[$key]['label']?' - '.$links[$key]['label']:''); print ''; } - else if ($links[$key]['type']=='payment_sc') { + elseif ($links[$key]['type']=='payment_sc') { print ''; print img_object($langs->trans('ShowPayment'),'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; } - else if ($links[$key]['type']=='payment_vat') { + elseif ($links[$key]['type']=='payment_vat') { print ''; print img_object($langs->trans('ShowVAT'),'payment').' '; print $langs->trans("VATPayment"); print ''; } - else if ($links[$key]['type']=='payment_salary') { + elseif ($links[$key]['type']=='payment_salary') { print ''; print img_object($langs->trans('ShowPaymentSalary'),'payment').' '; print $langs->trans("SalaryPayment"); print ''; } - else if ($links[$key]['type']=='payment_loan') { + elseif ($links[$key]['type']=='payment_loan') { print ''; print img_object($langs->trans('ShowLoanPayment'),'payment').' '; print $langs->trans("PaymentLoan"); print ''; } - else if ($links[$key]['type']=='loan') { + elseif ($links[$key]['type']=='loan') { print ''; print img_object($langs->trans('ShowLoan'),'bill').' '; print $langs->trans("Loan"); print ''; } - else if ($links[$key]['type']=='member') { + elseif ($links[$key]['type']=='member') { print ''; print img_object($langs->trans('ShowMember'),'user').' '; print $links[$key]['label']; print ''; } - else if ($links[$key]['type']=='payment_donation') { + elseif ($links[$key]['type']=='payment_donation') { print ''; print img_object($langs->trans('ShowDonation'),'payment').' '; print $langs->trans("DonationPayment"); print ''; } - else if ($links[$key]['type']=='banktransfert') { + elseif ($links[$key]['type']=='banktransfert') { print ''; print img_object($langs->trans('ShowTransaction'),'payment').' '; print $langs->trans("TransactionOnTheOtherAccount"); print ''; } - else if ($links[$key]['type']=='user') { + elseif ($links[$key]['type']=='user') { print ''; print img_object($langs->trans('ShowUser'),'user').' '; print $langs->trans("User"); print ''; } - else if ($links[$key]['type']=='payment_various') { + elseif ($links[$key]['type']=='payment_various') { print ''; print img_object($langs->trans('ShowVariousPayment'),'payment').' '; print $langs->trans("VariousPayment"); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index cc93cfd61a1..4cb50e72431 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -591,7 +591,7 @@ if (isset($totalarray['totalbalancefield']) && $lastcurrencycode != 'various') / if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).''.price($totalarray['totalbalance'], 0, $langs, 0, 0, -1, $lastcurrencycode).'
'; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; @@ -480,7 +480,7 @@ if (empty($numref)) $balancestart[$objp->numr] = $obj->amount; $db->free($resql); } - print ''; + print ''; // Calculate end amount $sql = "SELECT sum(b.amount) as amount"; @@ -494,7 +494,7 @@ if (empty($numref)) $content[$objp->numr] = $obj->amount; $db->free($resql); } - print ''; + print ''; print ''; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; print "\n"; diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index bc9aa4e2c4c..7ad92a012b1 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -116,21 +116,21 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print ''; if($conf->global->MULTICOMPANY_INVOICE_SHARING_ENABLED )print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; // Current balance print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; @@ -293,9 +293,9 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) }else print ""; } print ""; - if ($obj->total_ttc < 0) { print ""; }; - if ($obj->total_ttc >= 0) { print ""; }; - print ''; + if ($obj->total_ttc < 0) { print ""; }; + if ($obj->total_ttc >= 0) { print ""; }; + print ''; print ""; } @@ -317,8 +317,8 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // solde print ''; - print ''; - print ''; + print ''; + print ''; print ''; print "
'.$langs->trans("Ref").''.$langs->trans("InitialBankBalance").''.$langs->trans("EndBankBalance").''.$langs->trans("InitialBankBalance").''.$langs->trans("EndBankBalance").'
'.price($balancestart[$objp->numr],'',$langs,1,-1,-1,$conf->currency).''.price($balancestart[$objp->numr],'',$langs,1,-1,-1,$conf->currency).''.price(($balancestart[$objp->numr]+$content[$objp->numr]),'',$langs,1,-1,-1,$conf->currency).''.price(($balancestart[$objp->numr]+$content[$objp->numr]),'',$langs,1,-1,-1,$conf->currency).''; if ($user->rights->banque->consolidate && $action != 'editbankreceipt') { @@ -546,9 +546,9 @@ else print ''.$langs->trans("DateValueShort").''.$langs->trans("Type").''.$langs->trans("Description").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").' 
'.$langs->trans("Description").''.$langs->trans("Entity").''.$langs->trans("ThirdParty").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("BankBalance").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("BankBalance").'
'.$langs->trans("CurrentBalance").''.price($solde).''.$langs->trans("CurrentBalance").''.price($solde).'
'.$langs->trans("RemainderToPay").' '.$langs->trans("RemainderToPay").' 
".$refcomp."".price(abs($total_ttc))."  ".price($total_ttc)."'.price($solde).'".price(abs($total_ttc))."  ".price($total_ttc)."'.price($solde).'
'.$langs->trans("FutureBalance").' ('.$object->currency_code.')'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).''.$langs->trans("FutureBalance").' ('.$object->currency_code.')'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'
"; diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index d2adc857ec7..d9fa5c3c9a1 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index c255ef19c16..6b864c09f81 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index d9f8709b155..34be85c6975 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 91608666601..c6e5d95e3db 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2017 Laurent Destailleur * Copyright (C) 2018 Frédéric France * diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index e6358fcb5eb..5902d9ff8a7 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -516,7 +516,7 @@ if (isset($totalarray['pos'])) while ($i < $totalarray['nbfield']) { $i++; - if (! empty($totalarray['pos'][$i])) print '
'.price($totalarray['val'][$totalarray['pos'][$i]]).''.price($totalarray['val'][$totalarray['pos'][$i]]).'
'.$langs->trans("InitialBankBalance").' - '.$langs->trans("Cash").''.price($cashcontrol->opening).''.price($cashcontrol->opening).'
'; + print ''; $invoicetmp->fetch($objp->facid); print $invoicetmp->getNomUrl(1); print ''; + print ''; print ''.dol_print_date($db->jdate($objp->do),"day").""; print "'; + print ''; print $bankaccount->getNomUrl(1); if ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH==$bankaccount->id) $cash+=$objp->amount; elseif ($conf->global->CASHDESK_ID_BANKACCOUNT_CB==$bankaccount->id) $bank+=$objp->amount; @@ -204,7 +204,7 @@ if ($resql) if (! $i) $totalarray['nbfield']++; // Debit - print ''; + print ''; if ($objp->amount < 0) { print price($objp->amount * -1); @@ -215,7 +215,7 @@ if ($resql) if (! $i) $totalarray['totaldebfield']=$totalarray['nbfield']; // Credit - print ''; + print ''; if ($objp->amount > 0) { print price($objp->amount); @@ -243,8 +243,8 @@ if ($resql) if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).'
'.$obj->lib.''.price($obj->total).''.price($obj->total).''; + print ''; if ($obj->totalpaye) print price($obj->totalpaye); print '
".$obj->label."'.price($obj->amount)."'.price($obj->amount)."'.price($obj->amount)."'.price($obj->amount)."
'.$langs->trans("Total").''.price($total).''.price($total).'    '.price($total)."'.price($total)."
"; @@ -413,7 +413,7 @@ while($j<$numlt) print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"pv.label","",$param,'',$sortfield,$sortorder); print_liste_field_titre("RefPayment",$_SERVER["PHP_SELF"],"pv.rowid","",$param,'',$sortfield,$sortorder); print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"pv.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"pv.amount","",$param,'class="right"',$sortfield,$sortorder); print "\n"; while ($i < $num) @@ -433,13 +433,13 @@ while($j<$numlt) print ''.$tva_static->getNomUrl(1)."\n"; print ''.dol_print_date($db->jdate($obj->dp),'day')."\n"; - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; print "\n"; $i++; } - print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.$langs->trans("Total").''; + print ''.price($total).""; print ""; print ""; @@ -496,7 +496,7 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"s.datep","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre("Type",$_SERVER["PHP_SELF"],"pct.code","",$param,'',$sortfield,$sortorder); if (! empty($conf->banque->enabled)) print_liste_field_titre("Account",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("PayedByThisPayment",$_SERVER["PHP_SELF"],"s.amount","",$param,'class="right"',$sortfield,$sortorder); print "\n"; while ($i < $num) @@ -545,13 +545,13 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) } // Paid - print ''.price($obj->amount).""; + print ''.price($obj->amount).""; print "\n"; $i++; } print ''.$langs->trans("Total").''; - print ''.price($total).""; + print ''.price($total).""; print ""; print ""; diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php index 83e475f2855..5cce413a9ae 100644 --- a/htdocs/compta/compta-files.php +++ b/htdocs/compta/compta-files.php @@ -231,7 +231,7 @@ if ($result && $action == "dl") if (file_exists($file["fullname"])) $zip->addFile($file["fullname"], $file["relpathnamelang"]); // $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; } - $zip->addFromString('log.csv', $log); + $zip->addFromString('transactions.csv', $log); $zip->close(); ///Then download the zipped file. diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 922df54c147..94f66f2552e 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -78,7 +78,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) } } -else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer) +elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { $object->fetch($id); if ($object->statut == 1) @@ -96,7 +96,7 @@ else if ($action == 'classifyrefunded' && $user->rights->deplacement->creer) } } -else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) +elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->deplacement->supprimer) { $result=$object->delete($id); if ($result >= 0) @@ -110,7 +110,7 @@ else if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depl } } -else if ($action == 'add' && $user->rights->deplacement->creer) +elseif ($action == 'add' && $user->rights->deplacement->creer) { if (! GETPOST('cancel','alpha')) { @@ -169,7 +169,7 @@ else if ($action == 'add' && $user->rights->deplacement->creer) } // Update record -else if ($action == 'update' && $user->rights->deplacement->creer) +elseif ($action == 'update' && $user->rights->deplacement->creer) { if (! GETPOST('cancel','alpha')) { @@ -203,7 +203,7 @@ else if ($action == 'update' && $user->rights->deplacement->creer) } // Set into a project -else if ($action == 'classin' && $user->rights->deplacement->creer) +elseif ($action == 'classin' && $user->rights->deplacement->creer) { $object->fetch($id); $result=$object->setProject(GETPOST('projectid','int')); @@ -211,14 +211,14 @@ else if ($action == 'classin' && $user->rights->deplacement->creer) } // Set fields -else if ($action == 'setdated' && $user->rights->deplacement->creer) +elseif ($action == 'setdated' && $user->rights->deplacement->creer) { $dated=dol_mktime(GETPOST('datedhour','int'), GETPOST('datedmin','int'), GETPOST('datedsec','int'), GETPOST('datedmonth','int'), GETPOST('datedday','int'), GETPOST('datedyear','int')); $object->fetch($id); $result=$object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); } -else if ($action == 'setkm' && $user->rights->deplacement->creer) +elseif ($action == 'setkm' && $user->rights->deplacement->creer) { $object->fetch($id); $result=$object->setValueFrom('km', GETPOST('km','int'), '', null, 'text', '', $user, 'DEPLACEMENT_MODIFY'); @@ -314,7 +314,7 @@ if ($action == 'create') print ''; } -else if ($id) +elseif ($id) { $result = $object->fetch($id); if ($result > 0) diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 2c21c2694ae..60108eed794 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -245,7 +245,7 @@ class Deplacement extends CommonObject * @param string $ref Ref of record * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $ref = '') { $sql = "SELECT rowid, fk_user, type, fk_statut, km, fk_soc, dated, note_private, note_public, fk_projet, extraparams"; $sql.= " FROM ".MAIN_DB_PREFIX."deplacement"; @@ -316,7 +316,7 @@ class Deplacement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -329,7 +329,7 @@ class Deplacement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Libelle */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -374,7 +374,7 @@ class Deplacement extends CommonObject * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @return string Chaine avec URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto = 0) { global $langs; @@ -400,7 +400,7 @@ class Deplacement extends CommonObject * @param int $active Active or not * @return array */ - function listOfTypes($active=1) + function listOfTypes($active = 1) { global $langs; diff --git a/htdocs/compta/deplacement/class/deplacementstats.class.php b/htdocs/compta/deplacement/class/deplacementstats.class.php index ae93eb094d9..af704c1ad56 100644 --- a/htdocs/compta/deplacement/class/deplacementstats.class.php +++ b/htdocs/compta/deplacement/class/deplacementstats.class.php @@ -50,7 +50,7 @@ class DeplacementStats extends Stats * @param mixed $userid Id user for filter or array of user ids * @return void */ - function __construct($db, $socid=0, $userid=0) + function __construct($db, $socid = 0, $userid = 0) { global $conf; @@ -69,7 +69,7 @@ class DeplacementStats extends Stats $this->where.=" AND fk_soc = ".$this->socid; } if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',',$this->userid).')'; - else if ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; + elseif ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; } @@ -96,7 +96,7 @@ class DeplacementStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { $sql = "SELECT MONTH(dated) as dm, count(*)"; $sql.= " FROM ".$this->from; @@ -118,7 +118,7 @@ class DeplacementStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getAmountByMonth($year, $format=0) + function getAmountByMonth($year, $format = 0) { $sql = "SELECT date_format(dated,'%m') as dm, sum(".$this->field.")"; $sql.= " FROM ".$this->from; @@ -166,4 +166,3 @@ class DeplacementStats extends Stats return $this->_getAllByYear($sql); } } - diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index ef28a7909f9..26721ace101 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -127,7 +127,7 @@ if ($conf->use_javascript_ajax) print ''; print ''.$langs->trans("Total").''; -print ''.$totalnb.''; +print ''.$totalnb.''; print ''; print ''; @@ -163,8 +163,8 @@ if ($result) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; if ($num) @@ -184,8 +184,8 @@ if ($result) print ''; print ''; print ''; - print ''; - print ''; + print ''; + print ''; print ''; print ''; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index d6d599d7ece..ff3c256e33e 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -184,10 +184,10 @@ if ($resql) if ($obj->socid) print ''; else print ''; - print ''; + print ''; $tripandexpense_static->statut=$obj->fk_statut; - print ''; + print ''; print "\n"; $i++; diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 207e19fc265..e24dfdaac5f 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -274,16 +274,16 @@ foreach ($data as $val) $oldyear--; print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; } print ''; print ''; - print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; $oldyear=$year; } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c3bcbf1d45b..5f7b1abd0d6 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -178,7 +178,7 @@ if (empty($reshook)) } // Change status of invoice - else if ($action == 'reopen' && $usercancreate) { + elseif ($action == 'reopen' && $usercancreate) { $result = $object->fetch($id); if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted $result = $object->set_unpaid($user); @@ -192,7 +192,7 @@ if (empty($reshook)) } // Delete invoice - else if ($action == 'confirm_delete' && $confirm == 'yes') { + elseif ($action == 'confirm_delete' && $confirm == 'yes') { $result = $object->fetch($id); $object->fetch_thirdparty(); @@ -222,7 +222,7 @@ if (empty($reshook)) } // Delete line - else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { $object->fetch($id); $object->fetch_thirdparty(); @@ -256,7 +256,7 @@ if (empty($reshook)) } // Delete link of credit note to invoice - else if ($action == 'unlinkdiscount' && $usercancreate) + elseif ($action == 'unlinkdiscount' && $usercancreate) { $discount = new DiscountAbsolute($db); $result = $discount->fetch(GETPOST("discountid")); @@ -264,7 +264,7 @@ if (empty($reshook)) } // Validation - else if ($action == 'valid' && $usercancreate) + elseif ($action == 'valid' && $usercancreate) { $object->fetch($id); @@ -284,7 +284,7 @@ if (empty($reshook)) } } - else if ($action == 'set_thirdparty' && $usercancreate) + elseif ($action == 'set_thirdparty' && $usercancreate) { $object->fetch($id); $object->setValueFrom('fk_soc', $socid, '', null, 'int', '', $user, 'BILL_MODIFY'); @@ -293,13 +293,13 @@ if (empty($reshook)) exit(); } - else if ($action == 'classin' && $usercancreate) + elseif ($action == 'classin' && $usercancreate) { $object->fetch($id); $object->setProject($_POST['projectid']); } - else if ($action == 'setmode' && $usercancreate) + elseif ($action == 'setmode' && $usercancreate) { $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); @@ -308,16 +308,16 @@ if (empty($reshook)) } // Multicurrency Code - else if ($action == 'setmulticurrencycode' && $usercancreate) { + elseif ($action == 'setmulticurrencycode' && $usercancreate) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } // Multicurrency rate - else if ($action == 'setmulticurrencyrate' && $usercancreate) { + elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } - else if ($action == 'setinvoicedate' && $usercancreate) + elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; @@ -336,7 +336,7 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } - else if ($action == 'setdate_pointoftax' && $usercancreate) + elseif ($action == 'setdate_pointoftax' && $usercancreate) { $object->fetch($id); $date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']); @@ -345,7 +345,7 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } - else if ($action == 'setconditions' && $usercancreate) + elseif ($action == 'setconditions' && $usercancreate) { $object->fetch($id); $object->cond_reglement_code = 0; // To clean property @@ -361,7 +361,7 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } - else if ($action == 'setpaymentterm' && $usercancreate) + elseif ($action == 'setpaymentterm' && $usercancreate) { $object->fetch($id); $object->date_lim_reglement = dol_mktime(12, 0, 0, $_POST['paymenttermmonth'], $_POST['paymenttermday'], $_POST['paymenttermyear']); @@ -374,7 +374,7 @@ if (empty($reshook)) dol_print_error($db, $object->error); } - else if ($action == 'setrevenuestamp' && $usercancreate) + elseif ($action == 'setrevenuestamp' && $usercancreate) { $object->fetch($id); $object->revenuestamp = GETPOST('revenuestamp'); @@ -391,18 +391,18 @@ if (empty($reshook)) } // bank account - else if ($action == 'setbankaccount' && $usercancreate) + elseif ($action == 'setbankaccount' && $usercancreate) { $result=$object->setBankAccount(GETPOST('fk_account', 'int')); } - else if ($action == 'setremisepercent' && $usercancreate) + elseif ($action == 'setremisepercent' && $usercancreate) { $object->fetch($id); $result = $object->set_remise($user, $_POST['remise_percent']); } - else if ($action == "setabsolutediscount" && $usercancreate) + elseif ($action == "setabsolutediscount" && $usercancreate) { // POST[remise_id] or POST[remise_id_for_payment] @@ -460,14 +460,14 @@ if (empty($reshook)) } } - else if ($action == 'setref_client' && $usercancreate) + elseif ($action == 'setref_client' && $usercancreate) { $object->fetch($id); $object->set_ref_client(GETPOST('ref_client')); } // Classify to validated - else if ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) + elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse','int'); @@ -567,7 +567,7 @@ if (empty($reshook)) } // Go back to draft status (unvalidate) - else if ($action == 'confirm_modif' && $usercanunvalidate) + elseif ($action == 'confirm_modif' && $usercanunvalidate) { $idwarehouse = GETPOST('idwarehouse','int'); @@ -647,13 +647,13 @@ if (empty($reshook)) } // Classify "paid" - else if ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment) + elseif ($action == 'confirm_paid' && $confirm == 'yes' && $usercanissuepayment) { $object->fetch($id); $result = $object->set_paid($user); if ($result<0) setEventMessages($object->error, $object->errors, 'errors'); } // Classif "paid partialy" - else if ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment) + elseif ($action == 'confirm_paid_partially' && $confirm == 'yes' && $usercanissuepayment) { $object->fetch($id); $close_code = GETPOST("close_code",'none'); @@ -665,7 +665,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Reason")), null, 'errors'); } } // Classify "abandoned" - else if ($action == 'confirm_canceled' && $confirm == 'yes') { + elseif ($action == 'confirm_canceled' && $confirm == 'yes') { $object->fetch($id); $close_code = GETPOST("close_code",'none'); $close_note = GETPOST("close_note",'none'); @@ -678,7 +678,7 @@ if (empty($reshook)) } // Convertir en reduc - else if ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $usercancreate) + elseif ($action == 'confirm_converttoreduc' && $confirm == 'yes' && $usercancreate) { $object->fetch($id); $object->fetch_thirdparty(); @@ -733,20 +733,31 @@ if (empty($reshook)) { // If we're on a standard invoice, we have to get excess received to create a discount in TTC without VAT + // Total payments $sql = 'SELECT SUM(pf.amount) as total_paiements'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'paiement as p'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id'; $sql.= ' WHERE pf.fk_facture = '.$object->id; $sql.= ' AND pf.fk_paiement = p.rowid'; - $sql.= ' AND p.entity IN (' . getEntity('invoice').')'; - + $sql.= ' AND p.entity IN ('.getEntity('invoice').')'; $resql = $db->query($sql); if (! $resql) dol_print_error($db); $res = $db->fetch_object($resql); $total_paiements = $res->total_paiements; - $discount->amount_ht = $discount->amount_ttc = $total_paiements - $object->total_ttc; + // Total credit note and deposit + $total_creditnote_and_deposit = 0; + $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,"; + $sql .= " re.description, re.fk_facture_source"; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re"; + $sql .= " WHERE fk_facture = " . $object->id; + $resql = $db->query($sql); + if (!empty($resql)) { + while ($obj = $db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc; + } else dol_print_error($db); + + $discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc; $discount->amount_tva = 0; $discount->tva_tx = 0; @@ -824,7 +835,7 @@ if (empty($reshook)) /* * Insert new invoice in database */ - else if ($action == 'add' && $usercancreate) + elseif ($action == 'add' && $usercancreate) { if ($socid > 0) $object->socid = GETPOST('socid', 'int'); @@ -1648,7 +1659,7 @@ if (empty($reshook)) } // Add a new line - else if ($action == 'addline' && $usercancreate) + elseif ($action == 'addline' && $usercancreate) { $langs->load('errors'); $error = 0; @@ -1775,104 +1786,17 @@ if (empty($reshook)) $label = ((GETPOST('product_label') && GETPOST('product_label') != $prod->label) ? GETPOST('product_label') : ''); - // Update if prices fields are defined - $tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id); - $tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id); - if (empty($tva_tx)) $tva_npr=0; + // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. + $pqp = (GETPOST('pbq','int') ? GETPOST('pbq','int') : 0); - $pu_ht = $prod->price; - $pu_ttc = $prod->price_ttc; - $price_min = $prod->price_min; - $price_base_type = $prod->price_base_type; + $datapriceofproduct = $prod->getSellPrice($mysoc, $object->thirdparty, $pqp); - // If price per segment - if (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($object->thirdparty->price_level)) - { - $pu_ht = $prod->multiprices[$object->thirdparty->price_level]; - $pu_ttc = $prod->multiprices_ttc[$object->thirdparty->price_level]; - $price_min = $prod->multiprices_min[$object->thirdparty->price_level]; - $price_base_type = $prod->multiprices_base_type[$object->thirdparty->price_level]; - if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility - { - if (isset($prod->multiprices_tva_tx[$object->thirdparty->price_level])) $tva_tx=$prod->multiprices_tva_tx[$object->thirdparty->price_level]; - if (isset($prod->multiprices_recuperableonly[$object->thirdparty->price_level])) $tva_npr=$prod->multiprices_recuperableonly[$object->thirdparty->price_level]; - if (empty($tva_tx)) $tva_npr=0; - } - } - // If price per customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES)) - { - require_once DOL_DOCUMENT_ROOT . '/product/class/productcustomerprice.class.php'; - - $prodcustprice = new Productcustomerprice($db); - - $filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id); - - $result = $prodcustprice->fetch_all('', '', 0, 0, $filter); - if ($result) { - if (count($prodcustprice->lines) > 0) { - $pu_ht = price($prodcustprice->lines[0]->price); - $pu_ttc = price($prodcustprice->lines[0]->price_ttc); - $price_base_type = $prodcustprice->lines[0]->price_base_type; - $tva_tx = $prodcustprice->lines[0]->tva_tx; - if ($prodcustprice->lines[0]->default_vat_code && ! preg_match('/\(.*\)/', $tva_tx)) $tva_tx.= ' ('.$prodcustprice->lines[0]->default_vat_code.')'; - $tva_npr = $prodcustprice->lines[0]->recuperableonly; - if (empty($tva_tx)) $tva_npr=0; - } - } - } - // If price per quantity - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) - { - if ($prod->prices_by_qty[0]) // yes, this product has some prices per quantity - { - // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. - $pqp = GETPOST('pbq','int'); - - // Search price into product_price_by_qty from $prod->id - foreach($prod->prices_by_qty_list[0] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. - break; - } - } - } - // If price per quantity and customer - elseif (! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) - { - if ($prod->prices_by_qty[$object->thirdparty->price_level]) // yes, this product has some prices per quantity - { - // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. - $pqp = GETPOST('pbq','int'); - - // Search price into product_price_by_qty from $prod->id - foreach($prod->prices_by_qty_list[$object->thirdparty->price_level] as $priceforthequantityarray) - { - if ($priceforthequantityarray['rowid'] != $pqp) continue; - // We found the price - if ($priceforthequantityarray['price_base_type'] == 'HT') - { - $pu_ht = $priceforthequantityarray['unitprice']; - } - else - { - $pu_ttc = $priceforthequantityarray['unitprice']; - } - // Note: the remise_percent or price by qty is used to set data on form, so we will use value from POST. - break; - } - } - } + $pu_ht = $datapriceofproduct['pu_ht']; + $pu_ttc = $datapriceofproduct['pu_ttc']; + $price_min = $datapriceofproduct['price_min']; + $price_base_type = $datapriceofproduct['price_base_type']; + $tva_tx = $datapriceofproduct['tva_tx']; + $tva_npr = $datapriceofproduct['tva_npr']; $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $tva_tx)); $tmpprodvat = price2num(preg_replace('/\s*\(.*\)/', '', $prod->tva_tx)); @@ -2259,7 +2183,7 @@ if (empty($reshook)) } } - else if ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) + elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) { if (!$object->fetch($id) > 0) dol_print_error($db); if (!is_null(GETPOST('all_progress')) && GETPOST('all_progress') != "") @@ -2276,7 +2200,7 @@ if (empty($reshook)) } } - else if ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { + elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition exit(); } @@ -3370,7 +3294,7 @@ if ($action == 'create') print '
'; } -else if ($id > 0 || ! empty($ref)) +elseif ($id > 0 || ! empty($ref)) { /* * Show object in view mode @@ -4627,7 +4551,7 @@ else if ($id > 0 || ! empty($ref)) } else { print '
' . $langs->trans('Modify') . '
'; } - } else if (!$object->is_last_in_cycle()) { + } elseif (!$object->is_last_in_cycle()) { print '
' . $langs->trans('Modify') . '
'; } else { print '
' . $langs->trans('Modify') . '
'; @@ -4636,7 +4560,7 @@ else if ($id > 0 || ! empty($ref)) } else { - print '
' . $langs->trans('Modify') . '
'; + print '
' . $langs->trans('Modify') . '
'; } } @@ -4845,7 +4769,7 @@ else if ($id > 0 || ! empty($ref)) if ($usercancreate && ($object->type == 5) && ($object->statut == 1 || $object->statut == 2)) { if ($object->is_last_in_cycle() && $object->situation_final != 1) { print ''; - } else if (!$object->is_last_in_cycle()) { + } elseif (!$object->is_last_in_cycle()) { print ''; } else { print ''; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 04c2bedeb41..e145ed477aa 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -104,7 +104,7 @@ class Invoices extends DolibarrApi * * @throws RestException */ - function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids='', $status='', $sqlfilters = '') + function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $status = '', $sqlfilters = '') { global $db, $conf; @@ -600,7 +600,7 @@ class Invoices extends DolibarrApi * @throws 500 * */ - function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger=0) + function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -650,7 +650,7 @@ class Invoices extends DolibarrApi * @throws 500 * */ - function settodraft($id, $idwarehouse=-1) + function settodraft($id, $idwarehouse = -1) { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -702,7 +702,7 @@ class Invoices extends DolibarrApi * * @return array */ - function validate($id, $idwarehouse=0, $notrigger=0) + function validate($id, $idwarehouse = 0, $notrigger = 0) { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -753,7 +753,7 @@ class Invoices extends DolibarrApi * @throws 404 * @throws 500 */ - function settopaid($id, $close_code='', $close_note='') + function settopaid($id, $close_code = '', $close_note = '') { if(! DolibarrApiAccess::$user->rights->facture->creer) { throw new RestException(401); @@ -994,7 +994,7 @@ class Invoices extends DolibarrApi * @throws 401 * @throws 404 */ - function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') + function addPayment($id, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; @@ -1114,7 +1114,7 @@ class Invoices extends DolibarrApi * @throws 403 * @throws 404 */ - function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement='', $comment='', $chqemetteur='', $chqbank='') + function addPaymentDistributed($arrayofamounts, $datepaye, $paiementid, $closepaidinvoices, $accountid, $num_paiement = '', $comment = '', $chqemetteur = '', $chqbank = '') { global $conf; diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5090132632e..35a8a45bd20 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -321,7 +321,7 @@ class FactureRec extends CommonInvoice * @param int $ref_int Internal reference of other object * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='') + function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '') { $sql = 'SELECT f.rowid, f.entity, f.titre, f.suspended, f.fk_soc, f.amount, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc'; $sql.= ', f.remise_percent, f.remise_absolue, f.remise'; @@ -573,7 +573,7 @@ class FactureRec extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function delete(User $user, $notrigger=0, $idwarehouse=-1) + function delete(User $user, $notrigger = 0, $idwarehouse = -1) { $rowid=$this->id; @@ -644,7 +644,7 @@ class FactureRec extends CommonInvoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice * @return int <0 if KO, Id of line if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise=0, $date_start_fill=0, $date_end_fill=0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $date_start_fill = 0, $date_end_fill = 0) { global $mysoc; @@ -826,7 +826,7 @@ class FactureRec extends CommonInvoice * @param int $date_end_fill 1=Flag to fill end date when generating invoice * @return int <0 if KO, Id of line if OK */ - function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $price_base_type='HT', $info_bits=0, $fk_remise_except='', $pu_ttc=0, $type=0, $rang=-1, $special_code=0, $label='', $fk_unit=null, $pu_ht_devise = 0, $notrigger=0, $date_start_fill=0, $date_end_fill=0) + function updateline($rowid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $price_base_type = 'HT', $info_bits = 0, $fk_remise_except = '', $pu_ttc = 0, $type = 0, $rang = -1, $special_code = 0, $label = '', $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0, $date_start_fill = 0, $date_end_fill = 0) { global $mysoc; @@ -1002,7 +1002,7 @@ class FactureRec extends CommonInvoice * @param int $forcevalidation 1=Force validation of invoice whatever is template auto_validate flag. * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) */ - function createRecurringInvoices($restrictioninvoiceid=0, $forcevalidation=0) + function createRecurringInvoices($restrictioninvoiceid = 0, $forcevalidation = 0) { global $conf, $langs, $db, $user, $hookmanager; @@ -1159,7 +1159,7 @@ class FactureRec extends CommonInvoice * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip='',$save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = '', $save_lastsearch_value = -1) { global $langs; @@ -1210,7 +1210,7 @@ class FactureRec extends CommonInvoice * @param integer $alreadypaid Not used on recurring invoices * @return string Label of status */ - function getLibStatut($mode=0, $alreadypaid=-1) + function getLibStatut($mode = 0, $alreadypaid = -1) { return $this->LibStatut($this->frequency?1:0, $this->suspended, $mode, $alreadypaid, empty($this->type)?0:$this->type); @@ -1227,7 +1227,7 @@ class FactureRec extends CommonInvoice * @param int $type Type invoice * @return string Label of status */ - function LibStatut($recur, $status, $mode=0, $alreadypaid=-1, $type=0) + function LibStatut($recur, $status, $mode = 0, $alreadypaid = -1, $type = 0) { // phpcs:enable global $langs; @@ -1328,7 +1328,7 @@ class FactureRec extends CommonInvoice * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option='') + function initAsSpecimen($option = '') { global $user,$langs,$conf; @@ -1398,7 +1398,7 @@ class FactureRec extends CommonInvoice $line->total_ttc=-119.6; $line->total_tva=-19.6; } - else if ($xnbp == 2) // UP is negative (free line) + elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice=-100; $line->total_ht=-100; @@ -1406,7 +1406,7 @@ class FactureRec extends CommonInvoice $line->total_tva=-19.6; $line->remise_percent=0; } - else if ($xnbp == 3) // Discount is 50% (product line) + elseif ($xnbp == 3) // Discount is 50% (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; @@ -1480,7 +1480,7 @@ class FactureRec extends CommonInvoice * @param string $unit unit of frequency (d, m, y) * @return int <0 if KO, >0 if OK */ - function setFrequencyAndUnit($frequency,$unit) + function setFrequencyAndUnit($frequency, $unit) { if (! $this->table_element) { @@ -1523,7 +1523,7 @@ class FactureRec extends CommonInvoice * @param int $increment_nb_gen_done 0 do nothing more, >0 increment nb_gen_done * @return int <0 if KO, >0 if OK */ - function setNextDate($date, $increment_nb_gen_done=0) + function setNextDate($date, $increment_nb_gen_done = 0) { if (! $this->table_element) { @@ -1823,7 +1823,7 @@ class FactureLigneRec extends CommonInvoiceLine * @param int $notrigger No trigger * @return int <0 if KO, Id of line if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 3e4335774c9..9ed5e234882 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2013 Cedric Gross * Copyright (C) 2013 Florian Henry * Copyright (C) 2016 Ferran Marcet - * Copyright (C) 2018 Alexandre Spangaro + * Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2018 Nicolas ZABOURI * * This program is free software; you can redistribute it and/or modify @@ -289,7 +289,7 @@ class Facture extends CommonInvoice * @param int $forceduedate 1=Do not recalculate due date from payment condition but force it with value * @return int <0 if KO, >0 if OK */ - function create(User $user, $notrigger=0, $forceduedate=0) + function create(User $user, $notrigger = 0, $forceduedate = 0) { global $langs,$conf,$mysoc,$hookmanager; $error=0; @@ -854,7 +854,7 @@ class Facture extends CommonInvoice * @param int $invertdetail Reverse sign of amounts for lines * @return int <0 if KO, >0 if OK */ - function createFromCurrent(User $user, $invertdetail=0) + function createFromCurrent(User $user, $invertdetail = 0) { global $conf; @@ -945,7 +945,7 @@ class Facture extends CommonInvoice * @param int $socid Id of thirdparty * @return int New id of clone */ - function createFromClone($socid=0) + function createFromClone($socid = 0) { global $user,$hookmanager, $conf; @@ -1162,7 +1162,7 @@ class Facture extends CommonInvoice * @param int $withpicto Add download picto into link * @return string HTML link to file */ - function getDirectExternalLink($withpicto=0) + function getDirectExternalLink($withpicto = 0) { global $dolibarr_main_url_root; @@ -1193,7 +1193,7 @@ class Facture extends CommonInvoice * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $max=0, $short=0, $moretitle='', $notooltip=0, $addlinktonotes=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user, $form; @@ -1301,7 +1301,7 @@ class Facture extends CommonInvoice * @param bool $fetch_situation Fetch the previous and next situation in $tab_previous_situation_invoice and $tab_next_situation_invoice * @return int >0 if OK, <0 if KO, 0 if not found */ - function fetch($rowid, $ref='', $ref_ext='', $ref_int='', $fetch_situation=false) + function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '', $fetch_situation = false) { global $conf; @@ -1604,7 +1604,7 @@ class Facture extends CommonInvoice * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf; @@ -1819,7 +1819,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_ref_client($ref_client, $notrigger=0) + function set_ref_client($ref_client, $notrigger = 0) { // phpcs:enable global $user; @@ -1884,7 +1884,7 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, 0=Refused, >0 if OK */ - function delete($user, $notrigger=0, $idwarehouse=-1) + function delete($user, $notrigger = 0, $idwarehouse = -1) { global $langs,$conf; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2058,7 +2058,7 @@ class Facture extends CommonInvoice * @param string $close_note Commentaire renseigne si on classe a payee alors que paiement incomplet (cas escompte par exemple) * @return int <0 if KO, >0 if OK */ - function set_paid($user, $close_code='', $close_note='') + function set_paid($user, $close_code = '', $close_note = '') { // phpcs:enable $error=0; @@ -2168,7 +2168,7 @@ class Facture extends CommonInvoice * @param string $close_note Comment * @return int <0 if KO, >0 if OK */ - function set_canceled($user, $close_code='', $close_note='') + function set_canceled($user, $close_code = '', $close_note = '') { // phpcs:enable @@ -2231,7 +2231,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, 0=Nothing done because invoice is not a draft, >0 if OK */ - function validate($user, $force_number='', $idwarehouse=0, $notrigger=0) + function validate($user, $force_number = '', $idwarehouse = 0, $notrigger = 0) { global $conf,$langs; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; @@ -2313,7 +2313,7 @@ class Facture extends CommonInvoice { $num = $force_number; } - else if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life + elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life { if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date { @@ -2529,7 +2529,7 @@ class Facture extends CommonInvoice * @param int $idwarehouse Id warehouse to use for stock change. * @return int <0 if KO, >0 if OK */ - function set_draft($user,$idwarehouse=-1) + function set_draft($user, $idwarehouse = -1) { // phpcs:enable global $conf,$langs; @@ -2649,7 +2649,7 @@ class Facture extends CommonInvoice * @param double $pu_ht_devise Unit price in currency * @return int <0 if KO, Id of line if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlocaltax2=0, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits=0, $fk_remise_except='', $price_base_type='HT', $pu_ttc=0, $type=self::TYPE_STANDARD, $rang=-1, $special_code=0, $origin='', $origin_id=0, $fk_parent_line=0, $fk_fournprice=null, $pa_ht=0, $label='', $array_options=0, $situation_percent=100, $fk_prev_id=0, $fk_unit = null, $pu_ht_devise = 0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $fk_product = 0, $remise_percent = 0, $date_start = '', $date_end = '', $ventil = 0, $info_bits = 0, $fk_remise_except = '', $price_base_type = 'HT', $pu_ttc = 0, $type = self::TYPE_STANDARD, $rang = -1, $special_code = 0, $origin = '', $origin_id = 0, $fk_parent_line = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $array_options = 0, $situation_percent = 100, $fk_prev_id = 0, $fk_unit = null, $pu_ht_devise = 0) { // Deprecation warning if ($label) { @@ -2879,7 +2879,7 @@ class Facture extends CommonInvoice * @param int $notrigger disable line update trigger * @return int < 0 if KO, > 0 if OK */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type= self::TYPE_STANDARD, $fk_parent_line=0, $skip_update_total=0, $fk_fournprice=null, $pa_ht=0, $label='', $special_code=0, $array_options=0, $situation_percent=100, $fk_unit = null, $pu_ht_devise = 0, $notrigger=0) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $txtva, $txlocaltax1 = 0, $txlocaltax2 = 0, $price_base_type = 'HT', $info_bits = 0, $type = self::TYPE_STANDARD, $fk_parent_line = 0, $skip_update_total = 0, $fk_fournprice = null, $pa_ht = 0, $label = '', $special_code = 0, $array_options = 0, $situation_percent = 100, $fk_unit = null, $pu_ht_devise = 0, $notrigger = 0) { global $conf,$user; // Deprecation warning @@ -3197,7 +3197,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if ko, >0 if ok */ - function set_remise($user, $remise, $notrigger=0) + function set_remise($user, $remise, $notrigger = 0) { // phpcs:enable // Clean parameters @@ -3263,7 +3263,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function set_remise_absolue($user, $remise, $notrigger=0) + function set_remise_absolue($user, $remise, $notrigger = 0) { // phpcs:enable if (empty($remise)) $remise=0; @@ -3330,15 +3330,15 @@ class Facture extends CommonInvoice * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc,$mode='next') + function getNextNumRef($soc, $mode = 'next') { global $conf, $langs; $langs->load("bills"); // Clean parameters (if not defined or using deprecated value) if (empty($conf->global->FACTURE_ADDON)) $conf->global->FACTURE_ADDON='mod_facture_terre'; - else if ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre'; - else if ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure'; + elseif ($conf->global->FACTURE_ADDON=='terre') $conf->global->FACTURE_ADDON='mod_facture_terre'; + elseif ($conf->global->FACTURE_ADDON=='mercure') $conf->global->FACTURE_ADDON='mod_facture_mercure'; if (! empty($conf->global->FACTURE_ADDON)) { @@ -3472,7 +3472,7 @@ class Facture extends CommonInvoice * @param string $sortorder Sort order * @return int -1 if KO, array with result if OK */ - function liste_array($shortlist=0, $draft=0, $excluser='', $socid=0, $limit=0, $offset=0, $sortfield='f.datef,f.rowid', $sortorder='DESC') + function liste_array($shortlist = 0, $draft = 0, $excluser = '', $socid = 0, $limit = 0, $offset = 0, $sortfield = 'f.datef,f.rowid', $sortorder = 'DESC') { // phpcs:enable global $conf,$user; @@ -3511,7 +3511,7 @@ class Facture extends CommonInvoice { $ga[$obj->fid] = $obj->ref; } - else if ($shortlist == 2) + elseif ($shortlist == 2) { $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; } @@ -3543,7 +3543,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ('id'=>id, 'ref'=>ref, 'status'=>status, 'paymentornot'=>0/1) */ - function list_replacable_invoices($socid=0) + function list_replacable_invoices($socid = 0) { // phpcs:enable global $conf; @@ -3593,7 +3593,7 @@ class Facture extends CommonInvoice * @param int $socid Id thirdparty * @return array Array of invoices ($id => array('ref'=>,'paymentornot'=>,'status'=>,'paye'=>) */ - function list_qualified_avoir_invoices($socid=0) + function list_qualified_avoir_invoices($socid = 0) { // phpcs:enable global $conf; @@ -3668,7 +3668,7 @@ class Facture extends CommonInvoice * @param float $amount Amount we request direct debit for * @return int <0 if KO, >0 if OK */ - function demande_prelevement($fuser, $amount=0) + function demande_prelevement($fuser, $amount = 0) { // phpcs:enable @@ -3894,7 +3894,7 @@ class Facture extends CommonInvoice * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option='') + function initAsSpecimen($option = '') { global $langs; @@ -3971,7 +3971,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc=-239.2; $line->multicurrency_total_tva=-39.2; } - else if ($xnbp == 2) // UP is negative (free line) + elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice=-100; $line->total_ht=-100; @@ -3982,7 +3982,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc=-239.2; $line->multicurrency_total_tva=-39.2; } - else if ($xnbp == 3) // Discount is 50% (product line) + elseif ($xnbp == 3) // Discount is 50% (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product=$prodids[$prodid]; @@ -4110,7 +4110,7 @@ class Facture extends CommonInvoice * @param null|array $moreparams Array to provide more information * @return int <0 if KO, >0 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$langs; @@ -4215,7 +4215,7 @@ class Facture extends CommonInvoice * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function setFinal(User $user, $notrigger=0) + function setFinal(User $user, $notrigger = 0) { $error=0; @@ -4512,7 +4512,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $noerrorifdiscountalreadylinked 1=Do not make error if lines is linked to a discount and discount already linked to another * @return int <0 if KO, >0 if OK */ - function insert($notrigger=0, $noerrorifdiscountalreadylinked=0) + function insert($notrigger = 0, $noerrorifdiscountalreadylinked = 0) { global $langs,$user,$conf; @@ -4729,7 +4729,7 @@ class FactureLigne extends CommonInvoiceLine * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function update($user='',$notrigger=0) + function update($user = '', $notrigger = 0) { global $user,$conf; @@ -4945,7 +4945,7 @@ class FactureLigne extends CommonInvoiceLine * @param bool $include_credit_note Include credit note or not * @return int >= 0 */ - function get_prev_progress($invoiceid, $include_credit_note=true) + function get_prev_progress($invoiceid, $include_credit_note = true) { // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { diff --git a/htdocs/compta/facture/class/facturestats.class.php b/htdocs/compta/facture/class/facturestats.class.php index 4cf9477613e..a6a6fd07e84 100644 --- a/htdocs/compta/facture/class/facturestats.class.php +++ b/htdocs/compta/facture/class/facturestats.class.php @@ -53,7 +53,7 @@ class FactureStats extends Stats * @param string $mode Option ('customer', 'supplier') * @param int $userid Id user for filter (creation user) */ - function __construct($db, $socid, $mode, $userid=0) + function __construct($db, $socid, $mode, $userid = 0) { global $user, $conf; @@ -100,7 +100,7 @@ class FactureStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { global $user; @@ -145,7 +145,7 @@ class FactureStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array with amount by month */ - function getAmountByMonth($year, $format=0) + function getAmountByMonth($year, $format = 0) { global $user; @@ -225,4 +225,3 @@ class FactureStats extends Stats return $this->_getAllByProduct($sql); } } - diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 55a3e40b55f..3d4f0881de2 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -82,7 +82,7 @@ class PaymentTerm // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -268,7 +268,7 @@ class PaymentTerm // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; @@ -345,7 +345,7 @@ class PaymentTerm // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 80277e14741..4e0c52589de 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -85,7 +85,7 @@ if ($action == 'addcontact' && $user->rights->facture->creer) } // Toggle the status of a contact -else if ($action == 'swapstatut' && $user->rights->facture->creer) +elseif ($action == 'swapstatut' && $user->rights->facture->creer) { if ($object->fetch($id)) { @@ -98,7 +98,7 @@ else if ($action == 'swapstatut' && $user->rights->facture->creer) } // Deletes a contact -else if ($action == 'deletecontact' && $user->rights->facture->creer) +elseif ($action == 'deletecontact' && $user->rights->facture->creer) { $object->fetch($id); $result = $object->delete_contact($lineid); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index c048737b156..c0dd351f009 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Meziane Sof * Copyright (C) 2017-2018 Frédéric France * @@ -405,7 +405,7 @@ if (empty($reshook)) setEventMessages($line->error, $line->errors, 'errors'); } } - else if ($action == 'update_extras') + elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -1145,7 +1145,7 @@ if ($action == 'create') $title = $langs->trans("ProductsAndServices"); if (empty($conf->service->enabled)) $title = $langs->trans("Products"); - else if (empty($conf->product->enabled)) + elseif (empty($conf->product->enabled)) $title = $langs->trans("Services"); print load_fiche_titre($title, '', ''); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index be372e8a570..a025829f274 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -6,7 +6,7 @@ * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Meziane Sof * * This program is free software; you can redistribute it and/or modify @@ -247,12 +247,12 @@ if ($search_month > 0) { if ($search_year > 0 && empty($search_day)) $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year,$search_month,false))."' AND '".$db->idate(dol_get_last_day($search_year,$search_month,false))."'"; - else if ($search_year > 0 && ! empty($search_day)) + elseif ($search_year > 0 && ! empty($search_day)) $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month, $search_day, $search_year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month, $search_day, $search_year))."'"; else $sql.= " AND date_format(f.date_last_gen, '%m') = '".$db->escape($search_month)."'"; } -else if ($search_year > 0) +elseif ($search_year > 0) { $sql.= " AND f.date_last_gen BETWEEN '".$db->idate(dol_get_first_day($search_year,1,false))."' AND '".$db->idate(dol_get_last_day($search_year,12,false))."'"; } @@ -260,12 +260,12 @@ if ($search_month_date_when > 0) { if ($search_year_date_when > 0 && empty($search_day_date_when)) $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when,$search_month_date_when,false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when,$search_month_date_when,false))."'"; - else if ($search_year_date_when > 0 && ! empty($search_day_date_when)) + elseif ($search_year_date_when > 0 && ! empty($search_day_date_when)) $sql.= " AND f.date_date_when_reglement BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $search_month_date_when, $search_day_date_when, $search_year_date_when))."' AND '".$db->idate(dol_mktime(23, 59, 59, $search_month_date_when, $search_day_date_when, $search_year_date_when))."'"; else $sql.= " AND date_format(f.date_when, '%m') = '".$db->escape($search_month_date_when)."'"; } -else if ($search_year_date_when > 0) +elseif ($search_year_date_when > 0) { $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($search_year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($search_year_date_when,12,false))."'"; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 7a06e6f66df..c3aeb8f6608 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -273,7 +273,7 @@ if ($massaction == 'withdrawrequest') if($objecttmp->paye || $objecttmp->resteapayer==0){ $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("AlreadyPaid"), $objecttmp->errors, 'errors'); - } else if($objecttmp->resteapayer<0){ + } elseif($objecttmp->resteapayer<0){ $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("AmountMustBePositive"), $objecttmp->errors, 'errors'); } @@ -303,7 +303,7 @@ if ($massaction == 'withdrawrequest') $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings'); } - else if (!empty($objecttmp->mode_reglement_code ) && $objecttmp->mode_reglement_code != 'PRE'){ + elseif (!empty($objecttmp->mode_reglement_code ) && $objecttmp->mode_reglement_code != 'PRE'){ $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("BadPaymentMethod"), $objecttmp->errors, 'errors'); } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 2ab17905715..e979e297dd7 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2011-2012 Alexandre spangaro + * Copyright (C) 2011-2012 Alexandre spangaro * Copyright (C) 2013 Marcos García * Copyright (C) 2018 Frédéric France * diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 42b2c8a95af..5aec70b1dec 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -3,7 +3,7 @@ * Copyright (C) 2007-2010 Jean Heimburger * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2012 Regis Houssin - * Copyright (C) 2011-2012 Alexandre Spangaro + * Copyright (C) 2011-2012 Alexandre Spangaro * Copyright (C) 2012 Cédric Salvador * Copyright (C) 2013 Marcos García * Copyright (C) 2014 Raphaël Doursenaud diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 49c95c26c2e..d80b9cc4783 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -163,7 +163,7 @@ class Localtax extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf, $langs; @@ -628,7 +628,7 @@ class Localtax extends CommonObject * @param string $option Sur quoi pointe le lien * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $option='') + function getNomUrl($withpicto = 0, $option = '') { global $langs; @@ -652,7 +652,7 @@ class Localtax extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -665,7 +665,7 @@ class Localtax extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status, $mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 574c7103c61..924c6bf3a09 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -58,8 +58,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $date_start=dol_get_first_day($year_start,empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START,false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; } } else @@ -229,7 +229,7 @@ if($calc ==0 || $calc == 2) $langs->load("errors"); if ($coll_list == -1) print ''; - else if ($coll_list == -2) + elseif ($coll_list == -2) print ''; else print ''; @@ -305,7 +305,7 @@ if($calc ==0 || $calc == 1){ $langs->load("errors"); if ($coll_list == -1) print ''; - else if ($coll_list == -2) + elseif ($coll_list == -2) print ''; else print ''; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 73a9f77341a..6875083901b 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -68,8 +68,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $date_start=dol_get_first_day($year_start,empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START,false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; } } else diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 51435433aa4..bca1fa8f835 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -622,15 +622,16 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $multicurrency_remaintopay=price2num($invoice->multicurrency_total_ttc - $multicurrency_payment - $multicurrency_creditnotes - $multicurrency_deposits,'MT'); } - print ''; - print ''; + + print '\n"; // Date - print '\n"; + print '\n"; // Date Max Payment if ($objp->dlr > 0 ) @@ -700,7 +701,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Price - print ''; + print ''; // Received or paid back print ''; - } else if ($x_coll == -2) { + } elseif ($x_coll == -2) { print ''; } else { print ''; diff --git a/htdocs/compta/tva/info.php b/htdocs/compta/tva/info.php index 4a2308bd0bd..feea451f1db 100644 --- a/htdocs/compta/tva/info.php +++ b/htdocs/compta/tva/info.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2016-2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index f0bb433c65c..d54a99acc76 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2018 Laurent Destailleur * Copyright (C) 2005-2009 Regis Houssin - * Copyright (C) 2011-2017 Alexandre Spangaro + * Copyright (C) 2011-2017 Alexandre Spangaro * * 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 @@ -115,7 +115,7 @@ if ($month > 0) else $sql.= " AND date_format(t.datev, '%m') = '$month'"; } -else if ($year > 0) +elseif ($year > 0) { $sql.= " AND t.datev BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index a8e22815ea4..b98b3791c8b 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -66,8 +66,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $date_start=dol_get_first_day($year_start,empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START,false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; } } else @@ -209,7 +209,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $langs->load("errors"); if ($x_coll == -1) { print ''; - } else if ($x_coll == -2) { + } elseif ($x_coll == -2) { print ''; } else { print ''; diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index fbd3e46b9a7..3df7945a08e 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9371f1e3200..6b6bc9f69da 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Frédéric France diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index a5297750386..bd7819ee299 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2007 Franky Van Liedekerke * Copyright (C) 2008 Raphael Bertrand (Resultic) * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Marcos García * @@ -313,7 +313,7 @@ class Contact extends CommonObject * @param int $nosyncuser No sync linked user (external users and contacts are linked) * @return int <0 if KO, >0 if OK */ - function update($id, $user=null, $notrigger=0, $action='update', $nosyncuser=0) + function update($id, $user = null, $notrigger = 0, $action = 'update', $nosyncuser = 0) { global $conf, $langs, $hookmanager; @@ -344,7 +344,7 @@ class Contact extends CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX."socpeople SET "; if ($this->socid > 0) $sql .= " fk_soc='".$this->db->escape($this->socid)."',"; - else if ($this->socid == -1) $sql .= " fk_soc=null,"; + elseif ($this->socid == -1) $sql .= " fk_soc=null,"; $sql .= " civility='".$this->db->escape($this->civility_id)."'"; $sql .= ", lastname='".$this->db->escape($this->lastname)."'"; $sql .= ", firstname='".$this->db->escape($this->firstname)."'"; @@ -501,7 +501,7 @@ class Contact extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - function _load_ldap_dn($info,$mode=0) + function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; @@ -597,7 +597,7 @@ class Contact extends CommonObject * @param int $notrigger 0=no, 1=yes * @return int <0 if KO, >=0 if OK */ - function update_perso($id, $user=null, $notrigger=0) + function update_perso($id, $user = null, $notrigger = 0) { // phpcs:enable $error=0; @@ -686,7 +686,7 @@ class Contact extends CommonObject * @param string $email Email * @return int -1 if KO, 0 if OK but not found, 1 if OK */ - function fetch($id, $user=null, $ref_ext='', $email='') + function fetch($id, $user = null, $ref_ext = '', $email = '') { global $langs; @@ -874,7 +874,7 @@ class Contact extends CommonObject unset($this->gender); if (in_array($this->civility_id, array('MR'))) { $this->gender = 'man'; - } else if(in_array($this->civility_id, array('MME','MLE'))) { + } elseif(in_array($this->civility_id, array('MME','MLE'))) { $this->gender = 'woman'; } } @@ -931,7 +931,7 @@ class Contact extends CommonObject * @param int $notrigger Disable all trigger * @return int <0 if KO, >0 if OK */ - function delete($notrigger=0) + function delete($notrigger = 0) { global $conf, $langs, $user; @@ -1124,7 +1124,7 @@ class Contact extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $maxlen=0, $moreparam='', $save_lastsearch_value=-1, $notooltip=0) + function getNomUrl($withpicto = 0, $option = '', $maxlen = 0, $moreparam = '', $save_lastsearch_value = -1, $notooltip = 0) { global $conf, $langs, $hookmanager; @@ -1231,7 +1231,7 @@ class Contact extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function LibStatut($statut,$mode) + function LibStatut($statut, $mode) { // phpcs:enable global $langs; diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php index d118c4de3b9..3dbf5f660a7 100644 --- a/htdocs/contact/document.php +++ b/htdocs/contact/document.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2015 Frederic France * Copyright (C) 2017 Regis Houssin * diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index af15d873acb..8ca5ce040ac 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2013-2015 Raphaël Doursenaud * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2013 Alexandre Spangaro + * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2018 Nicolas ZABOURI * Copyright (C) 2018 Juanjo Menent @@ -113,13 +113,13 @@ if ($type == "c") $titre.=' ('.$langs->trans("ThirdPartyCustomers").')'; $urlfiche="card.php"; } -else if ($type == "f") +elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactsupplierlist'; $titre.=' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche="card.php"; } -else if ($type == "o") +elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage='contactotherlist'; $titre.=' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; @@ -330,15 +330,15 @@ if ($type == "o") // filtre sur type { $sql .= " AND p.fk_soc IS NULL"; } -else if ($type == "f") // filtre sur type +elseif ($type == "f") // filtre sur type { $sql .= " AND s.fournisseur = 1"; } -else if ($type == "c") // filtre sur type +elseif ($type == "c") // filtre sur type { $sql .= " AND s.client IN (1, 3)"; } -else if ($type == "p") // filtre sur type +elseif ($type == "p") // filtre sur type { $sql .= " AND s.client IN (2, 3)"; } @@ -487,7 +487,7 @@ if (! empty($conf->categorie->enabled)) { $moreforfilter.='
'; if ($type == 'c') $moreforfilter.=$langs->trans('CustomersCategoriesShort'). ': '; - else if ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': '; + elseif ($type == 'p') $moreforfilter.=$langs->trans('ProspectsCategoriesShort'). ': '; else $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort'). ': '; $moreforfilter.=$formother->select_categories(Categorie::TYPE_CUSTOMER,$search_categ_thirdparty,'search_categ_thirdparty',1); $moreforfilter.='
'; diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 8e74c33cd14..da5a8d4eaa8 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -293,7 +293,7 @@ else $ageyear=convertSecondToTime($now-$object->birthday,'year')-1970; $agemonth=convertSecondToTime($now-$object->birthday,'month')-1; if ($ageyear >= 2) print '('.$ageyear.' '.$langs->trans("DurationYears").')'; - else if ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')'; + elseif ($agemonth >= 2) print '('.$agemonth.' '.$langs->trans("DurationMonths").')'; else print '('.$agemonth.' '.$langs->trans("DurationMonth").')'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 844cd4321a4..d0e928ff7cd 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -119,7 +119,7 @@ if (empty($reshook)) } } - else if ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) + elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (! GETPOST('dateend')) { @@ -408,13 +408,13 @@ if (empty($reshook)) } } - else if ($action == 'classin' && $user->rights->contrat->creer) + elseif ($action == 'classin' && $user->rights->contrat->creer) { $object->setProject(GETPOST('projectid')); } // Add a new line - else if ($action == 'addline' && $user->rights->contrat->creer) + elseif ($action == 'addline' && $user->rights->contrat->creer) { // Set if we used free entry or predefined product $predef=''; @@ -653,7 +653,7 @@ if (empty($reshook)) } } - else if ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha')) + elseif ($action == 'updateline' && $user->rights->contrat->creer && ! GETPOST('cancel','alpha')) { $error = 0; @@ -761,7 +761,7 @@ if (empty($reshook)) } } - else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) + elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->deleteline(GETPOST('lineid'),$user); @@ -776,7 +776,7 @@ if (empty($reshook)) } } - else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) + elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->validate($user); @@ -805,7 +805,7 @@ if (empty($reshook)) } } - else if ($action == 'reopen' && $user->rights->contrat->creer) + elseif ($action == 'reopen' && $user->rights->contrat->creer) { $result = $object->reopen($user); if ($result < 0) @@ -815,7 +815,7 @@ if (empty($reshook)) } // Close all lines - else if ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) + elseif ($action == 'confirm_close' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->closeAll($user); if ($result < 0) @@ -825,7 +825,7 @@ if (empty($reshook)) } // Close all lines - else if ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) + elseif ($action == 'confirm_activate' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->activateAll($user); if ($result < 0) @@ -834,7 +834,7 @@ if (empty($reshook)) } } - else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) + elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->contrat->supprimer) { $result=$object->delete($user); if ($result >= 0) @@ -848,7 +848,7 @@ if (empty($reshook)) } } - else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) + elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) { if (GETPOST('newcid') > 0) { @@ -871,7 +871,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } } - else if ($action == 'update_extras') + elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -1042,13 +1042,13 @@ if (empty($reshook)) } // bascule du statut d'un contact - else if ($action == 'swapstatut') + elseif ($action == 'swapstatut') { $result=$object->swapContactStatus(GETPOST('ligne')); } // Efface un contact - else if ($action == 'deletecontact') + elseif ($action == 'deletecontact') { $result = $object->delete_contact(GETPOST('lineid')); diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 585d5399771..8631becc515 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -555,7 +555,7 @@ class Contracts extends DolibarrApi * "notrigger": 0 * } */ - function validate($id, $notrigger=0) + function validate($id, $notrigger = 0) { if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); @@ -601,7 +601,7 @@ class Contracts extends DolibarrApi * "notrigger": 0 * } */ - function close($id, $notrigger=0) + function close($id, $notrigger = 0) { if (! DolibarrApiAccess::$user->rights->contrat->creer) { throw new RestException(401); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 5929ec034d1..81a8ddba115 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -261,7 +261,7 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - function active_line($user, $line_id, $date, $date_end='', $comment='') + function active_line($user, $line_id, $date, $date_end = '', $comment = '') { // phpcs:enable $result = $this->lines[$this->lines_id_index_mapper[$line_id]]->active_line($user, $date, $date_end, $comment); @@ -284,7 +284,7 @@ class Contrat extends CommonObject * @param string $comment A comment typed by user * @return int <0 if KO, >0 if OK */ - function close_line($user, $line_id, $date_end, $comment='') + function close_line($user, $line_id, $date_end, $comment = '') { // phpcs:enable $result=$this->lines[$this->lines_id_index_mapper[$line_id]]->close_line($user, $date_end, $comment); @@ -307,7 +307,7 @@ class Contrat extends CommonObject * @return int <0 if KO, >0 if OK * @see closeAll */ - function activateAll($user, $date_start='', $notrigger=0, $comment='') + function activateAll($user, $date_start = '', $notrigger = 0, $comment = '') { if (empty($date_start)) $date_start = dol_now(); @@ -363,7 +363,7 @@ class Contrat extends CommonObject * @return int <0 if KO, >0 if OK * @see activateAll */ - function closeAll(User $user, $notrigger=0, $comment='') + function closeAll(User $user, $notrigger = 0, $comment = '') { $this->db->begin(); @@ -419,7 +419,7 @@ class Contrat extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int <0 if KO, >0 if OK */ - function validate(User $user, $force_number='', $notrigger=0) + function validate(User $user, $force_number = '', $notrigger = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; global $langs, $conf; @@ -445,7 +445,7 @@ class Contrat extends CommonObject { $num = $force_number; } - else if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life + elseif (! $error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $num = $this->getNextNumRef($this->thirdparty); } @@ -547,7 +547,7 @@ class Contrat extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0=execute triggers * @return int <0 if KO, >0 if OK */ - function reopen($user, $notrigger=0) + function reopen($user, $notrigger = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; global $langs, $conf; @@ -614,7 +614,7 @@ class Contrat extends CommonObject * @param string $ref_supplier Supplier ref * @return int <0 if KO, 0 if not found, Id of contract if OK */ - function fetch($id, $ref='', $ref_customer='', $ref_supplier='') + function fetch($id, $ref = '', $ref_customer = '', $ref_supplier = '') { $sql = "SELECT rowid, statut, ref, fk_soc, mise_en_service as datemise,"; $sql.= " ref_supplier, ref_customer,"; @@ -1242,7 +1242,7 @@ class Contrat extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -1360,7 +1360,7 @@ class Contrat extends CommonObject * @param string $rang Position * @return int <0 if KO, >0 if OK */ - function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type='HT', $pu_ttc=0.0, $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null, $rang=0) + function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1, $txlocaltax2, $fk_product, $remise_percent, $date_start, $date_end, $price_base_type = 'HT', $pu_ttc = 0.0, $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null, $rang = 0) { global $user, $langs, $conf, $mysoc; $error=0; @@ -1570,7 +1570,7 @@ class Contrat extends CommonObject * @param string $fk_unit Code of the unit to use. Null to use the default one * @return int < 0 si erreur, > 0 si ok */ - function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx=0.0, $localtax2tx=0.0, $date_debut_reel='', $date_fin_reel='', $price_base_type='HT', $info_bits=0, $fk_fournprice=null, $pa_ht = 0,$array_options=0, $fk_unit = null) + function updateline($rowid, $desc, $pu, $qty, $remise_percent, $date_start, $date_end, $tvatx, $localtax1tx = 0.0, $localtax2tx = 0.0, $date_debut_reel = '', $date_fin_reel = '', $price_base_type = 'HT', $info_bits = 0, $fk_fournprice = null, $pa_ht = 0, $array_options = 0, $fk_unit = null) { global $user, $conf, $langs, $mysoc; @@ -1840,7 +1840,7 @@ class Contrat extends CommonObject * @param int $mode 0=Long label, 1=Short label, 2=Picto + Libelle court, 3=Picto, 4=Picto + Long label of all services, 5=Libelle court + Picto, 6=Picto of all services, 7=Same than 6 with fixed length * @return string Label */ - function LibStatut($statut,$mode) + function LibStatut($statut, $mode) { // phpcs:enable global $langs; @@ -1909,7 +1909,7 @@ class Contrat extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $maxlength=0, $notooltip=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_lastsearch_value = -1) { global $conf, $langs, $user; @@ -2022,7 +2022,7 @@ class Contrat extends CommonObject * @param int $statut Status of lines to get * @return array Array of line's rowid */ - function array_detail($statut=-1) + function array_detail($statut = -1) { // phpcs:enable $tab=array(); @@ -2059,7 +2059,7 @@ class Contrat extends CommonObject * @param string $option 'all' or 'others' * @return array Array of contracts id */ - function getListOfContracts($option='all') + function getListOfContracts($option = 'all') { $tab=array(); @@ -2100,7 +2100,7 @@ class Contrat extends CommonObject * @param string $mode "inactive" pour services a activer, "expired" pour services expires * @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK */ - function load_board($user,$mode) + function load_board($user, $mode) { // phpcs:enable global $conf, $langs; @@ -2336,7 +2336,7 @@ class Contrat extends CommonObject * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$langs; @@ -2382,7 +2382,7 @@ class Contrat extends CommonObject * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return int New id of clone */ - function createFromClone($socid = 0, $notrigger=0) + function createFromClone($socid = 0, $notrigger = 0) { global $db, $user, $langs, $conf, $hookmanager, $extrafields; @@ -2658,7 +2658,7 @@ class ContratLigne extends CommonObjectLine * @param string $moreatt More attribute * @return string Libelle */ - static function LibStatut($statut,$mode,$expired=-1,$moreatt='') + static function LibStatut($statut, $mode, $expired = -1, $moreatt = '') { // phpcs:enable global $langs; @@ -2720,7 +2720,7 @@ class ContratLigne extends CommonObjectLine * @param int $maxlength Max length * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlength=0) + function getNomUrl($withpicto = 0, $maxlength = 0) { global $langs; @@ -2747,7 +2747,7 @@ class ContratLigne extends CommonObjectLine * @param string $ref Ref of contract * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $ref = '') { // Check parameters @@ -2879,7 +2879,7 @@ class ContratLigne extends CommonObjectLine * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update($user, $notrigger = 0) { global $conf, $langs, $mysoc; @@ -3257,7 +3257,7 @@ class ContratLigne extends CommonObjectLine * @param int $notrigger 1=Does not execute triggers, 0=Execute triggers * @return int <0 if KO, >0 if OK */ - function close_line($user, $date_end, $comment = '', $notrigger=0) + function close_line($user, $date_end, $comment = '', $notrigger = 0) { // phpcs:enable global $langs, $conf; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index c1d21426f83..3272d7ed908 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -241,12 +241,12 @@ if ($month > 0) { if ($year > 0 && empty($day)) $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) + elseif ($year > 0 && ! empty($day)) $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; else $sql.= " AND date_format(c.date_contrat, '%m') = '".$month."'"; } -else if ($year > 0) +elseif ($year > 0) { $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } @@ -711,7 +711,7 @@ while ($i < min($num,$limit)) print $nbofsalesrepresentative; print ''; } - else if ($nbofsalesrepresentative > 0) + elseif ($nbofsalesrepresentative > 0) { $userstatic=new User($db); $j=0; diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index 9d33def496c..30576329d1c 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -60,7 +60,7 @@ if ($action == 'builddoc' && $permissioncreate) //{ if (GETPOST('fk_bank','int')) { // this field may come from an external module $object->fk_bank = GETPOST('fk_bank','int'); - } else if (! empty($object->fk_account)) { + } elseif (! empty($object->fk_account)) { $object->fk_bank = $object->fk_account; } //} @@ -133,4 +133,3 @@ if ($action == 'remove_file' && $permissioncreate) header('Location: '.$urltoredirect); exit; } - diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php index 6d39272f74e..4cfc29209b1 100644 --- a/htdocs/core/actions_changeselectedfields.inc.php +++ b/htdocs/core/actions_changeselectedfields.inc.php @@ -44,5 +44,3 @@ if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') //$action='list'; //var_dump($tabparam);exit; } - - diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 7d20f124277..d2b8019a5e0 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -43,4 +43,3 @@ if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel','a $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); } - diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index bae5001b256..a50fadec1af 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -402,4 +402,3 @@ if ($action == 'delete') $mesg=$langs->trans("ErrorFieldCanNotContainSpecialCharacters",$langs->transnoentities("AttributeCode")); } } - diff --git a/htdocs/core/actions_lineupdown.inc.php b/htdocs/core/actions_lineupdown.inc.php index bcf251e0763..8b5e3e3a24c 100644 --- a/htdocs/core/actions_lineupdown.inc.php +++ b/htdocs/core/actions_lineupdown.inc.php @@ -70,4 +70,3 @@ if ($action == 'down' && $permissiontoedit) header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid')); exit(); } - diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 630c67e9979..36e6c4956bf 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -37,8 +37,8 @@ // Protection if (empty($objectclass) || empty($uploaddir)) { - dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); - exit; + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); + exit; } @@ -46,1042 +46,1054 @@ if (empty($objectclass) || empty($uploaddir)) $maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); if (! empty($massaction) && count($toselect) < 1) { - $error++; - setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); + $error++; + setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); } if (! $error && is_array($toselect) && count($toselect) > $maxformassaction) { - setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); - $error++; + setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors'); + $error++; } if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form { - $massaction='presend'; + $massaction='presend'; } if (! $error && $massaction == 'confirm_presend') { - $resaction = ''; - $nbsent = 0; - $nbignored = 0; - $langs->load("mails"); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $resaction = ''; + $nbsent = 0; + $nbignored = 0; + $langs->load("mails"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); - if (! $error) - { - $thirdparty=new Societe($db); - if ($objecttmp->element == 'expensereport') $thirdparty=new User($db); - if ($objecttmp->element == 'holiday') $thirdparty=new User($db); + if (! $error) + { + $thirdparty=new Societe($db); - $objecttmp=new $objectclass($db); - foreach($toselect as $toselectid) - { - $objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofobjectid[$toselectid]=$toselectid; - $thirdpartyid=($objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid); - if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id; - if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author; - if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; - } - } - } + $objecttmp=new $objectclass($db); + if ($objecttmp->element == 'expensereport') $thirdparty=new User($db); + if ($objecttmp->element == 'holiday') $thirdparty=new User($db); - // Check mandatory parameters - if (GETPOST('fromtype','alpha') === 'user' && empty($user->email)) - { - $error++; - setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); - $massaction='presend'; - } + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofobjectid[$toselectid]=$toselectid; - $receiver=$_POST['receiver']; - if (! is_array($receiver)) - { - if (empty($receiver) || $receiver == '-1') $receiver=array(); - else $receiver=array($receiver); - } - if (! trim($_POST['sendto']) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) // if only one recipient, receiver is mandatory - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings'); - $massaction='presend'; - } + $thirdpartyid=($objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid); + if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id; + if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author; + if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user; + if (empty($thirdpartyid)) $thirdpartyid=0; - if (! GETPOST('subject','none')) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); - $massaction='presend'; - } + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; + } + } + } - // Loop on each recipient/thirdparty - if (! $error) - { - foreach ($listofobjectthirdparties as $thirdpartyid) - { - $result = $thirdparty->fetch($thirdpartyid); - if ($result < 0) - { - dol_print_error($db); - exit; - } + // Check mandatory parameters + if (GETPOST('fromtype','alpha') === 'user' && empty($user->email)) + { + $error++; + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); + $massaction='presend'; + } - $sendto=''; - $sendtocc=''; - $sendtobcc=''; - $sendtoid = array(); + $receiver=$_POST['receiver']; + if (! is_array($receiver)) + { + if (empty($receiver) || $receiver == '-1') $receiver=array(); + else $receiver=array($receiver); + } + if (! trim($_POST['sendto']) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) // if only one recipient, receiver is mandatory + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings'); + $massaction='presend'; + } - // Define $sendto - $tmparray=array(); - if (trim($_POST['sendto'])) - { - // Recipients are provided into free text - $tmparray[] = trim($_POST['sendto']); - } - if (count($receiver)>0) - { - foreach($receiver as $key=>$val) - { - // Recipient was provided from combo list - if ($val == 'thirdparty') // Id of third party or user - { - $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact - { - $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); - $sendtoid[] = $val; - } - } - } - $sendto=implode(',',$tmparray); + if (! GETPOST('subject','none')) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); + $massaction='presend'; + } - // Define $sendtocc - $receivercc=$_POST['receivercc']; - if (! is_array($receivercc)) - { - if ($receivercc == '-1') $receivercc=array(); - else $receivercc=array($receivercc); - } - $tmparray=array(); - if (trim($_POST['sendtocc'])) - { - $tmparray[] = trim($_POST['sendtocc']); - } - if (count($receivercc) > 0) - { - foreach($receivercc as $key=>$val) - { - // Recipient was provided from combo list - if ($val == 'thirdparty') // Id of third party - { - $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val) // Id du contact - { - $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); - //$sendtoid[] = $val; TODO Add also id of contact in CC ? - } - } - } - $sendtocc=implode(',',$tmparray); + // Loop on each recipient/thirdparty + if (! $error) + { + foreach ($listofobjectthirdparties as $thirdpartyid) + { + $result = $thirdparty->fetch($thirdpartyid); + if ($result < 0) + { + dol_print_error($db); + exit; + } - //var_dump($listofobjectref);exit; - $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); - $listofqualifiedobj=array(); - $listofqualifiedref=array(); - $thirdpartywithoutemail=array(); + $sendto=''; + $sendtocc=''; + $sendtobcc=''; + $sendtoid = array(); - foreach($listofobjectref[$thirdpartyid] as $objectid => $objectobj) - { - //var_dump($thirdpartyid.' - '.$objectid.' - '.$objectobj->statut); - if ($objectclass == 'Propal' && $objectobj->statut == Propal::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; - continue; // Payment done or started or canceled - } - if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; - continue; - } - if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'

'; - continue; // Payment done or started or canceled - } + // Define $sendto + $tmparray=array(); + if (trim($_POST['sendto'])) + { + // Recipients are provided into free text + $tmparray[] = trim($_POST['sendto']); + } + if (count($receiver)>0) + { + foreach($receiver as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party or user + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + $sendtoid[] = $val; + } + } + } + $sendto=implode(',',$tmparray); - // Test recipient - if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) - { - if ($objectobj->element == 'expensereport') - { - $fuser = new User($db); - $fuser->fetch($objectobj->fk_user_author); - $sendto = $fuser->email; - } - else - { - $objectobj->fetch_thirdparty(); - $sendto = $objectobj->thirdparty->email; - } - } + // Define $sendtocc + $receivercc=$_POST['receivercc']; + if (! is_array($receivercc)) + { + if ($receivercc == '-1') $receivercc=array(); + else $receivercc=array($receivercc); + } + $tmparray=array(); + if (trim($_POST['sendtocc'])) + { + $tmparray[] = trim($_POST['sendtocc']); + } + if (count($receivercc) > 0) + { + foreach($receivercc as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val) // Id du contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val,'email'); + //$sendtoid[] = $val; TODO Add also id of contact in CC ? + } + } + } + $sendtocc=implode(',',$tmparray); - if (empty($sendto)) - { - //print "No recipient for thirdparty ".$objectobj->thirdparty->name; - $nbignored++; - if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) - { - $resaction.='
'.$langs->trans('NoRecipientEmail',$objectobj->thirdparty->name).'

'; - } - dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); - $thirdpartywithoutemail[$objectobj->thirdparty->id]=1; - continue; - } + //var_dump($listofobjectref);exit; + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); + $listofqualifiedobj=array(); + $listofqualifiedref=array(); + $thirdpartywithoutemail=array(); - if ($_POST['addmaindocfile']) - { - // TODO Use future field $objectobj->fullpathdoc to know where is stored default file - // TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. - $filename=dol_sanitizeFileName($objectobj->ref).'.pdf'; - $filedir=$uploaddir . '/' . dol_sanitizeFileName($objectobj->ref); - $file = $filedir . '/' . $filename; - $mime = dol_mimetype($file); + foreach($listofobjectref[$thirdpartyid] as $objectid => $objectobj) + { + //var_dump($thirdpartyid.' - '.$objectid.' - '.$objectobj->statut); + if ($objectclass == 'Propal' && $objectobj->statut == Propal::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; + continue; // Payment done or started or canceled + } + if ($objectclass == 'Commande' && $objectoj->statut == Commande::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction',$objectobj->ref).'

'; + continue; + } + if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction',$objectobj->ref).'

'; + continue; // Payment done or started or canceled + } - if (dol_is_file($file)) - { - // Create form object - $attachedfiles=array( - 'paths'=>array_merge($attachedfiles['paths'],array($file)), - 'names'=>array_merge($attachedfiles['names'],array($filename)), - 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) - ); - } - else - { - $nbignored++; - $langs->load("errors"); - $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'

'; - dol_syslog('Failed to read file: '.$file, LOG_WARNING); - continue; - } - } + // Test recipient + if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) + { + if ($objectobj->element == 'expensereport') + { + $fuser = new User($db); + $fuser->fetch($objectobj->fk_user_author); + $sendto = $fuser->email; + } + elseif ($objectobj->element == 'holiday') + { + $fuser = new User($db); + $fuser->fetch($objectobj->fk_user); + $sendto = $fuser->email; + } + else + { + $objectobj->fetch_thirdparty(); + $sendto = $objectobj->thirdparty->email; + } + } - // Object of thirdparty qualified - $listofqualifiedobj[$objectid]=$objectobj; - $listofqualifiedref[$objectid]=$objectobj->ref; + if (empty($sendto)) + { + //print "No recipient for thirdparty ".$objectobj->thirdparty->name; + $nbignored++; + if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) + { + $resaction.='
'.$langs->trans('NoRecipientEmail',$objectobj->thirdparty->name).'

'; + } + dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); + $thirdpartywithoutemail[$objectobj->thirdparty->id]=1; + continue; + } + if ($_POST['addmaindocfile']) + { + // TODO Use future field $objectobj->fullpathdoc to know where is stored default file + // TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. + $filename=dol_sanitizeFileName($objectobj->ref).'.pdf'; + $filedir=$uploaddir . '/' . dol_sanitizeFileName($objectobj->ref); + $file = $filedir . '/' . $filename; + $mime = dol_mimetype($file); - //var_dump($listofqualifiedref); - } + if (dol_is_file($file)) + { + // Create form object + $attachedfiles=array( + 'paths'=>array_merge($attachedfiles['paths'],array($file)), + 'names'=>array_merge($attachedfiles['names'],array($filename)), + 'mimes'=>array_merge($attachedfiles['mimes'],array($mime)) + ); + } + else + { + $nbignored++; + $langs->load("errors"); + $resaction.='
'.$langs->trans('ErrorCantReadFile',$file).'

'; + dol_syslog('Failed to read file: '.$file, LOG_WARNING); + continue; + } + } - // Send email if there is at least one qualified record - if (count($listofqualifiedobj) > 0) - { - $langs->load("commercial"); + // Object of thirdparty qualified, we add it + $listofqualifiedobj[$objectid]=$objectobj; + $listofqualifiedref[$objectid]=$objectobj->ref; - $fromtype = GETPOST('fromtype'); - if ($fromtype === 'user') { - $from = $user->getFullName($langs) .' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { - $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { - $tmp=explode(',', $user->email_aliases); - $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { - $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); - $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { - $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; - $resql = $db->query($sql); - $obj = $db->fetch_object($resql); - if ($obj) - { - $from = $obj->label.' <'.$obj->email.'>'; - } - } - else { - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - } + //var_dump($listofqualifiedref); + } - $replyto = $from; - $subject = GETPOST('subject','none'); - $message = GETPOST('message','none'); + // Send email if there is at least one qualified object for current thirdparty + if (count($listofqualifiedobj) > 0) + { + $langs->load("commercial"); - $sendtobcc = GETPOST('sendtoccc'); - if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); - if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); - if ($objectclass == 'Facture') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); - if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); - if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); - if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); + $fromtype = GETPOST('fromtype'); + if ($fromtype === 'user') { + $from = $user->getFullName($langs) .' <'.$user->email.'>'; + } + elseif ($fromtype === 'company') { + $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $user->email_aliases); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { + $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) + { + $from = $obj->label.' <'.$obj->email.'>'; + } + } + else { + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + } - // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) - $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); - $looparray=array(); - if (! $oneemailperrecipient) - { - $looparray = $listofqualifiedobj; - foreach ($looparray as $key => $objecttmp) - { - $looparray[$key]->thirdparty = $thirdparty; - } - } - else - { - $objectforloop=new $objectclass($db); - $objectforloop->thirdparty = $thirdparty; - $looparray[0]=$objectforloop; - } - //var_dump($looparray);exit; + $replyto = $from; + $subject = GETPOST('subject','none'); + $message = GETPOST('message','none'); - foreach ($looparray as $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per record - { - // Make substitution in email content - $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); - $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ',array_keys($listofqualifiedobj)) : $objecttmp->id); - $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ',$listofqualifiedref) : $objecttmp->ref); - $substitutionarray['__EMAIL__'] = $thirdparty->email; - $substitutionarray['__CHECK_READ__'] = ''; + $sendtobcc = GETPOST('sendtoccc'); + if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); + if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); + if ($objectclass == 'Facture') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); + if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); + if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); + if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); - $parameters=array('mode'=>'formemail'); + // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) + // $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty) + $oneemailperrecipient=(GETPOST('oneemailperrecipient','alpha')=='on'?1:0); + $looparray=array(); + if (! $oneemailperrecipient) + { + $looparray = $listofqualifiedobj; + foreach ($looparray as $key => $objecttmp) + { + $looparray[$key]->thirdparty = $thirdparty; // Force thirdparty on object + } + } + else + { + $objectforloop=new $objectclass($db); + $objectforloop->thirdparty = $thirdparty; // Force thirdparty on object (even if object was not loaded) + $looparray[0]=$objectforloop; + } + //var_dump($looparray);exit; + dol_syslog("We have set an array of ".count($looparray)." emails to send"); - if ( ! empty( $listofobjectthirdparties ) ) { - $parameters['listofobjectthirdparties'] = $listofobjectthirdparties; - } - if ( ! empty( $listofobjectref ) ) { - $parameters['listofobjectref'] = $listofobjectref; - } + foreach ($looparray as $objectid => $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object + { + // Make substitution in email content + $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); + $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ',array_keys($listofqualifiedobj)) : $objecttmp->id); + $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ',$listofqualifiedref) : $objecttmp->ref); + $substitutionarray['__EMAIL__'] = $thirdparty->email; + $substitutionarray['__CHECK_READ__'] = ''; - complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); + $parameters=array('mode'=>'formemail'); - $subject=make_substitutions($subject, $substitutionarray); - $message=make_substitutions($message, $substitutionarray); + if ( ! empty( $listofobjectthirdparties ) ) { + $parameters['listofobjectthirdparties'] = $listofobjectthirdparties; + } + if ( ! empty( $listofobjectref ) ) { + $parameters['listofobjectref'] = $listofobjectref; + } - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; + complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); - // Define the trackid when emails sent from the mass action - if ($oneemailperrecipient) - { - $trackid='thi'.$thirdparty->id; - if ($objecttmp->element == 'expensereport') $trackid='use'.$thirdparty->id; - if ($objecttmp->element == 'holiday') $trackid='use'.$thirdparty->id; - } - else - { - $trackid=strtolower(get_class($objecttmp)); - if (get_class($objecttmp)=='Contrat') $trackid='con'; - if (get_class($objecttmp)=='Propal') $trackid='pro'; - if (get_class($objecttmp)=='Commande') $trackid='ord'; - if (get_class($objecttmp)=='Facture') $trackid='inv'; - if (get_class($objecttmp)=='Supplier_Proposal') $trackid='spr'; - if (get_class($objecttmp)=='CommandeFournisseur') $trackid='sor'; - if (get_class($objecttmp)=='FactureFournisseur') $trackid='sin'; + $subject=make_substitutions($subject, $substitutionarray); + $message=make_substitutions($message, $substitutionarray); - $trackid.=$objecttmp->id; - } - //var_dump($filepath); - //var_dump($trackid);exit; + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; - // Send mail (substitutionarray must be done just before this) - require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); - if ($mailfile->error) - { - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " + // Define the trackid when emails sent from the mass action + if ($oneemailperrecipient) + { + $trackid='thi'.$thirdparty->id; + if ($objecttmp->element == 'expensereport') $trackid='use'.$thirdparty->id; + if ($objecttmp->element == 'holiday') $trackid='use'.$thirdparty->id; + } + else + { + $trackid=strtolower(get_class($objecttmp)); + if (get_class($objecttmp)=='Contrat') $trackid='con'; + if (get_class($objecttmp)=='Propal') $trackid='pro'; + if (get_class($objecttmp)=='Commande') $trackid='ord'; + if (get_class($objecttmp)=='Facture') $trackid='inv'; + if (get_class($objecttmp)=='Supplier_Proposal') $trackid='spr'; + if (get_class($objecttmp)=='CommandeFournisseur') $trackid='sor'; + if (get_class($objecttmp)=='FactureFournisseur') $trackid='sin'; - $error=0; + $trackid.=$objecttmp->id; + } + //var_dump($filepath); + //var_dump($trackid);exit; - // Insert logs into agenda - foreach($listofqualifiedobj as $objid => $objectobj) - { - dol_syslog("Try to insert email event into agenda for objid=".$objid." => objectobj=".get_class($objectobj)); + // Send mail (substitutionarray must be done just before this) + require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject,$sendto,$from,$message,$filepath,$mimetype,$filename,$sendtocc,$sendtobcc,$deliveryreceipt,-1,'','',$trackid); + if ($mailfile->error) + { + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $resaction.=$langs->trans('MailSuccessfulySent',$mailfile->getValidAddress($from,2),$mailfile->getValidAddress($sendto,2)).'
'; // Must not contain " - /*if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; - if ($objectclass == 'Commande') $actiontypecode='AC_COM'; - if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; - if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; - if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; - if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/ + $error=0; - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); - $actionmsg = dol_concatdesc($actionmsg, $message); - } - $actionmsg2=''; + // Insert logs into agenda + foreach($listofqualifiedobj as $objid2 => $objectobj2) + { + if ((! $oneemailperrecipient) && $objid2 != $objectid) continue; // We discard this pass to avoid duplicate with other pass in looparray at higher level - // Initialisation donnees - $objectobj->sendtoid = 0; - $objectobj->actionmsg = $actionmsg; // Long text - $objectobj->actionmsg2 = $actionmsg2; // Short text - $objectobj->fk_element = $objid; - $objectobj->elementtype = $objectobj->element; + dol_syslog("Try to insert email event into agenda for objid=".$objid2." => objectobj=".get_class($objectobj2)); - $triggername = strtoupper(get_class($objectobj)) .'_SENTBYMAIL'; - if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYMAIL'; - if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYMAIL'; - if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYMAIL'; - if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL'; - if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYMAIL'; - if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL'; - if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYMAIL'; - if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL'; + /*if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; + if ($objectclass == 'Commande') $actiontypecode='AC_COM'; + if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; + if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; + if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; + if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/ - if (! empty($triggername)) - { - // Appel des triggers - include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"; - $interface=new Interfaces($db); - $result=$interface->run_triggers($triggername, $objectobj, $user, $langs, $conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + if ($message) + { + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + $actionmsg2=''; - if ($error) - { - setEventMessages($db->lasterror(), $errors, 'errors'); - dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR); - } - } + // Initialisation donnees + $objectobj2->sendtoid = 0; + $objectobj2->actionmsg = $actionmsg; // Long text + $objectobj2->actionmsg2 = $actionmsg2; // Short text + $objectobj2->fk_element = $objid2; + $objectobj2->elementtype = $objectobj2->element; - $nbsent++; - } - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; - } - } - } - } - } - } + $triggername = strtoupper(get_class($objectobj2)) .'_SENTBYMAIL'; + if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYMAIL'; + if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYMAIL'; + if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYMAIL'; + if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL'; + if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYMAIL'; + if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL'; + if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYMAIL'; + if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL'; - $resaction.=($resaction?'
':$resaction); - $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; - $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; - $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; - $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; + if (! empty($triggername)) + { + // Appel des triggers + include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"; + $interface=new Interfaces($db); + $result=$interface->run_triggers($triggername, $objectobj2, $user, $langs, $conf); + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers - if ($nbsent) - { - $action=''; // Do not show form post if there was at least one successfull sent - //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); - setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); - setEventMessages($resaction, null, 'mesgs'); - } - else - { - //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file - setEventMessages($resaction, null, 'warnings'); - } + if ($error) + { + setEventMessages($db->lasterror(), $errors, 'errors'); + dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR); + } + } + } - $action='list'; - $massaction=''; - } + $nbsent++; // Nb of email sent (may be lower than number of record selected if we group thirdparties) + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $resaction.=$langs->trans('ErrorFailedToSendMail',$from,$sendto); + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; + } + } + } + } + } + } + + $resaction.=($resaction?'
':$resaction); + $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; + $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; + $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; + $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; + + if ($nbsent) + { + $action=''; // Do not show form post if there was at least one successfull sent + //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($resaction, null, 'mesgs'); + } + else + { + //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file + setEventMessages($resaction, null, 'warnings'); + } + + $action='list'; + $massaction=''; + } } -if ($massaction == 'confirm_createbills') +if ($massaction == 'confirm_createbills') // Create bills from orders { - $orders = GETPOST('toselect','array'); - $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('valdate_invoices', 'int'); + $orders = GETPOST('toselect','array'); + $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); + $validate_invoices = GETPOST('valdate_invoices', 'int'); - $TFact = array(); - $TFactThird = array(); + $TFact = array(); + $TFactThird = array(); - $nb_bills_created = 0; + $nb_bills_created = 0; - $db->begin(); + $db->begin(); - foreach($orders as $id_order) - { - $cmd = new Commande($db); - if ($cmd->fetch($id_order) <= 0) continue; + foreach($orders as $id_order) + { + $cmd = new Commande($db); + if ($cmd->fetch($id_order) <= 0) continue; - $objecttmp = new Facture($db); - if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. - else { - // Load extrafields of order - $cmd->fetch_optionals(); - - $objecttmp->socid = $cmd->socid; - $objecttmp->type = Facture::TYPE_STANDARD; - $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; - $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; - $objecttmp->fk_project = $cmd->fk_project; + $objecttmp = new Facture($db); + if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + else { + // Load extrafields of order + $cmd->fetch_optionals(); - $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); - if (empty($datefacture)) - { - $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); - } + $objecttmp->socid = $cmd->socid; + $objecttmp->type = Facture::TYPE_STANDARD; + $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; + $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; + $objecttmp->fk_project = $cmd->fk_project; - $objecttmp->date = $datefacture; - $objecttmp->origin = 'commande'; - $objecttmp->origin_id = $id_order; + $datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); + if (empty($datefacture)) + { + $datefacture = dol_mktime(date("h"), date("M"), 0, date("m"), date("d"), date("Y")); + } - $objecttmp->array_options = $cmd->array_options; // Copy extrafields + $objecttmp->date = $datefacture; + $objecttmp->origin = 'commande'; + $objecttmp->origin_id = $id_order; - $res = $objecttmp->create($user); + $objecttmp->array_options = $cmd->array_options; // Copy extrafields - if($res > 0) $nb_bills_created++; - } + $res = $objecttmp->create($user); - if ($objecttmp->id > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; - $sql.= "fk_source"; - $sql.= ", sourcetype"; - $sql.= ", fk_target"; - $sql.= ", targettype"; - $sql.= ") VALUES ("; - $sql.= $id_order; - $sql.= ", '".$objecttmp->origin."'"; - $sql.= ", ".$objecttmp->id; - $sql.= ", '".$objecttmp->element."'"; - $sql.= ")"; + if($res > 0) $nb_bills_created++; + } - if (! $db->query($sql)) - { - $error++; - } + if ($objecttmp->id > 0) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; + $sql.= "fk_source"; + $sql.= ", sourcetype"; + $sql.= ", fk_target"; + $sql.= ", targettype"; + $sql.= ") VALUES ("; + $sql.= $id_order; + $sql.= ", '".$objecttmp->origin."'"; + $sql.= ", ".$objecttmp->id; + $sql.= ", '".$objecttmp->element."'"; + $sql.= ")"; - if (! $error) - { - $lines = $cmd->lines; - if (empty($lines) && method_exists($cmd, 'fetch_lines')) - { - $cmd->fetch_lines(); - $lines = $cmd->lines; - } + if (! $db->query($sql)) + { + $error++; + } - $fk_parent_line=0; - $num=count($lines); + if (! $error) + { + $lines = $cmd->lines; + if (empty($lines) && method_exists($cmd, 'fetch_lines')) + { + $cmd->fetch_lines(); + $lines = $cmd->lines; + } - for ($i=0;$i<$num;$i++) - { - $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); - if ($lines[$i]->subprice < 0) - { - // Negative line, we create a discount line - $discount = new DiscountAbsolute($db); - $discount->fk_soc=$objecttmp->socid; - $discount->amount_ht=abs($lines[$i]->total_ht); - $discount->amount_tva=abs($lines[$i]->total_tva); - $discount->amount_ttc=abs($lines[$i]->total_ttc); - $discount->tva_tx=$lines[$i]->tva_tx; - $discount->fk_user=$user->id; - $discount->description=$desc; - $discountid=$discount->create($user); - if ($discountid > 0) - { - $result=$objecttmp->insert_discount($discountid); - //$result=$discount->link_to_invoice($lineid,$id); - } - else - { - setEventMessages($discount->error, $discount->errors, 'errors'); - $error++; - break; - } - } - else - { - // Positive line - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - // Date start - $date_start=false; - if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - //Date end - $date_end=false; - if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) - { - $fk_parent_line = 0; - } + $fk_parent_line=0; + $num=count($lines); - // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); - $array_options = $lines[$i]->array_options; - } + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + if ($lines[$i]->subprice < 0) + { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$objecttmp->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$objecttmp->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + break; + } + } + else + { + // Positive line + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + // Date start + $date_start=false; + if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + //Date end + $date_end=false; + if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) + { + $fk_parent_line = 0; + } - $result = $objecttmp->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $ii, - $lines[$i]->special_code, - $objecttmp->origin, - $lines[$i]->rowid, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $lines[$i]->label, - $array_options - ); - if ($result > 0) - { - $lineid=$result; - } - else - { - $lineid=0; - $error++; - break; - } - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) - { - $fk_parent_line = $result; - } - } - } - } - } + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_options = $lines[$i]->array_options; + } - //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. + $result = $objecttmp->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $ii, + $lines[$i]->special_code, + $objecttmp->origin, + $lines[$i]->rowid, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $lines[$i]->label, + $array_options + ); + if ($result > 0) + { + $lineid=$result; + } + else + { + $lineid=0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) + { + $fk_parent_line = $result; + } + } + } + } + } - if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp; - else $TFact[$objecttmp->id] = $objecttmp; - } + //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. - // Build doc with all invoices - $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; - $toselect = array(); + if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp; + else $TFact[$objecttmp->id] = $objecttmp; + } - if (! $error && $validate_invoices) - { - $massaction = $action = 'builddoc'; + // Build doc with all invoices + $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; + $toselect = array(); - foreach($TAllFact as &$objecttmp) - { - $result = $objecttmp->validate($user); - if ($result <= 0) - { - $error++; - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - break; - } + if (! $error && $validate_invoices) + { + $massaction = $action = 'builddoc'; - $id = $objecttmp->id; // For builddoc action - $object = $objecttmp; + foreach($TAllFact as &$objecttmp) + { + $result = $objecttmp->validate($user); + if ($result <= 0) + { + $error++; + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + break; + } - // Builddoc - $donotredirect = 1; - $upload_dir = $conf->facture->dir_output; - $permissioncreate=$user->rights->facture->creer; + $id = $objecttmp->id; // For builddoc action + $object = $objecttmp; - // Call action to build doc - $savobject = $object; - $object = $objecttmp; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - $object = $savobject; - } + // Builddoc + $donotredirect = 1; + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; - $massaction = $action = 'confirm_createbills'; - } + // Call action to build doc + $savobject = $object; + $object = $objecttmp; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; + } - if (! $error) - { - $db->commit(); - setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); + $massaction = $action = 'confirm_createbills'; + } - // Make a redirect to avoid to bill twice if we make a refresh or back - $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); - if ($sall) $param.='&sall='.urlencode($sall); - if ($socid > 0) $param.='&socid='.urlencode($socid); - if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); - if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); - if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); - if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); - if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); - if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); - if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_company) $param.='&search_company='.urlencode($search_company); - if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); - if ($search_user > 0) $param.='&search_user='.urlencode($search_user); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); - if ($show_files) $param.='&show_files=' .urlencode($show_files); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($billed != '') $param.='&billed='.urlencode($billed); + if (! $error) + { + $db->commit(); + setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); - header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); - exit; - } - else - { - $db->rollback(); - $action='create'; - $_GET["origin"]=$_POST["origin"]; - $_GET["originid"]=$_POST["originid"]; - setEventMessages("Error", null, 'errors'); - $error++; - } + // Make a redirect to avoid to bill twice if we make a refresh or back + $param=''; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($sall) $param.='&sall='.urlencode($sall); + if ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); + if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); + if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); + if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); + if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); + if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); + + header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); + exit; + } + else + { + $db->rollback(); + $action='create'; + $_GET["origin"]=$_POST["origin"]; + $_GET["originid"]=$_POST["originid"]; + setEventMessages("Error", null, 'errors'); + $error++; + } } if (!$error && $massaction == 'cancelorders') { + $db->begin(); - $db->begin(); - - $nbok = 0; + $nbok = 0; - $orders = GETPOST('toselect', 'array'); - foreach ($orders as $id_order) - { + $orders = GETPOST('toselect', 'array'); + foreach ($orders as $id_order) + { - $cmd = new Commande($db); - if ($cmd->fetch($id_order) <= 0) - continue; + $cmd = new Commande($db); + if ($cmd->fetch($id_order) <= 0) + continue; - if ($cmd->statut != Commande::STATUS_VALIDATED) - { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); - $error++; - break; - } - else - $result = $cmd->cancel(); + if ($cmd->statut != Commande::STATUS_VALIDATED) + { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); + $error++; + break; + } + else + $result = $cmd->cancel(); - if ($result < 0) - { - setEventMessages($cmd->error, $cmd->errors, 'errors'); - $error++; - break; - } - else - $nbok++; - } - if (!$error) - { - if ($nbok > 1) - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } + if ($result < 0) + { + setEventMessages($cmd->error, $cmd->errors, 'errors'); + $error++; + break; + } + else + $nbok++; + } + if (!$error) + { + if ($nbok > 1) + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } } if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search')) { - if (empty($diroutputmassaction)) - { - dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined'); - exit; - } + if (empty($diroutputmassaction)) + { + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined'); + exit; + } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $objecttmp=new $objectclass($db); - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); - foreach($toselect as $toselectid) - { - $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofobjectid[$toselectid]=$toselectid; - $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$toselectid]=$objecttmp->ref; - } - } + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofobjectid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$toselectid]=$objecttmp->ref; + } + } - $arrayofinclusion=array(); - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'\.pdf$'; - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files - $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); + $arrayofinclusion=array(); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'\.pdf$'; + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf),'/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $listoffiles = dol_dir_list($uploaddir,'all',1,implode('|',$arrayofinclusion),'\.meta$|\.png','date',SORT_DESC,0,true); - // build list of files with full path - $files = array(); - foreach($listofobjectref as $basename) - { - $basename = dol_sanitizeFileName($basename); - foreach($listoffiles as $filefound) - { - if (strstr($filefound["name"],$basename)) - { - $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; - break; - } - } - } + // build list of files with full path + $files = array(); + foreach($listofobjectref as $basename) + { + $basename = dol_sanitizeFileName($basename); + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"],$basename)) + { + $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; + break; + } + } + } - // Define output language (Here it is not used because we do only merging existing PDF) - $outputlangs = $langs; - $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=$objecttmp->thirdparty->default_lang; - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } + // Define output language (Here it is not used because we do only merging existing PDF) + $outputlangs = $langs; + $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=$objecttmp->thirdparty->default_lang; + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } - if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) - { - // Create output dir if not exists - dol_mkdir($diroutputmassaction); + if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) + { + // Create output dir if not exists + dol_mkdir($diroutputmassaction); - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); - // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; + // Save merged file + if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; - if (count($files)>0) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + if (count($files)>0) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $input_files = ''; - foreach($files as $f) { - $input_files.=' '.escapeshellarg($f); - } + $input_files = ''; + foreach($files as $f) { + $input_files.=' '.escapeshellarg($f); + } - $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); - exec($cmd); + $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); + exec($cmd); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); - } - } - else { - // Create empty PDF - $formatarray=pdf_getFormat(); - $page_largeur = $formatarray['width']; - $page_hauteur = $formatarray['height']; - $format = array($page_largeur,$page_hauteur); + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } + } + else { + // Create empty PDF + $formatarray=pdf_getFormat(); + $page_largeur = $formatarray['width']; + $page_hauteur = $formatarray['height']; + $format = array($page_largeur,$page_hauteur); - $pdf=pdf_getInstance($format); + $pdf=pdf_getInstance($format); - if (class_exists('TCPDF')) - { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - // Add all others - foreach($files as $file) - { - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) - { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } - } + // Add all others + foreach($files as $file) + { + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } - // Create output dir if not exists - dol_mkdir($diroutputmassaction); + // Create output dir if not exists + dol_mkdir($diroutputmassaction); - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/','_',$filename); + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/','_',$filename); - // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; - if ($pagecount) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; - $pdf->Output($file,'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + // Save merged file + if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + if ($pagecount) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now,'dayhourlog').'.pdf'; + $pdf->Output($file,'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); - } - } + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt',$filename.'_'.dol_print_date($now,'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } + } } // Remove a file from massaction area if ($action == 'remove_file') { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $langs->load("other"); - $upload_dir = $diroutputmassaction; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); - $action=''; + $langs->load("other"); + $upload_dir = $diroutputmassaction; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action=''; } // Validate records if (! $error && $massaction == 'validate' && $permtocreate) { - $objecttmp=new $objectclass($db); + $objecttmp=new $objectclass($db); - if ($objecttmp->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); - $error++; - } - if ($objecttmp->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); - $error++; - } - if (! $error) - { - $db->begin(); + if ($objecttmp->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); + $error++; + } + if ($objecttmp->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) + { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); + $error++; + } + if (! $error) + { + $db->begin(); - $nbok = 0; - foreach($toselect as $toselectid) - { - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - //if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - //else - $result = $objecttmp->validate($user); - if ($result == 0) - { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); - $error++; - break; - } - elseif ($result < 0) - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - else $nbok++; - } - else - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + //if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); + //else + $result = $objecttmp->validate($user); + if ($result == 0) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); + $error++; + break; + } + elseif ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } - if (! $error) - { - if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } - //var_dump($listofobjectthirdparties);exit; - } + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } } // Closed records if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclose) { @@ -1110,9 +1122,9 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo if (!$error) { if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); + else + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); } else { $db->rollback(); @@ -1121,127 +1133,127 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo // Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before) if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete) { - $db->begin(); + $db->begin(); - $objecttmp=new $objectclass($db); - $nbok = 0; - foreach($toselect as $toselectid) - { - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - // Refuse deletion for some objects/status - if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'

'; - continue; - } + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + // Refuse deletion for some objects/status + if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction',$objecttmp->ref).'

'; + continue; + } - if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; - $res = $db->query($sql); + if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; + $res = $db->query($sql); - if (!$res) - { - setEventMessage('ErrorRecordParentingNotModified', 'errors'); - $error++; - } - } + if (!$res) + { + setEventMessage('ErrorRecordParentingNotModified', 'errors'); + $error++; + } + } - if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - else $result = $objecttmp->delete($user); + if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); + else $result = $objecttmp->delete($user); - if ($result <= 0) - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - else $nbok++; - } - else - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } - if (! $error) - { - if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } - //var_dump($listofobjectthirdparties);exit; + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; } // Generate document foreach object according to model linked to object // @TODO : propose model selection if (! $error && $massaction == 'generate_doc' && $permtoread) { - $db->begin(); + $db->begin(); - $objecttmp=new $objectclass($db); - $nbok = 0; - foreach($toselect as $toselectid) - { - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $outputlangs = $langs; - $newlang=''; + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $outputlangs = $langs; + $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','aZ09')) $newlang=GETPOST('lang_id','aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->thirdparty->default_lang)) $newlang=$objecttmp->thirdparty->default_lang; // for proposal, order, invoice, ... + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && isset($objecttmp->default_lang)) $newlang=$objecttmp->default_lang; // for thirdparty + if (! empty($newlang)) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($newlang); + } - // To be sure vars is defined - if (empty($hidedetails)) $hidedetails=0; - if (empty($hidedesc)) $hidedesc=0; - if (empty($hideref)) $hideref=0; - if (empty($moreparams)) $moreparams=null; + // To be sure vars is defined + if (empty($hidedetails)) $hidedetails=0; + if (empty($hidedesc)) $hidedesc=0; + if (empty($hideref)) $hideref=0; + if (empty($moreparams)) $moreparams=null; - $result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); + $result= $objecttmp->generateDocument($objecttmp->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - if ($result <= 0) - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - else $nbok++; - } - else - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } - if (! $error) - { - if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } } $parameters['toselect']=$toselect; @@ -1249,6 +1261,3 @@ $parameters['uploaddir']=$uploaddir; $reshook=$hookmanager->executeHooks('doMassActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - - - diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 183585d986b..655c3e62efd 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -121,17 +121,17 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO $thirdparty=$object->thirdparty; $sendtosocid=$thirdparty->id; } - else if ($object->element == 'member' || $object->element == 'user') + elseif ($object->element == 'member' || $object->element == 'user') { $thirdparty=$object; if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id; } - else if ($object->element == 'societe') + elseif ($object->element == 'societe') { $thirdparty=$object; if ($thirdparty->id > 0) $sendtosocid=$thirdparty->id; } - else if ($object->element == 'contact') + elseif ($object->element == 'contact') { $contact=$object; if ($contact->id > 0) $sendtosocid=$contact->fetch_thirdparty()->id; diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index 03ff1491e49..fec4ef08c11 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -114,4 +114,3 @@ if ($action == 'setModuleOptions') if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); } } - diff --git a/htdocs/core/actions_setnotes.inc.php b/htdocs/core/actions_setnotes.inc.php index ec253d5ef4a..511adbf9e3e 100644 --- a/htdocs/core/actions_setnotes.inc.php +++ b/htdocs/core/actions_setnotes.inc.php @@ -61,7 +61,7 @@ if ($action == 'setnote_public' && ! empty($permissionnote) && ! GETPOST('cancel } } // Set public note -else if ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel','alpha')) +elseif ($action == 'setnote_private' && ! empty($permissionnote) && ! GETPOST('cancel','alpha')) { if (empty($action) || ! is_object($object) || empty($id)) dol_print_error('','Include of actions_setnotes.inc.php was done but required variable was not set before'); if (empty($object->id)) $object->fetch($id); // Fetch may not be already done diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index bfbf35b019c..4164b2e41de 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -185,33 +185,33 @@ if ($type == 'directory') // Auto area for suppliers invoices if ($module == 'company') $upload_dir = $conf->societe->dir_output; // Auto area for suppliers invoices - else if ($module == 'invoice') $upload_dir = $conf->facture->dir_output; + elseif ($module == 'invoice') $upload_dir = $conf->facture->dir_output; // Auto area for suppliers invoices - else if ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output; + elseif ($module == 'invoice_supplier') $upload_dir = $conf->fournisseur->facture->dir_output; // Auto area for customers proposal - else if ($module == 'propal') $upload_dir = $conf->propal->dir_output; + elseif ($module == 'propal') $upload_dir = $conf->propal->dir_output; // Auto area for suppliers proposal - else if ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output; + elseif ($module == 'supplier_proposal') $upload_dir = $conf->supplier_proposal->dir_output; // Auto area for customers orders - else if ($module == 'order') $upload_dir = $conf->commande->dir_output; + elseif ($module == 'order') $upload_dir = $conf->commande->dir_output; // Auto area for suppliers orders - else if ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output; + elseif ($module == 'order_supplier') $upload_dir = $conf->fournisseur->commande->dir_output; // Auto area for suppliers invoices - else if ($module == 'contract') $upload_dir = $conf->contrat->dir_output; + elseif ($module == 'contract') $upload_dir = $conf->contrat->dir_output; // Auto area for products - else if ($module == 'product') $upload_dir = $conf->product->dir_output; + elseif ($module == 'product') $upload_dir = $conf->product->dir_output; // Auto area for suppliers invoices - else if ($module == 'tax') $upload_dir = $conf->tax->dir_output; + elseif ($module == 'tax') $upload_dir = $conf->tax->dir_output; // Auto area for projects - else if ($module == 'project') $upload_dir = $conf->projet->dir_output; + elseif ($module == 'project') $upload_dir = $conf->projet->dir_output; // Auto area for interventions - else if ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output; + elseif ($module == 'fichinter') $upload_dir = $conf->ficheinter->dir_output; // Auto area for users - else if ($module == 'user') $upload_dir = $conf->user->dir_output; + elseif ($module == 'user') $upload_dir = $conf->user->dir_output; // Auto area for expense report - else if ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; + elseif ($module == 'expensereport') $upload_dir = $conf->expensereport->dir_output; // Auto area for holiday - else if ($module == 'holiday') $upload_dir = $conf->holiday->dir_output; + elseif ($module == 'holiday') $upload_dir = $conf->holiday->dir_output; // Automatic list if (in_array($module, $automodules)) @@ -280,7 +280,7 @@ if ($type == 'directory') $textifempty = $langs->trans('NoFileFound'); } - else if ($section === '0') + elseif ($section === '0') { if ($module == 'ecm') $textifempty='
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; else $textifempty = $langs->trans('NoFileFound'); diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index d90a3f5f316..422cf455704 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -337,7 +337,7 @@ if ((! isset($mode) || $mode != 'noajax') && is_object($db)) $db->close(); * @param int $depth Depth * @return void */ -function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth=0) +function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, $modulepart, $websitekey, $pageid, $preopened, $fullpathpreopened, $depth = 0) { global $conf, $db, $langs, $form; global $dolibarr_main_data_root; @@ -491,4 +491,3 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, else print "PermissionDenied"; } } - diff --git a/htdocs/core/ajax/bankconciliate.php b/htdocs/core/ajax/bankconciliate.php index e5bfb674e8f..47e86864d89 100644 --- a/htdocs/core/ajax/bankconciliate.php +++ b/htdocs/core/ajax/bankconciliate.php @@ -94,4 +94,3 @@ if (($user->rights->banque->modifier || $user->rights->banque->consolidate) && $ exit; } - diff --git a/htdocs/core/ajax/box.php b/htdocs/core/ajax/box.php index 93b317a43c9..664af93822b 100644 --- a/htdocs/core/ajax/box.php +++ b/htdocs/core/ajax/box.php @@ -77,4 +77,3 @@ if ($boxorder && $zone != '' && $userid > 0) } } } - diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index a5c73655bab..35d465ae632 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -116,4 +116,3 @@ if ($time >= $_SESSION['auto_check_events_not_before']) } print json_encode($eventfound); - diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index 0f733f4df5c..4a7d9fc5bd1 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -58,10 +58,9 @@ if (! empty($action) && ! empty($name)) { dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); } - else if ($action == 'del') + elseif ($action == 'del') { dolibarr_del_const($db, $name, $entity); } } } - diff --git a/htdocs/core/ajax/contacts.php b/htdocs/core/ajax/contacts.php index 777fa076639..b1c9d7a82fa 100644 --- a/htdocs/core/ajax/contacts.php +++ b/htdocs/core/ajax/contacts.php @@ -54,4 +54,3 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) echo json_encode($return); } - diff --git a/htdocs/core/ajax/extraparams.php b/htdocs/core/ajax/extraparams.php index e5972d29d70..0dd7f3ff016 100644 --- a/htdocs/core/ajax/extraparams.php +++ b/htdocs/core/ajax/extraparams.php @@ -52,18 +52,18 @@ if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type)) // For compatibility if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } - else if ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } - else if ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } - else if ($element == 'contract') { $classpath = $subelement = 'contrat'; } - else if ($element == 'shipping') { $classpath = $subelement = 'expedition'; } - else if ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } - else if ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } - else if ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } + elseif ($element == 'propal') { $classpath = 'comm/propal'; $subelement = 'propal'; } + elseif ($element == 'facture') { $classpath = 'compta/facture'; $subelement = 'facture'; } + elseif ($element == 'contract') { $classpath = $subelement = 'contrat'; } + elseif ($element == 'shipping') { $classpath = $subelement = 'expedition'; } + elseif ($element == 'deplacement') { $classpath = 'compta/deplacement'; $subelement = 'deplacement'; } + elseif ($element == 'order_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.commande'; } + elseif ($element == 'invoice_supplier') { $classpath = 'fourn'; $subelement = 'fournisseur.facture'; } dol_include_once('/'.$classpath.'/class/'.$subelement.'.class.php'); if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } - else if ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } + elseif ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } else $classname = ucfirst($subelement); $object = new $classname($db); @@ -74,4 +74,3 @@ if(! empty($id) && ! empty($element) && ! empty($htmlelement) && ! empty($type)) $result=$object->setExtraParameters(); } - diff --git a/htdocs/core/ajax/fileupload.php b/htdocs/core/ajax/fileupload.php index 1cf5678cb00..dd7fcd88131 100644 --- a/htdocs/core/ajax/fileupload.php +++ b/htdocs/core/ajax/fileupload.php @@ -73,4 +73,3 @@ switch ($_SERVER['REQUEST_METHOD']) { } $db->close(); - diff --git a/htdocs/core/ajax/getaccountcurrency.php b/htdocs/core/ajax/getaccountcurrency.php index d58c81efdba..46244f8ec7a 100644 --- a/htdocs/core/ajax/getaccountcurrency.php +++ b/htdocs/core/ajax/getaccountcurrency.php @@ -54,4 +54,3 @@ if (! empty($id)) echo json_encode($return); } - diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index abf3efba7db..5123d5e6202 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -56,14 +56,14 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } if ($element == 'propal') $element = 'propale'; - else if ($element == 'fichinter') $element = 'ficheinter'; - else if ($element == 'product') $element = 'produit'; - else if ($element == 'member') $element = 'adherent'; - else if ($element == 'order_supplier') { + elseif ($element == 'fichinter') $element = 'ficheinter'; + elseif ($element == 'product') $element = 'produit'; + elseif ($element == 'member') $element = 'adherent'; + elseif ($element == 'order_supplier') { $element = 'fournisseur'; $subelement = 'commande'; } - else if ($element == 'invoice_supplier') { + elseif ($element == 'invoice_supplier') { $element = 'fournisseur'; $subelement = 'facture'; } @@ -84,7 +84,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ $ret = $form->$methodname(); if ($ret > 0) echo json_encode($form->$cachename); } - else if (! empty($ext_element)) + elseif (! empty($ext_element)) { $module = $subelement = $ext_element; if (preg_match('/^([^_]+)_([^_]+)/i',$ext_element,$regs)) @@ -112,4 +112,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ echo $langs->transnoentities('NotEnoughPermissions'); } } - diff --git a/htdocs/core/ajax/price.php b/htdocs/core/ajax/price.php index 3eab18216d1..614bad5e161 100644 --- a/htdocs/core/ajax/price.php +++ b/htdocs/core/ajax/price.php @@ -53,7 +53,7 @@ if (! empty($output) && isset($amount) && isset($tva_tx)) $return['price_ht'] = $amount; $return['price_ttc'] = (isset($price) && $price != '' ? price($price) : ''); } - else if ($output == 'price_ht') { + elseif ($output == 'price_ht') { $price = price2num($amount / (1 + ($tva_tx/100)), 'MU'); $return['price_ht'] = (isset($price) && $price != '' ? price($price) : ''); @@ -63,4 +63,3 @@ if (! empty($output) && isset($amount) && isset($tva_tx)) echo json_encode($return); } - diff --git a/htdocs/core/ajax/row.php b/htdocs/core/ajax/row.php index 5348f36976d..11c1d614304 100644 --- a/htdocs/core/ajax/row.php +++ b/htdocs/core/ajax/row.php @@ -73,4 +73,3 @@ if ((! empty($_POST['roworder'])) && (! empty($_POST['table_element_line'])) $result=$row->line_order(true); } } - diff --git a/htdocs/core/ajax/saveinplace.php b/htdocs/core/ajax/saveinplace.php index 188dcbb29da..a3546f8f782 100644 --- a/htdocs/core/ajax/saveinplace.php +++ b/htdocs/core/ajax/saveinplace.php @@ -79,14 +79,14 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ } if ($element == 'propal') $newelement = 'propale'; - else if ($element == 'fichinter') $newelement = 'ficheinter'; - else if ($element == 'product') $newelement = 'produit'; - else if ($element == 'member') $newelement = 'adherent'; - else if ($element == 'order_supplier') { + elseif ($element == 'fichinter') $newelement = 'ficheinter'; + elseif ($element == 'product') $newelement = 'produit'; + elseif ($element == 'member') $newelement = 'adherent'; + elseif ($element == 'order_supplier') { $newelement = 'fournisseur'; $subelement = 'commande'; } - else if ($element == 'invoice_supplier') { + elseif ($element == 'invoice_supplier') { $newelement = 'fournisseur'; $subelement = 'facture'; } @@ -131,13 +131,13 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ $return['error'] = $langs->trans('ErrorBadValue'); } } - else if ($type == 'datepicker') + elseif ($type == 'datepicker') { $timestamp = GETPOST('timestamp','int',2); $format = 'date'; $newvalue = ($timestamp / 1000); } - else if ($type == 'select') + elseif ($type == 'select') { $loadmethodname = 'load_cache_'.$loadmethod; $loadcachename = 'cache_'.$loadmethod; @@ -211,7 +211,7 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ if ($ret > 0) { if ($type == 'numeric') $value = price($newvalue); - else if ($type == 'textarea') $value = dol_nl2br($newvalue); + elseif ($type == 'textarea') $value = dol_nl2br($newvalue); $return['value'] = $value; $return['view'] = (! empty($view) ? $view : $value); @@ -229,4 +229,3 @@ if (! empty($field) && ! empty($element) && ! empty($table_element) && ! empty($ echo $langs->trans('NotEnoughPermissions'); } } - diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index d6bfe51b45c..0ed7545b4cf 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -49,4 +49,3 @@ if (isset($_GET['action']) && ! empty($_GET['action'])) echo getRandomPassword($generic); } } - diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 8d6c4fe0c31..c8ca10b21b4 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -170,4 +170,3 @@ if (! isset($usedbyinclude) || empty($usedbyinclude)) print json_encode($arrayresult); if (is_object($db)) $db->close(); } - diff --git a/htdocs/core/ajax/vatrates.php b/htdocs/core/ajax/vatrates.php index 8fe38d02552..29070c57985 100644 --- a/htdocs/core/ajax/vatrates.php +++ b/htdocs/core/ajax/vatrates.php @@ -67,4 +67,3 @@ if (! empty($id) && ! empty($action) && ! empty($htmlname)) echo json_encode($return); } - diff --git a/htdocs/core/ajax/ziptown.php b/htdocs/core/ajax/ziptown.php index c1af6a2ac22..a7d40a69aba 100644 --- a/htdocs/core/ajax/ziptown.php +++ b/htdocs/core/ajax/ziptown.php @@ -135,4 +135,3 @@ else } $db->close(); - diff --git a/htdocs/core/antispamimage.php b/htdocs/core/antispamimage.php index 7f0f2bde12f..9d0f8e46ad2 100644 --- a/htdocs/core/antispamimage.php +++ b/htdocs/core/antispamimage.php @@ -65,4 +65,3 @@ $background_color = imagecolorallocate($img, 250, 250, 250); $ecriture_color = imagecolorallocate($img, 0, 0, 0); imagestring($img, 4, 24, 8, $string, $ecriture_color); imagepng($img); - diff --git a/htdocs/core/boxes/box_actions.php b/htdocs/core/boxes/box_actions.php index aea85fd111e..0c2e6651848 100644 --- a/htdocs/core/boxes/box_actions.php +++ b/htdocs/core/boxes/box_actions.php @@ -54,7 +54,7 @@ class box_actions extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $user; @@ -69,7 +69,7 @@ class box_actions extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -189,7 +189,7 @@ class box_actions extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { global $langs, $conf; $out = parent::showBox($this->info_box_head, $this->info_box_contents); @@ -260,4 +260,3 @@ class box_actions extends ModeleBoxes return ''; } } - diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 413dc43d8b2..e18114a5bc7 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -53,7 +53,7 @@ class box_activity extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $conf, $user; @@ -74,7 +74,7 @@ class box_activity extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -457,7 +457,7 @@ class box_activity extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_bookmarks.php b/htdocs/core/boxes/box_bookmarks.php index c3a29877104..7213019754c 100644 --- a/htdocs/core/boxes/box_bookmarks.php +++ b/htdocs/core/boxes/box_bookmarks.php @@ -50,7 +50,7 @@ class box_bookmarks extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -65,7 +65,7 @@ class box_bookmarks extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); @@ -157,9 +157,8 @@ class box_bookmarks extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_clients.php b/htdocs/core/boxes/box_clients.php index 9b1e4e34261..1fb09668799 100644 --- a/htdocs/core/boxes/box_clients.php +++ b/htdocs/core/boxes/box_clients.php @@ -54,7 +54,7 @@ class box_clients extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf, $user; @@ -72,7 +72,7 @@ class box_clients extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); @@ -173,9 +173,8 @@ class box_clients extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_commandes.php b/htdocs/core/boxes/box_commandes.php index 3f86909f04a..26f15f9cf13 100644 --- a/htdocs/core/boxes/box_commandes.php +++ b/htdocs/core/boxes/box_commandes.php @@ -54,7 +54,7 @@ class box_commandes extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -69,7 +69,7 @@ class box_commandes extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -198,9 +198,8 @@ class box_commandes extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_comptes.php b/htdocs/core/boxes/box_comptes.php index 5a5c2f59986..a5566fad1db 100644 --- a/htdocs/core/boxes/box_comptes.php +++ b/htdocs/core/boxes/box_comptes.php @@ -56,7 +56,7 @@ class box_comptes extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf, $user; @@ -75,7 +75,7 @@ class box_comptes extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -184,9 +184,8 @@ class box_comptes extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_contacts.php b/htdocs/core/boxes/box_contacts.php index 2d9d7e9461b..9ba8fc02cf9 100644 --- a/htdocs/core/boxes/box_contacts.php +++ b/htdocs/core/boxes/box_contacts.php @@ -56,7 +56,7 @@ class box_contacts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -71,7 +71,7 @@ class box_contacts extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); @@ -185,9 +185,8 @@ class box_contacts extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_contracts.php b/htdocs/core/boxes/box_contracts.php index 7239fa78919..8f0161fee9c 100644 --- a/htdocs/core/boxes/box_contracts.php +++ b/htdocs/core/boxes/box_contracts.php @@ -53,7 +53,7 @@ class box_contracts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -68,7 +68,7 @@ class box_contracts extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -189,9 +189,8 @@ class box_contracts extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_external_rss.php b/htdocs/core/boxes/box_external_rss.php index fa7d35f6db0..644eff9ae4c 100644 --- a/htdocs/core/boxes/box_external_rss.php +++ b/htdocs/core/boxes/box_external_rss.php @@ -56,7 +56,7 @@ class box_external_rss extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { $this->db=$db; $this->paramdef=$param; @@ -69,7 +69,7 @@ class box_external_rss extends ModeleBoxes * @param int $cachedelay Delay we accept for cache file * @return void */ - function loadBox($max=5, $cachedelay=3600) + function loadBox($max = 5, $cachedelay = 3600) { global $user, $langs, $conf; $langs->load("boxes"); @@ -195,9 +195,8 @@ class box_external_rss extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index ae4a32fad7c..b45c530a085 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -52,7 +52,7 @@ class box_factures extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -67,7 +67,7 @@ class box_factures extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -209,7 +209,7 @@ class box_factures extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 617f041d7d2..611f71578b7 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -53,7 +53,7 @@ class box_factures_fourn extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -68,7 +68,7 @@ class box_factures_fourn extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -214,9 +214,8 @@ class box_factures_fourn extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index bd8fde32aab..9957fb9cbf7 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -52,7 +52,7 @@ class box_factures_fourn_imp extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -67,7 +67,7 @@ class box_factures_fourn_imp extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -201,9 +201,8 @@ class box_factures_fourn_imp extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 11331f7f3e7..6193924ebc7 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -55,7 +55,7 @@ class box_factures_imp extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -70,7 +70,7 @@ class box_factures_imp extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -207,7 +207,7 @@ class box_factures_imp extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index 76d1414f53f..d76340023d3 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -53,7 +53,7 @@ class box_ficheinter extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -68,7 +68,7 @@ class box_ficheinter extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=10) + function loadBox($max = 10) { global $user, $langs, $db, $conf; @@ -166,9 +166,8 @@ class box_ficheinter extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_fournisseurs.php b/htdocs/core/boxes/box_fournisseurs.php index c66c7f674c2..a5e8ed77228 100644 --- a/htdocs/core/boxes/box_fournisseurs.php +++ b/htdocs/core/boxes/box_fournisseurs.php @@ -53,7 +53,7 @@ class box_fournisseurs extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -68,7 +68,7 @@ class box_fournisseurs extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; $langs->load("boxes"); @@ -160,9 +160,8 @@ class box_fournisseurs extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_goodcustomers.php b/htdocs/core/boxes/box_goodcustomers.php index 138326d6c01..adba592f516 100644 --- a/htdocs/core/boxes/box_goodcustomers.php +++ b/htdocs/core/boxes/box_goodcustomers.php @@ -55,7 +55,7 @@ class box_goodcustomers extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf, $user; @@ -74,7 +74,7 @@ class box_goodcustomers extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); @@ -169,9 +169,8 @@ class box_goodcustomers extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index fd0b4e593c0..0bac498a1b6 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -48,7 +48,7 @@ class box_graph_invoices_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -63,7 +63,7 @@ class box_graph_invoices_permonth extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -275,9 +275,8 @@ class box_graph_invoices_permonth extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index f13b19259c9..eb6b443c546 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -48,7 +48,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -63,7 +63,7 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -274,9 +274,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index fefa90c5fea..8ca192c189f 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -48,7 +48,7 @@ class box_graph_orders_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -63,7 +63,7 @@ class box_graph_orders_permonth extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -273,9 +273,8 @@ class box_graph_orders_permonth extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index e388d226fd2..7c59ecb6de1 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -48,7 +48,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -63,7 +63,7 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -272,9 +272,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 9dc4c162e0f..494f6cd98f9 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -51,7 +51,7 @@ class box_graph_product_distribution extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user, $conf; @@ -70,7 +70,7 @@ class box_graph_product_distribution extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -368,17 +368,17 @@ class box_graph_product_distribution extends ModeleBoxes if ($nbofgraph == 1) { if ($showinvoicenb) $stringtoshow.=$px1->show(); - else if ($showpropalnb) $stringtoshow.=$px2->show(); + elseif ($showpropalnb) $stringtoshow.=$px2->show(); else $stringtoshow.=$px3->show(); } if ($nbofgraph == 2) { $stringtoshow.='
'; if ($showinvoicenb) $stringtoshow.=$px1->show(); - else if ($showpropalnb) $stringtoshow.=$px2->show(); + elseif ($showpropalnb) $stringtoshow.=$px2->show(); $stringtoshow.='
'; if ($showordernb) $stringtoshow.=$px3->show(); - else if ($showpropalnb) $stringtoshow.=$px2->show(); + elseif ($showpropalnb) $stringtoshow.=$px2->show(); $stringtoshow.='
'; } if ($nbofgraph == 3) @@ -412,9 +412,8 @@ class box_graph_product_distribution extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index f28b0ec2c99..ddf95f8076e 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -48,7 +48,7 @@ class box_graph_propales_permonth extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -63,7 +63,7 @@ class box_graph_propales_permonth extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -276,9 +276,8 @@ class box_graph_propales_permonth extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php index 9ce7dd91605..34281d13c82 100644 --- a/htdocs/core/boxes/box_last_modified_ticket.php +++ b/htdocs/core/boxes/box_last_modified_ticket.php @@ -187,7 +187,7 @@ class box_last_modified_ticket extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php index a824a707168..a1a52c3070d 100644 --- a/htdocs/core/boxes/box_last_ticket.php +++ b/htdocs/core/boxes/box_last_ticket.php @@ -187,7 +187,7 @@ class box_last_ticket extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_lastlogin.php b/htdocs/core/boxes/box_lastlogin.php index c8149c6384b..d1ae1e7abf4 100644 --- a/htdocs/core/boxes/box_lastlogin.php +++ b/htdocs/core/boxes/box_lastlogin.php @@ -53,7 +53,7 @@ class box_lastlogin extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $conf; @@ -66,7 +66,7 @@ class box_lastlogin extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -109,7 +109,7 @@ class box_lastlogin extends ModeleBoxes * @param int $nooutput No print, only return string * @return void */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/box_members.php b/htdocs/core/boxes/box_members.php index b0f999f54f1..1d569302256 100644 --- a/htdocs/core/boxes/box_members.php +++ b/htdocs/core/boxes/box_members.php @@ -55,7 +55,7 @@ class box_members extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf, $user; @@ -74,7 +74,7 @@ class box_members extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; $langs->load("boxes"); @@ -178,9 +178,8 @@ class box_members extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 3dd66eb1da2..13b24352978 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -55,7 +55,7 @@ class box_produits extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $conf, $user; @@ -73,7 +73,7 @@ class box_produits extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf, $hookmanager; @@ -226,9 +226,8 @@ class box_produits extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 896ceb93df6..1b58320992c 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -57,7 +57,7 @@ class box_produits_alerte_stock extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf,$user; @@ -75,7 +75,7 @@ class box_produits_alerte_stock extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf, $hookmanager; @@ -238,9 +238,8 @@ class box_produits_alerte_stock extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_project.php b/htdocs/core/boxes/box_project.php index a48543a00f6..1edcce79b0f 100644 --- a/htdocs/core/boxes/box_project.php +++ b/htdocs/core/boxes/box_project.php @@ -51,7 +51,7 @@ class box_project extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $user, $langs; @@ -70,7 +70,7 @@ class box_project extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -195,9 +195,8 @@ class box_project extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index 2b3426f21b8..b99c389af63 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -54,7 +54,7 @@ class box_propales extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -69,7 +69,7 @@ class box_propales extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -188,9 +188,8 @@ class box_propales extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_prospect.php b/htdocs/core/boxes/box_prospect.php index a4382f86048..4861a5e2a8a 100644 --- a/htdocs/core/boxes/box_prospect.php +++ b/htdocs/core/boxes/box_prospect.php @@ -56,7 +56,7 @@ class box_prospect extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $conf, $user; @@ -74,7 +74,7 @@ class box_prospect extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -176,9 +176,8 @@ class box_prospect extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 708b781f092..513a9db79d9 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -54,7 +54,7 @@ class box_services_contracts extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -69,7 +69,7 @@ class box_services_contracts extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -241,9 +241,8 @@ class box_services_contracts extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index ed62e127816..596b585eab9 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -52,7 +52,7 @@ class box_services_expired extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -67,7 +67,7 @@ class box_services_expired extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $user, $langs, $db, $conf; @@ -185,9 +185,8 @@ class box_services_expired extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_supplier_orders.php b/htdocs/core/boxes/box_supplier_orders.php index 4621950843e..8e2e1b6e8e3 100644 --- a/htdocs/core/boxes/box_supplier_orders.php +++ b/htdocs/core/boxes/box_supplier_orders.php @@ -52,7 +52,7 @@ class box_supplier_orders extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param) + function __construct($db, $param) { global $user; @@ -184,9 +184,8 @@ class box_supplier_orders extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } } - diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index cf1e799e486..5f576c3a83d 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Frederic France + * Copyright (C) 2015-2019 Frederic 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 @@ -54,7 +54,7 @@ class box_task extends ModeleBoxes * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { global $user, $langs; @@ -73,7 +73,7 @@ class box_task extends ModeleBoxes * @param int $max Maximum number of records to load * @return void */ - function loadBox($max=5) + function loadBox($max = 5) { global $conf, $user, $langs, $db; @@ -104,12 +104,10 @@ class box_task extends ModeleBoxes $sql.= $db->plimit($max, 0); $result = $db->query($sql); - if ($result) - { + $i = 0; + if ($result) { $num = $db->num_rows($result); - $i = 0; - while ($i < $num) - { + while ($i < $num) { $objp = $db->fetch_object($result); $this->info_box_contents[$i][] = array( 'td' => '', @@ -131,11 +129,11 @@ class box_task extends ModeleBoxes $i++; } - } - else dol_print_error($this->db); + } else { + dol_print_error($this->db); + } } - // Add the sum at the bottom of the boxes $this->info_box_contents[$i][] = array('tr' => 'class="liste_total"', 'td' => '', 'text' => $langs->trans("Total")." ".$textHead); $this->info_box_contents[$i][] = array('td' => 'align="right" ', 'text' => number_format($totalnb, 0, ',', ' ')." ".$langs->trans("Tasks")); @@ -152,7 +150,7 @@ class box_task extends ModeleBoxes * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput); } diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 9ae35403ec7..2624599ba66 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -115,7 +115,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box * @param DoliDB $db Database handler * @param string $param More parameters */ - function __construct($db,$param='') + function __construct($db, $param = '') { $this->db=$db; } @@ -204,7 +204,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box * @param int $nooutput No print, only return string * @return string */ - function showBox($head = null, $contents = null, $nooutput=0) + function showBox($head = null, $contents = null, $nooutput = 0) { global $langs, $user, $conf; @@ -385,7 +385,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box * @param array $forcedirwidget null=All default directories. This parameter is used by modulebuilder module only. * @return array Array list of widget */ - static function getWidgetsList($forcedirwidget=null) + static function getWidgetsList($forcedirwidget = null) { global $conf, $langs, $db; @@ -503,5 +503,3 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box return $widget; } } - - diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 52d98790dcc..9b0ee84ceed 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -119,7 +119,7 @@ class CMailFile * @param string $sendcontext 'standard', 'emailing', ... (used to define with sending mode and parameters to use) * @param string $replyto Reply-to email (will be set to same value than From by default if not provided) */ - function __construct($subject, $to, $from, $msg, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=0, $errors_to='', $css='', $trackid='', $moreinheader='', $sendcontext='standard', $replyto='') + function __construct($subject, $to, $from, $msg, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = 0, $errors_to = '', $css = '', $trackid = '', $moreinheader = '', $sendcontext = 'standard', $replyto = '') { global $conf, $dolibarr_main_data_root; @@ -294,7 +294,7 @@ class CMailFile $this->message.= $text_body . $files_encoded; $this->message.= "--" . $this->mixed_boundary . "--" . $this->eol; } - else if ($this->sendmode == 'smtps') + elseif ($this->sendmode == 'smtps') { // Use SMTPS library // ------------------------------------------ @@ -349,7 +349,7 @@ class CMailFile $this->smtps=$smtps; } - else if ($this->sendmode == 'swiftmailer') + elseif ($this->sendmode == 'swiftmailer') { // Use Swift Mailer library // ------------------------------------------ @@ -670,7 +670,7 @@ class CMailFile if (! empty($conf->global->$keyforsmtpserver)) ini_restore('SMTP'); if (! empty($conf->global->$keyforsmtpport)) ini_restore('smtp_port'); } - else if ($this->sendmode == 'smtps') + elseif ($this->sendmode == 'smtps') { if (! is_object($this->smtps)) { @@ -750,7 +750,7 @@ class CMailFile } } } - else if ($this->sendmode == 'swiftmailer') + elseif ($this->sendmode == 'swiftmailer') { // Use Swift Mailer library // ------------------------------------------ @@ -1178,7 +1178,7 @@ class CMailFile * @param array $mimefilename_list Tableau * @return string Chaine fichiers encodes */ - function write_files($filename_list,$mimetype_list,$mimefilename_list) + function write_files($filename_list, $mimetype_list, $mimefilename_list) { // phpcs:enable $out = ''; @@ -1259,7 +1259,7 @@ class CMailFile * @param int $port Example: 25, 465 * @return int Socket id if ok, 0 if KO */ - function check_server_port($host,$port) + function check_server_port($host, $port) { // phpcs:enable global $conf; @@ -1457,7 +1457,7 @@ class CMailFile * If format 3: '' or '"John Doe" ' or '"=?UTF-8?B?Sm9obiBEb2U=?=" ' * If format 4: 'John Doe' or 'john@doe.com' if no label exists */ - static function getValidAddress($address,$format,$encode=0,$maxnumberofemail=0) + static function getValidAddress($address, $format, $encode = 0, $maxnumberofemail = 0) { global $conf; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 86ffed48551..ebdcad5ccf8 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -59,7 +59,7 @@ class CSMSFile * @param int $priority Priority * @param int $class Class */ - function __construct($to,$from,$msg,$deliveryreceipt=0,$deferred=0,$priority=3,$class=1) + function __construct($to, $from, $msg, $deliveryreceipt = 0, $deferred = 0, $priority = 3, $class = 1) { global $conf; @@ -139,7 +139,7 @@ class CSMSFile if (! empty($conf->global->MAIN_SMS_DEBUG)) $this->dump_sms_result($res); } } - else if (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' + elseif (! empty($conf->global->MAIN_SMS_SENDMODE)) // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' { $tmp=explode('@',$conf->global->MAIN_SMS_SENDMODE); $classfile=$tmp[0]; $module=(empty($tmp[1])?$tmp[0]:$tmp[1]); diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index 4694a5e4652..f822b178536 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -60,7 +60,7 @@ class Canvas * @param DoliDB $db Database handler * @param string $actiontype Action type ('create', 'view', 'edit', 'list') */ - function __construct($db, $actiontype='view') + function __construct($db, $actiontype = 'view') { $this->db = $db; @@ -142,7 +142,7 @@ class Canvas * @param string $ref Object ref (if id not provided) * @return void */ - function assign_values(&$action='view', $id=0, $ref='') + function assign_values(&$action = 'view', $id = 0, $ref = '') { // phpcs:enable if (method_exists($this->control,'assign_values')) $this->control->assign_values($action, $id, $ref); @@ -204,7 +204,7 @@ class Canvas * @return mixed Return return code of doActions of canvas * @see http://wiki.dolibarr.org/index.php/Canvas_development */ - function doActions(&$action='view', $id=0) + function doActions(&$action = 'view', $id = 0) { if (method_exists($this->control,'doActions')) { diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index f07916a7511..e93af622a27 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -86,7 +86,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -165,7 +165,7 @@ class Ccountry // extends CommonObject * @param string $code Code * @return int >0 if OK, 0 if not found, <0 if KO */ - function fetch($id,$code='') + function fetch($id, $code = '') { global $langs; $sql = "SELECT"; @@ -214,7 +214,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -285,7 +285,7 @@ class Ccountry // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 332f7e115ef..ddcce49cef4 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -82,7 +82,7 @@ class Comment extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; @@ -155,7 +155,7 @@ class Comment extends CommonObject * @param int $ref ref object * @return int <0 if KO, 0 if not found, >0 if OK */ - function fetch($id, $ref='') + function fetch($id, $ref = '') { global $langs; @@ -213,7 +213,7 @@ class Comment extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <=0 if KO, >0 if OK */ - function update(User $user, $notrigger=0) + function update(User $user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -278,7 +278,7 @@ class Comment extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php'; diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index 11bc678196a..79f266ed8a2 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -69,7 +69,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_user($user,$outputlangs) + function get_substitutionarray_user($user, $outputlangs) { // phpcs:enable global $conf; @@ -107,7 +107,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_mysoc($mysoc,$outputlangs) + function get_substitutionarray_mysoc($mysoc, $outputlangs) { // phpcs:enable global $conf; @@ -167,7 +167,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Language object for output * @return array Array of substitution key->code */ - function get_substitutionarray_thirdparty($object,$outputlangs) + function get_substitutionarray_thirdparty($object, $outputlangs) { // phpcs:enable global $conf; @@ -230,7 +230,7 @@ abstract class CommonDocGenerator { $object->array_options['options_'.$key] = price($object->array_options['options_'.$key],0,$outputlangs,0,0,-1,$conf->currency); } - else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') + elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') { $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } @@ -361,7 +361,7 @@ abstract class CommonDocGenerator * @param string $array_key Name of the key for return array * @return array Array of substitution */ - function get_substitutionarray_object($object,$outputlangs,$array_key='object') + function get_substitutionarray_object($object, $outputlangs, $array_key = 'object') { // phpcs:enable global $conf; @@ -472,6 +472,7 @@ abstract class CommonDocGenerator // Add vat by rates if (is_array($object->lines) && count($object->lines)>0) { + $totalUp = 0; foreach ($object->lines as $line) { // $line->tva_tx format depends on database field accuraty, no reliable. This is kept for backward comaptibility @@ -483,8 +484,20 @@ abstract class CommonDocGenerator if (empty($resarray[$array_key.'_total_vat_'.$vatformated])) $resarray[$array_key.'_total_vat_'.$vatformated]=0; $resarray[$array_key.'_total_vat_'.$vatformated]+=$line->total_tva; $resarray[$array_key.'_total_vat_locale_'.$vatformated]=price($resarray[$array_key.'_total_vat_'.$vatformated]); + + $totalUp += $line->subprice * $line->qty; + } + + // @GS: Calculate total up and total discount percentage + // Note that this added fields correspond to nothing in Dolibarr (Dolibarr manage discount on lines not globally) + $resarray['object_total_up'] = $totalUp; + $resarray['object_total_up_locale'] = price($resarray['object_total_up'], 0, $outputlangs); + if (method_exists($object, 'getTotalDiscount')) { + $resarray['object_total_discount'] = round(100 / $totalUp * $object->getTotalDiscount(), 2); + $resarray['object_total_discount_locale'] = price($resarray['object_total_discount'], 0, $outputlangs); } } + // Retrieve extrafields if (is_array($object->array_options) && count($object->array_options)) { @@ -497,6 +510,7 @@ abstract class CommonDocGenerator $resarray = $this->fill_substitutionarray_with_extrafields($object,$resarray,$extrafields,$array_key,$outputlangs); } + return $resarray; } @@ -523,6 +537,8 @@ abstract class CommonDocGenerator 'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits), 'line_up'=>price2num($line->subprice), 'line_up_locale'=>price($line->subprice, 0, $outputlangs), + 'line_total_up'=>price2num($line->subprice * $line->qty), + 'line_total_up_locale'=>price($line->subprice * $line->qty, 0, $outputlangs), 'line_qty'=>$line->qty, 'line_discount_percent'=>($line->remise_percent?$line->remise_percent.'%':''), 'line_price_ht'=>price2num($line->total_ht), @@ -588,7 +604,7 @@ abstract class CommonDocGenerator * @param array $array_key Name of the key for return array * @return array Array of substitution */ - function get_substitutionarray_shipment($object,$outputlangs,$array_key='object') + function get_substitutionarray_shipment($object, $outputlangs, $array_key = 'object') { // phpcs:enable global $conf; @@ -663,6 +679,7 @@ abstract class CommonDocGenerator 'line_desc'=>$line->desc, 'line_vatrate'=>vatrate($line->tva_tx,true,$line->info_bits), 'line_up'=>price($line->subprice), + 'line_total_up'=>price($line->subprice * $line->qty), 'line_qty'=>$line->qty, 'line_qty_shipped'=>$line->qty_shipped, 'line_qty_asked'=>$line->qty_asked, @@ -699,7 +716,7 @@ abstract class CommonDocGenerator * @param boolean $recursive Want to fetch child array or child object * @return array Array of substitution key->code */ - function get_substitutionarray_each_var_object(&$object,$outputlangs,$recursive=true) + function get_substitutionarray_each_var_object(&$object, $outputlangs, $recursive = true) { // phpcs:enable $array_other = array(); @@ -730,7 +747,7 @@ abstract class CommonDocGenerator * @param Translate $outputlangs Lang object to use for output * @return array Substitution array */ - function fill_substitutionarray_with_extrafields($object,$array_to_fill,$extrafields,$array_key,$outputlangs) + function fill_substitutionarray_with_extrafields($object, $array_to_fill, $extrafields, $array_key, $outputlangs) { // phpcs:enable global $conf; @@ -743,11 +760,11 @@ abstract class CommonDocGenerator //Add value to store price with currency $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_currency' => $object->array_options['options_'.$key.'_currency'])); } - else if($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') + elseif($extrafields->attribute_type[$key] == 'select' || $extrafields->attribute_type[$key] == 'checkbox') { $object->array_options['options_'.$key] = $extrafields->attribute_param[$key]['options'][$object->array_options['options_'.$key]]; } - else if($extrafields->attribute_type[$key] == 'date') + elseif($extrafields->attribute_type[$key] == 'date') { if (strlen($object->array_options['options_'.$key])>0) { @@ -765,7 +782,7 @@ abstract class CommonDocGenerator $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } - else if($extrafields->attribute_type[$key] == 'datetime') + elseif($extrafields->attribute_type[$key] == 'datetime') { $datetime = $object->array_options['options_'.$key]; $object->array_options['options_'.$key] = ($datetime!="0000-00-00 00:00:00"?dol_print_date($object->array_options['options_'.$key],'dayhour'):''); // using company output language @@ -774,7 +791,7 @@ abstract class CommonDocGenerator $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_locale' => $object->array_options['options_'.$key.'_locale'])); $array_to_fill=array_merge($array_to_fill,array($array_key.'_options_'.$key.'_rfc' => $object->array_options['options_'.$key.'_rfc'])); } - else if($extrafields->attribute_type[$key] == 'link') + elseif($extrafields->attribute_type[$key] == 'link') { $id = $object->array_options['options_'.$key]; if ($id != "") @@ -817,7 +834,7 @@ abstract class CommonDocGenerator * @param int $hidebottom Hide bottom * @return void */ - function printRect($pdf, $x, $y, $l, $h, $hidetop=0, $hidebottom=0) + function printRect($pdf, $x, $y, $l, $h, $hidetop = 0, $hidebottom = 0) { if (empty($hidetop) || $hidetop==-1) $pdf->line($x, $y, $x+$l, $y); $pdf->line($x+$l, $y, $x+$l, $y+$h); @@ -853,7 +870,7 @@ abstract class CommonDocGenerator * @param int $hideref Do not show ref * @return null */ - function prepareArrayColumnField($object,$outputlangs,$hidedetails=0,$hidedesc=0,$hideref=0) + function prepareArrayColumnField($object, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0) { global $conf; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index cd346dd95e2..5615ecf3b20 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -97,7 +97,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return double Remain of amount to pay */ - function getRemainToPay($multicurrency=0) + function getRemainToPay($multicurrency = 0) { $alreadypaid=0; $alreadypaid+=$this->getSommePaiement($multicurrency); @@ -112,7 +112,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int Amount of payment already done, <0 if KO */ - function getSommePaiement($multicurrency=0) + function getSommePaiement($multicurrency = 0) { $table='paiement_facture'; $field='fk_facture'; @@ -149,7 +149,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of deposits amount otherwise */ - function getSumDepositsUsed($multicurrency=0) + function getSumDepositsUsed($multicurrency = 0) { if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') { @@ -178,7 +178,7 @@ abstract class CommonInvoice extends CommonObject * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumCreditNotesUsed($multicurrency=0) + function getSumCreditNotesUsed($multicurrency = 0) { require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; @@ -233,7 +233,7 @@ abstract class CommonInvoice extends CommonObject * @param string $option filtre sur statut ('', 'validated', ...) * @return int <0 si KO, 0 si aucune facture ne remplace, id facture sinon */ - function getIdReplacingInvoice($option='') + function getIdReplacingInvoice($option = '') { $sql = 'SELECT rowid'; $sql.= ' FROM '.MAIN_DB_PREFIX.$this->table_element; @@ -274,7 +274,7 @@ abstract class CommonInvoice extends CommonObject * @param string $filtertype 1 to filter on type of payment == 'PRE' * @return array Array with list of payments */ - function getListOfPayments($filtertype='') + function getListOfPayments($filtertype = '') { $retarray=array(); @@ -447,7 +447,7 @@ abstract class CommonInvoice extends CommonObject * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label of status */ - function getLibStatut($mode=0, $alreadypaid=-1) + function getLibStatut($mode = 0, $alreadypaid = -1) { return $this->LibStatut($this->paye, $this->statut, $mode, $alreadypaid, $this->type); } @@ -463,7 +463,7 @@ abstract class CommonInvoice extends CommonObject * @param int $type Type invoice * @return string Label of status */ - function LibStatut($paye, $status, $mode=0, $alreadypaid=-1, $type=0) + function LibStatut($paye, $status, $mode = 0, $alreadypaid = -1, $type = 0) { // phpcs:enable global $langs; @@ -593,7 +593,7 @@ abstract class CommonInvoice extends CommonObject * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko */ - function calculate_date_lim_reglement($cond_reglement=0) + function calculate_date_lim_reglement($cond_reglement = 0) { // phpcs:enable if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 945d257b8eb..26094c4cc49 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012-2015 Raphaël Doursenaud * Copyright (C) 2012 Cedric Salvador - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Bahfir abbes * Copyright (C) 2017 ATM Consulting * Copyright (C) 2017 Nicolas ZABOURI @@ -310,6 +310,12 @@ abstract class CommonObject */ public $modelpdf; + /** + * @var string + * Contains relative path of last generated main file + */ + public $last_main_doc; + /** * @var int Bank account ID * @see SetBankAccount() @@ -417,7 +423,7 @@ abstract class CommonObject * @param string $ref_ext Ref ext of object to check * @return int <0 if KO, 0 if OK but not found, >0 if OK and exists */ - static function isExistingObject($element, $id, $ref='', $ref_ext='') + static function isExistingObject($element, $id, $ref = '', $ref_ext = '') { global $db,$conf; @@ -426,8 +432,8 @@ abstract class CommonObject $sql.= " WHERE entity IN (".getEntity($element).")" ; if ($id > 0) $sql.= " AND rowid = ".$db->escape($id); - else if ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; - else if ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'"; + elseif ($ref) $sql.= " AND ref = '".$db->escape($ref)."'"; + elseif ($ref_ext) $sql.= " AND ref_ext = '".$db->escape($ref_ext)."'"; else { $error='ErrorWrongParameters'; dol_print_error(get_class()."::isExistingObject ".$error, LOG_ERR); @@ -505,7 +511,7 @@ abstract class CommonObject * @param int $maxlen Maximum length * @return string String with full name */ - function getFullName($langs,$option=0,$nameorder=-1,$maxlen=0) + function getFullName($langs, $option = 0, $nameorder = -1, $maxlen = 0) { //print "lastname=".$this->lastname." name=".$this->name." nom=".$this->nom."
\n"; $lastname=$this->lastname; @@ -532,7 +538,7 @@ abstract class CommonObject * @param int $withregion 1=Add region into address string * @return string Full address string */ - function getFullAddress($withcountry=0, $sep="\n", $withregion=0) + function getFullAddress($withcountry = 0, $sep = "\n", $withregion = 0) { if ($withcountry && $this->country_id && (empty($this->country_code) || empty($this->country))) { @@ -682,7 +688,7 @@ abstract class CommonObject * @param int $relativelink 0=Return full external link, 1=Return link relative to root of file * @return string Link or empty string if there is no download link */ - function getLastMainDocLink($modulepart, $initsharekey=0, $relativelink=0) + function getLastMainDocLink($modulepart, $initsharekey = 0, $relativelink = 0) { global $user, $dolibarr_main_url_root; @@ -779,7 +785,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int <0 if KO, >0 if OK */ - function add_contact($fk_socpeople, $type_contact, $source='external',$notrigger=0) + function add_contact($fk_socpeople, $type_contact, $source = 'external', $notrigger = 0) { // phpcs:enable global $user,$langs; @@ -901,7 +907,7 @@ abstract class CommonObject * @param string $source Nature of contact ('internal' or 'external') * @return int >0 if OK, <0 if KO */ - function copy_linked_contact($objFrom, $source='internal') + function copy_linked_contact($objFrom, $source = 'internal') { // phpcs:enable $contacts = $objFrom->liste_contact(-1, $source); @@ -926,7 +932,7 @@ abstract class CommonObject * @param int $fk_socpeople Id of soc_people to update (not modified if 0) * @return int <0 if KO, >= 0 if OK */ - function update_contact($rowid, $statut, $type_contact_id=0, $fk_socpeople=0) + function update_contact($rowid, $statut, $type_contact_id = 0, $fk_socpeople = 0) { // phpcs:enable // Insert into database @@ -955,7 +961,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - function delete_contact($rowid, $notrigger=0) + function delete_contact($rowid, $notrigger = 0) { // phpcs:enable global $user; @@ -994,7 +1000,7 @@ abstract class CommonObject * @param string $code Type of contact (code or id) * @return int >0 if OK, <0 if KO */ - function delete_linked_contact($source='',$code='') + function delete_linked_contact($source = '', $code = '') { // phpcs:enable $temp = array(); @@ -1033,7 +1039,7 @@ abstract class CommonObject * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) * @return array|int Array of contacts, -1 if error */ - function liste_contact($statut=-1,$source='external',$list=0,$code='') + function liste_contact($statut = -1, $source = 'external', $list = 0, $code = '') { // phpcs:enable global $langs; @@ -1143,7 +1149,7 @@ abstract class CommonObject * @param string $code Type of contact (Example: 'CUSTOMER', 'SERVICE') * @return array Array list of type of contacts (id->label if option=0, code->label if option=1) */ - function liste_type_contact($source='internal', $order='position', $option=0, $activeonly=0, $code='') + function liste_type_contact($source = 'internal', $order = 'position', $option = 0, $activeonly = 0, $code = '') { // phpcs:enable global $langs; @@ -1197,7 +1203,7 @@ abstract class CommonObject * @param int $status limited to a certain status * @return array List of id for such contacts */ - function getIdContact($source,$code,$status=0) + function getIdContact($source, $code, $status = 0) { global $conf; @@ -1207,7 +1213,7 @@ abstract class CommonObject if($this->element=='shipping' && $this->origin_id != 0) { $id=$this->origin_id; $element='commande'; - } else if($this->element=='reception' && $this->origin_id != 0) { + } elseif($this->element=='reception' && $this->origin_id != 0) { $id=$this->origin_id; $element='order_supplier'; } else { @@ -1257,7 +1263,7 @@ abstract class CommonObject * @param int $contactid Id du contact. Use this->contactid if empty. * @return int <0 if KO, >0 if OK */ - function fetch_contact($contactid=null) + function fetch_contact($contactid = null) { // phpcs:enable if (empty($contactid)) $contactid=$this->contactid; @@ -1278,7 +1284,7 @@ abstract class CommonObject * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty($force_thirdparty_id=0) + function fetch_thirdparty($force_thirdparty_id = 0) { // phpcs:enable global $conf; @@ -1353,7 +1359,7 @@ abstract class CommonObject if (empty($idtype) && $idtype != '0') // If type of barcode no set, we try to guess. If set to '0' it means we forced to have type remain not defined { if ($this->element == 'product') $idtype = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; - else if ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; + elseif ($this->element == 'societe') $idtype = $conf->global->GENBARCODE_BARCODETYPE_THIRDPARTY; else dol_syslog('Call fetch_barcode with barcode_type not defined and cant be guessed', LOG_WARNING); } @@ -1542,7 +1548,7 @@ abstract class CommonObject * @return int <0 if KO, >0 if OK * @see updateExtraField() */ - function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field='', $fuser=null, $trigkey='', $fk_user_field='fk_user_modif') + function setValueFrom($field, $value, $table = '', $id = null, $format = '', $id_field = '', $fuser = null, $trigkey = '', $fk_user_field = 'fk_user_modif') { global $user,$langs,$conf; @@ -1562,8 +1568,8 @@ abstract class CommonObject $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; - else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); - else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); + elseif ($format == 'int') $sql.= $field." = ".$this->db->escape($value); + elseif ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); if ($fk_user_field) { @@ -1621,7 +1627,7 @@ abstract class CommonObject * @param int $nodbprefix Do not include DB prefix to forge table name * @return int <0 if KO, >0 if OK */ - function load_previous_next_ref($filter, $fieldid, $nodbprefix=0) + function load_previous_next_ref($filter, $fieldid, $nodbprefix = 0) { // phpcs:enable global $conf, $user; @@ -1648,8 +1654,8 @@ abstract class CommonObject $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity - else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid - else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." < '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id; @@ -1660,7 +1666,7 @@ abstract class CommonObject $sql.=$filter; } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity - else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) { @@ -1694,8 +1700,8 @@ abstract class CommonObject $sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug"; } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity - else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid - else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid if ($this->restrictiononfksoc && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON ".$alias.".rowid = sc.fk_soc"; $sql.= " WHERE te.".$fieldid." > '".$this->db->escape($this->ref)."'"; // ->ref must always be defined (set to id if field does not exists) if ($this->restrictiononfksoc == 1 && !$user->rights->societe->client->voir && !$socid) $sql.= " AND sc.fk_user = " .$user->id; @@ -1706,7 +1712,7 @@ abstract class CommonObject $sql.=$filter; } if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity - else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid + elseif ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) { if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) { @@ -1745,7 +1751,7 @@ abstract class CommonObject * @return array Array of id of contacts (if source=external or internal) * Array of id of third parties with at least one contact on object (if source=thirdparty) */ - function getListContactId($source='external') + function getListContactId($source = 'external') { $contactAlreadySelected = array(); $tab = $this->liste_contact(-1,$source); @@ -1892,7 +1898,7 @@ abstract class CommonObject * @param int $mode mode 1 : amounts in company currency will be recalculated, mode 2 : amounts in foreign currency * @return int >0 if OK, <0 if KO */ - function setMulticurrencyRate($rate, $mode=1) + function setMulticurrencyRate($rate, $mode = 1) { dol_syslog(get_class($this).'::setMulticurrencyRate('.$id.')'); if ($this->statut >= 0 || $this->element == 'societe') @@ -2068,7 +2074,7 @@ abstract class CommonObject * * @return int 1 if OK, 0 if KO */ - function setShippingMethod($shipping_method_id, $notrigger=false, $userused=null) + function setShippingMethod($shipping_method_id, $notrigger = false, $userused = null) { global $user; @@ -2192,7 +2198,7 @@ abstract class CommonObject * @param User $userused Object user * @return int 1 if OK, 0 if KO */ - function setBankAccount($fk_account, $notrigger=false, $userused=null) + function setBankAccount($fk_account, $notrigger = false, $userused = null) { global $user; @@ -2257,7 +2263,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return int <0 if KO, >0 if OK */ - function line_order($renum=false, $rowidorder='ASC', $fk_parent_line=true) + function line_order($renum = false, $rowidorder = 'ASC', $fk_parent_line = true) { // phpcs:enable if (! $this->table_element_line) @@ -2376,7 +2382,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - function line_up($rowid, $fk_parent_line=true) + function line_up($rowid, $fk_parent_line = true) { // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); @@ -2396,7 +2402,7 @@ abstract class CommonObject * @param boolean $fk_parent_line Table with fk_parent_line field or not * @return void */ - function line_down($rowid, $fk_parent_line=true) + function line_down($rowid, $fk_parent_line = true) { // phpcs:enable $this->line_order(false, 'ASC', $fk_parent_line); @@ -2418,7 +2424,7 @@ abstract class CommonObject * @param int $rang Position * @return void */ - function updateRangOfLine($rowid,$rang) + function updateRangOfLine($rowid, $rang) { $fieldposition = 'rang'; if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; @@ -2457,7 +2463,7 @@ abstract class CommonObject * @param int $rang Position * @return void */ - function updateLineUp($rowid,$rang) + function updateLineUp($rowid, $rang) { if ($rang > 1) { @@ -2491,7 +2497,7 @@ abstract class CommonObject * @param int $max Max * @return void */ - function updateLineDown($rowid,$rang,$max) + function updateLineDown($rowid, $rang, $max) { if ($rang < $max) { @@ -2563,7 +2569,7 @@ abstract class CommonObject * @param int $fk_parent_line Parent line id * @return int Max value of rang in table of lines */ - function line_max($fk_parent_line=0) + function line_max($fk_parent_line = 0) { // phpcs:enable // Search the last rang with fk_parent_line @@ -2645,7 +2651,7 @@ abstract class CommonObject * @param string $suffix '', '_public' or '_private' * @return int <0 if KO, >0 if OK */ - function update_note($note, $suffix='') + function update_note($note, $suffix = '') { // phpcs:enable global $user; @@ -2675,7 +2681,7 @@ abstract class CommonObject if ($this->db->query($sql)) { if ($suffix == '_public') $this->note_public = $note; - else if ($suffix == '_private') $this->note_private = $note; + elseif ($suffix == '_private') $this->note_private = $note; else { $this->note = $note; // deprecated @@ -2716,7 +2722,7 @@ abstract class CommonObject * @param Societe $seller If roundingadjust is '0' or '1' or maybe 'auto', it means we recalculate total for lines before calculating total for object and for this, we need seller object. * @return int <0 if KO, >0 if OK */ - function update_price($exclspec=0,$roundingadjust='none',$nodatabaseupdate=0,$seller=null) + function update_price($exclspec = 0, $roundingadjust = 'none', $nodatabaseupdate = 0, $seller = null) { // phpcs:enable global $conf, $hookmanager, $action; @@ -2953,7 +2959,7 @@ abstract class CommonObject * @return int <=0 if KO, >0 if OK * @see fetchObjectLinked(), updateObjectLinked(), deleteObjectLinked() */ - function add_object_linked($origin=null, $origin_id=null) + function add_object_linked($origin = null, $origin_id = null) { // phpcs:enable $origin = (! empty($origin) ? $origin : $this->origin); @@ -3014,7 +3020,7 @@ abstract class CommonObject * @return int <0 if KO, >0 if OK * @see add_object_linked(), updateObjectLinked(), deleteObjectLinked() */ - function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1,$orderby='sourcetype',$loadalsoobjects=1) + function fetchObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $clause = 'OR', $alsosametype = 1, $orderby = 'sourcetype', $loadalsoobjects = 1) { global $conf; @@ -3059,7 +3065,7 @@ abstract class CommonObject $sql.= "fk_source = ".$sourceid." AND sourcetype = '".$sourcetype."'"; if ($withtargettype) $sql.= " AND targettype = '".$targettype."'"; } - else if ($justtarget) + elseif ($justtarget) { $sql.= "fk_target = ".$targetid." AND targettype = '".$targettype."'"; if ($withsourcetype) $sql.= " AND sourcetype = '".$sourcetype."'"; @@ -3087,7 +3093,7 @@ abstract class CommonObject { $this->linkedObjectsIds[$obj->targettype][$obj->rowid]=$obj->fk_target; } - else if ($justtarget) + elseif ($justtarget) { $this->linkedObjectsIds[$obj->sourcetype][$obj->rowid]=$obj->fk_source; } @@ -3125,28 +3131,28 @@ abstract class CommonObject if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } - else if ($objecttype == 'facturerec') { + elseif ($objecttype == 'facturerec') { $classpath = 'compta/facture/class'; $module = 'facture'; } - else if ($objecttype == 'propal') { + elseif ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } - else if ($objecttype == 'supplier_proposal') { + elseif ($objecttype == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; } - else if ($objecttype == 'shipping') { + elseif ($objecttype == 'shipping') { $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; } - else if ($objecttype == 'delivery') { + elseif ($objecttype == 'delivery') { $classpath = 'livraison/class'; $subelement = 'livraison'; $module = 'livraison_bon'; } - else if ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { + elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { $classpath = 'fourn/class'; $module = 'fournisseur'; } - else if ($objecttype == 'fichinter') { + elseif ($objecttype == 'fichinter') { $classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter'; } - else if ($objecttype == 'subscription') { + elseif ($objecttype == 'subscription') { $classpath = 'adherents/class'; $module = 'adherent'; } @@ -3156,19 +3162,19 @@ abstract class CommonObject if ($objecttype == 'order') { $classfile = 'commande'; $classname = 'Commande'; } - else if ($objecttype == 'invoice_supplier') { + elseif ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } - else if ($objecttype == 'order_supplier') { + elseif ($objecttype == 'order_supplier') { $classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur'; } - else if ($objecttype == 'supplier_proposal') { + elseif ($objecttype == 'supplier_proposal') { $classfile = 'supplier_proposal'; $classname = 'SupplierProposal'; } - else if ($objecttype == 'facturerec') { + elseif ($objecttype == 'facturerec') { $classfile = 'facture-rec'; $classname = 'FactureRec'; } - else if ($objecttype == 'subscription') { + elseif ($objecttype == 'subscription') { $classfile = 'subscription'; $classname = 'Subscription'; } @@ -3218,13 +3224,13 @@ abstract class CommonObject * @return int >0 if OK, <0 if KO * @see add_object_linked(), fetObjectLinked(), deleteObjectLinked() */ - function updateObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='') + function updateObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '') { $updatesource=false; $updatetarget=false; if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid) && empty($targettype)) $updatesource=true; - else if (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $updatetarget=true; + elseif (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $updatetarget=true; $sql = "UPDATE ".MAIN_DB_PREFIX."element_element SET "; if ($updatesource) @@ -3234,7 +3240,7 @@ abstract class CommonObject $sql.= " WHERE fk_target = ".$this->id; $sql.= " AND targettype = '".$this->db->escape($this->element)."'"; } - else if ($updatetarget) + elseif ($updatetarget) { $sql.= "fk_target = ".$targetid; $sql.= ", targettype = '".$this->db->escape($targettype)."'"; @@ -3265,13 +3271,13 @@ abstract class CommonObject * @return int >0 if OK, <0 if KO * @see add_object_linked, updateObjectLinked, fetchObjectLinked */ - function deleteObjectLinked($sourceid=null, $sourcetype='', $targetid=null, $targettype='', $rowid='') + function deleteObjectLinked($sourceid = null, $sourcetype = '', $targetid = null, $targettype = '', $rowid = '') { $deletesource=false; $deletetarget=false; if (! empty($sourceid) && ! empty($sourcetype) && empty($targetid) && empty($targettype)) $deletesource=true; - else if (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $deletetarget=true; + elseif (empty($sourceid) && empty($sourcetype) && ! empty($targetid) && ! empty($targettype)) $deletetarget=true; $sourceid = (! empty($sourceid) ? $sourceid : $this->id); $sourcetype = (! empty($sourcetype) ? $sourcetype : $this->element); @@ -3291,7 +3297,7 @@ abstract class CommonObject $sql.= " fk_source = ".$sourceid." AND sourcetype = '".$this->db->escape($sourcetype)."'"; $sql.= " AND fk_target = ".$this->id." AND targettype = '".$this->db->escape($this->element)."'"; } - else if ($deletetarget) + elseif ($deletetarget) { $sql.= " fk_target = ".$targetid." AND targettype = '".$this->db->escape($targettype)."'"; $sql.= " AND fk_source = ".$this->id." AND sourcetype = '".$this->db->escape($this->element)."'"; @@ -3326,7 +3332,7 @@ abstract class CommonObject * @param string $trigkey Trigger key to use for trigger * @return int <0 if KO, >0 if OK */ - function setStatut($status, $elementId=null, $elementType='', $trigkey='') + function setStatut($status, $elementId = null, $elementType = '', $trigkey = '') { global $user,$langs,$conf; @@ -3414,7 +3420,7 @@ abstract class CommonObject * @param string $ref Record ref * @return int <0 if KO, 0 if nothing done, >0 if OK */ - function getCanvas($id=0,$ref='') + function getCanvas($id = 0, $ref = '') { global $conf; @@ -3474,7 +3480,7 @@ abstract class CommonObject * @param int $id Force id of object * @return int <0 if KO, 0 if not used, >0 if already used */ - function isObjectUsed($id=0) + function isObjectUsed($id = 0) { global $langs; @@ -3543,7 +3549,7 @@ abstract class CommonObject * @param int $predefined -1=All, 0=Count free product/service only, 1=Count predefined product/service only, 2=Count predefined product, 3=Count predefined service * @return int <0 if KO, 0 if no predefined products, nb of lines with predefined products if found */ - function hasProductsOrServices($predefined=-1) + function hasProductsOrServices($predefined = -1) { $nb=0; @@ -3626,7 +3632,7 @@ abstract class CommonObject { if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' $totalToShip+=$line->qty_shipped; // defined for shipment only - }else if ($line->element == 'commandefournisseurdispatch' && isset($line->qty)) + }elseif ($line->element == 'commandefournisseurdispatch' && isset($line->qty)) { if (empty($totalToShip)) $totalToShip=0; $totalToShip+=$line->qty; // defined for reception only @@ -3881,7 +3887,7 @@ abstract class CommonObject * @param int $dateSelector 1=Show also date range input fields * @return void */ - function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0) + function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0) { global $conf, $hookmanager, $langs, $user; // TODO We should not use global var for this ! @@ -4035,7 +4041,7 @@ abstract class CommonObject * @param int $extrafieldsline Object of extrafield line attribute * @return void */ - function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0) + function printObjectLine($action, $line, $var, $num, $i, $dateSelector, $seller, $buyer, $selected = 0, $extrafieldsline = 0) { global $conf,$langs,$user,$object,$hookmanager; global $form,$bc,$bcdd; @@ -4153,7 +4159,7 @@ abstract class CommonObject * @param string $restrictlist ''=All lines, 'services'=Restrict to services only * @return void */ - function printOriginLinesList($restrictlist='') + function printOriginLinesList($restrictlist = '') { global $langs, $hookmanager, $conf; @@ -4207,7 +4213,7 @@ abstract class CommonObject * @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not) * @return void */ - function printOriginLine($line, $var, $restrictlist='') + function printOriginLine($line, $var, $restrictlist = '') { global $langs, $conf; @@ -4240,7 +4246,7 @@ abstract class CommonObject $discount->fk_soc = $this->socid; $this->tpl['label'].= $discount->getNomUrl(0,'discount'); } - else if (! empty($line->fk_product)) + elseif (! empty($line->fk_product)) { $productstatic = new Product($this->db); $productstatic->id = $line->fk_product; @@ -4353,7 +4359,7 @@ abstract class CommonObject * @param int $mandatory Mandatory or not * @return int <=0 if KO, >0 if OK */ - function add_element_resource($resource_id, $resource_type, $busy=0, $mandatory=0) + function add_element_resource($resource_id, $resource_type, $busy = 0, $mandatory = 0) { // phpcs:enable $this->db->begin(); @@ -4397,7 +4403,7 @@ abstract class CommonObject * @param int $notrigger Disable all triggers * @return int >0 if OK, <0 if KO */ - function delete_resource($rowid, $element, $notrigger=0) + function delete_resource($rowid, $element, $notrigger = 0) { // phpcs:enable global $user; @@ -4460,7 +4466,7 @@ abstract class CommonObject * @return int >0 if OK, <0 if KO * @see addFileIntoDatabaseIndex() */ - protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams=null) + protected function commonGenerateDocument($modelspath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams = null) { global $conf, $langs, $user; @@ -4667,10 +4673,15 @@ abstract class CommonObject if (! empty($obj->update_main_doc_field)) $update_main_doc_field=1; if ($update_main_doc_field && ! empty($this->table_element)) { - $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".($ecmfile->filepath.'/'.$ecmfile->filename)."'"; + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element." SET last_main_doc = '".$this->db->escape($ecmfile->filepath.'/'.$ecmfile->filename)."'"; $sql.= ' WHERE rowid = '.$this->id; + $resql = $this->db->query($sql); if (! $resql) dol_print_error($this->db); + else + { + $this->last_main_doc = $ecmfile->filepath.'/'.$ecmfile->filename; + } } } } @@ -4742,7 +4753,7 @@ abstract class CommonObject * @param string $alternatevalue Alternate value to use * @return string|string[] Default value (can be an array if the GETPOST return an array) **/ - function getDefaultCreateValueFor($fieldname, $alternatevalue=null) + function getDefaultCreateValueFor($fieldname, $alternatevalue = null) { global $conf, $_POST; @@ -4818,7 +4829,7 @@ abstract class CommonObject * @param array $optionsArray Array resulting of call of extrafields->fetch_name_optionals_label(). Deprecated. Function must be called without parameters. * @return int <0 if error, 0 if no values of extrafield to find nor found, 1 if an attribute is found and value loaded */ - function fetch_optionals($rowid=null, $optionsArray=null) + function fetch_optionals($rowid = null, $optionsArray = null) { // phpcs:enable if (empty($rowid)) $rowid=$this->id; @@ -4900,7 +4911,7 @@ abstract class CommonObject //var_dump('key '.$key.' '.$value.' type='.$extrafields->attributes[$this->table_element]['type'][$key].' '.$this->array_options["options_".$key]); } } - + // If field is a computed field, value must become result of compute foreach ($tab as $key => $value) { if (! empty($extrafields) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) @@ -4962,7 +4973,7 @@ abstract class CommonObject * @return int -1=error, O=did nothing, 1=OK * @see updateExtraField(), setValueFrom() */ - function insertExtraFields($trigger='', $userused=null) + function insertExtraFields($trigger = '', $userused = null) { global $conf,$langs,$user; @@ -5208,7 +5219,7 @@ abstract class CommonObject * @return int -1=error, O=did nothing, 1=OK * @see setValueFrom(), insertExtraFields() */ - function updateExtraField($key, $trigger=null, $userused=null) + function updateExtraField($key, $trigger = null, $userused = null) { global $conf,$langs,$user; @@ -5342,7 +5353,7 @@ abstract class CommonObject * @param string|int $morecss Value for css to define style/length of field. May also be a numeric. * @return string */ - function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0) + function showInputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = 0) { global $conf,$langs,$form; @@ -5437,7 +5448,7 @@ abstract class CommonObject { $morecss = 'minwidth100'; } - else if (round($size) <= 48) + elseif (round($size) <= 48) { $morecss = 'minwidth200'; } @@ -5953,7 +5964,7 @@ abstract class CommonObject * @param mixed $showsize Value for css to define size. May also be a numeric. * @return string */ - function showOutputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0) + function showOutputField($val, $key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $showsize = 0) { global $conf,$langs,$form; @@ -6035,7 +6046,7 @@ abstract class CommonObject { $showsize = 'minwidth100'; } - else if (round($size) <= 48) + elseif (round($size) <= 48) { $showsize = 'minwidth200'; } @@ -6324,7 +6335,7 @@ abstract class CommonObject * @param string $onetrtd All fields in same tr td * @return string */ - function showOptionals($extrafields, $mode='view', $params=null, $keysuffix='', $keyprefix='', $onetrtd=0) + function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0) { global $db, $conf, $langs, $action, $form; @@ -6531,7 +6542,7 @@ abstract class CommonObject * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) * @return bool True if success, False if error */ - public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) + public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors = 0) { foreach ($tables as $table) { @@ -6589,12 +6600,12 @@ abstract class CommonObject { $buyPrice = $product->cost_price; } - else if ($product->pmp > 0) + elseif ($product->pmp > 0) { $buyPrice = $product->pmp; } } - else if (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp') + elseif (isset($conf->global->MARGIN_TYPE) && $conf->global->MARGIN_TYPE == 'pmp') { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $product = new Product($this->db); @@ -6618,7 +6629,7 @@ abstract class CommonObject { $buyPrice = $productFournisseur->fourn_unitprice; } - else if ($result < 0) + elseif ($result < 0) { $this->errors[] = $productFournisseur->error; return -2; @@ -6647,7 +6658,7 @@ abstract class CommonObject * @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead) * @return string Html code to show photo. Number of photos shown is saved in this->nbphoto */ - function show_photos($modulepart, $sdir, $size=0, $nbmax=0, $nbbyrow=5, $showfilename=0, $showaction=0, $maxHeight=120, $maxWidth=160, $nolink=0, $notitle=0, $usesharelink=0) + function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $notitle = 0, $usesharelink = 0) { // phpcs:enable global $conf,$user,$langs; @@ -6740,7 +6751,7 @@ abstract class CommonObject if ($nbphoto % $nbbyrow == 1) $return.= '
'; $return.= ''; if (($nbphoto % $nbbyrow) == 0) $return.= ''; } - else if ($nbbyrow < 0) $return.=''; + elseif ($nbbyrow < 0) $return.=''; } if (empty($size)) { // Format origine @@ -7003,7 +7014,7 @@ abstract class CommonObject $queryarray[$field] = $this->db->idate($this->{$field}); } } - else if($this->isArray($info)) + elseif($this->isArray($info)) { if(! empty($this->{$field})) { if(! is_array($this->{$field})) { @@ -7014,7 +7025,7 @@ abstract class CommonObject $queryarray[$field] = null; } } - else if($this->isInt($info)) + elseif($this->isInt($info)) { if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field]=$conf->entity; else @@ -7023,7 +7034,7 @@ abstract class CommonObject if (empty($queryarray[$field])) $queryarray[$field]=0; // May be reset to null later if property 'notnull' is -1 for this field. } } - else if($this->isFloat($info)) + elseif($this->isFloat($info)) { $queryarray[$field] = (double) price2num($this->{$field}); if (empty($queryarray[$field])) $queryarray[$field]=0; @@ -7111,7 +7122,7 @@ abstract class CommonObject protected function quote($value, $fieldsentry) { if (is_null($value)) return 'NULL'; - else if (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); + elseif (preg_match('/^(int|double|real)/i', $fieldsentry['type'])) return $this->db->escape("$value"); else return "'".$this->db->escape($value)."'"; } @@ -7349,7 +7360,7 @@ abstract class CommonObject * @param int $forcechilddeletion 0=no, 1=Force deletion of children * @return int <=0 if KO, >0 if OK */ - public function deleteCommon(User $user, $notrigger=false, $forcechilddeletion=0) + public function deleteCommon(User $user, $notrigger = false, $forcechilddeletion = 0) { $error=0; diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 91d4245ff88..891ea5e4bc6 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -57,7 +57,7 @@ abstract class CommonObjectLine extends CommonObject * @param string $type Label type (long or short) * @return string|int <0 if ko, label if ok */ - public function getLabelOfUnit($type='long') + public function getLabelOfUnit($type = 'long') { global $langs; diff --git a/htdocs/core/class/commonorder.class.php b/htdocs/core/class/commonorder.class.php index 199b29b87cd..9d9445df91c 100644 --- a/htdocs/core/class/commonorder.class.php +++ b/htdocs/core/class/commonorder.class.php @@ -145,4 +145,3 @@ abstract class CommonOrderLine extends CommonObjectLine public $special_code = 0; } - diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index d5bf6f3317e..2cbf6a9ecb7 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -107,7 +107,7 @@ abstract class CommonStickerGenerator * @param string $outputdir Output directory for pdf file * @return int 1=OK, 0=KO */ - abstract function write_file($arrayofrecords,$outputlangs,$srctemplatepath,$outputdir=''); + abstract function write_file($arrayofrecords, $outputlangs, $srctemplatepath, $outputdir = ''); // phpcs:enable /** @@ -118,7 +118,7 @@ abstract class CommonStickerGenerator * @param array $param Associative array containing label content and optional parameters * @return void */ - abstract function addSticker(&$pdf,$outputlangs,$param); + abstract function addSticker(&$pdf, $outputlangs, $param); // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** @@ -129,7 +129,7 @@ abstract class CommonStickerGenerator * @param int $pt point * @return void */ - function Set_Char_Size(&$pdf,$pt) + function Set_Char_Size(&$pdf, $pt) { // phpcs:enable if ($pt > 3) { @@ -152,7 +152,7 @@ abstract class CommonStickerGenerator * @param int $nbPointilles Nb pointilles * @return void */ - function _Pointille(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$nbPointilles=15) + function _Pointille(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $nbPointilles = 15) { // phpcs:enable $pdf->SetLineWidth($epaisseur); @@ -195,7 +195,7 @@ abstract class CommonStickerGenerator * @param int $taille Size * @return void */ - function _Croix(&$pdf,$x1=0,$y1=0,$x2=210,$y2=297,$epaisseur=1,$taille=4) + function _Croix(&$pdf, $x1 = 0, $y1 = 0, $x2 = 210, $y2 = 297, $epaisseur = 1, $taille = 4) { // phpcs:enable $pdf->SetDrawColor(192,192,192); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index de39260e007..2de814fd14a 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -180,10 +180,10 @@ class Conf if (! isset($this->modules_parts[$partname]) || ! is_array($this->modules_parts[$partname])) { $this->modules_parts[$partname] = array(); } $arrValue = json_decode($value,true); if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; - else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; - else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; - else if (in_array($partname,array('sms'))) $value = '/'.$modulename.'/'; - else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe + elseif (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; + elseif (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; + elseif (in_array($partname,array('sms'))) $value = '/'.$modulename.'/'; + elseif ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array } // If this is a module constant (must be at end) @@ -252,7 +252,7 @@ class Conf if (empty($this->global->MAIN_MENUFRONT_SMARTPHONE)) $this->global->MAIN_MENUFRONT_SMARTPHONE="eldy_menu.php"; // Use eldy by default because smartphone does not work on all phones // Clean var use vat for company if (! isset($this->global->FACTURE_TVAOPTION)) $this->global->FACTURE_TVAOPTION=1; - else if (! empty($this->global->FACTURE_TVAOPTION) && ! is_numeric($this->global->FACTURE_TVAOPTION)) + elseif (! empty($this->global->FACTURE_TVAOPTION) && ! is_numeric($this->global->FACTURE_TVAOPTION)) { // Old value of option, we clean to use new value (0 or 1) if ($this->global->FACTURE_TVAOPTION != "franchise") $this->global->FACTURE_TVAOPTION=1; @@ -694,4 +694,3 @@ class Conf } } } - diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 5129ac54ece..a3a8a0dd5ff 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -123,7 +123,7 @@ class CoreObject extends CommonObject * @param bool $try_to_load Force the fetch if an id is given * @return int */ - public function addChild($tabName, $id=0, $key='id', $try_to_load = false) + public function addChild($tabName, $id = 0, $key = 'id', $try_to_load = false) { if(!empty($id)) { @@ -154,7 +154,7 @@ class CoreObject extends CommonObject * @param string $key Attribute name of the object id * @return bool */ - public function removeChild($tabName, $id, $key='id') + public function removeChild($tabName, $id, $key = 'id') { foreach ($this->{$tabName} as &$object) { @@ -370,7 +370,7 @@ class CoreObject extends CommonObject * @param string $format Output date format * @return string */ - public function getDate($field, $format='') + public function getDate($field, $format = '') { if(empty($this->{$field})) return ''; else @@ -416,15 +416,15 @@ class CoreObject extends CommonObject { $this->setDate($key, $value); } - else if( $this->checkFieldType($key, 'array')) + elseif( $this->checkFieldType($key, 'array')) { $this->{$key} = $value; } - else if( $this->checkFieldType($key, 'float') ) + elseif( $this->checkFieldType($key, 'float') ) { $this->{$key} = (double) price2num($value); } - else if( $this->checkFieldType($key, 'int') ) { + elseif( $this->checkFieldType($key, 'int') ) { $this->{$key} = (int) price2num($value); } else diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 4320446d7b5..6ad6523f199 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -92,7 +92,7 @@ class Cstate // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -168,7 +168,7 @@ class Cstate // extends CommonObject * @param string $code Code * @return int <0 if KO, >0 if OK */ - function fetch($id,$code='') + function fetch($id, $code = '') { global $langs; $sql = "SELECT"; @@ -212,7 +212,7 @@ class Cstate // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -281,7 +281,7 @@ class Cstate // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index db8ed461727..ffaccbfe964 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -76,7 +76,7 @@ class Ctypent // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, Id of created object if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -166,7 +166,7 @@ class Ctypent // extends CommonObject * @param string $label Label * @return int <0 if KO, >0 if OK */ - function fetch($id,$code='',$label='') + function fetch($id, $code = '', $label = '') { global $langs; $sql = "SELECT"; @@ -214,7 +214,7 @@ class Ctypent // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -285,7 +285,7 @@ class Ctypent // extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; diff --git a/htdocs/core/class/ctyperesource.class.php b/htdocs/core/class/ctyperesource.class.php index 95c642772e2..4ceb7ed37c8 100644 --- a/htdocs/core/class/ctyperesource.class.php +++ b/htdocs/core/class/ctyperesource.class.php @@ -159,7 +159,7 @@ class Ctyperesource * * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id,$code='',$label='') + public function fetch($id, $code = '', $label = '') { dol_syslog(__METHOD__, LOG_DEBUG); @@ -223,7 +223,7 @@ class Ctyperesource * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 48c426a830f..eb44fac13ea 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -109,7 +109,7 @@ class DiscountAbsolute * @param int $fk_invoice_supplier_source fk_invoice_supplier_source * @return int <0 if KO, =0 if not found, >0 if OK */ - function fetch($rowid, $fk_facture_source=0, $fk_invoice_supplier_source=0) + function fetch($rowid, $fk_facture_source = 0, $fk_invoice_supplier_source = 0) { global $conf; @@ -396,7 +396,7 @@ class DiscountAbsolute * @param int $rowidinvoice Invoice id (To use discount as a credit note to reduc payment of invoice) * @return int <0 if KO, >0 if OK */ - function link_to_invoice($rowidline,$rowidinvoice) + function link_to_invoice($rowidline, $rowidinvoice) { // phpcs:enable // Check parameters @@ -484,7 +484,7 @@ class DiscountAbsolute * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return int <0 if KO, amount otherwise */ - function getAvailableDiscounts($company='', $user='',$filter='', $maxvalue=0, $discount_type=0) + function getAvailableDiscounts($company = '', $user = '', $filter = '', $maxvalue = 0, $discount_type = 0) { global $conf; @@ -527,7 +527,7 @@ class DiscountAbsolute * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and deposits amount otherwise */ - function getSumDepositsUsed($invoice, $multicurrency=0) + function getSumDepositsUsed($invoice, $multicurrency = 0) { dol_syslog(get_class($this)."::getSumDepositsUsed", LOG_DEBUG); @@ -538,7 +538,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND f.type = 3'; } - else if ($invoice->element == 'invoice_supplier') + elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; @@ -573,7 +573,7 @@ class DiscountAbsolute * @param int $multicurrency Return multicurrency_amount instead of amount * @return int <0 if KO, Sum of credit notes and excess received amount otherwise */ - function getSumCreditNotesUsed($invoice, $multicurrency=0) + function getSumCreditNotesUsed($invoice, $multicurrency = 0) { dol_syslog(get_class($this)."::getSumCreditNotesUsed", LOG_DEBUG); @@ -584,7 +584,7 @@ class DiscountAbsolute $sql.= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql.= ' AND (f.type = 2 OR f.type = 0)'; // Find discount coming from credit note or excess received } - else if ($invoice->element == 'invoice_supplier') + elseif ($invoice->element == 'invoice_supplier') { $sql = 'SELECT sum(rc.amount_ttc) as amount, sum(rc.multicurrency_amount_ttc) as multicurrency_amount'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture_fourn as f'; @@ -619,7 +619,7 @@ class DiscountAbsolute * @param string $option Where to link to ('invoice' or 'discount') * @return string String with URL */ - function getNomUrl($withpicto,$option='invoice') + function getNomUrl($withpicto, $option = 'invoice') { global $langs; diff --git a/htdocs/core/class/doleditor.class.php b/htdocs/core/class/doleditor.class.php index 548721be05f..5d375e420f4 100644 --- a/htdocs/core/class/doleditor.class.php +++ b/htdocs/core/class/doleditor.class.php @@ -64,7 +64,7 @@ class DolEditor * @param string $cols Size of cols for textarea tool (textarea number of cols '70' or percent 'x%') * @param int $readonly 0=Read/Edit, 1=Read only */ - function __construct($htmlname, $content, $width='', $height=200, $toolbarname='Basic', $toolbarlocation='In', $toolbarstartexpanded=false, $uselocalbrowser=true, $okforextendededitor=true, $rows=0, $cols=0, $readonly=0) + function __construct($htmlname, $content, $width = '', $height = 200, $toolbarname = 'Basic', $toolbarlocation = 'In', $toolbarstartexpanded = false, $uselocalbrowser = true, $okforextendededitor = true, $rows = 0, $cols = 0, $readonly = 0) { global $conf,$langs; @@ -149,7 +149,7 @@ class DolEditor * @param string $option For ACE editor, set the source language ('html', 'php', 'javascript', ...) * @return void|string */ - function Create($noprint=0, $morejs='', $disallowAnyContent=true, $titlecontent='', $option='') + function Create($noprint = 0, $morejs = '', $disallowAnyContent = true, $titlecontent = '', $option = '') { // phpcs:enable global $conf,$langs; diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index a57e4e844ec..035fe1a1486 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -41,14 +41,14 @@ class DolGeoIP * @param string $type 'country' or 'city' * @param string $datfile Data file */ - function __construct($type,$datfile) + function __construct($type, $datfile) { if ($type == 'country') { // geoip may have been already included with PEAR if (! function_exists('geoip_country_code_by_name')) $res=include_once GEOIP_PATH.'geoip.inc'; } - else if ($type == 'city') + elseif ($type == 'city') { // geoip may have been already included with PEAR if (! function_exists('geoip_country_code_by_name')) $res=include_once GEOIP_PATH.'geoipcity.inc'; diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 42386494a37..01ed83bf176 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -88,7 +88,7 @@ class DolGraph * * @param string $library 'jflot' (default) or 'artichow' (no more supported) */ - function __construct($library='jflot') + function __construct($library = 'jflot') { global $conf; global $theme_bordercolor, $theme_datacolor, $theme_bgcolor, $theme_bgcoloronglet; @@ -658,7 +658,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return integer|null */ - function draw($file, $fileurl='') + function draw($file, $fileurl = '') { if (empty($file)) { @@ -690,7 +690,7 @@ class DolGraph * @param string $fileurl Url path to show image if saved onto disk * @return void */ - private function draw_artichow($file,$fileurl) + private function draw_artichow($file, $fileurl) { // phpcs:enable global $artichow_defaultfont; @@ -704,7 +704,7 @@ class DolGraph // Create graph $classname=''; if (! isset($this->type[0]) || $this->type[0] == 'bars') $classname='BarPlot'; // Only one type (first one) is supported by artichow - else if ($this->type[0] == 'lines' || $this->type[0] == 'linesnopoint') $classname='LinePlot'; + elseif ($this->type[0] == 'lines' || $this->type[0] == 'linesnopoint') $classname='LinePlot'; else $classname='TypeUnknown'; include_once ARTICHOW_PATH.$classname.'.class.php'; @@ -1127,7 +1127,7 @@ class DolGraph * @param int $shownographyet Show graph to say there is not enough data * @return string HTML string to show graph */ - function show($shownographyet=0) + function show($shownographyet = 0) { global $langs; @@ -1149,7 +1149,7 @@ class DolGraph * @param string $defaultsize Value we want as default size * @return int Value of width or height to use by default */ - static function getDefaultGraphSizeForStats($direction,$defaultsize='') + static function getDefaultGraphSizeForStats($direction, $defaultsize = '') { global $conf; diff --git a/htdocs/core/class/dolreceiptprinter.class.php b/htdocs/core/class/dolreceiptprinter.class.php index f38afc67807..19de8abb3f6 100644 --- a/htdocs/core/class/dolreceiptprinter.class.php +++ b/htdocs/core/class/dolreceiptprinter.class.php @@ -311,7 +311,7 @@ class dolReceiptPrinter extends Escpos * @param string $htmlname select html name * @return int 0 if OK; >0 if KO */ - function selectTypePrinter($selected='', $htmlname='printertypeid') + function selectTypePrinter($selected = '', $htmlname = 'printertypeid') { global $langs; @@ -335,7 +335,7 @@ class dolReceiptPrinter extends Escpos * @param string $htmlname select html name * @return int 0 if OK; >0 if KO */ - function selectProfilePrinter($selected='', $htmlname='printerprofileid') + function selectProfilePrinter($selected = '', $htmlname = 'printerprofileid') { global $langs; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index 3a1fba460c4..3ce9623a05d 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -277,7 +277,7 @@ class EmailSenderProfile extends CommonObject * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) * @return string String with URL */ - function getNomUrl($withpicto=0) + function getNomUrl($withpicto = 0) { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -309,7 +309,7 @@ class EmailSenderProfile extends CommonObject * @param int $withpicto Add download picto into link * @return string HTML link to file */ - function getDirectExternalLink($withpicto=0) + function getDirectExternalLink($withpicto = 0) { return 'todo'; } @@ -320,7 +320,7 @@ class EmailSenderProfile extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -333,7 +333,7 @@ class EmailSenderProfile extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label of status */ - static function LibStatut($status,$mode=0) + static function LibStatut($status, $mode = 0) { global $langs; diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 68e029dae4b..ecaaba8f4c7 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -183,7 +183,7 @@ class Events // extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; @@ -220,7 +220,7 @@ class Events // extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=null) + function fetch($id, $user = null) { global $langs; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 12fa3ea9bc9..77ee805295d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -155,7 +155,7 @@ class ExtraFields * @param string $label label of attribute * @param int $type Type of attribute ('boolean','int','varchar','text','html','date','datehour','price','phone','mail','password','url','select','checkbox','separate',...) * @param int $pos Position of attribute - * @param string $size Size/length of attribute + * @param string $size Size/length definition of attribute ('5', '24,8', ...). For float, it contains 2 numeric separated with a comma. * @param string $elementtype Element type. Same value than object->table_element (Example 'member', 'product', 'thirdparty', ...) * @param int $unique Is field unique or not * @param int $required Is field required or not @@ -171,7 +171,7 @@ class ExtraFields * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ - function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $computed='', $entity='', $langfile='', $enabled='1') + function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique = 0, $required = 0, $default_value = '', $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $computed = '', $entity = '', $langfile = '', $enabled = '1') { if (empty($attrname)) return -1; if (empty($label)) return -1; @@ -221,7 +221,7 @@ class ExtraFields * @param string $computed Computed value * @return int <=0 if KO, >0 if OK */ - private function create($attrname, $type='varchar', $length=255, $elementtype='member', $unique=0, $required=0, $default_value='',$param='', $perms='', $list='0', $computed='') + private function create($attrname, $type = 'varchar', $length = 255, $elementtype = 'member', $unique = 0, $required = 0, $default_value = '', $param = '', $perms = '', $list = '0', $computed = '') { if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'contact') $elementtype='socpeople'; @@ -317,7 +317,7 @@ class ExtraFields * @param string $enabled Condition to have the field enabled or not * @return int <=0 if KO, >0 if OK */ - private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $default='', $computed='',$entity='', $langfile='', $enabled='1') + private function create_label($attrname, $label = '', $type = '', $pos = 0, $size = 0, $elementtype = 'member', $unique = 0, $required = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '-1', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1') { // phpcs:enable global $conf,$user; @@ -414,7 +414,7 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'thirdparty', 'contact', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ - function delete($attrname, $elementtype='member') + function delete($attrname, $elementtype = 'member') { if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'contact') $elementtype='socpeople'; @@ -472,7 +472,7 @@ class ExtraFields * @param string $elementtype Element type ('member', 'product', 'thirdparty', ...) * @return int < 0 if KO, 0 if nothing is done, 1 if OK */ - private function delete_label($attrname, $elementtype='member') + private function delete_label($attrname, $elementtype = 'member') { // phpcs:enable global $conf; @@ -529,7 +529,7 @@ class ExtraFields * @param int $totalizable Is extrafield totalizable on list * @return int >0 if OK, <=0 if KO */ - function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $help='', $default='', $computed='', $entity='', $langfile='', $enabled='1', $totalizable=0) + function update($attrname, $label, $type, $length, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0) { if ($elementtype == 'thirdparty') $elementtype='societe'; if ($elementtype == 'contact') $elementtype='socpeople'; @@ -639,7 +639,7 @@ class ExtraFields * @param int $totalizable Is extrafield totalizable on list * @return int <=0 if KO, >0 if OK */ - private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$help='',$default='',$computed='',$entity='',$langfile='',$enabled='1', $totalizable=0) + private function update_label($attrname, $label, $type, $size, $elementtype, $unique = 0, $required = 0, $pos = 0, $param = '', $alwayseditable = 0, $perms = '', $list = '0', $help = '', $default = '', $computed = '', $entity = '', $langfile = '', $enabled = '1', $totalizable = 0) { // phpcs:enable global $conf, $user; @@ -770,7 +770,7 @@ class ExtraFields * @param boolean $forceload Force load of extra fields whatever is option MAIN_EXTRAFIELDS_DISABLED. Deprecated. Should not be required. * @return array Array of attributes keys+label for all extra fields. */ - function fetch_name_optionals_label($elementtype,$forceload=false) + function fetch_name_optionals_label($elementtype, $forceload = false) { // phpcs:enable global $conf; @@ -893,7 +893,7 @@ class ExtraFields * @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data * @return string */ - function showInputField($key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss='', $objectid=0, $extrafieldsobjectkey='') + function showInputField($key, $value, $moreparam = '', $keysuffix = '', $keyprefix = '', $morecss = '', $objectid = 0, $extrafieldsobjectkey = '') { global $conf,$langs,$form; @@ -979,7 +979,7 @@ class ExtraFields { $morecss = 'minwidth100'; } - else if (round($size) <= 48) + elseif (round($size) <= 48) { $morecss = 'minwidth200'; } @@ -1333,13 +1333,13 @@ class ExtraFields // current object id can be use into filter if (strpos($InfoFieldList[4], '$ID$')!==false && !empty($objectid)) { $InfoFieldList[4]=str_replace('$ID$',$objectid,$InfoFieldList[4]); - } else if (preg_match("#^.*list.php$#",$_SERVER["DOCUMENT_URI"])) { + } elseif (preg_match("#^.*list.php$#",$_SERVER["DOCUMENT_URI"])) { // Pattern for word=$ID$ $word = '\b[a-zA-Z0-9-\.-_]+\b=\$ID\$'; - + // Removing space arount =, ( and ) $InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#','$1', $InfoFieldList[4]); - + $nbPreg = 1; // While we have parenthesis while ($nbPreg!=0) { @@ -1353,11 +1353,11 @@ class ExtraFields $InfoFieldList[4]=preg_replace( '#\b[a-zA-Z0-9-\.-_]+\b=\([^)^(]*(' . $word . ')[^)^(]*\)#','$1 ',$InfoFieldList[4], -1, $nbPregSel); // On retire les espaces autour des = et parenthèses $InfoFieldList[4]=preg_replace('# *(=|\(|\)) *#','$1', $InfoFieldList[4]); - + // Calcul du compteur général pour la boucle $nbPreg = $nbPregRepl + $nbPregSel; } - + // Si l'on a un AND ou un OR, avant ou après preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#',$InfoFieldList[4],$matchCondition); while(!empty($matchCondition[0])) { @@ -1371,7 +1371,7 @@ class ExtraFields $boolCond =(( $matchCondition[1] == "AND" )?' AND 1 ':' OR 0 '); $InfoFieldList[4]=str_replace($matchCondition[0],$boolCond.$matchCondition[3],$InfoFieldList[4]); } - else if (! empty($matchCondition[3])) { + elseif (! empty($matchCondition[3])) { $boolCond =(( $matchCondition[3] == "AND" )?' 1 AND ':' 0 OR'); $InfoFieldList[4]=str_replace($matchCondition[0],$boolCond,$InfoFieldList[4]); } @@ -1379,7 +1379,7 @@ class ExtraFields $InfoFieldList[4] = 1; } } - + // Si l'on a un AND ou un OR, avant ou après preg_match('#(AND|OR|) *('.$word.') *(AND|OR|)#',$InfoFieldList[4],$matchCondition); } @@ -1508,7 +1508,7 @@ class ExtraFields * @param string $extrafieldsobjectkey If defined (for example $object->table_element), use the new method to get extrafields data * @return string Formated value */ - function showOutputField($key, $value, $moreparam='', $extrafieldsobjectkey='') + function showOutputField($key, $value, $moreparam = '', $extrafieldsobjectkey = '') { global $conf,$langs; @@ -1820,7 +1820,7 @@ class ExtraFields * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data * @return string Formated value */ - function getAlignFlag($key, $extrafieldsobjectkey='') + function getAlignFlag($key, $extrafieldsobjectkey = '') { global $conf,$langs; @@ -1890,7 +1890,7 @@ class ExtraFields * @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset. * @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example) */ - function setOptionalsFromPost($extralabels, &$object, $onlykey='') + function setOptionalsFromPost($extralabels, &$object, $onlykey = '') { global $_POST, $langs; $nofillrequired='';// For error when required field left blank @@ -1945,7 +1945,7 @@ class ExtraFields // TODO GMT date in memory must be GMT so we should add gm=true in parameters $value_key=dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); } - else if (in_array($key_type,array('checkbox','chkbxlst'))) + elseif (in_array($key_type,array('checkbox','chkbxlst'))) { $value_arr=GETPOST("options_".$key, 'array'); // check if an array if (!empty($value_arr)) { @@ -1954,7 +1954,7 @@ class ExtraFields $value_key=''; } } - else if (in_array($key_type,array('price','double'))) + elseif (in_array($key_type,array('price','double'))) { $value_arr=GETPOST("options_".$key, 'alpha'); $value_key=price2num($value_arr); @@ -1989,7 +1989,7 @@ class ExtraFields * @param string $keysuffix Suffix string to add into name and id of field (can be used to avoid duplicate names) * @return array|int array_options set or 0 if no value */ - function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix='', $keysuffix='') + function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $keysuffix = '') { global $_POST; @@ -2020,14 +2020,14 @@ class ExtraFields // Clean parameters $value_key=dol_mktime($_POST[$keysuffix."options_".$key.$keyprefix."hour"], $_POST[$keysuffix."options_".$key.$keyprefix."min"], 0, $_POST[$keysuffix."options_".$key.$keyprefix."month"], $_POST[$keysuffix."options_".$key.$keyprefix."day"], $_POST[$keysuffix."options_".$key.$keyprefix."year"]); } - else if (in_array($key_type,array('checkbox', 'chkbxlst'))) + elseif (in_array($key_type,array('checkbox', 'chkbxlst'))) { $value_arr=GETPOST($keysuffix."options_".$key.$keyprefix); // Make sure we get an array even if there's only one checkbox $value_arr=(array) $value_arr; $value_key=implode(',', $value_arr); } - else if (in_array($key_type,array('price','double'))) + elseif (in_array($key_type,array('price','double'))) { $value_arr=GETPOST($keysuffix."options_".$key.$keyprefix); $value_key=price2num($value_arr); diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 027fdda0514..3a085821694 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -41,7 +41,7 @@ class FileUpload * @param int $fk_element fk_element * @param string $element element */ - function __construct($options=null,$fk_element=null,$element=null) + function __construct($options = null, $fk_element = null, $element = null) { global $db, $conf; global $object; @@ -136,7 +136,7 @@ class FileUpload $object_ref = dol_sanitizeFileName($object->ref); if ($element == 'invoice_supplier') { $object_ref = get_exdir($object->id,2,0,0,$object,'invoice_supplier') . $object_ref; - } else if ($element == 'project_task') { + } elseif ($element == 'project_task') { $object_ref = $object->project->ref . '/' . $object_ref; } @@ -456,7 +456,7 @@ class FileUpload } } } - else if ($this->options['discard_aborted_uploads']) + elseif ($this->options['discard_aborted_uploads']) { unlink($file_path); $file->error = 'abort'; diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index c1c288cbf79..e3f52f703b3 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2014-2018 Alexandre Spangaro * * 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 @@ -264,7 +264,7 @@ class Fiscalyear extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -277,7 +277,7 @@ class Fiscalyear extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto * @return string Label */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/core/class/google.class.php b/htdocs/core/class/google.class.php index 615729ba9c3..797f0a14af1 100644 --- a/htdocs/core/class/google.class.php +++ b/htdocs/core/class/google.class.php @@ -44,7 +44,7 @@ class GoogleAPI * @param DoliDB $db Database handler * @param string $key Google key */ - function __construct($db,$key) + function __construct($db, $key) { $this->db=$db; $this->key=$key; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 98193f1e32e..47edef4011d 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -136,7 +136,7 @@ class HookManager * All types can also return some values into an array ->results that will be finaly merged into this->resArray for caller. * $this->error or this->errors are also defined by class called by this function if error. */ - function executeHooks($method, $parameters=array(), &$object='', &$action='') + function executeHooks($method, $parameters = array(), &$object = '', &$action = '') { if (! is_array($this->hooks) || empty($this->hooks)) return ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 509ee8bcc0d..9401dce5622 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -15,7 +15,7 @@ * Copyright (C) 2012-2016 Marcos García * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2012-2015 Raphaël Doursenaud - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Frédéric France * Copyright (C) 2018 Nicolas ZABOURI @@ -102,7 +102,7 @@ class Form * @param string $paramid Key of parameter for id ('id', 'socid') * @return string HTML edit field */ - function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0, $paramid='id') + function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata = 'string', $moreparam = '', $fieldrequired = 0, $notabletag = 0, $paramid = 'id') { global $conf,$langs; @@ -164,7 +164,7 @@ class Form * @param string $paramid Key of parameter for id ('id', 'socid') * @return string HTML edit field */ - function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata='string', $editvalue='', $extObject=null, $custommsg=null, $moreparam='', $notabletag=0, $formatfunc='', $paramid='id') + function editfieldval($text, $htmlname, $value, $object, $perm, $typeofdata = 'string', $editvalue = '', $extObject = null, $custommsg = null, $moreparam = '', $notabletag = 0, $formatfunc = '', $paramid = 'id') { global $conf,$langs,$db; @@ -194,13 +194,13 @@ class Form $tmp=explode(':',$typeofdata); $ret.=''; } - else if (preg_match('/^(numeric|amount)/',$typeofdata)) + elseif (preg_match('/^(numeric|amount)/',$typeofdata)) { $tmp=explode(':',$typeofdata); $valuetoshow=price2num($editvalue?$editvalue:$value); $ret.=''; } - else if (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) + elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) { $tmp=explode(':',$typeofdata); $cols=$tmp[2]; @@ -217,15 +217,15 @@ class Form $ret.=dol_string_neverthesehtmltags($valuetoshow, array('textarea')); $ret.=''; } - else if ($typeofdata == 'day' || $typeofdata == 'datepicker') + elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { $ret.=$this->selectDate($value,$htmlname,0,0,1,'form'.$htmlname,1,0); } - else if ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') + elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { $ret.=$this->selectDate($value,$htmlname,1,1,1,'form'.$htmlname,1,0); } - else if (preg_match('/^select;/',$typeofdata)) + elseif (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); foreach($arraydata as $val) @@ -235,7 +235,7 @@ class Form } $ret.=$this->selectarray($htmlname,$arraylist,$value); } - else if (preg_match('/^ckeditor/',$typeofdata)) + elseif (preg_match('/^ckeditor/',$typeofdata)) { $tmp=explode(':',$typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -261,7 +261,7 @@ class Form elseif (preg_match('/^text/',$typeofdata) || preg_match('/^note/',$typeofdata)) $ret.=dol_htmlentitiesbr($value); elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') $ret.=dol_print_date($value,'day'); elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') $ret.=dol_print_date($value,'dayhour'); - else if (preg_match('/^select;/',$typeofdata)) + elseif (preg_match('/^select;/',$typeofdata)) { $arraydata=explode(',',preg_replace('/^select;/','',$typeofdata)); foreach($arraydata as $val) @@ -271,7 +271,7 @@ class Form } $ret.=$arraylist[$value]; } - else if (preg_match('/^ckeditor/',$typeofdata)) + elseif (preg_match('/^ckeditor/',$typeofdata)) { $tmpcontent=dol_htmlentitiesbr($value); if (! empty($conf->global->MAIN_DISABLE_NOTES_TAB)) @@ -306,7 +306,7 @@ class Form * @param mixed $custommsg String or Array of custom messages : eg array('success' => 'MyMessage', 'error' => 'MyMessage') * @return string HTML edit in place */ - private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $editvalue=null, $extObject=null, $custommsg=null) + private function editInPlace($object, $value, $htmlname, $condition, $inputType = 'textarea', $editvalue = null, $extObject = null, $custommsg = null) { global $conf; @@ -314,8 +314,8 @@ class Form // Check parameters if (preg_match('/^text/',$inputType)) $value = dol_nl2br($value); - else if (preg_match('/^numeric/',$inputType)) $value = price($value); - else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day'); + elseif (preg_match('/^numeric/',$inputType)) $value = price($value); + elseif ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day'); if ($condition) { @@ -348,7 +348,7 @@ class Form if (! empty($tmp[2])) $savemethod=$tmp[2]; $out.= ''."\n"; } - else if ((preg_match('/^day$/',$inputType)) || (preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) + elseif ((preg_match('/^day$/',$inputType)) || (preg_match('/^datepicker/',$inputType)) || (preg_match('/^datehourpicker/',$inputType))) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; @@ -357,21 +357,21 @@ class Form $out.= ''."\n"; // Use for timestamp format } - else if (preg_match('/^(select|autocomplete)/',$inputType)) + elseif (preg_match('/^(select|autocomplete)/',$inputType)) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; $loadmethod=$tmp[1]; if (! empty($tmp[2])) $savemethod=$tmp[2]; if (! empty($tmp[3])) $button_only=true; } - else if (preg_match('/^textarea/',$inputType)) + elseif (preg_match('/^textarea/',$inputType)) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; $rows=(empty($tmp[1])?'8':$tmp[1]); $cols=(empty($tmp[2])?'80':$tmp[2]); } - else if (preg_match('/^ckeditor/',$inputType)) + elseif (preg_match('/^ckeditor/',$inputType)) { $tmp=explode(':',$inputType); $inputType=$tmp[0]; $toolbar=$tmp[1]; @@ -441,7 +441,7 @@ class Form * @see Use function textwithpicto if you can. * TODO Move this as static as soon as everybody use textwithpicto or @Form::textwithtooltip */ - function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger='', $forcenowrap=0) + function textwithtooltip($text, $htmltext, $tooltipon = 1, $direction = 0, $img = '', $extracss = '', $notabs = 2, $incbefore = '', $noencodehtmltext = 0, $tooltiptrigger = '', $forcenowrap = 0) { global $conf; @@ -518,7 +518,7 @@ class Form * @param string $text Text to show * @param string $htmltext Content of tooltip * @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon - * @param string $type Type of picto ('info', 'help', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath + * @param string $type Type of picto ('info', 'help', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath or 'none' * @param string $extracss Add a CSS style to td, div or span tag * @param int $noencodehtmltext Do not encode into html entity the htmltext * @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span @@ -526,7 +526,7 @@ class Form * @param int $forcenowrap Force no wrap between text and picto (works with notabs=2 only) * @return string HTML code of text, picto, tooltip */ - function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger='', $forcenowrap=0) + function textwithpicto($text, $htmltext, $direction = 1, $type = 'help', $extracss = '', $noencodehtmltext = 0, $notabs = 2, $tooltiptrigger = '', $forcenowrap = 0) { global $conf, $langs; @@ -559,12 +559,13 @@ class Form if ($type == 'info' || $type == 'help') return $text; } + $img=''; if ($type == 'info') $img = img_help(0, $alt); elseif ($type == 'help') $img = img_help(($tooltiptrigger != '' ? 2 : 1), $alt); elseif ($type == 'superadmin') $img = img_picto($alt, 'redstar'); elseif ($type == 'admin') $img = img_picto($alt, 'star'); elseif ($type == 'warning') $img = img_warning($alt); - else $img = img_picto($alt, $type); + elseif ($type != 'none') $img = img_picto($alt, $type); // $type can be an image path return $this->textwithtooltip($text, $htmltext, (($tooltiptrigger && ! $img)?3:2), $direction, $img, $extracss, $notabs, '', $noencodehtmltext, $tooltiptrigger, $forcenowrap); } @@ -577,7 +578,7 @@ class Form * @param int $alwaysvisible 1=select button always visible * @return string Select list */ - function selectMassAction($selected, $arrayofaction, $alwaysvisible=0) + function selectMassAction($selected, $arrayofaction, $alwaysvisible = 0) { global $conf,$langs,$hookmanager; @@ -677,7 +678,7 @@ class Form * @param int $addspecialentries 1=Add dedicated entries for group of countries (like 'European Economic Community', ...) * @return string HTML string with select */ - function select_country($selected='', $htmlname='country_id', $htmloption='', $maxlength=0, $morecss='minwidth300', $usecodeaskey='', $showempty=1, $disablefavorites=0, $addspecialentries=0) + function select_country($selected = '', $htmlname = 'country_id', $htmloption = '', $maxlength = 0, $morecss = 'minwidth300', $usecodeaskey = '', $showempty = 1, $disablefavorites = 0, $addspecialentries = 0) { // phpcs:enable global $conf,$langs,$mysoc; @@ -790,7 +791,7 @@ class Form * @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) * @return string HTML string with select and input */ - function select_incoterms($selected='', $location_incoterms='', $page='', $htmlname='incoterm_id', $htmloption='', $forcecombo=1, $events=array()) + function select_incoterms($selected = '', $location_incoterms = '', $page = '', $htmlname = 'incoterm_id', $htmloption = '', $forcecombo = 1, $events = array()) { // phpcs:enable global $conf,$langs; @@ -883,7 +884,7 @@ class Form * @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, 2=Force to show only Products, 3=Force to show only services, -1=Force none (and set hidden field to 'service') * @return void */ - function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0) + function select_type_of_lines($selected = '', $htmlname = 'type', $showempty = 0, $hidetext = 0, $forceall = 0) { // phpcs:enable global $db,$langs,$user,$conf; @@ -986,7 +987,7 @@ class Form * @param int $showempty Add an empty field * @return void */ - function select_type_fees($selected='',$htmlname='type',$showempty=0) + function select_type_fees($selected = '', $htmlname = 'type', $showempty = 0) { // phpcs:enable global $user, $langs; @@ -1030,7 +1031,7 @@ class Form * @return string Return select box for thirdparty. * @deprecated 3.8 Use select_company instead. For exemple $form->select_thirdparty(GETPOST('socid'),'socid','',0) => $form->select_company(GETPOST('socid'),'socid','',1,0,0,array(),0) */ - function select_thirdparty($selected='', $htmlname='socid', $filter='', $limit=20, $ajaxoptions=array(), $forcecombo=0) + function select_thirdparty($selected = '', $htmlname = 'socid', $filter = '', $limit = 20, $ajaxoptions = array(), $forcecombo = 0) { // phpcs:enable return $this->select_thirdparty_list($selected,$htmlname,$filter,1,0,$forcecombo,array(),'',0, $limit); @@ -1056,7 +1057,7 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter) * @return string HTML string with select box for thirdparty. */ - function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false) + function select_company($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $limit = 0, $morecss = 'minwidth100', $moreparam = '', $selected_input_value = '', $hidelabel = 1, $ajaxoptions = array(), $multiple = false) { // phpcs:enable global $conf,$user,$langs; @@ -1080,7 +1081,7 @@ class Form $out.= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); $out.=''; if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : '; - else if ($hidelabel > 1) { + elseif ($hidelabel > 1) { $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; if ($hidelabel == 2) { $out.= img_picto($langs->trans("Search"), 'search'); @@ -1120,7 +1121,7 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return string HTML string with */ - function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false) + function select_thirdparty_list($selected = '', $htmlname = 'socid', $filter = '', $showempty = '', $showtype = 0, $forcecombo = 0, $events = array(), $filterkey = '', $outputmode = 0, $limit = 0, $morecss = 'minwidth100', $moreparam = '', $multiple = false) { // phpcs:enable global $conf,$user,$langs; @@ -1130,7 +1131,7 @@ class Form $outarray=array(); if ($selected === '') $selected = array(); - else if (!is_array($selected)) $selected = array($selected); + elseif (!is_array($selected)) $selected = array($selected); // Clean $filter that may contains sql conditions so sql code if (function_exists('testSqlAndScriptInject')) { @@ -1294,7 +1295,7 @@ class Form * @param int $maxvalue Max value for lines that can be selected * @return int Return number of qualifed lines in list */ - function select_remises($selected, $htmlname, $filter, $socid, $maxvalue=0) + function select_remises($selected, $htmlname, $filter, $socid, $maxvalue = 0) { // phpcs:enable global $langs,$conf; @@ -1381,7 +1382,7 @@ class Form * @return int <0 if KO, Nb of contact in list if OK * @deprected You can use selectcontacts directly (warning order of param was changed) */ - function select_contacts($socid,$selected='',$htmlname='contactid',$showempty=0,$exclude='',$limitto='',$showfunction=0, $moreclass='', $showsoc=0, $forcecombo=0, $events=array(), $options_only=false, $moreparam='', $htmlid='') + function select_contacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $showsoc = 0, $forcecombo = 0, $events = array(), $options_only = false, $moreparam = '', $htmlid = '') { // phpcs:enable print $this->selectcontacts($socid,$selected,$htmlname,$showempty,$exclude,$limitto,$showfunction, $moreclass, $options_only, $showsoc, $forcecombo, $events, $moreparam, $htmlid); @@ -1411,7 +1412,7 @@ class Form * @param bool $multiple add [] in the name of element and add 'multiple' attribut * @return int <0 if KO, Nb of contact in list if OK */ - function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='', $multiple=false) + function selectcontacts($socid, $selected = '', $htmlname = 'contactid', $showempty = 0, $exclude = '', $limitto = '', $showfunction = 0, $moreclass = '', $options_only = false, $showsoc = 0, $forcecombo = 0, $events = array(), $moreparam = '', $htmlid = '', $multiple = false) { global $conf,$langs,$hookmanager,$action; @@ -1420,7 +1421,7 @@ class Form if (empty($htmlid)) $htmlid = $htmlname; if ($selected === '') $selected = array(); - else if (!is_array($selected)) $selected = array($selected); + elseif (!is_array($selected)) $selected = array($selected); $out=''; if (! is_object($hookmanager)) @@ -1558,7 +1559,7 @@ class Form * @deprecated Use select_dolusers instead * @see select_dolusers() */ - function select_users($selected='',$htmlname='userid',$show_empty=0,$exclude=null,$disabled=0,$include='',$enableonly='',$force_entity='0') + function select_users($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0') { // phpcs:enable print $this->select_dolusers($selected,$htmlname,$show_empty,$exclude,$disabled,$include,$enableonly,$force_entity); @@ -1588,7 +1589,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false) + function select_dolusers($selected = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $show_every = 0, $enableonlytext = '', $morecss = '', $noactive = 0, $outputmode = 0, $multiple = false) { // phpcs:enable global $conf,$user,$langs; @@ -1597,7 +1598,7 @@ class Form if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id; if ($selected === '') $selected = array(); - else if (!is_array($selected)) $selected = array($selected); + elseif (!is_array($selected)) $selected = array($selected); $excludeUsers=null; $includeUsers=null; @@ -1606,12 +1607,12 @@ class Form if (is_array($exclude)) $excludeUsers = implode(",",$exclude); // Permettre l'inclusion d'utilisateurs if (is_array($include)) $includeUsers = implode(",",$include); - else if ($include == 'hierarchy') + elseif ($include == 'hierarchy') { // Build list includeUsers to have only hierarchy $includeUsers = implode(",",$user->getAllChildIds(0)); } - else if ($include == 'hierarchyme') + elseif ($include == 'hierarchyme') { // Build list includeUsers to have only hierarchy and current user $includeUsers = implode(",",$user->getAllChildIds(1)); @@ -1796,7 +1797,7 @@ class Form * @return string HTML select string * @see select_dolgroups */ - function select_dolusers_forevent($action='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $showproperties=0, $listofuserid=array(), $listofcontactid=array(), $listofotherid=array()) + function select_dolusers_forevent($action = '', $htmlname = 'userid', $show_empty = 0, $exclude = null, $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $maxlength = 0, $showstatus = 0, $morefilter = '', $showproperties = 0, $listofuserid = array(), $listofcontactid = array(), $listofotherid = array()) { // phpcs:enable global $conf, $user, $langs; @@ -1889,7 +1890,7 @@ class Form * @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...]) * @return void */ - function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array()) + function select_produits($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $status = 1, $finished = 2, $selected_input_value = '', $hidelabel = 0, $ajaxoptions = array(), $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '', $selected_combinations = array()) { // phpcs:enable global $langs,$conf; @@ -1990,7 +1991,7 @@ class Form trans("RefOrLabel").' : '; - else if ($hidelabel > 1) { + elseif ($hidelabel > 1) { $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"'; if ($hidelabel == 2) { print img_picto($langs->trans("Search"), 'search'); @@ -2003,7 +2004,7 @@ class Form } else { - print $this->select_produits_list($selected,$htmlname,$filtertype,$limit,$price_level,'',$status,$finished,0,$socid,$showempty,$forcecombo,$morecss,$hidepriceinlabel, $warehouseStatus); + print $this->select_produits_list($selected, $htmlname, $filtertype, $limit, $price_level, '', $status, $finished, 0, $socid, $showempty, $forcecombo, $morecss, $hidepriceinlabel, $warehouseStatus); } } @@ -2031,7 +2032,7 @@ class Form * 'warehouseinternal' = select products from warehouses for internal correct/transfer only * @return array Array of keys for json */ - function select_produits_list($selected='',$htmlname='productid',$filtertype='',$limit=20,$price_level=0,$filterkey='',$status=1,$finished=2,$outputmode=0,$socid=0,$showempty='1',$forcecombo=0,$morecss='',$hidepriceinlabel=0, $warehouseStatus='') + function select_produits_list($selected = '', $htmlname = 'productid', $filtertype = '', $limit = 20, $price_level = 0, $filterkey = '', $status = 1, $finished = 2, $outputmode = 0, $socid = 0, $showempty = '1', $forcecombo = 0, $morecss = '', $hidepriceinlabel = 0, $warehouseStatus = '') { // phpcs:enable global $langs,$conf,$user,$db; @@ -2224,6 +2225,10 @@ class Form if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); else $textifempty.=$langs->trans("All"); } + else + { + if ($showempty && ! is_numeric($showempty)) $textifempty=$langs->trans($showempty); + } if ($showempty) $out.=''; $i = 0; @@ -2323,7 +2328,7 @@ class Form * @param int $hidepriceinlabel Hide price in label * @return void */ - private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel=0) + private function constructProductListOption(&$objp, &$opt, &$optJson, $price_level, $selected, $hidepriceinlabel = 0) { global $langs,$conf,$user,$db; @@ -2366,7 +2371,7 @@ class Form if (! empty($conf->stock->enabled) && $objp->fk_product_type == 0 && isset($objp->stock)) { if ($objp->stock > 0) $opt.= ' class="product_line_stock_ok"'; - else if ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; + elseif ($objp->stock <= 0) $opt.= ' class="product_line_stock_too_low"'; } $opt.= '>'; $opt.= $objp->ref; @@ -2545,7 +2550,7 @@ class Form * @param string $morecss More CSS * @return void */ - function select_produits_fournisseurs($socid, $selected='', $htmlname='productid', $filtertype='', $filtre='', $ajaxoptions=array(), $hidelabel=0, $alsoproductwithnosupplierprice=0, $morecss='') + function select_produits_fournisseurs($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $ajaxoptions = array(), $hidelabel = 0, $alsoproductwithnosupplierprice = 0, $morecss = '') { // phpcs:enable global $langs,$conf; @@ -2591,7 +2596,7 @@ class Form * @param string $morecss Add more CSS * @return array Array of keys for json */ - function select_produits_fournisseurs_list($socid,$selected='',$htmlname='productid',$filtertype='',$filtre='',$filterkey='',$statut=-1,$outputmode=0,$limit=100,$alsoproductwithnosupplierprice=0,$morecss='') + function select_produits_fournisseurs_list($socid, $selected = '', $htmlname = 'productid', $filtertype = '', $filtre = '', $filterkey = '', $statut = -1, $outputmode = 0, $limit = 100, $alsoproductwithnosupplierprice = 0, $morecss = '') { // phpcs:enable global $langs,$conf,$db; @@ -2815,7 +2820,7 @@ class Form * @param int $selected_supplier Pre-selected supplier if more than 1 result * @return void */ - function select_product_fourn_price($productid, $htmlname='productfournpriceid', $selected_supplier='') + function select_product_fourn_price($productid, $htmlname = 'productfournpriceid', $selected_supplier = '') { // phpcs:enable global $langs,$conf; @@ -2929,7 +2934,7 @@ class Form * @param int $showempty Add an empty field * @return integer|null */ - function select_address($selected, $socid, $htmlname='address_id',$showempty=0) + function select_address($selected, $socid, $htmlname = 'address_id', $showempty = 0) { // phpcs:enable // looking for users @@ -3080,7 +3085,7 @@ class Form * @param int $addempty Add empty entry * @return void */ - function selectAvailabilityDelay($selected='',$htmlname='availid',$filtertype='',$addempty=0) + function selectAvailabilityDelay($selected = '', $htmlname = 'availid', $filtertype = '', $addempty = 0) { global $langs,$user; @@ -3166,7 +3171,7 @@ class Form * @param int $addempty Add an empty entry * @return void */ - function selectInputReason($selected='',$htmlname='demandreasonid',$exclude='',$addempty=0) + function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0) { global $langs,$user; @@ -3262,7 +3267,7 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ - function select_conditions_paiements($selected=0, $htmlname='condid', $filtertype=-1, $addempty=0, $noinfoadmin=0, $morecss='') + function select_conditions_paiements($selected = 0, $htmlname = 'condid', $filtertype = -1, $addempty = 0, $noinfoadmin = 0, $morecss = '') { // phpcs:enable global $langs, $user, $conf; @@ -3309,7 +3314,7 @@ class Form * @param string $morecss Add more CSS on select tag * @return void */ - function select_types_paiements($selected='', $htmlname='paiementtype', $filtertype='', $format=0, $empty=1, $noadmininfo=0, $maxlength=0, $active=1, $morecss='') + function select_types_paiements($selected = '', $htmlname = 'paiementtype', $filtertype = '', $format = 0, $empty = 1, $noadmininfo = 0, $maxlength = 0, $active = 1, $morecss = '') { // phpcs:enable global $langs,$user; @@ -3363,7 +3368,7 @@ class Form * @param string $htmlname Nom de la zone select * @return string Code of HTML select to chose tax or not */ - function selectPriceBaseType($selected='',$htmlname='price_base_type') + function selectPriceBaseType($selected = '', $htmlname = 'price_base_type') { global $langs; @@ -3401,7 +3406,7 @@ class Form * @param string $moreattrib To add more attribute on select * @return void */ - function selectShippingMethod($selected='',$htmlname='shipping_method_id',$filtre='',$useempty=0,$moreattrib='') + function selectShippingMethod($selected = '', $htmlname = 'shipping_method_id', $filtre = '', $useempty = 0, $moreattrib = '') { global $langs, $conf, $user; @@ -3454,7 +3459,7 @@ class Form * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @return void */ - function formSelectShippingMethod($page, $selected='', $htmlname='shipping_method_id', $addempty=0) + function formSelectShippingMethod($page, $selected = '', $htmlname = 'shipping_method_id', $addempty = 0) { global $langs, $db; @@ -3539,7 +3544,7 @@ class Form * @param int $showempty Add a nempty line * @return string HTML select */ - function selectUnits($selected = '', $htmlname = 'units', $showempty=0) + function selectUnits($selected = '', $htmlname = 'units', $showempty = 0) { global $langs; @@ -3590,7 +3595,7 @@ class Form * @param int $showcurrency Show currency in label * @return int <0 if error, Num of bank account found if OK (0, 1, 2, ...) */ - function select_comptes($selected='',$htmlname='accountid',$statut=0,$filtre='',$useempty=0,$moreattrib='',$showcurrency=0) + function select_comptes($selected = '', $htmlname = 'accountid', $statut = 0, $filtre = '', $useempty = 0, $moreattrib = '', $showcurrency = 0) { // phpcs:enable global $langs, $conf; @@ -3660,7 +3665,7 @@ class Form * @param int $addempty 1=Add an empty value in list, 2=Add an empty value in list only if there is more than 2 entries. * @return void */ - function formSelectAccount($page, $selected='', $htmlname='fk_account', $addempty=0) + function formSelectAccount($page, $selected = '', $htmlname = 'fk_account', $addempty = 0) { global $langs; if ($htmlname != "none") { @@ -3698,7 +3703,7 @@ class Form * @return string * @see select_categories */ - function select_all_categories($type, $selected='', $htmlname="parent", $maxlength=64, $excludeafterid=0, $outputmode=0) + function select_all_categories($type, $selected = '', $htmlname = "parent", $maxlength = 64, $excludeafterid = 0, $outputmode = 0) { // phpcs:enable global $conf, $langs; @@ -3789,7 +3794,7 @@ class Form * @deprecated * @see formconfirm() */ - function form_confirm($page, $title, $question, $action, $formquestion='', $selectedchoice="", $useajax=0, $height=170, $width=500) + function form_confirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = "", $useajax = 0, $height = 170, $width = 500) { // phpcs:enable dol_syslog(__METHOD__ . ': using form_confirm is deprecated. Use formconfim instead.', LOG_WARNING); @@ -3820,7 +3825,7 @@ class Form * @param int $disableformtag 1=Disable form tag. Can be used if we are already inside a
section. * @return string HTML ajax code if a confirm ajax popup is required, Pure HTML code if it's an html form */ - function formconfirm($page, $title, $question, $action, $formquestion='', $selectedchoice='', $useajax=0, $height=210, $width=500, $disableformtag=0) + function formconfirm($page, $title, $question, $action, $formquestion = '', $selectedchoice = '', $useajax = 0, $height = 210, $width = 500, $disableformtag = 0) { global $langs,$conf; global $useglobalvars; @@ -4100,7 +4105,7 @@ class Form * @param int $nooutput No print is done. String is returned. * @return string Return html content */ - function form_project($page, $socid, $selected='', $htmlname='projectid', $discard_closed=0, $maxlength=20, $forcefocus=0, $nooutput=0) + function form_project($page, $socid, $selected = '', $htmlname = 'projectid', $discard_closed = 0, $maxlength = 20, $forcefocus = 0, $nooutput = 0) { // phpcs:enable global $langs; @@ -4156,7 +4161,7 @@ class Form * @param int $addempty Add empty entry * @return void */ - function form_conditions_reglement($page, $selected='', $htmlname='cond_reglement_id', $addempty=0) + function form_conditions_reglement($page, $selected = '', $htmlname = 'cond_reglement_id', $addempty = 0) { // phpcs:enable global $langs; @@ -4191,7 +4196,7 @@ class Form * @param int $addempty Ajoute entree vide * @return void */ - function form_availability($page, $selected='', $htmlname='availability', $addempty=0) + function form_availability($page, $selected = '', $htmlname = 'availability', $addempty = 0) { // phpcs:enable global $langs; @@ -4226,7 +4231,7 @@ class Form * @param int $addempty Add empty entry * @return void */ - function formInputReason($page, $selected='', $htmlname='demandreason', $addempty=0) + function formInputReason($page, $selected = '', $htmlname = 'demandreason', $addempty = 0) { global $langs; if ($htmlname != "none") @@ -4270,7 +4275,7 @@ class Form * @return string * @see selectDate */ - function form_date($page, $selected, $htmlname, $displayhour=0, $displaymin=0, $nooutput=0) + function form_date($page, $selected, $htmlname, $displayhour = 0, $displaymin = 0, $nooutput = 0) { // phpcs:enable global $langs; @@ -4311,7 +4316,7 @@ class Form * @param array $include List of users id to include * @return void */ - function form_users($page, $selected='', $htmlname='userid', $exclude='', $include='') + function form_users($page, $selected = '', $htmlname = 'userid', $exclude = '', $include = '') { // phpcs:enable global $langs; @@ -4352,7 +4357,7 @@ class Form * @param int $addempty 1=Add empty entry * @return void */ - function form_modes_reglement($page, $selected='', $htmlname='mode_reglement_id', $filtertype='', $active=1, $addempty=0) + function form_modes_reglement($page, $selected = '', $htmlname = 'mode_reglement_id', $filtertype = '', $active = 1, $addempty = 0) { // phpcs:enable global $langs; @@ -4386,7 +4391,7 @@ class Form * @param string $htmlname Name of select html field * @return void */ - function form_multicurrency_code($page, $selected='', $htmlname='multicurrency_code') + function form_multicurrency_code($page, $selected = '', $htmlname = 'multicurrency_code') { // phpcs:enable global $langs; @@ -4416,7 +4421,7 @@ class Form * @param string $currency Currency code to explain the rate * @return void */ - function form_multicurrency_rate($page, $rate='', $htmlname='multicurrency_tx', $currency='') + function form_multicurrency_rate($page, $rate = '', $htmlname = 'multicurrency_tx', $currency = '') { // phpcs:enable global $langs, $mysoc, $conf; @@ -4465,7 +4470,7 @@ class Form * @param int $discount_type 0 => customer discount, 1 => supplier discount * @return void */ - function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter='', $maxvalue=0, $more='', $hidelist=0, $discount_type=0) + function form_remise_dispo($page, $selected, $htmlname, $socid, $amount, $filter = '', $maxvalue = 0, $more = '', $hidelist = 0, $discount_type = 0) { // phpcs:enable global $conf,$langs; @@ -4556,7 +4561,7 @@ class Form * @param string $htmlname Name of HTML select. If 'none', we just show contact link. * @return void */ - function form_contacts($page, $societe, $selected='', $htmlname='contactid') + function form_contacts($page, $societe, $selected = '', $htmlname = 'contactid') { // phpcs:enable global $langs, $conf; @@ -4607,7 +4612,7 @@ class Form * @param int $nooutput No print output. Return it only. * @return void */ - function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $nooutput=0) + function form_thirdparty($page, $selected = '', $htmlname = 'socid', $filter = '', $showempty = 0, $showtype = 0, $forcecombo = 0, $events = array(), $nooutput = 0) { // phpcs:enable global $langs; @@ -4650,7 +4655,7 @@ class Form * @deprecated * @return void */ - function select_currency($selected='',$htmlname='currency_id') + function select_currency($selected = '', $htmlname = 'currency_id') { // phpcs:enable print $this->selectCurrency($selected,$htmlname); @@ -4663,7 +4668,7 @@ class Form * @param string $htmlname name of HTML select list * @return string */ - function selectCurrency($selected='',$htmlname='currency_id') + function selectCurrency($selected = '', $htmlname = 'currency_id') { global $conf,$langs,$user; @@ -4706,7 +4711,7 @@ class Form * @param integer $useempty 1=Add empty line * @return string */ - function selectMultiCurrency($selected='', $htmlname='multicurrency_code', $useempty=0) + function selectMultiCurrency($selected = '', $htmlname = 'multicurrency_code', $useempty = 0) { global $db,$conf,$langs,$user; @@ -4843,7 +4848,7 @@ class Form * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key * @return string */ - function load_tva($htmlname='tauxtva', $selectedrate='', $societe_vendeuse='', $societe_acheteuse='', $idprod=0, $info_bits=0, $type='', $options_only=false, $mode=0) + function load_tva($htmlname = 'tauxtva', $selectedrate = '', $societe_vendeuse = '', $societe_acheteuse = '', $idprod = 0, $info_bits = 0, $type = '', $options_only = false, $mode = 0) { // phpcs:enable global $langs,$conf,$mysoc; @@ -4905,7 +4910,7 @@ class Form $code_country.=",'".$societe_acheteuse->country_code."'"; } } - else if (! $idprod) // We don't know type of product + elseif (! $idprod) // We don't know type of product { $code_country.=",'".$societe_acheteuse->country_code."'"; } @@ -5043,7 +5048,7 @@ class Form * @deprecated * @see form_date, select_month, select_year, select_dayofweek */ - function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') + function select_date($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $nooutput = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') { // phpcs:enable $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); @@ -5076,7 +5081,7 @@ class Form * @return string Html for selectDate * @see form_date, select_month, select_year, select_dayofweek */ - function selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') + function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') { global $conf,$langs; @@ -5439,7 +5444,7 @@ class Form * @param int $nooutput Do not output html string but return it * @return string|void */ - function select_duration($prefix, $iSecond='', $disabled=0, $typehour='select', $minunderhours=0, $nooutput=0) + function select_duration($prefix, $iSecond = '', $disabled = 0, $typehour = 'select', $minunderhours = 0, $nooutput = 0) { // phpcs:enable global $langs; @@ -5527,7 +5532,7 @@ class Form * @return string Return HTML string * @see selectForFormsList select_thirdparty */ - function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0) + function selectForForms($objectdesc, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0) { global $conf, $user; @@ -5597,7 +5602,7 @@ class Form * @return string Return HTML string * @see selectForForms */ - function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty='', $searchkey='', $placeholder='', $morecss='', $moreparams='', $forcecombo=0, $outputmode=0) + function selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty = '', $searchkey = '', $placeholder = '', $morecss = '', $moreparams = '', $forcecombo = 0, $outputmode = 0) { global $conf, $langs, $user; @@ -5734,7 +5739,7 @@ class Form * @return string HTML select string. * @see multiselectarray, selectArrayAjax, selectArrayFilter */ - static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='',$disablebademail=0, $nohtmlescape=0) + static function selectarray($htmlname, $array, $id = '', $show_empty = 0, $key_in_label = 0, $value_as_key = 0, $moreparam = '', $translate = 0, $maxlen = 0, $disabled = 0, $sort = '', $morecss = '', $addjscombo = 0, $moreparamonempty = '', $disablebademail = 0, $nohtmlescape = 0) { global $conf, $langs; @@ -5844,7 +5849,7 @@ class Form * @return string HTML select string * @see selectArrayFilter, ajax_combobox in ajax.lib.php */ - static function selectArrayAjax($htmlname, $url, $id='', $moreparam='', $moreparamtourl='', $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) + static function selectArrayAjax($htmlname, $url, $id = '', $moreparam = '', $moreparamtourl = '', $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) { global $conf, $langs; global $delayedhtmlcontent; @@ -5946,7 +5951,7 @@ class Form * @return string HTML select string * @see selectArrayAjax, ajax_combobox in ajax.lib.php */ - static function selectArrayFilter($htmlname, $array, $id='', $moreparam='', $disableFiltering=0, $disabled=0, $minimumInputLength=1, $morecss='', $callurlonselect=0, $placeholder='', $acceptdelayedhtml=0) + static function selectArrayFilter($htmlname, $array, $id = '', $moreparam = '', $disableFiltering = 0, $disabled = 0, $minimumInputLength = 1, $morecss = '', $callurlonselect = 0, $placeholder = '', $acceptdelayedhtml = 0) { global $conf, $langs; global $delayedhtmlcontent; @@ -6064,7 +6069,7 @@ class Form * @return string HTML multiselect string * @see selectarray, selectArrayAjax, selectArrayFilter */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=-1) + static function multiselectarray($htmlname, $array, $selected = array(), $key_in_label = 0, $value_as_key = 0, $morecss = '', $translate = 0, $width = 0, $moreattrib = '', $elemtype = '', $placeholder = '', $addjscombo = -1) { global $conf, $langs; @@ -6263,7 +6268,7 @@ class Form * @param int $rendermode 0=Default, use multiselect. 1=Emulate multiselect (recommended) * @return string String with categories */ - function showCategories($id, $type, $rendermode=0) + function showCategories($id, $type, $rendermode = 0) { global $db; @@ -6308,7 +6313,7 @@ class Form * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action * @return int <0 if KO, >=0 if OK */ - function showLinkedObjectBlock($object, $morehtmlright='',$compatibleImportElementsList=false) + function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = false) { global $conf,$langs,$hookmanager; global $bc; @@ -6369,40 +6374,40 @@ class Form $tplpath = 'compta/'.$element; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'facturerec') { + elseif ($objecttype == 'facturerec') { $tplpath = 'compta/facture'; $tplname = 'linkedobjectblockForRec'; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'propal') { + elseif ($objecttype == 'propal') { $tplpath = 'comm/'.$element; if (empty($conf->propal->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'supplier_proposal') { + elseif ($objecttype == 'supplier_proposal') { if (empty($conf->supplier_proposal->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'shipping' || $objecttype == 'shipment') { + elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { $tplpath = 'expedition'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'reception') { + elseif ($objecttype == 'reception') { $tplpath = 'reception'; if (empty($conf->reception->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'delivery') { + elseif ($objecttype == 'delivery') { $tplpath = 'livraison'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled } - else if ($objecttype == 'invoice_supplier') { + elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; } - else if ($objecttype == 'order_supplier') { + elseif ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; } - else if ($objecttype == 'expensereport') { + elseif ($objecttype == 'expensereport') { $tplpath = 'expensereport'; } - else if ($objecttype == 'subscription') { + elseif ($objecttype == 'subscription') { $tplpath = 'adherents'; } @@ -6456,7 +6461,7 @@ class Form * @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion. * @return string <0 if KO, >0 if OK */ - function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinksto=array()) + function showLinkToObjectBlock($object, $restrictlinksto = array(), $excludelinksto = array()) { global $conf, $langs, $hookmanager; global $bc; @@ -6508,7 +6513,7 @@ class Form $possiblelinks=array_merge($possiblelinks, $hookmanager->resArray); } } - else if ($reshook > 0) + elseif ($reshook > 0) { if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { @@ -6629,7 +6634,7 @@ class Form * @param int $useempty 1=Add empty line * @return string See option */ - function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty=0) + function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0) { global $langs; @@ -6671,7 +6676,7 @@ class Form * @param int $useempty Affiche valeur vide dans liste * @return void */ - function select_export_model($selected='',$htmlname='exportmodelid',$type='',$useempty=0) + function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0) { // phpcs:enable $sql = "SELECT rowid, label"; @@ -6729,7 +6734,7 @@ class Form * @param string $morehtmlright More html code to show after ref. * @return string Portion HTML with ref + navigation buttons */ - function showrefnav($object,$paramid,$morehtml='',$shownav=1,$fieldid='rowid',$fieldref='ref',$morehtmlref='',$moreparam='',$nodbprefix=0,$morehtmlleft='',$morehtmlstatus='',$morehtmlright='') + function showrefnav($object, $paramid, $morehtml = '', $shownav = 1, $fieldid = 'rowid', $fieldref = 'ref', $morehtmlref = '', $moreparam = '', $nodbprefix = 0, $morehtmlleft = '', $morehtmlstatus = '', $morehtmlright = '') { global $langs,$conf,$hookmanager; @@ -6831,7 +6836,7 @@ class Form { $ret.=dol_htmlentities($object->name); } - else if ($object->element == 'member') + elseif ($object->element == 'member') { $ret.=$object->ref.'
'; $fullname=$object->getFullName($langs); @@ -6841,23 +6846,23 @@ class Form $ret.= dol_htmlentities($fullname) . ((! empty($object->societe) && $object->societe != $fullname)?' ('.dol_htmlentities($object->societe).')':''); } } - else if (in_array($object->element, array('contact', 'user', 'usergroup'))) + elseif (in_array($object->element, array('contact', 'user', 'usergroup'))) { $ret.=dol_htmlentities($object->getFullName($langs)); } - else if (in_array($object->element, array('action', 'agenda'))) + elseif (in_array($object->element, array('action', 'agenda'))) { $ret.=$object->ref.'
'.$object->label; } - else if (in_array($object->element, array('adherent_type'))) + elseif (in_array($object->element, array('adherent_type'))) { $ret.=$object->label; } - else if ($object->element == 'ecm_directories') + elseif ($object->element == 'ecm_directories') { $ret.=''; } - else if ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); + elseif ($fieldref != 'none') $ret.=dol_htmlentities($object->$fieldref); if ($morehtmlref) @@ -6879,7 +6884,7 @@ class Form * @param int $width Width of photo * @return string HTML code to output barcode */ - function showbarcode(&$object,$width=100) + function showbarcode(&$object, $width = 100) { global $conf; @@ -6916,7 +6921,7 @@ class Form * @param string $forcecapture Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if empty. * @return string HTML code to output photo */ - static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0, $forcecapture='') + static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '') { global $conf,$langs; @@ -6930,32 +6935,32 @@ class Form if (! empty($object->logo)) { if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_mini'); // getImageFileNameForSize include the thumbs - else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small'); + elseif ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.getImageFileNameForSize($object->logo, '_small'); else $file=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'thirdparty').'/logos/'.$object->logo; } $email=$object->email; } - else if ($modulepart=='contact') + elseif ($modulepart=='contact') { $dir=$conf->societe->multidir_output[$entity].'/contact'; if (! empty($object->photo)) { if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_mini'); - else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small'); + elseif ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo; } $email=$object->email; $capture='user'; } - else if ($modulepart=='userphoto') + elseif ($modulepart=='userphoto') { $dir=$conf->user->dir_output; if (! empty($object->photo)) { if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_mini'); - else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_small'); + elseif ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'user').$object->id.'/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'user').'/'.$object->id.'/'.$object->photo; } @@ -6963,13 +6968,13 @@ class Form $email=$object->email; $capture='user'; } - else if ($modulepart=='memberphoto') + elseif ($modulepart=='memberphoto') { $dir=$conf->adherent->dir_output; if (! empty($object->photo)) { if ((string) $imagesize == 'mini') $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); - else if ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); + elseif ((string) $imagesize == 'small') $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; $originalfile=get_exdir(0, 0, 0, 0, $object, 'member').'photos/'.$object->photo; } @@ -6984,7 +6989,7 @@ class Form if (! empty($object->photo)) { if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini'); - else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); + elseif ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; $originalfile=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; } @@ -7007,7 +7012,7 @@ class Form $ret.='Photo'; if ($addlinktofullsize) $ret.=''; } - else if ($altfile && file_exists($dir."/".$altfile)) + elseif ($altfile && file_exists($dir."/".$altfile)) { if ($addlinktofullsize) { @@ -7075,7 +7080,7 @@ class Form * @return string * @see select_dolusers */ - function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false) + function select_dolgroups($selected = '', $htmlname = 'groupid', $show_empty = 0, $exclude = '', $disabled = 0, $include = '', $enableonly = '', $force_entity = '0', $multiple = false) { // phpcs:enable global $conf,$user,$langs; @@ -7190,7 +7195,7 @@ class Form * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes * @return string */ - function showCheckAddButtons($cssclass='checkforaction', $calljsfunction=0) + function showCheckAddButtons($cssclass = 'checkforaction', $calljsfunction = 0) { global $conf, $langs; @@ -7229,7 +7234,7 @@ class Form * @param int $calljsfunction 0=default. 1=call function initCheckForSelect() after changing status of checkboxes * @return string */ - function showFilterAndCheckAddButtons($addcheckuncheckall=0, $cssclass='checkforaction', $calljsfunction=0) + function showFilterAndCheckAddButtons($addcheckuncheckall = 0, $cssclass = 'checkforaction', $calljsfunction = 0) { $out.=$this->showFilterButtons(); if ($addcheckuncheckall) @@ -7251,7 +7256,7 @@ class Form * @param array $params param to give * @return string */ - function selectExpenseCategories($selected='', $htmlname='fk_c_exp_tax_cat', $useempty=0, $excludeid=array(), $target='', $default_selected=0, $params=array()) + function selectExpenseCategories($selected = '', $htmlname = 'fk_c_exp_tax_cat', $useempty = 0, $excludeid = array(), $target = '', $default_selected = 0, $params = array()) { global $db, $conf, $langs, $user; @@ -7340,7 +7345,7 @@ class Form * @param integer $useempty 1=Add empty line * @return string */ - function selectExpenseRanges($selected='', $htmlname='fk_range', $useempty=0) + function selectExpenseRanges($selected = '', $htmlname = 'fk_range', $useempty = 0) { global $db,$conf,$langs; @@ -7377,7 +7382,7 @@ class Form * @param integer $useid 0=use 'code' as key, 1=use 'id' as key * @return string */ - function selectExpense($selected='', $htmlname='fk_c_type_fees', $useempty=0, $allchoice=1, $useid=0) + function selectExpense($selected = '', $htmlname = 'fk_c_type_fees', $useempty = 0, $allchoice = 1, $useid = 0) { global $db,$langs; diff --git a/htdocs/core/class/html.formaccounting.class.php b/htdocs/core/class/html.formaccounting.class.php index 5ffaf0463a6..8b4c4e5390d 100644 --- a/htdocs/core/class/html.formaccounting.class.php +++ b/htdocs/core/class/html.formaccounting.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2016 Marcos García - * Copyright (C) 2016-2017 Alexandre Spangaro + * Copyright (C) 2016-2017 Alexandre Spangaro * * 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 @@ -70,7 +70,7 @@ class FormAccounting extends Form * @param int $disabledajaxcombo Disable ajax combo box. * @return string String with HTML select */ - function select_journal($selectid, $htmlname = 'journal', $nature=0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='', $disabledajaxcombo=0) + function select_journal($selectid, $htmlname = 'journal', $nature = 0, $showempty = 0, $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '', $disabledajaxcombo = 0) { // phpcs:enable global $conf,$langs; @@ -151,7 +151,7 @@ class FormAccounting extends Form * @param int $allcountries All countries * @return void */ - function select_accounting_category($selected='',$htmlname='account_category', $useempty=0, $maxlen=0, $help=1, $allcountries=0) + function select_accounting_category($selected = '', $htmlname = 'account_category', $useempty = 0, $maxlen = 0, $help = 1, $allcountries = 0) { // phpcs:enable global $db,$langs,$user,$mysoc; @@ -267,7 +267,7 @@ class FormAccounting extends Form * @param string $usecache Key to use to store result into a cache. Next call with same key will reuse the cache. * @return string String with HTML select */ - function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss='maxwidth300 maxwidthonsmartphone', $usecache='') + function select_account($selectid, $htmlname = 'account', $showempty = 0, $event = array(), $select_in = 0, $select_out = 0, $morecss = 'maxwidth300 maxwidthonsmartphone', $usecache = '') { // phpcs:enable global $conf, $langs; @@ -356,7 +356,7 @@ class FormAccounting extends Form * @param string $morecss More css * @return string String with HTML select */ - function select_auxaccount($selectid, $htmlname='account_num_aux', $showempty=0, $morecss='maxwidth200') + function select_auxaccount($selectid, $htmlname = 'account_num_aux', $showempty = 0, $morecss = 'maxwidth200') { // phpcs:enable diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 15db641a5ec..2f345bb20e4 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -64,7 +64,7 @@ class FormActions * @param string $morecss More css on select field * @return void */ - function form_select_status_action($formname, $selected, $canedit=1, $htmlname='complete', $showempty=0, $onlyselect=0, $morecss='maxwidth100') + function form_select_status_action($formname, $selected, $canedit = 1, $htmlname = 'complete', $showempty = 0, $onlyselect = 0, $morecss = 'maxwidth100') { // phpcs:enable global $langs,$conf; @@ -168,7 +168,7 @@ class FormActions * @param string $morehtmlright More html text on right of title line * @return int <0 if KO, >=0 if OK */ - function showactions($object, $typeelement, $socid=0, $forceshowtitle=0, $morecss='listactions', $max=0, $moreparambacktopage='', $morehtmlright='') + function showactions($object, $typeelement, $socid = 0, $forceshowtitle = 0, $morecss = 'listactions', $max = 0, $moreparambacktopage = '', $morehtmlright = '') { global $langs,$conf,$user; global $bc; @@ -327,7 +327,7 @@ class FormActions * @param int $nooutput 1=No output * @return string */ - function select_type_actions($selected='', $htmlname='actioncode', $excludetype='', $onlyautoornot=0, $hideinfohelp=0, $multiselect=0, $nooutput=0) + function select_type_actions($selected = '', $htmlname = 'actioncode', $excludetype = '', $onlyautoornot = 0, $hideinfohelp = 0, $multiselect = 0, $nooutput = 0) { // phpcs:enable global $langs,$user,$form,$conf; diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 32a421a7b61..ddfe8682081 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -59,7 +59,7 @@ class FormAdmin * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @return string Return HTML select string with list of languages */ - function select_language($selected='', $htmlname='lang_id', $showauto=0, $filter=null, $showempty='', $showwarning=0, $disabled=0, $morecss='', $showcode=0, $forcecombo=0) + function select_language($selected = '', $htmlname = 'lang_id', $showauto = 0, $filter = null, $showempty = '', $showwarning = 0, $disabled = 0, $morecss = '', $showcode = 0, $forcecombo = 0) { // phpcs:enable global $langs; @@ -100,7 +100,7 @@ class FormAdmin $out.= ''; } } - else if ($selected == $key) + elseif ($selected == $key) { $out.= ''; } @@ -131,7 +131,7 @@ class FormAdmin * @param string $moreattrib More attributes on html select tag * @return integer|null */ - function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib='') + function select_menu($selected, $htmlname, $dirmenuarray, $moreattrib = '') { // phpcs:enable global $langs,$conf; @@ -167,7 +167,7 @@ class FormAdmin $prefix=''; // 0=Recommanded, 1=Experimental, 2=Developpement, 3=Other if (preg_match('/^eldy/i',$file)) $prefix='0'; - else if (preg_match('/^smartphone/i',$file)) $prefix='2'; + elseif (preg_match('/^smartphone/i',$file)) $prefix='2'; else $prefix='3'; if ($file == $selected) @@ -293,7 +293,7 @@ class FormAdmin * @param string $htmlname Nom de la zone select * @return void */ - function select_timezone($selected,$htmlname) + function select_timezone($selected, $htmlname) { // phpcs:enable global $langs,$conf; @@ -349,7 +349,7 @@ class FormAdmin * @param int $showempty Add empty value * @return string Return HTML output */ - function select_paper_format($selected='',$htmlname='paperformat_id',$filter=0,$showempty=0) + function select_paper_format($selected = '', $htmlname = 'paperformat_id', $filter = 0, $showempty = 0) { // phpcs:enable global $langs; diff --git a/htdocs/core/class/html.formbank.class.php b/htdocs/core/class/html.formbank.class.php index 9cf60cc45b1..b86c5262e07 100644 --- a/htdocs/core/class/html.formbank.class.php +++ b/htdocs/core/class/html.formbank.class.php @@ -1,6 +1,6 @@ - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -79,4 +79,3 @@ class FormBank return 'IBANNumber'; } } - diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 65a3213bad8..f7a7199ab03 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -60,7 +60,7 @@ class FormBarCode * @param int $idForm Id du formulaire * @return string HTML select string */ - function setBarcodeEncoder($selected,$barcodelist,$code_id,$idForm='formbarcode') + function setBarcodeEncoder($selected, $barcodelist, $code_id, $idForm = 'formbarcode') { global $conf, $langs; @@ -123,7 +123,7 @@ class FormBarCode * @return void * @deprecated */ - function select_barcode_type($selected='', $htmlname='barcodetype_id', $useempty=0) + function select_barcode_type($selected = '', $htmlname = 'barcodetype_id', $useempty = 0) { // phpcs:enable print $this->selectBarcodeType($selected, $htmlname, $useempty); @@ -137,7 +137,7 @@ class FormBarCode * @param int $useempty Display empty value in select * @return string */ - function selectBarcodeType($selected='', $htmlname='barcodetype_id', $useempty=0) + function selectBarcodeType($selected = '', $htmlname = 'barcodetype_id', $useempty = 0) { global $langs, $conf; @@ -193,7 +193,7 @@ class FormBarCode * @return void * @deprecated */ - function form_barcode_type($page, $selected='', $htmlname='barcodetype_id') + function form_barcode_type($page, $selected = '', $htmlname = 'barcodetype_id') { // phpcs:enable print $this->formBarcodeType($page, $selected, $htmlname); @@ -207,7 +207,7 @@ class FormBarCode * @param string $htmlname Nom du formulaire select * @return string */ - function formBarcodeType($page, $selected='', $htmlname='barcodetype_id') + function formBarcodeType($page, $selected = '', $htmlname = 'barcodetype_id') { global $langs, $conf; $out = ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 9d0bded74b6..e1315a9b244 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -60,7 +60,7 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types */ - function typent_array($mode=0, $filter='') + function typent_array($mode = 0, $filter = '') { // phpcs:enable global $langs,$mysoc; @@ -103,7 +103,7 @@ class FormCompany * @param string $filter Add a SQL filter to select * @return array Array of types d'effectifs */ - function effectif_array($mode=0, $filter='') + function effectif_array($mode = 0, $filter = '') { // phpcs:enable $effs = array(); @@ -145,7 +145,7 @@ class FormCompany * @param int $empty Add empty value in list * @return void */ - function form_prospect_level($page, $selected='', $htmlname='prospect_level_id', $empty=0) + function form_prospect_level($page, $selected = '', $htmlname = 'prospect_level_id', $empty = 0) { // phpcs:enable global $user, $langs; @@ -199,7 +199,7 @@ class FormCompany * @param string $htmlname Id of department * @return void */ - function select_departement($selected='',$country_codeid=0, $htmlname='state_id') + function select_departement($selected = '', $country_codeid = 0, $htmlname = 'state_id') { // phpcs:enable print $this->select_state($selected,$country_codeid, $htmlname); @@ -219,7 +219,7 @@ class FormCompany * @return string String with HTML select * @see select_country */ - function select_state($selected='',$country_codeid=0, $htmlname='state_id') + function select_state($selected = '', $country_codeid = 0, $htmlname = 'state_id') { // phpcs:enable global $conf,$langs,$user; @@ -332,7 +332,7 @@ class FormCompany * @param string $htmlname Name of HTML select field * @return void */ - function select_region($selected='',$htmlname='region_id') + function select_region($selected = '', $htmlname = 'region_id') { // phpcs:enable global $conf,$langs; @@ -398,7 +398,7 @@ class FormCompany * @param string $morecss Add more css on SELECT element * @return string String with HTML select */ - function select_civility($selected='',$htmlname='civility_id',$morecss='maxwidth100') + function select_civility($selected = '', $htmlname = 'civility_id', $morecss = 'maxwidth100') { // phpcs:enable global $conf,$langs,$user; @@ -459,7 +459,7 @@ class FormCompany * @deprecated Use print xxx->select_juridicalstatus instead * @see select_juridicalstatus() */ - function select_forme_juridique($selected='', $country_codeid=0, $filter='') + function select_forme_juridique($selected = '', $country_codeid = 0, $filter = '') { // phpcs:enable print $this->select_juridicalstatus($selected, $country_codeid, $filter); @@ -476,7 +476,7 @@ class FormCompany * @param string $htmlname HTML name of select * @return string String with HTML select */ - function select_juridicalstatus($selected='', $country_codeid=0, $filter='', $htmlname='forme_juridique_code') + function select_juridicalstatus($selected = '', $country_codeid = 0, $filter = '', $htmlname = 'forme_juridique_code') { // phpcs:enable global $conf,$langs,$user; @@ -581,7 +581,7 @@ class FormCompany * @param string $morecss More CSS on select component * @return int The selected third party ID */ - function selectCompaniesForNewContact($object, $var_id, $selected='', $htmlname='newcompany', $limitto='', $forceid=0, $moreparam='', $morecss='') + function selectCompaniesForNewContact($object, $var_id, $selected = '', $htmlname = 'newcompany', $limitto = '', $forceid = 0, $moreparam = '', $morecss = '') { global $conf, $langs; @@ -740,7 +740,7 @@ class FormCompany * @param string $morecss Add more css to select component * @return void */ - function selectTypeContact($object, $selected, $htmlname = 'type', $source='internal', $sortorder='position', $showempty=0, $morecss='') + function selectTypeContact($object, $selected, $htmlname = 'type', $source = 'internal', $sortorder = 'position', $showempty = 0, $morecss = '') { global $user, $langs; @@ -774,7 +774,7 @@ class FormCompany * @param string $morecss More css * @return string */ - function select_ziptown($selected='', $htmlname='zipcode', $fields='', $fieldsize=0, $disableautocomplete=0, $moreattrib='',$morecss='') + function select_ziptown($selected = '', $htmlname = 'zipcode', $fields = '', $fieldsize = 0, $disableautocomplete = 0, $moreattrib = '', $morecss = '') { // phpcs:enable global $conf; @@ -805,7 +805,7 @@ class FormCompany * @param string $morecss More css * @return string HTML string with prof id */ - function get_input_id_prof($idprof,$htmlname,$preselected,$country_code,$morecss='maxwidth100onsmartphone quatrevingtpercent') + function get_input_id_prof($idprof, $htmlname, $preselected, $country_code, $morecss = 'maxwidth100onsmartphone quatrevingtpercent') { // phpcs:enable global $conf,$langs; @@ -816,12 +816,12 @@ class FormCompany { if (isset($idprof)) { if ($idprof==1) $formlength=9; - else if ($idprof==2) $formlength=14; - else if ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier - else if ($idprof==4) $formlength=32; // No maximum as we need to include a town name in this id + elseif ($idprof==2) $formlength=14; + elseif ($idprof==3) $formlength=5; // 4 chiffres et 1 lettre depuis janvier + elseif ($idprof==4) $formlength=32; // No maximum as we need to include a town name in this id } } - else if ($country_code == 'ES') + elseif ($country_code == 'ES') { if ($idprof==1) $formlength=9; //CIF/NIF/NIE 9 digits if ($idprof==2) $formlength=12; //NASS 12 digits without / @@ -833,9 +833,9 @@ class FormCompany $selected=$preselected; if (! $selected && isset($idprof)) { if ($idprof==1 && ! empty($this->idprof1)) $selected=$this->idprof1; - else if ($idprof==2 && ! empty($this->idprof2)) $selected=$this->idprof2; - else if ($idprof==3 && ! empty($this->idprof3)) $selected=$this->idprof3; - else if ($idprof==4 && ! empty($this->idprof4)) $selected=$this->idprof4; + elseif ($idprof==2 && ! empty($this->idprof2)) $selected=$this->idprof2; + elseif ($idprof==3 && ! empty($this->idprof3)) $selected=$this->idprof3; + elseif ($idprof==4 && ! empty($this->idprof4)) $selected=$this->idprof4; } $maxlength=$formlength; diff --git a/htdocs/core/class/html.formcontract.class.php b/htdocs/core/class/html.formcontract.class.php index 5bdb00cfc40..862c1e56b23 100644 --- a/htdocs/core/class/html.formcontract.class.php +++ b/htdocs/core/class/html.formcontract.class.php @@ -60,7 +60,7 @@ class FormContract * @param int $showempty Show empty line * @return int Nbr of project if OK, <0 if KO */ - function select_contract($socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) + function select_contract($socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) { // phpcs:enable global $db,$user,$conf,$langs; @@ -78,7 +78,7 @@ class FormContract // CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma. if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY)) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)"; - else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') + elseif ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all') { $sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") "; $sql.= " OR c.fk_soc IS NULL)"; @@ -177,7 +177,7 @@ class FormContract * @param int $showempty Show empty line * @return int Nbr of project if OK, <0 if KO */ - function formSelectContract($page, $socid=-1, $selected='', $htmlname='contrattid', $maxlength=16, $showempty=1) + function formSelectContract($page, $socid = -1, $selected = '', $htmlname = 'contrattid', $maxlength = 16, $showempty = 1) { global $langs; diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 94747481cb0..13cf88e9aa2 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -58,7 +58,7 @@ class FormCron extends Form * @param integer $readonly Select is read only or not * @return string HTML select field */ - function select_typejob($htmlname,$selected=0,$readonly=0) + function select_typejob($htmlname, $selected = 0, $readonly = 0) { // phpcs:enable global $langs; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d8af718bb04..8261b737e43 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -77,7 +77,7 @@ class FormFile * @param string $sectiondir If upload must be done inside a particular directory (is sectiondir defined, sectionid must not be) * @return int <0 if KO, >0 if OK */ - function form_attach_new_file($url, $title='', $addcancel=0, $sectionid=0, $perm=1, $size=50, $object='', $options='', $useajax=1, $savingdocmask='', $linkfiles=1, $htmlname='formuserfile', $accept='', $sectiondir='') + function form_attach_new_file($url, $title = '', $addcancel = 0, $sectionid = 0, $perm = 1, $size = 50, $object = '', $options = '', $useajax = 1, $savingdocmask = '', $linkfiles = 1, $htmlname = 'formuserfile', $accept = '', $sectiondir = '') { // phpcs:enable global $conf,$langs, $hookmanager; @@ -255,7 +255,7 @@ class FormFile * @return int <0 if KO, number of shown files if OK * @deprecated Use print xxx->showdocuments() instead. */ - function show_documents($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='') + function show_documents($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '') { // phpcs:enable $this->numoffiles=0; @@ -288,7 +288,7 @@ class FormFile * @param int $hideifempty Hide section of generated files if there is no file * @return string Output string with HTML array of documents (might be empty string) */ - function showdocuments($modulepart,$modulesubdir,$filedir,$urlsource,$genallowed,$delallowed=0,$modelselected='',$allowgenifempty=1,$forcenomultilang=0,$iconPDF=0,$notused=0,$noform=0,$param='',$title='',$buttonlabel='',$codelang='',$morepicto='',$object=null,$hideifempty=0) + function showdocuments($modulepart, $modulesubdir, $filedir, $urlsource, $genallowed, $delallowed = 0, $modelselected = '', $allowgenifempty = 1, $forcenomultilang = 0, $iconPDF = 0, $notused = 0, $noform = 0, $param = '', $title = '', $buttonlabel = '', $codelang = '', $morepicto = '', $object = null, $hideifempty = 0) { // Deprecation warning if (! empty($iconPDF)) { @@ -380,7 +380,7 @@ class FormFile $modellist=ModeleThirdPartyDoc::liste_modeles($this->db); } } - else if ($modulepart == 'propal') + elseif ($modulepart == 'propal') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -389,7 +389,7 @@ class FormFile $modellist=ModelePDFPropales::liste_modeles($this->db); } } - else if ($modulepart == 'supplier_proposal') + elseif ($modulepart == 'supplier_proposal') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -398,7 +398,7 @@ class FormFile $modellist=ModelePDFSupplierProposal::liste_modeles($this->db); } } - else if ($modulepart == 'commande') + elseif ($modulepart == 'commande') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -434,7 +434,7 @@ class FormFile $modellist=ModelePDFDeliveryOrder::liste_modeles($this->db); } } - else if ($modulepart == 'ficheinter') + elseif ($modulepart == 'ficheinter') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -524,7 +524,7 @@ class FormFile $modellist=ModeleExports::liste_modeles($this->db); } } - else if ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') + elseif ($modulepart == 'commande_fournisseur' || $modulepart == 'supplier_order') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -533,7 +533,7 @@ class FormFile $modellist=ModelePDFSuppliersOrders::liste_modeles($this->db); } } - else if ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') + elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'supplier_invoice') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -542,7 +542,7 @@ class FormFile $modellist=ModelePDFSuppliersInvoices::liste_modeles($this->db); } } - else if ($modulepart == 'supplier_payment') + elseif ($modulepart == 'supplier_payment') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -551,7 +551,7 @@ class FormFile $modellist=ModelePDFSuppliersPayments::liste_modeles($this->db); } } - else if ($modulepart == 'remisecheque') + elseif ($modulepart == 'remisecheque') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -587,7 +587,7 @@ class FormFile $modellist=ModeleAction::liste_modeles($this->db); } } - else if ($modulepart == 'expensereport') + elseif ($modulepart == 'expensereport') { if (is_array($genallowed)) $modellist=$genallowed; else @@ -596,7 +596,7 @@ class FormFile $modellist=ModeleExpenseReport::liste_modeles($this->db); } } - else if ($modulepart == 'unpaid') + elseif ($modulepart == 'unpaid') { $modellist=''; } @@ -887,7 +887,7 @@ class FormFile * @param string $filter Filter filenames on this regex string (Example: '\.pdf$') * @return string Output string with HTML link of documents (might be empty string). This also fill the array ->infofiles */ - function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter='') + function getDocumentsLink($modulepart, $modulesubdir, $filedir, $filter = '') { global $conf, $langs; @@ -1022,7 +1022,7 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_autoecmfiles */ - function list_of_documents($filearray,$object,$modulepart,$param='',$forcedownload=0,$relativepath='',$permonobject=1,$useinecm=0,$textifempty='',$maxlength=0,$title='',$url='', $showrelpart=0, $permtoeditline=-1,$upload_dir='',$sortfield='',$sortorder='ASC', $disablemove=1, $addfilterfields=0) + function list_of_documents($filearray, $object, $modulepart, $param = '', $forcedownload = 0, $relativepath = '', $permonobject = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $title = '', $url = '', $showrelpart = 0, $permtoeditline = -1, $upload_dir = '', $sortfield = '', $sortorder = 'ASC', $disablemove = 1, $addfilterfields = 0) { // phpcs:enable global $user, $conf, $langs, $hookmanager; @@ -1412,7 +1412,7 @@ class FormFile * @return int <0 if KO, nb of files shown if OK * @see list_of_documents */ - function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload=0, $relativepath='', $permtodelete=1, $useinecm=0, $textifempty='', $maxlength=0, $url='', $addfilterfields=0) + function list_of_autoecmfiles($upload_dir, $filearray, $modulepart, $param, $forcedownload = 0, $relativepath = '', $permtodelete = 1, $useinecm = 0, $textifempty = '', $maxlength = 0, $url = '', $addfilterfields = 0) { // phpcs:enable global $user, $conf, $langs, $form; @@ -1465,72 +1465,72 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $object_instance=new Societe($this->db); } - else if ($modulepart == 'invoice') + elseif ($modulepart == 'invoice') { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $object_instance=new Facture($this->db); } - else if ($modulepart == 'invoice_supplier') + elseif ($modulepart == 'invoice_supplier') { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $object_instance=new FactureFournisseur($this->db); } - else if ($modulepart == 'propal') + elseif ($modulepart == 'propal') { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $object_instance=new Propal($this->db); } - else if ($modulepart == 'supplier_proposal') + elseif ($modulepart == 'supplier_proposal') { include_once DOL_DOCUMENT_ROOT.'/supplier_proposal/class/supplier_proposal.class.php'; $object_instance=new SupplierProposal($this->db); } - else if ($modulepart == 'order') + elseif ($modulepart == 'order') { include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $object_instance=new Commande($this->db); } - else if ($modulepart == 'order_supplier') + elseif ($modulepart == 'order_supplier') { include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.commande.class.php'; $object_instance=new CommandeFournisseur($this->db); } - else if ($modulepart == 'contract') + elseif ($modulepart == 'contract') { include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $object_instance=new Contrat($this->db); } - else if ($modulepart == 'product') + elseif ($modulepart == 'product') { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $object_instance=new Product($this->db); } - else if ($modulepart == 'tax') + elseif ($modulepart == 'tax') { include_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; $object_instance=new ChargeSociales($this->db); } - else if ($modulepart == 'project') + elseif ($modulepart == 'project') { include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; $object_instance=new Project($this->db); } - else if ($modulepart == 'fichinter') + elseif ($modulepart == 'fichinter') { include_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $object_instance=new Fichinter($this->db); } - else if ($modulepart == 'user') + elseif ($modulepart == 'user') { include_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $object_instance=new User($this->db); } - else if ($modulepart == 'expensereport') + elseif ($modulepart == 'expensereport') { include_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; $object_instance=new ExpenseReport($this->db); } - else if ($modulepart == 'holiday') + elseif ($modulepart == 'holiday') { include_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php'; $object_instance=new Holiday($this->db); @@ -1695,7 +1695,7 @@ class FormFile * @param string $param More param to add into URL * @return int Number of links */ - public function listOfLinks($object, $permtodelete=1, $action=null, $selected=null, $param='') + public function listOfLinks($object, $permtodelete = 1, $action = null, $selected = null, $param = '') { global $user, $conf, $langs, $user; global $sortfield, $sortorder; @@ -1831,7 +1831,7 @@ class FormFile * @param string $param More param on http links * @return string $out Output string with HTML */ - public function showPreview($file, $modulepart, $relativepath, $ruleforpicto=0, $param='') + public function showPreview($file, $modulepart, $relativepath, $ruleforpicto = 0, $param = '') { global $langs, $conf; diff --git a/htdocs/core/class/html.formintervention.class.php b/htdocs/core/class/html.formintervention.class.php index ae35b74fad9..a9602f8a158 100644 --- a/htdocs/core/class/html.formintervention.class.php +++ b/htdocs/core/class/html.formintervention.class.php @@ -60,7 +60,7 @@ class FormIntervention * @param int $showempty Show empty line * @return int Nbre of project if OK, <0 if KO */ - function select_interventions($socid=-1, $selected='', $htmlname='interventionid', $maxlength=16, $showempty=1) + function select_interventions($socid = -1, $selected = '', $htmlname = 'interventionid', $maxlength = 16, $showempty = 1) { // phpcs:enable global $db,$user,$conf,$langs; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 2cb10056cc3..6a5cfea92d9 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -183,7 +183,7 @@ class FormMail extends Form * @param string $type Mime type (can be dol_mimetype($file)) * @return void */ - function add_attached_files($path, $file='', $type='') + function add_attached_files($path, $file = '', $type = '') { // phpcs:enable $listofpaths=array(); @@ -268,7 +268,7 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return void */ - function show_form($addfileaction='addfile',$removefileaction='removefile') + function show_form($addfileaction = 'addfile', $removefileaction = 'removefile') { // phpcs:enable print $this->get_form($addfileaction,$removefileaction); @@ -285,7 +285,7 @@ class FormMail extends Form * @param string $removefileaction Name of action when removing file attachments * @return string Form to show */ - function get_form($addfileaction='addfile', $removefileaction='removefile') + function get_form($addfileaction = 'addfile', $removefileaction = 'removefile') { // phpcs:enable global $conf, $langs, $user, $hookmanager, $form; @@ -614,7 +614,7 @@ class FormMail extends Form $soc->fetch($this->toid); $out.= $soc->getNomUrl(1); } - else if ($this->totype == 'contact') + elseif ($this->totype == 'contact') { $contact=new Contact($this->db); $contact->fetch($this->toid); @@ -841,7 +841,7 @@ class FormMail extends Form $out.= '
'; } } - else if (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox + elseif (empty($this->withmaindocfile)) // Do not show message if we asked to show the checkbox { $out.= $langs->trans("NoAttachedFiles").'
'; } @@ -924,7 +924,7 @@ class FormMail extends Form // Deal with format differences between message and signature (text / HTML) if (dol_textishtml($defaultmessage) && !dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $this->substit['__USER_SIGNATURE__'] = dol_nl2br($this->substit['__USER_SIGNATURE__']); - } else if(!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { + } elseif(!dol_textishtml($defaultmessage) && dol_textishtml($this->substit['__USER_SIGNATURE__'])) { $defaultmessage = dol_nl2br($defaultmessage); } @@ -1143,7 +1143,7 @@ class FormMail extends Form * @param string $label Label of template * @return ModelMail One instance of ModelMail */ - public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id=0, $active=1, $label='') + public function getEMailTemplate($db, $type_template, $user, $outputlangs, $id = 0, $active = 1, $label = '') { $ret = new ModelMail(); @@ -1267,7 +1267,7 @@ class FormMail extends Form * @param int $active 1=Only active template, 0=Only disabled, -1=All * @return int <0 if KO, nb of records found if OK */ - public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active=1) + public function fetchAllEMailTemplate($type_template, $user, $outputlangs, $active = 1) { $ret=array(); @@ -1378,7 +1378,7 @@ class FormMail extends Form * @param Object $object Object if applicable * @return array Array of substitution values for emails. */ - static function getAvailableSubstitKey($mode='formemail', $object=null) + static function getAvailableSubstitKey($mode = 'formemail', $object = null) { global $conf, $langs; diff --git a/htdocs/core/class/html.formmailing.class.php b/htdocs/core/class/html.formmailing.class.php index 067692f5094..95c2c057b40 100644 --- a/htdocs/core/class/html.formmailing.class.php +++ b/htdocs/core/class/html.formmailing.class.php @@ -40,7 +40,7 @@ class FormMailing extends Form * @param integer $show_empty Show empty option * @return string HTML select */ - public function selectDestinariesStatus($selectedid='', $htmlname='dest_status', $show_empty=0) + public function selectDestinariesStatus($selectedid = '', $htmlname = 'dest_status', $show_empty = 0) { global $langs; diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index cdd827145b0..6d6ff82d5dd 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -59,7 +59,7 @@ class FormMargin * @param boolean $force_price True of not * @return array Array with info */ - function getMarginInfosArray($object, $force_price=false) + function getMarginInfosArray($object, $force_price = false) { global $conf, $db; @@ -191,7 +191,7 @@ class FormMargin * @param boolean $force_price Force price * @return void */ - function displayMarginInfos($object, $force_price=false) + function displayMarginInfos($object, $force_price = false) { global $langs, $conf, $user; @@ -281,4 +281,3 @@ class FormMargin print ''; } } - diff --git a/htdocs/core/class/html.formorder.class.php b/htdocs/core/class/html.formorder.class.php index 781b3f76e4f..6fc9f6f2046 100644 --- a/htdocs/core/class/html.formorder.class.php +++ b/htdocs/core/class/html.formorder.class.php @@ -39,7 +39,7 @@ class FormOrder extends Form * @param string $hmlname Name of HTML select element * @return void */ - public function selectSupplierOrderStatus($selected='', $short=0, $hmlname='order_status') + public function selectSupplierOrderStatus($selected = '', $short = 0, $hmlname = 'order_status') { $options = array(); @@ -74,7 +74,7 @@ class FormOrder extends Form * @param int $addempty 0=list with no empty value, 1=list with empty value * @return array Tableau des sources de commandes */ - public function selectInputMethod($selected='',$htmlname='source_id',$addempty=0) + public function selectInputMethod($selected = '', $htmlname = 'source_id', $addempty = 0) { global $langs; @@ -101,4 +101,3 @@ class FormOrder extends Form return 1; } } - diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 8ca0b988fda..ce3fe126a51 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -67,7 +67,7 @@ class FormOther * @param int $fk_user Utilisateur créant le modèle * @return void */ - function select_export_model($selected='', $htmlname='exportmodelid', $type='', $useempty=0, $fk_user=null) + function select_export_model($selected = '', $htmlname = 'exportmodelid', $type = '', $useempty = 0, $fk_user = null) { // phpcs:enable $sql = "SELECT rowid, label"; @@ -119,7 +119,7 @@ class FormOther * @param int $useempty Affiche valeur vide dans liste * @return void */ - function select_import_model($selected='', $htmlname='importmodelid', $type='', $useempty=0) + function select_import_model($selected = '', $htmlname = 'importmodelid', $type = '', $useempty = 0) { // phpcs:enable $sql = "SELECT rowid, label"; @@ -168,7 +168,7 @@ class FormOther * @param string $htmlname Name of combo list * @return integer */ - function select_ecotaxes($selected='', $htmlname='ecotaxe_id') + function select_ecotaxes($selected = '', $htmlname = 'ecotaxe_id') { // phpcs:enable global $langs; @@ -227,7 +227,7 @@ class FormOther * @param string $country_code Country Code * @return string HTML select list */ - function select_revenue_stamp($selected='', $htmlname='revenuestamp', $country_code='') + function select_revenue_stamp($selected = '', $htmlname = 'revenuestamp', $country_code = '') { // phpcs:enable global $langs; @@ -290,7 +290,7 @@ class FormOther * @param int $showempty Add also an empty line * @return string HTML select string */ - function select_percent($selected=0,$htmlname='percent',$disabled=0,$increment=5,$start=0,$end=100,$showempty=0) + function select_percent($selected = 0, $htmlname = 'percent', $disabled = 0, $increment = 5, $start = 0, $end = 100, $showempty = 0) { // phpcs:enable $return = ''; + print ''; + } print '
'.$langs->trans("BoxTitleLastModifiedExpenses",min($max,$num)).''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").''.$langs->trans("FeesKilometersOrAmout").''.$langs->trans("DateModificationShort").' 
'.$deplacementstatic->getNomUrl(1).''.$userstatic->getNomUrl(1).''.$obj->km.''.dol_print_date($db->jdate($obj->dm),'day').''.$obj->km.''.dol_print_date($db->jdate($obj->dm),'day').''.$deplacementstatic->LibStatut($obj->fk_statut,3).'
'.$soc->getNomUrl(1).' '.$obj->km.''.$obj->km.''.$tripandexpense_static->getLibStatut(5).''.$tripandexpense_static->getLibStatut(5).'
'.$oldyear.'000000
'.$year.''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).''.$val['nb'].''.price(price2num($val['total'],'MT'),1).''.price(price2num($val['avg'],'MT'),1).'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'.$langs->trans("ErrorNoAccountancyModuleLoaded").'
'.$langs->trans("FeatureNotYetAvailable").'
'.$langs->trans("Error").'
'; + print '
'; print $invoice->getNomUrl(1,''); if($objp->socid != $facture->thirdparty->id) print ' - '.$soc->getNomUrl(1).' '; print "'.dol_print_date($db->jdate($objp->df),'day')."'.dol_print_date($db->jdate($objp->df),'day')."'.price($sign * $objp->total_ttc).'id==$facid)?' style="font-weight: bold" ':'').'>'.price($sign * $objp->total_ttc).''.price($sign * $paiement); diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index c19d51b5891..f710ff2615e 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -4,7 +4,7 @@ * Copyright (C) 2009-2012 Regis Houssin * Copyright (C) 2011-2016 Juanjo Menent * Copyright (C) 2013 Philippe Grand - * Copyright (C) 2015-2016 Alexandre Spangaro + * Copyright (C) 2015-2016 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -270,7 +270,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) } // Remove file in doc form -else if ($action == 'remove_file' && $user->rights->banque->cheque) +elseif ($action == 'remove_file' && $user->rights->banque->cheque) { if ($object->fetch($id) > 0) { diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 28973d3c4e2..ccb42343907 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -84,7 +84,7 @@ class RemiseCheque extends CommonObject * @param string $ref Ref record * @return int <0 if KO, > 0 if OK */ - function fetch($id,$ref='') + function fetch($id, $ref = '') { global $conf; @@ -299,7 +299,7 @@ class RemiseCheque extends CommonObject * @param User $user Utilisateur qui effectue l'operation * @return int */ - function delete($user='') + function delete($user = '') { global $conf; @@ -416,15 +416,15 @@ class RemiseCheque extends CommonObject * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($mode='next') + function getNextNumRef($mode = 'next') { global $conf, $db, $langs, $mysoc; $langs->load("bills"); // Clean parameters (if not defined or using deprecated value) if (empty($conf->global->CHEQUERECEIPTS_ADDON)) $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; - else if ($conf->global->CHEQUERECEIPTS_ADDON=='thyme') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_thyme'; - else if ($conf->global->CHEQUERECEIPTS_ADDON=='mint') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; + elseif ($conf->global->CHEQUERECEIPTS_ADDON=='thyme') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_thyme'; + elseif ($conf->global->CHEQUERECEIPTS_ADDON=='mint') $conf->global->CHEQUERECEIPTS_ADDON='mod_chequereceipt_mint'; if (! empty($conf->global->CHEQUERECEIPTS_ADDON)) { @@ -988,7 +988,7 @@ class RemiseCheque extends CommonObject * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option='') + function initAsSpecimen($option = '') { global $user,$langs,$conf; @@ -1013,7 +1013,7 @@ class RemiseCheque extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $conf, $langs; @@ -1064,7 +1064,7 @@ class RemiseCheque extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -1077,7 +1077,7 @@ class RemiseCheque extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto, 6=Long label + picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index d9ac1ab11eb..ab074e58541 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2006 Rodolphe Quiedeville * Copyright (C) 2007-2016 Laurent Destailleur * Copyright (C) 2009-2012 Regis Houssin - * Copyright (C) 2014 Alexandre Spangaro + * Copyright (C) 2014 Alexandre Spangaro * Copyright (C) 2016 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -100,12 +100,12 @@ if ($month > 0) { if ($year > 0 && empty($day)) $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'"; - else if ($year > 0 && ! empty($day)) + elseif ($year > 0 && ! empty($day)) $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'"; else $sql.= " AND date_format(bc.date_bordereau, '%m') = '".$month."'"; } -else if ($year > 0) +elseif ($year > 0) { $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index c4cb529d895..0003043fef4 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -157,7 +157,7 @@ class Paiement extends CommonObject * @param int $fk_bank Id of bank line associated to payment * @return int <0 if KO, 0 if not found, >0 if OK */ - public function fetch($id, $ref='', $fk_bank='') + public function fetch($id, $ref = '', $fk_bank = '') { $sql = 'SELECT p.rowid, p.ref, p.datep as dp, p.amount, p.statut, p.ext_payment_id, p.ext_payment_site, p.fk_bank,'; $sql.= ' c.code as type_code, c.libelle as type_libelle,'; @@ -168,9 +168,9 @@ class Paiement extends CommonObject $sql.= ' WHERE p.entity IN (' . getEntity('invoice').')'; if ($id > 0) $sql.= ' AND p.rowid = '.$id; - else if ($ref) + elseif ($ref) $sql.= " AND p.ref = '".$ref."'"; - else if ($fk_bank) + elseif ($fk_bank) $sql.= ' AND p.fk_bank = '.$fk_bank; $resql = $this->db->query($sql); @@ -224,7 +224,7 @@ class Paiement extends CommonObject * @param int $closepaidinvoices 1=Also close payed invoices to paid, 0=Do nothing more * @return int id of created payment, < 0 if error */ - function create($user, $closepaidinvoices=0) + function create($user, $closepaidinvoices = 0) { global $conf, $langs; @@ -357,7 +357,7 @@ class Paiement extends CommonObject ); if (!in_array($invoice->type, $affected_types)) dol_syslog("Invoice ".$facid." is not a standard, nor replacement invoice, nor credit note, nor deposit invoice, nor situation invoice. We do nothing more."); - else if ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); + elseif ($remaintopay) dol_syslog("Remain to pay for invoice ".$facid." not null. We do nothing more."); //else if ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); else { @@ -488,7 +488,7 @@ class Paiement extends CommonObject * @param int $notrigger No trigger * @return int <0 si ko, >0 si ok */ - function delete($notrigger=0) + function delete($notrigger = 0) { global $conf, $user, $langs; @@ -598,7 +598,7 @@ class Paiement extends CommonObject * @param int $notrigger No trigger * @return int <0 if KO, bank_line_id if OK */ - function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque,$notrigger=0) + function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque, $notrigger = 0) { global $conf,$langs,$user; @@ -897,7 +897,7 @@ class Paiement extends CommonObject * @param User $user User making validation * @return int <0 if KO, >0 if OK */ - function valide(User $user=null) + function valide(User $user = null) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 1 WHERE rowid = '.$this->id; @@ -921,7 +921,7 @@ class Paiement extends CommonObject * @param User $user User making reject * @return int <0 if KO, >0 if OK */ - function reject(User $user=null) + function reject(User $user = null) { $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element.' SET statut = 2 WHERE rowid = '.$this->id; @@ -989,7 +989,7 @@ class Paiement extends CommonObject * @param string $filter Critere de filtre * @return array Tableau des id de factures */ - function getBillsArray($filter='') + function getBillsArray($filter = '') { $sql = 'SELECT fk_facture'; $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf, '.MAIN_DB_PREFIX.'facture as f'; @@ -1027,15 +1027,15 @@ class Paiement extends CommonObject * @param string $mode 'next' for next value or 'last' for last value * @return string free ref or last ref */ - function getNextNumRef($soc,$mode='next') + function getNextNumRef($soc, $mode = 'next') { global $conf, $db, $langs; $langs->load("bills"); // Clean parameters (if not defined or using deprecated value) if (empty($conf->global->PAYMENT_ADDON)) $conf->global->PAYMENT_ADDON='mod_payment_cicada'; - else if ($conf->global->PAYMENT_ADDON=='ant') $conf->global->PAYMENT_ADDON='mod_payment_ant'; - else if ($conf->global->PAYMENT_ADDON=='cicada') $conf->global->PAYMENT_ADDON='mod_payment_cicada'; + elseif ($conf->global->PAYMENT_ADDON=='ant') $conf->global->PAYMENT_ADDON='mod_payment_ant'; + elseif ($conf->global->PAYMENT_ADDON=='cicada') $conf->global->PAYMENT_ADDON='mod_payment_cicada'; if (! empty($conf->global->PAYMENT_ADDON)) { @@ -1138,7 +1138,7 @@ class Paiement extends CommonObject * @param string $option ''=Create a specimen invoice with lines, 'nolines'=No lines * @return void */ - function initAsSpecimen($option='') + function initAsSpecimen($option = '') { global $user,$langs,$conf; @@ -1164,7 +1164,7 @@ class Paiement extends CommonObject * @param int $notooltip 1=Disable tooltip * @return string Chaine avec URL */ - function getNomUrl($withpicto=0, $option='', $mode='withlistofinvoices', $notooltip=0) + function getNomUrl($withpicto = 0, $option = '', $mode = 'withlistofinvoices', $notooltip = 0) { global $conf, $langs; @@ -1222,7 +1222,7 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -1235,7 +1235,7 @@ class Paiement extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -1286,7 +1286,7 @@ class Paiement extends CommonObject * @param int $force_thirdparty_id Force thirdparty id * @return int <0 if KO, >0 if OK */ - function fetch_thirdparty($force_thirdparty_id=0) + function fetch_thirdparty($force_thirdparty_id = 0) { // phpcs:enable include_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 12669947cff..9234ca1e68d 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Charlene Benke * diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 3f7dd23059d..f39ed254df3 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -81,7 +81,7 @@ class BonPrelevement extends CommonObject * @param DoliDB $db Database handler * @param string $filename Filename of withdraw receipt */ - function __construct($db, $filename='') + function __construct($db, $filename = '') { global $conf,$langs; @@ -276,7 +276,7 @@ class BonPrelevement extends CommonObject * @param string $ref Ref of direct debit * @return int >0 if OK, <0 if KO */ - function fetch($rowid, $ref='') + function fetch($rowid, $ref = '') { global $conf; @@ -630,7 +630,7 @@ class BonPrelevement extends CommonObject * @param int $amounts If you want to get the amount of the order for each invoice * @return array Id of invoices */ - private function getListInvoices($amounts=0) + private function getListInvoices($amounts = 0) { global $conf; @@ -731,7 +731,7 @@ class BonPrelevement extends CommonObject * @param int $agence dolibarr mysoc agence * @return int 0 if OK, <0 if KO */ - function delete($user=null) + function delete($user = null) { $this->db->begin(); @@ -1178,7 +1178,7 @@ class BonPrelevement extends CommonObject * @param string $option link target * @return string URL of target */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto = 0, $option = '') { global $langs; @@ -1299,7 +1299,7 @@ class BonPrelevement extends CommonObject * @param string $executiondate Date to execute transfer * @return int 0 if OK, <0 if KO */ - function generate($format='ALL',$executiondate='') + function generate($format = 'ALL', $executiondate = '') { global $conf,$langs,$mysoc; @@ -1493,7 +1493,7 @@ class BonPrelevement extends CommonObject * @param string $rib_dom rib domiciliation * @return void */ - function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom='') + function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom = '') { // phpcs:enable fputs($this->file, "06"); @@ -1726,7 +1726,7 @@ class BonPrelevement extends CommonObject * @param string $format FRST or RCUR or ALL * @return string String with SEPA Sender */ - function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf='\n', $format='FRST') + function EnregEmetteurSEPA($configuration, $ladate, $nombre, $total, $CrLf = '\n', $format = 'FRST') { // phpcs:enable // SEPA INITIALISATION @@ -1905,7 +1905,7 @@ class BonPrelevement extends CommonObject * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -1918,7 +1918,7 @@ class BonPrelevement extends CommonObject * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto * @return string Label */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable if (empty($this->labelstatut)) diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 7e100022c7a..d47eb32504a 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -123,7 +123,7 @@ class LignePrelevement * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -136,7 +136,7 @@ class LignePrelevement * @param int $mode 0=Label, 1=Picto + label, 2=Picto, 3=Label + Picto * @return string Label */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 4797121a24c..46b4242944b 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -82,7 +82,7 @@ class RejetPrelevement * @param int $facturation Facturation * @return void */ - function create($user, $id, $motif, $date_rejet, $bonid, $facturation=0) + function create($user, $id, $motif, $date_rejet, $bonid, $facturation = 0) { global $langs,$conf; @@ -282,7 +282,7 @@ class RejetPrelevement * @return array Array List of invoices related to the withdrawal line * @TODO A withdrawal line is today linked to one and only one invoice. So the function should return only one object ? */ - private function getListInvoices($amounts=0) + private function getListInvoices($amounts = 0) { global $conf; diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index e7bd8622fa2..ea4d91d6022 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -228,4 +228,3 @@ else // End of page llxFooter(); $db->close(); - diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 3a3ba57cb18..38888110d79 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -134,7 +134,7 @@ if ($modecompta == 'CREANCES-DETTES') $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="RECETTES-DEPENSES") { +elseif ($modecompta=="RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode=$langs->trans("CalcModeEngagement"); $calcmode.='
('.$langs->trans("SeeReportInDueDebtMode",'','').')'; @@ -146,7 +146,7 @@ else if ($modecompta=="RECETTES-DEPENSES") { $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode=$langs->trans("CalcModeBookkeeping"); @@ -191,7 +191,7 @@ if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo if (! empty($date_start) && ! empty($date_end)) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -232,7 +232,7 @@ if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo dol_print_error($db); } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } @@ -278,12 +278,12 @@ if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo dol_print_error($db); } } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { // Nothing from this table } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } @@ -307,7 +307,7 @@ if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo if (! empty($date_start) && ! empty($date_end)) $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { $sql = "SELECT sum(pf.amount) as amount_ttc, date_format(p.datep,'%Y-%m') as dm"; $sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; @@ -347,7 +347,7 @@ if (! empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo dol_print_error($db); } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } @@ -429,7 +429,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco dol_print_error($db); } } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { // TVA reellement deja payee $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; @@ -493,7 +493,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco } } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } @@ -516,7 +516,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco if (! empty($date_start) && ! empty($date_end)) $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -554,7 +554,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco dol_print_error($db); } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } @@ -578,7 +578,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco if (! empty($date_start) && ! empty($date_end)) $sql.= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; } - else if ($modecompta=="RECETTES-DEPENSES") + elseif ($modecompta=="RECETTES-DEPENSES") { $sql = "SELECT c.libelle as nom, date_format(p.datep,'%Y-%m') as dm, sum(p.amount) as amount"; $sql.= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -616,7 +616,7 @@ if (! empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco dol_print_error($db); } } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { // Nothing from this table } diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 16d2631686c..85f38cb9905 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Alexandre Spangaro + * Copyright (C) 2016 Alexandre Spangaro * Copyright (C) 2018 Laurent Destailleur * Copyright (C) 2018 Frédéric France * diff --git a/htdocs/compta/salaries/card.php b/htdocs/compta/salaries/card.php index 474fcd0a6cb..91c0e169b5d 100644 --- a/htdocs/compta/salaries/card.php +++ b/htdocs/compta/salaries/card.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2018 Alexandre Spangaro * Copyright (C) 2014 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Charlie BENKE diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index 76a8284daff..21423f85e87 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2018 Alexandre Spangaro * Copyright (C) 2014 Juanjo Menent * * This program is free software; you can redistribute it and/or modify @@ -108,7 +108,7 @@ class PaymentSalary extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; @@ -189,7 +189,7 @@ class PaymentSalary extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=null) + function fetch($id, $user = null) { global $langs; $sql = "SELECT"; @@ -544,7 +544,7 @@ class PaymentSalary extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string Chaine with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -652,7 +652,7 @@ class PaymentSalary extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -665,7 +665,7 @@ class PaymentSalary extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/salaries/class/salariesstats.class.php b/htdocs/compta/salaries/class/salariesstats.class.php index 82a8d094148..c34d7713901 100644 --- a/htdocs/compta/salaries/class/salariesstats.class.php +++ b/htdocs/compta/salaries/class/salariesstats.class.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * Copyright (c) 2018 Fidesio * * This program is free software; you can redistribute it and/or modify @@ -49,7 +49,7 @@ class SalariesStats extends Stats * @param mixed $userid Id user for filter or array of user ids * @return void */ - function __construct($db, $socid=0, $userid=0) + function __construct($db, $socid = 0, $userid = 0) { global $conf; @@ -67,7 +67,7 @@ class SalariesStats extends Stats $this->where.=" AND fk_soc = ".$this->socid; } if (is_array($this->userid) && count($this->userid) > 0) $this->where.=' AND fk_user IN ('.join(',',$this->userid).')'; - else if ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; + elseif ($this->userid > 0) $this->where.=' AND fk_user = '.$this->userid; } @@ -94,7 +94,7 @@ class SalariesStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getNbByMonth($year, $format=0) + function getNbByMonth($year, $format = 0) { $sql = "SELECT MONTH(datep) as dm, count(*)"; $sql.= " FROM ".$this->from; @@ -116,7 +116,7 @@ class SalariesStats extends Stats * @param int $format 0=Label of absiss is a translated text, 1=Label of absiss is month number, 2=Label of absiss is first letter of month * @return array Array of values */ - function getAmountByMonth($year, $format=0) + function getAmountByMonth($year, $format = 0) { $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; $sql.= " FROM ".$this->from; @@ -164,4 +164,3 @@ class SalariesStats extends Stats return $this->_getAllByYear($sql); } } - diff --git a/htdocs/compta/salaries/document.php b/htdocs/compta/salaries/document.php index 33e92ecaf3b..0ce0fb66e52 100644 --- a/htdocs/compta/salaries/document.php +++ b/htdocs/compta/salaries/document.php @@ -6,7 +6,7 @@ * Copyright (C) 2005 Simon TOSSER * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/salaries/info.php b/htdocs/compta/salaries/info.php index 87d24ceb406..c7a180346fb 100644 --- a/htdocs/compta/salaries/info.php +++ b/htdocs/compta/salaries/info.php @@ -1,7 +1,7 @@ * Copyright (C) 2015 Charlie BENKE - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/salaries/list.php b/htdocs/compta/salaries/list.php index c7f5970723e..761d40a5227 100644 --- a/htdocs/compta/salaries/list.php +++ b/htdocs/compta/salaries/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2015-2016 Laurent Destailleur * Copyright (C) 2015 Jean-François Ferry * diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php index 6471f66cf57..5b1d5c1b973 100644 --- a/htdocs/compta/salaries/stats/index.php +++ b/htdocs/compta/salaries/stats/index.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2018 Alexandre Spangaro * Copyright (C) 2018 Fidesio * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 6a0d53d6987..b31339a8d5f 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2016-2018 Frédéric France - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * * 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 diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 9e13ffcd8a5..f7c829294f8 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -404,7 +404,7 @@ class Cchargesociales * @param string $morecss Add more css on link * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') { global $langs, $conf, $db; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -438,7 +438,7 @@ class Cchargesociales * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -451,7 +451,7 @@ class Cchargesociales * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index cca5a4d7dd2..fe6a3be96ee 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002 Rodolphe Quiedeville * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2016 Frédéric France - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017 Alexandre Spangaro * * 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 @@ -93,7 +93,7 @@ class ChargeSociales extends CommonObject * @param string $ref Ref * @return int <0 KO >0 OK */ - function fetch($id, $ref='') + function fetch($id, $ref = '') { $sql = "SELECT cs.rowid, cs.date_ech"; $sql.= ", cs.libelle as lib, cs.fk_type, cs.amount, cs.fk_projet as fk_project, cs.paye, cs.periode, cs.import_key"; @@ -303,13 +303,15 @@ class ChargeSociales extends CommonObject /** - * Met a jour une charge sociale + * Update social or fiscal contribution * - * @param User $user Utilisateur qui modifie - * @return int <0 si erreur, >0 si ok + * @param User $user User that modify + * @param int $notrigger 0=launch triggers after, 1=disable triggers + * @return int <0 if KO, >0 if OK */ - function update($user) + function update($user, $notrigger = 0) { + $error=0; $this->db->begin(); $sql = "UPDATE ".MAIN_DB_PREFIX."chargesociales"; @@ -323,16 +325,37 @@ class ChargeSociales extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql=$this->db->query($sql); - if ($resql) + + if (! $resql) { + $error++; $this->errors[]="Error ".$this->db->lasterror(); + } + + if (! $error) { - $this->db->commit(); - return 1; + if (! $notrigger) + { + // Call trigger + $result=$this->call_trigger('SOCIALCHARGES_MODIFY',$user); + if ($result < 0) $error++; + // End call triggers + } + } + + // Commit or rollback + if ($error) + { + foreach($this->errors as $errmsg) + { + dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); + $this->error.=($this->error?', '.$errmsg:$errmsg); + } + $this->db->rollback(); + return -1*$error; } else { - $this->error=$this->db->error(); - $this->db->rollback(); - return -1; + $this->db->commit(); + return 1; } } @@ -419,7 +442,7 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function getLibStatut($mode=0,$alreadypaid=-1) + function getLibStatut($mode = 0, $alreadypaid = -1) { return $this->LibStatut($this->paye,$mode,$alreadypaid); } @@ -433,7 +456,7 @@ class ChargeSociales extends CommonObject * @param double $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) * @return string Label */ - function LibStatut($statut,$mode=0,$alreadypaid=-1) + function LibStatut($statut, $mode = 0, $alreadypaid = -1) { // phpcs:enable global $langs; @@ -491,7 +514,7 @@ class ChargeSociales extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with link */ - function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0, $short=0, $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $maxlen = 0, $notooltip = 0, $short = 0, $save_lastsearch_value = -1) { global $langs, $conf, $user, $form; diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 74ddce68230..bd678904df6 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -104,7 +104,7 @@ class PaymentSocialContribution extends CommonObject * @param int $closepaidcontrib 1=Also close payed contributions to paid, 0=Do nothing more * @return int <0 if KO, id of payment if OK */ - function create($user, $closepaidcontrib=0) + function create($user, $closepaidcontrib = 0) { global $conf, $langs; @@ -292,7 +292,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function update($user=null, $notrigger=0) + function update($user = null, $notrigger = 0) { global $conf, $langs; $error=0; @@ -379,7 +379,7 @@ class PaymentSocialContribution extends CommonObject * @param int $notrigger 0=launch triggers after, 1=disable triggers * @return int <0 if KO, >0 if OK */ - function delete($user, $notrigger=0) + function delete($user, $notrigger = 0) { global $conf, $langs; $error=0; @@ -540,7 +540,7 @@ class PaymentSocialContribution extends CommonObject * @param string $emetteur_banque Name of bank * @return int <0 if KO, >0 if OK */ - function addPaymentToBank($user,$mode,$label,$accountid,$emetteur_nom,$emetteur_banque) + function addPaymentToBank($user, $mode, $label, $accountid, $emetteur_nom, $emetteur_banque) { global $conf; @@ -656,7 +656,7 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -669,7 +669,7 @@ class PaymentSocialContribution extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage @@ -720,7 +720,7 @@ class PaymentSocialContribution extends CommonObject * @param int $maxlen Longueur max libelle * @return string Chaine avec URL */ - function getNomUrl($withpicto=0,$maxlen=0) + function getNomUrl($withpicto = 0, $maxlen = 0) { global $langs; diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index efdd39d2205..bb194f8cb3e 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -2,7 +2,7 @@ /* Copyright (C) 2001-2003 Rodolphe Quiedeville * Copyright (C) 2004-2014 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin - * Copyright (C) 2011-2016 Alexandre Spangaro + * Copyright (C) 2011-2016 Alexandre Spangaro * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index df199d2e23e..4e1e429f0e5 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -210,7 +210,7 @@ if ($modecompta=="CREANCES-DETTES") { $builddate=dol_now(); } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate"); $calcmode=$langs->trans("CalcModeEngagement"); @@ -221,12 +221,12 @@ else if ($modecompta=="RECETTES-DEPENSES") $builddate=dol_now(); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { } -else if ($modecompta=="BOOKKEEPINGCOLLECTED") +elseif ($modecompta=="BOOKKEEPINGCOLLECTED") { diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 701fe86f10e..388ae43eb1e 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -178,7 +178,7 @@ if ($modecompta=="CREANCES-DETTES") { $builddate=dol_now(); } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode=$langs->trans("CalcModeEngagement"); @@ -189,12 +189,12 @@ else if ($modecompta=="RECETTES-DEPENSES") $builddate=dol_now(); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { } -else if ($modecompta=="BOOKKEEPINGCOLLECTED") +elseif ($modecompta=="BOOKKEEPINGCOLLECTED") { @@ -231,7 +231,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; } - else if ($selected_cat) // Into a specific category + elseif ($selected_cat) // Into a specific category { $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_product as cp"; } @@ -253,7 +253,7 @@ if ($modecompta == 'CREANCES-DETTES') { $sql.=" AND cp.fk_product is null"; } - else if ($selected_cat) { // Into a specific category + elseif ($selected_cat) { // Into a specific category $sql.= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; $sql.= ")"; diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index ba9556dd2ac..397538d2ac1 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -158,7 +158,7 @@ if ($modecompta=="CREANCES-DETTES") { $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode=$langs->trans("CalcModeEngagement"); @@ -168,12 +168,12 @@ else if ($modecompta=="RECETTES-DEPENSES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { } -else if ($modecompta=="BOOKKEEPINGCOLLECTED") +elseif ($modecompta=="BOOKKEEPINGCOLLECTED") { diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index eec3bbcfbac..727f65a8b68 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -184,7 +184,7 @@ if ($modecompta=="CREANCES-DETTES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode=$langs->trans("CalcModeEngagement"); @@ -194,12 +194,12 @@ else if ($modecompta=="RECETTES-DEPENSES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { } -else if ($modecompta=="BOOKKEEPINGCOLLECTED") +elseif ($modecompta=="BOOKKEEPINGCOLLECTED") { @@ -228,7 +228,7 @@ if ($modecompta == 'CREANCES-DETTES') { { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; } - else if ($selected_cat) // Into a specific category + elseif ($selected_cat) // Into a specific category { $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -246,7 +246,7 @@ if ($modecompta == 'CREANCES-DETTES') { { $sql.=" AND cs.fk_soc is null"; } - else if ($selected_cat) { // Into a specific category + elseif ($selected_cat) { // Into a specific category $sql.= " AND (c.rowid = ".$db->escape($selected_cat); if ($subcat) $sql.=" OR c.fk_parent = " . $db->escape($selected_cat); $sql.= ")"; @@ -266,7 +266,7 @@ if ($modecompta == 'CREANCES-DETTES') { { $sql.= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; } - else if ($selected_cat) // Into a specific category + elseif ($selected_cat) // Into a specific category { $sql.= ", ".MAIN_DB_PREFIX."categorie as c, ".MAIN_DB_PREFIX."categorie_societe as cs"; } @@ -280,7 +280,7 @@ if ($modecompta == 'CREANCES-DETTES') { { $sql.=" AND cs.fk_soc is null"; } - else if ($selected_cat) { // Into a specific category + elseif ($selected_cat) { // Into a specific category $sql.= " AND (c.rowid = ".$selected_cat; if ($subcat) $sql.=" OR c.fk_parent = " . $selected_cat; $sql.= ")"; diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index 79ff8ff5df5..b700905183c 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -128,7 +128,7 @@ if ($modecompta=="CREANCES-DETTES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { $name=$langs->trans("TurnoverCollected"); $calcmode=$langs->trans("CalcModeEngagement"); @@ -141,7 +141,7 @@ else if ($modecompta=="RECETTES-DEPENSES") $builddate=dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { $name=$langs->trans("Turnover"); $calcmode=$langs->trans("CalcModeBookkeeping"); @@ -174,7 +174,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql.= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; } -else if ($modecompta=="RECETTES-DEPENSES") +elseif ($modecompta=="RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -189,7 +189,7 @@ else if ($modecompta=="RECETTES-DEPENSES") $sql.= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql.= " AND f.fk_soc = ".$socid; } -else if ($modecompta=="BOOKKEEPING") +elseif ($modecompta=="BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.credit) as amount_ttc"; $sql.= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index d5779266661..985c0b834a5 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -2,7 +2,7 @@ /* Copyright (C) 2003 Rodolphe Quiedeville * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin - * Copyright (C) 2015-2017 Alexandre Spangaro + * Copyright (C) 2015-2017 Alexandre Spangaro * Copyright (C) 2018 Frédéric France * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index 33d48de8bfc..fba25b0e752 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2008 Laurent Destailleur - * Copyright (C) 2011-2017 Alexandre Spangaro + * Copyright (C) 2011-2017 Alexandre Spangaro * Copyright (C) 2018 Philippe Grand * Copyright (C) 2018 Frédéric France * @@ -173,7 +173,7 @@ class Tva extends CommonObject * @param int $notrigger 0=no, 1=yes (no update trigger) * @return int <0 if KO, >0 if OK */ - function update($user, $notrigger=0) + function update($user, $notrigger = 0) { global $conf, $langs; @@ -241,7 +241,7 @@ class Tva extends CommonObject * @param User $user User that load * @return int <0 if KO, >0 if OK */ - function fetch($id, $user=null) + function fetch($id, $user = null) { global $langs; $sql = "SELECT"; @@ -687,7 +687,7 @@ class Tva extends CommonObject * @param string $morecss More CSS * @return string Chaine with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='') + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '') { global $langs, $conf; @@ -813,7 +813,7 @@ class Tva extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -826,7 +826,7 @@ class Tva extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Libelle du statut */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; // TODO Renvoyer le libelle anglais et faire traduction a affichage diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 45b93692e3a..172b66c170c 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -66,8 +66,8 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end { $date_start=dol_get_first_day($year_start,empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START,false); if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) $date_end=dol_time_plus_duree($date_start, 3, 'm') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; - else if ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) $date_end=dol_time_plus_duree($date_start, 1, 'y') - 1; + elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) $date_end=dol_time_plus_duree($date_start, 1, 'm') - 1; } } else @@ -217,7 +217,7 @@ if (! is_array($x_coll) || ! is_array($x_paye)) $langs->load("errors"); if ($x_coll == -1) { print '
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . $langs->trans("Error") . '
' . $langs->trans("ErrorNoAccountancyModuleLoaded") . '
' . $langs->trans("FeatureNotYetAvailable") . '
' . $langs->trans("Error") . '
'; } - else if ($nbbyrow < 0) $return .= '
'; + elseif ($nbbyrow < 0) $return .= '
'; $return.= "\n"; @@ -6821,7 +6832,7 @@ abstract class CommonObject $return.= '
'; print ''; @@ -1382,7 +1387,6 @@ function form_constantes($tableau, $strictw3c=0, $helptext='') print "\n"; $label=''; - $listofparam=array(); foreach($tableau as $key => $const) // Loop on each param { $label=''; @@ -1550,6 +1554,7 @@ function form_constantes($tableau, $strictw3c=0, $helptext='') print ""; } print "\n"; + if (empty($strictw3c)) print "\n"; } } @@ -1606,7 +1611,7 @@ function showModulesExludedForExternal($modules) * @param string $description Model description * @return int <0 if KO, >0 if OK */ -function addDocumentModel($name, $type, $label='', $description='') +function addDocumentModel($name, $type, $label = '', $description = '') { global $db, $conf; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 6dab036193d..b168539f091 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -47,7 +47,7 @@ * @param int $resourceid Preselected value of resource for filter on resource * @return void */ -function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals=array(), $actioncode='', $usergroupid='', $excludetype='', $resourceid=0) +function print_actions_filter($form, $canedit, $status, $year, $month, $day, $showbirthday, $filtera, $filtert, $filterd, $pid, $socid, $action, $showextcals = array(), $actioncode = '', $usergroupid = '', $excludetype = '', $resourceid = 0) { global $conf, $user, $langs, $db, $hookmanager; global $begin_h, $end_h, $begin_d, $end_d; @@ -209,7 +209,7 @@ function print_actions_filter($form, $canedit, $status, $year, $month, $day, $sh * @param int $max Max nb of records * @return void */ -function show_array_actions_to_do($max=5) +function show_array_actions_to_do($max = 5) { global $langs, $conf, $user, $db, $bc, $socid; @@ -309,7 +309,7 @@ function show_array_actions_to_do($max=5) * @param int $max Max nb of records * @return void */ -function show_array_last_actions_done($max=5) +function show_array_last_actions_done($max = 5) { global $langs, $conf, $user, $db, $bc, $socid; @@ -561,4 +561,3 @@ function calendars_prepare_head($param) return $head; } - diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 4b4d36aa20b..8a2aa8f91a9 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -43,7 +43,7 @@ * - Ex: array('option_disabled'=> id to disable and warning to show if we select a disabled value (this is possible when using autocomplete ajax) * @return string Script */ -function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLength=2, $autoselect=0, $ajaxoptions=array()) +function ajax_autocompleter($selected, $htmlname, $url, $urloption = '', $minLength = 2, $autoselect = 0, $ajaxoptions = array()) { if (empty($minLength)) $minLength=1; @@ -221,7 +221,7 @@ function ajax_autocompleter($selected, $htmlname, $url, $urloption='', $minLengt * @param int $autoselect Automatic selection if just one value * @return string Script */ -function ajax_multiautocompleter($htmlname, $fields, $url, $option='', $minLength=2, $autoselect=0) +function ajax_multiautocompleter($htmlname, $fields, $url, $option = '', $minLength = 2, $autoselect = 0) { $script = ''."\n"; $script.= ' @@ -63,7 +64,7 @@ top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); $categorie = new Categorie($db); $categories = $categorie->get_full_arbo('product'); ?> -var categories = JSON.parse( '' ); +var categories = ; var currentcat; var pageproducts=0; var pagecategories=0; @@ -352,27 +353,30 @@ $( document ).ready(function() { -
-
+
+
-
- - - - - - - - - - - - - - - - -
+
+
+ +
+ + + + + + + + + + + + + + + + +
global->TAKEPOSCONNECTOR){ $menus[$r++]=array('title'=>$langs->trans("DOL_OPEN_DRAWER"), 'action'=>'OpenDrawer();'); } + +$hookmanager->initHooks(array('takeposfrontend')); +$reshook=$hookmanager->executeHooks('ActionButtons'); +if (!empty($reshook)) + { + $menus[$r++]=$reshook; + } + ?> -
+
'.$langs->trans("Next").''; echo ''; } - else if ($i>9) echo ''; + elseif ($i>9) echo ''; else echo ''; } ?> -
- -
+
+
+
+
-
id='catdiv'> - width="98%" id='catimg'/> -
-
-
-
+
id='catdiv'> + width="98%" id='catimg'/> +
+
+
+
-
+
-
+
-
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > - width="95%" id='proimg'/> -
-
-
-
+
onclick="MoreProducts('less');" onclick="MoreProducts('more');" > + width="95%" id='proimg'/> +
+
+
+
+
+
- } -div.tmenusep { +div.topmenuimage { display: none; @@ -3935,6 +3935,7 @@ tr.visible { display: inline-block; padding-left: 10px; vertical-align: middle; + line-height: 28px; } .websitetools { float: right; diff --git a/htdocs/theme/md/graph-color.php b/htdocs/theme/md/graph-color.php index 72cc839043b..78a621ada1d 100644 --- a/htdocs/theme/md/graph-color.php +++ b/htdocs/theme/md/graph-color.php @@ -31,4 +31,3 @@ $theme_bordercolor = array(235,235,224); $theme_datacolor = array(array(136,102,136), array(0,130,110), array(140,140,220), array(190,120,120), array(190,190,100), array(115,125,150), array(100,170,20), array(250,190,30), array(150,135,125), array(85,135,150), array(150,135,80), array(150,80,150)); $theme_bgcolor = array(hexdec('F4'),hexdec('F4'),hexdec('F4')); $theme_bgcoloronglet = array(hexdec('DE'),hexdec('E7'),hexdec('EC')); - diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index e20ffbe43e2..d3e2368217e 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -4,7 +4,7 @@ * Copyright (C) 2007-2017 Regis Houssin * Copyright (C) 2011 Philippe Grand * Copyright (C) 2012 Juanjo Menent - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index e67cd7a313c..b4a106d48e5 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -109,7 +109,7 @@ class ActionsTicket * @param Ticket $object Object Ticket * @return int 0 */ - public function doActions(&$action = '', Ticket $object=null) + public function doActions(&$action = '', Ticket $object = null) { global $conf, $user, $langs, $mysoc; diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 43002f30f99..28ba0ce4938 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1329,7 +1329,7 @@ class Ticket extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $db, $conf, $langs; global $dolibarr_main_authentication, $dolibarr_main_demo; diff --git a/htdocs/user/agenda_extsites.php b/htdocs/user/agenda_extsites.php index 2eb2ede000b..e504f5ed8e2 100644 --- a/htdocs/user/agenda_extsites.php +++ b/htdocs/user/agenda_extsites.php @@ -57,10 +57,7 @@ $object->getrights(); $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) // A user can always read its own card -{ - $feature2=''; -} + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // If user is not user that read and no permission to read other users, we stop diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index c76cab34f3b..527a7af5cb7 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -5,7 +5,7 @@ * Copyright (C) 2005-2009 Regis Houssin * Copyright (C) 2013 Peter Fontaine * Copyright (C) 2015-2016 Marcos García - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * * 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 diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8db719c62d4..f0b3aa361cc 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -8,7 +8,7 @@ * Copyright (C) 2011 Herve Prot * Copyright (C) 2012-2018 Juanjo Menent * Copyright (C) 2013 Florian Henry - * Copyright (C) 2013-2016 Alexandre Spangaro + * Copyright (C) 2013-2016 Alexandre Spangaro * Copyright (C) 2015-2017 Jean-François Ferry * Copyright (C) 2015 Ari Elbaz (elarifr) * Copyright (C) 2015-2018 Charlene Benke @@ -85,11 +85,8 @@ if ($id) $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; -if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card -if (! $canreaduser) { - $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); -} +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); @@ -393,7 +390,7 @@ if (empty($reshook)) { { $object->entity = 0; } - else if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) + elseif (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $object->entity = 1; // all users in master entity } @@ -1407,11 +1404,11 @@ else { $valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').$langs->trans("LdapUacf_".$statutUACF); } - else if($userChangePassNextLogon) + elseif($userChangePassNextLogon) { $valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').''.$langs->trans("UserMustChangePassNextLogon",$ldap->domainFQDN).''; } - else if($userDisabled) + elseif($userDisabled) { $valuetoshow.=($valuetoshow?(' '.$langs->trans("or").' '):'').''.$langs->trans("LdapUacf_".$statutUACF,$ldap->domainFQDN).''; } @@ -1463,7 +1460,7 @@ else { print $form->textwithpicto(yn($object->admin),$langs->trans("SuperAdministratorDesc"),1,"superadmin"); } - else if ($object->admin) + elseif ($object->admin) { print $form->textwithpicto(yn($object->admin),$langs->trans("AdministratorDesc"),1,"admin"); } @@ -1777,7 +1774,7 @@ else { print ''; } - else if (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && + elseif (($user->id != $id && $caneditpassword) && $object->login && !$object->ldap_sid && ((empty($conf->multicompany->enabled) && $object->entity == $user->entity) || ! $user->entity || ($object->entity == $conf->entity) || ($conf->global->MULTICOMPANY_TRANSVERSE_MODE && $conf->entity == 1))) { if ($object->email) print ''; diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 3b7d7ee5b00..0458d2c98be 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -17,7 +17,8 @@ use Luracast\Restler\RestException; -//require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; +require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; /** * API class for users @@ -217,11 +218,22 @@ class Users extends DolibarrApi foreach ($request_data as $field => $value) { - if ($field == 'id') continue; - $this->useraccount->$field = $value; + if ($field == 'id') continue; + // The status must be updated using setstatus() because it + // is not handled by the update() method. + if ($field == 'statut') { + $result = $this->useraccount->setstatus($value); + if ($result < 0) { + throw new RestException(500, 'Error when updating status of user: '.$this->useraccount->error); + } + } else { + $this->useraccount->$field = $value; + } } - if ($this->useraccount->update(DolibarrApiAccess::$user) > 0) + // If there is no error, update() returns the number of affected + // rows so if the update is a no op, the return value is zezo. + if ($this->useraccount->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); } @@ -231,6 +243,41 @@ class Users extends DolibarrApi } } + + /** + * List the groups of a user + * + * @param int $id Id of user + * @return array Array of group objects + * + * @throws RestException + * + * @url GET {id}/groups + */ + function getGroups($id) + { + $obj_ret = array(); + + if (! DolibarrApiAccess::$user->rights->user->user->lire) { + throw new RestException(401); + } + + $user = new User($this->db); + $result = $user->fetch($id); + if( ! $result ) { + throw new RestException(404, 'user not found'); + } + + $usergroup = new UserGroup($this->db); + $groups = $usergroup->listGroupsForUser($id, false); + $obj_ret = array(); + foreach ($groups as $group) { + $obj_ret[] = $this->_cleanObjectDatas($group); + } + return $obj_ret; + } + + /** * Add a user into a group * diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 2c189ad07d1..15139bd0291 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -8,7 +8,7 @@ * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot * Copyright (C) 2013-2018 Philippe Grand - * Copyright (C) 2013-2015 Alexandre Spangaro + * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2018 charlene Benke * Copyright (C) 2018 Nicolas ZABOURI @@ -219,7 +219,7 @@ class User extends CommonObject * @param int $entity If a value is >= 0, we force the search on a specific entity. If -1, means search depens on default setup. * @return int <0 if KO, 0 not found, >0 if OK */ - function fetch($id='', $login='', $sid='', $loadpersonalconf=0, $entity=-1) + function fetch($id = '', $login = '', $sid = '', $loadpersonalconf = 0, $entity = -1) { global $conf, $user; @@ -279,7 +279,7 @@ class User extends CommonObject { $sql.= " AND (u.ldap_sid = '".$this->db->escape($sid)."' OR u.login = '".$this->db->escape($login)."') LIMIT 1"; } - else if ($login) + elseif ($login) { $sql.= " AND u.login = '".$this->db->escape($login)."'"; } @@ -501,7 +501,7 @@ class User extends CommonObject * @return int > 0 if OK, < 0 if KO * @see clearrights, delrights, getrights */ - function addrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0) + function addrights($rid, $allmodule = '', $allperms = '', $entity = 0, $notrigger = 0) { global $conf, $user, $langs; @@ -538,7 +538,7 @@ class User extends CommonObject $whereforadd="id=".$this->db->escape($rid); // Ajout des droits induits if (! empty($subperms)) $whereforadd.=" OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; - else if (! empty($perms)) $whereforadd.=" OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; + elseif (! empty($perms)) $whereforadd.=" OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; } else { // On a pas demande un droit en particulier mais une liste de droits @@ -627,7 +627,7 @@ class User extends CommonObject * @return int > 0 if OK, < 0 if OK * @see clearrights, addrights, getrights */ - function delrights($rid, $allmodule='', $allperms='', $entity=0, $notrigger=0) + function delrights($rid, $allmodule = '', $allperms = '', $entity = 0, $notrigger = 0) { global $conf, $user, $langs; @@ -762,7 +762,7 @@ class User extends CommonObject * @return void * @see clearrights, delrights, addrights */ - function getrights($moduletag='', $forcereload=0) + function getrights($moduletag = '', $forcereload = 0) { global $conf; @@ -1102,7 +1102,7 @@ class User extends CommonObject * @param int $notrigger 1=do not execute triggers, 0 otherwise * @return int <0 if KO, id of created user if OK */ - function create($user, $notrigger=0) + function create($user, $notrigger = 0) { global $conf,$langs; global $mysoc; @@ -1236,7 +1236,7 @@ class User extends CommonObject * @param string $password Password to force * @return int <0 if error, if OK returns id of created user */ - function create_from_contact($contact,$login='',$password='') + function create_from_contact($contact, $login = '', $password = '') { // phpcs:enable global $conf,$user,$langs; @@ -1316,7 +1316,7 @@ class User extends CommonObject * @param string $login Login to force * @return int <0 if KO, if OK, return id of created account */ - function create_from_member($member,$login='') + function create_from_member($member, $login = '') { // phpcs:enable global $conf,$user,$langs; @@ -1438,7 +1438,7 @@ class User extends CommonObject * @param int $nosynccontact 0=Synchronize linked contact, 1=Do not synchronize linked contact * @return int <0 si KO, >=0 si OK */ - function update($user, $notrigger=0, $nosyncmember=0, $nosyncmemberpass=0, $nosynccontact=0) + function update($user, $notrigger = 0, $nosyncmember = 0, $nosyncmemberpass = 0, $nosynccontact = 0) { global $conf, $langs; @@ -1777,7 +1777,7 @@ class User extends CommonObject * @param int $nosyncmember Do not synchronize linked member * @return string If OK return clear password, 0 if no change, < 0 if error */ - function setPassword($user, $password='', $changelater=0, $notrigger=0, $nosyncmember=0) + function setPassword($user, $password = '', $changelater = 0, $notrigger = 0, $nosyncmember = 0) { global $conf, $langs; require_once DOL_DOCUMENT_ROOT .'/core/lib/security2.lib.php'; @@ -1909,7 +1909,7 @@ class User extends CommonObject * @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @TODO Add method 2 = Send link to reset password * @return int < 0 si erreur, > 0 si ok */ - function send_password($user, $password='', $changelater=0) + function send_password($user, $password = '', $changelater = 0) { // phpcs:enable global $conf, $langs; @@ -2102,7 +2102,7 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function SetInGroup($group, $entity, $notrigger=0) + function SetInGroup($group, $entity, $notrigger = 0) { // phpcs:enable global $conf, $langs, $user; @@ -2164,7 +2164,7 @@ class User extends CommonObject * @param int $notrigger Disable triggers * @return int <0 if KO, >0 if OK */ - function RemoveFromGroup($group, $entity, $notrigger=0) + function RemoveFromGroup($group, $entity, $notrigger = 0) { // phpcs:enable global $conf,$langs,$user; @@ -2224,7 +2224,7 @@ class User extends CommonObject * @param string $imagesize 'mini', 'small' or '' (original) * @return string String with URL link */ - function getPhotoUrl($width, $height, $cssclass='', $imagesize='') + function getPhotoUrl($width, $height, $cssclass = '', $imagesize = '') { $result =''; $result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize); @@ -2248,7 +2248,7 @@ class User extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpictoimg=0, $option='', $infologin=0, $notooltip=0, $maxlen=24, $hidethirdpartylogo=0, $mode='',$morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpictoimg = 0, $option = '', $infologin = 0, $notooltip = 0, $maxlen = 24, $hidethirdpartylogo = 0, $mode = '', $morecss = '', $save_lastsearch_value = -1) { global $langs, $conf, $db, $hookmanager, $user; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -2385,7 +2385,7 @@ class User extends CommonObject * @param string $option Sur quoi pointe le lien * @return string Chaine avec URL */ - function getLoginUrl($withpicto=0,$option='') + function getLoginUrl($withpicto = 0, $option = '') { global $langs, $user; @@ -2422,7 +2422,7 @@ class User extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->statut,$mode); } @@ -2435,7 +2435,7 @@ class User extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -2484,7 +2484,7 @@ class User extends CommonObject * 2=Return key only (RDN) (uid=qqq) * @return string DN */ - function _load_ldap_dn($info,$mode=0) + function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; @@ -2735,7 +2735,7 @@ class User extends CommonObject * @param int $admin Filter on admin tag * @return int Number of users */ - function getNbOfUsers($limitTo, $option='', $admin=-1) + function getNbOfUsers($limitTo, $option = '', $admin = -1) { global $conf; @@ -2891,7 +2891,7 @@ class User extends CommonObject * @param string $filter SQL filter on users * @return array Array of users $this->users. Note: $this->parentof is also set. */ - function get_full_tree($deleteafterid=0, $filter='') + function get_full_tree($deleteafterid = 0, $filter = '') { // phpcs:enable global $conf, $user; @@ -2993,7 +2993,7 @@ class User extends CommonObject * @return array Array of user id lower than user (all levels under user). This overwrite this->users. * @see get_children */ - function getAllChildIds($addcurrentuser=0) + function getAllChildIds($addcurrentuser = 0) { $childids=array(); @@ -3031,7 +3031,7 @@ class User extends CommonObject * @param int $protection Deep counter to avoid infinite loop (no more required, a protection is added with array useridfound) * @return int < 0 if KO (infinit loop), >= 0 if OK */ - function build_path_from_id_user($id_user,$protection=0) + function build_path_from_id_user($id_user, $protection = 0) { // phpcs:enable dol_syslog(get_class($this)."::build_path_from_id_user id_user=".$id_user." protection=".$protection, LOG_DEBUG); @@ -3134,7 +3134,7 @@ class User extends CommonObject * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf, $user, $langs; @@ -3166,7 +3166,7 @@ class User extends CommonObject * @param string $mode 'email' or 'mobile' * @return string Email of user with format: "Full name " */ - function user_get_property($rowid,$mode) + function user_get_property($rowid, $mode) { // phpcs:enable $user_property=''; @@ -3187,7 +3187,7 @@ class User extends CommonObject $obj = $this->db->fetch_object($resql); if ($mode == 'email') $user_property = dolGetFirstLastname($obj->firstname, $obj->lastname)." <".$obj->email.">"; - else if ($mode == 'mobile') $user_property = $obj->user_mobile; + elseif ($mode == 'mobile') $user_property = $obj->user_mobile; } return $user_property; } @@ -3208,7 +3208,7 @@ class User extends CommonObject * @param string $filtermode Filter mode (AND or OR) * @return int <0 if KO, >0 if OK */ - function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, $filter=array(), $filtermode='AND') + function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, $filter = array(), $filtermode = 'AND') { global $conf; diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 7870fe9c35e..8e9ad2745c3 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2010-2013 Laurent Destailleur * Copyright (C) 2012 Regis Houssin * Copyright (C) 2013 Peter Fontaine - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -62,7 +62,7 @@ class UserBankAccount extends Account * @param int $notrigger 1=Disable triggers * @return int <0 if KO, >= 0 if OK */ - function create(User $user=null, $notrigger=0) + function create(User $user = null, $notrigger = 0) { $now=dol_now(); @@ -92,7 +92,7 @@ class UserBankAccount extends Account * @param int $notrigger 1=Disable triggers * @return int <=0 if KO, >0 if OK */ - function update(User $user=null, $notrigger=0) + function update(User $user = null, $notrigger = 0) { global $conf; @@ -139,7 +139,7 @@ class UserBankAccount extends Account * @param int $userid User id * @return int <0 if KO, >0 if OK */ - function fetch($id, $ref='', $userid=0) + function fetch($id, $ref = '', $userid = 0) { if (empty($id) && empty($ref) && empty($userid)) return -1; diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index f70f61e2ed6..a6e443a26dc 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -107,7 +107,7 @@ class UserGroup extends CommonObject * @param boolean $load_members Load all members of the group * @return int <0 if KO, >0 if OK */ - function fetch($id='', $groupname='', $load_members = true) + function fetch($id = '', $groupname = '', $load_members = true) { global $conf; @@ -224,7 +224,7 @@ class UserGroup extends CommonObject * @param int $mode 0=Return array of user instance, 1=Return array of users id only * @return mixed Array of users or -1 on error */ - function listUsersForGroup($excludefilter='', $mode=0) + function listUsersForGroup($excludefilter = '', $mode = 0) { global $conf, $user; @@ -289,7 +289,7 @@ class UserGroup extends CommonObject * @param int $entity Entity to use * @return int > 0 if OK, < 0 if KO */ - function addrights($rid, $allmodule='', $allperms='', $entity=0) + function addrights($rid, $allmodule = '', $allperms = '', $entity = 0) { global $conf, $user, $langs; @@ -326,7 +326,7 @@ class UserGroup extends CommonObject $whereforadd="id=".$this->db->escape($rid); // Ajout des droits induits if ($subperms) $whereforadd.=" OR (module='$module' AND perms='$perms' AND (subperms='lire' OR subperms='read'))"; - else if ($perms) $whereforadd.=" OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; + elseif ($perms) $whereforadd.=" OR (module='$module' AND (perms='lire' OR perms='read') AND subperms IS NULL)"; // Pour compatibilite, si lowid = 0, on est en mode ajout de tout // TODO A virer quand sera gere par l'appelant @@ -415,7 +415,7 @@ class UserGroup extends CommonObject * @param int $entity Entity to use * @return int > 0 if OK, < 0 if OK */ - function delrights($rid, $allmodule='', $allperms='', $entity=0) + function delrights($rid, $allmodule = '', $allperms = '', $entity = 0) { global $conf, $user, $langs; @@ -537,7 +537,7 @@ class UserGroup extends CommonObject * @param string $moduletag Name of module we want permissions ('' means all) * @return int <0 if KO, >0 if OK */ - function getrights($moduletag='') + function getrights($moduletag = '') { global $conf; @@ -676,7 +676,7 @@ class UserGroup extends CommonObject * @param int $notrigger 0=triggers enabled, 1=triggers disabled * @return int <0 if KO, >=0 if OK */ - function create($notrigger=0) + function create($notrigger = 0) { global $user, $conf, $langs, $hookmanager; @@ -747,7 +747,7 @@ class UserGroup extends CommonObject * @param int $notrigger 0=triggers enabled, 1=triggers disabled * @return int <0 if KO, >=0 if OK */ - function update($notrigger=0) + function update($notrigger = 0) { global $user, $conf, $langs, $hookmanager; @@ -817,7 +817,7 @@ class UserGroup extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut(0,$mode); } @@ -830,7 +830,7 @@ class UserGroup extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($statut,$mode=0) + function LibStatut($statut, $mode = 0) { // phpcs:enable global $langs; @@ -849,7 +849,7 @@ class UserGroup extends CommonObject * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1) { global $langs, $conf, $db, $hookmanager; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -925,7 +925,7 @@ class UserGroup extends CommonObject * 2=Return key only (uid=qqq) * @return string DN */ - function _load_ldap_dn($info,$mode=0) + function _load_ldap_dn($info, $mode = 0) { // phpcs:enable global $conf; @@ -1011,7 +1011,7 @@ class UserGroup extends CommonObject * @param null|array $moreparams Array to provide more information * @return int 0 if KO, 1 if OK */ - public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) + public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null) { global $conf,$user,$langs; diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index a6618f3a7c0..21342704524 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -35,10 +35,7 @@ $id=GETPOST('id','int'); $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) // A user can always read its own card -{ - $feature2=''; -} + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 6f7e27b13dd..13975dff97c 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -66,10 +66,9 @@ if ($id) $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2='user'; -if ($user->id == $id) { $feature2=''; $canreaduser=1; } // A user can always read its own card -if (!$canreaduser) { - $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); -} + +$result = restrictedArea($user, 'user', $id, 'user&user', $feature2); + if ($user->id <> $id && ! $canreaduser) accessforbidden(); // Get parameters diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 61c817a4c72..b940e6befe6 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -473,7 +473,7 @@ else print '
'; print ''; print ''; diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 65723b4d65d..f0673966f44 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -121,7 +121,7 @@ foreach($fulltree as $key => $val) { $li.=img_picto($langs->trans("SuperAdministrator"),'redstar'); } - else if ($userstatic->admin) + elseif ($userstatic->admin) { $li.=img_picto($langs->trans("Administrator"),'star'); } diff --git a/htdocs/user/home.php b/htdocs/user/home.php index fb97549e9a1..efb1ba33b78 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -156,7 +156,7 @@ if ($resql) { print img_picto($langs->trans("SuperAdministrator"),'redstar'); } - else if ($obj->admin) + elseif ($obj->admin) { print img_picto($langs->trans("Administrator"),'star'); } diff --git a/htdocs/user/info.php b/htdocs/user/info.php index 5e1bfaddc4c..5936c36e2d2 100644 --- a/htdocs/user/info.php +++ b/htdocs/user/info.php @@ -43,10 +43,7 @@ if ($id > 0 || ! empty($ref)) $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) // A user can always read its own card -{ - $feature2=''; -} + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // If user is not user that read and no permission to read other users, we stop diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 45b575b9843..d120e7334b4 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -37,7 +37,7 @@ $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'userldap'; $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) $feature2=''; // A user can always read its own card + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); $object = new User($db); diff --git a/htdocs/user/list.php b/htdocs/user/list.php index dcede3a5576..4a449771a64 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -2,7 +2,7 @@ /* Copyright (C) 2002-2005 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2017 Regis Houssin - * Copyright (C) 2015 Alexandre Spangaro + * Copyright (C) 2015 Alexandre Spangaro * Copyright (C) 2016 Marcos García * * This program is free software; you can redistribute it and/or modify @@ -504,7 +504,7 @@ while ($i < min($num,$limit)) { print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"'); } - else if ($obj->admin) + elseif ($obj->admin) { print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"'); } @@ -553,7 +553,7 @@ while ($i < min($num,$limit)) $companystatic->canvas=$obj->canvas; print $companystatic->getNomUrl(1); } - else if ($obj->ldap_sid) + elseif ($obj->ldap_sid) { print $langs->trans("DomainUser"); } @@ -604,7 +604,7 @@ while ($i < min($num,$limit)) { print img_picto($langs->trans("SuperAdministrator"), 'redstar', 'class="valignmiddle paddingleft"'); } - else if ($obj->admin2) + elseif ($obj->admin2) { print img_picto($langs->trans("Administrator"), 'star', 'class="valignmiddle paddingleft"'); } diff --git a/htdocs/user/note.php b/htdocs/user/note.php index c4f657a29bc..3d2880b99a5 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -45,7 +45,7 @@ if (($object->id != $user->id) && (! $user->rights->user->user->lire)) accessfor $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) $feature2=''; // A user can always read its own card + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 0e53db2c954..48e6674a031 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -49,11 +49,7 @@ if ($id) $socid=0; if ($user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id) // A user can always read its own card -{ - $feature2=''; - $canreaduser=1; -} + $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); if ($user->id <> $id && ! $canreaduser) accessforbidden(); diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 17666183319..495cd3d913d 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -58,10 +58,9 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $socid=0; if (isset($user->societe_id) && $user->societe_id > 0) $socid = $user->societe_id; $feature2 = (($socid && $user->rights->user->self->creer)?'':'user'); -if ($user->id == $id && (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->user->self_advance->readperms)) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms +if ($user->id == $id && (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->user->self_advance->readperms))) // A user can always read its own card if not advanced perms enabled, or if he has advanced perms { - $feature2=''; - $canreaduser=1; + accessforbidden(); } $result = restrictedArea($user, 'user', $id, 'user&user', $feature2); @@ -351,7 +350,7 @@ if ($result) print img_picto($langs->trans("Active"),'tick'); print ''; } - else if (in_array($obj->id, $permsuser)) // Permission granted by user + elseif (in_array($obj->id, $permsuser)) // Permission granted by user { if ($caneditperms) { @@ -362,7 +361,7 @@ if ($result) print ''; } - else if (is_array($permsgroupbyentity[$entity])) + elseif (is_array($permsgroupbyentity[$entity])) { if (in_array($obj->id, $permsgroupbyentity[$entity])) // Permission granted by group { diff --git a/htdocs/variants/ajax/orderAttribute.php b/htdocs/variants/ajax/orderAttribute.php index 92bbcc241d5..518b41fb388 100644 --- a/htdocs/variants/ajax/orderAttribute.php +++ b/htdocs/variants/ajax/orderAttribute.php @@ -50,4 +50,3 @@ if (isset($_POST['roworder'])) { ProductAttribute::bulkUpdateOrder($db, $newrowordertab); } - diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index ea29fe0d8bd..2385a558307 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -84,7 +84,7 @@ require 'main.inc.php'; // Load $user and permissions require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $action=GETPOST('action','alpha'); -$original_file=GETPOST('file','alpha'); // Do not use urldecode here ($_GET are already decoded by PHP). +$original_file=GETPOST('file','alphanohtml'); // Do not use urldecode here ($_GET are already decoded by PHP). $hashp=GETPOST('hashp','aZ09'); $modulepart=GETPOST('modulepart','alpha'); $urlsource=GETPOST('urlsource','alpha'); diff --git a/htdocs/webservices/index.php b/htdocs/webservices/index.php index e0a1ba998c8..2f469fa95fd 100644 --- a/htdocs/webservices/index.php +++ b/htdocs/webservices/index.php @@ -54,4 +54,3 @@ print 'List of available SOAP Web services is visible on the setup area, setup p $db->close(); - diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index a9edcb0557a..763dd500366 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -244,7 +244,7 @@ $server->register( * @param int $id Id of object * @return mixed */ -function getActionComm($authentication,$id) +function getActionComm($authentication, $id) { global $db,$conf,$langs; @@ -408,7 +408,7 @@ function getListActionCommType($authentication) * @param ActionComm $actioncomm $actioncomm * @return array Array result */ -function createActionComm($authentication,$actioncomm) +function createActionComm($authentication, $actioncomm) { global $db,$conf,$langs; @@ -491,7 +491,7 @@ function createActionComm($authentication,$actioncomm) * @param ActionComm $actioncomm $actioncomm * @return array Array result */ -function updateActionComm($authentication,$actioncomm) +function updateActionComm($authentication, $actioncomm) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index a941c2aceff..491122f748c 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -186,7 +186,7 @@ $server->register( * @param int $id Id of object * @return mixed */ -function getCategory($authentication,$id) +function getCategory($authentication, $id) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index edb429af0d3..8143b4cd178 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -235,7 +235,7 @@ $server->register( * @param string $ref_ext Ref external of object * @return mixed */ -function getContact($authentication,$id,$ref_ext) +function getContact($authentication, $id, $ref_ext) { global $db,$conf,$langs; @@ -352,7 +352,7 @@ function getContact($authentication,$id,$ref_ext) * @param Contact $contact $contact * @return array Array result */ -function createContact($authentication,$contact) +function createContact($authentication, $contact) { global $db,$conf,$langs; @@ -463,7 +463,7 @@ function createContact($authentication,$contact) * @param int $idthirdparty Id thirdparty * @return array Array result */ -function getContactsForThirdParty($authentication,$idthirdparty) +function getContactsForThirdParty($authentication, $idthirdparty) { global $db,$conf,$langs; @@ -595,7 +595,7 @@ function getContactsForThirdParty($authentication,$idthirdparty) * @param Contact $contact Contact * @return array Array result */ -function updateContact($authentication,$contact) +function updateContact($authentication, $contact) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 4e8d3ec41d8..8287d3bff48 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -286,7 +286,7 @@ $server->register( * @param string $ref_ext Ref_ext * @return array Array result */ -function getInvoice($authentication,$id='',$ref='',$ref_ext='') +function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') { global $db,$conf,$langs; @@ -399,7 +399,7 @@ function getInvoice($authentication,$id='',$ref='',$ref_ext='') * @param int $idthirdparty Id thirdparty * @return array Array result */ -function getInvoicesForThirdParty($authentication,$idthirdparty) +function getInvoicesForThirdParty($authentication, $idthirdparty) { global $db,$conf,$langs; @@ -534,7 +534,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty) * @param Facture $invoice Invoice * @return array Array result */ -function createInvoice($authentication,$invoice) +function createInvoice($authentication, $invoice) { global $db,$conf,$langs; @@ -654,7 +654,7 @@ function createInvoice($authentication,$invoice) * @param string $ref_ext_order ref_ext of order to copy invoice from * @return array Array result */ -function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $ref_ext_order='') +function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '', $ref_ext_order = '') { global $db,$conf; @@ -740,7 +740,7 @@ function createInvoiceFromOrder($authentication,$id_order='', $ref_order='', $re * @param Facture $invoice Invoice * @return array Array result */ -function updateInvoice($authentication,$invoice) +function updateInvoice($authentication, $invoice) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index c74b5660873..0d38d601b99 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -344,7 +344,7 @@ $server->register( * @param string $ref_ext Ref_ext * @return array Array result */ -function getOrder($authentication,$id='',$ref='',$ref_ext='') +function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') { global $db,$conf,$langs; @@ -496,7 +496,7 @@ function getOrder($authentication,$id='',$ref='',$ref_ext='') * @param int $idthirdparty Id of thirdparty * @return array Array result */ -function getOrdersForThirdParty($authentication,$idthirdparty) +function getOrdersForThirdParty($authentication, $idthirdparty) { global $db,$conf,$langs; @@ -655,7 +655,7 @@ function getOrdersForThirdParty($authentication,$idthirdparty) * @param array $order Order info * @return int Id of new order */ -function createOrder($authentication,$order) +function createOrder($authentication, $order) { global $db,$conf,$langs; @@ -795,7 +795,7 @@ function createOrder($authentication,$order) * @param int $id_warehouse Id of warehouse to use for stock decrease * @return array Array result */ -function validOrder($authentication,$id='',$id_warehouse=0) +function validOrder($authentication, $id = '', $id_warehouse = 0) { global $db,$conf,$langs; @@ -875,7 +875,7 @@ function validOrder($authentication,$id='',$id_warehouse=0) * @param array $order Order info * @return array Array result */ -function updateOrder($authentication,$order) +function updateOrder($authentication, $order) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 895e5d55af4..6037b5285e0 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -181,7 +181,7 @@ function getVersions($authentication) * @param string $refname Ref of object to check permission for external users (autodetect if not provided) * @return void */ -function getDocument($authentication, $modulepart, $file, $refname='') +function getDocument($authentication, $modulepart, $file, $refname = '') { global $db,$conf,$langs,$mysoc; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index 1e301350063..b4ad2460700 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -333,7 +333,7 @@ $server->register( * @param string $lang Lang to force * @return mixed */ -function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='') +function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '', $lang = '') { global $db,$conf,$langs; @@ -467,7 +467,7 @@ function getProductOrService($authentication,$id='',$ref='',$ref_ext='',$lang='' * @param Product $product Product * @return array Array result */ -function createProductOrService($authentication,$product) +function createProductOrService($authentication, $product) { global $db,$conf,$langs; @@ -635,7 +635,7 @@ function createProductOrService($authentication,$product) * @param Product $product Product * @return array Array result */ -function updateProductOrService($authentication,$product) +function updateProductOrService($authentication, $product) { global $db,$conf,$langs; @@ -823,7 +823,7 @@ function updateProductOrService($authentication,$product) * @param string $listofidstring List of id with comma * @return array Array result */ -function deleteProductOrService($authentication,$listofidstring) +function deleteProductOrService($authentication, $listofidstring) { global $db,$conf,$langs; @@ -903,7 +903,7 @@ function deleteProductOrService($authentication,$listofidstring) //$objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'listofid'=>$listofiddeleted); $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel), 'nbdeleted'=>0); } - else if (count($listofiddeleted) == 0) + elseif (count($listofiddeleted) == 0) { //$objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'listofid'=>$listofiddeleted); $objectresp=array('result'=>array('result_code'=>'NOT_FOUND', 'result_label'=>'No product or service with id '.join(',',$listofid).' found'), 'nbdeleted'=>0); @@ -920,7 +920,7 @@ function deleteProductOrService($authentication,$listofidstring) * @param array $filterproduct Filter fields * @return array Array result */ -function getListOfProductsOrServices($authentication,$filterproduct) +function getListOfProductsOrServices($authentication, $filterproduct) { global $db,$conf,$langs; @@ -997,7 +997,7 @@ function getListOfProductsOrServices($authentication,$filterproduct) * @param $lang $lang Force lang * @return array Array result */ -function getProductsForCategory($authentication,$id,$lang='') +function getProductsForCategory($authentication, $id, $lang = '') { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 822081011aa..a064eff1ebc 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -329,7 +329,7 @@ function createProject($authentication, $project) * @param string $ref internal reference * @return array Array result */ -function getProject($authentication,$id='',$ref='') +function getProject($authentication, $id = '', $ref = '') { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 50e5498dbe1..c5005dab24d 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -223,7 +223,7 @@ $server->register( * @param string $ref_ext Ref_ext * @return array Array result */ -function getSupplierInvoice($authentication,$id='',$ref='',$ref_ext='') +function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') { global $db,$conf,$langs; @@ -333,7 +333,7 @@ function getSupplierInvoice($authentication,$id='',$ref='',$ref_ext='') * @return array Array result * */ -function getSupplierInvoicesForThirdParty($authentication,$idthirdparty) +function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index 7f0b590ee9a..1587a403940 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -283,7 +283,7 @@ $server->register( * @param string $ref_ext external reference * @return array Array result */ -function getThirdParty($authentication,$id='',$ref='',$ref_ext='') +function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') { global $db,$conf,$langs; @@ -399,7 +399,7 @@ function getThirdParty($authentication,$id='',$ref='',$ref_ext='') * @param Societe $thirdparty Thirdparty * @return array Array result */ -function createThirdParty($authentication,$thirdparty) +function createThirdParty($authentication, $thirdparty) { global $db,$conf,$langs; @@ -525,7 +525,7 @@ function createThirdParty($authentication,$thirdparty) * @param Societe $thirdparty Thirdparty * @return array Array result */ -function updateThirdParty($authentication,$thirdparty) +function updateThirdParty($authentication, $thirdparty) { global $db,$conf,$langs; @@ -655,7 +655,7 @@ function updateThirdParty($authentication,$thirdparty) * @param array $filterthirdparty Filter fields (key=>value to filer on. For example 'client'=>2, 'supplier'=>1, 'category'=>idcateg, 'name'=>'searchstring', ...) * @return array Array result */ -function getListOfThirdParties($authentication,$filterthirdparty) +function getListOfThirdParties($authentication, $filterthirdparty) { global $db,$conf,$langs; @@ -760,7 +760,7 @@ function getListOfThirdParties($authentication,$filterthirdparty) * @param string $ref_ext external reference * @return array Array result */ -function deleteThirdParty($authentication,$id='',$ref='',$ref_ext='') +function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') { global $db,$conf,$langs; diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 81702c55456..5bc8350d563 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -301,7 +301,7 @@ $server->register( * @param string $ref_ext Ref external of object * @return mixed */ -function getUser($authentication,$id,$ref='',$ref_ext='') +function getUser($authentication, $id, $ref = '', $ref_ext = '') { global $db,$conf,$langs; @@ -473,7 +473,7 @@ function getListOfGroups($authentication) * @param array $thirdpartywithuser Datas * @return mixed */ -function createUserFromThirdparty($authentication,$thirdpartywithuser) +function createUserFromThirdparty($authentication, $thirdpartywithuser) { global $db,$conf,$langs; @@ -681,7 +681,7 @@ function createUserFromThirdparty($authentication,$thirdpartywithuser) * @param array $shortuser Array of login/password info * @return mixed */ -function setUserPassword($authentication,$shortuser) +function setUserPassword($authentication, $shortuser) { global $db,$conf,$langs; diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 0e6ee83aa9d..e0cd985ced1 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -301,7 +301,7 @@ class Website extends CommonObject * * @return int <0 if KO, >0 if OK */ - public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, array $filter = array(), $filtermode='AND') + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); @@ -517,7 +517,7 @@ class Website extends CommonObject * @param string $newlang New language * @return mixed New object created, <0 if KO */ - public function createFromClone($user, $fromid, $newref, $newlang='') + public function createFromClone($user, $fromid, $newref, $newlang = '') { global $hookmanager, $langs; global $dolibarr_main_data_root; @@ -671,7 +671,7 @@ class Website extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') { global $langs, $conf, $db; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -707,7 +707,7 @@ class Website extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -720,7 +720,7 @@ class Website extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; @@ -1094,7 +1094,7 @@ class Website extends CommonObject * @param string $htmlname Suffix for HTML name * @return string HTML select component */ - public function componentSelectLang($languagecodes, $weblangs, $morecss='', $htmlname='') + public function componentSelectLang($languagecodes, $weblangs, $morecss = '', $htmlname = '') { global $websitepagefile, $website; diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index ffa2176f142..778998f8ac2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -256,7 +256,7 @@ class WebsitePage extends CommonObject * @param string $filtermode Filter mode (AND or OR) * @return array|int int <0 if KO, array of pages if OK */ - public function fetchAll($websiteid, $sortorder='', $sortfield='', $limit=0, $offset=0, array $filter=array(), $filtermode='AND') + public function fetchAll($websiteid, $sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') { dol_syslog(__METHOD__, LOG_DEBUG); @@ -407,7 +407,7 @@ class WebsitePage extends CommonObject * @param int $keeptitleunchanged 1=Keep title unchanged * @return mixed New object created, <0 if KO */ - public function createFromClone(User $user, $fromid, $newref, $newlang='', $istranslation=0, $newwebsite=0, $keeptitleunchanged=0) + public function createFromClone(User $user, $fromid, $newref, $newlang = '', $istranslation = 0, $newwebsite = 0, $keeptitleunchanged = 0) { global $hookmanager, $langs; @@ -472,7 +472,7 @@ class WebsitePage extends CommonObject * @param string $morecss Add more css on link * @return string String with URL */ - function getNomUrl($withpicto=0, $option='', $notooltip=0, $maxlen=24, $morecss='') + function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $maxlen = 24, $morecss = '') { global $langs, $conf, $db; global $dolibarr_main_authentication, $dolibarr_main_demo; @@ -507,7 +507,7 @@ class WebsitePage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function getLibStatut($mode=0) + function getLibStatut($mode = 0) { return $this->LibStatut($this->status,$mode); } @@ -520,7 +520,7 @@ class WebsitePage extends CommonObject * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long, 5=Libelle court + Picto * @return string Label of status */ - function LibStatut($status,$mode=0) + function LibStatut($status, $mode = 0) { // phpcs:enable global $langs; diff --git a/htdocs/website/index.php b/htdocs/website/index.php index ecb80bf6c22..db253adafbf 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -37,7 +37,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; -$langs->loadLangs(array("admin","other","website")); +$langs->loadLangs(array("admin","other","website","errors")); if (! $user->rights->website->read) accessforbidden(); @@ -280,6 +280,12 @@ if ($action == 'addsite') { $db->begin(); + if (GETPOST('virtualhost','alpha') && ! preg_match('/^http/',GETPOST('virtualhost','alpha'))) + { + $error++; + setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors'); + } + if (! $error && ! GETPOST('WEBSITE_REF','alpha')) { $error++; @@ -298,7 +304,7 @@ if ($action == 'addsite') $tmpobject=new Website($db); $tmpobject->ref = GETPOST('WEBSITE_REF','alpha'); $tmpobject->description = GETPOST('WEBSITE_DESCRIPTION','alpha'); - $tmpobject->virtualhost = GETPOST('WEBSITE_VIRTUALHOST','alpha'); + $tmpobject->virtualhost = GETPOST('virtualhost','alpha'); $result = $tmpobject->create($user); if ($result <= 0) @@ -353,6 +359,7 @@ if ($action == 'addcontainer') if (! preg_match('/^http/', $urltograb)) { $error++; + $langs->load("errors"); setEventMessages('Error URL must start with http:// or https://', null, 'errors'); $action = 'createcontainer'; } @@ -670,7 +677,7 @@ if ($action == 'addcontainer') $error++; $action='createcontainer'; } - else if (! preg_match('/^[a-z0-9\-\_]+$/i', $objectpage->pageurl)) + elseif (! preg_match('/^[a-z0-9\-\_]+$/i', $objectpage->pageurl)) { $langs->load("errors"); setEventMessages($langs->transnoentities("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities('WEBSITE_PAGENAME')), null, 'errors'); @@ -867,180 +874,207 @@ if ($action == 'updatecss') $res = $object->fetch(0, $websitekey); $website = $object; - // Save master.inc.php file - $filemaster=$pathofwebsite.'/master.inc.php'; - - dol_syslog("Save master file ".$filemaster); - - dol_mkdir($pathofwebsite); - - // Now generate the master.inc.php page - $result = dolSaveMasterFile($filemaster); - if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); - - - // Html header file - $htmlheadercontent =''; - - /* We disable php code since htmlheader is never executed as an include but only read by fgets_content. - $htmlheadercontent.= "\n";*/ - - $htmlheadercontent.= preg_replace(array('/\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER', 'none')); - - /*$htmlheadercontent.= "\n".'"."\n";*/ - - $htmlheadercontent = trim($htmlheadercontent)."\n"; - - dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); - - - // Css file - $csscontent =''; - - $csscontent.= "\n"; - - $csscontent.= GETPOST('WEBSITE_CSS_INLINE', 'none'); - - $csscontent.= "\n".'"."\n"; - - dol_syslog("Save css content into ".$filecss); - - dol_mkdir($pathofwebsite); - $result = file_put_contents($filecss, $csscontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filecss, octdec($conf->global->MAIN_UMASK)); - - if (! $result) + if (GETPOSTISSET('virtualhost')) { - $error++; - setEventMessages('Failed to write file '.$filecss, null, 'errors'); + if (GETPOST('virtualhost','alpha') && ! preg_match('/^http/',GETPOST('virtualhost','alpha'))) + { + $error++; + setEventMessages($langs->trans('ErrorURLMustStartWithHttp', $langs->transnoentitiesnoconv("VirtualHost")), null, 'errors'); + $action='editcss'; + } + + if (! $error) + { + $object->virtualhost = GETPOST('virtualhost','alpha'); + + $result = $object->update($user); + if ($result < 0) + { + $error++; + setEventMessages($object->error, $object->errors, 'errors'); + $action='editcss'; + } + } } - - // Js file - $jscontent =''; - - $jscontent.= "\n"; - - $jscontent.= GETPOST('WEBSITE_JS_INLINE', 'none'); - - $jscontent.= "\n".'"."\n"; - - dol_syslog("Save js content into ".$filejs); - - dol_mkdir($pathofwebsite); - $result = file_put_contents($filejs, $jscontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filejs, octdec($conf->global->MAIN_UMASK)); - - if (! $result) - { - $error++; - setEventMessages('Failed to write file '.$filejs, null, 'errors'); - } - - - // Robot file - $robotcontent =''; - - /*$robotcontent.= "\n";*/ - - $robotcontent.= GETPOST('WEBSITE_ROBOT', 'none'); - - /*$robotcontent.= "\n".'"."\n";*/ - - dol_syslog("Save file robot into ".$filerobot); - - dol_mkdir($pathofwebsite); - $result = file_put_contents($filerobot, $robotcontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filerobot, octdec($conf->global->MAIN_UMASK)); - - if (! $result) - { - $error++; - setEventMessages('Failed to write file '.$filerobot, null, 'errors'); - } - - - // Css file - $htaccesscontent =''; - - /*$htaccesscontent.= "\n";*/ - - $htaccesscontent.= GETPOST('WEBSITE_HTACCESS', 'none'); - - /*$htaccesscontent.= "\n".'"."\n";*/ - - dol_syslog("Save file htaccess into ".$filehtaccess); - - dol_mkdir($pathofwebsite); - $result = file_put_contents($filehtaccess, $htaccesscontent); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($filehtaccess, octdec($conf->global->MAIN_UMASK)); - - if (! $result) - { - $error++; - setEventMessages('Failed to write file '.$filehtaccess, null, 'errors'); - } - - // Message if no error if (! $error) { - setEventMessages($langs->trans("Saved"), null, 'mesgs'); - } + // Save master.inc.php file + $filemaster=$pathofwebsite.'/master.inc.php'; - $action='preview'; + dol_syslog("Save master file ".$filemaster); + + dol_mkdir($pathofwebsite); + + // Now generate the master.inc.php page + $result = dolSaveMasterFile($filemaster); + if (! $result) setEventMessages('Failed to write file '.$filemaster, null, 'errors'); + + + // Html header file + $htmlheadercontent =''; + + /* We disable php code since htmlheader is never executed as an include but only read by fgets_content. + $htmlheadercontent.= "\n";*/ + + $htmlheadercontent.= preg_replace(array('/\n*/ims','/<\/html>\n*/ims'),array('',''),GETPOST('WEBSITE_HTML_HEADER', 'none')); + + /*$htmlheadercontent.= "\n".'"."\n";*/ + + $htmlheadercontent = trim($htmlheadercontent)."\n"; + + dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); + + + // Css file + $csscontent =''; + + $csscontent.= "\n"; + + $csscontent.= GETPOST('WEBSITE_CSS_INLINE', 'none'); + + $csscontent.= "\n".'"."\n"; + + dol_syslog("Save css content into ".$filecss); + + dol_mkdir($pathofwebsite); + $result = file_put_contents($filecss, $csscontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filecss, octdec($conf->global->MAIN_UMASK)); + + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filecss, null, 'errors'); + } + + + // Js file + $jscontent =''; + + $jscontent.= "\n"; + + $jscontent.= GETPOST('WEBSITE_JS_INLINE', 'none'); + + $jscontent.= "\n".'"."\n"; + + dol_syslog("Save js content into ".$filejs); + + dol_mkdir($pathofwebsite); + $result = file_put_contents($filejs, $jscontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filejs, octdec($conf->global->MAIN_UMASK)); + + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filejs, null, 'errors'); + } + + + // Robot file + $robotcontent =''; + + /*$robotcontent.= "\n";*/ + + $robotcontent.= GETPOST('WEBSITE_ROBOT', 'none'); + + /*$robotcontent.= "\n".'"."\n";*/ + + dol_syslog("Save file robot into ".$filerobot); + + dol_mkdir($pathofwebsite); + $result = file_put_contents($filerobot, $robotcontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filerobot, octdec($conf->global->MAIN_UMASK)); + + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filerobot, null, 'errors'); + } + + + // Css file + $htaccesscontent =''; + + /*$htaccesscontent.= "\n";*/ + + $htaccesscontent.= GETPOST('WEBSITE_HTACCESS', 'none'); + + /*$htaccesscontent.= "\n".'"."\n";*/ + + dol_syslog("Save file htaccess into ".$filehtaccess); + + dol_mkdir($pathofwebsite); + $result = file_put_contents($filehtaccess, $htaccesscontent); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($filehtaccess, octdec($conf->global->MAIN_UMASK)); + + if (! $result) + { + $error++; + setEventMessages('Failed to write file '.$filehtaccess, null, 'errors'); + } + + + // Message if no error + if (! $error) + { + setEventMessages($langs->trans("Saved"), null, 'mesgs'); + } + + $action='preview'; + } } } @@ -1784,53 +1818,46 @@ if (! GETPOST('hide_websitemenu')) // Toolbar for websites - print '
'; + print '
'; if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') { $urlext=$virtualurl; $urlint=$urlwithroot.'/public/website/index.php?website='.$websitekey; - $htmltext = $langs->trans("PreviewSiteServedByDolibarr", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $urlint, $dataroot); - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); - print '
'; - print $form->textwithpicto('', $htmltext, 1, 'preview'); - print ''; - - print '
'; - print ''; - //print ''; - $htmltext =$langs->trans("SetHereVirtualHost", $dataroot); - $htmltext.='
'; - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); - $htmltext.='
'; - $htmltext.='
'; - $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); - print $form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helpvirtualhost'); - print '
'; - + print '
'; + $linktotestonwebserver = ''; + $linktotestonwebserver.= $langs->trans("TestDeployOnWeb", $virtualurl).' '.img_picto('','object_globe'); + $linktotestonwebserver.= ''; + $htmltext = ''; if (empty($object->fk_default_home)) { - $htmltext = ''.$langs->trans("YouMustDefineTheHomePage").'
'.$langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").''); - $htmltext.='
'; - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT); - print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $htmltext, 1, 'preview_ext'); - print ''; + $htmltext.= '
'.$langs->trans("YouMustDefineTheHomePage").'

'; + } + elseif (empty($virtualurl)) + { + $htmltext.= '
'.$langs->trans("VirtualHostUrlNotDefined").'

'; } else { - $htmltext = $langs->trans("PreviewSiteServedByWebServer", $langs->transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext?$urlext:''.$langs->trans("VirtualHostUrlNotDefined").''); - $htmltext.='
'; - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); - $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); - print 'transnoentitiesnoconv("Site"), $langs->transnoentitiesnoconv("Site"), $dataroot, $urlext)).'">'; - print $form->textwithpicto('', $htmltext, 1, 'preview_ext'); - print ''; + $htmltext.= '
'.$langs->trans("GoTo").' '.$virtualurl.'

'; } + if (! empty($conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER)) + { + $htmltext.= '
'.$conf->global->WEBSITE_REPLACE_INFO_ABOUT_USAGE_WITH_WEBSERVER; + } + else + { + $htmltext.=$langs->trans("SetHereVirtualHost", $dataroot); + $htmltext.='
'; + $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); + $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); + $htmltext.='
'; + $htmltext.='
'; + $htmltext.=$langs->trans("YouCanAlsoTestWithPHPS", $dataroot); + } + print $form->textwithpicto($linktotestonwebserver, $htmltext, 1, 'none', 'valignmiddle', 0, 2, 'helpvirtualhost'); + print '
'; } if (in_array($action, array('editcss','editmenu','file_manager'))) @@ -2129,7 +2156,7 @@ if (! GETPOST('hide_websitemenu')) newurl=jQuery("#previewsiteurl").val(); if (! newurl.startsWith("http")) { - alert(\''.dol_escape_js($langs->trans("ExternalURLMustStartWithHttp")).'\'); + alert(\''.dol_escape_js($langs->trans("ErrorURLMustStartWithHttp")).'\'); return false; } @@ -2321,6 +2348,19 @@ if ($action == 'editcss') print '
'; + // VirtualHost + print ''; + print '
'; print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); if ($useringroup->admin && ! $useringroup->entity) print img_picto($langs->trans("SuperAdministrator"),'redstar'); - else if ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); + elseif ($useringroup->admin) print img_picto($langs->trans("Administrator"),'star'); print ''.$useringroup->lastname.''.$useringroup->firstname.'
'; + + $htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/'.$websitekey.''); + $htmltext.='
'; + $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); + $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); + + print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip'); + print '
'; + print ''; + print '
'; dol_fiche_end(); @@ -2356,7 +2396,6 @@ if ($action == 'createsite') if (GETPOST('WEBSITE_REF')) $siteref=GETPOST('WEBSITE_REF','alpha'); if (GETPOST('WEBSITE_DESCRIPTION')) $sitedesc=GETPOST('WEBSITE_DESCRIPTION','alpha'); - if (GETPOST('WEBSITE_VIRTUALHOST')) $sitevhost=GETPOST('WEBSITE_VIRTUALHOST','alpha'); print ''; print $langs->trans('Ref'); @@ -2371,14 +2410,15 @@ if ($action == 'createsite') print ''; print ''; + $htmltext = $langs->trans("SetHereVirtualHost", DOL_DATA_ROOT.'/website/websiteref'); $htmltext.='
'; $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("ReadPerm"), DOL_DOCUMENT_ROOT); $htmltext.='
'.$langs->trans("CheckVirtualHostPerms", $langs->transnoentitiesnoconv("WritePerm"), DOL_DATA_ROOT.'/website
'.DOL_DATA_ROOT.'/medias'); - print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'tooltipvirtual'); + print $form->textwithpicto($langs->trans('Virtualhost'), $htmltext, 1, 'help', '', 0, 2, 'virtualhosttooltip'); print ''; - print ''; + print ''; print ''; diff --git a/scripts/accountancy/export-thirdpartyaccount.php b/scripts/accountancy/export-thirdpartyaccount.php index e8468d64ece..90a072ebeba 100755 --- a/scripts/accountancy/export-thirdpartyaccount.php +++ b/scripts/accountancy/export-thirdpartyaccount.php @@ -1,7 +1,7 @@ #!/usr/bin/env php - * Copyright (C) 2013-2014 Alexandre Spangaro + * Copyright (C) 2013-2014 Alexandre Spangaro * Copyright (C) 2014 Florian Henry * Copyright (C) 2018 Frédéric France * diff --git a/scripts/contracts/email_expire_services_to_customers.php b/scripts/contracts/email_expire_services_to_customers.php index 43a0b2524e6..12a2fbd6c85 100755 --- a/scripts/contracts/email_expire_services_to_customers.php +++ b/scripts/contracts/email_expire_services_to_customers.php @@ -220,7 +220,7 @@ else * @param int $duration_value duration value * @return int <0 if KO, >0 if OK */ -function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget,$duration_value) +function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget, $duration_value) { global $conf,$langs; @@ -314,4 +314,3 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget,$durati return -1; } } - diff --git a/scripts/contracts/email_expire_services_to_representatives.php b/scripts/contracts/email_expire_services_to_representatives.php index a23652a779f..bfde9ab51c6 100755 --- a/scripts/contracts/email_expire_services_to_representatives.php +++ b/scripts/contracts/email_expire_services_to_representatives.php @@ -187,7 +187,7 @@ else * @param int $duration_value duration value * @return int <0 if KO, >0 if OK */ -function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresentative,$duration_value) +function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepresentative, $duration_value) { global $conf,$langs; @@ -280,4 +280,3 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta return -1; } } - diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 873fc0ae9fb..228f130dbb3 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -255,7 +255,7 @@ exit(0); * @param string $script_file filename * @return void */ -function usage($path,$script_file) +function usage($path, $script_file) { global $conf; diff --git a/scripts/invoices/email_unpaid_invoices_to_customers.php b/scripts/invoices/email_unpaid_invoices_to_customers.php index 57fdeeed76f..aa9214b9ec6 100755 --- a/scripts/invoices/email_unpaid_invoices_to_customers.php +++ b/scripts/invoices/email_unpaid_invoices_to_customers.php @@ -218,7 +218,7 @@ else * @param string $oldtarget Target name * @return int <0 if KO, >0 if OK */ -function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget) +function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldtarget) { global $conf,$langs; @@ -305,4 +305,3 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldtarget) return -1; } } - diff --git a/scripts/invoices/email_unpaid_invoices_to_representatives.php b/scripts/invoices/email_unpaid_invoices_to_representatives.php index 37b421bcefd..70d216750c5 100755 --- a/scripts/invoices/email_unpaid_invoices_to_representatives.php +++ b/scripts/invoices/email_unpaid_invoices_to_representatives.php @@ -192,7 +192,7 @@ else * @param string $oldsalerepresentative Old sale representative * @return int <0 if KO, >0 if OK */ -function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresentative) +function envoi_mail($mode, $oldemail, $message, $total, $userlang, $oldsalerepresentative) { global $conf,$langs; @@ -277,4 +277,3 @@ function envoi_mail($mode,$oldemail,$message,$total,$userlang,$oldsalerepresenta return -1; } } - diff --git a/scripts/members/sync_members_ldap2dolibarr.php b/scripts/members/sync_members_ldap2dolibarr.php index d7d4fbdeaaf..a82caf4cbe7 100755 --- a/scripts/members/sync_members_ldap2dolibarr.php +++ b/scripts/members/sync_members_ldap2dolibarr.php @@ -340,4 +340,3 @@ function dolValidElement($element) { return (trim($element) != ''); } - diff --git a/scripts/members/sync_members_types_ldap2dolibarr.php b/scripts/members/sync_members_types_ldap2dolibarr.php index cb85e38bd89..b9ded8436b7 100755 --- a/scripts/members/sync_members_types_ldap2dolibarr.php +++ b/scripts/members/sync_members_types_ldap2dolibarr.php @@ -216,4 +216,3 @@ function dolValidElementType($element) { return (trim($element) != ''); } - diff --git a/scripts/modulebuilder/initmodule.php b/scripts/modulebuilder/initmodule.php index bee931dc8fa..09daa1024d5 100755 --- a/scripts/modulebuilder/initmodule.php +++ b/scripts/modulebuilder/initmodule.php @@ -172,4 +172,3 @@ if (! $error) print 'Module initialized'."\n"; exit(0); - diff --git a/scripts/user/sync_groups_ldap2dolibarr.php b/scripts/user/sync_groups_ldap2dolibarr.php index 4063d2f9321..be65fbb2943 100755 --- a/scripts/user/sync_groups_ldap2dolibarr.php +++ b/scripts/user/sync_groups_ldap2dolibarr.php @@ -197,7 +197,7 @@ if ($result >= 0) if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { $fuser->fetch('','',$userKey[0]); // Chargement du user concerné par le SID - } else if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { + } elseif($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { $fuser->fetch('',$userKey[0]); // Chargement du user concerné par le login } @@ -263,4 +263,3 @@ function dolValidElement($element) { return (trim($element) != ''); } - diff --git a/scripts/user/sync_users_ldap2dolibarr.php b/scripts/user/sync_users_ldap2dolibarr.php index 320a1f495ad..30663f53518 100755 --- a/scripts/user/sync_users_ldap2dolibarr.php +++ b/scripts/user/sync_users_ldap2dolibarr.php @@ -195,7 +195,7 @@ if ($result >= 0) if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_SID) { $fuser->fetch('','',$ldapuser[$conf->global->LDAP_KEY_USERS]); // Chargement du user concerné par le SID - } else if($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { + } elseif($conf->global->LDAP_KEY_USERS == $conf->global->LDAP_FIELD_LOGIN) { $fuser->fetch('',$ldapuser[$conf->global->LDAP_KEY_USERS]); // Chargement du user concerné par le login } @@ -319,4 +319,3 @@ function dolValidElement($element) { return (trim($element) != ''); } - diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index 07d728eb0ec..432c3556ff0 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -171,7 +171,7 @@ class FactureRecTest extends PHPUnit_Framework_TestCase * @param array $fieldstoignorearray Array of fields to ignore in diff * @return array Array with differences */ - public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + public function objCompare($oA, $oB, $ignoretype = true, $fieldstoignorearray = array('id')) { $retAr=array(); diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index cb23c7d092e..abf1f286a90 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -349,7 +349,7 @@ class FactureTest extends PHPUnit_Framework_TestCase * @param array $fieldstoignorearray Array of fields to ignore in diff * @return array Array with differences */ - public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + public function objCompare($oA, $oB, $ignoretype = true, $fieldstoignorearray = array('id')) { $retAr=array(); diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 9b8e5217183..58e08affb69 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -321,7 +321,7 @@ class UserTest extends PHPUnit_Framework_TestCase * @param array $fieldstoignorearray Array of fields to ignore in diff * @return array Array with differences */ - public function objCompare($oA,$oB,$ignoretype=true,$fieldstoignorearray=array('id')) + public function objCompare($oA, $oB, $ignoretype = true, $fieldstoignorearray = array('id')) { $retAr=array();