From 43dcd9beb51781717595ae5db746a01792b62767 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 00:02:33 +0200 Subject: [PATCH 01/28] add new rule --- dev/setup/codesniffer/ruleset.xml | 25 +- htdocs/accountancy/admin/account.php | 6 +- htdocs/accountancy/admin/accountmodel.php | 18 +- htdocs/accountancy/admin/card.php | 12 +- htdocs/accountancy/admin/categories_list.php | 26 +- htdocs/accountancy/admin/journals_list.php | 12 +- htdocs/accountancy/admin/productaccount.php | 4 +- htdocs/accountancy/bookkeeping/card.php | 9 +- htdocs/accountancy/bookkeeping/list.php | 30 +-- .../accountancy/bookkeeping/listbyaccount.php | 18 +- .../class/accountancycategory.class.php | 21 +- .../class/accountancyexport.class.php | 33 ++- .../class/accountingjournal.class.php | 3 +- .../accountancy/class/bookkeeping.class.php | 3 +- htdocs/accountancy/closure/index.php | 3 +- htdocs/accountancy/closure/validate.php | 3 +- htdocs/accountancy/customer/card.php | 3 +- htdocs/accountancy/customer/index.php | 3 +- htdocs/accountancy/customer/list.php | 3 +- htdocs/accountancy/expensereport/card.php | 3 +- htdocs/accountancy/expensereport/index.php | 3 +- htdocs/accountancy/expensereport/list.php | 3 +- htdocs/accountancy/index.php | 3 +- htdocs/accountancy/journal/bankjournal.php | 33 +-- .../journal/expensereportsjournal.php | 15 +- .../accountancy/journal/purchasesjournal.php | 21 +- htdocs/accountancy/journal/sellsjournal.php | 24 +- htdocs/accountancy/supplier/card.php | 3 +- htdocs/accountancy/supplier/index.php | 3 +- htdocs/accountancy/supplier/list.php | 3 +- htdocs/accountancy/tpl/export_journal.tpl.php | 3 +- htdocs/adherents/type.php | 36 +-- htdocs/adherents/type_ldap.php | 9 +- htdocs/adherents/type_translation.php | 15 +- .../datapolicy/class/datapolicycron.class.php | 6 +- htdocs/modulebuilder/admin/setup.php | 4 +- htdocs/modulebuilder/index.php | 239 ++++++------------ htdocs/modulebuilder/template/admin/setup.php | 6 +- .../template/class/actions_mymodule.class.php | 5 +- .../template/class/api_mymodule.class.php | 6 +- .../template/class/myobject.class.php | 18 +- .../mailinglist_mymodule_myobject.modules.php | 3 +- .../doc/doc_generic_myobject_odt.modules.php | 39 ++- .../mymodule/mod_myobject_standard.php | 3 +- .../template/myobject_agenda.php | 11 +- .../modulebuilder/template/myobject_card.php | 9 +- .../template/myobject_document.php | 4 +- .../modulebuilder/template/myobject_list.php | 4 +- .../template/scripts/mymodule.php | 3 +- test/phpunit/CodingPhpTest.php | 16 +- test/phpunit/CodingSqlTest.php | 10 +- test/phpunit/ExportTest.php | 4 +- test/phpunit/FactureRecTest.php | 5 +- test/phpunit/FactureTest.php | 5 +- test/phpunit/LangTest.php | 2 +- test/phpunit/ModulesTest.php | 2 +- test/phpunit/UserTest.php | 2 +- test/phpunit/WebservicesInvoicesTest.php | 7 +- test/phpunit/WebservicesOrdersTest.php | 2 +- test/phpunit/WebservicesOtherTest.php | 4 +- test/phpunit/WebservicesProductsTest.php | 6 +- test/phpunit/WebservicesThirdpartyTest.php | 8 +- test/phpunit/WebservicesUserTest.php | 4 +- 63 files changed, 315 insertions(+), 534 deletions(-) diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index e726df6db7c..a6a915094e2 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -27,7 +27,7 @@ - + @@ -101,7 +101,7 @@ - --> + --> 0 @@ -117,7 +117,7 @@ --> - + @@ -188,8 +188,8 @@ - @@ -213,6 +213,9 @@ + + + @@ -309,16 +312,16 @@ 0 - + 0 - + 0 - + 0 @@ -332,7 +335,7 @@ 0 - + 0 @@ -385,7 +388,7 @@ - + 0 @@ -426,5 +429,5 @@ - + diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index cf00519e9d7..d131e228f44 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -144,8 +144,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ChartLoaded"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings'); } } @@ -432,8 +431,7 @@ if ($resql) print "\n"; if (!$i) $totalarray['nbfield']++; } - else - { + else { print ' '; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index b31cd23dfa4..66f1e3c0fa3 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -246,8 +246,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } @@ -319,8 +318,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } - else - { + else { dol_print_error($db); } } @@ -582,8 +580,7 @@ if ($id) print $form->select_country($search_country_id, 'search_country_id', '', 28, 'maxwidth200 maxwidthonsmartphone'); print ''; } - else - { + else { print ''; } } @@ -630,8 +627,7 @@ if ($id) print ' '; print ' '; } - else - { + else { $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -665,8 +661,7 @@ if ($id) { $valuetoshow = '-'; } - else - { + else { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } @@ -785,8 +780,7 @@ function fieldListAccountModel($fieldlist, $obj = '', $tabname = '', $context = elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; } - else - { + else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $size = 'size="8" '; diff --git a/htdocs/accountancy/admin/card.php b/htdocs/accountancy/admin/card.php index 708165fc757..0fc2f9001a1 100644 --- a/htdocs/accountancy/admin/card.php +++ b/htdocs/accountancy/admin/card.php @@ -76,8 +76,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { $account_number = GETPOST('account_number', 'string'); } - else - { + else { $account_number = clean_account(GETPOST('account_number', 'string')); } @@ -85,8 +84,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { $account_parent = 0; } - else - { + else { $account_parent = GETPOST('account_parent', 'int'); } @@ -141,8 +139,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { $account_number = GETPOST('account_number', 'string'); } - else - { + else { $account_number = clean_account(GETPOST('account_number', 'string')); } @@ -150,8 +147,7 @@ if ($action == 'add' && $user->rights->accounting->chartofaccount) { $account_parent = 0; } - else - { + else { $account_parent = GETPOST('account_parent', 'int'); } diff --git a/htdocs/accountancy/admin/categories_list.php b/htdocs/accountancy/admin/categories_list.php index 1b2733e2045..04c8cbce12a 100644 --- a/htdocs/accountancy/admin/categories_list.php +++ b/htdocs/accountancy/admin/categories_list.php @@ -236,8 +236,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } @@ -309,8 +308,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } - else - { + else { dol_print_error($db); } } @@ -598,8 +596,7 @@ if ($id) print ''; $filterfound++; } - else - { + else { print ''; } } @@ -727,9 +724,8 @@ if ($id) print ''; print ''; } - else - { - $tmpaction = 'view'; + else { + $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -754,8 +750,7 @@ if ($id) { $valuetoshow = '-'; } - else - { + else { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } @@ -799,8 +794,7 @@ if ($id) // Active print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; - else - { + else { print $langs->trans("AlwaysActive"); } print ""; @@ -883,8 +877,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co $fieldname = 'country_id'; print $form->select_country(GETPOST('country_id', 'int'), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); } - else - { + else { print $form->select_country((!empty($obj->country_code) ? $obj->country_code : (!empty($obj->country) ? $obj->country : $mysoc->country_code)), $fieldname, '', 28, 'maxwidth200 maxwidthonsmartphone'); } print ''; @@ -907,8 +900,7 @@ function fieldListAccountingCategories($fieldlist, $obj = '', $tabname = '', $co elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; } - else - { + else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; diff --git a/htdocs/accountancy/admin/journals_list.php b/htdocs/accountancy/admin/journals_list.php index e34ce8094dd..93942946b26 100644 --- a/htdocs/accountancy/admin/journals_list.php +++ b/htdocs/accountancy/admin/journals_list.php @@ -239,8 +239,7 @@ if (GETPOST('actionadd', 'alpha') || GETPOST('actionmodify', 'alpha')) setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } @@ -314,8 +313,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } - else - { + else { dol_print_error($db); } } @@ -596,8 +594,7 @@ if ($id) print '
'; print ''; } - else - { + else { $tmpaction = 'view'; $parameters = array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -728,8 +725,7 @@ function fieldListJournal($fieldlist, $obj = '', $tabname = '', $context = '') elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; } - else - { + else { print ''; $size = ''; $class = ''; if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index e32e47b169d..6006e97b8da 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -268,9 +268,7 @@ elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL') elseif ($accounting_product_mode == 'ACCOUNTANCY_SELL_INTRA') { $sql .= " p.accountancy_code_sell_intra = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; -} -else -{ +} else { $sql .= " p.accountancy_code_sell_export = aa.account_number AND aa.fk_pcg_version = '".$pcgvercode."'"; } $sql .= ' WHERE p.entity IN ('.getEntity('product').')'; diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index f8fa0774400..8ab554c08e7 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -629,8 +629,7 @@ if ($action == 'create') { print $formaccounting->select_auxaccount((GETPOSTISSET("subledger_account") ? GETPOST("subledger_account", "alpha") : $line->subledger_account), 'subledger_account', 1); } - else - { + else { print 'subledger_account).'">'; } print ''; @@ -686,8 +685,7 @@ if ($action == 'create') { print $formaccounting->select_auxaccount('', 'subledger_account', 1); } - else - { + else { print ''; } print ''; @@ -708,8 +706,7 @@ if ($action == 'create') { print ''.$langs->trans("ValidTransaction").''; } - else - { + else { print ''; } diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 2889fbf4ef1..87808e95500 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -352,8 +352,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { setEventMessages("RecordDeleted", null, 'mesgs'); } @@ -361,8 +360,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme header("Location: list.php".($param ? '?'.$param : '')); exit; } - else - { + else { setEventMessages("NoRecordDeleted", null, 'warnings'); } } @@ -374,8 +372,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } @@ -481,8 +478,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { // Export files $accountancyexport = new AccountancyExport($db); $accountancyexport->export($object->lines, $formatexportset); @@ -491,8 +487,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { { setEventMessages('', $accountancyexport->errors, 'errors'); } - else - { + else { // Specify as export : update field date_export $error = 0; $db->begin(); @@ -522,8 +517,7 @@ if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { $db->commit(); // setEventMessages($langs->trans("AllExportedMovementsWereRecordedAsExported"), null, 'mesgs'); } - else - { + else { $error++; $db->rollback(); setEventMessages($langs->trans("NotAllExportedMovementsCouldBeRecordedAsExported"), null, 'errors'); @@ -560,8 +554,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; } -else -{ +else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -722,8 +715,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_start, 'search_accountancy_aux_code_start', 1); } - else - { + else { print ''; } print ''; @@ -735,8 +727,7 @@ if (!empty($arrayfields['t.subledger_account']['checked'])) { print $formaccounting->select_auxaccount($search_accountancy_aux_code_end, 'search_accountancy_aux_code_end', 1); } - else - { + else { print ''; } print ''; @@ -958,8 +949,7 @@ while ($i < min($num, $limit)) $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); } - else - { + else { // Other type } diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index 25f664d955e..a2b456b52b3 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -255,8 +255,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { setEventMessages("RecordDeleted", null, 'mesgs'); } @@ -264,8 +263,7 @@ if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouveme header("Location: listbyaccount.php".($param ? '?'.$param : '')); exit; } - else - { + else { setEventMessages("NoRecordDeleted", null, 'warnings'); } } @@ -277,8 +275,7 @@ if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->suppri if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } @@ -538,8 +535,7 @@ while ($i < min($num, $limit)) print ''; print ''; } - else - { + else { print ''; print ''; print price($sous_total_credit - $sous_total_debit); @@ -640,8 +636,7 @@ while ($i < min($num, $limit)) $urlsource = $_SERVER['PHP_SELF'].'?id='.$objectstatic->id; $documentlink = $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); } - else - { + else { // Other type } @@ -743,8 +738,7 @@ if ($balance > 0 ) print ''; print ''; } -else -{ +else { print ''; print ''; print price($sous_total_credit - $sous_total_debit); diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index cc93232dcdc..0150e1d155d 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -210,8 +210,7 @@ class AccountancyCategory // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -241,8 +240,7 @@ class AccountancyCategory // extends CommonObject $sql .= " t.active"; $sql .= " FROM ".MAIN_DB_PREFIX."c_accounting_category as t"; if ($id) $sql .= " WHERE t.rowid = ".$id; - else - { + else { $sql .= " WHERE t.entity IN (".getEntity('c_accounting_category').")"; // Dont't use entity if you use rowid if ($code) $sql .= " AND t.code = '".$this->db->escape($code)."'"; elseif ($label) $sql .= " AND t.label = '".$this->db->escape($label)."'"; @@ -271,8 +269,7 @@ class AccountancyCategory // extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -336,8 +333,7 @@ class AccountancyCategory // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -376,8 +372,7 @@ class AccountancyCategory // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -710,8 +705,7 @@ class AccountancyCategory // extends CommonObject } $sql .= " AND t.numero_compte IN (".$listofaccount.")"; } - else - { + else { $sql .= " AND t.numero_compte = '".$this->db->escape($cpt)."'"; } if (!empty($date_start) && !empty($date_end) && (empty($month) || empty($year))) // If month/year provided, it is stronger than filter date_start/date_end @@ -834,8 +828,7 @@ class AccountancyCategory // extends CommonObject $sql .= " AND t.entity = ".$conf->entity; $sql .= " ORDER BY t.account_number"; } - else - { + else { $sql = "SELECT t.rowid, t.account_number, t.label as account_label"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_account as t"; $sql .= " WHERE ".$predefinedgroupwhere; diff --git a/htdocs/accountancy/class/accountancyexport.class.php b/htdocs/accountancy/class/accountancyexport.class.php index 3bf41e6326f..33c2537f600 100644 --- a/htdocs/accountancy/class/accountancyexport.class.php +++ b/htdocs/accountancy/class/accountancyexport.class.php @@ -518,11 +518,12 @@ class AccountancyExport $Tab['contrepartie'] = str_repeat(' ', 8); // elarifr: date format must be fixed format : 6 char ddmmyy = %d%m%yand not defined by user / dolibarr setting - if (!empty($data->date_echeance)) + if (!empty($data->date_echeance)) { //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%y'); // elarifr: format must be ddmmyy - else + } else { $Tab['date_echeance'] = '000000'; + } //elarifr please keep quadra named field lettrage(2) + codestat(3) instead of fake lettrage(5) //$Tab['lettrage'] = str_repeat(' ', 5); @@ -597,12 +598,12 @@ class AccountancyExport $Tab['num_compte'] = str_pad(self::trunc($code_compta, 6), 6, '0'); - if($data->sens == 'D'){ + if ($data->sens == 'D') { $Tab['montant_debit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); } - else{ + else { $Tab['montant_debit'] = str_pad(number_format(0, 2, ',', ''), 13, ' ', STR_PAD_LEFT); $Tab['montant_crebit'] = str_pad(number_format(abs($data->montant), 2, ',', ''), 13, ' ', STR_PAD_LEFT); @@ -616,11 +617,12 @@ class AccountancyExport $Tab['code_stat'] = str_repeat(' ', 4); - if (!empty($data->date_echeance)) + if (!empty($data->date_echeance)) { //$Tab['date_echeance'] = dol_print_date($data->date_echeance, $conf->global->ACCOUNTING_EXPORT_DATE); $Tab['date_echeance'] = dol_print_date($data->date_echeance, '%d%m%Y'); - else + } else { $Tab['date_echeance'] = dol_print_date($data->doc_date, '%d%m%Y'); + } $Tab['monnaie'] = '1'; @@ -925,8 +927,7 @@ class AccountancyExport { print 'S'.$this->separator; } - else - { + else { print 'H'.$this->separator; } //Grp @@ -938,13 +939,11 @@ class AccountancyExport { print length_accounta($thisPieceAccountNr).$this->separator; } - else - { + else { print "div".$this->separator; } } - else - { + else { print length_accounta($line->code_tiers).$this->separator; } //SId @@ -961,8 +960,7 @@ class AccountancyExport { print "2".$this->separator; } - else - { + else { print "1".$this->separator; } // Code @@ -972,8 +970,7 @@ class AccountancyExport { print $line->montant.$this->separator; } - else - { + else { print ($line->montant * -1).$this->separator; } // Steuer @@ -1458,7 +1455,9 @@ class AccountancyExport print self::trunc($line->code_journal, 6).$separator; //Journal code if (!empty($line->subledger_account)) $account = $line->subledger_account; - else $account = $line->numero_compte; + else { + $account = $line->numero_compte; + } print self::trunc($account, 15).$separator; //Account number print self::trunc($line->label_compte, 60).$separator; //Account label diff --git a/htdocs/accountancy/class/accountingjournal.class.php b/htdocs/accountancy/class/accountingjournal.class.php index 727e68346fa..7b78cbca84b 100644 --- a/htdocs/accountancy/class/accountingjournal.class.php +++ b/htdocs/accountancy/class/accountingjournal.class.php @@ -137,8 +137,7 @@ class AccountingJournal extends CommonObject return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); $this->errors[] = "Error ".$this->db->lasterror(); } diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index 0162a98394e..2f197d7919f 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -259,8 +259,7 @@ class BookKeeping extends CommonObject { $this->errors[] = $langs->trans('ErrorFieldAccountNotDefinedForBankLine', $this->fk_docdet, $this->doc_type); } - else - { + else { //$this->errors[]=$langs->trans('ErrorFieldAccountNotDefinedForInvoiceLine', $this->doc_ref, $this->label_compte); $mesg = $this->doc_ref.', '.$langs->trans("AccountAccounting").': '.$this->numero_compte; if ($this->subledger_account && $this->subledger_account != $this->numero_compte) diff --git a/htdocs/accountancy/closure/index.php b/htdocs/accountancy/closure/index.php index 39ed325b5fe..ed8fc8ecc7e 100644 --- a/htdocs/accountancy/closure/index.php +++ b/htdocs/accountancy/closure/index.php @@ -42,8 +42,7 @@ if (!$user->rights->accounting->fiscalyear->write) $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); -else -{ +else { $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/closure/validate.php b/htdocs/accountancy/closure/validate.php index fe7fda5054f..808ccfba0ef 100644 --- a/htdocs/accountancy/closure/validate.php +++ b/htdocs/accountancy/closure/validate.php @@ -42,8 +42,7 @@ if ($user->socid > 0) $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); -else -{ +else { $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/customer/card.php b/htdocs/accountancy/customer/card.php index 0a39fbc8254..7c184cced45 100644 --- a/htdocs/accountancy/customer/card.php +++ b/htdocs/accountancy/customer/card.php @@ -60,8 +60,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/customer/index.php b/htdocs/accountancy/customer/index.php index eff348816fb..c2ba41d7368 100644 --- a/htdocs/accountancy/customer/index.php +++ b/htdocs/accountancy/customer/index.php @@ -47,8 +47,7 @@ if (!$user->rights->accounting->bind->write) $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); -else -{ +else { $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 1d93a0fea17..4e551fef9e8 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -160,8 +160,7 @@ if ($massaction == 'ventil') { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } - else - { + else { $sql = " UPDATE ".MAIN_DB_PREFIX."facturedet"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; diff --git a/htdocs/accountancy/expensereport/card.php b/htdocs/accountancy/expensereport/card.php index 36d587e0c99..acea87f95a6 100644 --- a/htdocs/accountancy/expensereport/card.php +++ b/htdocs/accountancy/expensereport/card.php @@ -64,8 +64,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/expensereport/index.php b/htdocs/accountancy/expensereport/index.php index 387cfd0fb8e..9573cbfc257 100644 --- a/htdocs/accountancy/expensereport/index.php +++ b/htdocs/accountancy/expensereport/index.php @@ -43,8 +43,7 @@ if (!$user->rights->accounting->bind->write) $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); -else -{ +else { $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 96eebd49b36..706bd41f2b0 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -139,8 +139,7 @@ if ($massaction == 'ventil') { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } - else - { + else { $sql = " UPDATE ".MAIN_DB_PREFIX."expensereport_det"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; diff --git a/htdocs/accountancy/index.php b/htdocs/accountancy/index.php index 56cf674505b..2fbbfe4b104 100644 --- a/htdocs/accountancy/index.php +++ b/htdocs/accountancy/index.php @@ -241,8 +241,7 @@ if ($conf->accounting->enabled) print ''; } -else -{ +else { print load_fiche_titre($langs->trans("AccountancyArea"), '', 'accountancy'); print $langs->trans("Module10Desc")."
\n"; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 3372105cd85..96fa45bcfd1 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -550,8 +550,7 @@ if (!$error && $action == 'writebookkeeping') { $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -576,8 +575,7 @@ if (!$error && $action == 'writebookkeeping') { { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); } - else - { + else { $reflabel .= dol_string_nohtmltag($val['soclib']); } @@ -700,8 +698,7 @@ if (!$error && $action == 'writebookkeeping') { $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -748,8 +745,7 @@ if (!$error && $action == 'writebookkeeping') { $errorforline++; setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -771,8 +767,7 @@ if (!$error && $action == 'writebookkeeping') { { $db->commit(); } - else - { + else { //print 'KO for line '.$key.' '.$error.'
'; $db->rollback(); @@ -792,8 +787,7 @@ if (!$error && $action == 'writebookkeeping') { { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); } - else - { + else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -880,8 +874,7 @@ if ($action == 'exportcsv') { // ISO and not UTF8 ! { $reflabel .= dol_string_nohtmltag($langs->transnoentitiesnoconv('TransitionalAccount').' '.$account_transfer); } - else - { + else { $reflabel .= dol_string_nohtmltag($val['soclib']); } @@ -1105,8 +1098,7 @@ if (empty($action) || $action == 'view') { { $reflabel .= $langs->trans('TransitionalAccount').' '.$account_transfer; } - else - { + else { $reflabel .= $val['soclib']; } @@ -1135,13 +1127,11 @@ if (empty($action) || $action == 'view') { { print ''.$langs->trans('UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking').''; } - else - { + else { print ''.$langs->trans('UnknownAccountForThirdparty', length_accountg($conf->global->ACCOUNTING_ACCOUNT_SUSPENSE)).''; // We will use a waiting account } } - else - { + else { // We will refuse writing $errorstring = 'UnknownAccountForThirdpartyBlocking'; if ($tabtype[$key] == 'payment') $errorstring = 'MainAccountForCustomersNotDefined'; @@ -1178,8 +1168,7 @@ if (empty($action) || $action == 'view') { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknown", $tabcompany[$key]['code_compta']).''; } } - else - { + else { print ''.$langs->trans("ThirdpartyAccountNotDefinedOrThirdPartyUnknownBlocking").''; } } diff --git a/htdocs/accountancy/journal/expensereportsjournal.php b/htdocs/accountancy/journal/expensereportsjournal.php index 4be0b133143..6ed33f56ef1 100644 --- a/htdocs/accountancy/journal/expensereportsjournal.php +++ b/htdocs/accountancy/journal/expensereportsjournal.php @@ -232,8 +232,7 @@ if ($action == 'writebookkeeping') { $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -282,8 +281,7 @@ if ($action == 'writebookkeeping') { $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -342,8 +340,7 @@ if ($action == 'writebookkeeping') { $errorforline++; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; setEventMessages($bookkeeping->error, $bookkeeping->errors, 'errors'); @@ -366,8 +363,7 @@ if ($action == 'writebookkeeping') { { $db->commit(); } - else - { + else { $db->rollback(); if ($error >= 10) @@ -387,8 +383,7 @@ if ($action == 'writebookkeeping') { { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); } - else - { + else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } diff --git a/htdocs/accountancy/journal/purchasesjournal.php b/htdocs/accountancy/journal/purchasesjournal.php index 42bff74097f..c7cff6443ca 100644 --- a/htdocs/accountancy/journal/purchasesjournal.php +++ b/htdocs/accountancy/journal/purchasesjournal.php @@ -152,8 +152,9 @@ if ($result) { if (empty($compta_prod)) { if ($obj->product_type == 0) $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT : 'NotDefined'; - else + else { $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT : 'NotDefined'; + } } $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); @@ -332,8 +333,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -384,8 +384,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -447,8 +446,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -500,8 +498,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -525,8 +522,7 @@ if ($action == 'writebookkeeping') { { $db->commit(); } - else - { + else { $db->rollback(); if ($error >= 10) @@ -546,8 +542,7 @@ if ($action == 'writebookkeeping') { { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); } - else - { + else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } diff --git a/htdocs/accountancy/journal/sellsjournal.php b/htdocs/accountancy/journal/sellsjournal.php index c3c9f45ed5a..9bfa10dd3f1 100644 --- a/htdocs/accountancy/journal/sellsjournal.php +++ b/htdocs/accountancy/journal/sellsjournal.php @@ -158,8 +158,9 @@ if ($result) { if (empty($compta_prod)) { if ($obj->product_type == 0) $compta_prod = (!empty($conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_PRODUCT_SOLD_ACCOUNT : 'NotDefined'; - else + else { $compta_prod = (!empty($conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT)) ? $conf->global->ACCOUNTING_SERVICE_SOLD_ACCOUNT : 'NotDefined'; + } } $vatdata = getTaxesFromId($obj->tva_tx.($obj->vat_src_code ? ' ('.$obj->vat_src_code.')' : ''), $mysoc, $mysoc, 0); @@ -343,8 +344,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -395,8 +395,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -457,8 +456,7 @@ if ($action == 'writebookkeeping') { $errorforinvoice[$key] = 'alreadyjournalized'; //setEventMessages('Transaction for ('.$bookkeeping->doc_type.', '.$bookkeeping->fk_doc.', '.$bookkeeping->fk_docdet.') were already recorded', null, 'warnings'); } - else - { + else { $error++; $errorforline++; $errorforinvoice[$key] = 'other'; @@ -483,8 +481,7 @@ if ($action == 'writebookkeeping') { { $db->commit(); } - else - { + else { $db->rollback(); if ($error >= 10) @@ -500,12 +497,10 @@ if ($action == 'writebookkeeping') { if (empty($error) && count($tabpay) > 0) { setEventMessages($langs->trans("GeneralLedgerIsWritten"), null, 'mesgs'); } - elseif (count($tabpay) == $error) - { + elseif (count($tabpay) == $error) { setEventMessages($langs->trans("NoNewRecordSaved"), null, 'warnings'); } - else - { + else { setEventMessages($langs->trans("GeneralLedgerSomeRecordWasNotRecorded"), null, 'warnings'); } @@ -659,8 +654,9 @@ if (empty($action) || $action == 'view') { $description .= $langs->trans("DescJournalOnlyBindedVisible").'
'; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else + else { $description .= $langs->trans("DepositsAreIncluded"); + } $listofchoices = array('notyet'=>$langs->trans("NotYetInGeneralLedger"), 'already'=>$langs->trans("AlreadyInGeneralLedger")); $period = $form->selectDate($date_start ? $date_start : -1, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end ? $date_end : -1, 'date_end', 0, 0, 0, '', 1, 0); diff --git a/htdocs/accountancy/supplier/card.php b/htdocs/accountancy/supplier/card.php index 6140f90fe8d..b8d32e690a1 100644 --- a/htdocs/accountancy/supplier/card.php +++ b/htdocs/accountancy/supplier/card.php @@ -64,8 +64,7 @@ if ($action == 'ventil' && $user->rights->accounting->bind->write) if (!$resql) { setEventMessages($db->lasterror(), null, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); if ($backtopage) { diff --git a/htdocs/accountancy/supplier/index.php b/htdocs/accountancy/supplier/index.php index 07877378ce1..9cd2b0c61e4 100644 --- a/htdocs/accountancy/supplier/index.php +++ b/htdocs/accountancy/supplier/index.php @@ -45,8 +45,7 @@ if (!$user->rights->accounting->bind->write) $month_start = ($conf->global->SOCIETE_FISCAL_MONTH_START ? ($conf->global->SOCIETE_FISCAL_MONTH_START) : 1); if (GETPOST("year", 'int')) $year_start = GETPOST("year", 'int'); -else -{ +else { $year_start = dol_print_date(dol_now(), '%Y'); if (dol_print_date(dol_now(), '%m') < $month_start) $year_start--; // If current month is lower that starting fiscal month, we start last year } diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 6ef942bea89..2c7110bf65d 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -164,8 +164,7 @@ if ($massaction == 'ventil') { $msg .= '
'.$langs->trans("Lineofinvoice").' '.$monId.' - '.$langs->trans("NoAccountSelected").'
'; $ko++; } - else - { + else { $sql = " UPDATE ".MAIN_DB_PREFIX."facture_fourn_det"; $sql .= " SET fk_code_ventilation = ".$monCompte; $sql .= " WHERE rowid = ".$monId; diff --git a/htdocs/accountancy/tpl/export_journal.tpl.php b/htdocs/accountancy/tpl/export_journal.tpl.php index fb957db2233..a6addb536a2 100644 --- a/htdocs/accountancy/tpl/export_journal.tpl.php +++ b/htdocs/accountancy/tpl/export_journal.tpl.php @@ -59,8 +59,7 @@ if ($accountancyexport->getFormatCode($formatexportset) == $accountancyexport::$ $completefilename = $siren."FEC".$endaccountingperiod.".txt"; } -else -{ +else { $completefilename = ($code ? $code."_" : "").($prefix ? $prefix."_" : "").$filename.($nodateexport ? "" : $date_export).".".$format; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index c190398c1db..5f89f06b22f 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -146,14 +146,12 @@ if ($action == 'add' && $user->rights->adherent->configurer) { header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } - else - { + else { $action = 'create'; } } @@ -184,8 +182,7 @@ if ($action == 'update' && $user->rights->adherent->configurer) { setEventMessages($langs->trans("MemberTypeModified"), null, 'mesgs'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -204,8 +201,7 @@ if ($action == 'confirm_delete' && $user->rights->adherent->configurer) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages($langs->trans("MemberTypeCanNotBeDeleted"), null, 'errors'); $action = ''; } @@ -244,8 +240,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; $newcardbutton = ''; - if ($user->rights->adherent->configurer) - { + if ($user->rights->adherent->configurer) { $newcardbutton .= dolGetButtonTitle($langs->trans('NewMemberType'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/adherents/type.php?action=create'); } @@ -300,8 +295,9 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''.$membertype->getLibStatut(5).''; if ($user->rights->adherent->configurer) print 'rowid.'">'.img_edit().''; - else + else { print ' '; + } print ""; $i++; } @@ -310,8 +306,7 @@ if (!$rowid && $action != 'create' && $action != 'edit') print ''; } - else - { + else { dol_print_error($db); } } @@ -665,8 +660,7 @@ if ($rowid > 0) { print ''.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 20).' / '.dol_trunc($objp->societe, 12).''."\n"; } - else - { + else { print ''.img_object($langs->trans("ShowMember"), "user").' '.$adh->getFullName($langs, 0, -1, 32).''."\n"; } @@ -700,22 +694,19 @@ if ($rowid > 0) { print dol_print_date($datefin, 'day')." ".img_warning($langs->trans("SubscriptionLate")); } - else - { + else { print dol_print_date($datefin, 'day'); } print ''; } - else - { + else { print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); } - else - { + else { print ' '; } print ''; @@ -747,8 +738,7 @@ if ($rowid > 0) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, ''); } } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/adherents/type_ldap.php b/htdocs/adherents/type_ldap.php index bfb81e8d5c4..9e52f05739e 100644 --- a/htdocs/adherents/type_ldap.php +++ b/htdocs/adherents/type_ldap.php @@ -167,21 +167,18 @@ if ($result > 0) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; } - else - { + else { $result = show_ldap_content($records, 0, $records['count'], true); } } - else - { + else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } $ldap->unbind(); $ldap->close(); } -else -{ +else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/adherents/type_translation.php b/htdocs/adherents/type_translation.php index 4c68b82784f..0e81240a020 100644 --- a/htdocs/adherents/type_translation.php +++ b/htdocs/adherents/type_translation.php @@ -77,8 +77,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad $object->description = dol_htmlcleanlastbr($_POST["desc"]); $object->other = dol_htmlcleanlastbr($_POST["other"]); } - else - { + else { $object->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"]; $object->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); $object->multilangs[$_POST["forcelangprod"]]["other"] = dol_htmlcleanlastbr($_POST["other"]); @@ -89,8 +88,7 @@ if ($action == 'vadd' && $cancel != $langs->trans("Cancel") && $user->rights->ad { $action = ''; } - else - { + else { $action = 'add'; setEventMessages($object->error, $object->errors, 'errors'); } @@ -111,8 +109,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a $object->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->other = dol_htmlcleanlastbr($_POST["other-".$key]); } - else - { + else { $object->multilangs[$key]["label"] = $_POST["libelle-".$key]; $object->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); $object->multilangs[$key]["other"] = dol_htmlcleanlastbr($_POST["other-".$key]); @@ -123,8 +120,7 @@ if ($action == 'vedit' && $cancel != $langs->trans("Cancel") && $user->rights->a { $action = ''; } - else - { + else { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); } @@ -142,8 +138,7 @@ if ($action == 'vdelete' && $cancel != $langs->trans("Cancel") && $user->rights- { $action = ''; } - else - { + else { $action = 'edit'; setEventMessages($object->error, $object->errors, 'errors'); } diff --git a/htdocs/datapolicy/class/datapolicycron.class.php b/htdocs/datapolicy/class/datapolicycron.class.php index 409df1362e9..ba93638455e 100644 --- a/htdocs/datapolicy/class/datapolicycron.class.php +++ b/htdocs/datapolicy/class/datapolicycron.class.php @@ -506,8 +506,7 @@ class DataPolicyCron } } } - else - { + else { $errormsg = $object->error; $error++; } @@ -539,8 +538,7 @@ class DataPolicyCron { $this->output = $nbupdated.' record updated, '.$nbdeleted.' record deleted'; } - else - { + else { $this->error = $errormsg; } diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index db30c32607f..45f6dd91b66 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -48,9 +48,7 @@ if ($action == "update") if ($res1 < 0 || $res2 < 0 || $res3 < 0 || $res4 < 0 || $res5 < 0 || $res6 < 0 || $res7 < 0 || $res8 < 0) { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); - } - else - { + } else { setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); $db->commit(); } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index d813c3b291b..02bd9c387b4 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -129,8 +129,8 @@ if ($dirins && $action == 'initmodule' && $modulename) $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCopyDir", $srcdir, $destdir), null, 'errors'); } - else // $result == 0 - { + else { + // $result == 0 setEventMessages($langs->trans("AllFilesDidAlreadyExist", $srcdir, $destdir), null, 'warnings'); } } @@ -271,8 +271,7 @@ if ($dirins && $action == 'initapi' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -308,14 +307,12 @@ if ($dirins && $action == 'initphpunit' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } } -if ($dirins && $action == 'initsqlextrafields' && !empty($module)) -{ +if ($dirins && $action == 'initsqlextrafields' && !empty($module)) { $modulename = ucfirst($module); // Force first letter in uppercase $objectname = $tabobj; @@ -354,8 +351,7 @@ if ($dirins && $action == 'initsqlextrafields' && !empty($module)) dolReplaceInFile($destfile1, $arrayreplacement); dolReplaceInFile($destfile2, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', ''), null, 'errors'); } @@ -389,8 +385,7 @@ if ($dirins && $action == 'inithook' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -423,8 +418,7 @@ if ($dirins && $action == 'inittrigger' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -438,8 +432,7 @@ if ($dirins && $action == 'initwidget' && !empty($module)) //var_dump($srcfile);var_dump($destfile); $result = dol_copy($srcfile, $destfile, 0, 0); - if ($result > 0) - { + if ($result > 0) { $modulename = ucfirst($module); // Force first letter in uppercase //var_dump($phpfileval['fullname']); @@ -456,9 +449,7 @@ if ($dirins && $action == 'initwidget' && !empty($module)) ); dolReplaceInFile($destfile, $arrayreplacement); - } - else - { + } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -496,8 +487,7 @@ if ($dirins && $action == 'initcss' && !empty($module)) $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/css/'.strtolower($module).'.css.php', '/').'\'/' => '\'/'.strtolower($module).'/css/'.strtolower($module).'.css.php\''); dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -535,8 +525,7 @@ if ($dirins && $action == 'initjs' && !empty($module)) $arrayreplacement = array('/\/\/\s*\''.preg_quote('/'.strtolower($module).'/js/'.strtolower($module).'.js.php', '/').'\'/' => '\'/'.strtolower($module).'/js/'.strtolower($module).'.js.php\''); dolReplaceInFile($srcfile, $arrayreplacement, '', 0, 0, 1); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -574,14 +563,12 @@ if ($dirins && $action == 'initcli' && !empty($module)) dolReplaceInFile($destfile, $arrayreplacement); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } } -if ($dirins && $action == 'initdoc' && !empty($module)) -{ +if ($dirins && $action == 'initdoc' && !empty($module)) { dol_mkdir($dirins.'/'.strtolower($module).'/doc'); $srcdir = DOL_DOCUMENT_ROOT.'/modulebuilder/template'; $srcfile = $srcdir.'/doc/Documentation.asciidoc'; @@ -589,8 +576,7 @@ if ($dirins && $action == 'initdoc' && !empty($module)) //var_dump($srcfile);var_dump($destfile); $result = dol_copy($srcfile, $destfile, 0, 0); - if ($result > 0) - { + if ($result > 0) { $modulename = ucfirst($module); // Force first letter in uppercase $modulelowercase = strtolower($module); @@ -625,8 +611,7 @@ if ($dirins && $action == 'initdoc' && !empty($module)) dol_delete_file($outputfiledoc, 0, 0, 0, null, false, 0); dol_delete_file($outputfiledocpdf, 0, 0, 0, null, false, 0); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFailToCreateFile', $destfile), null, 'errors'); } @@ -671,8 +656,7 @@ if ($dirins && $action == 'initobject' && $module && GETPOST('createtablearray', { setEventMessages($langs->trans("ErrorTableNotFound", $tablename), null, 'errors'); } - else - { + else { /** * 'type' if the field format ('integer', 'integer:Class:pathtoclass', 'varchar(x)', 'double(24,8)', 'text', 'html', 'datetime', 'timestamp', 'float') * 'label' the translation key. @@ -882,8 +866,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCopyFile", $srcdir.'/'.$srcfile, $destdir.'/'.$destfile), null, 'errors'); } - else // $result == 0 - { + else { + // $result == 0 setEventMessages($langs->trans("FileAlreadyExists", $destfile), null, 'warnings'); } } @@ -1066,14 +1050,12 @@ if ($dirins && ($action == 'droptable' || $action == 'droptableextrafields') && $nb = $obj->nb; } } - else - { + else { if ($db->lasterrno() == 'DB_ERROR_NOSUCHTABLE') { setEventMessages($langs->trans("TableDoesNotExists", $tabletodrop), null, 'warnings'); } - else - { + else { dol_print_error($db); } } @@ -1231,8 +1213,7 @@ if ($dirins && $action == 'confirm_deletemodule') { setEventMessages($langs->trans("DirWasRemoved", $modulelowercase), null); } - else - { + else { setEventMessages($langs->trans("PurgeNothingToDelete"), null, 'warnings'); } } @@ -1291,8 +1272,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { setEventMessages($langs->trans("FilesDeleted"), null); } - else - { + else { setEventMessages($langs->trans("ErrorSomeFilesCouldNotBeDeleted"), null, 'warnings'); } } @@ -1326,8 +1306,7 @@ if ($dirins && $action == 'generatepackage') dol_print_error($e->getMessage()); } } - else - { + else { $error++; $langs->load("errors"); dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); @@ -1346,8 +1325,7 @@ if ($dirins && $action == 'generatepackage') if (!dol_is_dir($dirofmodule)) dol_mkdir($dirofmodule); $result = dol_compress_dir($dir, $outputfilezip, 'zip', '', $modulelowercase); } - else - { + else { $result = -1; } @@ -1355,15 +1333,13 @@ if ($dirins && $action == 'generatepackage') { setEventMessages($langs->trans("ZipFileGeneratedInto", $outputfilezip), null); } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToGenerateFile", $outputfilezip), null, 'errors'); } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorCheckVersionIsDefined"), null, 'errors'); @@ -1382,8 +1358,7 @@ if ($dirins && $action == 'generatedoc') { setEventMessages($langs->trans("DocFileGeneratedInto", $dirofmodule), null); } - else - { + else { setEventMessages($util->error, $util->errors, 'errors'); } } @@ -1421,13 +1396,11 @@ if ($action == 'savefile' && empty($cancel)) setEventMessages($langs->trans("FileSaved"), null); } - else - { + else { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } } - else - { + else { setEventMessages($langs->trans("ContentCantBeEmpty"), null, 'errors'); //$action='editfile'; $error++; @@ -1446,8 +1419,7 @@ if ($action == 'set' && $user->admin) $value = GETPOST('value', 'alpha'); $resarray = activateModule($value); if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); - else - { + else { //var_dump($resarray);exit; if ($resarray['nbperms'] > 0) { @@ -1595,8 +1567,7 @@ if (!$dirins) $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $allowfromweb = -1; } -else -{ +else { if ($dirins_ok) { if (!is_writable(dol_osencode($dirins))) @@ -1606,8 +1577,7 @@ else $allowfromweb = 0; } } - else - { + else { $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $allowfromweb = 0; } @@ -1645,8 +1615,7 @@ if (!empty($module) && $module != 'initmodule' && $module != 'deletemodule') print $e->getMessage(); } } - else - { + else { if (empty($forceddirread)) $error++; $langs->load("errors"); print img_warning('').' '.$langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; @@ -1703,28 +1672,24 @@ if (is_array($listofmodules) && count($listofmodules) > 0) { $linktoenabledisable .= ' '.img_picto(ucfirst($page), "setup").''; // print ''.ucfirst($page).' '; } - else - { + else { if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) { $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $linktoenabledisable .= '   '.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; } - else - { + else { $urltouse = $urlpage; $linktoenabledisable .= '   '.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; } } } } - elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) - { + elseif (preg_match('/^([^@]+)@([^@]+)$/i', $objMod->config_page_url, $regs)) { $linktoenabledisable .= '   '.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"').''; } } - else - { + else { $linktoenabledisable .= ''; $linktoenabledisable .= img_picto($langs->trans("ModuleIsNotActive", $urltomodulesetup), 'switch_off', '', false, 0, 0, '', 'classfortooltip', 1); $linktoenabledisable .= "\n"; @@ -1775,8 +1740,7 @@ if ($module == 'initmodule') print '
'; print ''; } -elseif ($module == 'deletemodule') -{ +elseif ($module == 'deletemodule') { print ''."\n"; print '
'; print ''; @@ -1789,8 +1753,7 @@ elseif ($module == 'deletemodule') print ''; print '
'; } -elseif (!empty($module)) -{ +elseif (!empty($module)) { // Tabs for module if (!$error) { @@ -1978,8 +1941,7 @@ elseif (!empty($module)) print ''; } - else - { + else { print $langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module).'
'; } @@ -2006,8 +1968,7 @@ elseif (!empty($module)) dol_fiche_end(); } - else - { + else { $fullpathoffile = dol_buildpath($file, 0, 1); // Description - level 2 if ($fullpathoffile) @@ -2039,8 +2000,7 @@ elseif (!empty($module)) print ''; } } - else - { + else { dol_fiche_head($head2, $tab, '', -1, ''); // Level 2 } @@ -2078,8 +2038,7 @@ elseif (!empty($module)) } print ''; } - else - { + else { // Edit text language file //print $langs->trans("UseAsciiDocFormat").'
'; @@ -2208,8 +2167,7 @@ elseif (!empty($module)) $i++; } } - else - { + else { print ''.$langs->trans("None").''; } @@ -2218,8 +2176,7 @@ elseif (!empty($module)) print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -2324,8 +2281,7 @@ elseif (!empty($module)) print ''; } - elseif ($tabobj == 'deleteobject') - { + elseif ($tabobj == 'deleteobject') { // Delete object tab print '
'; print ''; @@ -2339,8 +2295,8 @@ elseif (!empty($module)) print ''; print '
'; } - else - { // tabobj = module + else { + // tabobj = module if ($action == 'deleteproperty') { $formconfirm = $form->formconfirm( @@ -2413,13 +2369,11 @@ elseif (!empty($module)) { print ''.$langs->trans("GoToApiExplorer").''; } - else - { + else { print ''.$langs->trans("GoToApiExplorer").''; } } - else - { + else { //print ''.$langs->trans("FileNotYetGenerated").' '; print ''; } @@ -2433,8 +2387,7 @@ elseif (!empty($module)) print ' '; print ''.img_picto($langs->trans("Delete"), 'delete').''; } - else - { + else { //print ''.$langs->trans("FileNotYetGenerated").' '; print ''; } @@ -2542,8 +2495,7 @@ elseif (!empty($module)) { $result = dol_include_once($pathtoclass); } - else - { + else { $result = @include_once $dirread.'/'.$pathtoclass; } if (class_exists($tabobj)) @@ -2748,8 +2700,7 @@ elseif (!empty($module)) print ''; } } - else - { + else { if ($tab == 'specifications') { if ($action != 'editfile' || empty($file)) @@ -2769,8 +2720,7 @@ elseif (!empty($module)) print '
'; } } - else - { + else { // Use MD or asciidoc //print $langs->trans("UseAsciiDocFormat").'
'; @@ -2806,8 +2756,7 @@ elseif (!empty($module)) print ''; } - else - { + else { print ''.$langs->trans('Failed to init the object with the new.').''; } } @@ -2816,14 +2765,12 @@ elseif (!empty($module)) print $e->getMessage(); } } - else - { + else { if (empty($forceddirread)) { $fullpathoffile = dol_buildpath($file, 0); } - else - { + else { $fullpathoffile = $dirread.'/'.$file; } @@ -2957,9 +2904,8 @@ elseif (!empty($module)) print ''; } } - else - { - print ''.$langs->trans("None").''; + else { + print ''.$langs->trans("None").''; } print ''; @@ -2967,8 +2913,7 @@ elseif (!empty($module)) print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3057,9 +3002,8 @@ elseif (!empty($module)) print ''; } } - else - { - print ''.$langs->trans("None").''; + else { + print ''.$langs->trans("None").''; } print ''; @@ -3067,8 +3011,7 @@ elseif (!empty($module)) print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3120,16 +3063,14 @@ elseif (!empty($module)) print ''.img_picto($langs->trans("Edit"), 'edit').' '; print ''.img_picto($langs->trans("Delete"), 'delete').''; } - else - { + else { print ''.$langs->trans("FileNotYetGenerated").''; print ''; print ''; } print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3189,8 +3130,7 @@ elseif (!empty($module)) print ''; } } - else - { + else { print ''; print ' '.$langs->trans("NoTrigger"); print ''; @@ -3200,8 +3140,7 @@ elseif (!empty($module)) print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3245,15 +3184,13 @@ elseif (!empty($module)) print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').''; } - else - { + else { print ''.$langs->trans("FileNotYetGenerated").''; print ''; } print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3297,15 +3234,13 @@ elseif (!empty($module)) print ''.img_picto($langs->trans("Edit"), 'edit').''; print ''.img_picto($langs->trans("Delete"), 'delete').''; } - else - { + else { print ''.$langs->trans("FileNotYetGenerated").''; print ''; } print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3355,16 +3290,14 @@ elseif (!empty($module)) print ''; } } - else - { + else { print ' '.$langs->trans("NoWidget"); print ''; print ''; } print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3441,16 +3374,14 @@ elseif (!empty($module)) print ''; } } - else - { + else { print ' '.$langs->trans("NoCLIFile"); print ''; print ''; } print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3561,8 +3492,7 @@ elseif (!empty($module)) print ''; } } - else - { + else { print ''.$langs->trans("None").''; } @@ -3571,8 +3501,7 @@ elseif (!empty($module)) print ''; } - else - { + else { $fullpathoffile = dol_buildpath($file, 0); $content = file_get_contents($fullpathoffile); @@ -3622,8 +3551,7 @@ elseif (!empty($module)) print ''; } } - else - { + else { print ''; print ' '.$langs->trans("FileNotYetGenerated"); print ''; @@ -3631,8 +3559,7 @@ elseif (!empty($module)) } print ''; } - else - { + else { // Use MD or asciidoc //print $langs->trans("UseAsciiDocFormat").'
'; @@ -3735,14 +3662,12 @@ elseif (!empty($module)) try { $moduleobj = new $class($db); } - catch (Exception $e) - { + catch (Exception $e) { $error++; dol_print_error($e->getMessage()); } } - else - { + else { $error++; $langs->load("errors"); dol_print_error($langs->trans("ErrorFailedToLoadModuleDescriptorForXXX", $module)); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 05b2c56ffb8..642fa838783 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -116,8 +116,7 @@ if ($action == 'edit') print ''; print '
'; } -else -{ +else { if (!empty($arrayofparameters)) { print ''; @@ -137,8 +136,7 @@ else print ''.$langs->trans("Modify").''; print ''; } - else - { + else { print '
'.$langs->trans("NothingToSetup"); } } diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index 10bca2e8b9a..13a2b8e895c 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -165,6 +165,7 @@ class ActionsMyModule global $conf, $user, $langs; $error = 0; // Error counter + $disabled = 1; /* print_r($parameters); print_r($object); echo "action: " . $action; */ if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' @@ -231,8 +232,8 @@ class ActionsMyModule dol_syslog(get_class($this).'::executeHooks action='.$action); /* print_r($parameters); print_r($object); echo "action: " . $action; */ - if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) // do something only for the context 'somecontext1' or 'somecontext2' - { + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { + // do something only for the context 'somecontext1' or 'somecontext2' } return $ret; diff --git a/htdocs/modulebuilder/template/class/api_mymodule.class.php b/htdocs/modulebuilder/template/class/api_mymodule.class.php index f84210b9198..40af5ce2f0d 100644 --- a/htdocs/modulebuilder/template/class/api_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/api_mymodule.class.php @@ -159,6 +159,7 @@ class MyModuleApi extends DolibarrApi } $result = $db->query($sql); + $i = 0; if ($result) { $num = $db->num_rows($result); @@ -239,12 +240,11 @@ class MyModuleApi extends DolibarrApi $this->myobject->$field = $value; } - if ($this->myobject->update($id, DolibarrApiAccess::$user) > 0) + if ($this->myobject->update(DolibarrApiAccess::$user, false) > 0) { return $this->get($id); } - else - { + else { throw new RestException(500, $this->myobject->error); } } diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2070bedf568..6f1d45fee9f 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -546,8 +546,7 @@ class MyObject extends CommonObject { $num = $this->getNextNumRef(); } - else - { + else { $num = $this->ref; } $this->newref = $num; @@ -631,8 +630,7 @@ class MyObject extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -900,8 +898,7 @@ class MyObject extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -935,8 +932,7 @@ class MyObject extends CommonObject $this->errors = $this->errors; return $result; } - else - { + else { $this->lines = $result; return $this->lines; } @@ -987,8 +983,7 @@ class MyObject extends CommonObject { return $numref; } - else - { + else { $this->error = $obj->error; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; @@ -998,8 +993,7 @@ class MyObject extends CommonObject return ""; } } - else - { + else { print $langs->trans("ErrorNumberingModuleNotSetup", $this->element); return ""; } diff --git a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php index 39b325924fc..e7d407dc8c9 100644 --- a/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mailings/mailinglist_mymodule_myobject.modules.php @@ -147,8 +147,7 @@ class mailing_mailinglist_mymodule_myobject extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php index 98c2c94bc7b..74a05a6b5e7 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/doc/doc_generic_myobject_odt.modules.php @@ -136,9 +136,9 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if (!$tmpdir) { unset($listofdir[$key]); continue; } - if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + if (!is_dir($tmpdir)) { + $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); + } else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -275,8 +275,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -309,18 +308,17 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } // Make substitution $substitutionarray = array( - '__FROM_NAME__' => $this->emetteur->name, - '__FROM_EMAIL__' => $this->emetteur->email, - '__TOTAL_TTC__' => $object->total_ttc, - '__TOTAL_HT__' => $object->total_ht, - '__TOTAL_VAT__' => $object->total_vat + '__FROM_NAME__' => $this->emetteur->name, + '__FROM_EMAIL__' => $this->emetteur->email, + '__TOTAL_TTC__' => $object->total_ttc, + '__TOTAL_HT__' => $object->total_ht, + '__TOTAL_VAT__' => $object->total_vat ); complete_substitutions_array($substitutionarray, $langs, $object); // Call the ODTSubstitution hook @@ -392,13 +390,13 @@ class doc_generic_myobject_odt extends ModelePDFMyObject foreach ($tmparray as $key=>$value) { try { - if (preg_match('/logo$/', $key)) // Image - { + if (preg_match('/logo$/', $key)) { + // Image if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text - { + else { + // Text $odfHandler->setVars($key, $value, true, 'UTF-8'); } } @@ -408,8 +406,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -433,8 +430,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -508,8 +504,7 @@ class doc_generic_myobject_odt extends ModelePDFMyObject return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php index a611b6210bc..526c7c11213 100644 --- a/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php +++ b/htdocs/modulebuilder/template/core/modules/mymodule/mod_myobject_standard.php @@ -141,8 +141,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/modulebuilder/template/myobject_agenda.php b/htdocs/modulebuilder/template/myobject_agenda.php index 9b71971b6cf..4da40f0eb9a 100644 --- a/htdocs/modulebuilder/template/myobject_agenda.php +++ b/htdocs/modulebuilder/template/myobject_agenda.php @@ -54,13 +54,10 @@ $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); -if (GETPOST('actioncode', 'array')) -{ +if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else -{ +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -226,9 +223,7 @@ if ($object->id > 0) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print ''.$langs->trans("AddAction").''; - } - else - { + } else { print ''.$langs->trans("AddAction").''; } } diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index e92c88f1364..a31e9f6acdd 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -479,8 +479,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Modify").''."\n"; } - else - { + else { print ''.$langs->trans('Modify').''."\n"; } @@ -493,8 +492,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Validate").''; } - else - { + else { $langs->load("errors"); print ''.$langs->trans("Validate").''; } @@ -537,8 +535,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 63b114ffc10..186edc11da1 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -199,9 +199,7 @@ if ($object->id) $relativepathwithnofile = 'myobject/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else -{ +} else { accessforbidden('', 0, 1); } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index a0fcb744bb1..a37890649e2 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -292,9 +292,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else -{ +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/modulebuilder/template/scripts/mymodule.php b/htdocs/modulebuilder/template/scripts/mymodule.php index 02024759058..aab823d1cb0 100644 --- a/htdocs/modulebuilder/template/scripts/mymodule.php +++ b/htdocs/modulebuilder/template/scripts/mymodule.php @@ -164,8 +164,7 @@ if (!$error) $db->commit(); print '--- end ok'."\n"; } -else -{ +else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/test/phpunit/CodingPhpTest.php b/test/phpunit/CodingPhpTest.php index 5c3c6d7d54e..c28021a6957 100644 --- a/test/phpunit/CodingPhpTest.php +++ b/test/phpunit/CodingPhpTest.php @@ -154,7 +154,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $filesarray = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, '\.php', null, 'fullname'); - foreach($filesarray as $key => $file) + foreach ($filesarray as $key => $file) { if (preg_match('/\/htdocs\/includes\//', $file['fullname'])) continue; if (preg_match('/\/htdocs\/custom\//', $file['fullname'])) continue; @@ -170,7 +170,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/'.preg_quote('get_class($this)."::".__METHOD__', '/').'/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { $ok=false; break; @@ -183,7 +183,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/(..)\s*\.\s*\$this->db->idate\(/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { if ($val[1] != '\'"' && $val[1] != '\'\'') { @@ -201,7 +201,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/(=|sql.+)\s*\'"\s*\.\s*\$this->(....)/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { if ($val[2] != 'db->' && $val[2] != 'esca') { @@ -220,7 +220,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/(..............)\$_SERVER\[\'QUERY_STRING\'\]/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { if ($val[1] != 'scape_htmltag(' && $val[1] != 'ing_nohtmltag(' && $val[1] != 'dol_escape_js(') { @@ -236,7 +236,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/print_liste_field_titre\(\$langs/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { $ok=false; break; @@ -249,7 +249,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/
/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { if ($file['name'] != 'functions.lib.php') { @@ -265,7 +265,7 @@ class CodingPhpTest extends PHPUnit\Framework\TestCase $matches=array(); // Check string ='".$this->xxx with xxx that is not 'escape'. It means we forget a db->escape when forging sql request. preg_match_all('/@var\s+array\(/', $filecontent, $matches, PREG_SET_ORDER); - foreach($matches as $key => $val) + foreach ($matches as $key => $val) { $ok=false; break; diff --git a/test/phpunit/CodingSqlTest.php b/test/phpunit/CodingSqlTest.php index f56d00b5bcd..c9a5d12f3fc 100644 --- a/test/phpunit/CodingSqlTest.php +++ b/test/phpunit/CodingSqlTest.php @@ -158,7 +158,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase print 'Process dir '.$dir."\n"; $filesarray = scandir($dir); - foreach($filesarray as $key => $file) + foreach ($filesarray as $key => $file) { if (! preg_match('/\.sql$/', $file)) continue; @@ -206,14 +206,12 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase { // Test for data files only } - else - { + else { if (preg_match('/\.key\.sql$/', $file)) { // Test for key files only } - else - { + else { // Test for non key files only $result=(strpos($filecontent, 'KEY ') && strpos($filecontent, 'PRIMARY KEY') == 0); print __METHOD__." Result for checking we don't have ' KEY ' instead of a sql file to create index = ".$result."\n"; @@ -244,7 +242,7 @@ class CodingSqlTest extends PHPUnit\Framework\TestCase $db=$this->savdb; $filesarray = scandir(DOL_DOCUMENT_ROOT.'/../dev/initdemo'); - foreach($filesarray as $key => $file) { + foreach ($filesarray as $key => $file) { if (! preg_match('/\.sql$/', $file)) continue; diff --git a/test/phpunit/ExportTest.php b/test/phpunit/ExportTest.php index 590accccbed..cf1cafe74b1 100644 --- a/test/phpunit/ExportTest.php +++ b/test/phpunit/ExportTest.php @@ -342,7 +342,7 @@ class ExportTest extends PHPUnit\Framework\TestCase $result=$objexport->load_arrays($user, $filterdatatoexport); // This load ->array_export_xxx properties for datatoexport // Loop on each dataset - foreach($objexport->array_export_code as $key => $datatoexport) + foreach ($objexport->array_export_code as $key => $datatoexport) { $exportfile=$conf->export->dir_temp.'/'.$user->id.'/export_'.$datatoexport.'.csv'; print "Process export for dataset ".$datatoexport." into ".$exportfile."\n"; @@ -351,7 +351,7 @@ class ExportTest extends PHPUnit\Framework\TestCase // Generate $array_selected $i=0; $array_selected=array(); - foreach($objexport->array_export_fields[$key] as $key => $val) + foreach ($objexport->array_export_fields[$key] as $key => $val) { $array_selected[$key]=$i++; } diff --git a/test/phpunit/FactureRecTest.php b/test/phpunit/FactureRecTest.php index f89ab4b1f13..fa44fda619f 100644 --- a/test/phpunit/FactureRecTest.php +++ b/test/phpunit/FactureRecTest.php @@ -187,12 +187,11 @@ class FactureRecTest extends PHPUnit\Framework\TestCase { $retAr[]="Supplied objects are not of same class."; } - else - { + else { $oVarsA=get_object_vars($oA); $oVarsB=get_object_vars($oB); $aKeys=array_keys($oVarsA); - foreach($aKeys as $sKey) + foreach ($aKeys as $sKey) { if (in_array($sKey, $fieldstoignorearray)) continue; if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) diff --git a/test/phpunit/FactureTest.php b/test/phpunit/FactureTest.php index 47f3a639b29..83a7c0cfbe9 100644 --- a/test/phpunit/FactureTest.php +++ b/test/phpunit/FactureTest.php @@ -366,12 +366,11 @@ class FactureTest extends PHPUnit\Framework\TestCase { $retAr[]="Supplied objects are not of same class."; } - else - { + else { $oVarsA=get_object_vars($oA); $oVarsB=get_object_vars($oB); $aKeys=array_keys($oVarsA); - foreach($aKeys as $sKey) + foreach ($aKeys as $sKey) { if (in_array($sKey, $fieldstoignorearray)) continue; if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) diff --git a/test/phpunit/LangTest.php b/test/phpunit/LangTest.php index f4a14373ebe..92e96fc1ad4 100644 --- a/test/phpunit/LangTest.php +++ b/test/phpunit/LangTest.php @@ -154,7 +154,7 @@ class LangTest extends PHPUnit\Framework\TestCase include_once DOL_DOCUMENT_ROOT.'/core/class/translate.class.php'; $filesarray = scandir(DOL_DOCUMENT_ROOT.'/langs'); - foreach($filesarray as $key => $code) + foreach ($filesarray as $key => $code) { if (! preg_match('/^[a-z]+_[A-Z]+$/', $code)) continue; diff --git a/test/phpunit/ModulesTest.php b/test/phpunit/ModulesTest.php index f8feaa8f829..32652200c2c 100755 --- a/test/phpunit/ModulesTest.php +++ b/test/phpunit/ModulesTest.php @@ -144,7 +144,7 @@ class ModulesTest extends PHPUnit\Framework\TestCase 'Mailing','MailmanSpip','Margin','ModuleBuilder','MultiCurrency', 'Notification','Oauth','OpenSurvey','Paybox','Paypal','Prelevement','Printing','Product','ProductBatch','Projet','Propale','ReceiptPrinter','Resource', 'Salaries','Service','SocialNetworks','Societe','Stock','Stripe','SupplierProposal','Syslog','TakePos','Tax','Ticket','User','Variants','WebServices','WebServicesClient','Website','Workflow'); - foreach($modulelist as $modlabel) + foreach ($modulelist as $modlabel) { require_once DOL_DOCUMENT_ROOT.'/core/modules/mod'.$modlabel.'.class.php'; $class='mod'.$modlabel; diff --git a/test/phpunit/UserTest.php b/test/phpunit/UserTest.php index 10b0bd7b0b7..08338de949b 100644 --- a/test/phpunit/UserTest.php +++ b/test/phpunit/UserTest.php @@ -339,7 +339,7 @@ class UserTest extends PHPUnit\Framework\TestCase $oVarsA=get_object_vars($oA); $oVarsB=get_object_vars($oB); $aKeys=array_keys($oVarsA); - foreach($aKeys as $sKey) { + foreach ($aKeys as $sKey) { if (in_array($sKey, $fieldstoignorearray)) continue; if (! $ignoretype && $oVarsA[$sKey] !== $oVarsB[$sKey]) { diff --git a/test/phpunit/WebservicesInvoicesTest.php b/test/phpunit/WebservicesInvoicesTest.php index 8aada2fc03a..dc6cc93c8a5 100644 --- a/test/phpunit/WebservicesInvoicesTest.php +++ b/test/phpunit/WebservicesInvoicesTest.php @@ -256,7 +256,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); } - catch(SoapFault $exception) + catch (SoapFault $exception) { echo $exception; $result=0; @@ -314,7 +314,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); } - catch(SoapFault $exception) + catch (SoapFault $exception) { echo $exception; $result=0; @@ -414,7 +414,7 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); } - catch(SoapFault $exception) + catch (SoapFault $exception) { echo $exception; $result=0; @@ -433,7 +433,6 @@ class WebservicesInvoicesTest extends PHPUnit\Framework\TestCase $this->assertEquals('OK', $result['result']['result_code']); $this->assertEquals('ref-phpunit-2', $result['ref_ext']); - return $result; } } diff --git a/test/phpunit/WebservicesOrdersTest.php b/test/phpunit/WebservicesOrdersTest.php index 33d842f6d39..803247e2598 100644 --- a/test/phpunit/WebservicesOrdersTest.php +++ b/test/phpunit/WebservicesOrdersTest.php @@ -169,7 +169,7 @@ class WebservicesOrdersTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } diff --git a/test/phpunit/WebservicesOtherTest.php b/test/phpunit/WebservicesOtherTest.php index 34686cbec92..10c74bb1821 100644 --- a/test/phpunit/WebservicesOtherTest.php +++ b/test/phpunit/WebservicesOtherTest.php @@ -170,7 +170,7 @@ class WebservicesOtherTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -198,7 +198,7 @@ class WebservicesOtherTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } diff --git a/test/phpunit/WebservicesProductsTest.php b/test/phpunit/WebservicesProductsTest.php index 70a8c12a498..90911b289bc 100644 --- a/test/phpunit/WebservicesProductsTest.php +++ b/test/phpunit/WebservicesProductsTest.php @@ -188,7 +188,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -251,7 +251,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -314,7 +314,7 @@ class WebservicesProductsTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } diff --git a/test/phpunit/WebservicesThirdpartyTest.php b/test/phpunit/WebservicesThirdpartyTest.php index 1106164b4ee..285fc6d5ddb 100644 --- a/test/phpunit/WebservicesThirdpartyTest.php +++ b/test/phpunit/WebservicesThirdpartyTest.php @@ -214,7 +214,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -268,7 +268,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -330,7 +330,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -390,7 +390,7 @@ class WebservicesThirdpartyTest extends PHPUnit\Framework\TestCase print __METHOD__." call method ".$WS_METHOD."\n"; try { $result = $this->soapclient->call($WS_METHOD, $parameters, $this->_ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } diff --git a/test/phpunit/WebservicesUserTest.php b/test/phpunit/WebservicesUserTest.php index bb68f413741..f78386fc5bf 100644 --- a/test/phpunit/WebservicesUserTest.php +++ b/test/phpunit/WebservicesUserTest.php @@ -170,7 +170,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } @@ -197,7 +197,7 @@ class WebservicesUserTest extends PHPUnit\Framework\TestCase print __METHOD__."Call method ".$WS_METHOD."\n"; try { $result = $soapclient->call($WS_METHOD, $parameters, $ns, ''); - } catch(SoapFault $exception) { + } catch (SoapFault $exception) { echo $exception; $result=0; } From ccadb1ec7a88f667ec95a11a898dc17759638be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 00:47:16 +0200 Subject: [PATCH 02/28] add new rule --- htdocs/adherents/admin/adherent.php | 16 +- htdocs/adherents/admin/adherent_emails.php | 7 +- htdocs/adherents/admin/website.php | 12 +- htdocs/adherents/agenda.php | 4 +- .../actions_adherentcard_common.class.php | 12 +- .../actions_adherentcard_default.class.php | 4 +- htdocs/adherents/card.php | 140 +++++------------- htdocs/adherents/cartes/carte.php | 10 +- htdocs/adherents/class/adherent.class.php | 22 +-- .../adherents/class/adherent_type.class.php | 52 ++----- htdocs/adherents/class/api_members.class.php | 6 +- .../class/api_memberstypes.class.php | 6 +- .../class/api_subscriptions.class.php | 6 +- htdocs/adherents/class/subscription.class.php | 32 +--- htdocs/adherents/document.php | 8 +- htdocs/adherents/htpasswd.php | 4 +- htdocs/adherents/index.php | 12 +- htdocs/adherents/ldap.php | 16 +- htdocs/adherents/list.php | 16 +- htdocs/adherents/stats/byproperties.php | 11 +- htdocs/adherents/stats/geo.php | 11 +- htdocs/adherents/subscription.php | 72 +++------ htdocs/adherents/subscription/card.php | 32 +--- htdocs/core/lib/functions.lib.php | 4 +- 24 files changed, 149 insertions(+), 366 deletions(-) diff --git a/htdocs/adherents/admin/adherent.php b/htdocs/adherents/admin/adherent.php index 6b2d432fe46..ca5011849b1 100644 --- a/htdocs/adherents/admin/adherent.php +++ b/htdocs/adherents/admin/adherent.php @@ -71,9 +71,7 @@ if ($action == 'updateall') { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); - } - else - { + } else { setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); $db->commit(); } @@ -101,9 +99,7 @@ if ($action == 'update' || $action == 'add') if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -199,9 +195,7 @@ if ($conf->facture->enabled) print ''; - } - else - { + } else { print ''; @@ -234,12 +228,12 @@ print '
'; */ $constantes = array( 'ADHERENT_CARD_TYPE', -// 'ADHERENT_CARD_BACKGROUND', + //'ADHERENT_CARD_BACKGROUND', 'ADHERENT_CARD_HEADER_TEXT', 'ADHERENT_CARD_TEXT', 'ADHERENT_CARD_TEXT_RIGHT', 'ADHERENT_CARD_FOOTER_TEXT' - ); +); print load_fiche_titre($langs->trans("MembersCards"), '', ''); diff --git a/htdocs/adherents/admin/adherent_emails.php b/htdocs/adherents/admin/adherent_emails.php index e0675a6124a..f59a27c170b 100644 --- a/htdocs/adherents/admin/adherent_emails.php +++ b/htdocs/adherents/admin/adherent_emails.php @@ -74,9 +74,7 @@ if ($action == 'updateall') { setEventMessages('ErrorFailedToSaveDate', null, 'errors'); $db->rollback(); - } - else - { + } else { setEventMessages('RecordModifiedSuccessfully', null, 'mesgs'); $db->commit(); } @@ -102,8 +100,7 @@ if ($action == 'update' || $action == 'add') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/adherents/admin/website.php b/htdocs/adherents/admin/website.php index a8cdc06784e..50a7f58e8c5 100644 --- a/htdocs/adherents/admin/website.php +++ b/htdocs/adherents/admin/website.php @@ -61,16 +61,16 @@ if ($action == 'update') $res = dolibarr_set_const($db, "MEMBER_NEWFORM_EDITAMOUNT", $editamount, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, "MEMBER_NEWFORM_PAYONLINE", $payonline, 'chaine', 0, '', $conf->entity); if ($forcetype < 0) $res = dolibarr_del_const($db, "MEMBER_NEWFORM_FORCETYPE", $conf->entity); - else $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); + else { + $res = dolibarr_set_const($db, "MEMBER_NEWFORM_FORCETYPE", $forcetype, 'chaine', 0, '', $conf->entity); + } if (!$res > 0) $error++; if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else - { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -145,9 +145,7 @@ if (empty($conf->global->MEMBER_ENABLE_PUBLIC)) $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; -} -else -{ +} else { // Button on, click to disable $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 20d712e6179..f1d83a4b314 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -53,9 +53,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else -{ +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index eeee48e2138..44046d5a26e 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -118,9 +118,7 @@ abstract class ActionsAdherentCardCommon { $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; - } - else - { + } else { $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); } @@ -190,9 +188,7 @@ abstract class ActionsAdherentCardCommon $objsoc->fetch($this->object->socid); $this->tpl['company'] = $objsoc->getNomUrl(1); - } - else - { + } else { $this->tpl['company'] = $langs->trans("AdherentNotLinkedToThirdParty"); } @@ -273,9 +269,7 @@ abstract class ActionsAdherentCardCommon $this->object->country_code = $obj->code; $this->object->country = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->libelle; - } - else - { + } else { dol_print_error($this->db); } } diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index 60bb2ecd034..f248256a547 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -105,9 +105,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); - } - else - { + } else { // Confirm delete contact if ($action == 'delete' && $user->rights->adherent->supprimer) { diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index c913d6a1b49..7a5880fc317 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -209,9 +209,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans($nuser->error), null, 'errors'); } - } - else - { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -231,9 +229,7 @@ if (empty($reshook)) setEventMessages($langs->trans($company->error), null, 'errors'); setEventMessages($company->error, $company->errors, 'errors'); } - } - else - { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -376,21 +372,15 @@ if (empty($reshook)) if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); - } - else - { + } else { // Create thumbs $object->addThumbs($newfile); } } - } - else - { + } else { setEventMessages("ErrorBadImageFormat", null, 'errors'); } - } - else - { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -412,15 +402,11 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - } - else - { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } - } - else - { + } else { $action = 'edit'; } } @@ -527,8 +513,7 @@ if (empty($reshook)) if (empty($login)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); - } - else { + } else { $sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape($login)."'"; $result = $db->query($sql); if ($result) { @@ -588,9 +573,7 @@ if (empty($reshook)) $rowid = $object->id; $id = $object->id; $action = ''; - } - else - { + } else { $db->rollback(); if ($object->error) { @@ -616,15 +599,11 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } - else - { + } else { header("Location: list.php"); exit; } - } - else - { + } else { $errmesg = $object->error; } } @@ -689,9 +668,7 @@ if (empty($reshook)) } } } - } - else - { + } else { $error++; if ($object->error) { setEventMessages($object->error, $object->errors, 'errors'); @@ -703,9 +680,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else - { + } else { $db->rollback(); } $action = ''; @@ -770,9 +745,7 @@ if (empty($reshook)) } } } - } - else - { + } else { $error++; if ($object->error) { @@ -857,9 +830,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else -{ +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -1027,9 +998,7 @@ else if ($object->country_id) { print $formcompany->select_state(GETPOST('state_id', 'int') ?GETPOST('state_id', 'int') : $object->state_id, $object->country_code); - } - else - { + } else { print $countrynotdefined; } print ''; @@ -1084,9 +1053,7 @@ else if (!empty($backtopage)) { print ''; - } - else - { + } else { print ''; } print ''; @@ -1123,9 +1090,7 @@ else if ($resql) { $obj = $db->fetch_object($resql); - } - else - { + } else { dol_print_error($db); } $object->country_id = $obj->rowid; @@ -1204,9 +1169,7 @@ else if ($user->rights->adherent->creer) { print $form->selectarray("typeid", $adht->liste_array(), (GETPOSTISSET("typeid") ?GETPOST("typeid", 'int') : $object->typeid)); - } - else - { + } else { print $adht->getNomUrl(1); print ''; } @@ -1334,9 +1297,7 @@ else $company = new Societe($db); $result = $company->fetch($object->socid); print $company->getNomUrl(1); - } - else - { + } else { print $langs->trans("NoThirdPartyAssociatedToMember"); } print ''; @@ -1432,9 +1393,7 @@ else { $companyname = $object->company; if (!empty($fullname)) $companyalias = $fullname; - } - else - { + } else { $companyname = $fullname; if (!empty($object->company)) $companyalias = $object->company; } @@ -1629,8 +1588,7 @@ else { print ''; print ''; print '
'; print $form->selectarray('ADHERENT_VAT_FOR_SUBSCRIPTIONS', array('0'=>$langs->trans("NoVatOnSubscription"), 'defaultforfoundationcountry'=>$langs->trans("Default")), (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) ? '0' : $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS), 0); print ''; print $langs->trans("WarningModuleNotActive", $langs->transnoentities("Module85Name")); print '
'.$langs->trans("Password").''.preg_replace('/./i', '*', $object->pass); if ($object->pass) print preg_replace('/./i', '*', $object->pass); - else - { + else { if ($user->admin) print $langs->trans("Crypted").': '.$object->pass_indatabase_crypted; else print $langs->trans("Hidden"); } @@ -1651,9 +1609,7 @@ else if ($object->hasDelay()) { print " ".img_warning($langs->trans("Late")); } - } - else - { + } else { if ($object->need_subscription == 0) { print $langs->trans("SubscriptionNotNeeded"); @@ -1662,9 +1618,7 @@ else { print $langs->trans("SubscriptionNotRecorded"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated - } - else - { + } else { print $langs->trans("SubscriptionNotReceived"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } @@ -1691,17 +1645,12 @@ else print '
'; - } - else - { - if ($object->socid) - { + } else { + if ($object->socid) { $company = new Societe($db); $result = $company->fetch($object->socid); print $company->getNomUrl(1); - } - else - { + } else { print $langs->trans("NoThirdPartyAssociatedToMember"); } } @@ -1716,14 +1665,13 @@ else if ($action == 'editlogin') { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); - } - else - { + } else { if ($object->user_id) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); + } else { + print $langs->trans("NoDolibarrAccess"); } - else print $langs->trans("NoDolibarrAccess"); } print ''; @@ -1803,9 +1751,7 @@ else if ($user->rights->adherent->creer) { print '"; - } - else - { + } else { print '
'.$langs->trans("Modify").'
'; } @@ -1815,9 +1761,7 @@ else if ($user->rights->adherent->creer) { print '\n"; - } - else - { + } else { print '
'.$langs->trans("Validate").'
'; } } @@ -1828,9 +1772,7 @@ else if ($user->rights->adherent->creer) { print '\n"; - } - else - { + } else { print '
'.$langs->trans("Reenable")."
"; } } @@ -1841,9 +1783,7 @@ else if ($user->rights->adherent->supprimer) { print '\n"; - } - else - { + } else { print '
'.$langs->trans("Resiliate")."
"; } } @@ -1855,9 +1795,7 @@ else { if ($object->statut != -1) print ''; else print ''; - } - else - { + } else { print '
'.$langs->trans("CreateDolibarrThirdParty")."
"; } } @@ -1869,9 +1807,7 @@ else { if ($object->statut != -1) print ''; else print ''; - } - else - { + } else { print '
'.$langs->trans("CreateDolibarrLogin")."
"; } } @@ -1880,9 +1816,7 @@ else if ($user->rights->adherent->supprimer) { print '\n"; - } - else - { + } else { print '
'.$langs->trans("Delete")."
"; } diff --git a/htdocs/adherents/cartes/carte.php b/htdocs/adherents/cartes/carte.php index 86bf523ac51..345542f8cba 100644 --- a/htdocs/adherents/cartes/carte.php +++ b/htdocs/adherents/cartes/carte.php @@ -162,11 +162,9 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) 'photo'=>$objp->photo ); } - } - else - { + } else { $arrayofmembers[] = array( - 'textleft'=>$textleft, + 'textleft'=>$textleft, 'textheader'=>$textheader, 'textfooter'=>$textfooter, 'textright'=>$textright, @@ -226,9 +224,7 @@ if ((!empty($foruserid) || !empty($foruserlogin) || !empty($mode)) && !$mesg) { dol_print_error('', $result); } - } - else - { + } else { dol_print_error($db); } diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 55504a547c2..a7410d87973 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1282,10 +1282,11 @@ class Adherent extends CommonObject $this->country_id = $obj->country_id; $this->country_code = $obj->country_code; - if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) + if ($langs->trans("Country".$obj->country_code) != "Country".$obj->country_code) { $this->country = $langs->transnoentitiesnoconv("Country".$obj->country_code); - else + } else { $this->country = $obj->country; + } $this->phone = $obj->phone; $this->phone_perso = $obj->phone_perso; @@ -2037,12 +2038,13 @@ class Adherent extends CommonObject if ($withpictoimg > -2 && $withpictoimg != 2) { if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ''; - if ($mode == 'login') + if ($mode == 'login') { $result .= dol_trunc($this->login, $maxlen); - elseif ($mode == 'ref') + } elseif ($mode == 'ref') { $result .= $this->id; - else + } else { $result .= $this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); + } if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result .= ''; } if ($withpictoimg) $result .= ''; @@ -2803,10 +2805,11 @@ class Adherent extends CommonObject $listofids .= ', ...'; break; } - if (empty($listofids)) + if (empty($listofids)) { $listofids .= ' ['; - else + } else { $listofids .= ', '; + } $listofids .= $idmember; $i++; } @@ -2823,10 +2826,11 @@ class Adherent extends CommonObject $listofids .= ', ...'; break; } - if (empty($listofids)) + if (empty($listofids)) { $listofids .= ' ['; - else + } else { $listofids .= ', '; + } $listofids .= $idmember; $i++; } diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index 4af80ab4a63..199bd5e8a51 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -146,9 +146,7 @@ class AdherentType extends CommonObject $this->multilangs["$obj->lang"]["email"] = $obj->email; } return 1; - } - else - { + } else { $this->error = "Error: ".$this->db->lasterror()." - ".$sql; return -1; } @@ -184,9 +182,7 @@ class AdherentType extends CommonObject $sql2 .= " label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else - { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->label)."',"; @@ -214,9 +210,7 @@ class AdherentType extends CommonObject $sql2 .= " label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " WHERE fk_type=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else - { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."adherent_type_lang (fk_type, lang, label, description"; $sql2 .= ")"; $sql2 .= " VALUES(".$this->id.",'".$this->db->escape($key)."','".$this->db->escape($this->multilangs["$key"]["label"])."',"; @@ -231,9 +225,7 @@ class AdherentType extends CommonObject return -1; } } - } - else - { + } else { // language is not current language and we didn't provide a multilang description for this language } } @@ -274,9 +266,7 @@ class AdherentType extends CommonObject } // End call triggers return 1; - } - else - { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); return -1; @@ -336,16 +326,12 @@ class AdherentType extends CommonObject { $this->db->commit(); return $this->id; - } - else - { + } else { dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else - { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -418,16 +404,12 @@ class AdherentType extends CommonObject { $this->db->commit(); return 1; - } - else - { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); return -$error; } - } - else - { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -458,9 +440,7 @@ class AdherentType extends CommonObject $this->db->commit(); return 1; - } - else - { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -511,9 +491,7 @@ class AdherentType extends CommonObject } return 1; - } - else - { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -552,9 +530,7 @@ class AdherentType extends CommonObject $i++; } } - } - else - { + } else { print $this->db->error(); } return $adherenttypes; @@ -608,9 +584,7 @@ class AdherentType extends CommonObject $this->members = $ret; return $ret; - } - else - { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index 8e2e0d278f0..a5d72f3b78f 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -239,10 +239,8 @@ class Members extends DolibarrApi if ($member->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); - } - else - { - throw new RestException(500, $member->error); + } else { + throw new RestException(500, $member->error); } } diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index 98cb25b7fc3..c9d12206962 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -207,10 +207,8 @@ class MembersTypes extends DolibarrApi if ($membertype->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); - } - else - { - throw new RestException(500, $membertype->error); + } else { + throw new RestException(500, $membertype->error); } } diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php index c9804e5d802..11ac1f17113 100644 --- a/htdocs/adherents/class/api_subscriptions.class.php +++ b/htdocs/adherents/class/api_subscriptions.class.php @@ -196,10 +196,8 @@ class Subscriptions extends DolibarrApi if ($subscription->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else - { - throw new RestException(500, $subscription->error); + } else { + throw new RestException(500, $subscription->error); } } diff --git a/htdocs/adherents/class/subscription.class.php b/htdocs/adherents/class/subscription.class.php index e512e1152bb..e1ec3bd1753 100644 --- a/htdocs/adherents/class/subscription.class.php +++ b/htdocs/adherents/class/subscription.class.php @@ -232,14 +232,10 @@ class Subscription extends CommonObject $this->note = $obj->note; $this->fk_bank = $obj->fk_bank; return 1; - } - else - { + } else { return 0; } - } - else - { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -286,9 +282,7 @@ class Subscription extends CommonObject if ($result < 0) { $error++; } //Do also here what you must do to rollback action if trigger fail // End call triggers } - } - else - { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -355,28 +349,20 @@ class Subscription extends CommonObject { $this->db->commit(); return 1; - } - else - { + } else { $this->error = $accountline->error; $this->db->rollback(); return -1; } - } - else - { + } else { $this->db->commit(); return 1; } - } - else - { + } else { $this->db->commit(); return 0; } - } - else - { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -488,9 +474,7 @@ class Subscription extends CommonObject } $this->db->free($result); - } - else - { + } else { dol_print_error($this->db); } } diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 05ccf20169c..291b1916e55 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -158,14 +158,10 @@ if ($id > 0) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; print "

"; - } - else - { + } else { dol_print_error($db); } -} -else -{ +} else { $langs->load("errors"); print $langs->trans("ErrorRecordNotFound"); } diff --git a/htdocs/adherents/htpasswd.php b/htdocs/adherents/htpasswd.php index b7aa8da5d14..385e34d6538 100644 --- a/htdocs/adherents/htpasswd.php +++ b/htdocs/adherents/htpasswd.php @@ -79,9 +79,7 @@ if ($resql) $i++; } print "
\n"; -} -else -{ +} else { dol_print_error($db); } diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 6d069386592..001730d67b1 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -331,9 +331,7 @@ if ($resql) $staticmember->fk_soc = $obj->fk_soc; $staticmember->fetch_thirdparty(); $staticmember->name = $staticmember->thirdparty->name; - } - else - { + } else { $staticmember->name = $obj->company; } $staticmember->ref = $staticmember->getFullName($langs); @@ -349,9 +347,7 @@ if ($resql) } print ""; print "
"; -} -else -{ +} else { dol_print_error($db); } @@ -411,9 +407,7 @@ if ($resql) } print ""; print "
"; -} -else -{ +} else { dol_print_error($db); } diff --git a/htdocs/adherents/ldap.php b/htdocs/adherents/ldap.php index 6a49f99fbf4..43d6a34fcf9 100644 --- a/htdocs/adherents/ldap.php +++ b/htdocs/adherents/ldap.php @@ -176,9 +176,7 @@ if ($result > 0) { $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Member")).''; - } - else - { + } else { $records = $ldap->getAttribute($dn, $search); //print_r($records); @@ -189,23 +187,17 @@ if ($result > 0) if (!is_array($records)) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; - } - else - { + } else { $result = show_ldap_content($records, 0, $records['count'], true); } - } - else - { + } else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } } $ldap->unbind(); $ldap->close(); -} -else -{ +} else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 6cb34192845..72745b54614 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -214,9 +214,7 @@ if (empty($reshook)) if ($result < 0 && !count($tmpmember->errors)) { setEventMessages($tmpmember->error, $tmpmember->errors, 'errors'); - } - else - { + } else { if ($result > 0) $nbclose++; } } @@ -226,9 +224,7 @@ if (empty($reshook)) setEventMessages($langs->trans("XMembersClosed", $nbclose), null, 'mesgs'); $db->commit(); - } - else - { + } else { $db->rollback(); } } @@ -858,17 +854,13 @@ while ($i < min($num, $limit)) print " ".img_warning($langs->trans("SubscriptionLate").$textlate); } print ''; - } - else - { + } else { print ''; if ($obj->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($obj->statut > 0) print " ".img_warning(); - } - else - { + } else { print ' '; } print ''; diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index 7927c2e3f00..70c6ab0689b 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -93,9 +93,7 @@ if ($resql) $i++; } $db->free($resql); -} -else -{ +} else { dol_print_error($db); } @@ -106,13 +104,10 @@ dol_fiche_head($head, 'statsbyproperties', $langs->trans("Statistics"), -1, 'use // Print title -if (!count($data)) -{ +if (!count($data)) { print $langs->trans("NoValidatedMemberYet").'
'; print '
'; -} -else -{ +} else { print $langs->trans("MembersByNature").'
'; print '
'; } diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 5b51008a9a2..bde4d5c949c 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -200,9 +200,7 @@ if ($mode) $i++; } $db->free($resql); - } - else - { + } else { dol_print_error($db); } } @@ -218,15 +216,12 @@ if ($mode && !count($data)) { print $langs->trans("NoValidatedMemberYet").'
'; print '
'; -} -else -{ +} else { if ($mode == 'memberbycountry') print $langs->trans("MembersByCountryDesc").'
'; elseif ($mode == 'memberbystate') print $langs->trans("MembersByStateDesc").'
'; elseif ($mode == 'memberbytown') print $langs->trans("MembersByTownDesc").'
'; elseif ($mode == 'memberbyregion') print $langs->trans("MembersByRegion").'
'; //+ - else - { + else { print $langs->trans("MembersStatisticsDesc").'
'; print '
'; print ''.$langs->trans("MembersStatisticsByCountries").'
'; diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 47866fc8981..3bf821db04e 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -128,13 +128,11 @@ if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights $langs->load("errors"); setEventMessages($company->error, $company->errors, 'errors'); } - else - { + else { $action = 'addsubscription'; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -276,8 +274,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $error++; $action = 'addsubscription'; } - else - { + else { if (!empty($conf->banque->enabled) && $_POST["paymentsave"] != 'none') { if ($_POST["subscription"]) @@ -286,8 +283,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! if ($_POST["paymentsave"] != 'invoiceonly' && !$_POST["operation"]) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("PaymentMode")); if ($_POST["paymentsave"] != 'invoiceonly' && !($_POST["accountid"] > 0)) $errmsg = $langs->trans("ErrorFieldRequired", $langs->transnoentities("FinancialAccount")); } - else - { + else { if ($_POST["accountid"]) $errmsg = $langs->trans("ErrorDoNotProvideAccountsIfNullAmount"); } if ($errmsg) @@ -323,8 +319,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $error++; setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { // If an invoice was created, it is into $object->invoice } } @@ -333,8 +328,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! { $db->commit(); } - else - { + else { $db->rollback(); $action = 'addsubscription'; } @@ -403,13 +397,11 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $errmsg = $object->error; setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("EmailSentToMember", $object->email), null, 'mesgs'); } } - else - { + else { setEventMessages($langs->trans("NoEmailSentToMember"), null, 'mesgs'); } } @@ -548,15 +540,13 @@ if ($rowid > 0) print " ".img_warning($langs->trans("Late")); } } - else - { + else { if (!$adht->subscription) { print $langs->trans("SubscriptionNotRecorded"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled } - else - { + else { print $langs->trans("SubscriptionNotReceived"); if ($object->statut > 0) print " ".img_warning($langs->trans("Late")); // Display a delay picto only if it is not a draft and is not canceled } @@ -587,16 +577,14 @@ if ($rowid > 0) print ''; print ''; } - else - { + else { if ($object->fk_soc) { $company = new Societe($db); $result = $company->fetch($object->fk_soc); print $company->getNomUrl(1); } - else - { + else { print $langs->trans("NoThirdPartyAssociatedToMember"); } } @@ -623,8 +611,7 @@ if ($rowid > 0) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'userid', ''); } - else - { + else { if ($object->user_id) { $form->form_users($_SERVER['PHP_SELF'].'?rowid='.$object->id, $object->user_id, 'none'); @@ -755,9 +742,7 @@ if ($rowid > 0) $accountstatic->ref = $objp->ref; print $accountstatic->getNomUrl(1); - } - else - { + } else { print ' '; } print ''; @@ -773,9 +758,7 @@ if ($rowid > 0) } print ""; - } - else - { + } else { dol_print_error($db); } } @@ -814,9 +797,7 @@ if ($rowid > 0) if (GETPOST('paymentsave') == 'bankdirect') $bankdirect = 1; if (GETPOST('paymentsave') == 'invoiceonly') $invoiceonly = 1; if (GETPOST('paymentsave') == 'bankviainvoice') $bankviainvoice = 1; - } - else - { + } 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; 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; @@ -870,9 +851,7 @@ if ($rowid > 0) { $companyname = $object->company; if (!empty($fullname)) $companyalias = $fullname; - } - else - { + } else { $companyname = $fullname; if (!empty($object->company)) $companyalias = $object->company; } @@ -999,8 +978,7 @@ if ($rowid > 0) //if (empty($object->fk_soc)) print ' disabled'; print '> '.$langs->trans("MoreActionInvoiceOnly"); if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else - { + else { print ' ('; if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); print $langs->trans("NoThirdPartyAssociatedToMember"); @@ -1009,8 +987,7 @@ if ($rowid > 0) print ')'; } if (empty($conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS) || $conf->global->ADHERENT_VAT_FOR_SUBSCRIPTIONS != 'defaultforfoundationcountry') print '. '.$langs->trans("NoVatOnSubscription", 0).''; - if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) - { + if (!empty($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS) && (!empty($conf->product->enabled) || !empty($conf->service->enabled))) { $prodtmp = new Product($db); $prodtmp->fetch($conf->global->ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS); print '. '.$langs->transnoentitiesnoconv("ADHERENT_PRODUCT_ID_FOR_SUBSCRIPTIONS", $prodtmp->getNomUrl(1)); // must use noentitiesnoconv to avoid to encode html into getNomUrl of product @@ -1024,8 +1001,7 @@ if ($rowid > 0) //if (empty($object->fk_soc)) print ' disabled'; print '> '.$langs->trans("MoreActionBankViaInvoice"); if ($object->fk_soc) print ' ('.$langs->trans("ThirdParty").': '.$company->getNomUrl(1).')'; - else - { + else { print ' ('; if (empty($object->fk_soc)) print img_warning($langs->trans("NoThirdPartyAssociatedToMember")); print $langs->trans("NoThirdPartyAssociatedToMember"); @@ -1083,9 +1059,7 @@ if ($rowid > 0) if (!$object->email) { print $langs->trans("NoEMail"); - } - else - { + } else { $adht = new AdherentType($db); $adht->fetch($object->typeid); @@ -1158,9 +1132,7 @@ if ($rowid > 0) //print ''; //print ''; -} -else -{ +} else { $langs->load("errors"); print $langs->trans("ErrorRecordNotFound"); } diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 02941cb9967..303a4aa7b5a 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -85,9 +85,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance if ($accountline->rappro) { $errmsg = $langs->trans("SubscriptionLinkedToConciliatedTransaction"); - } - else - { + } else { $accountline->datev = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->dateo = dol_mktime($_POST['datesubhour'], $_POST['datesubmin'], 0, $_POST['datesubmonth'], $_POST['datesubday'], $_POST['datesubyear']); $accountline->amount = $_POST["amount"]; @@ -116,17 +114,13 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance header("Location: card.php?rowid=".$object->id); exit; - } - else - { + } else { $db->rollback(); if ($object->error) { $errmsg = $object->error; - } - else - { + } else { foreach ($object->errors as $error) { if ($errmsg) $errmsg .= '
'; @@ -135,9 +129,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'update' && !$cance } $action = ''; } - } - else - { + } else { $db->rollback(); } } @@ -151,9 +143,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->adherent- { header("Location: ".DOL_URL_ROOT."/adherents/card.php?rowid=".$object->fk_adherent); exit; - } - else - { + } else { $mesg = $adh->error; } } @@ -248,9 +238,7 @@ if ($user->rights->adherent->cotisation->creer && $action == 'edit') $bankline = new AccountLine($db); $result = $bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1, 0, 'showall'); - } - else - { + } else { print $langs->trans("NoneF"); } print ''; @@ -355,9 +343,7 @@ if ($rowid && $action != 'edit') $bankline = new AccountLine($db); $result = $bankline->fetch($object->fk_bank); print $bankline->getNomUrl(1, 0, 'showall'); - } - else - { + } else { print $langs->trans("NoneF"); } print ''; @@ -382,9 +368,7 @@ if ($rowid && $action != 'edit') if (!$bankline->rappro) { print '"; - } - else - { + } else { print '"; } } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e3059ade21e..66d8c6b773a 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4047,8 +4047,8 @@ function dol_print_error($db = '', $error = '', $errors = null) } if (empty($dolibarr_main_prod)) print $out; - else // This should not happen, except if there is a bug somewhere. Enabled and check log in such case. - { + else { + // This should not happen, except if there is a bug somewhere. Enabled and check log in such case. print 'This website or feature is currently temporarly not available.

This may be due to a maintenance operation. Current status of operation are on next line...

'."\n"; $langs->load("errors"); print $langs->trans("DolibarrHasDetectedError").'. '; From 4be4f975b00db33cc4d7ffed32ce419a5ae34991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 01:03:03 +0200 Subject: [PATCH 03/28] add new rule --- htdocs/index.php | 4 +- htdocs/main.inc.php | 85 +++++++++++++------------------------------ htdocs/master.inc.php | 16 +++----- htdocs/viewimage.php | 25 ++++--------- 4 files changed, 40 insertions(+), 90 deletions(-) diff --git a/htdocs/index.php b/htdocs/index.php index 7f6e462839b..38fde99682c 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -301,9 +301,7 @@ if (empty($user->socid) && empty($conf->global->MAIN_DISABLE_GLOBAL_BOXSTATS)) $board = new $class($db); $board->load_state_board($user); $boardloaded[$class] = $board; - } - else - { + } else { $board = $boardloaded[$class]; } diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 49c48e34ec1..733ded3e447 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -131,17 +131,13 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) if (analyseVarsForSqlAndScriptsInjection($key, $type) && analyseVarsForSqlAndScriptsInjection($value, $type)) { //$var[$key] = $value; // This is useless - } - else - { + } else { print 'Access refused by SQL/Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')'; exit; } } return true; - } - else - { + } else { return (testSqlAndScriptInject($var, $type) <= 0); } } @@ -271,13 +267,11 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV $newurl = preg_replace('/^http:/i', 'https:', $_SERVER["SCRIPT_URI"]); } } - else // Check HTTPS environment variable (Apache/mod_ssl only) - { + else { + // Check HTTPS environment variable (Apache/mod_ssl only) $newurl = preg_replace('/^http:/i', 'https:', DOL_MAIN_URL_ROOT).$_SERVER["REQUEST_URI"]; } - } - else - { + } else { // Check HTTPS environment variable (Apache/mod_ssl only) $newurl = $conf->file->main_force_https.$_SERVER["REQUEST_URI"]; } @@ -288,9 +282,7 @@ if (!empty($conf->file->main_force_https) && (empty($_SERVER["HTTPS"]) || $_SERV dol_syslog("main.inc: dolibarr_main_force_https is on, we make a redirect to ".$newurl); header("Location: ".$newurl); exit; - } - else - { + } else { dol_syslog("main.inc: dolibarr_main_force_https is on but we failed to forge new https url so no redirect is done", LOG_WARNING); } } @@ -432,9 +424,7 @@ if (!defined('NOLOGIN')) if (defined('MAIN_AUTHENTICATION_MODE')) { $dolibarr_main_authentication = constant('MAIN_AUTHENTICATION_MODE'); - } - else - { + } else { // Authentication mode if (empty($dolibarr_main_authentication)) $dolibarr_main_authentication = 'http,dolibarr'; // Authentication mode: forceuser @@ -658,9 +648,7 @@ if (!defined('NOLOGIN')) header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); exit; } - } - else - { + } else { // We are already into an authenticated session $login = $_SESSION["dol_login"]; $entity = $_SESSION["dol_entity"]; @@ -710,9 +698,7 @@ if (!defined('NOLOGIN')) if (GETPOST('lang', 'aZ09')) $paramsurl[] = 'lang='.GETPOST('lang', 'aZ09'); header('Location: '.DOL_URL_ROOT.'/index.php'.(count($paramsurl) ? '?'.implode('&', $paramsurl) : '')); exit; - } - else - { + } else { // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $hookmanager->initHooks(array('main')); @@ -814,9 +800,7 @@ if (!defined('NOLOGIN')) session_destroy(); dol_print_error($db, 'Error in some triggers USER_LOGIN or in some hooks afterLogin'); exit; - } - else - { + } else { $db->commit(); } @@ -986,9 +970,7 @@ if (empty($conf->browser->firefox)) define('ROWS_7', 7); define('ROWS_8', 8); define('ROWS_9', 9); -} -else -{ +} else { define('ROWS_1', 0); define('ROWS_2', 1); define('ROWS_3', 2); @@ -1008,9 +990,8 @@ if (!defined('NOREQUIREMENU')) if (empty($user->socid)) // If internal user or not defined { $conf->standard_menu = (empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENU_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED); - } - else // If external user - { + } else { + // If external user $conf->standard_menu = (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENUFRONT_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED); } @@ -1333,9 +1314,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (preg_match('/^(http|\/\/)/i', $cssfile)) { $urltofile = $cssfile; - } - else - { + } else { $urltofile = dol_buildpath($cssfile, 1); } print ''."\n".''."\n"; @@ -1505,9 +1482,7 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr if (preg_match('/^(http|\/\/)/i', $jsfile)) { print ''."\n"; - } - else - { + } else { print ''."\n"; } } @@ -1606,9 +1581,7 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead $logouttext .= ''; $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin'); $logouttext .= ''; - } - else - { + } else { $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); $logouttext .= img_picto($langs->trans('Logout'), 'sign-out', '', false, 0, 0, '', 'atoplogin opacitymedium'); } @@ -1625,11 +1598,10 @@ function top_menu($head, $title = '', $target = '', $disablejs = 0, $disablehead { if ($result == 0) $toprightmenu .= $hookmanager->resPrint; // add - else + else { $toprightmenu = $hookmanager->resPrint; // replace - } - else - { + } + } else { $toprightmenu .= $result; // For backward compatibility } @@ -2362,8 +2334,9 @@ function main_area($title = '') print ''."\n"; print ''; print ''."\n"; print ''."\n"; print ''."\n"; @@ -2398,9 +2371,7 @@ function getHelpParamFor($helppagename, $langs) $helpbaseurl = '%s'; $helppage = $helppagename; $mode = 'local'; - } - else - { + } else { // If WIKI URL $reg = array(); if (preg_match('/^es/i', $langs->defaultlang)) @@ -2538,10 +2509,8 @@ if (!function_exists("llxFooter")) { $title = img_warning().' '.$langs->trans('CoreErrorTitle'); print ajax_dialog($title, $langs->trans('CoreErrorMessage')); - } - // html version - else - { + } else { + // html version $msg = img_warning().' '.$langs->trans('CoreErrorMessage'); print '
'.$msg.'
'; } @@ -2683,9 +2652,7 @@ if (!function_exists("llxFooter")) \n"; include_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 4005e6a2ed5..1ef1f9c1f50 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -60,14 +60,14 @@ if (defined('TEST_DB_FORCE_TYPE')) $conf->db->type = constant('TEST_DB_FORCE_TYP // Set properties specific to conf file $conf->file->main_limit_users = $dolibarr_main_limit_users; -$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; -$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli; +$conf->file->mailing_limit_sendbyweb = $dolibarr_mailing_limit_sendbyweb; +$conf->file->mailing_limit_sendbycli = $dolibarr_mailing_limit_sendbycli; $conf->file->main_authentication = empty($dolibarr_main_authentication) ? '' : $dolibarr_main_authentication; // Identification mode $conf->file->main_force_https = empty($dolibarr_main_force_https) ? '' : $dolibarr_main_force_https; // Force https -$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) +$conf->file->strict_mode = empty($dolibarr_strict_mode) ? '' : $dolibarr_strict_mode; // Force php strict mode (for debug) $conf->file->instance_unique_id = empty($dolibarr_main_instance_unique_id) ? (empty($dolibarr_main_cookie_cryptkey) ? '' : $dolibarr_main_cookie_cryptkey) : $dolibarr_main_instance_unique_id; // Unique id of instance $conf->file->dol_document_root = array('main' => (string) DOL_DOCUMENT_ROOT); // Define array of document root directories ('/home/htdocs') -$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr') +$conf->file->dol_url_root = array('main' => (string) DOL_URL_ROOT); // Define array of url root path ('' or '/dolibarr') if (!empty($dolibarr_main_document_root_alt)) { // dolibarr_main_document_root_alt can contains several directories @@ -132,9 +132,7 @@ if (!defined('NOREQUIREDB')) $langs->setDefaultLang('auto'); $langs->load("website"); print $langs->trans("SorryWebsiteIsCurrentlyOffLine"); - } - else - { + } else { print "SorryWebsiteIsCurrentlyOffLine"; } print ''; @@ -225,9 +223,7 @@ if (!empty($conf->global->MAIN_ONLY_LOGIN_ALLOWED)) print 'You are logged with user "'.$_SESSION["dol_login"].'" and only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; $nexturl = DOL_URL_ROOT.'/user/logout.php'; print 'Please try later or click here to disconnect and change login user...'."\n"; - } - else - { + } else { print 'Sorry, your application is offline. Only administrator user "'.$conf->global->MAIN_ONLY_LOGIN_ALLOWED.'" is allowed to connect for the moment.'."\n"; $nexturl = DOL_URL_ROOT.'/'; print 'Please try later or click here to change login user...'."\n"; diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index b2534ee92dd..9970026a524 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -155,20 +155,14 @@ if (!empty($hashp)) // We remove first level of directory $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; - } - else - { + } else { accessforbidden('Bad link. File is from another module part.', 0, 0, 1); } - } - else - { + } else { $modulepart = $moduleparttocheck; $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir } - } - else - { + } else { $langs->load("errors"); accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); } @@ -208,9 +202,7 @@ elseif (isset($_GET["publictakepos"])) if (! empty($conf->global->TAKEPOS_AUTO_ORDER)) { $accessallowed = 1; // Only if TakePOS Public Auto Order is enabled and received publictakepos variable } -} -else -{ +} else { // Basic protection (against external users only) if ($user->socid > 0) { @@ -290,9 +282,8 @@ if ($modulepart == 'barcode') { $result = $module->buildBarCode($code, $encoding, $readable); } -} -else // Open and return file -{ +} else { + // Open and return file clearstatcache(); $filename = basename($fullpath_original_file); @@ -314,9 +305,7 @@ else // Open and return file { top_httphead($type); header('Content-Disposition: inline; filename="'.basename($fullpath_original_file).'"'); - } - else - { + } else { top_httphead('image/png'); header('Content-Disposition: inline; filename="'.basename($fullpath_original_file).'"'); } From b70efb5d7b4bdbb76afd8549b62ba64a0b4ca2f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 01:10:33 +0200 Subject: [PATCH 04/28] add new rule --- .travis.yml | 4 ++-- htdocs/filefunc.inc.php | 11 +++-------- htdocs/zapier/admin/setup.php | 3 +-- htdocs/zapier/class/hook.class.php | 2 +- htdocs/zapier/hook_agenda.php | 8 ++------ htdocs/zapier/hook_card.php | 8 ++------ htdocs/zapier/hook_document.php | 4 +--- 7 files changed, 12 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9958556d42d..752dd572371 100644 --- a/.travis.yml +++ b/.travis.yml @@ -291,8 +291,8 @@ script: # Ensure we catch errors set -e # Exclusions are defined in the ruleset.xml file - #phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . - if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi + phpcs -s -n -p -d memory_limit=-1 --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 . + #if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then phpcs -s -p -d memory_limit=-1 --extensions=php --colors --tab-width=4 --standard=dev/setup/codesniffer/ruleset.xml --encoding=utf-8 --runtime-set ignore_warnings_on_exit true .; fi set +e echo diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index b70419de5f4..d1a33d24344 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -87,9 +87,7 @@ if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done // Note: If calling page was an index.php not into htdocs (ie comm/index.php, ...), then this redirect will fails, // but we don't want to change this because when URL is correct, we must be sure the redirect to install/index.php will be correct. $path = ''; - } - else - { + } else { // If what we look is not index.php, we can try to guess location of root. May not work all the time. // There is no real solution, because the only way to know the apache url relative path is to have it into conf file. // If it fails to find correct $path, then only solution is to ask user to enter the correct URL to index.php or install/index.php @@ -114,9 +112,7 @@ if (!$result && !empty($_SERVER["GATEWAY_INTERFACE"])) // If install not done if (!empty($dolibarr_strict_mode)) { error_reporting(E_ALL | E_STRICT); -} -else -{ +} else { error_reporting(E_ALL & ~(E_STRICT | E_NOTICE | E_DEPRECATED)); } @@ -156,8 +152,7 @@ if (!defined('NOCSRFCHECK') && empty($dolibarr_nocsrfcheck)) { $csrfattack = false; if (empty($_SERVER['HTTP_REFERER'])) $csrfattack = true; // An evil browser was used - else - { + else { $tmpa = parse_url($_SERVER['HTTP_HOST']); $tmpb = parse_url($_SERVER['HTTP_REFERER']); if ((empty($tmpa['host']) ? $tmpa['path'] : $tmpa['host']) != (empty($tmpb['host']) ? $tmpb['path'] : $tmpb['host'])) $csrfattack = true; diff --git a/htdocs/zapier/admin/setup.php b/htdocs/zapier/admin/setup.php index e608ece5bb7..8a74b525c2b 100644 --- a/htdocs/zapier/admin/setup.php +++ b/htdocs/zapier/admin/setup.php @@ -110,8 +110,7 @@ if ($action == 'edit') { print '
'; print ''.$langs->trans("Modify").''; print '
'; - } else - { + } else { print '
'.$langs->trans("NothingToSetup"); } } diff --git a/htdocs/zapier/class/hook.class.php b/htdocs/zapier/class/hook.class.php index b985c77434e..280780f8f25 100644 --- a/htdocs/zapier/class/hook.class.php +++ b/htdocs/zapier/class/hook.class.php @@ -398,7 +398,7 @@ class Hook extends CommonObject { $result = $this->fetchCommon($id, $ref); if ($result > 0 && !empty($this->table_element_line)) { - $this->fetchLines(); + //$this->fetchLines(); } return $result; } diff --git a/htdocs/zapier/hook_agenda.php b/htdocs/zapier/hook_agenda.php index ca046392cec..b036057cb04 100644 --- a/htdocs/zapier/hook_agenda.php +++ b/htdocs/zapier/hook_agenda.php @@ -45,9 +45,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else -{ +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -217,9 +215,7 @@ if ($object->id > 0) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print ''.$langs->trans("AddAction").''; - } - else - { + } else { print ''.$langs->trans("AddAction").''; } } diff --git a/htdocs/zapier/hook_card.php b/htdocs/zapier/hook_card.php index c2755892716..660e972cf28 100644 --- a/htdocs/zapier/hook_card.php +++ b/htdocs/zapier/hook_card.php @@ -338,9 +338,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->mymodule->write) { print ''.$langs->trans("Modify").''."\n"; - } - else - { + } else { print ''.$langs->trans('Modify').''."\n"; } @@ -367,9 +365,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->mymodule->delete) { print ''.$langs->trans('Delete').''."\n"; - } - else - { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/zapier/hook_document.php b/htdocs/zapier/hook_document.php index cdc5f8c7ddf..4c390a118e2 100644 --- a/htdocs/zapier/hook_document.php +++ b/htdocs/zapier/hook_document.php @@ -132,9 +132,7 @@ if ($object->id) print ''; dol_fiche_end(); -} -else -{ +} else { accessforbidden('', 0, 0); } From ee6fadd0d57dd74c8ecfa52f6f18c530c6928486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 01:41:27 +0200 Subject: [PATCH 05/28] add new rule --- dev/tools/dolibarr-postgres2mysql.php | 21 +- dev/translation/autotranslator.class.php | 19 +- dev/translation/sanity_check_en_langfiles.php | 6 +- dev/translation/strip_language_file.php | 9 +- htdocs/admin/agenda.php | 6 +- htdocs/admin/agenda_extsites.php | 9 +- htdocs/admin/agenda_other.php | 30 +- htdocs/admin/agenda_reminder.php | 12 +- htdocs/admin/agenda_xcal.php | 3 +- htdocs/admin/bank.php | 12 +- htdocs/admin/barcode.php | 15 +- htdocs/admin/bom.php | 33 +- htdocs/admin/boxes.php | 15 +- htdocs/admin/chequereceipts.php | 12 +- htdocs/admin/clicktodial.php | 6 +- htdocs/admin/commande.php | 48 +- htdocs/admin/company.php | 42 +- htdocs/admin/compta.php | 3 +- htdocs/admin/confexped.php | 3 +- htdocs/admin/const.php | 21 +- htdocs/admin/contract.php | 30 +- htdocs/admin/dav.php | 9 +- htdocs/admin/debugbar.php | 3 +- htdocs/admin/defaultvalues.php | 24 +- htdocs/admin/delais.php | 3 +- htdocs/admin/dict.php | 42 +- .../class/PSWebServiceLibrary.class.php | 22 +- .../admin/dolistore/class/dolistore.class.php | 6 +- htdocs/admin/ecm.php | 9 +- htdocs/admin/emailcollector_card.php | 30 +- htdocs/admin/emailcollector_list.php | 3 +- htdocs/admin/expedition.php | 27 +- htdocs/admin/expensereport.php | 30 +- htdocs/admin/expensereport_ik.php | 3 +- htdocs/admin/expensereport_rules.php | 27 +- htdocs/admin/external_rss.php | 21 +- htdocs/admin/facture.php | 48 +- htdocs/admin/fckeditor.php | 9 +- htdocs/admin/fichinter.php | 36 +- htdocs/admin/geoipmaxmind.php | 6 +- htdocs/admin/holiday.php | 30 +- htdocs/admin/ihm.php | 6 +- htdocs/admin/ldap.php | 21 +- htdocs/admin/ldap_contacts.php | 9 +- htdocs/admin/ldap_groups.php | 9 +- htdocs/admin/ldap_members.php | 9 +- htdocs/admin/ldap_members_types.php | 9 +- htdocs/admin/ldap_users.php | 15 +- htdocs/admin/limits.php | 9 +- htdocs/admin/livraison.php | 30 +- htdocs/admin/loan.php | 6 +- htdocs/admin/mailing.php | 3 +- htdocs/admin/mailman.php | 15 +- htdocs/admin/mails.php | 42 +- htdocs/admin/mails_emailing.php | 39 +- htdocs/admin/mails_senderprofile_list.php | 3 +- htdocs/admin/mails_templates.php | 45 +- htdocs/admin/menus.php | 3 +- htdocs/admin/menus/edit.php | 30 +- htdocs/admin/menus/index.php | 6 +- htdocs/admin/menus/other.php | 3 +- htdocs/admin/modulehelp.php | 18 +- htdocs/admin/modules.php | 65 +- htdocs/admin/mrp.php | 33 +- htdocs/admin/multicurrency.php | 9 +- htdocs/admin/notification.php | 9 +- htdocs/admin/oauth.php | 3 +- htdocs/admin/oauthlogintokens.php | 15 +- htdocs/admin/payment.php | 6 +- htdocs/admin/pdf.php | 3 +- htdocs/admin/perms.php | 3 +- htdocs/admin/prelevement.php | 3 +- htdocs/admin/propal.php | 48 +- htdocs/admin/receiptprinter.php | 6 +- htdocs/admin/reception_setup.php | 24 +- htdocs/admin/resource.php | 3 +- htdocs/admin/security.php | 24 +- htdocs/admin/security_other.php | 21 +- htdocs/admin/sms.php | 9 +- htdocs/admin/socialnetworks.php | 6 +- htdocs/admin/spip.php | 6 +- htdocs/admin/stock.php | 30 +- htdocs/admin/supplier_invoice.php | 27 +- htdocs/admin/supplier_order.php | 36 +- htdocs/admin/supplier_payment.php | 21 +- htdocs/admin/supplier_proposal.php | 45 +- htdocs/admin/syslog.php | 6 +- htdocs/admin/system/about.php | 3 +- htdocs/admin/system/constall.php | 6 +- htdocs/admin/system/database-tables.php | 6 +- htdocs/admin/system/database.php | 3 +- htdocs/admin/system/dbtable.php | 3 +- htdocs/admin/system/dolibarr.php | 18 +- htdocs/admin/system/filecheck.php | 33 +- htdocs/admin/system/modules.php | 9 +- htdocs/admin/system/perf.php | 36 +- htdocs/admin/system/phpinfo.php | 21 +- htdocs/admin/system/xdebug.php | 6 +- htdocs/admin/taxes.php | 18 +- htdocs/admin/ticket.php | 3 +- htdocs/admin/ticket_public.php | 3 +- htdocs/admin/tools/dolibarr_export.php | 17 +- htdocs/admin/tools/dolibarr_import.php | 3 +- htdocs/admin/tools/export.php | 3 +- htdocs/admin/tools/export_files.php | 3 +- htdocs/admin/tools/listevents.php | 6 +- htdocs/admin/tools/listsessions.php | 6 +- htdocs/admin/tools/update.php | 6 +- htdocs/admin/translation.php | 30 +- htdocs/admin/user.php | 33 +- htdocs/admin/usergroup.php | 18 +- htdocs/admin/website.php | 24 +- htdocs/admin/website_options.php | 3 +- htdocs/admin/workflow.php | 9 +- htdocs/api/admin/index.php | 12 +- htdocs/api/class/api.class.php | 3 +- htdocs/api/class/api_access.class.php | 3 +- htdocs/api/class/api_login.class.php | 3 +- htdocs/api/class/api_setup.class.php | 33 +- htdocs/api/index.php | 3 +- htdocs/asset/admin/setup.php | 3 +- htdocs/asset/card.php | 6 +- htdocs/asset/class/asset.class.php | 3 +- htdocs/asset/class/asset_type.class.php | 24 +- htdocs/asset/document.php | 3 +- htdocs/asset/list.php | 3 +- htdocs/asset/type.php | 18 +- htdocs/asterisk/cidlookup.php | 3 +- htdocs/asterisk/wrapper.php | 6 +- htdocs/barcode/codeinit.php | 15 +- htdocs/barcode/printsheet.php | 3 +- htdocs/blockedlog/admin/blockedlog.php | 6 +- htdocs/blockedlog/admin/blockedlog_list.php | 24 +- htdocs/blockedlog/ajax/block-info.php | 3 +- htdocs/blockedlog/class/authority.class.php | 15 +- htdocs/blockedlog/class/blockedlog.class.php | 20 +- htdocs/bom/bom_agenda.php | 6 +- htdocs/bom/bom_card.php | 15 +- htdocs/bom/bom_document.php | 3 +- htdocs/bom/bom_list.php | 15 +- htdocs/bom/class/api_boms.class.php | 3 +- htdocs/bom/class/bom.class.php | 21 +- htdocs/bom/tpl/objectline_create.tpl.php | 3 +- htdocs/bookmarks/admin/bookmark.php | 3 +- htdocs/bookmarks/bookmarks.lib.php | 6 +- htdocs/bookmarks/card.php | 18 +- htdocs/bookmarks/class/bookmark.class.php | 15 +- htdocs/bookmarks/list.php | 12 +- htdocs/cashdesk/admin/cashdesk.php | 9 +- htdocs/cashdesk/affContenu.php | 6 +- htdocs/cashdesk/class/Auth.class.php | 3 +- htdocs/cashdesk/class/Facturation.class.php | 18 +- htdocs/cashdesk/facturation.php | 12 +- htdocs/cashdesk/facturation_dhtml.php | 6 +- htdocs/cashdesk/facturation_verif.php | 15 +- htdocs/cashdesk/index.php | 6 +- htdocs/cashdesk/index_verif.php | 6 +- htdocs/cashdesk/tpl/liste_articles.tpl.php | 3 +- htdocs/cashdesk/tpl/validation1.tpl.php | 3 +- htdocs/cashdesk/validation_verif.php | 18 +- htdocs/comm/action/card.php | 66 +- htdocs/comm/action/class/actioncomm.class.php | 69 +- .../comm/action/class/cactioncomm.class.php | 9 +- htdocs/comm/action/class/ical.class.php | 9 +- htdocs/comm/action/document.php | 6 +- htdocs/comm/action/index.php | 82 +- htdocs/comm/action/list.php | 21 +- htdocs/comm/action/pertype.php | 36 +- htdocs/comm/action/peruser.php | 42 +- htdocs/comm/action/rapport/index.php | 3 +- htdocs/comm/card.php | 54 +- htdocs/comm/contact.php | 3 +- htdocs/comm/index.php | 36 +- htdocs/comm/mailing/advtargetemailing.php | 3 +- htdocs/comm/mailing/card.php | 99 +- htdocs/comm/mailing/cibles.php | 39 +- .../mailing/class/advtargetemailing.class.php | 21 +- .../html.formadvtargetemailing.class.php | 6 +- htdocs/comm/mailing/class/mailing.class.php | 39 +- htdocs/comm/mailing/index.php | 9 +- htdocs/comm/mailing/list.php | 9 +- htdocs/comm/multiprix.php | 3 +- htdocs/comm/propal/card.php | 45 +- .../comm/propal/class/api_proposals.class.php | 6 +- htdocs/comm/propal/class/propal.class.php | 200 +- htdocs/comm/propal/contact.php | 12 +- htdocs/comm/propal/document.php | 3 +- htdocs/comm/propal/index.php | 6 +- htdocs/comm/propal/list.php | 15 +- htdocs/comm/propal/stats/index.php | 9 +- htdocs/comm/prospect/index.php | 3 +- htdocs/comm/prospect/recap-prospect.php | 3 +- htdocs/comm/recap-client.php | 3 +- htdocs/comm/remise.php | 18 +- htdocs/comm/remx.php | 60 +- htdocs/commande/card.php | 63 +- htdocs/commande/class/api_orders.class.php | 3 +- htdocs/commande/class/commande.class.php | 200 +- htdocs/commande/contact.php | 12 +- htdocs/commande/customer.php | 3 +- htdocs/commande/document.php | 6 +- htdocs/commande/index.php | 6 +- htdocs/commande/list.php | 9 +- htdocs/commande/orderstoinvoice.php | 27 +- htdocs/commande/stats/index.php | 9 +- htdocs/core/actions_addupdatedelete.inc.php | 41 +- htdocs/core/actions_builddoc.inc.php | 6 +- htdocs/core/actions_comments.inc.php | 9 +- htdocs/core/actions_extrafields.inc.php | 33 +- htdocs/core/actions_fetchobject.inc.php | 3 +- htdocs/core/actions_linkedfiles.inc.php | 17 +- htdocs/core/actions_massactions.inc.php | 78 +- htdocs/core/actions_sendmails.inc.php | 15 +- htdocs/core/actions_setmoduleoptions.inc.php | 9 +- htdocs/core/ajax/ajaxdirpreview.php | 14 +- htdocs/core/ajax/ajaxdirtree.php | 2 +- htdocs/core/ajax/check_notifications.php | 6 +- htdocs/core/ajax/loadinplace.php | 6 +- htdocs/core/ajax/saveinplace.php | 15 +- htdocs/core/ajax/vatrates.php | 3 +- htdocs/core/ajax/ziptown.php | 5 +- htdocs/core/boxes/box_actions.php | 3 +- htdocs/core/boxes/box_activity.php | 3 +- htdocs/core/boxes/box_bookmarks.php | 3 +- htdocs/core/boxes/box_external_rss.php | 3 +- htdocs/core/boxes/box_factures_imp.php | 3 +- htdocs/core/boxes/box_ficheinter.php | 6 +- .../boxes/box_graph_invoices_permonth.php | 12 +- .../box_graph_invoices_supplier_permonth.php | 12 +- .../core/boxes/box_graph_orders_permonth.php | 12 +- .../box_graph_orders_supplier_permonth.php | 12 +- .../boxes/box_graph_product_distribution.php | 6 +- .../boxes/box_graph_propales_permonth.php | 12 +- htdocs/core/boxes/box_produits.php | 3 +- .../core/boxes/box_produits_alerte_stock.php | 6 +- htdocs/core/boxes/box_project.php | 3 +- htdocs/core/boxes/box_services_contracts.php | 6 +- htdocs/core/boxes/box_services_expired.php | 6 +- htdocs/core/boxes/box_supplier_orders.php | 3 +- ...box_supplier_orders_awaiting_reception.php | 3 +- htdocs/core/boxes/modules_boxes.php | 9 +- htdocs/core/class/CMailFile.class.php | 51 +- htdocs/core/class/CSMSFile.class.php | 15 +- htdocs/core/class/ccountry.class.php | 12 +- htdocs/core/class/comment.class.php | 9 +- .../core/class/commondocgenerator.class.php | 5 +- htdocs/core/class/commoninvoice.class.php | 39 +- htdocs/core/class/commonobject.class.php | 383 +-- htdocs/core/class/commonobjectline.class.php | 3 +- htdocs/core/class/conf.class.php | 3 +- htdocs/core/class/coreobject.class.php | 33 +- htdocs/core/class/cstate.class.php | 9 +- htdocs/core/class/ctypent.class.php | 12 +- htdocs/core/class/cunits.class.php | 24 +- htdocs/core/class/discount.class.php | 51 +- htdocs/core/class/dolgeoip.class.php | 18 +- htdocs/core/class/dolgraph.class.php | 33 +- .../core/class/emailsenderprofile.class.php | 3 +- htdocs/core/class/evalmath.class.php | 6 +- htdocs/core/class/events.class.php | 6 +- htdocs/core/class/extrafields.class.php | 88 +- htdocs/core/class/extralanguages.class.php | 37 +- htdocs/core/class/fileupload.class.php | 9 +- htdocs/core/class/fiscalyear.class.php | 18 +- htdocs/core/class/hookmanager.class.php | 3 +- htdocs/core/class/html.form.class.php | 398 +-- .../core/class/html.formaccounting.class.php | 18 +- htdocs/core/class/html.formactions.class.php | 12 +- htdocs/core/class/html.formadmin.class.php | 12 +- htdocs/core/class/html.formcompany.class.php | 36 +- htdocs/core/class/html.formcontract.class.php | 12 +- htdocs/core/class/html.formfile.class.php | 138 +- .../class/html.formintervention.class.php | 12 +- htdocs/core/class/html.formmail.class.php | 54 +- htdocs/core/class/html.formmargin.class.php | 3 +- htdocs/core/class/html.formother.class.php | 56 +- htdocs/core/class/html.formprojet.class.php | 36 +- htdocs/core/class/html.formpropal.class.php | 9 +- htdocs/core/class/html.formsms.class.php | 30 +- .../class/html.formsocialcontrib.class.php | 9 +- htdocs/core/class/html.formwebsite.class.php | 18 +- htdocs/core/class/infobox.class.php | 20 +- htdocs/core/class/interfaces.class.php | 15 +- htdocs/core/class/ldap.class.php | 92 +- htdocs/core/class/lessc.class.php | 2663 +++++++++-------- htdocs/core/class/link.class.php | 18 +- htdocs/core/class/menubase.class.php | 21 +- htdocs/core/class/notify.class.php | 30 +- htdocs/core/class/openid.class.php | 12 +- htdocs/core/class/rssparser.class.php | 36 +- htdocs/core/class/smtps.class.php | 51 +- htdocs/core/class/stats.class.php | 21 +- htdocs/core/class/translate.class.php | 17 +- htdocs/core/class/utils.class.php | 44 +- htdocs/core/commonfieldsinexport.inc.php | 3 +- htdocs/core/datepicker.php | 18 +- htdocs/core/db/DoliDB.class.php | 17 +- htdocs/core/db/mssql.class.php | 57 +- htdocs/core/db/mysqli.class.php | 27 +- htdocs/core/db/pgsql.class.php | 24 +- htdocs/core/db/sqlite3.class.php | 15 +- htdocs/core/extrafieldsinexport.inc.php | 3 +- .../filemanagerdol/connectors/php/basexml.php | 6 +- .../connectors/php/commands.php | 24 +- .../core/filemanagerdol/connectors/php/io.php | 12 +- .../filemanagerdol/connectors/php/util.php | 6 +- htdocs/core/get_info.php | 5 +- htdocs/core/get_menudiv.php | 2 +- htdocs/core/lib/admin.lib.php | 63 +- htdocs/core/lib/agenda.lib.php | 6 +- htdocs/core/lib/ajax.lib.php | 3 +- htdocs/core/lib/bank.lib.php | 3 +- htdocs/core/lib/barcode.lib.php | 9 +- htdocs/core/lib/company.lib.php | 39 +- htdocs/core/lib/cron.lib.php | 3 +- htdocs/core/lib/date.lib.php | 33 +- htdocs/core/lib/doc.lib.php | 9 +- htdocs/core/lib/doleditor.lib.php | 3 +- htdocs/core/lib/ecm.lib.php | 3 +- htdocs/core/lib/files.lib.php | 101 +- htdocs/core/lib/format_cards.lib.php | 3 +- htdocs/core/lib/functions.lib.php | 247 +- htdocs/core/lib/functions2.lib.php | 68 +- htdocs/core/lib/functionsnumtoword.lib.php | 3 +- htdocs/core/lib/geturl.lib.php | 12 +- htdocs/core/lib/images.lib.php | 12 +- htdocs/core/lib/invoice2.lib.php | 6 +- htdocs/core/lib/json.lib.php | 8 +- htdocs/core/lib/ldap.lib.php | 3 +- htdocs/core/lib/memory.lib.php | 18 +- htdocs/core/lib/modulebuilder.lib.php | 15 +- htdocs/core/lib/parsemd.lib.php | 3 +- htdocs/core/lib/payments.lib.php | 15 +- htdocs/core/lib/pdf.lib.php | 52 +- htdocs/core/lib/price.lib.php | 20 +- htdocs/core/lib/product.lib.php | 3 +- htdocs/core/lib/project.lib.php | 27 +- htdocs/core/lib/security.lib.php | 18 +- htdocs/core/lib/security2.lib.php | 23 +- htdocs/core/lib/sendings.lib.php | 12 +- htdocs/core/lib/signature.lib.php | 6 +- htdocs/core/lib/tax.lib.php | 33 +- htdocs/core/lib/ticket.lib.php | 21 +- htdocs/core/lib/treeview.lib.php | 9 +- htdocs/core/lib/usergroups.lib.php | 105 +- htdocs/core/lib/website.lib.php | 47 +- htdocs/core/lib/xcal.lib.php | 9 +- htdocs/core/login/functions_dolibarr.php | 12 +- htdocs/core/login/functions_ldap.php | 6 +- htdocs/core/login/functions_openid.php | 6 +- htdocs/core/menus/standard/auguria.lib.php | 12 +- htdocs/core/menus/standard/auguria_menu.php | 26 +- htdocs/core/menus/standard/eldy.lib.php | 18 +- htdocs/core/menus/standard/eldy_menu.php | 26 +- htdocs/core/menus/standard/empty.php | 20 +- htdocs/core/modules/DolibarrModules.class.php | 89 +- htdocs/core/modules/action/modules_action.php | 9 +- htdocs/core/modules/action/rapport.pdf.php | 3 +- .../core/modules/bank/doc/pdf_ban.modules.php | 15 +- .../bank/doc/pdf_sepamandate.modules.php | 15 +- .../barcode/mod_barcode_product_standard.php | 18 +- .../bom/doc/doc_generic_bom_odt.modules.php | 20 +- htdocs/core/modules/bom/mod_bom_standard.php | 3 +- .../modules/cheque/mod_chequereceipt_mint.php | 3 +- .../modules/cheque/modules_chequereceipts.php | 9 +- .../doc/doc_generic_order_odt.modules.php | 20 +- .../commande/doc/pdf_einstein.modules.php | 38 +- .../commande/doc/pdf_eratosthene.modules.php | 53 +- .../modules/commande/mod_commande_marbre.php | 3 +- .../doc/doc_generic_contract_odt.modules.php | 20 +- .../contract/doc/pdf_strato.modules.php | 32 +- .../modules/contract/mod_contract_serpis.php | 3 +- .../modules/dons/html_cerfafr.modules.php | 30 +- .../doc/doc_generic_shipment_odt.modules.php | 25 +- .../expedition/doc/pdf_espadon.modules.php | 53 +- .../expedition/doc/pdf_merou.modules.php | 30 +- .../expedition/doc/pdf_rouget.modules.php | 50 +- .../expedition/mod_expedition_safor.php | 3 +- .../doc/pdf_standard.modules.php | 38 +- .../expensereport/mod_expensereport_jade.php | 3 +- .../modules/export/export_csv.modules.php | 6 +- .../export/export_excel2007new.modules.php | 12 +- .../doc/doc_generic_invoice_odt.modules.php | 17 +- .../modules/facture/doc/pdf_crabe.modules.php | 47 +- .../facture/doc/pdf_sponge.modules.php | 59 +- .../core/modules/facture/mod_facture_mars.php | 3 +- .../modules/facture/mod_facture_terre.php | 3 +- .../fichinter/doc/pdf_soleil.modules.php | 29 +- htdocs/core/modules/fichinter/mod_pacific.php | 3 +- .../modules/fichinter/modules_fichinter.php | 9 +- .../modules/holiday/mod_holiday_madonna.php | 3 +- .../modules/import/import_csv.modules.php | 50 +- .../modules/import/import_xlsx.modules.php | 41 +- .../livraison/doc/pdf_typhon.modules.php | 32 +- .../modules/livraison/mod_livraison_jade.php | 3 +- .../mailings/advthirdparties.modules.php | 9 +- .../modules/mailings/contacts1.modules.php | 12 +- .../core/modules/mailings/fraise.modules.php | 9 +- .../modules/mailings/modules_mailings.php | 6 +- .../core/modules/mailings/pomme.modules.php | 3 +- .../modules/mailings/thirdparties.modules.php | 15 +- .../thirdparties_services_expired.modules.php | 6 +- .../modules/mailings/xinputfile.modules.php | 11 +- .../modules/mailings/xinputuser.modules.php | 6 +- .../modules/member/doc/pdf_standard.class.php | 19 +- htdocs/core/modules/member/modules_cards.php | 9 +- htdocs/core/modules/modAgenda.class.php | 3 +- htdocs/core/modules/modBlockedLog.class.php | 3 +- .../mrp/doc/doc_generic_mo_odt.modules.php | 20 +- htdocs/core/modules/mrp/mod_mo_standard.php | 3 +- .../modules/oauth/github_oauthcallback.php | 3 +- .../modules/oauth/google_oauthcallback.php | 3 +- .../oauth/stripelive_oauthcallback.php | 3 +- .../oauth/stripetest_oauthcallback.php | 3 +- .../modules/payment/mod_payment_cicada.php | 3 +- .../modules/printing/printgcp.modules.php | 15 +- .../modules/printing/printipp.modules.php | 6 +- .../doc/pdf_standardlabel.class.php | 10 +- .../printsheet/doc/pdf_tcpdflabel.class.php | 10 +- .../modules/printsheet/modules_labels.php | 9 +- .../doc/doc_generic_product_odt.modules.php | 20 +- .../product/doc/pdf_standard.modules.php | 18 +- .../product/mod_codeproduct_elephant.php | 9 +- .../modules/product/modules_product.class.php | 3 +- .../doc/doc_generic_project_odt.modules.php | 47 +- .../project/doc/pdf_baleine.modules.php | 29 +- .../project/doc/pdf_beluga.modules.php | 26 +- .../project/doc/pdf_timespent.modules.php | 29 +- .../modules/project/mod_project_simple.php | 6 +- .../task/doc/doc_generic_task_odt.modules.php | 29 +- .../modules/project/task/mod_task_simple.php | 6 +- .../doc/doc_generic_proposal_odt.modules.php | 20 +- .../modules/propale/doc/pdf_azur.modules.php | 53 +- .../modules/propale/doc/pdf_cyan.modules.php | 56 +- .../modules/propale/mod_propale_marbre.php | 6 +- .../modules/rapport/pdf_paiement.class.php | 9 +- .../doc/doc_generic_reception_odt.modules.php | 23 +- .../reception/doc/pdf_squille.modules.php | 47 +- .../modules/reception/mod_reception_beryl.php | 3 +- .../societe/doc/doc_generic_odt.modules.php | 17 +- .../societe/mod_codeclient_elephant.php | 9 +- .../modules/societe/mod_codeclient_monkey.php | 24 +- .../societe/mod_codecompta_aquarium.php | 12 +- .../societe/mod_codecompta_digitaria.php | 15 +- .../modules/societe/modules_societe.class.php | 3 +- .../doc/doc_generic_stock_odt.modules.php | 20 +- .../stock/doc/pdf_standard.modules.php | 47 +- .../stock/doc/pdf_stdmovement.modules.php | 53 +- .../doc/pdf_canelle.modules.php | 35 +- .../mod_facture_fournisseur_cactus.php | 3 +- ...doc_generic_supplier_order_odt.modules.php | 23 +- .../supplier_order/doc/pdf_cornas.modules.php | 50 +- .../doc/pdf_muscadet.modules.php | 47 +- .../mod_commande_fournisseur_muguet.php | 3 +- .../doc/pdf_standard.modules.php | 32 +- .../mod_supplier_payment_bronan.php | 3 +- ..._generic_supplier_proposal_odt.modules.php | 23 +- .../doc/pdf_aurore.modules.php | 47 +- .../mod_supplier_proposal_marbre.php | 6 +- .../core/modules/syslog/mod_syslog_file.php | 3 +- .../core/modules/syslog/mod_syslog_syslog.php | 3 +- .../user/doc/doc_generic_user_odt.modules.php | 14 +- .../doc/doc_generic_usergroup_odt.modules.php | 23 +- htdocs/core/photos_resize.php | 17 +- htdocs/core/search.php | 3 +- htdocs/core/search_page.php | 3 +- .../core/tpl/admin_extrafields_edit.tpl.php | 3 +- .../core/tpl/admin_extrafields_view.tpl.php | 3 +- htdocs/core/tpl/bloc_comment.tpl.php | 6 +- htdocs/core/tpl/card_presend.tpl.php | 9 +- htdocs/core/tpl/contacts.tpl.php | 3 +- .../tpl/extrafields_list_print_fields.tpl.php | 3 +- .../tpl/extrafields_list_search_input.tpl.php | 3 +- .../tpl/extrafields_list_search_title.tpl.php | 3 +- htdocs/core/tpl/extrafields_view.tpl.php | 9 +- htdocs/core/tpl/filemanager.tpl.php | 5 +- htdocs/core/tpl/list_print_total.tpl.php | 3 +- htdocs/core/tpl/login.tpl.php | 3 +- htdocs/core/tpl/massactions_pre.tpl.php | 6 +- htdocs/core/tpl/object_discounts.tpl.php | 3 +- htdocs/core/tpl/objectline_create.tpl.php | 21 +- htdocs/core/tpl/objectline_edit.tpl.php | 6 +- htdocs/core/tpl/objectline_view.tpl.php | 12 +- htdocs/core/tpl/resource_view.tpl.php | 3 +- .../interface_20_all_Logevents.class.php | 3 +- ...terface_50_modAgenda_ActionsAuto.class.php | 14 +- ..._modBlockedlog_ActionsBlockedLog.class.php | 3 +- ...odMailmanspip_Mailmanspipsynchro.class.php | 18 +- ...terface_50_modTicket_TicketEmail.class.php | 3 +- .../interface_80_modStripe_Stripe.class.php | 3 +- htdocs/core/website.inc.php | 3 +- htdocs/stripe/admin/stripe.php | 18 +- htdocs/stripe/charge.php | 12 +- htdocs/stripe/class/actions_stripe.class.php | 6 +- htdocs/stripe/class/stripe.class.php | 36 +- htdocs/stripe/config.php | 3 +- htdocs/stripe/payout.php | 6 +- htdocs/stripe/transaction.php | 6 +- htdocs/supplier_proposal/card.php | 33 +- .../class/supplier_proposal.class.php | 156 +- htdocs/supplier_proposal/contact.php | 12 +- htdocs/supplier_proposal/document.php | 3 +- htdocs/supplier_proposal/index.php | 6 +- htdocs/supplier_proposal/list.php | 6 +- htdocs/support/inc.php | 6 +- htdocs/takepos/admin/bar.php | 3 +- htdocs/takepos/admin/orderprinters.php | 6 +- htdocs/takepos/admin/receipt.php | 18 +- htdocs/takepos/admin/setup.php | 6 +- htdocs/takepos/admin/terminal.php | 9 +- htdocs/takepos/ajax/ajax.php | 3 +- htdocs/takepos/genimg/index.php | 6 +- htdocs/takepos/index.php | 12 +- htdocs/takepos/invoice.php | 36 +- htdocs/takepos/pay.php | 6 +- htdocs/takepos/phone.php | 3 +- htdocs/takepos/reduction.php | 6 +- htdocs/theme/eldy/global.inc.php | 6 +- htdocs/theme/eldy/theme_vars.inc.php | 3 +- htdocs/theme/md/style.css.php | 6 +- htdocs/theme/md/theme_vars.inc.php | 3 +- htdocs/ticket/agenda.php | 3 +- htdocs/ticket/card.php | 3 +- htdocs/ticket/class/actions_ticket.class.php | 3 +- htdocs/ticket/class/ticket.class.php | 12 +- htdocs/ticket/document.php | 3 +- htdocs/ticket/list.php | 3 +- htdocs/ticket/messaging.php | 3 +- htdocs/ticket/stats/index.php | 9 +- htdocs/user/bank.php | 18 +- htdocs/user/card.php | 180 +- htdocs/user/class/api_users.class.php | 6 +- htdocs/user/class/user.class.php | 179 +- htdocs/user/class/userbankaccount.class.php | 12 +- htdocs/user/class/usergroup.class.php | 39 +- htdocs/user/clicktodial.php | 8 +- htdocs/user/document.php | 3 +- htdocs/user/group/card.php | 36 +- htdocs/user/group/ldap.php | 12 +- htdocs/user/group/list.php | 6 +- htdocs/user/group/perms.php | 9 +- htdocs/user/hierarchy.php | 9 +- htdocs/user/home.php | 15 +- htdocs/user/ldap.php | 12 +- htdocs/user/list.php | 6 +- htdocs/user/note.php | 3 +- htdocs/user/notify/card.php | 27 +- htdocs/user/param_ihm.php | 9 +- htdocs/user/passwordforgotten.php | 24 +- htdocs/user/perms.php | 12 +- htdocs/variants/combinations.php | 12 +- htdocs/variants/create.php | 3 +- htdocs/webservices/admin/index.php | 3 +- htdocs/webservices/server_actioncomm.php | 15 +- htdocs/webservices/server_category.php | 6 +- htdocs/webservices/server_contact.php | 12 +- htdocs/webservices/server_invoice.php | 21 +- htdocs/webservices/server_order.php | 24 +- htdocs/webservices/server_other.php | 3 +- htdocs/webservices/server_payment.php | 3 +- .../webservices/server_productorservice.php | 42 +- htdocs/webservices/server_project.php | 15 +- .../webservices/server_supplier_invoice.php | 9 +- htdocs/webservices/server_thirdparty.php | 24 +- htdocs/webservices/server_user.php | 42 +- 565 files changed, 5190 insertions(+), 8632 deletions(-) diff --git a/dev/tools/dolibarr-postgres2mysql.php b/dev/tools/dolibarr-postgres2mysql.php index f2794455ca3..c17a73dfe12 100644 --- a/dev/tools/dolibarr-postgres2mysql.php +++ b/dev/tools/dolibarr-postgres2mysql.php @@ -76,14 +76,12 @@ function getfieldname($l) if (preg_match("/`(.*)`/", $l, $regs)) { if ($regs[1]) return $regs[1]; - else - return null; + else return null; } // if its not in quotes, then it should (we hope!) be the first "word" on the line, up to the first space. elseif (preg_match("/([^\ ]*)/", trim($l), $regs)) { if ($regs[1]) return $regs[1]; - else - return null; + else return null; } } @@ -102,8 +100,7 @@ function formatsize($s) return sprintf("%.1f", round($s / 1024, 1)) . "K"; elseif ($s < pow(2, 30)) return sprintf("%.1f", round($s / 1024 / 1024, 1)) . "M"; - else - return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G"; + else return sprintf("%.1f", round($s / 1024 / 1024 / 1024, 1)) . "G"; } /** @@ -146,8 +143,7 @@ function pg2mysql_large($infilename, $outfilename) if ($c % 2 != 0) { if ($inquotes) $inquotes = false; - else - $inquotes = true; + else $inquotes = true; } if ($linenum % 10000 == 0) { @@ -329,8 +325,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $num = $regs[1]; if ($num <= 255) $line = preg_replace("/ character varying\([0-9]*\)/", " varchar($num)", $line); - else - $line = preg_replace("/ character varying\([0-9]*\)/", " text", $line); + else $line = preg_replace("/ character varying\([0-9]*\)/", " text", $line); } // character varying with no size, we will default to varchar(255) if (preg_match("/ character varying/", $line)) { @@ -352,8 +347,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) $num = $regs[1]; if ($num <= 255) $line = preg_replace("/ character\([0-9]*\)/", " varchar($num)", $line); - else - $line = preg_replace("/ character\([0-9]*\)/", " text", $line); + else $line = preg_replace("/ character\([0-9]*\)/", " text", $line); } // timestamps $line = str_replace(" timestamp with time zone", " datetime", $line); @@ -465,8 +459,7 @@ function pg2mysql(&$input, &$arrayofprimaryalreadyintabledef, $header = true) if ($c % 2 != 0) { if ($inquotes) $inquotes = false; - else - $inquotes = true; + else $inquotes = true; // echo "inquotes=$inquotes\n"; } } while (substr($lines[$linenumber], - 3, - 1) != ");" || $inquotes); diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index f9657482c86..b51515a42cb 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -77,7 +77,7 @@ class autoTranslator $files = $this->getTranslationFilesArray($this->_refLang); $counter = 1; - foreach($files as $file) + foreach ($files as $file) { if ($this->_limittofile && $this->_limittofile != $file) continue; $counter++; @@ -94,7 +94,7 @@ class autoTranslator // If we must process all languages $arraytmp=dol_dir_list($this->_langDir, 'directories', 0); - foreach($arraytmp as $dirtmp) + foreach ($arraytmp as $dirtmp) { if ($dirtmp['name'] === $this->_refLang) continue; // We discard source language $tmppart=explode('_', $dirtmp['name']); @@ -112,7 +112,7 @@ class autoTranslator } // Process translation of source file for each target languages - foreach($targetlangs as $my_destlang) + foreach ($targetlangs as $my_destlang) { $this->_translatedFiles = array(); @@ -124,15 +124,14 @@ class autoTranslator echo "File not found: " . $destPath . ". We generate it.
\n"; $this->createTranslationFile($destPath, $my_destlang); } - else - { + else { echo "Updating file: " . $destPath . "
\n"; } // Translate lines $fileContentDest = file($destPath, FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES); $newlines=0; - foreach($fileContent as $line){ + foreach ($fileContent as $line){ $key = $this->getLineKey($line); $value = $this->getLineValue($line); if ($key && $value) @@ -167,7 +166,7 @@ class autoTranslator fwrite($fp, "\n"); fwrite($fp, "// START - Lines generated via autotranslator.php tool (".$this->_time.").\n"); fwrite($fp, "// Reference language: ".$this->_refLang." -> ".$my_destlang."\n"); - foreach($this->_translatedFiles[$file] as $line) { + foreach ($this->_translatedFiles[$file] as $line) { fwrite($fp, $line . "\n"); } fwrite($fp, "// STOP - Lines generated via autotranslator.php tool (".$this->_time_end.").\n"); @@ -209,7 +208,7 @@ class autoTranslator { //print "key =".$key."\n"; - foreach($content as $line) { + foreach ($content as $line) { $destKey = $this->getLineKey($line); $destValue = $this->getLineValue($line); // If translated return @@ -273,8 +272,8 @@ class autoTranslator private function getTranslationFilesArray($lang) { $dir = new DirectoryIterator($this->_langDir.$lang); - while($dir->valid()) { - if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) { + while ($dir->valid()) { + if (!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) { $files[] = $dir->getFilename(); } $dir->next(); diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index f568ba2b04b..0268fc94ed8 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -360,16 +360,14 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a $unused[$value] = $line; echo $line; // $trad contains the \n } - else - { + else { unset($output); //print 'X'.$output.'Y'; } } if (empty($unused)) print "No string not used found.\n"; - else - { + else { $filetosave='/tmp/'.($argv[2]?$argv[2]:"").'notused.lang'; print "Strings in en_US that are never used are saved into file ".$filetosave.":\n"; file_put_contents($filetosave, implode("", $unused)); diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index ce28ca5de63..5a94192b2bd 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -80,8 +80,8 @@ $aEnglish = array(); if ($filesToProcess == 'all') { $dir = new DirectoryIterator('htdocs/langs/'.$lPrimary); - while($dir->valid()) { - if(!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) { + while ($dir->valid()) { + if (!$dir->isDot() && $dir->isFile() && ! preg_match('/^\./', $dir->getFilename())) { $files[] = $dir->getFilename(); } $dir->next(); @@ -94,7 +94,7 @@ else $filesToProcess=explode(',', $filesToProcess); // Loop on each file -foreach($filesToProcess as $fileToProcess) +foreach ($filesToProcess as $fileToProcess) { $lPrimaryFile = 'htdocs/langs/'.$lPrimary.'/'.$fileToProcess; $lSecondaryFile = 'htdocs/langs/'.$lSecondary.'/'.$fileToProcess; @@ -285,8 +285,7 @@ foreach($filesToProcess as $fileToProcess) print "Key $key is redundant in file $lPrimaryFile (line: $cnt) - Already found into ".$fileFirstFound[$key]." (line: ".$lineFirstFound[$key].").\n"; continue; } - else - { + else { $fileFirstFound[$key] = $fileToProcess; $lineFirstFound[$key] = $cnt; } diff --git a/htdocs/admin/agenda.php b/htdocs/admin/agenda.php index b6231a45a10..52a1adc4fd2 100644 --- a/htdocs/admin/agenda.php +++ b/htdocs/admin/agenda.php @@ -62,8 +62,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -108,8 +107,7 @@ if ($action == "save" && empty($cancel)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); $db->commit(); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); $db->rollback(); } diff --git a/htdocs/admin/agenda_extsites.php b/htdocs/admin/agenda_extsites.php index 77113ff1e13..dd5d04732ff 100644 --- a/htdocs/admin/agenda_extsites.php +++ b/htdocs/admin/agenda_extsites.php @@ -108,8 +108,7 @@ if ($actionsave) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -163,14 +162,12 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('AGENDA_DISABLE_EXT', array('enabled'=>array(0=>'.hideifnotset')), null, 1); } -else -{ +else { if (empty($conf->global->AGENDA_DISABLE_EXT)) { print ''.img_picto($langs->trans("Enabled"), 'on').''; } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'off').''; } } diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index c5b196146d5..a9e5bccd71b 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -60,8 +60,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -74,8 +73,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -121,14 +119,12 @@ elseif ($action == 'specimen') // For orders header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -214,8 +210,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -263,8 +258,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) $module = new $classname($db, $specimenthirdparty); if (method_exists($module, 'info')) print $module->info($langs); - else - print $module->description; + else print $module->description; print "\n"; // Active @@ -277,14 +271,12 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } - else - { + else { print img_picto($langs->trans("Enabled"), 'switch_on'); } print ""; } - else - { + else { print '
"; @@ -296,8 +288,7 @@ if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'&type=action"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -347,8 +338,7 @@ if (empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } -else -{ +else { print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } print ''."\n"; diff --git a/htdocs/admin/agenda_reminder.php b/htdocs/admin/agenda_reminder.php index 3d51bd3158c..d9b7ead6f2e 100644 --- a/htdocs/admin/agenda_reminder.php +++ b/htdocs/admin/agenda_reminder.php @@ -55,8 +55,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -69,8 +68,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -114,14 +112,12 @@ elseif ($action == 'specimen') // For orders header("Location: ".DOL_URL_ROOT."/document.php?modulepart=action&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } diff --git a/htdocs/admin/agenda_xcal.php b/htdocs/admin/agenda_xcal.php index 7df74ba6a9d..b6d0472c3af 100644 --- a/htdocs/admin/agenda_xcal.php +++ b/htdocs/admin/agenda_xcal.php @@ -55,8 +55,7 @@ if ($actionsave) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("SaveFailed"), null, 'errors'); } diff --git a/htdocs/admin/bank.php b/htdocs/admin/bank.php index b048dea9565..662dc517436 100644 --- a/htdocs/admin/bank.php +++ b/htdocs/admin/bank.php @@ -128,8 +128,7 @@ if ($actionsave) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); if (empty($errorsaved)) setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -359,8 +358,7 @@ foreach ($dirmodels as $reldir) { print "'; // Active @@ -448,8 +446,7 @@ if ($conf->global->BANK_COLORIZE_MOVEMENT) { print ''; print ''; } -else -{ +else { print '"; @@ -509,8 +506,7 @@ if ($conf->global->BANK_REPORT_LAST_NUM_RELEVE) { print ''; print ''; } -else -{ +else { print '"; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index e577942ab21..90a2525de05 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -81,8 +81,7 @@ elseif ($action == 'update') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -265,19 +264,16 @@ if ($resql) //print $url; print ''; } - else - { + else { print $langs->trans("FormatNotSupportedByGenerator"); } } - else - { + else { print 'ErrorClassNotFoundInModule '.$classname.' '.$obj->coder; } } } - else - { + else { print $langs->trans("ChooseABarCode"); } print ''; @@ -412,8 +408,7 @@ if ($conf->product->enabled) print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } - else - { + else { print ''; diff --git a/htdocs/admin/bom.php b/htdocs/admin/bom.php index 6d37def3187..26f3fe75858 100644 --- a/htdocs/admin/bom.php +++ b/htdocs/admin/bom.php @@ -58,8 +58,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -96,14 +95,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=bom&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, null, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -161,8 +158,7 @@ elseif ($action == 'set_BOM_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -179,8 +175,7 @@ elseif ($action == 'set_BOM_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -262,8 +257,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -328,8 +322,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -399,8 +392,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print '"; @@ -412,8 +404,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -442,8 +433,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -489,8 +479,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index c6ff9e94749..46f91e8b366 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -84,8 +84,7 @@ if ($action == 'add') { $i++; } } - else - { + else { setEventMessages($db->lasterror(), null, 'errors'); $error++; } @@ -135,8 +134,7 @@ if ($action == 'add') { $db->commit(); $action = ''; } - else - { + else { $db->rollback(); } } @@ -205,8 +203,7 @@ if ($action == 'switch') { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -346,8 +343,7 @@ foreach ($boxtoadd as $box) { $logo = $box->boximg; } - else - { + else { $logo = preg_replace("/^object_/i", "", $box->boximg); } @@ -411,8 +407,7 @@ foreach ($boxactivated as $key => $box) { $logo = $box->boximg; } - else - { + else { $logo = preg_replace("/^object_/i", "", $box->boximg); } diff --git a/htdocs/admin/chequereceipts.php b/htdocs/admin/chequereceipts.php index 8b5e7c433bf..397f289eaee 100644 --- a/htdocs/admin/chequereceipts.php +++ b/htdocs/admin/chequereceipts.php @@ -61,8 +61,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -84,8 +83,7 @@ if ($action == 'set_BANK_CHEQUERECEIPT_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -182,8 +180,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -260,8 +257,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/clicktodial.php b/htdocs/admin/clicktodial.php index 36205697e89..56f4f076e54 100644 --- a/htdocs/admin/clicktodial.php +++ b/htdocs/admin/clicktodial.php @@ -47,8 +47,7 @@ if ($action == 'setvalue' && $user->admin) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -134,8 +133,7 @@ if (!empty($conf->global->CLICKTODIAL_URL)) { print $langs->trans("LinkToTest", $user->login).': '.dol_print_phone($phonefortest, '', 0, 0, 'AC_TEL'); } - else - { + else { $langs->load("errors"); print '
'.$langs->trans("WarningClickToDialUserSetupNotComplete").'
'; } diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php index 76f04d94c15..f1f22203fa2 100644 --- a/htdocs/admin/commande.php +++ b/htdocs/admin/commande.php @@ -67,8 +67,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -105,14 +104,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, null, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -170,8 +167,7 @@ elseif ($action == 'set_COMMANDE_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -188,8 +184,7 @@ elseif ($action == 'set_ORDER_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -218,8 +213,7 @@ elseif ($action == 'setribchq') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -235,8 +229,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ORDER') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -252,8 +245,7 @@ elseif ($action == 'set_WAREHOUSE_ASK_WAREHOUSE_DURING_ORDER') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -335,8 +327,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -401,8 +392,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -472,8 +462,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print '"; @@ -485,8 +474,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -520,8 +508,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -595,14 +582,12 @@ if (empty($conf->facture->enabled)) } print ""; } - else - { + else { print "".$langs->trans("NoActiveBankAccountDefined").""; } } } - else - { + else { print ''.$langs->trans("BankModuleNotActive").''; } } @@ -682,8 +667,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f33a3ea6f93..b5ae98378c9 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -85,8 +85,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) $s = $mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label; dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity); } - else - { + else { dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); } @@ -165,14 +164,12 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) $tmparray = explode(':', $result); setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); } - else - { + else { $error++; setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); @@ -229,8 +226,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) { dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", 0, 'chaine', 0, '', $conf->entity); } - else - { + else { dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX1", GETPOST('lt1', 'aZ09'), 'chaine', 0, '', $conf->entity); } dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC1", GETPOST("clt1", 'aZ09'), 'chaine', 0, '', $conf->entity); @@ -241,8 +237,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) { dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", 0, 'chaine', 0, '', $conf->entity); } - else - { + else { dolibarr_set_const($db, "MAIN_INFO_VALUE_LOCALTAX2", GETPOST('lt2', 'aZ09'), 'chaine', 0, '', $conf->entity); } dolibarr_set_const($db, "MAIN_INFO_LOCALTAX_CALC2", GETPOST("clt2", 'aZ09'), 'chaine', 0, '', $conf->entity); @@ -252,8 +247,7 @@ if (($action == 'update' && !GETPOST("cancel", 'alpha')) { $db->commit(); } - else - { + else { $db->rollback(); } @@ -302,16 +296,14 @@ if ($action == 'addthumb' || $action == 'addthumbsquarred') // Regenerate thumb header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); dol_syslog($langs->transnoentities("ErrorBadImageFormat"), LOG_INFO); } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFileDoesNotExists", $_GET["file"]), null, 'errors'); @@ -583,8 +575,7 @@ if ($langs->transcountry("ProfId1", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; @@ -598,8 +589,7 @@ if ($langs->transcountry("ProfId2", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; @@ -613,8 +603,7 @@ if ($langs->transcountry("ProfId3", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; @@ -628,8 +617,7 @@ if ($langs->transcountry("ProfId4", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; @@ -643,8 +631,7 @@ if ($langs->transcountry("ProfId5", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; @@ -658,8 +645,7 @@ if ($langs->transcountry("ProfId6", $mysoc->country_code) != '-') { print ''; } - else - { + else { print $countrynotdefined; } print ''; diff --git a/htdocs/admin/compta.php b/htdocs/admin/compta.php index 3ccc2a213ac..7c1c64369ad 100644 --- a/htdocs/admin/compta.php +++ b/htdocs/admin/compta.php @@ -102,8 +102,7 @@ if ($action == 'update') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/confexped.php b/htdocs/admin/confexped.php index fd93b0fa83d..3f5cc1cd920 100644 --- a/htdocs/admin/confexped.php +++ b/htdocs/admin/confexped.php @@ -136,8 +136,7 @@ if (empty($conf->global->MAIN_SUBMODULE_LIVRAISON)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } -else -{ +else { print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index bc22a2020fb..9da7fb10bbf 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -86,8 +86,7 @@ if ($action == 'add' || (GETPOST('add') && $action != 'update')) $constvalue = ""; $constnote = ""; } - else - { + else { dol_print_error($db); } } @@ -105,8 +104,7 @@ if (!empty($consts) && $action == 'update') { $nbmodified++; } - else - { + else { dol_print_error($db); } } @@ -127,8 +125,7 @@ if (!empty($consts) && $action == 'delete') { $nbdeleted++; } - else - { + else { dol_print_error($db); } } @@ -144,8 +141,7 @@ if ($action == 'delete') { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } - else - { + else { dol_print_error($db); } } @@ -231,8 +227,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity) print ''; print ''; print ''; } - else - { + else { print '"; @@ -401,8 +394,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -434,8 +426,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'contract').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -483,8 +474,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/dav.php b/htdocs/admin/dav.php index bb7e82901f5..b7cb424d2cb 100644 --- a/htdocs/admin/dav.php +++ b/htdocs/admin/dav.php @@ -101,8 +101,7 @@ if ($action == 'edit') { print $form->selectyesno($key, $conf->global->$key, 1); } - else - { + else { print ''; } print ''; @@ -117,8 +116,7 @@ if ($action == 'edit') print ''; print '
'; } -else -{ +else { print '
'; - if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) + if ($conf->global->MAIN_SHOW_LOGO && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && !empty($conf->global->MAIN_INFO_SOCIETE_LOGO)) { print ''; + } print '
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_NOM).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ADDRESS).'
'.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_ZIP).' '.dol_escape_htmltag($conf->global->MAIN_INFO_SOCIETE_TOWN).'
'."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=action">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
\n"; if (method_exists($module, 'info')) print $module->info($langs); - else - print $module->description; + else print $module->description; print ''."\n"; print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'; } -else -{ +else { print ''; print ''; } @@ -298,8 +293,7 @@ if ($result) print ''; } - else - { + else { print ''; print ''; } @@ -308,8 +302,7 @@ if ($result) { print ''; } - else - { + else { print ''.img_delete().''; } diff --git a/htdocs/admin/contract.php b/htdocs/admin/contract.php index ae0c9c89b38..f3c50287107 100644 --- a/htdocs/admin/contract.php +++ b/htdocs/admin/contract.php @@ -63,8 +63,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -101,14 +100,12 @@ elseif ($action == 'specimen') // For contract header("Location: ".DOL_URL_ROOT."/document.php?modulepart=contract&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -169,8 +166,7 @@ elseif ($action == 'set_other') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -252,8 +248,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -317,8 +312,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -388,8 +382,7 @@ foreach ($dirmodels as $reldir) print ''; print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'; print ''; @@ -141,8 +139,7 @@ else { print yn($conf->global->$key); } - else - { + else { print $conf->global->$key; } print ''; diff --git a/htdocs/admin/debugbar.php b/htdocs/admin/debugbar.php index 926080cb9b5..dad99b2ab39 100644 --- a/htdocs/admin/debugbar.php +++ b/htdocs/admin/debugbar.php @@ -59,8 +59,7 @@ if ($action == 'set') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($error, null, 'errors'); } diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 094c4a8dd7c..2622d5ca514 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -151,8 +151,7 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac $defaultkey = ''; $defaultvalue = ''; } - else - { + else { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); $action = ''; @@ -170,8 +169,7 @@ if ($action == 'delete') { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } - else - { + else { dol_print_error($db); } } @@ -198,8 +196,7 @@ if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $enabledisablehtml .= img_picto($langs->trans("Disabled"), 'switch_off'); $enabledisablehtml .= ''; } -else -{ +else { // Button on, click to disable $enabledisablehtml .= ''; $enabledisablehtml .= img_picto($langs->trans("Activated"), 'switch_on'); @@ -261,8 +258,7 @@ if ($mode != 'sortorder') { $textkey = $form->textwithpicto($langs->trans("Field"), $texthelp); } -else -{ +else { $texthelp = 'field or alias.field'; $textkey = $form->textwithpicto($langs->trans("Field"), $texthelp); } @@ -281,8 +277,7 @@ if ($mode != 'focus' && $mode != 'mandatory') } $textvalue = $form->textwithpicto($langs->trans("Value"), $texthelp, 1, 'help', '', 0, 2, 'subsitutiontooltip'); } - else - { + else { $texthelp = 'ASC or DESC'; $textvalue = $form->textwithpicto($langs->trans("SortOrder"), $texthelp); } @@ -322,8 +317,7 @@ if (!empty($conf->multicompany->enabled) && !$user->entity) print ''; // We see environment, but to change it we must switch on other entity print ''; } -else -{ +else { print ''; @@ -394,8 +388,7 @@ if ($result) print '   '; print ''.img_delete().''; } - else - { + else { print ''; print ''; print '
'; @@ -409,8 +402,7 @@ if ($result) $i++; } } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/admin/delais.php b/htdocs/admin/delais.php index 3ee262b464a..26f2f87e2d5 100644 --- a/htdocs/admin/delais.php +++ b/htdocs/admin/delais.php @@ -250,8 +250,7 @@ if ($action == 'edit') print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'; print ''; print '
'; } -else -{ +else { /* * Show parameters */ diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index cce441c4052..7ed84b59629 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -698,8 +698,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) { $_POST["country"] = ''; } - else - { + else { $ok = 0; setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities("Country")), null, 'errors'); } @@ -792,8 +791,7 @@ if (GETPOST('actionadd') || GETPOST('actionmodify')) setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } @@ -883,8 +881,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') // delete { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } - else - { + else { dol_print_error($db); } } @@ -1302,8 +1299,7 @@ if ($id) print ''; $filterfound++; } - else - { + else { print ''; print ''; } @@ -1439,8 +1435,7 @@ if ($id) print ''; print ''; } - else - { + else { $tmpaction = 'view'; $parameters = array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]); $reshook = $hookmanager->executeHooks('viewDictionaryFieldlist', $parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks @@ -1479,8 +1474,7 @@ if ($id) { $valuetoshow = '-'; } - else - { + else { $key = $langs->trans("Country".strtoupper($obj->country_code)); $valuetoshow = ($key != "Country".strtoupper($obj->country_code) ? $obj->country_code." - ".$key : $obj->country); } @@ -1605,15 +1599,13 @@ if ($id) elseif ($fieldlist[$field] == 'localtax1_type') { if ($obj->localtax1 != 0) $valuetoshow = $localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; + else $valuetoshow = ''; $class = "center"; } elseif ($fieldlist[$field] == 'localtax2_type') { if ($obj->localtax2 != 0) $valuetoshow = $localtax_typeList[$valuetoshow]; - else - $valuetoshow = ''; + else $valuetoshow = ''; $class = "center"; } elseif ($fieldlist[$field] == 'taux') { @@ -1709,8 +1701,7 @@ if ($id) // Active print ''; if ($canbedisabled) print ''.$actl[$obj->active].''; - else - { + else { if (in_array($obj->code, array('AC_OTH', 'AC_OTH_AUTO'))) print $langs->trans("AlwaysActive"); 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"); @@ -1747,8 +1738,7 @@ if ($id) print ''; } -else -{ +else { /* * Show list of dictionary to show */ @@ -1782,8 +1772,7 @@ else { print ''.$langs->trans($tablib[$i]).''; } - else - { + else { print $langs->trans($tablib[$i]); } print ''; @@ -1796,8 +1785,7 @@ else print ''.$tabname[$i].''; $lastlineisempty = false; } - else - { + else { if (!$lastlineisempty) { $showemptyline = 1; @@ -2003,8 +1991,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') $accountancy_account = (!empty($obj->$fieldname) ? $obj->$fieldname : 0); print $formaccounting->select_account($accountancy_account, '.'.$fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); } - else - { + else { $fieldname = $fieldlist[$field]; print ''; } @@ -2028,8 +2015,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print $form->selectExpenseRanges($obj->fk_range); print ''; } - else - { + else { $fieldValue = isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''; if ($fieldlist[$field] == 'sortorder') diff --git a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php index 3c735707c4a..6eaf1cf375a 100644 --- a/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php +++ b/htdocs/admin/dolistore/class/PSWebServiceLibrary.class.php @@ -136,8 +136,9 @@ class PrestaShopWebservice { if (isset($curl_params[$defkey])) $curl_options[$defkey] = $curl_params[$defkey]; - else + else { $curl_options[$defkey] = $defaultParams[$defkey]; + } } foreach ($curl_params as $defkey => $defval) if (!isset($curl_options[$defkey])) @@ -237,8 +238,9 @@ class PrestaShopWebservice } return $xml; } - else + else { throw new PrestaShopWebserviceException('HTTP response is empty'); + } } /** @@ -264,9 +266,7 @@ class PrestaShopWebservice $url .= '&id_shop='.$options['id_shop']; if (isset($options['id_group_shop'])) $url .= '&id_group_shop='.$options['id_group_shop']; - } - else - { + } else { throw new PrestaShopWebserviceException('Bad parameters given'); } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => $xml)); @@ -323,9 +323,9 @@ class PrestaShopWebservice $url_params[$k] = $options[$k]; if (count($url_params) > 0) $url .= '?'.http_build_query($url_params); - } - else + } else { throw new PrestaShopWebserviceException('Bad parameters given '); + } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'GET')); self::checkStatusCode($request['status_code']); // check the response validity @@ -356,9 +356,9 @@ class PrestaShopWebservice $url_params[$k] = $options[$k]; if (count($url_params) > 0) $url .= '?'.http_build_query($url_params); - } - else + } else { throw new PrestaShopWebserviceException('Bad parameters given'); + } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'HEAD', CURLOPT_NOBODY => true)); self::checkStatusCode($request['status_code']); // check the response validity return $request['header']; @@ -387,9 +387,9 @@ class PrestaShopWebservice $url .= '&id_shop='.$options['id_shop']; if (isset($options['id_group_shop'])) $url .= '&id_group_shop='.$options['id_group_shop']; - } - else + } else { throw new PrestaShopWebserviceException('Bad parameters given'); + } $request = self::executeRequest($url, array(CURLOPT_CUSTOMREQUEST => 'PUT', CURLOPT_POSTFIELDS => $xml)); self::checkStatusCode($request['status_code']); // check the response validity diff --git a/htdocs/admin/dolistore/class/dolistore.class.php b/htdocs/admin/dolistore/class/dolistore.class.php index a229f3c985d..1d764a849be 100644 --- a/htdocs/admin/dolistore/class/dolistore.class.php +++ b/htdocs/admin/dolistore/class/dolistore.class.php @@ -101,8 +101,7 @@ class Dolistore $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) die('Bad ID'); elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); - else - { + else { print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; print $e->getMessage(); } @@ -183,8 +182,7 @@ class Dolistore $trace = $e->getTrace(); if ($trace[0]['args'][0] == 404) die('Bad ID'); elseif ($trace[0]['args'][0] == 401) die('Bad auth key'); - else - { + else { print 'Can not access to '.$conf->global->MAIN_MODULE_DOLISTORE_API_SRV.'
'; print $e->getMessage(); } diff --git a/htdocs/admin/ecm.php b/htdocs/admin/ecm.php index 0c348b25f60..b9af92dc8a5 100644 --- a/htdocs/admin/ecm.php +++ b/htdocs/admin/ecm.php @@ -42,8 +42,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -56,8 +55,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -94,8 +92,7 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('ECM_AUTO_TREE_ENABLED'); } -else -{ +else { if (empty($conf->global->ECM_AUTO_TREE_ENABLED)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index 80161eaadc6..a554354420d 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -127,8 +127,7 @@ if (GETPOST('addfilter', 'alpha')) { $object->fetchFilters(); } - else - { + else { setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); } } @@ -142,8 +141,7 @@ if ($action == 'deletefilter') { $object->fetchFilters(); } - else - { + else { setEventMessages($emailcollectorfilter->errors, $emailcollectorfilter->error, 'errors'); } } @@ -163,8 +161,7 @@ if (GETPOST('addoperation', 'alpha')) { $object->fetchActions(); } - else - { + else { setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); } } @@ -182,8 +179,7 @@ if ($action == 'updateoperation') { $object->fetchActions(); } - else - { + else { setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); } } @@ -196,8 +192,7 @@ if ($action == 'deleteoperation') { $object->fetchActions(); } - else - { + else { setEventMessages($emailcollectoroperation->errors, $emailcollectoroperation->error, 'errors'); } } @@ -212,8 +207,7 @@ if ($action == 'confirm_collect') $debuginfo = $object->debuginfo; setEventMessages($object->lastresult, null, 'mesgs'); } - else - { + else { $debuginfo = $object->debuginfo; setEventMessages($object->error, null, 'errors'); } @@ -440,8 +434,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= $form->textwithpicto('', 'connect string '.$connectstringserver); } - else - { + else { $morehtml .= 'IMAP functions not available on your PHP'; } @@ -449,8 +442,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; } - else - { + else { $morehtml .= imap_num_msg($connection); } @@ -582,8 +574,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($res) $arrayoftypes = $hookmanager->resArray; - else - foreach ($hookmanager->resArray as $k=>$desc) + else foreach ($hookmanager->resArray as $k=>$desc) $arrayoftypes[$k] = $desc; @@ -626,8 +617,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; print ' '; } - else - { + else { print $ruleaction['actionparam']; } print ''; diff --git a/htdocs/admin/emailcollector_list.php b/htdocs/admin/emailcollector_list.php index f180cdf10cf..bb17bbdca05 100644 --- a/htdocs/admin/emailcollector_list.php +++ b/htdocs/admin/emailcollector_list.php @@ -242,8 +242,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; } -else -{ +else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/admin/expedition.php b/htdocs/admin/expedition.php index be9e7091300..cd9a2976e11 100644 --- a/htdocs/admin/expedition.php +++ b/htdocs/admin/expedition.php @@ -69,8 +69,7 @@ if ($action == 'updateMask') { if ($res > 0) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else - setEventMessages($langs->trans("Error"), null, 'errors'); + else setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -130,14 +129,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expedition&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -259,8 +256,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -327,8 +323,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -396,8 +391,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; @@ -409,8 +403,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -439,8 +432,7 @@ foreach ($dirmodels as $reldir) { print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'sending').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -487,8 +479,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/expensereport.php b/htdocs/admin/expensereport.php index d076e77bf44..20f85dc6a29 100644 --- a/htdocs/admin/expensereport.php +++ b/htdocs/admin/expensereport.php @@ -64,8 +64,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -104,14 +103,12 @@ elseif ($action == 'specimen') // For fiche inter header("Location: ".DOL_URL_ROOT."/document.php?modulepart=expensereport&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -179,8 +176,7 @@ elseif ($action == 'setoptions') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -264,8 +260,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -329,8 +324,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -396,8 +390,7 @@ foreach ($dirmodels as $reldir) print ''; print ""; } - else - { + else { print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; @@ -409,8 +402,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -435,8 +427,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'intervention').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -485,8 +476,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/expensereport_ik.php b/htdocs/admin/expensereport_ik.php index 83bb28ca440..2b089335c40 100644 --- a/htdocs/admin/expensereport_ik.php +++ b/htdocs/admin/expensereport_ik.php @@ -162,8 +162,7 @@ foreach ($rangesbycateg as $fk_c_exp_tax_cat => $Tab) echo ''; echo ''; } - else - { + else { echo ''.img_edit().''; if (!empty($range->ik->id)) echo ''.img_delete().''; // TODO add delete link diff --git a/htdocs/admin/expensereport_rules.php b/htdocs/admin/expensereport_rules.php index a40e8d95520..0c99b4e4dda 100644 --- a/htdocs/admin/expensereport_rules.php +++ b/htdocs/admin/expensereport_rules.php @@ -229,8 +229,7 @@ foreach ($rules as $rule) echo '
'.$form->select_dolusers($object->fk_user, 'fk_user').'
'; echo '
'.$form->select_dolgroups($object->fk_usergroup, 'fk_usergroup').'
'; } - else - { + else { if ($rule->is_for_all > 0) echo $tab_apply['A']; elseif ($rule->fk_usergroup > 0) echo $tab_apply['G'].' ('.$rule->getGroupLabel().')'; elseif ($rule->fk_user > 0) echo $tab_apply['U'].' ('.$rule->getUserName().')'; @@ -243,11 +242,9 @@ foreach ($rules as $rule) { echo $form->selectExpense($object->fk_c_type_fees, 'fk_c_type_fees', 0, 1, 1); } - else - { + else { if ($rule->fk_c_type_fees == -1) echo $langs->trans('AllExpenseReport'); - else - { + else { $key = getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'code', $rule->fk_c_type_fees, false, 'id'); if ($key != $langs->trans($key)) echo $langs->trans($key); else echo $langs->trans(getDictvalue(MAIN_DB_PREFIX.'c_type_fees', 'label', $rule->fk_c_type_fees, false, 'id')); // TODO check to return trans of 'code' @@ -261,8 +258,7 @@ foreach ($rules as $rule) { echo $form->selectarray('code_expense_rules_type', $tab_rules_type, $object->code_expense_rules_type, 0); } - else - { + else { echo $tab_rules_type[$rule->code_expense_rules_type]; } echo ''; @@ -273,8 +269,7 @@ foreach ($rules as $rule) { print $form->selectDate(strtotime(date('Y-m-d', $object->dates)), 'start', '', '', 0, '', 1, 0); } - else - { + else { echo dol_print_date($rule->dates, 'day'); } echo ''; @@ -285,8 +280,7 @@ foreach ($rules as $rule) { print $form->selectDate(strtotime(date('Y-m-d', $object->datee)), 'end', '', '', 0, '', 1, 0); } - else - { + else { echo dol_print_date($rule->datee, 'day'); } echo ''; @@ -297,8 +291,7 @@ foreach ($rules as $rule) { echo ''.$conf->currency; } - else - { + else { echo price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency); } echo ''; @@ -309,8 +302,7 @@ foreach ($rules as $rule) { echo $form->selectyesno('restrictive', $object->restrictive, 1); } - else - { + else { echo yn($rule->restrictive, 1, 1); } echo ''; @@ -322,8 +314,7 @@ foreach ($rules as $rule) echo ''.img_edit().' '; echo ''.img_delete().''; } - else - { + else { echo ' '; echo ''.$langs->trans('Cancel').''; } diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index 8aa1a425778..eac6d7eb8e9 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -61,8 +61,7 @@ if ($result) if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1]; } } -else -{ +else { dol_print_error($db); } @@ -93,8 +92,7 @@ if ($action == 'add' || GETPOST("modify")) } */ } - else - { + else { // Ajoute boite box_external_rss dans definition des boites $sql = "INSERT INTO ".MAIN_DB_PREFIX."boxes_def (file, note)"; $sql .= " VALUES ('box_external_rss.php','".$db->escape(GETPOST("norss", 'int').' ('.GETPOST($external_rss_title, 'alpha')).")')"; @@ -114,8 +112,7 @@ if ($action == 'add' || GETPOST("modify")) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -162,8 +159,7 @@ if ($_POST["delete"]) $db->commit(); } - else - { + else { $db->rollback(); dol_print_error($db, "sql=".$sql); exit; @@ -179,8 +175,7 @@ if ($_POST["delete"]) header("Location: external_rss.php"); exit; } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -293,8 +288,7 @@ if ($resql) { print ''.$langs->trans("Online").''; } - else - { + else { print ''.$langs->trans("Offline"); $langs->load("errors"); if ($rssparser->error) print ' - '.$langs->trans($rssparser->error); @@ -332,8 +326,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/admin/facture.php b/htdocs/admin/facture.php index 1a484ec8c7e..6c0c03b6dda 100644 --- a/htdocs/admin/facture.php +++ b/htdocs/admin/facture.php @@ -72,8 +72,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -109,14 +108,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -173,8 +170,7 @@ elseif ($action == 'setribchq') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -190,8 +186,7 @@ elseif ($action == 'set_FACTURE_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -208,8 +203,7 @@ elseif ($action == 'set_INVOICE_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -225,8 +219,7 @@ elseif ($action == 'setforcedate') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -248,8 +241,7 @@ elseif ($action == 'setDefaultPDFModulesByType') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -350,8 +342,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -463,8 +454,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -535,8 +525,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("SetAsDefault"), 'switch_off').''; print ""; @@ -548,8 +537,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("SetAsDefault"), 'off').''; } print ''; @@ -583,8 +571,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -691,14 +678,12 @@ if (!empty($conf->banque->enabled)) } print ""; } - else - { + else { print ''.$langs->trans("NoActiveBankAccountDefined").''; } } } -else -{ +else { print $langs->trans("BankModuleNotActive"); } print ""; @@ -777,8 +762,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/fckeditor.php b/htdocs/admin/fckeditor.php index 00995a302a5..9dfc2cff6d1 100644 --- a/htdocs/admin/fckeditor.php +++ b/htdocs/admin/fckeditor.php @@ -127,8 +127,7 @@ if (GETPOST('save', 'alpha')) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -147,8 +146,7 @@ if (empty($conf->use_javascript_ajax)) { setEventMessages(array($langs->trans("NotAvailable"), $langs->trans("JavascriptDisabled")), null, 'errors'); } -else -{ +else { print ''; print ''; print ''; @@ -212,8 +210,7 @@ else $editor = new DolEditor('formtestfield', isset($conf->global->FCKEDITOR_TEST) ? $conf->global->FCKEDITOR_TEST : 'Test', '', 200, $mode, 'In', true, $uselocalbrowser, 1, 120, 8, $readonly); $editor->Create(); } - else - { + else { print '
'; print $conf->global->FCKEDITOR_TEST; print '
'; diff --git a/htdocs/admin/fichinter.php b/htdocs/admin/fichinter.php index 055384c0084..602570194fd 100644 --- a/htdocs/admin/fichinter.php +++ b/htdocs/admin/fichinter.php @@ -64,8 +64,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -102,14 +101,12 @@ elseif ($action == 'specimen') // For fiche inter header("Location: ".DOL_URL_ROOT."/document.php?modulepart=ficheinter&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -167,8 +164,7 @@ elseif ($action == 'set_FICHINTER_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -184,8 +180,7 @@ elseif ($action == 'set_FICHINTER_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -201,8 +196,7 @@ elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } elseif ($action == 'set_FICHINTER_USE_SERVICE_DURATION') { @@ -325,8 +319,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -389,8 +382,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -458,8 +450,7 @@ foreach ($dirmodels as $reldir) print ''; print ""; } - else - { + else { print ""; @@ -471,8 +462,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -499,8 +489,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'intervention').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -545,8 +534,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/geoipmaxmind.php b/htdocs/admin/geoipmaxmind.php index a661f3a8e9a..ba602c4b609 100644 --- a/htdocs/admin/geoipmaxmind.php +++ b/htdocs/admin/geoipmaxmind.php @@ -65,8 +65,7 @@ if ($action == 'set') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -183,8 +182,7 @@ if ($geoip) if ($result) print $result; else print $langs->trans("Error"); } - else - { + else { print '
'.$ip.' -> '; $result = dol_print_ip($ip, 1); if ($result) print $result; diff --git a/htdocs/admin/holiday.php b/htdocs/admin/holiday.php index aafe01bf5bd..58f39e30ff2 100644 --- a/htdocs/admin/holiday.php +++ b/htdocs/admin/holiday.php @@ -65,8 +65,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -103,14 +102,12 @@ elseif ($action == 'specimen') // For contract header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -171,8 +168,7 @@ elseif ($action == 'set_other') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -255,8 +251,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -332,8 +327,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -404,8 +398,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print '"; @@ -417,8 +410,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -450,8 +442,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'contract').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -502,8 +493,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 1b088f0c2b9..8df8a120c05 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -197,14 +197,12 @@ if ($action == 'update') $tmparray = explode(':', $result); setEventMessages($langs->trans('ErrorFileIsInfectedWithAVirus', $tmparray[1]), null, 'errors'); } - else - { + else { $error++; setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); diff --git a/htdocs/admin/ldap.php b/htdocs/admin/ldap.php index bd24e793374..33f1abb251f 100644 --- a/htdocs/admin/ldap.php +++ b/htdocs/admin/ldap.php @@ -77,8 +77,7 @@ if (empty($reshook)) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -215,8 +214,7 @@ if (!empty($conf->global->LDAP_SERVER_PORT)) { print ''; } -else -{ +else { print ''; } print ''; @@ -249,8 +247,7 @@ if (!empty($conf->global->LDAP_ADMIN_PASS)) { print ''; // je le met en visible pour test } -else -{ +else { print ''; } print ''; @@ -296,8 +293,7 @@ if (function_exists("ldap_connect")) print ''.$langs->trans("LDAPBindOK", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPBindKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT, $conf->global->LDAP_ADMIN_DN, preg_replace('/./i', '*', $conf->global->LDAP_ADMIN_PASS)).''; print '
'; @@ -305,8 +301,7 @@ if (function_exists("ldap_connect")) print '
'; } } - else - { + else { print img_picto('', 'warning').' '; print ''.$langs->trans("LDAPNoUserOrPasswordProvidedAccessIsReadOnly").''; print '
'; @@ -320,8 +315,7 @@ if (function_exists("ldap_connect")) print ''.$langs->trans("LDAPSetupForVersion3").''; print '
'; } - else - { + else { print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSetupForVersion2").''; print '
'; @@ -329,8 +323,7 @@ if (function_exists("ldap_connect")) $unbind = $ldap->unbind(); } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPTCPConnectKO", $conf->global->LDAP_SERVER_HOST, $conf->global->LDAP_SERVER_PORT).''; print '
'; diff --git a/htdocs/admin/ldap_contacts.php b/htdocs/admin/ldap_contacts.php index 834bde4eea5..58eb04e595d 100644 --- a/htdocs/admin/ldap_contacts.php +++ b/htdocs/admin/ldap_contacts.php @@ -79,8 +79,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -293,8 +292,7 @@ if (function_exists("ldap_connect")) print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; @@ -307,8 +305,7 @@ if (function_exists("ldap_connect")) print nl2br($ldap->dump_content($dn, $info)); print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; diff --git a/htdocs/admin/ldap_groups.php b/htdocs/admin/ldap_groups.php index fb49c947411..a301738db94 100644 --- a/htdocs/admin/ldap_groups.php +++ b/htdocs/admin/ldap_groups.php @@ -71,8 +71,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -234,8 +233,7 @@ if (function_exists("ldap_connect")) print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; @@ -248,8 +246,7 @@ if (function_exists("ldap_connect")) print nl2br($ldap->dump_content($dn, $info)); print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; diff --git a/htdocs/admin/ldap_members.php b/htdocs/admin/ldap_members.php index f6fa74cb79d..eba84afe925 100644 --- a/htdocs/admin/ldap_members.php +++ b/htdocs/admin/ldap_members.php @@ -96,8 +96,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -416,8 +415,7 @@ if (function_exists("ldap_connect")) print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; @@ -430,8 +428,7 @@ if (function_exists("ldap_connect")) print nl2br($ldap->dump_content($dn, $info)); print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; diff --git a/htdocs/admin/ldap_members_types.php b/htdocs/admin/ldap_members_types.php index 6628dd4d144..6913c477b38 100644 --- a/htdocs/admin/ldap_members_types.php +++ b/htdocs/admin/ldap_members_types.php @@ -69,8 +69,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -216,8 +215,7 @@ if (function_exists("ldap_connect")) print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; @@ -230,8 +228,7 @@ if (function_exists("ldap_connect")) print nl2br($ldap->dump_content($dn, $info)); print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; diff --git a/htdocs/admin/ldap_users.php b/htdocs/admin/ldap_users.php index 7781cf45676..d0d3bb50d0d 100644 --- a/htdocs/admin/ldap_users.php +++ b/htdocs/admin/ldap_users.php @@ -90,8 +90,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -396,8 +395,7 @@ if (function_exists("ldap_connect")) print img_picto('', 'info').' '; print ''.$langs->trans("LDAPSynchroOK").'
'; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKOMayBePermissions"); print ': '.$ldap->error; @@ -410,8 +408,7 @@ if (function_exists("ldap_connect")) print nl2br($ldap->dump_content($dn, $info)); print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; @@ -477,8 +474,7 @@ if (function_exists("ldap_connect")) $liste[$key] = $label; } } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } @@ -491,8 +487,7 @@ if (function_exists("ldap_connect")) print "=> ".count($liste)." records
\n"; print "\n
"; } - else - { + else { print img_picto('', 'error').' '; print ''.$langs->trans("LDAPSynchroKO"); print ': '.$ldap->error; diff --git a/htdocs/admin/limits.php b/htdocs/admin/limits.php index 0646c7f6d46..b03067bd581 100644 --- a/htdocs/admin/limits.php +++ b/htdocs/admin/limits.php @@ -163,8 +163,7 @@ if ($action == 'edit') print ''; print '
'; } -else -{ +else { print '
'.$langs->trans("ActivateFCKeditor").'\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'.$langs->trans("LDAPServerPortExample").'
'.$langs->trans('Password').' (ex: secret)
'; print ''; @@ -204,8 +203,7 @@ if (empty($mysoc->country_code)) $warnpicto = img_warning($langs->trans("WarningMandatorySetupNotComplete")); print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; } -else -{ +else { // Show examples print load_fiche_titre($langs->trans("ExamplesWithCurrentSetup"), '', ''); @@ -270,8 +268,7 @@ else } } } - else - { + else { // More examples if not specific vat rate found // This example must be kept for test purpose with current value because value used (2/7, 10/3, and vat 0, 10) // were calculated to show all possible cases of rounding. If we change this, examples becomes useless or show the same rounding rule. diff --git a/htdocs/admin/livraison.php b/htdocs/admin/livraison.php index 4cd8f4841e5..f6e3c0e63f9 100644 --- a/htdocs/admin/livraison.php +++ b/htdocs/admin/livraison.php @@ -64,8 +64,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -81,8 +80,7 @@ if ($action == 'set_DELIVERY_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -119,14 +117,12 @@ if ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=livraison&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -250,8 +246,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -317,8 +312,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -384,8 +378,7 @@ foreach ($dirmodels as $reldir) print ''; print ""; } - else - { + else { print "
"; @@ -397,8 +390,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -418,8 +410,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'sending').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -463,8 +454,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/loan.php b/htdocs/admin/loan.php index 45202de342b..23cd1fd6bba 100644 --- a/htdocs/admin/loan.php +++ b/htdocs/admin/loan.php @@ -64,8 +64,7 @@ if ($action == 'update') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -108,8 +107,7 @@ foreach ($list as $key) { print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); } - else - { + else { print ''; } print ''; diff --git a/htdocs/admin/mailing.php b/htdocs/admin/mailing.php index 921a4a6338c..020c1ef5241 100644 --- a/htdocs/admin/mailing.php +++ b/htdocs/admin/mailing.php @@ -66,8 +66,7 @@ if ($action == 'setvalue') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/admin/mailman.php b/htdocs/admin/mailman.php index 05c36128e8d..100b5cf3224 100644 --- a/htdocs/admin/mailman.php +++ b/htdocs/admin/mailman.php @@ -66,8 +66,7 @@ if ($action == 'update' || $action == 'add') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -100,8 +99,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf $langs->load("errors"); setEventMessages($langs->trans("ErrorBadEMail", $email), null, 'errors'); } - else - { + else { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; $mailmanspip = new MailmanSpip($db); @@ -119,8 +117,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf $error++; setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("MailmanCreationSuccess"), null); } } @@ -132,8 +129,7 @@ if (($action == 'testsubscribe' || $action == 'testunsubscribe') && !empty($conf $error++; setEventMessages($mailmanspip->error, $mailmanspip->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("MailmanDeletionSuccess"), null); } } @@ -212,8 +208,7 @@ if (!empty($conf->global->ADHERENT_USE_MAILMAN)) print ''; } -else -{ +else { dol_fiche_head($head, 'mailman', $langs->trans("Setup"), 0, 'user'); $link = ''; diff --git a/htdocs/admin/mails.php b/htdocs/admin/mails.php index 5502d44dae0..42ddb907b7d 100644 --- a/htdocs/admin/mails.php +++ b/htdocs/admin/mails.php @@ -170,8 +170,7 @@ if ($action == 'edit') jQuery("#smtp_server_mess").show(); jQuery("#smtp_port_mess").show();'; } - else - { + else { print ' jQuery("#MAIN_MAIL_SMTP_SERVER").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_PORT").prop("disabled", true); @@ -287,8 +286,7 @@ if ($action == 'edit') { print $form->selectarray('MAIN_MAIL_SENDMODE', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE); } - else - { + else { $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE]; if (empty($text)) $text = $langs->trans("Undefined"); $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -305,8 +303,7 @@ if ($action == 'edit') print ''; } - else - { + else { print ''; } @@ -549,8 +539,7 @@ else { print ''; } - else - { + else { print ''; } @@ -699,8 +688,7 @@ else print $conf->global->MAIN_MAIL_AUTOCOPY_TO; if (!isValidEmail($conf->global->MAIN_MAIL_AUTOCOPY_TO)) print img_warning($langs->trans("ErrorBadEMail")); } - else - { + else { print ' '; } print ''; @@ -722,8 +710,7 @@ else print ''.$langs->trans("DoTestServerAvailability").''; } } - else - { + else { print ''.$langs->trans("DoTestServerAvailability").''; } @@ -795,8 +782,7 @@ else $mail = new CMailFile('', '', '', '', array(), array(), array(), '', '', 0, '', '', '', '', $trackid, $sendcontext); $result = $mail->check_server_port($server, $port); if ($result) print '
'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'
'; - else - { + else { $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port); if ($mail->error) { diff --git a/htdocs/admin/mails_emailing.php b/htdocs/admin/mails_emailing.php index 84a0d2a0893..98c44f2b503 100644 --- a/htdocs/admin/mails_emailing.php +++ b/htdocs/admin/mails_emailing.php @@ -157,8 +157,7 @@ if ($action == 'edit') jQuery("#smtp_port_mess").show(); '; } - else - { + else { print ' jQuery("#MAIN_MAIL_SMTP_SERVER_EMAILING").prop("disabled", true); jQuery("#MAIN_MAIL_SMTP_PORT_EMAILING").prop("disabled", true); @@ -237,8 +236,7 @@ if ($action == 'edit') { print $form->selectarray('MAIN_MAIL_SENDMODE_EMAILING', $listofmethods, $conf->global->MAIN_MAIL_SENDMODE_EMAILING); } - else - { + else { $text = $listofmethods[$conf->global->MAIN_MAIL_SENDMODE_EMAILING]; if (empty($text)) $text = $langs->trans("Undefined"); $htmltext = $langs->trans("ContactSuperAdminForChange"); @@ -256,8 +254,7 @@ if ($action == 'edit') print '
'; } - else - { + else { print ''; } @@ -425,8 +415,7 @@ else { print ''; } - else - { + else { print ''; } @@ -507,8 +496,7 @@ else print ''.$langs->trans("DoTestServerAvailability").''; } } - else - { + else { print ''.$langs->trans("DoTestServerAvailability").''; } @@ -539,8 +527,7 @@ else $result = $mail->check_server_port($server, $port); if ($result) print '
'.$langs->trans("ServerAvailableOnIPOrPort", $server, $port).'
'; - else - { + else { $errormsg = $langs->trans("ServerNotAvailableOnIPOrPort", $server, $port); if ($mail->error) { diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 1c50ebf0949..fd5f4e3b1a7 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -282,8 +282,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit { $num = $nbtotalofrecords; } -else -{ +else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 37d1f903b4a..1dcc621095c 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -123,8 +123,7 @@ if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $helpsubstitforlines .= $key.' -> '.$val.'
'; } } -else -{ +else { $tmp = FormMail::getAvailableSubstitKey('formemailwithlines'); $tmp['__(AnyTranslationKey)__'] = 'Translation'; $helpsubstit = $langs->trans("AvailableVariables").':
'; @@ -297,8 +296,7 @@ if (empty($reshook)) setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); $_POST = array('id'=>$id); // Clean $_POST array, we keep only id } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors'); } @@ -356,8 +354,7 @@ if (empty($reshook)) { setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($db->error(), null, 'errors'); } } @@ -377,8 +374,7 @@ if (empty($reshook)) { setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors'); } - else - { + else { dol_print_error($db); } } @@ -577,8 +573,7 @@ foreach ($fieldsforcontent as $tmpfieldlist) elseif ($tmpfieldlist == 'joinfiles') { print ''; } - else - { + else { if ($context != 'hide') { // print ''; $okforextended = true; @@ -587,8 +582,7 @@ foreach ($fieldsforcontent as $tmpfieldlist) $doleditor = new DolEditor($tmpfieldlist, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%'); print $doleditor->Create(1); } - else - print ' '; + else print ' '; } print ''; if ($tmpfieldlist == 'topic') { @@ -802,8 +796,7 @@ if ($resql) print "\n"; } - else - { + else { $keyforobj = 'type_template'; if (!in_array($obj->$keyforobj, array_keys($elementList))) { @@ -989,15 +982,13 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { print $form->select_dolusers($obj->{$fieldlist[$field]}, 'fk_user', 1, null, 0, '', null, 0, 0, 1, '', 0, '', 'maxwidth200'); } - else - { + else { if ($context == 'add') // I am not admin and we show the add form { print $user->getNomUrl(1); // Me $forcedvalue = $user->id; } - else - { + else { if ($obj && !empty($obj->{$fieldlist[$field]}) && $obj->{$fieldlist[$field]} > 0) { $fuser = new User($db); @@ -1005,8 +996,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print $fuser->getNomUrl(1); $forcedvalue = $fuser->id; } - else - { + else { $forcedvalue = $obj->{$fieldlist[$field]}; } } @@ -1024,8 +1014,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') if ($context == 'edit') $selectedlang = $obj->{$fieldlist[$field]}; print $formadmin->select_language($selectedlang, 'langcode', 0, null, 1, 0, 0, 'maxwidth150'); } - else - { + else { if (!empty($obj->{$fieldlist[$field]})) { print $obj->{$fieldlist[$field]}.' - '.$langs->trans('Language_'.$obj->{$fieldlist[$field]}); @@ -1046,8 +1035,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') print ''; print $obj->{$fieldlist[$field]}; } - else - { + else { print $form->selectarray('type_template', $elementList, (!empty($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1, 0, 0, '', 0, 0, 0, '', 'maxwidth150 maxwidth100onsmartphone'); } print ''; @@ -1055,8 +1043,7 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') elseif ($context == 'add' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'edit' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; elseif ($context == 'hide' && in_array($fieldlist[$field], array('topic', 'joinfiles', 'content', 'content_lines'))) continue; - else - { + else { $size = ''; $class = ''; $classtd = ''; if ($fieldlist[$field] == 'code') $class = 'maxwidth100'; if ($fieldlist[$field] == 'label') $class = 'maxwidth100'; @@ -1073,14 +1060,12 @@ function fieldList($fieldlist, $obj = '', $tabname = '', $context = '') { print $form->selectyesno($fieldlist[$field], '1', 1); } - else - { + else { //print ''; print $form->selectyesno($fieldlist[$field], (isset($obj->{$fieldlist[$field]}) ? $obj->{$fieldlist[$field]}:''), 1); } } - else - { + else { print ''; } print ''; diff --git a/htdocs/admin/menus.php b/htdocs/admin/menus.php index 856ad50c28b..b66ab89075f 100644 --- a/htdocs/admin/menus.php +++ b/htdocs/admin/menus.php @@ -97,8 +97,7 @@ if ($action == 'update' && !$cancel) { $db->commit(); } - else - { + else { $error++; setEventMessages($langs->trans("FailedToInitializeMenu").' '.$key, null, 'errors'); $db->rollback(); diff --git a/htdocs/admin/menus/edit.php b/htdocs/admin/menus/edit.php index ef58c1042d4..a059a76b40c 100644 --- a/htdocs/admin/menus/edit.php +++ b/htdocs/admin/menus/edit.php @@ -103,9 +103,7 @@ if ($action == 'update') if (is_numeric(GETPOST('menuIdParent', 'alpha'))) { $menu->fk_menu = GETPOST('menuIdParent', 'alpha'); - } - else - { + } else { if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu = 0; else $menu->fk_menu = -1; $menu->fk_mainmenu = $mainmenu; @@ -116,14 +114,10 @@ if ($action == 'update') if ($result > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else - { + } else { setEventMessages($menu->error, $menu->errors, 'errors'); } - } - else - { + } else { setEventMessages($menu->error, $menu->errors, 'errors'); } $action = "edit"; @@ -131,8 +125,7 @@ if ($action == 'update') header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".$menu_handler); exit; } @@ -222,8 +215,7 @@ if ($action == 'add') { $menu->fk_menu = GETPOST('menuId', 'alpha', 3); } - else - { + else { if (GETPOST('type', 'alpha') == 'top') $menu->fk_menu = 0; else $menu->fk_menu = -1; $menu->fk_mainmenu = $mainmenu; @@ -236,8 +228,7 @@ if ($action == 'add') header("Location: ".DOL_URL_ROOT."/admin/menus/index.php?menu_handler=".GETPOST('menu_handler', 'aZ09')); exit; } - else - { + else { $action = 'create'; setEventMessages($menu->error, $menu->errors, 'errors'); } @@ -261,8 +252,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == 'yes') llxFooter(); exit; } - else - { + else { $this->db->rollback(); $reload = 0; @@ -359,8 +349,7 @@ if ($action == 'create') print $langs->trans('Left'); print ''; } - else - { + else { print '
'; } - else - { + else { print ''; } print '"; diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index d5bf12f1061..7b64dd08bd0 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -105,8 +105,7 @@ foreach ($modulesdir as $dir) continue; } - try - { + try { $res = include_once $dir.$file; if (class_exists($modName)) { @@ -141,8 +140,7 @@ foreach ($modulesdir as $dir) { $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; } - else - { + else { $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); } } @@ -188,8 +186,7 @@ foreach ($modulesdir as $dir) dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } - else - { + else { print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; } } @@ -202,8 +199,7 @@ foreach ($modulesdir as $dir) } closedir($handle); } - else - { + else { dol_syslog("htdocs/admin/modulehelp.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); } } @@ -332,8 +328,7 @@ if ($mode == 'desc') $text .= $textexternal; $text .= '
'; } - else - { + else { $text .= '
'.$langs->trans("Origin").': '.$langs->trans("Core").'
'; } @@ -450,8 +445,7 @@ if ($mode == 'feature') { $yesno = 'Yes'; } - else - { + else { $yesno = 'No'; } require_once DOL_DOCUMENT_ROOT.'/core/class/interfaces.class.php'; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c0f1991835b..dba149a2bb0 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -126,8 +126,7 @@ if ($action == 'install') setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings'); $error++; } - else - { + else { if (!$error && !preg_match('/\.zip$/i', $original_file)) { $langs->load("errors"); @@ -174,8 +173,7 @@ if ($action == 'install') setEventMessages($langs->trans($result['error'], $original_file), null, 'errors'); $error++; } - else - { + else { // Now we move the dir of the module $modulename = preg_replace('/module_/', '', $original_file); $modulename = preg_replace('/\-([0-9][0-9\.]*)\.zip$/i', '', $modulename); @@ -231,8 +229,7 @@ if ($action == 'install') } } } - else - { + else { setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors'); $error++; } @@ -248,8 +245,7 @@ if ($action == 'set' && $user->admin) { $resarray = activateModule($value); if (!empty($resarray['errors'])) setEventMessages('', $resarray['errors'], 'errors'); - else - { + else { //var_dump($resarray);exit; if ($resarray['nbperms'] > 0) { @@ -341,8 +337,7 @@ foreach ($modulesdir as $dir) continue; } - try - { + try { $res = include_once $dir.$file; // A class already exists in a different file will send a non catchable fatal error. if (class_exists($modName)) { @@ -376,8 +371,7 @@ foreach ($modulesdir as $dir) { $arrayofnatures['external_'.$publisher] = $langs->trans("External").' - '.$publisher; } - else - { + else { $arrayofnatures['external_'] = $langs->trans("External").' - '.$langs->trans("UnknownPublishers"); } } @@ -438,8 +432,7 @@ foreach ($modulesdir as $dir) dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } } - else - { + else { print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)
"; } } @@ -452,8 +445,7 @@ foreach ($modulesdir as $dir) } closedir($handle); } - else - { + else { dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); } } @@ -716,8 +708,7 @@ if ($mode == 'common' || $mode == 'commonkanban') } if (!empty($conf->multicompany->enabled) && $user->entity) $disableSetup++; } - else - { + else { if (!empty($objMod->warnings_unactivation[$mysoc->country_code]) && method_exists($objMod, 'alreadyUsed') && $objMod->alreadyUsed()) { $codeenabledisable .= 'warnings_unactivation[$mysoc->country_code].'&value='.$modName.'&mode='.$mode.$param.'">'; $codeenabledisable .= img_picto($langs->trans("Activated"), 'switch_on'); @@ -752,15 +743,13 @@ if ($mode == 'common' || $mode == 'commonkanban') $codetoconfig .= ''.img_picto(ucfirst($page), "setup").''; // print ''.ucfirst($page).' '; } - else - { + else { if (preg_match('/^([^@]+)@([^@]+)$/i', $urlpage, $regs)) { $urltouse = dol_buildpath('/'.$regs[2].'/admin/'.$regs[1], 1); $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } - else - { + else { $urltouse = $urlpage; $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } @@ -771,17 +760,15 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } - else - { + else { $codetoconfig .= ''.img_picto($langs->trans("Setup"), "setup", 'style="padding-right: 6px"', false, 0, 0, '', 'fa-15').''; } } - else - { + else { $codetoconfig .= img_picto($langs->trans("NothingToSetup"), "setup", 'class="opacitytransp" style="padding-right: 6px"', false, 0, 0, '', 'fa-15'); } } - else // Module not yet activated + else // Module not yet activated { // Set $codeenabledisable if (!empty($objMod->always_enabled)) @@ -792,8 +779,7 @@ if ($mode == 'common' || $mode == 'commonkanban') { $codeenabledisable .= $langs->trans("Disabled"); } - else - { + else { // Module qualified for activation $warningmessage = ''; if (!empty($arrayofwarnings[$modName])) @@ -857,8 +843,7 @@ if ($mode == 'common' || $mode == 'commonkanban') if (preg_match('/^\//i', $objMod->picto)) print img_picto($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"', 1); else print img_object($alttext, $objMod->picto, 'class="valignmiddle pictomodule paddingrightonly"'); } - else - { + else { print img_object($alttext, 'generic', 'class="valignmiddle paddingrightonly"'); } print ' '.$objMod->getName().''; @@ -1028,8 +1013,7 @@ if ($mode == 'deploy') $message = info_admin($langs->trans("ConfFileMustContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT)); $allowfromweb = -1; } - else - { + else { if ($dirins_ok) { if (!is_writable(dol_osencode($dirins))) @@ -1039,15 +1023,13 @@ if ($mode == 'deploy') $allowfromweb = 0; } } - else - { + else { $message = info_admin($langs->trans("NotExistsDirect", $dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample")); $allowfromweb = 0; } } } - else - { + else { $message = info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile", $dolibarrdataroot.'/installmodules.lock')); $allowfromweb = 0; } @@ -1068,8 +1050,7 @@ if ($mode == 'deploy') { //print $langs->trans("ThisIsProcessToFollow").'
'; } - else - { + else { print $langs->trans("ThisIsAlternativeProcessToFollow").'
'; print ''.$langs->trans("StepNb", 1).': '; print $langs->trans("FindPackageFromWebSite", $fullurl).'
'; @@ -1150,8 +1131,7 @@ if ($mode == 'deploy') print info_admin($langs->trans("ThisLimitIsDefinedInSetup", $max, $maxphptoshow, $maxphptoshowparam), 1); } } - else - { + else { print ' ('.$langs->trans("UploadDisabled").')'; } @@ -1162,8 +1142,7 @@ if ($mode == 'deploy') print '
'; } - else - { + else { print $langs->trans("UnpackPackageInModulesRoot", $dirins).'
'; print ''.$langs->trans("StepNb", 4).': '; print $langs->trans("SetupIsReadyForUse").'
'; diff --git a/htdocs/admin/mrp.php b/htdocs/admin/mrp.php index 9c59b5cf6da..ddf55993fd7 100644 --- a/htdocs/admin/mrp.php +++ b/htdocs/admin/mrp.php @@ -59,8 +59,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -97,14 +96,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=mrp&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, null, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -162,8 +159,7 @@ elseif ($action == 'set_MRP_MO_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -180,8 +176,7 @@ elseif ($action == 'set_MRP_MO_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -263,8 +258,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -329,8 +323,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -400,8 +393,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print '
"; @@ -413,8 +405,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -443,8 +434,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -490,8 +480,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 4ba581398ee..1b912b27b5e 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -54,8 +54,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -67,8 +66,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -146,8 +144,7 @@ elseif ($action == 'setapilayer') dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha')); //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); } - else - { + else { $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); if ($result > 0) { setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs"); diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index ba92aa1ec21..859d36b7c36 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -85,8 +85,7 @@ if ($action == 'settemplates') setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); @@ -107,8 +106,7 @@ if ($action == 'setvalue' && $user->admin) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); @@ -161,8 +159,7 @@ if ($action == 'setfixednotif' && $user->admin) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); diff --git a/htdocs/admin/oauth.php b/htdocs/admin/oauth.php index 785a77ac043..85f9ebf0409 100644 --- a/htdocs/admin/oauth.php +++ b/htdocs/admin/oauth.php @@ -120,8 +120,7 @@ foreach ($list as $key) print ''; } - else - { + else { print ''; print ''; print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index d8c65f9a2c5..f0d3c530b71 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -79,8 +79,7 @@ if ($action == 'setconst' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -99,8 +98,7 @@ if ($action == 'setvalue' && $user->admin) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -179,8 +177,7 @@ if ($mode == 'setup' && $user->admin) $urltodelete = ''; $urltocheckperms = ''; } - else - { + else { $urltorenew = ''; $urltodelete = ''; $urltocheckperms = ''; @@ -194,8 +191,7 @@ if ($mode == 'setup' && $user->admin) require_once DOL_DOCUMENT_ROOT.'/includes/OAuth/bootstrap.php'; // Dolibarr storage $storage = new DoliStorage($db, $conf); - try - { + try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME); } catch (Exception $e) @@ -226,8 +222,7 @@ if ($mode == 'setup' && $user->admin) { $expiredat = $langs->trans("Unknown"); } - else - { + else { $expiredat = dol_print_date($endoflife, "dayhour"); } } diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index a5b494b62e2..2873cf5d15f 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -57,8 +57,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -184,8 +183,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 496a32923f7..ec4015f6e98 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -190,8 +190,7 @@ for ($i = 1; $i <= 6; $i++) $pid = $langs->transcountry("ProfId".$i, $mysoc->country_code); if ($pid == '-') $pid = false; } - else - { + else { $pid = img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; } if ($pid) diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 0486edebeec..7dcaf0fba47 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -230,8 +230,7 @@ if ($result) print img_picto($langs->trans("Active"), 'tick'); print ''; } - else - { + else { print ''; diff --git a/htdocs/admin/prelevement.php b/htdocs/admin/prelevement.php index e9795304ad3..b33b2396aa2 100644 --- a/htdocs/admin/prelevement.php +++ b/htdocs/admin/prelevement.php @@ -101,8 +101,7 @@ if ($action == "set") $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index 73703829b8c..f2c748b4ce2 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -64,8 +64,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -101,14 +100,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=propal&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -127,8 +124,7 @@ elseif ($action == 'setribchq') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -143,8 +139,7 @@ elseif ($action == 'set_PROPALE_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -160,8 +155,7 @@ elseif ($action == 'set_PROPOSAL_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -175,8 +169,7 @@ elseif ($action == 'setdefaultduration') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -191,8 +184,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -311,8 +303,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -377,8 +368,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -449,8 +439,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print ""; @@ -462,8 +451,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -497,8 +485,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -572,14 +559,12 @@ if (empty($conf->facture->enabled)) } print ""; } - else - { + else { print "".$langs->trans("NoActiveBankAccountDefined").""; } } } - else - { + else { print ''.$langs->trans("BankModuleNotActive").''; } } @@ -686,8 +671,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/receiptprinter.php b/htdocs/admin/receiptprinter.php index 8730f148c07..dc6aa5da33b 100644 --- a/htdocs/admin/receiptprinter.php +++ b/htdocs/admin/receiptprinter.php @@ -90,8 +90,7 @@ if ($action == 'addprinter' && $user->admin) { $db->commit(); setEventMessages($langs->trans("PrinterAdded", $printername), null); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -116,8 +115,7 @@ if ($action == 'deleteprinter' && $user->admin) { $db->commit(); setEventMessages($langs->trans("PrinterDeleted", $printername), null); } - else - { + else { $db->rollback(); dol_print_error($db); } diff --git a/htdocs/admin/reception_setup.php b/htdocs/admin/reception_setup.php index 312038d3fcc..68f8f0e62ee 100644 --- a/htdocs/admin/reception_setup.php +++ b/htdocs/admin/reception_setup.php @@ -72,8 +72,7 @@ if ($action == 'updateMask') { if ($res > 0) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - else - setEventMessages($langs->trans("Error"), null, 'errors'); + else setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -133,14 +132,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=reception&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -264,8 +261,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -332,8 +328,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -402,8 +397,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print '"; @@ -415,8 +409,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -447,8 +440,7 @@ foreach ($dirmodels as $reldir) { print 'scandir.'&label='.urlencode($module->name).'">'.img_object($langs->trans("Preview"), 'reception').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; diff --git a/htdocs/admin/resource.php b/htdocs/admin/resource.php index 3efdd05bdc7..04ff3861c7f 100644 --- a/htdocs/admin/resource.php +++ b/htdocs/admin/resource.php @@ -92,8 +92,7 @@ if (empty($conf->use_javascript_ajax)) print $langs->trans("NotAvailableWhenAjaxDisabled"); print ''; } -else -{ +else { print '\n"; @@ -436,8 +431,7 @@ if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) //Do not allow "disable encryption" as passwords cannot be decrypted print ''.$langs->trans("Disable").''; } - else - { + else { print '-'; } print ""; @@ -463,8 +457,7 @@ if (empty($dolibarr_main_db_pass) && empty($dolibarr_main_db_encrypted_pass)) $langs->load("errors"); print img_warning($langs->trans("WarningPassIsEmpty")); } -else -{ +else { if (empty($dolibarr_main_db_encrypted_pass)) { print ''.$langs->trans("Activate").''; @@ -516,8 +509,7 @@ if (GETPOST('info', 'int') > 0) { print $langs->trans("Note: The function password_hash exists on your PHP")."
\n"; } - else - { + else { print $langs->trans("Note: The function password_hash does not exists on your PHP")."
\n"; } print 'MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO."
\n"; diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php index f642cd64182..b6674f00c5c 100644 --- a/htdocs/admin/security_other.php +++ b/htdocs/admin/security_other.php @@ -51,8 +51,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } elseif (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { @@ -62,8 +61,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) Header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -119,20 +117,17 @@ if (function_exists("imagecreatefrompng")) { print ajax_constantonoff('MAIN_SECURITY_ENABLECAPTCHA'); } - else - { + else { if (empty($conf->global->MAIN_SECURITY_ENABLECAPTCHA)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; } - else - { + else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } } -else -{ +else { $desc = $form->textwithpicto('', $langs->transnoentities("EnableGDLibraryDesc"), 1, 'warning'); print $desc; } @@ -146,14 +141,12 @@ if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('MAIN_USE_ADVANCED_PERMS'); } -else -{ +else { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; } - else - { + else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } diff --git a/htdocs/admin/sms.php b/htdocs/admin/sms.php index 09cc0debfd5..0745203f365 100644 --- a/htdocs/admin/sms.php +++ b/htdocs/admin/sms.php @@ -123,8 +123,7 @@ if ($action == 'send' && !$_POST['cancel']) setEventMessages($langs->trans("SmsSuccessfulySent", $smsfrom, $sendto), null, 'mesgs'); setEventMessages($smsfile->error, $smsfile->errors, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("ResultKo"), null, 'errors'); setEventMessages($smsfile->error, $smsfile->errors, 'errors'); } @@ -206,8 +205,7 @@ if ($action == 'edit') print ''; print '
'; } -else -{ +else { if (!count($listofmethods)) print '
'.$langs->trans("NoSmsEngine", 'DoliStore').'
'; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : ''); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -319,8 +316,7 @@ if ($action == 'edit') print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $text = !empty($mainserver) ? $mainserver : $smtpserver; $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); @@ -337,8 +333,7 @@ if ($action == 'edit') print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : ''); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -351,8 +346,7 @@ if ($action == 'edit') print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $text = (!empty($mainport) ? $mainport : $smtpport); $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); @@ -371,8 +365,7 @@ if ($action == 'edit') { print ''; } - else - { + else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID, $htmltext, 1, 'superadmin'); print ''; @@ -392,8 +385,7 @@ if ($action == 'edit') { print ''; } - else - { + else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW, $htmltext, 1, 'superadmin'); print ''; @@ -497,8 +489,7 @@ if ($action == 'edit') print ''; } -else -{ +else { dol_fiche_head($head, 'common', '', -1); print ''.$langs->trans("EMailsDesc")."
\n"; @@ -539,8 +530,7 @@ else { print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER) ? $conf->global->MAIN_MAIL_SMTP_SERVER : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_PORT) ? $conf->global->MAIN_MAIL_SMTP_PORT : '').'
'; print $langs->trans("SeeLocalSendMailSetup"); } - else - { + else { $mainserver = (!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : ''); $smtpserver = ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike"); @@ -270,8 +267,7 @@ if ($action == 'edit') print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $text = !empty($mainserver) ? $mainserver : $smtpserver; $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); @@ -289,8 +285,7 @@ if ($action == 'edit') print ''; print $langs->trans("SeeLocalSendMailSetup"); } - else - { + else { $mainport = (!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : ''); $smtpport = ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined"); if ($linuxlike) print $langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike"); @@ -303,8 +298,7 @@ if ($action == 'edit') print ''; print ''.$langs->trans("SeeLocalSendMailSetup").''; } - else - { + else { $text = (!empty($mainport) ? $mainport : $smtpport); $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($text, $htmltext, 1, 'superadmin'); @@ -323,8 +317,7 @@ if ($action == 'edit') { print ''; } - else - { + else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_ID_EMAILING, $htmltext, 1, 'superadmin'); print ''; @@ -342,8 +335,7 @@ if ($action == 'edit') { print ''; } - else - { + else { $htmltext = $langs->trans("ContactSuperAdminForChange"); print $form->textwithpicto($conf->global->MAIN_MAIL_SMTPS_PW_EMAILING, $htmltext, 1, 'superadmin'); print ''; @@ -391,8 +383,7 @@ if ($action == 'edit') print ''; } -else -{ +else { dol_fiche_head($head, 'common_emailing', '', -1); print ''.$langs->trans("EMailsDesc")."
\n"; @@ -415,8 +406,7 @@ else { print '
'.$langs->trans("MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_SERVER", ini_get('SMTP') ?ini_get('SMTP') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_SERVER_EMAILING : '').'
'.$langs->trans("MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike").''.$langs->trans("SeeLocalSendMailSetup").'
'.$langs->trans("MAIN_MAIL_SMTP_PORT", ini_get('smtp_port') ?ini_get('smtp_port') : $langs->transnoentities("Undefined")).''.(!empty($conf->global->MAIN_MAIL_SMTP_PORT_EMAILING) ? $conf->global->MAIN_MAIL_SMTP_PORT_EMAILING : '').'
'.$parent_rowid.''.$langs->trans('DetailMenuIdParent'); diff --git a/htdocs/admin/menus/index.php b/htdocs/admin/menus/index.php index 97f0246ac88..f27968d462d 100644 --- a/htdocs/admin/menus/index.php +++ b/htdocs/admin/menus/index.php @@ -192,8 +192,7 @@ elseif ($action == 'confirm_delete' && $confirm == 'yes') header("Location: ".DOL_URL_ROOT.'/admin/menus/index.php?menu_handler='.$menu_handler); exit; } - else - { + else { $db->rollback(); $reload = 0; @@ -409,8 +408,7 @@ if ($conf->use_javascript_ajax) print ''; } -else -{ +else { $langs->load("errors"); setEventMessages($langs->trans("ErrorFeatureNeedJavascript"), null, 'errors'); } diff --git a/htdocs/admin/menus/other.php b/htdocs/admin/menus/other.php index ed35f48d90e..145ec566057 100644 --- a/htdocs/admin/menus/other.php +++ b/htdocs/admin/menus/other.php @@ -95,8 +95,7 @@ if (empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } -else -{ +else { print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").''; print ''.img_edit_add().''; print '\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; $arrval = array( '0'=>$langs->trans("No"), diff --git a/htdocs/admin/security.php b/htdocs/admin/security.php index d9d61673c5e..161b521337b 100644 --- a/htdocs/admin/security.php +++ b/htdocs/admin/security.php @@ -46,8 +46,7 @@ if ($action == 'setgeneraterule') { dol_print_error($db); } - else - { + else { header("Location: ".$_SERVER["PHP_SELF"]); exit; } @@ -102,8 +101,7 @@ if ($action == 'activate_encrypt') header("Location: security.php"); exit; } - else - { + else { $db->rollback(); dol_print_error($db, ''); } @@ -132,8 +130,7 @@ if ($action == 'activate_encryptdbpassconf') header("Location: security.php"); exit; } - else - { + else { setEventMessages($langs->trans('InstrucToEncodePass', dol_encode($dolibarr_main_db_pass)), null, 'warnings'); } } @@ -149,8 +146,7 @@ elseif ($action == 'disable_encryptdbpassconf') header("Location: security.php"); exit; } - else - { + else { setEventMessages($langs->trans('InstrucToClearPass', $dolibarr_main_db_pass), null, 'warnings'); } } @@ -278,8 +274,7 @@ foreach ($arrayhandler as $key => $module) { print img_picto('', 'tick'); } - else - { + else { print ''.$langs->trans("Activate").''; } print "
'; @@ -265,8 +263,7 @@ else { print ''.$langs->trans("DoTestSend").''; } - else - { + else { print ''.$langs->trans("DoTestSend").''; } print ''; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php index d2a92aed9e8..fd4329b7023 100644 --- a/htdocs/admin/socialnetworks.php +++ b/htdocs/admin/socialnetworks.php @@ -49,8 +49,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -63,8 +62,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/admin/spip.php b/htdocs/admin/spip.php index 2ed43e97efd..6c1d1837ea8 100644 --- a/htdocs/admin/spip.php +++ b/htdocs/admin/spip.php @@ -74,8 +74,7 @@ if ($action == 'update' || $action == 'add') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -154,8 +153,7 @@ if (!empty($conf->global->ADHERENT_USE_SPIP)) print ''; } -else -{ +else { dol_fiche_head($head, 'spip', $langs->trans("Setup"), 0, 'user'); $link = ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 43e610c3052..d3b9061eecc 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -49,8 +49,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -63,8 +62,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -120,8 +118,7 @@ if (!empty($conf->facture->enabled)) print $form->selectarray("STOCK_CALCULATE_ON_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_BILL); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module30Name")); } print "\n\n"; @@ -140,8 +137,7 @@ if (!empty($conf->commande->enabled)) print $form->selectarray("STOCK_CALCULATE_ON_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module25Name")); } print "\n\n"; @@ -162,8 +158,7 @@ if (!empty($conf->expedition->enabled)) print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); } print "\n\n"; @@ -182,8 +177,7 @@ if (!empty($conf->expedition->enabled)) print $form->selectarray("STOCK_CALCULATE_ON_SHIPMENT_CLOSE", $arrval, $conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module80Name")); } print "\n\n"; @@ -222,8 +216,7 @@ if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUP print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_BILL", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; @@ -243,8 +236,7 @@ if (!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SUP print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER); } } -else -{ +else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "\n\n"; @@ -280,8 +272,7 @@ if (!empty($conf->reception->enabled)) print "\n\n"; $found++; } -else -{ +else { print ''; print ''; print '\n\n"; diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 977b99d0c99..c52f4296429 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -71,8 +71,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -110,14 +109,12 @@ if ($action == 'specimen') // For invoices header("Location: ".DOL_URL_ROOT."/document.php?modulepart=facture_fournisseur&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -186,8 +183,7 @@ if ($action == 'set_SUPPLIER_INVOICE_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -273,8 +269,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -341,8 +336,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -410,8 +404,7 @@ foreach ($dirmodels as $reldir) }*/ print ""; } - else - { + else { print '"; @@ -425,8 +418,7 @@ foreach ($dirmodels as $reldir) // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -488,8 +480,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/admin/supplier_order.php b/htdocs/admin/supplier_order.php index db9b3e257f6..f282ee8d7ca 100644 --- a/htdocs/admin/supplier_order.php +++ b/htdocs/admin/supplier_order.php @@ -69,8 +69,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -108,14 +107,12 @@ elseif ($action == 'specimen') // For orders header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande_fournisseur&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -197,8 +194,7 @@ elseif ($action == 'set_SUPPLIER_ORDER_OTHER') // Insert $newmodule->insert_permissions(1); } - else - { + else { // Remove all rights with Permission1190 $newmodule->delete_permissions(); @@ -218,8 +214,7 @@ elseif ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -305,8 +300,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -371,8 +365,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -430,14 +423,12 @@ foreach ($dirmodels as $reldir) print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } - else - { + else { print img_picto($langs->trans("Enabled"), 'switch_on'); } print ""; } - else - { + else { print '"; @@ -449,8 +440,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -554,8 +544,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); @@ -573,8 +562,7 @@ if ($conf->reception->enabled) { print ''.$langs->trans("FeatureNotAvailableWithReceptionModule").''; } -else -{ +else { if ($conf->use_javascript_ajax) { print ajax_constantonoff('SUPPLIER_ORDER_USE_DISPATCH_STATUS'); } else { diff --git a/htdocs/admin/supplier_payment.php b/htdocs/admin/supplier_payment.php index 5d7a0d0b8d5..1c4cfd5905e 100644 --- a/htdocs/admin/supplier_payment.php +++ b/htdocs/admin/supplier_payment.php @@ -58,8 +58,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } }elseif ($action == 'setmod') @@ -132,14 +131,12 @@ elseif ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_payment&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, $module->errors, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -207,8 +204,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -283,8 +279,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print ''; @@ -399,8 +394,7 @@ foreach ($dirmodels as $reldir) }*/ print ""; } - else - { + else { print '"; @@ -414,8 +408,7 @@ foreach ($dirmodels as $reldir) // Even if choice is the default value, we allow to disable it: For supplier invoice, we accept to have no doc generation at all print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').''; } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT"" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/admin/supplier_proposal.php b/htdocs/admin/supplier_proposal.php index c1007623a54..bb3454de4f7 100644 --- a/htdocs/admin/supplier_proposal.php +++ b/htdocs/admin/supplier_proposal.php @@ -61,8 +61,7 @@ if ($action == 'updateMask') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -99,14 +98,12 @@ if ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=supplier_proposal&file=SPECIMEN.pdf"); return; } - else - { + else { setEventMessages($module->error, null, 'errors'); dol_syslog($module->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -123,8 +120,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -141,8 +137,7 @@ if ($action == 'set_SUPPLIER_PROPOSAL_FREE_TEXT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -157,8 +152,7 @@ if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -279,8 +273,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -344,8 +337,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -415,8 +407,7 @@ foreach ($dirmodels as $reldir) print ''; print ''; } - else - { + else { print ""; @@ -428,8 +419,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Default"), 'on'); } - else - { + else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -463,8 +453,7 @@ foreach ($dirmodels as $reldir) { print ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -512,8 +501,7 @@ if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; } -else -{ +else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); @@ -544,21 +532,18 @@ if ($conf->banque->enabled) { print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL'); } - else - { + else { if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL)) { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } - else - { + else { print ''.img_picto($langs->trans("Enabled"), 'switch_on').''; } } print ''; } -else -{ +else { print ''; } diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 16b273cd6db..44143afb270 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -127,8 +127,7 @@ if ($action == 'set') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($error, $errors, 'errors'); } @@ -156,8 +155,7 @@ if ($action == 'setlevel') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index 3d0dddd6d10..db7559de17a 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -201,8 +201,7 @@ if ($showpromotemessage) print $langs->trans("ExampleOfNewsMessageForMajorRelease", DOL_VERSION, DOL_VERSION); print ''; } - else - { + else { print $langs->trans("TitleExampleForMaintenanceRelease").':
'; print ''; print '
'.$langs->trans("SmsInfoCharRemain").': '.(160 - dol_strlen($defaultmessage)).'
'; } diff --git a/htdocs/core/class/html.formsocialcontrib.class.php b/htdocs/core/class/html.formsocialcontrib.class.php index 5ecef635d73..ddc79a3c9cf 100644 --- a/htdocs/core/class/html.formsocialcontrib.class.php +++ b/htdocs/core/class/html.formsocialcontrib.class.php @@ -80,8 +80,7 @@ class FormSocialContrib $sql .= " AND c.fk_pays = ".$mysoc->country_id; $sql .= " ORDER BY c.libelle ASC"; } - else - { + else { $sql = "SELECT c.id, c.libelle as type"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c, ".MAIN_DB_PREFIX."c_country as co"; $sql .= " WHERE c.active = 1 AND c.fk_pays = co.rowid"; @@ -112,13 +111,11 @@ class FormSocialContrib if ($user->admin && $help) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); if (!empty($conf->use_javascript_ajax)) print ajax_combobox($htmlname); } - else - { + else { print $langs->trans("ErrorNoSocialContributionForSellerCountry", $mysoc->country_code); } } - else - { + else { dol_print_error($db, $db->lasterror()); } } diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 7b067fa11d6..e666260325c 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -80,8 +80,7 @@ class FormWebsite { $out .= '
"; @@ -256,8 +252,7 @@ function displayBox($selectedDate, $month, $year) { $stoploop = 1; } - else - { + else { $mydate = dol_getdate($thedate); if ($firstdate["month"] != $mydate["month"]) $stoploop = 1; } @@ -278,8 +273,7 @@ function displayBox($selectedDate, $month, $year) print sprintf("%02s", $tempDate["mday"]); print ", ".$selectYear; } - else - { + else { print "Click a Date"; } ?> diff --git a/htdocs/core/db/DoliDB.class.php b/htdocs/core/db/DoliDB.class.php index 2818eff65e2..f37d3a4b69d 100644 --- a/htdocs/core/db/DoliDB.class.php +++ b/htdocs/core/db/DoliDB.class.php @@ -121,8 +121,7 @@ abstract class DoliDB implements Database } return $ret; } - else - { + else { $this->transaction_opened++; dol_syslog('', 0, 1); return 1; @@ -147,13 +146,11 @@ abstract class DoliDB implements Database dol_syslog("COMMIT Transaction".($log ? ' '.$log : ''), LOG_DEBUG); return 1; } - else - { + else { return 0; } } - else - { + else { $this->transaction_opened--; return 1; } @@ -175,8 +172,7 @@ abstract class DoliDB implements Database dol_syslog("ROLLBACK Transaction".($log ? ' '.$log : ''), LOG_DEBUG); return $ret; } - else - { + else { $this->transaction_opened--; return 1; } @@ -253,8 +249,7 @@ abstract class DoliDB implements Database } return $return; } - else - { + else { return ''; } } @@ -331,7 +326,7 @@ abstract class DoliDB implements Database if ($res) { $results = array(); - if($this->num_rows($res) > 0){ + if ($this->num_rows($res) > 0){ while ($obj = $this->fetch_object($res)){ $results[] = $obj; } diff --git a/htdocs/core/db/mssql.class.php b/htdocs/core/db/mssql.class.php index 667f1986815..e5bd6c22e36 100644 --- a/htdocs/core/db/mssql.class.php +++ b/htdocs/core/db/mssql.class.php @@ -91,8 +91,7 @@ class DoliDBMssql extends DoliDB $this->connected = true; $this->ok = true; } - else - { + else { // host, login ou password incorrect $this->connected = false; $this->ok = false; @@ -109,8 +108,7 @@ class DoliDBMssql extends DoliDB $this->database_name = $name; $this->ok = true; } - else - { + else { $this->database_selected = false; $this->database_name = ''; $this->ok = false; @@ -118,8 +116,7 @@ class DoliDBMssql extends DoliDB dol_syslog(get_class($this)."::DoliDBMssql : Erreur Select_db ".$this->error, LOG_ERR); } } - else - { + else { // Pas de selection de base demandee, ok ou ko $this->database_selected = false; } @@ -250,8 +247,7 @@ class DoliDBMssql extends DoliDB } return $ret; } - else - { + else { return true; } } @@ -276,8 +272,7 @@ class DoliDBMssql extends DoliDB dol_syslog("COMMIT Transaction", LOG_DEBUG); return true; } - else - { + else { return false; } } @@ -368,8 +363,7 @@ class DoliDBMssql extends DoliDB $query .= " WHERE ".implode(" AND ", $query_comp); } } - else - { + else { if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches)) { $original_query = $query; @@ -432,8 +426,7 @@ class DoliDBMssql extends DoliDB // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) $ret = mssql_query($query, $this->db); } - else - { + else { $ret = mssql_query($query, $this->db); } @@ -598,8 +591,7 @@ class DoliDBMssql extends DoliDB // Si il y a eu echec de connexion, $this->db n'est pas valide. return 'DB_ERROR_FAILED_TO_CONNECT'; } - else - { + else { // Constants to convert a MSSql error code to a generic Dolibarr error code $errorcode_map = array( 1004 => 'DB_ERROR_CANNOT_CREATE', @@ -671,8 +663,7 @@ class DoliDBMssql extends DoliDB { return $data["id"]; } - else - { + else { return -1; } } @@ -849,8 +840,7 @@ class DoliDBMssql extends DoliDB { if (preg_match("/null/i", $field_desc['default'])) $sqlfields[$i] .= " default ".$field_desc['default']; - else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + else $sqlfields[$i] .= " default '".$field_desc['default']."'"; } elseif (preg_match("/^[^\s]/i", $field_desc['null'])) $sqlfields[$i] .= " ".$field_desc['null']; @@ -892,8 +882,7 @@ class DoliDBMssql extends DoliDB dol_syslog($sql); if (!$this -> query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -910,8 +899,7 @@ class DoliDBMssql extends DoliDB if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -958,16 +946,14 @@ class DoliDBMssql extends DoliDB if (preg_match("/^[^\s]/i", $field_desc['default'])) if (preg_match("/null/i", $field_desc['default'])) $sql .= " default ".$field_desc['default']; - else - $sql .= " default '".$field_desc['default']."'"; + else $sql .= " default '".$field_desc['default']."'"; if (preg_match("/^[^\s]/i", $field_desc['extra'])) $sql .= " ".$field_desc['extra']; $sql .= " ".$field_position; if (!$this -> query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -991,8 +977,7 @@ class DoliDBMssql extends DoliDB dol_syslog($sql, LOG_DEBUG); if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1038,8 +1023,7 @@ class DoliDBMssql extends DoliDB { return -1; } - else - { + else { // If user already exists, we continue to set permissions dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); } @@ -1051,8 +1035,7 @@ class DoliDBMssql extends DoliDB dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); return -1; } - else - { + else { if ($num) { $this->select_db($dolibarr_main_db_name); @@ -1207,8 +1190,7 @@ class DoliDBMssql extends DoliDB { $where = " IN ('".implode("','", $fields)."')"; } - else - { + else { $where = "='".$this->escape($fields)."'"; } $result = array(); @@ -1220,8 +1202,7 @@ class DoliDBMssql extends DoliDB $result[] = $obj; } } - else - return false; + else return false; return $result; } diff --git a/htdocs/core/db/mysqli.class.php b/htdocs/core/db/mysqli.class.php index 7c0d680662d..5f797b14c07 100644 --- a/htdocs/core/db/mysqli.class.php +++ b/htdocs/core/db/mysqli.class.php @@ -122,8 +122,7 @@ class DoliDBMysqli extends DoliDB if (!preg_match('/general/', $collation)) $this->db->query("SET collation_connection = ".$collation); } } - else - { + else { $this->database_selected = false; $this->database_name = ''; $this->ok = false; @@ -131,8 +130,7 @@ class DoliDBMysqli extends DoliDB dol_syslog(get_class($this)."::DoliDBMysqli : Select_db error ".$this->error, LOG_ERR); } } - else - { + else { // Pas de selection de base demandee, ok ou ko $this->database_selected = false; @@ -270,8 +268,7 @@ class DoliDBMysqli extends DoliDB // Ordre SQL ne necessitant pas de connexion a une base (exemple: CREATE DATABASE) $ret = $this->db->query($query); } - else - { + else { $ret = $this->db->query($query); } @@ -342,8 +339,7 @@ class DoliDBMysqli extends DoliDB if (!is_object($resultset)) { $resultset = $this->_results; } return $resultset->fetch_row(); } - else - { + else { // si le curseur est un booleen on retourne la valeur 0 return 0; } @@ -747,8 +743,7 @@ class DoliDBMysqli extends DoliDB if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -765,8 +760,7 @@ class DoliDBMysqli extends DoliDB if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -823,8 +817,7 @@ class DoliDBMysqli extends DoliDB { if (preg_match("/null/i", $field_desc['default'])) $sql .= " default ".$field_desc['default']; - else - $sql .= " default '".$field_desc['default']."'"; + else $sql .= " default '".$field_desc['default']."'"; } if (isset($field_desc['extra']) && preg_match("/^[^\s]/i", $field_desc['extra'])) { @@ -882,8 +875,7 @@ class DoliDBMysqli extends DoliDB dol_syslog(get_class($this)."::DDLUpdateField ".$sql, LOG_DEBUG); if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -929,8 +921,7 @@ class DoliDBMysqli extends DoliDB { return -1; } - else - { + else { // If user already exists, we continue to set permissions dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING); } diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php index bf9b468d4a8..f2378bcb998 100644 --- a/htdocs/core/db/pgsql.class.php +++ b/htdocs/core/db/pgsql.class.php @@ -105,8 +105,7 @@ class DoliDBPgsql extends DoliDB $this->connected = true; $this->ok = true; } - else - { + else { // host, login ou password incorrect $this->connected = false; $this->ok = false; @@ -123,8 +122,7 @@ class DoliDBPgsql extends DoliDB $this->database_name = $name; $this->ok = true; } - else - { + else { $this->database_selected = false; $this->database_name = ''; $this->ok = false; @@ -132,8 +130,7 @@ class DoliDBPgsql extends DoliDB dol_syslog(get_class($this)."::DoliDBPgsql : Erreur Select_db ".$this->error, LOG_ERR); } } - else - { + else { // Pas de selection de base demandee, ok ou ko $this->database_selected = false; } @@ -998,8 +995,7 @@ class DoliDBPgsql extends DoliDB { if (preg_match("/null/i", $field_desc['default'])) $sqlfields[$i] .= " default ".$field_desc['default']; - else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + else $sqlfields[$i] .= " default '".$field_desc['default']."'"; } elseif (preg_match("/^[^\s]/i", $field_desc['null'])) $sqlfields[$i] .= " ".$field_desc['null']; @@ -1041,8 +1037,7 @@ class DoliDBPgsql extends DoliDB dol_syslog($sql, LOG_DEBUG); if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1059,8 +1054,7 @@ class DoliDBPgsql extends DoliDB if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1313,8 +1307,7 @@ class DoliDBPgsql extends DoliDB { $fullpathofdump = '/usr/bin/pg_dump'; } - else - { + else { // TODO L'utilisateur de la base doit etre un superadmin pour lancer cette commande $resql = $this->query('SHOW data_directory'); if ($resql) @@ -1344,8 +1337,7 @@ class DoliDBPgsql extends DoliDB { $fullpathofdump = '/usr/bin/'.$tool; } - else - { + else { // TODO L'utilisateur de la base doit etre un superadmin pour lancer cette commande $resql = $this->query('SHOW data_directory'); if ($resql) diff --git a/htdocs/core/db/sqlite3.class.php b/htdocs/core/db/sqlite3.class.php index 2d24c232797..e5c9ef6b751 100644 --- a/htdocs/core/db/sqlite3.class.php +++ b/htdocs/core/db/sqlite3.class.php @@ -112,8 +112,7 @@ class DoliDBSqlite3 extends DoliDB $this->addCustomFunction('date_format'); //$this->db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); } - else - { + else { // host, login ou password incorrect $this->connected = false; $this->ok = false; @@ -554,8 +553,7 @@ class DoliDBSqlite3 extends DoliDB if (!is_object($resultset)) { $resultset = $this->_results; } return $resultset->fetchArray(SQLITE3_NUM); } - else - { + else { // si le curseur est un booleen on retourne la valeur 0 return false; } @@ -931,8 +929,7 @@ class DoliDBSqlite3 extends DoliDB { if (preg_match("/null/i", $field_desc['default'])) $sqlfields[$i] .= " default ".$field_desc['default']; - else - $sqlfields[$i] .= " default '".$field_desc['default']."'"; + else $sqlfields[$i] .= " default '".$field_desc['default']."'"; } elseif (preg_match("/^[^\s]/i", $field_desc['null'])) $sqlfields[$i] .= " ".$field_desc['null']; @@ -991,8 +988,7 @@ class DoliDBSqlite3 extends DoliDB if (!$this->query($sql)) return -1; - else - return 1; + else return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -1043,8 +1039,7 @@ class DoliDBSqlite3 extends DoliDB { if (preg_match("/null/i", $field_desc['default'])) $sql .= " default ".$field_desc['default']; - else - $sql .= " default '".$field_desc['default']."'"; + else $sql .= " default '".$field_desc['default']."'"; } if (preg_match("/^[^\s]/i", $field_desc['extra'])) $sql .= " ".$field_desc['extra']; diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 4f85610e657..db926a2b6bc 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -63,8 +63,7 @@ if ($resql) // This can fail when class is used on old database (during migra $this->export_entities_array[$r][$fieldname] = $keyforelement; } // If this is a computed field - else - { + else { $this->export_fields_array[$r][$fieldname] = $fieldlabel; $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute'; $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed; diff --git a/htdocs/core/filemanagerdol/connectors/php/basexml.php b/htdocs/core/filemanagerdol/connectors/php/basexml.php index 0f50f33e988..22eae8093d4 100644 --- a/htdocs/core/filemanagerdol/connectors/php/basexml.php +++ b/htdocs/core/filemanagerdol/connectors/php/basexml.php @@ -98,8 +98,7 @@ function SendError($number, $text) SendErrorNode($number, $text); CreateXmlFooter(); } - else - { + else { SetXmlHeaders(); dol_syslog('Error: '.$number.' '.$text, LOG_ERR); @@ -127,6 +126,5 @@ function SendErrorNode($number, $text) { if ($text) echo ''; - else - echo ''; + else echo ''; } diff --git a/htdocs/core/filemanagerdol/connectors/php/commands.php b/htdocs/core/filemanagerdol/connectors/php/commands.php index dcc1650d4cd..01a4caf9420 100644 --- a/htdocs/core/filemanagerdol/connectors/php/commands.php +++ b/htdocs/core/filemanagerdol/connectors/php/commands.php @@ -86,8 +86,7 @@ function GetFoldersAndFiles($resourceType, $currentFolder) { if (is_dir($sServerDir.$sFile)) $aFolders[] = ''; - else - { + else { $iFileSize = @filesize($sServerDir.$sFile); if (!$iFileSize) { $iFileSize = 0; @@ -147,8 +146,7 @@ function CreateFolder($resourceType, $currentFolder) if (strpos($sNewFolderName, '..') !== false) $sErrorNumber = '102'; // Invalid folder name. - else - { + else { // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder($resourceType, $currentFolder, 'CreateFolder'); @@ -172,12 +170,10 @@ function CreateFolder($resourceType, $currentFolder) break; } } - else - $sErrorNumber = '103'; + else $sErrorNumber = '103'; } } - else - $sErrorNumber = '102'; + else $sErrorNumber = '102'; // Create the "Error" node. echo ''; @@ -255,8 +251,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') $sFileName = RemoveExtension($sOriginalFileName).'('.$iCounter.').'.$sExtension; $sErrorNumber = '201'; } - else - { + else { move_uploaded_file($oFile['tmp_name'], $sFilePath); if (is_file($sFilePath)) @@ -297,11 +292,9 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') } } } - else - $sErrorNumber = '202'; + else $sErrorNumber = '202'; } - else - $sErrorNumber = '202'; + else $sErrorNumber = '202'; $sFileUrl = CombinePaths(GetResourceTypePath($resourceType, $sCommand), $currentFolder); @@ -315,8 +308,7 @@ function FileUpload($resourceType, $currentFolder, $sCommand, $CKEcallback = '') // this line already exists so wrap the if block around it SendUploadResults($sErrorNumber, $sFileUrl, $sFileName); } - else - { + else { //issue the CKEditor Callback SendCKEditorResults( $CKEcallback, diff --git a/htdocs/core/filemanagerdol/connectors/php/io.php b/htdocs/core/filemanagerdol/connectors/php/io.php index 2a9ac9f146b..2da8b4d5baa 100644 --- a/htdocs/core/filemanagerdol/connectors/php/io.php +++ b/htdocs/core/filemanagerdol/connectors/php/io.php @@ -46,8 +46,7 @@ function GetResourceTypePath($resourceType, $sCommand) if ($sCommand == "QuickUpload") return $Config['QuickUploadPath'][$resourceType]; - else - return $Config['FileTypesPath'][$resourceType]; + else return $Config['FileTypesPath'][$resourceType]; } /** @@ -68,8 +67,7 @@ function GetResourceTypeDirectory($resourceType, $sCommand) // Map the "UserFiles" path to a local directory. return Server_MapPath($Config['QuickUploadPath'][$resourceType]); } - else - { + else { if (strlen($Config['FileTypesAbsolutePath'][$resourceType]) > 0) return $Config['FileTypesAbsolutePath'][$resourceType]; @@ -179,8 +177,7 @@ function CreateServerFolder($folderPath, $lastFolder = null) { mkdir($folderPath); } - else - { + else { $permissions = '0777'; if (isset($Config['ChmodOnFolderCreate']) && $Config['ChmodOnFolderCreate']) { @@ -203,8 +200,7 @@ function CreateServerFolder($folderPath, $lastFolder = null) return $sErrorMsg; } - else - return ''; + else return ''; } /** diff --git a/htdocs/core/filemanagerdol/connectors/php/util.php b/htdocs/core/filemanagerdol/connectors/php/util.php index 1349ed00dad..5af89333a48 100644 --- a/htdocs/core/filemanagerdol/connectors/php/util.php +++ b/htdocs/core/filemanagerdol/connectors/php/util.php @@ -82,8 +82,7 @@ function ConvertToXmlAttribute($value) { $os = PHP_OS; } - else - { + else { $os = php_uname(); } @@ -91,8 +90,7 @@ function ConvertToXmlAttribute($value) { return (utf8_encode(htmlspecialchars($value))); } - else - { + else { return (htmlspecialchars($value)); } } diff --git a/htdocs/core/get_info.php b/htdocs/core/get_info.php index 1564fc3f9bc..969de383da0 100644 --- a/htdocs/core/get_info.php +++ b/htdocs/core/get_info.php @@ -90,8 +90,7 @@ if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $logouttext .= ''; $logouttext .= ''; } - else - { + else { $logouthtmltext .= $langs->trans("NoLogoutProcessWithAuthMode", $_SESSION["dol_authmode"]); $logouttext .= img_picto($langs->trans('Logout').":".$langs->trans('Logout'), 'logout_top.png', 'class="login"', 0, 0, 1); } @@ -118,7 +117,7 @@ $result = $hookmanager->executeHooks('printTopRightMenu', $parameters); // Note if (is_numeric($result)) { if (empty($result)) $toprightmenu .= $hookmanager->resPrint; // add - else $toprightmenu = $hookmanager->resPrint; // replace + else $toprightmenu = $hookmanager->resPrint; // replace } else $toprightmenu .= $result; // For backward compatibility diff --git a/htdocs/core/get_menudiv.php b/htdocs/core/get_menudiv.php index 92b8dc34a0e..6a034377ce7 100644 --- a/htdocs/core/get_menudiv.php +++ b/htdocs/core/get_menudiv.php @@ -178,7 +178,7 @@ if (empty($user->socid)) // If internal user or not defined { $conf->standard_menu = (empty($conf->global->MAIN_MENU_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENU_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENU_STANDARD) : $conf->global->MAIN_MENU_STANDARD_FORCED); } -else // If external user +else // If external user { $conf->standard_menu = (empty($conf->global->MAIN_MENUFRONT_STANDARD_FORCED) ? (empty($conf->global->MAIN_MENUFRONT_STANDARD) ? 'eldy_menu.php' : $conf->global->MAIN_MENUFRONT_STANDARD) : $conf->global->MAIN_MENUFRONT_STANDARD_FORCED); } diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index b78c0478370..d86f823f4c9 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -186,7 +186,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle $qualified = 0; } } - else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE + else // This is a test on a constant. For example when we have -- VMYSQLUTF8UNICODE, we test constant $conf->global->UTF8UNICODE { $dbcollation = strtoupper(preg_replace('/_/', '', $conf->db->dolibarr_main_db_collation)); //var_dump($reg[2]); @@ -226,8 +226,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if ($buffer) $arraysql[$i] = $buffer; fclose($fp); } - else - { + else { dol_syslog("Admin.lib::run_sql failed to open file ".$sqlfile, LOG_ERR); } @@ -252,8 +251,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle $listofmaxrowid[$table] = $obj->max; if (empty($listofmaxrowid[$table])) $listofmaxrowid[$table] = 0; } - else - { + else { if (!$silent) print '"; if (!$silent) print ''; @@ -370,8 +368,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle } // print ''; } - else - { + else { $errno = $db->errno(); if (!$silent) print ''."\n"; @@ -414,8 +411,7 @@ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handle if (!$silent) print ''."\n"; $ok = 1; } - else - { + else { if (!$silent) print ''; if (!$silent) print ''."\n"; $ok = 0; @@ -458,8 +454,7 @@ function dolibarr_del_const($db, $name, $entity = 1) $conf->global->$name = ''; return 1; } - else - { + else { dol_print_error($db); return -1; } @@ -555,8 +550,7 @@ function dolibarr_set_const($db, $name, $value, $type = 'chaine', $visible = 0, $conf->global->$name = $value; return 1; } - else - { + else { $error = $db->lasterror(); $db->rollback(); return -1; @@ -971,8 +965,7 @@ function activateModule($value, $withdeps = 1) { $ret['errors'][] = $objMod->error; } - else - { + else { if ($withdeps) { if (isset($objMod->depends) && is_array($objMod->depends) && !empty($objMod->depends)) @@ -1009,8 +1002,7 @@ function activateModule($value, $withdeps = 1) $ret['nbmodules'] += $resarray['nbmodules']; $ret['nbperms'] += $resarray['nbperms']; } - else - { + else { $ret['errors'][] = $langs->trans('activateModuleDependNotSatisfied', $objMod->name, $modulestring); } } @@ -1082,7 +1074,7 @@ function unActivateModule($value, $requiredby = 1) $result = $objMod->remove(); if ($result <= 0) $ret = $objMod->error; } - else // We come here when we try to unactivate a module when module does not exists anymore in sources + else // We come here when we try to unactivate a module when module does not exists anymore in sources { //print $dir.$modFile;exit; // TODO Replace this after DolibarrModules is moved as abstract class with a try catch to show module we try to disable has not been found or could not be loaded @@ -1163,8 +1155,7 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab { $j = $objMod->numero; } - else - { + else { $j = 1000 + $i; } @@ -1210,8 +1201,7 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab print 'Error in descriptor of module '.$const_name.'. Array ->dictionaries has not same number of record for key "tabname", "tablib", "tabsql" and "tabsqlsort"'; //print "$const_name: $nbtabname=$nbtablib=$nbtabsql=$nbtabsqlsort=$nbtabfield=$nbtabfieldvalue=$nbtabfieldinsert=$nbtabrowid=$nbtabcond=$nbtabfieldcheck=$nbtabhelp\n"; } - else - { + else { $taborder[] = 0; // Add an empty line } } @@ -1225,8 +1215,7 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab } closedir($handle); } - else - { + else { dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); } } @@ -1291,8 +1280,7 @@ function activateModulesRequiredByCountry($country_code) } closedir($handle); } - else - { + else { dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); } } @@ -1348,8 +1336,7 @@ function complete_elementList_with_modules(&$elementList) { $j = $objMod->numero; } - else - { + else { $j = 1000 + $i; } @@ -1393,8 +1380,7 @@ function complete_elementList_with_modules(&$elementList) } closedir($handle); } - else - { + else { dol_syslog("htdocs/admin/modules.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING); } } @@ -1448,16 +1434,14 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') if (is_numeric($key)) { // Very old behaviour $type = 'string'; } - else - { + else { if (is_array($const)) { $type = $const['type']; $label = $const['label']; $const = $key; } - else - { + else { $type = $const; $const = $key; } @@ -1549,8 +1533,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') print ''; print ''; } - else - { + else { print ''; } - else - { + else { print "'; } - else - { + else { //print ''; print ''; print ''; @@ -455,8 +452,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') } $db->free($resql); } - else - { + else { dol_print_error($db); } diff --git a/htdocs/core/lib/signature.lib.php b/htdocs/core/lib/signature.lib.php index 837f505c132..8dd24c87df6 100644 --- a/htdocs/core/lib/signature.lib.php +++ b/htdocs/core/lib/signature.lib.php @@ -63,8 +63,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '') if ($mode == 0) $out .= urlencode($ref); $out .= ($mode ? '' : ''); if ($mode == 1) $out .= '&hashp=hash_of_file'; - else - { + else { include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $propaltmp = new Propal($db); $res = $propaltmp->fetch(0, $ref); @@ -81,8 +80,7 @@ function getOnlineSignatureUrl($mode, $type, $ref = '') $out = $langs->trans("FeatureOnlineSignDisabled"); return $out; } - else - { + else { $out .= '&hashp='.$hashp; } } diff --git a/htdocs/core/lib/tax.lib.php b/htdocs/core/lib/tax.lib.php index cdf9fe29b1c..46682addf2c 100644 --- a/htdocs/core/lib/tax.lib.php +++ b/htdocs/core/lib/tax.lib.php @@ -175,8 +175,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } - else - { + else { // Count on payments date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; $sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, "; @@ -274,8 +273,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $company_id = $assoc['company_id']; } } - else - { + else { dol_print_error($db); return -3; } @@ -323,8 +321,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } - else - { + else { // Count on payments date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; $sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, "; @@ -425,8 +422,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $company_id = $assoc['company_id']; } } - else - { + else { dol_print_error($db); return -3; } @@ -529,8 +525,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di $company_id = $assoc['company_id']; } } - else - { + else { dol_print_error($db); return -3; } @@ -580,8 +575,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $paymentfacturetable = 'paiement_facture'; $invoicefieldref = 'ref'; } - else - { + else { $invoicetable = 'facture_fourn'; $invoicedettable = 'facture_fourn_det'; $fk_facture = 'fk_facture_fourn'; @@ -644,8 +638,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } - else - { + else { // Count on payments date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; $sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, "; @@ -743,8 +736,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $rate = $assoc['rate']; } } - else - { + else { dol_print_error($db); return -3; } @@ -792,8 +784,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire if (empty($conf->global->MAIN_INCLUDE_ZERO_VAT_IN_REPORTS)) $sql .= " AND (d.".$f_rate." <> 0 OR d.".$total_tva." <> 0)"; $sql .= " ORDER BY d.rowid, d.".$fk_facture; } - else - { + else { // Count on payments date $sql = "SELECT d.rowid, d.product_type as dtype, d.".$fk_facture." as facid, d.$f_rate as rate, d.total_ht as total_ht, d.total_ttc as total_ttc, d.".$total_tva." as total_vat, d.description as descr,"; $sql .= " d.".$total_localtax1." as total_localtax1, d.".$total_localtax2." as total_localtax2, "; @@ -894,8 +885,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $rate = $assoc['rate']; } } - else - { + else { dol_print_error($db); return -3; } @@ -998,8 +988,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire $rate = $assoc['rate']; } } - else - { + else { dol_print_error($db); return -3; } diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index cf6607e6960..4ed30dbcb2f 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -163,16 +163,14 @@ function showDirectPublicLink($object) { $out .= ''.$langs->trans("PublicInterfaceNotEnabled").''; } - else - { + else { $out .= img_picto('', 'object_globe.png').' '.$langs->trans("TicketPublicAccess").':
'; if ($url) { $out .= ''; $out .= ajax_autoselect("directpubliclink", 0); } - else - { + else { $out .= ''.$langs->trans("TicketNotCreatedFromPublicInterface").''; } } @@ -315,8 +313,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no if (is_object($objcon) && $objcon->id > 0) { $sql = "SELECT DISTINCT a.id, a.label as label,"; } - else - { + else { $sql = "SELECT a.id, a.label as label,"; } $sql .= " a.datep as dp,"; @@ -402,14 +399,12 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; - else - { + else { if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'"; elseif ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'"; } } - else - { + else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; else $sql .= " AND c.code = '".$db->escape($actioncode)."'"; @@ -527,8 +522,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no $i++; } } - else - { + else { dol_print_error($db); } @@ -555,8 +549,7 @@ function show_ticket_messaging($conf, $langs, $db, $filterobj, $objcon = '', $no { $out .= ''; } - else - { + else { $out .= ''; } if ($filterobj && get_class($filterobj) == 'Societe') $out .= ''; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index 0dcb6e8242d..8f7f6152c97 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -80,8 +80,7 @@ function tree_showpad(&$fulltree, $key, $silent = 0) if ($fulltree[$key]['level'] == $pos) print img_picto_common('', 'treemenu/branch.gif'); else print img_picto_common('', 'treemenu/line.gif'); } - else - { + else { if ($fulltree[$key]['level'] == $pos) print img_picto_common('', 'treemenu/branchbottom.gif'); else print img_picto_common('', 'treemenu/linebottom.gif'); } @@ -175,8 +174,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print $tab[$x]['buttons']; print '
'.$langs->trans("ReStockOnDispatchOrder").''; @@ -294,8 +285,7 @@ else print $form->selectarray("STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER", $arrval, $conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER); } } - else - { + else { print $langs->trans("ModuleMustBeEnabledFirst", $langs->transnoentitiesnoconv("Module40Name")); } print "
'."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=invoice_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=order_supplier">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'."\n"; print 'scandir.'&label='.urlencode($module->name).'&type=SUPPLIER_PAYMENT">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'; print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_PROPOSAL").' '.$langs->trans('NotAvailable').'
'; if (!$silent) print '
'.$langs->trans("Failed to get max rowid for ".$table)."
OK'.$langs->trans("OK").'
'.$langs->trans("ProcessMigrateScript").''.$langs->trans("KO").'
'; print ''; print ''; @@ -1595,7 +1578,7 @@ function form_constantes($tableau, $strictw3c = 0, $helptext = '') //var_dump($arrayofmessagename); print $form->selectarray('constvalue_'.$obj->name, $arrayofmessagename, $obj->value.':'.$tmp[1], 'None', 0, 0, '', 0, 0, 0, '', '', 1); } - else // type = 'string' ou 'chaine' + else // type = 'string' ou 'chaine' { print ''; } @@ -1685,8 +1668,7 @@ function addDocumentModel($name, $type, $label = '', $description = '') $db->commit(); return 1; } - else - { + else { dol_print_error($db); $db->rollback(); return -1; @@ -1718,8 +1700,7 @@ function delDocumentModel($name, $type) $db->commit(); return 1; } - else - { + else { dol_print_error($db); $db->rollback(); return -1; diff --git a/htdocs/core/lib/agenda.lib.php b/htdocs/core/lib/agenda.lib.php index 5d450aa4b04..6070264d487 100644 --- a/htdocs/core/lib/agenda.lib.php +++ b/htdocs/core/lib/agenda.lib.php @@ -305,8 +305,7 @@ function show_array_actions_to_do($max = 5) $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -394,8 +393,7 @@ function show_array_last_actions_done($max = 5) $db->free($resql); } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 1d3e80b90be..e917f99defb 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -495,8 +495,7 @@ function ajax_constantonoff($code, $input = array(), $entity = null, $revertonof if (empty($conf->global->$code)) print ''.img_picto($langs->trans("Disabled"), 'off').''; else print ''.img_picto($langs->trans("Enabled"), 'on').''; } - else - { + else { $out = "\n".' '; } - else - { + else { $return = $out; } } @@ -6954,8 +6889,7 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o $tmpmesgstring = preg_replace('/<\/div>/', '', $tmpmesgstring); $newmesgarray[] = $tmpmesgstring; } - else - { + else { dol_syslog("Error call of dol_htmloutput_mesg with an array with a value that is not a string", LOG_WARNING); } } @@ -7012,8 +6946,7 @@ function dol_sort_array(&$array, $index, $order = 'asc', $natsort = 0, $case_sen { $temp[$key] = $array[$key]->$index; } - else - { + else { $temp[$key] = $array[$key][$index]; } } @@ -7149,8 +7082,7 @@ function dol_getIdFromCode($db, $key, $tablename, $fieldkey = 'code', $fieldid = $db->free($resql); return $cache_codes[$tablename][$key][$fieldid]; } - else - { + else { return -1; } } @@ -7204,8 +7136,7 @@ function dol_eval($s, $returnvalue = 0, $hideerrors = 1) if ($hideerrors) return @eval('return '.$s.';'); else return eval('return '.$s.';'); } - else - { + else { if ($hideerrors) @eval($s); else eval($s); } @@ -7249,8 +7180,7 @@ function picto_from_langcode($codelang, $moreatt = '') ); if (isset($langtocountryflag[$codelang])) $flagImage = $langtocountryflag[$codelang]; - else - { + else { $tmparray = explode('_', $codelang); $flagImage = empty($tmparray[1]) ? $tmparray[0] : $tmparray[1]; } @@ -7469,8 +7399,7 @@ function getLanguageCodeFromCountryCode($countrycode) } } } - else - { + else { dol_syslog("Warning Exention php-intl is not available", LOG_WARNING); } @@ -7913,8 +7842,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) { $newres .= ($i2 > 0 ? ' OR ' : '').$field.' '.$operator.' '.$numnewcrit; } - else - { + else { $newres .= ($i2 > 0 ? ' OR ' : '').'1 = 2'; // force false } $i2++; // a criteria was added to string @@ -7965,7 +7893,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) } } } - else // $mode=0 + else // $mode=0 { $tmpcrits = explode('|', $crit); $i3 = 0; @@ -7979,8 +7907,7 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) { $newres .= $field." = ".(is_numeric(trim($tmpcrit)) ?trim($tmpcrit) : '0'); } - else - { + else { $newres .= $field." LIKE '"; $tmpcrit = trim($tmpcrit); @@ -8271,8 +8198,7 @@ function getDictvalue($tablename, $field, $id, $checkentity = false, $rowidfield $dictvalues[$tablename][$obj->{$rowidfield}] = $obj; } } - else - { + else { dol_print_error($db); } } @@ -8305,8 +8231,7 @@ function colorIsLight($stringcolor) $g = $tmp[1]; $b = $tmp[2]; } - else - { + else { $hexr = $stringcolor[0].$stringcolor[1]; $hexg = $stringcolor[2].$stringcolor[3]; $hexb = $stringcolor[4].$stringcolor[5]; diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 531e0fe242c..dcdd31a1cc2 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -233,8 +233,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_creation->id) print $object->user_creation->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_creation_id ? $object->user_creation_id : $object->user_creation); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -269,8 +268,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_modification->id) print $object->user_modification->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_modification_id ? $object->user_modification_id : $object->user_modification); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -305,8 +303,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_validation->id) print $object->user_validation->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_validation_id ? $object->user_validation_id : $object->user_validation); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -341,8 +338,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_approve->id) print $object->user_approve->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_approve_id ? $object->user_approve_id : $object->user_approve); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -405,8 +401,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_cloture->id) print $object->user_cloture->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_cloture); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -441,8 +436,7 @@ function dol_print_object_info($object, $usetable = 0) if ($object->user_rappro->id) print $object->user_rappro->getNomUrl(1, '', 0, 0, 0); else print $langs->trans("Unknown"); } - else - { + else { $userstatic = new User($db); $userstatic->fetch($object->user_rappro); if ($userstatic->id) print $userstatic->getNomUrl(1, '', 0, 0, 0); @@ -760,8 +754,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $maskcounter = $reg[1]; $hasglobalcounter = true; } - else - { + else { // setting some defaults so the rest of the code won't fail if there is a third party counter $masktri = '00000'; $maskcounter = '00000'; @@ -799,8 +792,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $masktype_value = substr(preg_replace('/^TE_/', '', $objsoc->typent_code), 0, dol_strlen($regType[1])); // get n first characters of thirdpaty typent_code (where n is length in mask) $masktype_value = str_pad($masktype_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } - else - { + else { $masktype = ''; $masktype_value = ''; } @@ -815,8 +807,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $maskuser_value = substr($lastname, 0, dol_strlen($regType[1])); // get n first characters of user firstname (where n is length in mask) $maskuser_value = str_pad($maskuser_value, dol_strlen($regType[1]), "#", STR_PAD_RIGHT); // we fill on right with # to have same number of char than into mask } - else - { + else { $maskuser = ''; $maskuser_value = ''; } @@ -961,7 +952,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $sqlwhere .= "(SUBSTRING(".$field.", ".$yearpos.", ".$yearlen.") = '".$yearcomp."'"; $sqlwhere .= " AND SUBSTRING(".$field.", ".$monthpos.", ".$monthlen.") = '".str_pad($monthcomp, $monthlen, '0', STR_PAD_LEFT)."')"; } - else // reset is done on january + else // reset is done on january { $sqlwhere .= '(SUBSTRING('.$field.', '.$yearpos.', '.$yearlen.") = '".$yearcomp."')"; } @@ -974,8 +965,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ { $posnumstart = mb_strrpos($maskwithnocode, $maskcounter, 'UTF-8'); } - else - { + else { $posnumstart = strrpos($maskwithnocode, $maskcounter); } // Pos of counter in final string (from 0 to ...) if ($posnumstart < 0) return 'ErrorBadMaskFailedToLocatePosOfSequence'; @@ -1142,7 +1132,7 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ $numFinal = preg_replace('/\{yy\}/i', date("y", $date) + $yearoffset, $numFinal); $numFinal = preg_replace('/\{y\}/i', substr(date("y", $date), 1, 1) + $yearoffset, $numFinal); } - else // we want yyyy to be current year + else // we want yyyy to be current year { $numFinal = preg_replace('/\{yyyy\}/i', date("Y", $date), $numFinal); $numFinal = preg_replace('/\{yy\}/i', date("y", $date), $numFinal); @@ -1224,8 +1214,7 @@ function check_value($mask, $value) $maskcounter = $reg[1]; $hasglobalcounter = true; } - else - { + else { // setting some defaults so the rest of the code won't fail if there is a third party counter $masktri = '00000'; $maskcounter = '00000'; @@ -1422,8 +1411,7 @@ function numero_semaine($time) { $numeroSemaine = 53; } - else - { + else { $numeroSemaine = 1; } } @@ -1528,8 +1516,7 @@ function dol_set_user_param($db, $conf, &$user, $tab) $user->conf->$key = $value; //print "key=".$key." user->conf->key=".$user->conf->$key; } - else - { + else { unset($user->conf->$key); } } @@ -1552,8 +1539,7 @@ function dol_print_reduction($reduction, $langs) { $string = $langs->transnoentities("Offered"); } - else - { + else { $string = vatrate($reduction, true); } @@ -1674,13 +1660,11 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $liste[$obj->id.':'.$record['fullname']] = dol_trunc($record['name'], $max, 'middle'); } } - else - { + else { $liste[0] = $obj->label.': '.$langs->trans("None"); } } - else - { + else { if ($type == 'member' && $obj->doc_template_name == 'standard') // Special case, if member template, we add variant per format { global $_Avery_Labels; @@ -1690,7 +1674,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $liste[$obj->id.':'.$key] = ($obj->label ? $obj->label : $obj->doc_template_name).' '.$val['name']; } } - else // Common usage + else // Common usage { $liste[$obj->id] = $obj->label ? $obj->label : $obj->doc_template_name; } @@ -1698,8 +1682,7 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $i++; } } - else - { + else { dol_print_error($db); return -1; } @@ -1777,8 +1760,7 @@ function getSoapParams() 'trace' => 1 ); } - else - { + else { $params = array('connection_timeout'=>$timeout, 'response_timeout'=>$response_timeout, 'proxy_use' => 0, @@ -1968,8 +1950,7 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) $i++; } } - else - { + else { dol_print_error($db); } @@ -2148,7 +2129,7 @@ function colorAgressiveness($hex, $ratio = -50, $brightness = 0) if ($color > 127) $color += ((255 - $color) * ($ratio / 100)); if ($color < 128) $color -= ($color * ($ratio / 100)); } - else // We decrease agressiveness + else // We decrease agressiveness { if ($color > 128) $color -= (($color - 128) * (abs($ratio) / 100)); if ($color < 127) $color += ((128 - $color) * (abs($ratio) / 100)); @@ -2157,8 +2138,7 @@ function colorAgressiveness($hex, $ratio = -50, $brightness = 0) { $color = ($color * (100 + abs($brightness)) / 100); } - else - { + else { $color = ($color * (100 - abs($brightness)) / 100); } diff --git a/htdocs/core/lib/functionsnumtoword.lib.php b/htdocs/core/lib/functionsnumtoword.lib.php index 26db2bbec90..f3dfa25c05c 100644 --- a/htdocs/core/lib/functionsnumtoword.lib.php +++ b/htdocs/core/lib/functionsnumtoword.lib.php @@ -213,8 +213,7 @@ function dolNumberToWord($numero, $langs, $numorcurrency = 'number') $entexto .= hundreds2text($CdMILLON, $DdMILLON, $udMILLON); if (!$CdMMillon && !$DdMMillon && !$UdMMillon && !$CdMILLON && !$DdMILLON && $udMILLON == 1) $entexto .= " MILLÓN "; - else - $entexto .= " MILLONES "; + else $entexto .= " MILLONES "; } if ($number >= 1000) { $cdm = (int) ($numero / 100000); diff --git a/htdocs/core/lib/geturl.lib.php b/htdocs/core/lib/geturl.lib.php index ae0eb86882e..0175ed83e61 100644 --- a/htdocs/core/lib/geturl.lib.php +++ b/htdocs/core/lib/geturl.lib.php @@ -88,8 +88,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = $array_param = null; curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); // HTTP request is 'PUT' if (!is_array($param)) parse_str($param, $array_param); - else - { + else { dol_syslog("parameter param must be a string", LOG_WARNING); $array_param = $param; } @@ -109,8 +108,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = { curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); // POST } - else - { + else { curl_setopt($ch, CURLOPT_POST, 0); // GET } @@ -144,8 +142,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation = dol_syslog("getURLContent response array is ".join(',', $rep)); } - else - { + else { $info = curl_getinfo($ch); // Ad keys to $rep @@ -183,8 +180,7 @@ function getDomainFromURL($url, $mode = 0) { $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)\.([^\.]+)$/', '\1.\2.\3', $tmpdomain); // Remove part 'www.' before 'abc.mydomain.com' } - else - { + else { $tmpdomain = preg_replace('/^.*\.([^\.]+)\.([^\.]+)$/', '\1.\2', $tmpdomain); // Remove part 'www.abc.' before 'mydomain.com' } if (empty($mode)) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 4f65ca3a2bf..c13c9c0f56c 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -221,8 +221,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, // Compatibilite image GIF $imgThumb = imagecreate($newWidth, $newHeight); } - else - { + else { $imgThumb = imagecreatetruecolor($newWidth, $newHeight); } @@ -359,8 +358,7 @@ function correctExifImageOrientation($fileSource, $fileDest, $quality = 95) if ($fileDest === false) { return $img; } - else - { + else { // In fact there exif is only for JPG but just in case // Create image on disk $image = false; @@ -597,8 +595,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', $thumbWidth = $maxWidth; $thumbHeight = $thumbWidth / $imgWhFact; } - else - { + else { // Si hauteur determinante $thumbHeight = $maxHeight; $thumbWidth = $thumbHeight * $imgWhFact; @@ -615,8 +612,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', // Compatibilite image GIF $imgThumb = imagecreate($thumbWidth, $thumbHeight); } - else - { + else { $imgThumb = imagecreatetruecolor($thumbWidth, $thumbHeight); } diff --git a/htdocs/core/lib/invoice2.lib.php b/htdocs/core/lib/invoice2.lib.php index d5ca3431845..64ecdcf9e69 100644 --- a/htdocs/core/lib/invoice2.lib.php +++ b/htdocs/core/lib/invoice2.lib.php @@ -262,15 +262,13 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte $result = 1; } - else - { + else { if ($usestdout) print "No invoices found for criteria.\n"; else dol_syslog("No invoices found for criteria"); $result = 0; } } - else - { + else { dol_print_error($db); dol_syslog("scripts/invoices/rebuild_merge.php: Error"); $error++; diff --git a/htdocs/core/lib/json.lib.php b/htdocs/core/lib/json.lib.php index 44ad9cc6ff1..9bf2db7278c 100644 --- a/htdocs/core/lib/json.lib.php +++ b/htdocs/core/lib/json.lib.php @@ -54,8 +54,7 @@ function dol_json_encode($elements) { foreach ($elements as $key => $value) $num++; } - else - { + else { $num = count($elements); } //var_dump($num); @@ -75,8 +74,7 @@ function dol_json_encode($elements) } $output .= ']'; } - else - { + else { // associative (object) $output = '{'; $last = $num - 1; @@ -201,7 +199,7 @@ function _val($val) elseif (is_int($val)) return sprintf('%d', $val); elseif (is_float($val)) return sprintf('%F', $val); elseif (is_bool($val)) return ($val ? 'true' : 'false'); - else return 'null'; + else return 'null'; } if (!function_exists('json_decode')) diff --git a/htdocs/core/lib/ldap.lib.php b/htdocs/core/lib/ldap.lib.php index 038791ce1cc..b5ea5faf3c5 100644 --- a/htdocs/core/lib/ldap.lib.php +++ b/htdocs/core/lib/ldap.lib.php @@ -122,8 +122,7 @@ function show_ldap_test_button($butlabel, $testlabel, $key, $dn, $objectclass) $langs->load("errors"); print ''.$butlabel.''; } - else - { + else { print ''.$butlabel.''; } print '

'; diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index a301ac40a2b..6ed00c10b34 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -64,8 +64,7 @@ function dol_setcache($memoryid, $data) { return count($data); } - else - { + else { return -$rescode; } } @@ -87,8 +86,7 @@ function dol_setcache($memoryid, $data) { return count($data); } - else - { + else { return -1; } } @@ -134,8 +132,7 @@ function dol_getcache($memoryid) { return $data; } - else - { + else { return -$rescode; } } @@ -159,8 +156,7 @@ function dol_getcache($memoryid) { return $data; } - else - { + else { return -1; } } @@ -236,8 +232,7 @@ function dol_setshmop($memoryid, $data) shmop_close($handle); return ($shm_bytes_written1 + $shm_bytes_written2); } - else - { + else { print 'Error in shmop_open for memoryid='.$memoryid.' shmkey='.$shmkey.' 6+size=6+'.$size; return -1; } @@ -264,8 +259,7 @@ function dol_getshmop($memoryid) else return -1; shmop_close($handle); } - else - { + else { return -2; } return $data; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index b9a958160d4..373e80e2a67 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -83,8 +83,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = //$pathoffiletoedittmp=$destdir.'/class/'.strtolower($objectname).'.class.php.tmp'; //dol_delete_file($pathoffiletoedittmp, 0, 1, 1); - try - { + try { include_once $pathoffiletoeditsrc; if (class_exists($objectname)) $object = new $objectname($db); else return -4; @@ -234,8 +233,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' } // Load object from myobject.class.php - try - { + try { if (!is_object($object)) { include_once $pathoffiletoclasssrc; @@ -270,8 +268,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' $texttoinsert .= "\t".$key." ".$type; if ($key == 'rowid') $texttoinsert .= ' AUTO_INCREMENT PRIMARY KEY'; if ($key == 'entity') $texttoinsert .= ' DEFAULT 1'; - else - { + else { if ($val['default'] != '') { if (preg_match('/^null$/i', $val['default'])) $texttoinsert .= " DEFAULT NULL"; @@ -293,8 +290,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' { @chmod($pathoffiletoedittarget, octdec($newmask)); } - else - { + else { $error++; } @@ -338,8 +334,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir = ' { @chmod($pathoffiletoedittarget, octdec($newmask)); } - else - { + else { $error++; } diff --git a/htdocs/core/lib/parsemd.lib.php b/htdocs/core/lib/parsemd.lib.php index 7dfd025609c..6a83fad87be 100644 --- a/htdocs/core/lib/parsemd.lib.php +++ b/htdocs/core/lib/parsemd.lib.php @@ -46,8 +46,7 @@ function dolMd2Html($content, $parser = 'parsedown', $replaceimagepath = null) $Parsedown = new Parsedown(); $content = $Parsedown->text($content); } - else - { + else { $content = nl2br($content); } diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index d031984552e..eedc8034d01 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -190,8 +190,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - else - { + else { $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + order_ref)"; if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); @@ -208,8 +207,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - else - { + else { $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + invoice_ref)"; if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); @@ -226,8 +224,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - else - { + else { $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + contractline_ref)"; if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); @@ -244,8 +241,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - else - { + else { $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + member_ref)"; if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); @@ -262,8 +258,7 @@ function getOnlinePaymentUrl($mode, $type, $ref = '', $amount = '9.99', $freetag if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if (empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) $out .= '&securekey='.$conf->global->PAYMENT_SECURITY_TOKEN; - else - { + else { $out .= '&securekey='.($mode ? '' : ''); if ($mode == 1) $out .= "hash('".$conf->global->PAYMENT_SECURITY_TOKEN."' + '".$type."' + donation_ref)"; if ($mode == 0) $out .= dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$type.$ref, 2); diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 63789a18e62..bfa49911b02 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -55,8 +55,7 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $pdfformat = dol_getDefaultFormat($outputlangs); } - else - { + else { $pdfformat = $conf->global->MAIN_PDF_FORMAT; } @@ -306,8 +305,7 @@ function pdfGetHeightForHtmlContent(&$pdf, $htmlcontent) if ($end_page == $start_page) { $height = $end_y - $start_y; } - else - { + else { for ($page = $start_page; $page <= $end_page; ++$page) { $pdf->setPage($page); $tmpm = $pdf->getMargins(); @@ -514,8 +512,7 @@ function pdf_build_address($outputlangs, $sourcecompany, $targetcompany = '', $t } } } - else - { + else { $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset(dol_format_address($targetcompany)); // Country if (!empty($targetcompany->country_code) && $targetcompany->country_code != $sourcecompany->country_code) $stringaddress .= ($stringaddress ? "\n" : '').$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$targetcompany->country_code)); @@ -804,8 +801,7 @@ function pdf_bank(&$pdf, $outputlangs, $curx, $cury, $account, $onlynumber = 0, $cury += 8; } } - else - { + else { $pdf->SetFont('', 'B', $default_font_size - $diffsizecontent); $pdf->SetXY($curx, $cury); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("Bank").': '.$outputlangs->convToOutputCharset($account->bank), 0, 'L', 0); @@ -1059,8 +1055,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } $freetextheight = $pdf->getStringHeight($width, $line); } - else - { + else { $freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); // New method (works for HTML content) //print '
'.$freetextheight;exit; } @@ -1076,8 +1071,7 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ { $pdf->MultiCell(0, 3, $line, 0, $align, 0); } - else - { + else { $pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk'] - $marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 0)); } $posy -= $freetextheight; @@ -1245,8 +1239,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php'; $prodser = new ProductFournisseur($db); } - else - { + else { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $prodser = new Product($db); } @@ -1328,8 +1321,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $discount->fetch($object->lines[$i]->fk_remise_except); $libelleproduitservice = $outputlangs->transnoentitiesnoconv("DiscountFromExcessPaid", $discount->ref_invoice_supplier_source); } - else - { + else { if ($idprod) { if (empty($hidedesc)) @@ -1338,14 +1330,12 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, { $libelleproduitservice = $desc."\n".$libelleproduitservice; } - else - { + else { $libelleproduitservice .= $desc; } } } - else - { + else { $libelleproduitservice .= $desc; } } @@ -1360,8 +1350,7 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, { $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." "; } - else - { + else { $prefix_prodserv = $outputlangs->transnoentitiesnoconv("Product")." "; } } @@ -1374,14 +1363,13 @@ function pdf_getlinedesc($object, $i, $outputlangs, $hideref = 0, $hidedesc = 0, $ref_prodserv = $ref_supplier; elseif ($conf->global->PDF_HIDE_PRODUCT_REF_IN_SUPPLIER_LINES == 2) $ref_prodserv = $ref_supplier.' ('.$outputlangs->transnoentitiesnoconv("InternalRef").' '.$prodser->ref.')'; - else // Common case + else // Common case { $ref_prodserv = $prodser->ref; // Show local ref if ($ref_supplier) $ref_prodserv .= ($prodser->ref ? ' (' : '').$outputlangs->transnoentitiesnoconv("SupplierRef").' '.$ref_supplier.($prodser->ref ? ')' : ''); } } - else - { + else { $ref_prodserv = $prodser->ref; // Show local ref only } @@ -1944,8 +1932,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm } $result = ($object->lines[$i]->situation_percent - $prev_progress).'%'; } - else - $result = $object->lines[$i]->situation_percent.'%'; + else $result = $object->lines[$i]->situation_percent.'%'; } } return $result; @@ -2001,8 +1988,7 @@ function pdf_getlinetotalexcltax($object, $i, $outputlangs, $hidedetails = 0) } $result .= price($sign * ($total_ht / ($object->lines[$i]->situation_percent / 100)) * $progress, 0, $outputlangs); } - else - { + else { $result .= price($sign * $total_ht, 0, $outputlangs); } } @@ -2187,8 +2173,7 @@ function pdf_getLinkedObjects($object, $outputlangs) //if (! empty($linkedobjects[$objecttype]['date_value'])) $linkedobjects[$objecttype]['date_value'].=' / '; //$linkedobjects[$objecttype]['date_value'].= dol_print_date($elementobject->date_delivery,'day','',$outputlangs); } - else - { + else { $linkedobjects[$objecttype]['ref_title'] = $outputlangs->transnoentities("RefOrder").' / '.$outputlangs->transnoentities("RefSending"); if (empty($linkedobjects[$objecttype]['ref_value'])) $linkedobjects[$objecttype]['ref_value'] = $outputlangs->convToOutputCharset($order->ref).($order->ref_client ? ' ('.$order->ref_client.')' : ''); $linkedobjects[$objecttype]['ref_value'] .= ' / '.$outputlangs->transnoentities($elementobject->ref); @@ -2235,7 +2220,7 @@ function pdf_getSizeForImage($realpath) $width = $maxwidth; $height = (int) round($maxwidth * $tmp['height'] / $tmp['width']); } - else // No pb with maxheight + else // No pb with maxheight { $height = $maxheight; } @@ -2261,8 +2246,7 @@ function pdfGetLineTotalDiscountAmount($object, $i, $outputlangs, $hidedetails = { return $outputlangs->transnoentities("Option"); } - else - { + else { if (is_object($hookmanager)) { $special_code = $object->lines[$i]->special_code; diff --git a/htdocs/core/lib/price.lib.php b/htdocs/core/lib/price.lib.php index c06c4431562..8f77d24bdab 100644 --- a/htdocs/core/lib/price.lib.php +++ b/htdocs/core/lib/price.lib.php @@ -132,7 +132,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $localtax2_type = $localtaxes_array[2]; $localtax2_rate = $localtaxes_array[3]; } - else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code) + else // deprecated method. values and type for localtaxes must be provided by caller and loaded with getLocalTaxesFromRate using the full vat rate (including text code) { dol_syslog("Price.lib::calcul_price_total search vat information using old deprecated method", LOG_WARNING); @@ -159,8 +159,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // pu calculation from pu_devise if pu empty if (empty($pu) && !empty($pu_devise)) { if (!empty($multicurrency_tx)) $pu = $pu_devise / $multicurrency_tx; - else - { + else { dol_syslog('Price.lib::calcul_price_total function called with bad parameters combination (multicurrency_tx empty when pu_devise not) ', LOG_ERR); return array(); } @@ -169,8 +168,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt // pu_devise calculation from pu if (empty($pu_devise) && !empty($multicurrency_tx)) { if (is_numeric($pu) && is_numeric($multicurrency_tx)) $pu_devise = $pu * $multicurrency_tx; - else - { + else { dol_syslog('Price.lib::calcul_price_total function called with bad parameters combination (pu or multicurrency_tx are not numeric)', LOG_ERR); return array(); } @@ -193,8 +191,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $tot_avec_remise_wt = price2num($tot_avec_remise * (1 + ($txtva / 100)), 'MU'); $pu_wt = price2num($pu * (1 + ($txtva / 100)), 'MU'); } - else - { + else { $tot_sans_remise_wt = $tot_sans_remise; $tot_avec_remise_wt = $tot_avec_remise; $pu_wt = $pu; @@ -269,8 +266,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result5bis = price2num($pu * (1 + ($txtva / 100)) + $localtaxes[2], 'MU'); // Si TVA consideree normale (non NPR) $result[4] = price2num($result5bis - ($result[3] + $localtaxes[2]), 'MU'); } - else - { + else { // We work to define prices using the price with tax $result[8] = price2num($tot_sans_remise + $localtaxes[0], 'MT'); $result[6] = price2num($tot_sans_remise / (1 + ((($info_bits & 1) ? 0 : $txtva) / 100)), 'MT'); // Selon TVA NPR ou non @@ -355,8 +351,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[9] = round($result[9] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[10] = round($result[10] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; } - else - { + else { $result[1] = round($result[1] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[2] = round($result[2] / $conf->global->MAIN_ROUNDING_RULE_TOT, 0) * $conf->global->MAIN_ROUNDING_RULE_TOT; $result[0] = price2num($result[2] - $result[1], 'MT'); @@ -406,8 +401,7 @@ function calcul_price_total($qty, $pu, $remise_percent_ligne, $txtva, $uselocalt $result[25] = $newresult[9]; $result[26] = $newresult[10]; } - else - { + else { $result[16] = $result[0]; $result[17] = $result[1]; $result[18] = $result[2]; diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 43acb16ba2a..e1ed6efc805 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -553,8 +553,7 @@ function measuringUnitString($unit, $measuring_style = '', $scale = '', $use_sho 't.active' => 1 ); } - else - { + else { $arrayforfilter = array( 't.rowid' => $unit, 't.unit_type' => $measuring_style, diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index bef3d9fd0dc..c84762f8575 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -419,14 +419,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t { $showlineingray = 1; // We will show line but in gray } - else - { + else { $showline = 0; // No reason to show line } } } - else - { + else { // Caller did not ask to filter on tasks of a specific user (this probably means he want also tasks of all users, into public project // or into all other projects if user has permission to). if (empty($user->rights->projet->all->lire)) @@ -682,8 +680,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t if ($lines[$i]->planned_workload) $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100; } } - else - { + else { //$level--; } } @@ -1380,8 +1377,7 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr } $level--; } - else - { + else { //$level--; } } @@ -1745,8 +1741,7 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } $level--; } - else - { + else { //$level--; } } @@ -2006,8 +2001,7 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & } $level--; } - else - { + else { //$level--; } } @@ -2110,8 +2104,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc"; } - else - { + else { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t ON p.rowid = t.fk_projet"; } $sql .= " WHERE p.entity IN (".getEntity('project').")"; @@ -2339,8 +2332,7 @@ function print_projecttasks_array($db, $form, $socid, $projectsListId, $mytasks $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -2475,8 +2467,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide } $out .= ' '; } - else - { + else { // bad $out .= '
'; $out .= '
'; diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 03f1525eb91..76ce3cb5b01 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -504,8 +504,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.entity IS NOT NULL"; } - else - { + else { $sql .= ",".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND ((ug.fk_user = dbt.rowid"; @@ -518,8 +517,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } } - else - { + else { $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } @@ -590,8 +588,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $tmparray = explode(',', $tmps); if (!in_array($objectid, $tmparray)) return false; } - else - { + else { $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; @@ -611,8 +608,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $tmparray = explode(',', $tmps); if (!in_array($task->fk_project, $tmparray)) return false; } - else - { + else { $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; @@ -662,8 +658,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $obj = $db->fetch_object($resql); if (!$obj || $obj->nb < count(explode(',', $objectid))) return false; } - else - { + else { return false; } } @@ -723,8 +718,7 @@ function accessforbidden($message = '', $printheader = 1, $printfooter = 1, $sho print $langs->trans("CurrentLogin").': '.$user->login.'
'; print $langs->trans("ErrorForbidden2", $langs->transnoentitiesnoconv("Home"), $langs->transnoentitiesnoconv("Users")); } - else - { + else { print $langs->trans("ErrorForbidden3"); } } diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 04d16084365..fba8ba346c6 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -102,8 +102,7 @@ function checkLoginPassEntity($usertotest, $passwordtotest, $entitytotest, $auth $dol_screenheight = GETPOST('screenheight'); } } - else - { + else { dol_syslog("Authentication KO - failed to load file '".$authfile."'", LOG_ERR); sleep(1); // Load translation files required by the page @@ -180,8 +179,7 @@ if (!function_exists('dol_loginfunction')) if (file_exists($tmp)) { $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; } } } - else - { + else { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } @@ -376,8 +374,7 @@ function encodedecode_dbpassconf($level = 0) $val = dol_decode($val); $passwd = $val; } - else - { + else { $passwd = $val; $val = dol_encode($val); $passwd_crypted = $val; @@ -401,8 +398,7 @@ function encodedecode_dbpassconf($level = 0) //print 'passwd = '.$passwd.' - passwd_crypted = '.$passwd_crypted; //exit; } - else - { + else { $config .= $buffer; } } @@ -423,14 +419,12 @@ function encodedecode_dbpassconf($level = 0) return 1; } - else - { + else { dol_syslog("encodedecode_dbpassconf Failed to open conf.php file for writing", LOG_WARNING); return -1; } } - else - { + else { dol_syslog("encodedecode_dbpassconf Failed to read conf.php", LOG_ERR); return -2; } @@ -476,7 +470,7 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len $generated_password = str_shuffle($randomCode); } - else // Old platform, non cryptographic random + else // Old platform, non cryptographic random { $max = strlen($lowercase) - 1; for ($x = 0; $x < $nbofchar; $x++) { @@ -514,8 +508,7 @@ function getRandomPassword($generic = false, $replaceambiguouschars = null, $len { $generated_password = str_replace($replaceambiguouschars, $numbers{random_int(0, $max)}, $generated_password); } - else - { + else { $generated_password = str_replace($replaceambiguouschars, $numbers{mt_rand(0, $max)}, $generated_password); } } diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index ad1e6304d03..541aab2358e 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -305,8 +305,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; } - else - { + else { $label = (!empty($objp->label) ? $objp->label : $objp->product_label); } @@ -333,8 +332,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print '
"; if ($objp->fk_product_type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -440,8 +438,7 @@ function show_list_sending_receive($origin, $origin_id, $filter = '') print dol_print_date($receiving->date_delivery, 'day'); print '   
'; } - else - { + else { print $tab[$x]['entry']; } //print ' -> A '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'
'."\n"; @@ -211,8 +209,7 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset print $tab[$x]['buttons']; print ''; } - else - { + else { print $tab[$x]['entry']; } //print ' -> B '.$tab[$x]['rowid'].' mainmenu='.$tab[$x]['mainmenu'].' leftmenu='.$tab[$x]['leftmenu'].' fk_mainmenu='.$tab[$x]['fk_mainmenu'].' fk_leftmenu='.$tab[$x]['fk_leftmenu'].'
'."\n"; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index 9ac9383e516..2fbc6eee325 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -347,8 +347,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ' '; print ''; } - else - { + else { $dirthemestring = ''; foreach ($dirthemes as $dirtheme) { @@ -404,8 +403,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print ' '.$subdir.''; } - else - { + else { print ' '.$subdir; } print ''; @@ -442,8 +440,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { // Nothing } - else - { + else { // Show logo print ''.$langs->trans("EnableShowLogo").''; if ($edit) @@ -451,8 +448,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ajax_constantonoff('MAIN_SHOW_LOGO', array(), null, 0, 0, 1); //print $form->selectyesno('MAIN_SHOW_LOGO', $conf->global->MAIN_SHOW_LOGO, 1); } - else - { + else { print yn($conf->global->MAIN_SHOW_LOGO); } print ''; @@ -487,8 +483,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ } - else - { + else { $default = $langs->trans('No'); print ''; print ''.$langs->trans("TopMenuDisableImages").''; @@ -498,8 +493,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ajax_constantonoff('THEME_TOPMENU_DISABLE_IMAGE', array(), null, 0, 0, 1); //print $form->selectyesno('THEME_TOPMENU_DISABLE_IMAGE', $conf->global->THEME_TOPMENU_DISABLE_IMAGE, 1); } - else - { + else { print yn($conf->global->THEME_TOPMENU_DISABLE_IMAGE); } print '   '.$langs->trans("Default").': '.$default.' '; @@ -532,8 +526,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ } - else - { + else { print ''; print ''.$langs->trans("BackgroundColor").''; print ''; @@ -542,8 +535,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''), 'THEME_ELDY_BACKBODY', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKBODY, array()), ''); if ($color) print ''; else print $langs->trans("Default"); @@ -578,8 +570,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ } - else - { + else { $default = (empty($colorbackhmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackhmenu1))); print ''; @@ -589,8 +580,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''), 'THEME_ELDY_TOPMENU_BACK1', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TOPMENU_BACK1, array()), ''); if ($color) print ''; else print $langs->trans("Default"); @@ -625,8 +615,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ } - else - { + else { $default = (empty($colorbackvmenu1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbackvmenu1))); print ''; @@ -636,8 +625,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''), 'THEME_ELDY_VERMENU_BACK1', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_VERMENU_BACK1, array()), ''); if ($color) print ''; else print $langs->trans("Default"); @@ -652,8 +640,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default = (empty($colortexttitlenotab) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlenotab))); print ''; @@ -663,8 +650,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLENOTAB, array()), ''), 'THEME_ELDY_TEXTTITLENOTAB', 'formcolor', 1).' '; } - else - { + else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLENOTAB, $langs->trans("Default")); } print '   '.$langs->trans("Default").': '.$default.' '; @@ -678,8 +664,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default = (empty($colorbacktitle1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacktitle1))); print ''; @@ -689,8 +674,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_BACKTITLE1, array()), ''), 'THEME_ELDY_BACKTITLE1', 'formcolor', 1).' '; } - else - { + else { print $formother->showColor($conf->global->THEME_ELDY_BACKTITLE1, $langs->trans("Default")); } print '   '.$langs->trans("Default").': '.$default.' '; // $colorbacktitle1 in CSS @@ -704,8 +688,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default = (empty($colortexttitle) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitle))); print ''; @@ -715,8 +698,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLE, array()), ''), 'THEME_ELDY_TEXTTITLE', 'formcolor', 1).' '; } - else - { + else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLE, $langs->trans("Default")); } print '   '.$langs->trans("Default").': '.$default.' '; @@ -730,8 +712,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default=(empty($colortexttitlelink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortexttitlelink))); print ''; @@ -741,8 +722,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTTITLELINK, array()), ''), 'THEME_ELDY_TEXTTITLELINK', 'formcolor', 1).' '; } - else - { + else { print $formother->showColor($conf->global->THEME_ELDY_TEXTTITLELINK, $langs->trans("Default")); } print '   '.$langs->trans("Default").': '.$default.' '; @@ -757,8 +737,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default = (empty($colorbacklineimpair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklineimpair1))); print ''; @@ -768,8 +747,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''), 'THEME_ELDY_LINEIMPAIR1', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEIMPAIR1, array()), ''); if ($color) print ''; else print $langs->trans("Default"); @@ -784,8 +762,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($foruserprofile) { } - else - { + else { $default = (empty($colorbacklinepair1) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepair1))); print ''; @@ -795,8 +772,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''), 'THEME_ELDY_LINEPAIR1', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_LINEPAIR1, array()), ''); if ($color) print ''; else print $langs->trans("Default"); @@ -831,8 +807,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) if ($edit) print '
('.$langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis").')'; print '';*/ } - else - { + else { $default = (empty($colortextlink) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colortextlink))); print ''; @@ -842,12 +817,10 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $formother->selectColor(colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''), 'THEME_ELDY_TEXTLINK', 'formcolor', 1).' '; } - else - { + else { $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_TEXTLINK, array()), ''); if ($color) print ''; - else - { + else { //print ''; //print ''.$langs->trans("Default").''; print $langs->trans("Default"); @@ -887,8 +860,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_HOVER', 'formcolor', 1).' '; } - else - { + else { if ($conf->global->THEME_ELDY_USE_HOVER == '1') $color = colorArrayToHex(colorStringToArray($colorbacklinepairhover)); else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_HOVER, array()), ''); if ($color) @@ -917,8 +889,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; */ } - else - { + else { $default = (empty($colorbacklinepairchecked) ? $langs->trans("Unknown") : colorArrayToHex(colorStringToArray($colorbacklinepairchecked))); print ''; @@ -932,8 +903,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); print $formother->selectColor($color, 'THEME_ELDY_USE_CHECKED', 'formcolor', 1).' '; } - else - { + else { if ($conf->global->THEME_ELDY_USE_CHECKED == '1') $color = 'e6edf0'; else $color = colorArrayToHex(colorStringToArray($conf->global->THEME_ELDY_USE_CHECKED, array()), ''); if ($color) @@ -962,14 +932,12 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1); } - else - { + else { if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { print yn($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER); } - else - { + else { print yn(1); if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')'; } @@ -979,8 +947,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; print ''; } - else - { + else { /*var_dump($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER); $default=$langs->trans('No'); print ''; @@ -1024,8 +991,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) { print $form->selectArray('MAIN_OPTIMIZEFORCOLORBLIND', $colorBlindOptions, $fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND, 0); } - else - { + else { if (!empty($fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND) && isset($colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND])) { print $colorBlindOptions[$fuser->conf->MAIN_OPTIMIZEFORCOLORBLIND]; } @@ -1038,8 +1004,7 @@ function showSkins($fuser, $edit = 0, $foruserprofile = false) print ''; print ''; } - else - { + else { } print ''; } diff --git a/htdocs/core/lib/website.lib.php b/htdocs/core/lib/website.lib.php index 1864ca27bea..9dd7708c36d 100644 --- a/htdocs/core/lib/website.lib.php +++ b/htdocs/core/lib/website.lib.php @@ -94,8 +94,7 @@ function dolKeepOnlyPhpCode($str) { $newstr .= $partlings[0].'?>'; } - else - { + else { $newstr .= $part.'?>'; } } @@ -300,7 +299,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = str_replace('!~!~!~', '', $content); } } - else // REPLACEMENT OF LINKS When page called from virtual host + else // REPLACEMENT OF LINKS When page called from virtual host { $symlinktomediaexists = 1; if ($website->virtualhost) { @@ -336,8 +335,7 @@ function dolWebsiteOutput($content, $contenttype = 'html', $containerid = '') $content = preg_replace('/(]*src=")\/?viewimage\.php/', '\1/wrapper.php', $content, -1, $nbrep); $content = preg_replace('/(]*href=")\/?documents\.php/', '\1/wrapper.php', $content, -1, $nbrep); } - else - { + else { // ]*src=")\/?image\//', '\1/medias/image/', $content, -1, $nbrep); $content = preg_replace('/(url\(["\']?)\/?image\//', '\1/medias/image/', $content, -1, $nbrep); @@ -426,8 +424,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri { $containerref = $tmpwebsitepage->pageurl; } - else - { + else { print "Error, page contains a redirect to the alternative alias '".$containeraliasalt."' that does not exists in web site (".$website->id." / ".$website->ref.")"; exit; } @@ -464,18 +461,16 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri print "Error, page with uri '.$currenturi.' try a redirect to the same alias page '".$containerref."' in web site '".$website->ref."'"; exit; } - else - { + else { $newurl = preg_replace('/&pageref=([^&]+)/', '&pageref='.$containerref, $currenturi); } } - else - { + else { $newurl = $currenturi.'&pageref='.urlencode($containerref); } } } - else // When page called from virtual host server + else // When page called from virtual host server { $newurl = '/'.$containerref.'.php'; } @@ -488,8 +483,7 @@ function redirectToContainer($containerref, $containeraliasalt = '', $containeri header("Location: ".$newurl); exit; } - else - { + else { print "Error, page contains a redirect to the alias page '".$containerref."' that does not exists in web site (".$website->id." / ".$website->ref.")"; exit; } @@ -601,7 +595,7 @@ function getStructuredData($type, $data = array()) if (is_array($mysoc->socialnetworks) && count($mysoc->socialnetworks) > 0) { $ret .= '"sameAs": ['; $i = 0; - foreach($mysoc->socialnetworks as $key => $value) { + foreach ($mysoc->socialnetworks as $key => $value) { if ($key == 'linkedin') { $ret.= '"https://www.'.$key.'.com/company/'.dol_escape_json($value).'"'; } elseif ($key == 'youtube') { @@ -670,7 +664,7 @@ function getStructuredData($type, $data = array()) $ret .= '"keywords": ['; $i = 0; $arrayofkeywords = explode(',', $websitepage->keywords); - foreach($arrayofkeywords as $keyword) { + foreach ($arrayofkeywords as $keyword) { $ret.= '"'.dol_escape_json($keyword).'"'; $i++; if ($i < count($arrayofkeywords)) $ret .= ', '; @@ -810,8 +804,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $arrayresult['code'] = 'KO'; $arrayresult['message'] = $weblangs->trans("ErrorSearchCriteriaTooSmall"); } - else - { + else { $tmparrayoftype = explode(',', $type); foreach ($tmparrayoftype as $tmptype) { if (!in_array($tmptype, array('', 'page', 'blogpost'))) { @@ -873,8 +866,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $i++; } } - else - { + else { $error++; $arrayresult['code'] = $db->lasterrno(); $arrayresult['message'] = $db->lasterror(); @@ -934,8 +926,7 @@ function getPagesFromSearchCriterias($type, $algo, $searchstring, $max = 25, $so $arrayresult['message'] = $weblangs->trans("NoRecordFound"); } } - else - { + else { $error++; $arrayresult['code'] = 'KO'; $arrayresult['message'] = 'No supported algorithm found'; @@ -985,8 +976,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb); $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot } - else - { + else { $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file } @@ -1029,8 +1019,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors'); $action = 'create'; } - else - { + else { $alreadygrabbed[$urltograbbis] = 1; // Track that file was alreay grabbed. dol_mkdir(dirname($filetosave)); @@ -1062,8 +1051,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify $urltograbdirrootwithoutslash = getRootURLFromURL($urltograb); $urltograbbis = $urltograbdirrootwithoutslash.$regs[2][$key]; // We use dirroot } - else - { + else { $urltograbbis = $urltograb.'/'.$regs[2][$key]; // We use dir of grabbed file } @@ -1108,8 +1096,7 @@ function getAllImages($object, $objectpage, $urltograb, &$tmp, &$action, $modify setEventMessages('Error getting '.$urltograbbis.': '.$tmpgeturl['http_code'], null, 'errors'); $action = 'create'; } - else - { + else { $alreadygrabbed[$urltograbbis] = 1; // Track that file was alreay grabbed. dol_mkdir(dirname($filetosave)); diff --git a/htdocs/core/lib/xcal.lib.php b/htdocs/core/lib/xcal.lib.php index 440f1147cbf..33db8490a75 100644 --- a/htdocs/core/lib/xcal.lib.php +++ b/htdocs/core/lib/xcal.lib.php @@ -230,8 +230,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) $enddate = dol_time_plus_duree($startdate, 1, "d"); } } - else - { + else { if (empty($enddate)) { $enddate = $startdate + $duration; @@ -316,8 +315,7 @@ function build_calfile($format, $title, $desc, $events_array, $outputfile) @chmod($outputfile, octdec($conf->global->MAIN_UMASK)); } } - else - { + else { dol_syslog("xcal.lib.php::build_calfile Failed to open file ".$outputfile." for writing"); return -2; } @@ -526,8 +524,7 @@ function calEncode($line) $out .= $newpara; } - else - { + else { $strlength = dol_strlen($line); for ($j = 0; $j < $strlength; $j++) diff --git a/htdocs/core/login/functions_dolibarr.php b/htdocs/core/login/functions_dolibarr.php index ea3fa2f3a19..333e4741cd1 100644 --- a/htdocs/core/login/functions_dolibarr.php +++ b/htdocs/core/login/functions_dolibarr.php @@ -107,8 +107,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes { $login = $obj->login; } - else - { + else { sleep(2); // Anti brut force protection dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO bad password for '".$usertotest."', cryptType=".$cryptType, LOG_NOTICE); @@ -124,8 +123,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes global $mc; if (!isset($mc)) $conf->multicompany->enabled = false; // Global not available, disable $conf->multicompany->enabled for safety - else - { + else { $ret = $mc->checkRight($obj->rowid, $entitytotest); if ($ret < 0) { @@ -135,8 +133,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes } } } - else - { + else { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO user not found for '".$usertotest."'", LOG_NOTICE); sleep(1); @@ -146,8 +143,7 @@ function check_user_password_dolibarr($usertotest, $passwordtotest, $entitytotes $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); } } - else - { + else { dol_syslog("functions_dolibarr::check_user_password_dolibarr Authentication KO db error for '".$usertotest."' error=".$db->lasterror(), LOG_ERR); sleep(1); $_SESSION["dol_loginmesg"] = $db->lasterror(); diff --git a/htdocs/core/login/functions_ldap.php b/htdocs/core/login/functions_ldap.php index 3a8b274c109..9f7f5f1d81c 100644 --- a/htdocs/core/login/functions_ldap.php +++ b/htdocs/core/login/functions_ldap.php @@ -127,8 +127,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) return ''; } } - else - { + else { if ($ldapdebug) print "DEBUG: ".$ldap->error."
\n"; } $ldap->close(); @@ -219,8 +218,7 @@ function check_user_password_ldap($usertotest, $passwordtotest, $entitytotest) $_SESSION["dol_loginmesg"] = $langs->trans("ErrorBadLoginPassword"); } } - else - { + else { /* Login failed. Return false, together with the error code and text from ** the LDAP server. The common error codes and reasons are listed below : ** (for iPlanet, other servers may differ) diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index a401dfd7764..c354d2d8d0e 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -57,8 +57,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $openid->SetApprovedURL($protocol.$_SERVER["HTTP_HOST"].$_SERVER["SCRIPT_NAME"]); // Send Response from OpenID server to this script $openid->Redirect(); // This will redirect user to OpenID Server } - else - { + else { $error = $openid->GetError(); return false; } @@ -96,8 +95,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $error = $openid->GetError(); return false; } - else - { + else { // Signature Verification Failed //echo "INVALID AUTHORIZATION"; return false; diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 4b4a4c54151..c58c8049c27 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -145,8 +145,7 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); }*/ - else - { + else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png'; $logoContainerAdditionalClass = ''; } @@ -411,8 +410,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $i++; } } - else - { + else { // Should not happend. Entries are added $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); } @@ -474,8 +472,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t { print '
'."\n"; } - else - { + else { print '
'."\n"; } } @@ -539,8 +536,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print ''."\n"; $lastlevel0 = 'greyed'; } - else - { + else { $lastlevel0 = 'hidden'; } if ($showmenu) diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index 2a67d43c1e3..c654e823b5c 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -79,8 +79,7 @@ class MenuManager $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } - else - { + else { // On va le chercher en session si non defini par le lien $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; } @@ -97,8 +96,7 @@ class MenuManager //$leftmenu=""; $_SESSION["leftmenuopened"] = ""; } - else - { + else { $_SESSION["leftmenuopened"] = $leftmenu; } } else { @@ -146,8 +144,7 @@ class MenuManager if ($mode == 'top') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); if ($mode == 'left') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); } - else - { + else { $conf->global->MAIN_SHOW_LOGO = 0; if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); @@ -226,8 +223,7 @@ class MenuManager { $lastlevel[0] = 'greyed'; } - else - { + else { $lastlevel[0] = 'hidden'; } } @@ -259,8 +255,7 @@ class MenuManager { $relurl2 = dol_buildpath($val2['url'], 1); } - else - { + else { $relurl2 = $val2['url']; } $canonurl2 = preg_replace('/\?.*$/', '', $val2['url']); @@ -286,20 +281,18 @@ class MenuManager print '>'; $lastlevel2[$val2['level']] = 'enabled'; } - else // Not allowed but visible (greyed) + else // Not allowed but visible (greyed) { print ''; $lastlevel2[$val2['level']] = 'greyed'; } } - else - { + else { if ($val2['enabled']) // Allowed { $lastlevel2[$val2['level']] = 'enabled'; } - else - { + else { $lastlevel2[$val2['level']] = 'greyed'; } } @@ -308,8 +301,7 @@ class MenuManager { if ($val2['enabled']) // Allowed print ''; - else - print ''; + else print ''; } print ''."\n"; } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 3f539260856..39f94d6eb2f 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -440,8 +440,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = $mtitle .= $langs->trans($item); } } - else - { + else { $mtitle = $langs->trans($smenu->title); } // Add item @@ -512,8 +511,7 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = { $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); }*/ - else - { + else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo_squarred_alpha.png'; $logoContainerAdditionalClass = ''; } @@ -1309,8 +1307,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $i++; } } - else - { + else { // Should not happend. Entries are added $newmenu->add('', $langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire); } @@ -1625,8 +1622,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM $newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->creer); $newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->lire); } - else - { + else { $newmenu->add("/product/inventory/list.php?leftmenu=stock", $langs->trans("Inventory"), 0, $user->rights->stock->inventory_advance->read, '', $mainmenu, 'stock'); $newmenu->add("/product/inventory/card.php?action=create", $langs->trans("NewInventory"), 1, $user->rights->stock->inventory_advance->write); $newmenu->add("/product/inventory/list.php", $langs->trans("List"), 1, $user->rights->stock->inventory_advance->read); @@ -1987,8 +1983,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM { print '
'."\n"; } - else - { + else { print '
'."\n"; } } @@ -2052,8 +2047,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print ''."\n"; $lastlevel0 = 'greyed'; } - else - { + else { $lastlevel0 = 'hidden'; } if ($showmenu) diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index 5276a509ae5..2d62f9f7275 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -78,8 +78,7 @@ class MenuManager $_SESSION["mainmenu"] = $mainmenu; $_SESSION["leftmenuopened"] = ""; } - else - { + else { // On va le chercher en session si non defini par le lien $mainmenu = isset($_SESSION["mainmenu"]) ? $_SESSION["mainmenu"] : ''; } @@ -96,8 +95,7 @@ class MenuManager //$leftmenu=""; $_SESSION["leftmenuopened"] = ""; } - else - { + else { $_SESSION["leftmenuopened"] = $leftmenu; } } else { @@ -147,8 +145,7 @@ class MenuManager if ($mode == 'top') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); if ($mode == 'left') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); } - else - { + else { $conf->global->MAIN_SHOW_LOGO = 0; if ($mode == 'top') print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); if ($mode == 'left') print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); @@ -231,8 +228,7 @@ class MenuManager { $lastlevel[0] = 'greyed'; } - else - { + else { $lastlevel[0] = 'hidden'; } } @@ -264,8 +260,7 @@ class MenuManager { $relurl2 = dol_buildpath($val2['url'], 1); } - else - { + else { $relurl2 = $val2['url']; } $canonurl2 = preg_replace('/\?.*$/', '', $val2['url']); @@ -291,20 +286,18 @@ class MenuManager print '>'; $lastlevel2[$val2['level']] = 'enabled'; } - else // Not allowed but visible (greyed) + else // Not allowed but visible (greyed) { print ''; $lastlevel2[$val2['level']] = 'greyed'; } } - else - { + else { if ($val2['enabled']) // Allowed { $lastlevel2[$val2['level']] = 'enabled'; } - else - { + else { $lastlevel2[$val2['level']] = 'greyed'; } } @@ -313,8 +306,7 @@ class MenuManager { if ($val2['enabled']) // Allowed print ''; - else - print ''; + else print ''; } print ''."\n"; } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 923f4e84965..2b2a000fa3b 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -231,8 +231,7 @@ class MenuManager { $lastlevel[0] = 'greyed'; } - else - { + else { $lastlevel[0] = 'hidden'; } } @@ -282,20 +281,18 @@ class MenuManager print '>'; $lastlevel2[$val2['level']] = 'enabled'; } - else // Not allowed but visible (greyed) + else // Not allowed but visible (greyed) { print ''; $lastlevel2[$val2['level']] = 'greyed'; } } - else - { + else { if ($val2['enabled']) // Allowed { $lastlevel2[$val2['level']] = 'enabled'; } - else - { + else { $lastlevel2[$val2['level']] = 'greyed'; } } @@ -376,8 +373,7 @@ class MenuManager { print '
'."\n"; } - else - { + else { print '
'."\n"; } } @@ -398,8 +394,7 @@ class MenuManager { print ''."\n"; } - else - { + else { print ''."\n"; } print ''."\n"; @@ -420,8 +415,7 @@ class MenuManager if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].''; else print ''; } - else - { + else { print $tabstring.''.$this->menu->liste[$i]['titre'].''; } diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 24811ad854d..0911dc85719 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -438,8 +438,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $this->error = $this->db->lasterror(); $err++; } - else - { + else { dol_syslog(get_class($this)."::_init Warning ".$this->db->lasterror(), LOG_WARNING); } } @@ -451,8 +450,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return 0; } @@ -538,8 +536,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return 0; } @@ -561,8 +558,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // If module name translation exists return $langs->transnoentitiesnoconv("Module".$this->numero."Name"); } - else - { + else { // If module name translation using it's unique id does not exist, we try to use its name to find translation if (is_array($this->langfiles)) { foreach ($this->langfiles as $val) @@ -597,8 +593,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // If module description translation exists return $langs->transnoentitiesnoconv("Module".$this->numero."Desc"); } - else - { + else { // If module description translation does not exist using its unique id, we can use its name to find translation if (is_array($this->langfiles)) { foreach ($this->langfiles as $val) @@ -651,13 +646,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it ) ); } - else - { + else { $content = nl2br($content); } } - else - { + else { // Mostly for internal modules if (!empty($this->descriptionlong)) { if (is_array($this->langfiles)) { @@ -746,8 +739,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it @include_once DOL_DOCUMENT_ROOT.'/core/lib/parsemd.lib.php'; $content = dolMd2Html($content, 'parsedown', array('doc/'=>dol_buildpath(strtolower($this->name).'/doc/', 1))); } - else - { + else { $content = nl2br($content); } } @@ -859,8 +851,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // Translation not found return $langs->trans($this->export_label[$r]); } - else - { + else { // Translation found return $langs->trans($langstring); } @@ -884,8 +875,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // Translation not found return $langs->transnoentitiesnoconv($this->import_label[$r]); } - else - { + else { // Translation found return $langs->transnoentitiesnoconv($langstring); } @@ -913,8 +903,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { $err++; } - else - { + else { $obj = $this->db->fetch_object($resql); if ($obj) { return $this->db->jdate($obj->tms); @@ -946,8 +935,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it { $err++; } - else - { + else { $obj = $this->db->fetch_object($resql); $tmp = array(); if ($obj->note) { @@ -1233,16 +1221,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (!$err) { $this->db->commit(); } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); } } // else box already registered into database } - else - { + else { $this->error = $this->db->lasterror(); $err++; } @@ -1428,16 +1414,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (!$err) { $this->db->commit(); } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); } } // else box already registered into database } - else - { + else { $this->error = $this->db->lasterror(); $err++; } @@ -1629,13 +1613,11 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err++; } } - else - { + else { dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_WARNING); } } - else - { + else { $err++; } } @@ -1738,16 +1720,14 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $sql .= " VALUES "; $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')"; } - else - { + else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def"; $sql .= " (id, entity, libelle, module, type, bydefault, perms)"; $sql .= " VALUES "; $sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')"; } } - else - { + else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def "; $sql .= " (id, entity, libelle, module, type, bydefault)"; $sql .= " VALUES "; @@ -1793,15 +1773,13 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if ($result > 0) { $tmpuser->addrights($r_id, '', '', 0, 1); } - else - { + else { dol_syslog(get_class($this)."::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR); } $i++; } } - else - { + else { dol_print_error($this->db); } } @@ -1816,8 +1794,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it } $this->db->free($resql); } - else - { + else { $this->error = $this->db->lasterror(); $err++; } @@ -1885,8 +1862,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (!$this->menu[$key]['fk_menu']) { $menu->fk_menu = 0; } - else - { + else { $foundparent = 0; $fk_parent = $this->menu[$key]['fk_menu']; if (preg_match('/^r=/', $fk_parent)) // old deprecated method @@ -1934,8 +1910,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if ($result > 0) { $this->menu[$key]['rowid'] = $result; } - else - { + else { $this->error = $menu->error; dol_syslog(get_class($this).'::insert_menus result='.$result." ".$this->error, LOG_ERR); $err++; @@ -1947,8 +1922,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (!$err) { $this->db->commit(); } - else - { + else { dol_syslog(get_class($this)."::insert_menus ".$this->error, LOG_ERR); $this->db->rollback(); } @@ -2081,8 +2055,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $this->db->query($sql); } } - else - { + else { $this->error = $this->db->lasterror(); $err++; } @@ -2153,7 +2126,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (isset($value['entity'])) { $entity = $value['entity']; } } - else // when hook is declared with syntax 'hook'=>array('hookcontext1','hookcontext2',...) + else // when hook is declared with syntax 'hook'=>array('hookcontext1','hookcontext2',...) { $newvalue = json_encode($value); } @@ -2184,8 +2157,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $error++; $this->error = $this->db->lasterror(); } - else - { + else { dol_syslog(get_class($this)."::insert_module_parts for ".$this->const_name."_".strtoupper($key)." Record already exists.", LOG_WARNING); } } @@ -2291,8 +2263,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it if (preg_match('/^\//i', $this->picto)) print img_picto($alttext, $this->picto, 'class="inline-block valignmiddle"', 1); else print img_object($alttext, $this->picto, 'class="inline-block valignmiddle"'); } - else - { + else { print img_object($alttext, 'generic', 'class="inline-block valignmiddle"'); } diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index bf957175f84..ea3b961b63f 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -86,8 +86,7 @@ function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $h { $modele = $conf->global->ACTION_EVENT_ADDON_PDF; } - else - { + else { $modele = 'soleil'; } } @@ -142,15 +141,13 @@ function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $h return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "action_pdf_create Error: ".$obj->error); return 0; } } - else - { + else { print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); return 0; } diff --git a/htdocs/core/modules/action/rapport.pdf.php b/htdocs/core/modules/action/rapport.pdf.php index b978bed1eab..0b489e7202c 100644 --- a/htdocs/core/modules/action/rapport.pdf.php +++ b/htdocs/core/modules/action/rapport.pdf.php @@ -295,8 +295,7 @@ class CommActionRapport if ($obj->dp2) { if (dol_print_date($this->db->jdate($obj->dp), "day") != dol_print_date($this->db->jdate($obj->dp2), "day")) $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "day")." - ".dol_print_date($this->db->jdate($obj->dp2), "hour"); - else - $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); + else $textdate .= " -> ".dol_print_date($this->db->jdate($obj->dp2), "hour"); } $textdate = $outputlangs->trans("ID").' '.$obj->id.' - '.$textdate; $pdf->MultiCell(45 - $this->marge_gauche, $height, $textdate, 0, 'L', 0); diff --git a/htdocs/core/modules/bank/doc/pdf_ban.modules.php b/htdocs/core/modules/bank/doc/pdf_ban.modules.php index 1bf2b836269..dc19b2c0907 100644 --- a/htdocs/core/modules/bank/doc/pdf_ban.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_ban.modules.php @@ -119,8 +119,7 @@ class pdf_ban extends ModeleBankAccountDoc $dir = $conf->bank->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->bank->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -204,8 +203,7 @@ class pdf_ban extends ModeleBankAccountDoc $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -224,8 +222,7 @@ class pdf_ban extends ModeleBankAccountDoc $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -263,8 +260,7 @@ class pdf_ban extends ModeleBankAccountDoc return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } @@ -332,8 +328,7 @@ class pdf_ban extends ModeleBankAccountDoc $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); diff --git a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php index 23868eef643..8bcb06b72da 100644 --- a/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php +++ b/htdocs/core/modules/bank/doc/pdf_sepamandate.modules.php @@ -124,8 +124,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc else $dir = $conf->bank->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); if (!empty($moreparams['force_dir_output'])) $dir = $moreparams['force_dir_output']; else $dir = $conf->bank->dir_output."/".$objectref; @@ -210,8 +209,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -368,8 +366,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -416,8 +413,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } @@ -567,8 +563,7 @@ class pdf_sepamandate extends ModeleBankAccountDoc $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 5b561f90c1c..b01df64c088 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -209,8 +209,7 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { $result = -2; } - else - { + else { if ($this->verif_syntax($code, $type) >= 0) { $is_dispo = $this->verif_dispo($db, $code, $product); @@ -218,19 +217,16 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { $result = -3; } - else - { + else { $result = 0; } } - else - { + else { if (dol_strlen($code) == 0) { $result = -2; } - else - { + else { $result = -1; } } @@ -264,13 +260,11 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode { return 0; } - else - { + else { return -1; } } - else - { + else { return -2; } } diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index 9755369793e..4260cd4d8c4 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -130,8 +130,7 @@ class doc_generic_bom_odt extends ModelePDFBom unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -268,8 +267,7 @@ class doc_generic_bom_odt extends ModelePDFBom if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -302,8 +300,7 @@ class doc_generic_bom_odt extends ModelePDFBom $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -386,7 +383,7 @@ class doc_generic_bom_odt extends ModelePDFBom if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -397,8 +394,7 @@ class doc_generic_bom_odt extends ModelePDFBom } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -422,8 +418,7 @@ class doc_generic_bom_odt extends ModelePDFBom $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -497,8 +492,7 @@ class doc_generic_bom_odt extends ModelePDFBom return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index 08acd30451c..2246412997b 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -130,8 +130,7 @@ class mod_bom_standard extends ModeleNumRefboms if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index daa2e04366d..ea431b5a2ce 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -127,8 +127,7 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog(__METHOD__, LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php index 7cc72a865d8..bbe9bc119a4 100644 --- a/htdocs/core/modules/cheque/modules_chequereceipts.php +++ b/htdocs/core/modules/cheque/modules_chequereceipts.php @@ -179,8 +179,7 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) { $modele = $conf->global->CHEQUERECEIPT_ADDON_PDF; } - else - { + else { //print $langs->trans("Error")." ".$langs->trans("Error_FACTURE_ADDON_PDF_NotDefined"); //return 0; $modele = 'blochet'; @@ -204,15 +203,13 @@ function chequereceipt_pdf_create($db, $id, $message, $modele, $outputlangs) $outputlangs->charset_output = $sav_charset_output; return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "chequereceipt_pdf_create Error: ".$obj->error); return -1; } } - else - { + else { dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $dir.$file)); return -1; } diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 75c5103c4ab..f992996403a 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -137,8 +137,7 @@ class doc_generic_order_odt extends ModelePDFCommandes unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -280,8 +279,7 @@ class doc_generic_order_odt extends ModelePDFCommandes if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -314,8 +312,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -402,7 +399,7 @@ class doc_generic_order_odt extends ModelePDFCommandes if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -413,8 +410,7 @@ class doc_generic_order_odt extends ModelePDFCommandes } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -438,8 +434,7 @@ class doc_generic_order_odt extends ModelePDFCommandes $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -513,8 +508,7 @@ class doc_generic_order_odt extends ModelePDFCommandes return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 3838b9146e6..f5568452221 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -173,8 +173,7 @@ class pdf_einstein extends ModelePDFCommandes $this->posxqty = 135; $this->posxunit = 151; } - else - { + else { $this->posxtva = 110; $this->posxup = 126; $this->posxqty = 145; @@ -240,8 +239,7 @@ class pdf_einstein extends ModelePDFCommandes $dir = $conf->commande->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->commande->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -441,17 +439,15 @@ class pdf_einstein extends ModelePDFCommandes $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -567,8 +563,7 @@ class pdf_einstein extends ModelePDFCommandes { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -583,8 +578,7 @@ class pdf_einstein extends ModelePDFCommandes { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -599,8 +593,7 @@ class pdf_einstein extends ModelePDFCommandes // Show square if ($pagenb == 1) $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); - else - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); + else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos @@ -643,14 +636,12 @@ class pdf_einstein extends ModelePDFCommandes return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); return 0; } @@ -915,8 +906,7 @@ class pdf_einstein extends ModelePDFCommandes { // Nothing to do } - else - { + else { //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ @@ -1282,16 +1272,14 @@ class pdf_einstein extends ModelePDFCommandes $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1910dd0c048..dc13ad237b7 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -233,8 +233,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } - else - { + else { $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } @@ -254,13 +253,11 @@ class pdf_eratosthene extends ModelePDFCommandes { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -289,8 +286,7 @@ class pdf_eratosthene extends ModelePDFCommandes $dir = $conf->commande->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->commande->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -532,8 +528,7 @@ class pdf_eratosthene extends ModelePDFCommandes $tab_height = $tab_height - $height_note; $tab_top = $posyafter + 6; } - else - { + else { $height_note = 0; } @@ -583,8 +578,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -622,17 +616,15 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -785,8 +777,7 @@ class pdf_eratosthene extends ModelePDFCommandes { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -801,8 +792,7 @@ class pdf_eratosthene extends ModelePDFCommandes { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -817,8 +807,7 @@ class pdf_eratosthene extends ModelePDFCommandes // Show square if ($pagenb == $pageposbeforeprintlines) $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); - else - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); + else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Affiche zone infos @@ -861,14 +850,12 @@ class pdf_eratosthene extends ModelePDFCommandes return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "COMMANDE_OUTPUTDIR"); return 0; } @@ -1130,8 +1117,7 @@ class pdf_eratosthene extends ModelePDFCommandes { // Nothing to do } - else - { + else { //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ @@ -1450,16 +1436,14 @@ class pdf_eratosthene extends ModelePDFCommandes $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -1853,8 +1837,7 @@ class pdf_eratosthene extends ModelePDFCommandes { $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys } - else - { + else { $this->cols = $hookmanager->resArray; } } diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 87e5666be4b..a5558f2d0b2 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -130,8 +130,7 @@ class mod_commande_marbre extends ModeleNumRefCommandes if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_commande_marbre::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index c938f40cfb2..b5bc55633ee 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -136,8 +136,7 @@ class doc_generic_contract_odt extends ModelePDFContract unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -267,8 +266,7 @@ class doc_generic_contract_odt extends ModelePDFContract if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -301,8 +299,7 @@ class doc_generic_contract_odt extends ModelePDFContract $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -382,7 +379,7 @@ class doc_generic_contract_odt extends ModelePDFContract if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -394,8 +391,7 @@ class doc_generic_contract_odt extends ModelePDFContract } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -419,8 +415,7 @@ class doc_generic_contract_odt extends ModelePDFContract $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -490,8 +485,7 @@ class doc_generic_contract_odt extends ModelePDFContract return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index f8b7908654b..68c8cd1b96c 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -194,8 +194,7 @@ class pdf_strato extends ModelePDFContract $dir = $conf->contrat->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->contrat->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -388,18 +387,16 @@ class pdf_strato extends ModelePDFContract $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -426,8 +423,7 @@ class pdf_strato extends ModelePDFContract { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -442,8 +438,7 @@ class pdf_strato extends ModelePDFContract { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter - $heightforfreetext, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter - $heightforfreetext, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -462,8 +457,7 @@ class pdf_strato extends ModelePDFContract $this->tabSignature($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs); $bottomlasttab = $this->page_hauteur - $heightforfooter - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $this->tabSignature($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, $outputlangs); $bottomlasttab = $this->page_hauteur - $heightforfooter - $heightforfooter + 1; @@ -499,14 +493,12 @@ class pdf_strato extends ModelePDFContract return 1; } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "CONTRACT_OUTPUTDIR"); return 0; } @@ -636,16 +628,14 @@ class pdf_strato extends ModelePDFContract $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 52950778738..2becdf52219 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -139,8 +139,7 @@ class mod_contract_serpis extends ModelNumRefContracts if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_contract_serpis::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/dons/html_cerfafr.modules.php b/htdocs/core/modules/dons/html_cerfafr.modules.php index 4c025750f04..d3ee39e8a5f 100644 --- a/htdocs/core/modules/dons/html_cerfafr.modules.php +++ b/htdocs/core/modules/dons/html_cerfafr.modules.php @@ -104,8 +104,7 @@ class html_cerfafr extends ModeleDon $dir = $conf->don->dir_output; $file = $dir."/SPECIMEN.html"; } - else - { + else { $donref = dol_sanitizeFileName($don->ref); $dir = $conf->don->dir_output."/".$donref; $file = $dir."/".$donref.".html"; @@ -142,8 +141,7 @@ class html_cerfafr extends ModeleDon elseif ($don->modepaymentcode == 'VIR' || $don->modepaymentcode == 'PRE' || $don->modepaymentcode == 'CB') { $ModePaiement = ' Remise d\'espèces Chèque Virement, prélèvement, carte bancaire'; } - else - { + else { $ModePaiement = ' Remise d\'espèces Chèque Virement, prélèvement, carte bancaire'; } @@ -217,8 +215,7 @@ class html_cerfafr extends ModeleDon { $art200 = '200 du CGI'; } - else - { + else { $art200 = '200 du CGI'; } } @@ -230,8 +227,7 @@ class html_cerfafr extends ModeleDon { $art238 = '238 bis du CGI'; } - else - { + else { $art238 = '238 bis du CGI'; } } @@ -243,8 +239,7 @@ class html_cerfafr extends ModeleDon { $art978 = '978 du CGI'; } - else - { + else { $art978 = '978 du CGI'; } } @@ -262,14 +257,12 @@ class html_cerfafr extends ModeleDon return 1; } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "DON_OUTPUTDIR"); return 0; } @@ -412,15 +405,13 @@ class html_cerfafr extends ModeleDon $somme = $trio[3].' '.$secon[3].' '.$prim[3].' million '; elseif (($cent[3] != 0 && $cent[3] != '') || ($dix[3] != 0 && $dix[3] != '') || ($unite[3] != 0 && $unite[3] != '')) $somme = $trio[3].' '.$secon[3].' '.$prim[3].' millions '; - else - $somme = $trio[3].' '.$secon[3].' '.$prim[3]; + else $somme = $trio[3].' '.$secon[3].' '.$prim[3]; if (($cent[2] == 0 || $cent[2] == '') && ($dix[2] == 0 || $dix[2] == '') && ($unite[2] == 1)) $somme = $somme.' mille '; elseif (($cent[2] != 0 && $cent[2] != '') || ($dix[2] != 0 && $dix[2] != '') || ($unite[2] != 0 && $unite[2] != '')) $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2].' milles '; - else - $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2]; + else $somme = $somme.$trio[2].' '.$secon[2].' '.$prim[2]; $somme = $somme.$trio[1].' '.$secon[1].' '.$prim[1]; @@ -428,7 +419,6 @@ class html_cerfafr extends ModeleDon if (($cent_c == '0' || $cent_c == '') && ($dix_c == '0' || $dix_c == '')) return $somme.' et zéro '.$dev2; - else - return $somme.$trio_c.' '.$secon_c.' '.$dev2; + else return $somme.$trio_c.' '.$secon_c.' '.$dev2; } } diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 1ea817709e1..a9be573f80d 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -138,8 +138,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -280,8 +279,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -385,7 +383,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -407,7 +405,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -431,7 +429,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -452,7 +450,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -478,7 +476,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -489,8 +487,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -512,8 +509,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -585,8 +581,7 @@ class doc_generic_shipment_odt extends ModelePdfExpedition return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c232edbe81c..2aa28f3b7db 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -196,8 +196,7 @@ class pdf_espadon extends ModelePdfExpedition $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product ."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } - else - { + else { $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product') . dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -212,13 +211,11 @@ class pdf_espadon extends ModelePdfExpedition { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -241,8 +238,7 @@ class pdf_espadon extends ModelePdfExpedition $dir = $conf->expedition->dir_output."/sending"; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $expref = dol_sanitizeFileName($object->ref); $dir = $conf->expedition->dir_output."/sending/".$expref; $file = $dir."/".$expref.".pdf"; @@ -413,8 +409,7 @@ class pdf_espadon extends ModelePdfExpedition $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -464,8 +459,7 @@ class pdf_espadon extends ModelePdfExpedition // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } @@ -504,17 +498,15 @@ class pdf_espadon extends ModelePdfExpedition $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -608,8 +600,7 @@ class pdf_espadon extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -624,8 +615,7 @@ class pdf_espadon extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -643,8 +633,7 @@ class pdf_espadon extends ModelePdfExpedition $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -678,14 +667,12 @@ class pdf_espadon extends ModelePdfExpedition return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); return 0; } @@ -889,16 +876,14 @@ class pdf_espadon extends ModelePdfExpedition $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -908,8 +893,7 @@ class pdf_espadon extends ModelePdfExpedition { $posx = 105; } - else - { + else { $posx = $this->marge_gauche + 3; } //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); @@ -1275,8 +1259,7 @@ class pdf_espadon extends ModelePdfExpedition { $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys } - else - { + else { $this->cols = $hookmanager->resArray; } } diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index 7899df494fc..bd698d72519 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -193,8 +193,7 @@ class pdf_merou extends ModelePdfExpedition $dir = $conf->expedition->dir_output."/sending"; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $expref = dol_sanitizeFileName($object->ref); $dir = $conf->expedition->dir_output."/sending/".$expref; $file = $dir."/".$expref.".pdf"; @@ -288,8 +287,7 @@ class pdf_merou extends ModelePdfExpedition $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -366,8 +364,7 @@ class pdf_merou extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -381,8 +378,7 @@ class pdf_merou extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -398,8 +394,7 @@ class pdf_merou extends ModelePdfExpedition $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage - 1, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -435,14 +430,12 @@ class pdf_merou extends ModelePdfExpedition return 1; } - else - { + else { $this->error = $outputlangs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $outputlangs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); return 0; } @@ -564,16 +557,14 @@ class pdf_merou extends ModelePdfExpedition $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, 10, 5, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(70, 3, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -673,8 +664,7 @@ class pdf_merou extends ModelePdfExpedition } } } - else - { + else { $pdf->MultiCell(50, 8, $outputlangs->transnoentities("Deliverer")." ".$outputlangs->convToOutputCharset($this->livreur->getFullName($outputlangs)), '', 'L'); } diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 2e0733f1ba2..99dfd20301f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -219,8 +219,7 @@ class pdf_rouget extends ModelePdfExpedition $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } - else - { + else { $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -234,13 +233,11 @@ class pdf_rouget extends ModelePdfExpedition { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -262,8 +259,7 @@ class pdf_rouget extends ModelePdfExpedition $dir = $conf->expedition->dir_output."/sending"; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $expref = dol_sanitizeFileName($object->ref); $dir = $conf->expedition->dir_output."/sending/".$expref; $file = $dir."/".$expref.".pdf"; @@ -422,8 +418,7 @@ class pdf_rouget extends ModelePdfExpedition $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -463,8 +458,7 @@ class pdf_rouget extends ModelePdfExpedition // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -503,18 +497,16 @@ class pdf_rouget extends ModelePdfExpedition $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -599,8 +591,7 @@ class pdf_rouget extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -615,8 +606,7 @@ class pdf_rouget extends ModelePdfExpedition { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -634,8 +624,7 @@ class pdf_rouget extends ModelePdfExpedition $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -669,14 +658,12 @@ class pdf_rouget extends ModelePdfExpedition return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); return 0; } @@ -924,16 +911,14 @@ class pdf_rouget extends ModelePdfExpedition $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -943,8 +928,7 @@ class pdf_rouget extends ModelePdfExpedition { $posx = 105; } - else - { + else { $posx = $this->marge_gauche + 3; } //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index afbeec748ea..f2d49ba6409 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -134,8 +134,7 @@ class mod_expedition_safor extends ModelNumRefExpedition if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_expedition_safor::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 3a66a8ae961..91539b979c2 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -227,8 +227,7 @@ class pdf_standard extends ModeleExpenseReport $dir = $conf->expensereport->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->expensereport->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -340,8 +339,7 @@ class pdf_standard extends ModeleExpenseReport $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -410,17 +408,15 @@ class pdf_standard extends ModeleExpenseReport $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -459,8 +455,7 @@ class pdf_standard extends ModeleExpenseReport { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -475,8 +470,7 @@ class pdf_standard extends ModeleExpenseReport { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -493,8 +487,7 @@ class pdf_standard extends ModeleExpenseReport $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -561,14 +554,12 @@ class pdf_standard extends ModeleExpenseReport return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "EXPENSEREPORT_OUTPUTDIR"); return 0; } @@ -710,8 +701,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -858,8 +848,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell(96, 4, $outputlangs->transnoentities("DATE_CANCEL")." : ".dol_print_date($object->date_cancel, "day", false, $outputlangs), 0, 'L'); } } - else - { + else { if ($object->fk_user_approve > 0) { $userfee = new User($this->db); $userfee->fetch($object->fk_user_approve); $posy += 6; @@ -1106,8 +1095,7 @@ class pdf_standard extends ModeleExpenseReport $pdf->MultiCell(30, 4, $outputlangs->transnoentitiesnoconv("RemainderToPay"), 0, 'L', 0); } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index 9093e55f78f..bae163227e4 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -187,8 +187,7 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_expensereport_jade::getNextValue", LOG_DEBUG); return 0; } diff --git a/htdocs/core/modules/export/export_csv.modules.php b/htdocs/core/modules/export/export_csv.modules.php index 5124cb3f160..0e57634f488 100644 --- a/htdocs/core/modules/export/export_csv.modules.php +++ b/htdocs/core/modules/export/export_csv.modules.php @@ -218,8 +218,7 @@ class ExportCsv extends ModeleExports { $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; } - else - { + else { $outputlangs->charset_output = 'ISO-8859-1'; } @@ -254,8 +253,7 @@ class ExportCsv extends ModeleExports { $outputlangs->charset_output = $conf->global->EXPORT_CSV_FORCE_CHARSET; } - else - { + else { $outputlangs->charset_output = 'ISO-8859-1'; } diff --git a/htdocs/core/modules/export/export_excel2007new.modules.php b/htdocs/core/modules/export/export_excel2007new.modules.php index 779f2240155..a96d51634b0 100644 --- a/htdocs/core/modules/export/export_excel2007new.modules.php +++ b/htdocs/core/modules/export/export_excel2007new.modules.php @@ -274,8 +274,7 @@ class ExportExcel2007new extends ModeleExports { $this->worksheet->write($this->row, $this->col, $outputlangs->transnoentities($alias), $formatheader); } - else - { + else { $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $outputlangs->transnoentities($alias)); if (!empty($array_types[$code]) && in_array($array_types[$code], array('Date', 'Numeric', 'TextAuto'))) // Set autowidth for some types { @@ -333,8 +332,7 @@ class ExportExcel2007new extends ModeleExports { $newvalue = $outputlangs->transnoentities($reg[1]); } - else - { + else { $newvalue = $outputlangs->convToOutputCharset($newvalue); } @@ -352,8 +350,7 @@ class ExportExcel2007new extends ModeleExports $coord = $this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row + 1)->getCoordinate(); $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('yyyy-mm-dd h:mm:ss'); } - else - { + else { if ($typefield == 'Text' || $typefield == 'TextAuto') { //$this->workbook->getActiveSheet()->getCellByColumnAndRow($this->col, $this->row+1)->setValueExplicit($newvalue, PHPExcel_Cell_DataType::TYPE_STRING); @@ -362,8 +359,7 @@ class ExportExcel2007new extends ModeleExports $this->workbook->getActiveSheet()->getStyle($coord)->getNumberFormat()->setFormatCode('@'); $this->workbook->getActiveSheet()->getStyle($coord)->getAlignment()->setHorizontal(PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT); } - else - { + else { $this->workbook->getActiveSheet()->SetCellValueByColumnAndRow($this->col, $this->row + 1, $newvalue); } } diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index acbebd54da8..a25f07384a3 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -137,8 +137,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -280,8 +279,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -410,7 +408,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -421,8 +419,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -446,8 +443,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -519,8 +515,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index cf91ec4806c..ea5376981a4 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -184,8 +184,7 @@ class pdf_crabe extends ModelePDFFactures $this->posxqty = 135; $this->posxunit = 151; } - else - { + else { $this->posxtva = 110; $this->posxup = 126; $this->posxqty = 145; @@ -288,8 +287,7 @@ class pdf_crabe extends ModelePDFFactures $dir = $conf->facture->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->facture->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -518,8 +516,7 @@ class pdf_crabe extends ModelePDFFactures // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -556,18 +553,16 @@ class pdf_crabe extends ModelePDFFactures $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -701,8 +696,7 @@ class pdf_crabe extends ModelePDFFactures { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -717,8 +711,7 @@ class pdf_crabe extends ModelePDFFactures { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -736,8 +729,7 @@ class pdf_crabe extends ModelePDFFactures $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -780,14 +772,12 @@ class pdf_crabe extends ModelePDFFactures return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "FAC_OUTPUTDIR"); return 0; } @@ -882,8 +872,7 @@ class pdf_crabe extends ModelePDFFactures $i++; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -936,8 +925,7 @@ class pdf_crabe extends ModelePDFFactures return $tab3_top + $y + 3; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1216,8 +1204,7 @@ class pdf_crabe extends ModelePDFFactures { // Nothing to do } - else - { + else { // FIXME amount of vat not supported with multicurrency //Local tax 1 before VAT @@ -1663,16 +1650,14 @@ class pdf_crabe extends ModelePDFFactures $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index 8f48f31fddb..acdb6063d5f 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -251,8 +251,7 @@ class pdf_sponge extends ModelePDFFactures $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } - else - { + else { $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } @@ -272,13 +271,11 @@ class pdf_sponge extends ModelePDFFactures { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -309,8 +306,7 @@ class pdf_sponge extends ModelePDFFactures $dir = $conf->facture->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->facture->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -586,8 +582,7 @@ class pdf_sponge extends ModelePDFFactures $tab_height = $tab_height - $height_note; $tab_top = $posyafter + 6; } - else - { + else { $height_note = 0; } @@ -635,8 +630,7 @@ class pdf_sponge extends ModelePDFFactures // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (!empty($this->cols['photo']) && isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -674,17 +668,15 @@ class pdf_sponge extends ModelePDFFactures $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -849,8 +841,7 @@ class pdf_sponge extends ModelePDFFactures if ($pagenb == $pageposbeforeprintlines) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -864,8 +855,7 @@ class pdf_sponge extends ModelePDFFactures if ($pagenb == $pageposafter) { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code, $outputlangsbis); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code, $outputlangsbis); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -883,8 +873,7 @@ class pdf_sponge extends ModelePDFFactures $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code, $outputlangsbis); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code, $outputlangsbis); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -927,14 +916,12 @@ class pdf_sponge extends ModelePDFFactures return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "FAC_OUTPUTDIR"); return 0; } @@ -1032,8 +1019,7 @@ class pdf_sponge extends ModelePDFFactures $i++; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1075,8 +1061,7 @@ class pdf_sponge extends ModelePDFFactures return $tab3_top + $y + 3; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1474,8 +1459,7 @@ class pdf_sponge extends ModelePDFFactures { // Nothing to do } - else - { + else { // FIXME amount of vat not supported with multicurrency //Local tax 1 before VAT @@ -1909,16 +1893,14 @@ class pdf_sponge extends ModelePDFFactures $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -2396,8 +2378,7 @@ class pdf_sponge extends ModelePDFFactures { $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys } - else - { + else { $this->cols = $hookmanager->resArray; } } diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 6b4b5f0451d..ae349f6f5cb 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -174,8 +174,7 @@ class mod_facture_mars extends ModeleNumRefFactures if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { return -1; } diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index caa47db3529..c16e751d7db 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -203,8 +203,7 @@ class mod_facture_terre extends ModeleNumRefFactures if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { return -1; } diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index d7509feff7c..a88e3c32bf3 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -186,8 +186,7 @@ class pdf_soleil extends ModelePDFFicheinter $dir = $conf->ficheinter->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->ficheinter->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -289,8 +288,7 @@ class pdf_soleil extends ModelePDFFicheinter $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -378,7 +376,7 @@ class pdf_soleil extends ModelePDFFicheinter } } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -404,8 +402,7 @@ class pdf_soleil extends ModelePDFFicheinter { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -420,8 +417,7 @@ class pdf_soleil extends ModelePDFFicheinter { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -440,8 +436,7 @@ class pdf_soleil extends ModelePDFFicheinter $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -470,14 +465,12 @@ class pdf_soleil extends ModelePDFFicheinter return 1; } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "FICHEINTER_OUTPUTDIR"); return 0; } @@ -591,16 +584,14 @@ class pdf_soleil extends ModelePDFFicheinter $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index b592e65b0d3..5a56b849e5f 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -107,8 +107,7 @@ class mod_pacific extends ModeleNumRefFicheinter { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index 140ce27cf03..b3b5906f683 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -179,8 +179,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, { $modele = $conf->global->FICHEINTER_ADDON_PDF; } - else - { + else { $modele = 'soleil'; } } @@ -235,15 +234,13 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "fichinter_pdf_create Error: ".$obj->error); return 0; } } - else - { + else { print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); return 0; } diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index 3de92c4a05e..90c419bd260 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -140,8 +140,7 @@ class mod_holiday_madonna extends ModelNumRefHolidays if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_holiday_madonna::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index de32e84d43a..2e8d1d80097 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -199,8 +199,7 @@ class ImportCsv extends ModeleImports $this->error = $langs->trans("ErrorFailToOpenFile", $file); $ret = -1; } - else - { + else { $this->file = $file; } @@ -265,21 +264,19 @@ class ImportCsv extends ModeleImports $newarrayres[$key]['val'] = $val; $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null } - else - { + else { $newarrayres[$key]['val'] = utf8_encode($val); $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null } } - else // Autodetect format (UTF8 or ISO) + else // Autodetect format (UTF8 or ISO) { if (utf8_check($val)) { $newarrayres[$key]['val'] = $val; $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null } - else - { + else { $newarrayres[$key]['val'] = utf8_encode($val); $newarrayres[$key]['type'] = (dol_strlen($val) ? 1 : -1); // If empty we considere it's null } @@ -347,8 +344,7 @@ class ImportCsv extends ModeleImports $this->warnings[$warning]['type'] = 'EMPTY'; $warning++; } - else - { + else { $last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id) $updatedone = false; $insertdone = false; @@ -375,8 +371,7 @@ class ImportCsv extends ModeleImports } else dol_print_error($this->db); } - else - { + else { //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } @@ -411,8 +406,7 @@ class ImportCsv extends ModeleImports $error++; } // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else - { + else { // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { @@ -438,8 +432,7 @@ class ImportCsv extends ModeleImports { $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]; } - else - { + else { $resultload = dol_include_once($file); if (empty($resultload)) { @@ -478,8 +471,7 @@ class ImportCsv extends ModeleImports { $newval = $classinstance->id; } - else - { + else { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); else $this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile'; @@ -542,8 +534,7 @@ class ImportCsv extends ModeleImports { $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]; } - else - { + else { $resultload = dol_include_once($file); if (empty($resultload)) { @@ -560,8 +551,7 @@ class ImportCsv extends ModeleImports { $newval = $scaleorid ? $scaleorid : 0; } - else - { + else { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; $this->errors[$error]['type'] = 'FOREIGNKEY'; @@ -688,8 +678,7 @@ class ImportCsv extends ModeleImports $i++; } } - else - { + else { dol_print_error($this->db); } } @@ -761,8 +750,7 @@ class ImportCsv extends ModeleImports $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = "'".$tmp[1]."'"; } - else - { + else { $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; $error++; @@ -812,8 +800,7 @@ class ImportCsv extends ModeleImports // No record found with filters, insert will be tried below } } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -841,8 +828,7 @@ class ImportCsv extends ModeleImports $lastinsertid = 0; } } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -872,8 +858,7 @@ class ImportCsv extends ModeleImports // No error, update has been done. $this->db->db->affected_rows can be 0 if data hasn't changed $updatedone = true; } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -907,8 +892,7 @@ class ImportCsv extends ModeleImports $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). $insertdone = true; } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 35aee35869e..dc5bac9568c 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -375,8 +375,7 @@ class ImportXlsx extends ModeleImports $this->warnings[$warning]['type'] = 'EMPTY'; $warning++; } - else - { + else { $last_insert_id_array = array(); // store the last inserted auto_increment id for each table, so that dependent tables can be inserted with the appropriate id (eg: extrafields fk_object will be set with the last inserted object's id) $updatedone = false; $insertdone = false; @@ -403,8 +402,7 @@ class ImportXlsx extends ModeleImports } else dol_print_error($this->db); } - else - { + else { //dol_syslog("Table ".$tablename." check for entity into cache is ".$tablewithentity_cache[$tablename]); } @@ -439,8 +437,7 @@ class ImportXlsx extends ModeleImports $error++; } // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else - { + else { // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { @@ -465,8 +462,7 @@ class ImportXlsx extends ModeleImports { $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'][$newval]; } - else - { + else { $resultload = dol_include_once($file); if (empty($resultload)) { @@ -505,8 +501,7 @@ class ImportXlsx extends ModeleImports { $newval = $classinstance->id; } - else - { + else { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'code', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); elseif (!empty($objimport->array_import_convertvalue[0][$val]['element'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldRefNotIn', $key, $newval, $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['element'])); else $this->errors[$error]['lib'] = 'ErrorBadDefinitionOfImportProfile'; @@ -569,8 +564,7 @@ class ImportXlsx extends ModeleImports { $newval = $this->cacheconvert[$file.'_'.$class.'_'.$method.'_'.$units][$newval]; } - else - { + else { $resultload = dol_include_once($file); if (empty($resultload)) { @@ -587,8 +581,7 @@ class ImportXlsx extends ModeleImports { $newval = $scaleorid ? $scaleorid : 0; } - else - { + else { if (!empty($objimport->array_import_convertvalue[0][$val]['dict'])) $this->errors[$error]['lib'] = $langs->trans('ErrorFieldValueNotIn', $key, $newval, 'scale', $langs->transnoentitiesnoconv($objimport->array_import_convertvalue[0][$val]['dict'])); else $this->errors[$error]['lib'] = 'ErrorFieldValueNotIn'; $this->errors[$error]['type'] = 'FOREIGNKEY'; @@ -715,8 +708,7 @@ class ImportXlsx extends ModeleImports $i++; } } - else - { + else { dol_print_error($this->db); } } @@ -752,7 +744,7 @@ class ImportXlsx extends ModeleImports // Note: arrayrecord (and 'type') is filled with ->import_read_record called by import.php page before calling import_insert if (empty($newval) && $arrayrecord[($key - 1)]['type'] < 0) $listvalues[] = ($newval == '0' ? $newval : "null"); elseif (empty($newval) && $arrayrecord[($key - 1)]['type'] == 0) $listvalues[] = "''"; - else $listvalues[] = "'".$this->db->escape($newval)."'"; + else $listvalues[] = "'".$this->db->escape($newval)."'"; } $i++; } @@ -784,8 +776,7 @@ class ImportXlsx extends ModeleImports $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = "'".$tmp[1]."'"; } - else - { + else { $this->errors[$error]['lib'] = 'Bad value of profile setup '.$val.' for array_import_fieldshidden'; $this->errors[$error]['type'] = 'Import profile setup'; $error++; @@ -834,8 +825,7 @@ class ImportXlsx extends ModeleImports // No record found with filters, insert will be tried below } } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -863,8 +853,7 @@ class ImportXlsx extends ModeleImports $lastinsertid = 0; } } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -894,8 +883,7 @@ class ImportXlsx extends ModeleImports // No error, update has been done. $this->db->db->affected_rows can be 0 if data hasn't changed $updatedone = true; } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; @@ -929,8 +917,7 @@ class ImportXlsx extends ModeleImports $last_insert_id_array[$tablename] = $this->db->last_insert_id($tablename); // store the last inserted auto_increment id for each table, so that child tables can be inserted with the appropriate id. This must be done just after the INSERT request, else we risk losing the id (because another sql query will be issued somewhere in Dolibarr). $insertdone = true; } - else - { + else { //print 'E'; $this->errors[$error]['lib'] = $this->db->lasterror(); $this->errors[$error]['type'] = 'SQL'; diff --git a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php index cda16561f8d..2a1b79bf4f3 100644 --- a/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/livraison/doc/pdf_typhon.modules.php @@ -205,8 +205,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $dir = $conf->expedition->dir_output."/receipt"; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->expedition->dir_output."/receipt/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -358,8 +357,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -404,17 +402,15 @@ class pdf_typhon extends ModelePDFDeliveryOrder $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -490,8 +486,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -506,8 +501,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -525,8 +519,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -627,8 +620,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } @@ -775,8 +767,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); @@ -799,8 +790,7 @@ class pdf_typhon extends ModelePDFDeliveryOrder { $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date_delivery, "%d %b %Y", false, $outputlangs, true), '', 'R'); } - else - { + else { $pdf->SetTextColor(255, 0, 0); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R'); $pdf->SetTextColor(0, 0, 60); diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 840b6a6f0a6..599a33578f5 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -143,8 +143,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { return -1; } diff --git a/htdocs/core/modules/mailings/advthirdparties.modules.php b/htdocs/core/modules/mailings/advthirdparties.modules.php index 464c657fa7b..858e44693b4 100644 --- a/htdocs/core/modules/mailings/advthirdparties.modules.php +++ b/htdocs/core/modules/mailings/advthirdparties.modules.php @@ -114,8 +114,7 @@ class mailing_advthirdparties extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; @@ -169,8 +168,7 @@ class mailing_advthirdparties extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; @@ -273,8 +271,7 @@ class mailing_advthirdparties extends MailingTargets $i++; } } - else - { + else { dol_print_error($this->db); } diff --git a/htdocs/core/modules/mailings/contacts1.modules.php b/htdocs/core/modules/mailings/contacts1.modules.php index 9d7a23ce9fd..1a4570df63f 100644 --- a/htdocs/core/modules/mailings/contacts1.modules.php +++ b/htdocs/core/modules/mailings/contacts1.modules.php @@ -191,8 +191,7 @@ class mailing_contacts1 extends MailingTargets $i++; } } - else - { + else { $s .= ''; } } @@ -266,8 +265,7 @@ class mailing_contacts1 extends MailingTargets $i++; } } - else - { + else { $s .= ''; } } @@ -308,8 +306,7 @@ class mailing_contacts1 extends MailingTargets $i++; } } - else - { + else { $s .= ''; } } @@ -448,8 +445,7 @@ class mailing_contacts1 extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; diff --git a/htdocs/core/modules/mailings/fraise.modules.php b/htdocs/core/modules/mailings/fraise.modules.php index 8a504ff28b5..e94fe57aa3b 100644 --- a/htdocs/core/modules/mailings/fraise.modules.php +++ b/htdocs/core/modules/mailings/fraise.modules.php @@ -155,8 +155,7 @@ class mailing_fraise extends MailingTargets $i++; } } - else - { + else { dol_print_error($this->db); } @@ -194,8 +193,7 @@ class mailing_fraise extends MailingTargets $i++; } } - else - { + else { dol_print_error($this->db); } @@ -314,8 +312,7 @@ class mailing_fraise extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; diff --git a/htdocs/core/modules/mailings/modules_mailings.php b/htdocs/core/modules/mailings/modules_mailings.php index ffba2571d23..9c042de1112 100644 --- a/htdocs/core/modules/mailings/modules_mailings.php +++ b/htdocs/core/modules/mailings/modules_mailings.php @@ -99,8 +99,7 @@ class MailingTargets // This can't be abstract as it is used for some method $obj = $this->db->fetch_object($result); return $obj->nb; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -193,8 +192,7 @@ class MailingTargets // This can't be abstract as it is used for some method { $j++; } - else - { + else { if ($this->db->errno() != 'DB_ERROR_RECORD_ALREADY_EXISTS') { // Si erreur autre que doublon diff --git a/htdocs/core/modules/mailings/pomme.modules.php b/htdocs/core/modules/mailings/pomme.modules.php index aa3e9bbc703..1f80623bece 100644 --- a/htdocs/core/modules/mailings/pomme.modules.php +++ b/htdocs/core/modules/mailings/pomme.modules.php @@ -214,8 +214,7 @@ class mailing_pomme extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; diff --git a/htdocs/core/modules/mailings/thirdparties.modules.php b/htdocs/core/modules/mailings/thirdparties.modules.php index 05e9f4f12c4..4773203e5ad 100644 --- a/htdocs/core/modules/mailings/thirdparties.modules.php +++ b/htdocs/core/modules/mailings/thirdparties.modules.php @@ -80,8 +80,7 @@ class mailing_thirdparties extends MailingTargets $sql .= " AND s.entity IN (".getEntity('societe').")"; $sql .= " AND s.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_cibles WHERE fk_mailing=".$mailing_id.")"; } - else - { + else { $addFilter = ""; if (isset($_POST["filter_client"]) && $_POST["filter_client"] <> '-1') { @@ -103,8 +102,7 @@ class mailing_thirdparties extends MailingTargets { $addDescription .= $langs->trans('ProspectCustomer'); } - else - { + else { $addDescription .= "Unknown status ".$_POST["filter_client"]; } } @@ -120,8 +118,7 @@ class mailing_thirdparties extends MailingTargets $addFilter .= " AND s.status=1"; $addDescription .= $langs->trans("Enabled"); } - else - { + else { $addFilter .= " AND s.status=0"; $addDescription .= $langs->trans("Disabled"); } @@ -187,8 +184,7 @@ class mailing_thirdparties extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->error()); $this->error = $this->db->error(); return -1; @@ -286,8 +282,7 @@ class mailing_thirdparties extends MailingTargets $i++; } } - else - { + else { dol_print_error($this->db); } diff --git a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php index 866712d4bb0..1c76a924883 100644 --- a/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php +++ b/htdocs/core/modules/mailings/thirdparties_services_expired.modules.php @@ -74,8 +74,7 @@ class mailing_thirdparties_services_expired extends MailingTargets $this->arrayofproducts[$i] = $obj->ref; } } - else - { + else { dol_print_error($this->db); } } @@ -154,8 +153,7 @@ class mailing_thirdparties_services_expired extends MailingTargets $i++; } } - else - { + else { dol_syslog($this->db->lasterror()); $this->error = $this->db->lasterror(); return -1; diff --git a/htdocs/core/modules/mailings/xinputfile.modules.php b/htdocs/core/modules/mailings/xinputfile.modules.php index 9d08cb3565d..040baddd7c2 100644 --- a/htdocs/core/modules/mailings/xinputfile.modules.php +++ b/htdocs/core/modules/mailings/xinputfile.modules.php @@ -180,8 +180,7 @@ class mailing_xinputfile extends MailingTargets $j++; } } - else - { + else { $i++; $langs->load("errors"); $msg = $langs->trans("ErrorFoundBadEmailInFile", $i, $cpt, $email); @@ -197,16 +196,14 @@ class mailing_xinputfile extends MailingTargets return -$i; } } - else - { + else { $this->error = $langs->trans("ErrorFaildToOpenFile"); return -1; } dol_syslog(get_class($this)."::add_to_target mailing ".$cpt." targets found"); } - else - { + else { $langs->load("errors"); if ($resupload < 0) // Unknown error { @@ -216,7 +213,7 @@ class mailing_xinputfile extends MailingTargets { $this->error = '
'.$langs->trans("ErrorFileIsInfectedWithAVirus").'
'; } - else // Known error + else // Known error { $this->error = '
'.$langs->trans($resupload).'
'; } diff --git a/htdocs/core/modules/mailings/xinputuser.modules.php b/htdocs/core/modules/mailings/xinputuser.modules.php index 0875b02ed56..56bbaa58137 100644 --- a/htdocs/core/modules/mailings/xinputuser.modules.php +++ b/htdocs/core/modules/mailings/xinputuser.modules.php @@ -149,15 +149,13 @@ class mailing_xinputuser extends MailingTargets return parent::addTargetsToDatabase($mailing_id, $cibles); } - else - { + else { $langs->load("errors"); $this->error = $langs->trans("ErrorBadEMail", $email); return -1; } } - else - { + else { $langs->load("errors"); $this->error = $langs->trans("ErrorBadEmail", $email); return -1; diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index 1582b1c1c34..e586de52b38 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -166,8 +166,7 @@ class pdf_standard extends CommonStickerGenerator // Output left area if ($textleft == '__LOGO__' && $logo) $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); elseif ($textleft == '__PHOTO__' && $photo) $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } @@ -188,7 +187,7 @@ class pdf_standard extends CommonStickerGenerator $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } - else // text on halft left and text on half right + else // text on halft left and text on half right { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); @@ -196,13 +195,12 @@ class pdf_standard extends CommonStickerGenerator $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } } - else // Only a right part + else // Only a right part { // Output right area if ($textright == '__LOGO__' && $logo) $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); elseif ($textright == '__PHOTO__' && $photo) $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } @@ -306,8 +304,7 @@ class pdf_standard extends CommonStickerGenerator $arrayofrecords = $arrayofmembers; } - else - { + else { $arrayofrecords = $object; } @@ -337,8 +334,7 @@ class pdf_standard extends CommonStickerGenerator $title = $outputlangs->transnoentities('MembersCards'); $keywords = $outputlangs->transnoentities('MembersCards')." ".$outputlangs->transnoentities("Foundation")." ".$outputlangs->convToOutputCharset($mysoc->name); } - else - { + else { dol_print_error('', 'Bad value for $mode'); return -1; } @@ -350,8 +346,7 @@ class pdf_standard extends CommonStickerGenerator $dir = $outputdir."/".get_exdir(0, 0, 0, 0, $object, 'member'); $file = $dir.'/'.$filename; } - else - { + else { $outputdir = $conf->adherent->dir_temp; $dir = $outputdir; $file = $dir.'/'.$filename; diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index f9bdd58af24..5f2f7f8b8ae 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -100,8 +100,7 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o { $code = $conf->global->ADHERENT_CARDS_ADDON_PDF; } - else - { + else { $code = $modele; } } @@ -154,16 +153,14 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o $outputlangs->charset_output = $sav_charset_output; return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "members_card_pdf_create Error: ".$obj->error); return -1; } } - else - { + else { dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file)); return -1; } diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index 2184500db8c..04283daf8b4 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -98,8 +98,7 @@ class modAgenda extends DolibarrModules $this->const[] = array('MAIN_AGENDA_ACTIONAUTO_'.$obj->code, "chaine", "1", '', 0, 'current'); } } - else - { + else { dol_print_error($this->db->lasterror()); } diff --git a/htdocs/core/modules/modBlockedLog.class.php b/htdocs/core/modules/modBlockedLog.class.php index 5b645747380..4527b620074 100644 --- a/htdocs/core/modules/modBlockedLog.class.php +++ b/htdocs/core/modules/modBlockedLog.class.php @@ -234,8 +234,7 @@ class modBlockedLog extends DolibarrModules { $res = $b->create($user, '0000000000'); // If already used for something else than SET or UNSET, we log with error } - else - { + else { $res = $b->create($user); } if ($res <= 0) { diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index e276fe1f5f7..ec0b497e7cd 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -137,8 +137,7 @@ class doc_generic_mo_odt extends ModelePDFMo unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -275,8 +274,7 @@ class doc_generic_mo_odt extends ModelePDFMo if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -309,8 +307,7 @@ class doc_generic_mo_odt extends ModelePDFMo $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -393,7 +390,7 @@ class doc_generic_mo_odt extends ModelePDFMo if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -404,8 +401,7 @@ class doc_generic_mo_odt extends ModelePDFMo } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -429,8 +425,7 @@ class doc_generic_mo_odt extends ModelePDFMo $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -504,8 +499,7 @@ class doc_generic_mo_odt extends ModelePDFMo return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index 3fd3b1ad87e..8b0edd9c129 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -130,8 +130,7 @@ class mod_mo_standard extends ModeleNumRefMos if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_mo_standard::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/oauth/github_oauthcallback.php b/htdocs/core/modules/oauth/github_oauthcallback.php index 4320481abb1..766d615f884 100644 --- a/htdocs/core/modules/oauth/github_oauthcallback.php +++ b/htdocs/core/modules/oauth/github_oauthcallback.php @@ -153,8 +153,7 @@ else // If entry on page with no parameter, we arrive here { $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); } - else - { + else { $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated } diff --git a/htdocs/core/modules/oauth/google_oauthcallback.php b/htdocs/core/modules/oauth/google_oauthcallback.php index 68aba389f31..0af4113fb0a 100644 --- a/htdocs/core/modules/oauth/google_oauthcallback.php +++ b/htdocs/core/modules/oauth/google_oauthcallback.php @@ -151,8 +151,7 @@ else // If entry on page with no parameter, we arrive here { $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); } - else - { + else { $url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated } diff --git a/htdocs/core/modules/oauth/stripelive_oauthcallback.php b/htdocs/core/modules/oauth/stripelive_oauthcallback.php index b2ff4165563..8be1be11cc8 100644 --- a/htdocs/core/modules/oauth/stripelive_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripelive_oauthcallback.php @@ -157,8 +157,7 @@ else // If entry on page with no parameter, we arrive here { $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); } - else - { + else { //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_LIVE_ID.'&scope=read_write'; diff --git a/htdocs/core/modules/oauth/stripetest_oauthcallback.php b/htdocs/core/modules/oauth/stripetest_oauthcallback.php index 925a55c7ca1..4374f65746e 100644 --- a/htdocs/core/modules/oauth/stripetest_oauthcallback.php +++ b/htdocs/core/modules/oauth/stripetest_oauthcallback.php @@ -157,8 +157,7 @@ else // If entry on page with no parameter, we arrive here { $url = $apiService->getAuthorizationUri(array('state'=>GETPOST('state'))); } - else - { + else { //$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated //https://connect.stripe.com/oauth/authorize?response_type=code&client_id=ca_AX27ut70tJ1j6eyFCV3ObEXhNOo2jY6V&scope=read_write $url = 'https://connect.stripe.com/oauth/authorize?response_type=code&client_id='.$conf->global->OAUTH_STRIPE_TEST_ID.'&scope=read_write'; diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 5650ad43707..b9909d64fea 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -137,8 +137,7 @@ class mod_payment_cicada extends ModeleNumRefPayments if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog(__METHOD__, LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/printing/printgcp.modules.php b/htdocs/core/modules/printing/printgcp.modules.php index 1a225518518..90f3825d007 100644 --- a/htdocs/core/modules/printing/printgcp.modules.php +++ b/htdocs/core/modules/printing/printgcp.modules.php @@ -157,8 +157,7 @@ class printing_printgcp extends PrintingDriver { $expiredat = $langs->trans("Unknown"); } - else - { + else { $expiredat = dol_print_date($endoflife, "dayhour"); } @@ -220,8 +219,7 @@ class printing_printgcp extends PrintingDriver { $html .= img_picto($langs->trans("Default"), 'on'); } - else - $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; + else $html .= ''.img_picto($langs->trans("Disabled"), 'off').''; $html .= ''; $html .= ''."\n"; } @@ -326,14 +324,12 @@ class printing_printgcp extends PrintingDriver { $printer_id = $obj->printer_id; } - else - { + else { if (!empty($conf->global->PRINTING_GCP_DEFAULT)) { $printer_id = $conf->global->PRINTING_GCP_DEFAULT; } - else - { + else { $this->errors[] = 'NoDefaultPrinterDefined'; $error++; return $error; @@ -507,8 +503,7 @@ class printing_printgcp extends PrintingDriver $html .= ''; } } - else - { + else { $html .= ''; $html .= ''.$langs->trans("None").''; $html .= ''; diff --git a/htdocs/core/modules/printing/printipp.modules.php b/htdocs/core/modules/printing/printipp.modules.php index 5a3d2481c6d..a305b648cfe 100644 --- a/htdocs/core/modules/printing/printipp.modules.php +++ b/htdocs/core/modules/printing/printipp.modules.php @@ -116,15 +116,13 @@ class printing_printipp extends PrintingDriver dol_syslog("Found a default printer for user ".$user->id." = ".$obj->printer_id); $ipp->setPrinterURI($obj->printer_id); } - else - { + else { if (!empty($conf->global->PRINTIPP_URI_DEFAULT)) { dol_syslog("Will use default printer conf->global->PRINTIPP_URI_DEFAULT = ".$conf->global->PRINTIPP_URI_DEFAULT); $ipp->setPrinterURI($conf->global->PRINTIPP_URI_DEFAULT); } - else - { + else { $this->errors[] = 'NoDefaultPrinterDefined'; $error++; return $error; diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index f85984ab9bd..9155baa8aac 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -153,8 +153,7 @@ class pdf_standardlabel extends CommonStickerGenerator // Output left area if ($textleft == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); elseif ($textleft == '%PHOTO%' && $photo) $pdf->Image($photo, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } @@ -175,7 +174,7 @@ class pdf_standardlabel extends CommonStickerGenerator $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $widthtouse - $xleft - $xleft - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } - else // text on halft left and text on half right + else // text on halft left and text on half right { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); @@ -183,13 +182,12 @@ class pdf_standardlabel extends CommonStickerGenerator $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } } - else // Only a right part + else // Only a right part { // Output right area if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); elseif ($textright == '%PHOTO%' && $photo) $pdf->Image($photo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 568d850765f..3a877049a26 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -167,8 +167,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); } - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } @@ -219,7 +218,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator $pdf->MultiCell($widthtouse - $logoWidth - 1, $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); } } - else // text on halft left and text on half right + else // text on halft left and text on half right { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell(round($this->_Width / 2), $this->_Line_Height, $outputlangs->convToOutputCharset($textleft), 0, 'L'); @@ -227,7 +226,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator $pdf->MultiCell(round($this->_Width / 2) - 2, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } } - else // Only a right part + else // Only a right part { // Output right area if ($textright == '%LOGO%' && $logo) $pdf->Image($logo, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, 0, $logoHeight); @@ -235,8 +234,7 @@ class pdf_tcpdflabel extends CommonStickerGenerator { $this->writeBarcode($pdf, $code, $encoding, $is2d, $_PosX + $this->_Width - $widthtouse - $xleft, $_PosY + $ytop, $widthtouse, $heighttouse); } - else - { + else { $pdf->SetXY($_PosX + $xleft, $_PosY + $ytop); $pdf->MultiCell($this->_Width - $xleft, $this->_Line_Height, $outputlangs->convToOutputCharset($textright), 0, 'R'); } diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index f99ddafc4b8..ddf6d73a2a3 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -101,8 +101,7 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp { $code = $conf->global->ADHERENT_ETIQUETTE_TYPE; } - else - { + else { $code = $modele; } } @@ -156,15 +155,13 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp $outputlangs->charset_output = $sav_charset_output; return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, "doc_label_pdf_create Error: ".$obj->error); return -1; } } - else - { + else { dol_print_error('', $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file)); return -1; } diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index c0fa4d0f6eb..3965bd1be5d 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -141,8 +141,7 @@ class doc_generic_product_odt extends ModelePDFProduct unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -294,8 +293,7 @@ class doc_generic_product_odt extends ModelePDFProduct if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -329,8 +327,7 @@ class doc_generic_product_odt extends ModelePDFProduct $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } // Make substitution @@ -417,7 +414,7 @@ class doc_generic_product_odt extends ModelePDFProduct if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -428,8 +425,7 @@ class doc_generic_product_odt extends ModelePDFProduct } } // Replace tags of lines - try - { + try { $listlines = $odfHandler->setSegment('supplierprices'); if (!empty($object->supplierprices)) { foreach ($object->supplierprices as $supplierprice) @@ -441,8 +437,7 @@ class doc_generic_product_odt extends ModelePDFProduct $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($array_lines as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -514,8 +509,7 @@ class doc_generic_product_odt extends ModelePDFProduct return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index cbe618b488f..20c3ba9c087 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -182,8 +182,7 @@ class pdf_standard extends ModelePDFProduct $dir = $conf->product->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->product->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -335,8 +334,7 @@ class pdf_standard extends ModelePDFProduct $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -574,14 +572,12 @@ class pdf_standard extends ModelePDFProduct return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "PRODUCT_OUTPUTDIR"); return 0; } @@ -741,16 +737,14 @@ class pdf_standard extends ModelePDFProduct $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index ba6329004e3..dc6d7bfd6ef 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -280,8 +280,7 @@ class mod_codeproduct_elephant extends ModeleProductCode { $result = -2; } - else - { + else { // Get Mask value $mask = ''; if ($type == 0) $mask = empty($conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT) ? '' : $conf->global->PRODUCT_ELEPHANT_MASK_PRODUCT; @@ -328,13 +327,11 @@ class mod_codeproduct_elephant extends ModeleProductCode { return 0; } - else - { + else { return -1; } } - else - { + else { return -2; } } diff --git a/htdocs/core/modules/product/modules_product.class.php b/htdocs/core/modules/product/modules_product.class.php index 80bc9f7ce0a..1ecd734dec2 100644 --- a/htdocs/core/modules/product/modules_product.class.php +++ b/htdocs/core/modules/product/modules_product.class.php @@ -170,8 +170,7 @@ abstract class ModeleProductCode $i++; } } - else - { + else { return -1; } return $liste; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 542ea728f84..585edee00ee 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -408,8 +408,7 @@ class doc_generic_project_odt extends ModelePDFProjects unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -544,8 +543,7 @@ class doc_generic_project_odt extends ModelePDFProjects if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -636,7 +634,7 @@ class doc_generic_project_odt extends ModelePDFProjects if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -648,8 +646,7 @@ class doc_generic_project_odt extends ModelePDFProjects } // Replace tags of lines for tasks - try - { + try { $listlines = $odfHandler->setSegment('tasks'); $taskstatic = new Task($this->db); @@ -667,8 +664,7 @@ class doc_generic_project_odt extends ModelePDFProjects //complete_substitutions_array($tmparray, $outputlangs, $object, $task, "completesubstitutionarray_lines"); foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -718,8 +714,7 @@ class doc_generic_project_odt extends ModelePDFProjects foreach ($tmparray as $key => $val) { - try - { + try { $listlinestaskres->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -768,8 +763,7 @@ class doc_generic_project_odt extends ModelePDFProjects $tmparray = $this->get_substitutionarray_taskstime($row, $outputlangs); foreach ($tmparray as $key => $val) { - try - { + try { $listlinestasktime->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -808,8 +802,7 @@ class doc_generic_project_odt extends ModelePDFProjects foreach ($tmparray as $key => $val) { - try - { + try { $listlinestasktime->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -841,8 +834,7 @@ class doc_generic_project_odt extends ModelePDFProjects //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); foreach ($tmparray as $key => $val) { - try - { + try { $listtasksfiles->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -873,8 +865,7 @@ class doc_generic_project_odt extends ModelePDFProjects } // Replace tags of project files - try - { + try { $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); @@ -887,8 +878,7 @@ class doc_generic_project_odt extends ModelePDFProjects foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -923,8 +913,7 @@ class doc_generic_project_odt extends ModelePDFProjects } if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { - try - { + try { $listlines = $odfHandler->setSegment('projectcontacts'); foreach ($contact_arrray as $contact) @@ -946,8 +935,7 @@ class doc_generic_project_odt extends ModelePDFProjects $tmparray = $this->get_substitutionarray_project_contacts($contact, $outputlangs); foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -1084,8 +1072,7 @@ class doc_generic_project_odt extends ModelePDFProjects ); //Insert reference - try - { + try { $listlines = $odfHandler->setSegment('projectrefs'); foreach ($listofreferent as $keyref => $valueref) @@ -1147,8 +1134,7 @@ class doc_generic_project_odt extends ModelePDFProjects foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -1217,8 +1203,7 @@ class doc_generic_project_odt extends ModelePDFProjects return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 59e3f855ebf..53b81ef5419 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -301,8 +301,7 @@ class pdf_baleine extends ModelePDFProjects $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -359,15 +358,13 @@ class pdf_baleine extends ModelePDFProjects $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; $forcedesconsamepage = 1; if ($forcedesconsamepage) @@ -397,7 +394,7 @@ class pdf_baleine extends ModelePDFProjects } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -452,8 +449,7 @@ class pdf_baleine extends ModelePDFProjects { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -468,8 +464,7 @@ class pdf_baleine extends ModelePDFProjects { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -484,8 +479,7 @@ class pdf_baleine extends ModelePDFProjects // Show square if ($pagenb == 1) $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - else - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Footer of the page @@ -514,14 +508,12 @@ class pdf_baleine extends ModelePDFProjects return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); return 0; } @@ -613,8 +605,7 @@ class pdf_baleine extends ModelePDFProjects $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index 4044676461e..0888a029d5b 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -274,8 +274,7 @@ class pdf_beluga extends ModelePDFProjects $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -509,15 +508,13 @@ class pdf_beluga extends ModelePDFProjects $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; $forcedesconsamepage = 1; if ($forcedesconsamepage) @@ -547,7 +544,7 @@ class pdf_beluga extends ModelePDFProjects } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -590,8 +587,7 @@ class pdf_beluga extends ModelePDFProjects $fuser->fetch($element->fk_user_author); $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, $fuser->getFullName($outputlangs), 1, 'L'); } - else - { + else { $pdf->MultiCell($this->posxamountht - $this->posxsociety, 3, (is_object($element->thirdparty) ? $element->thirdparty->name : ''), 1, 'L'); } @@ -608,8 +604,7 @@ class pdf_beluga extends ModelePDFProjects $textforamount = dol_trunc($element->label, 26); $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, $textforamount, 1, 'L'); } - else - { + else { $pdf->MultiCell($this->posxstatut - $this->posxamountht, 3, "", 1, 'R'); } } @@ -688,14 +683,12 @@ class pdf_beluga extends ModelePDFProjects return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); return 0; } @@ -787,8 +780,7 @@ class pdf_beluga extends ModelePDFProjects $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index 2a13aa8ab57..0b0190cffd2 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -232,8 +232,7 @@ class pdf_timespent extends ModelePDFProjects $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -290,15 +289,13 @@ class pdf_timespent extends ModelePDFProjects $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; $forcedesconsamepage = 1; if ($forcedesconsamepage) @@ -328,7 +325,7 @@ class pdf_timespent extends ModelePDFProjects } //var_dump($i.' '.$posybefore.' '.$posyafter.' '.($this->page_hauteur - ($heightforfooter + $heightforfreetext + $heightforinfotot)).' '.$showpricebeforepagebreak); } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -383,8 +380,7 @@ class pdf_timespent extends ModelePDFProjects { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -399,8 +395,7 @@ class pdf_timespent extends ModelePDFProjects { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -415,8 +410,7 @@ class pdf_timespent extends ModelePDFProjects // Show square if ($pagenb == 1) $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); - else - $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); + else $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; // Pied de page @@ -445,14 +439,12 @@ class pdf_timespent extends ModelePDFProjects return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "PROJECT_OUTPUTDIR"); return 0; } @@ -544,8 +536,7 @@ class pdf_timespent extends ModelePDFProjects $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $langs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 301e226020c..9929dd357cb 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -107,8 +107,7 @@ class mod_project_simple extends ModeleNumRefProjects { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -141,8 +140,7 @@ class mod_project_simple extends ModeleNumRefProjects if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_project_simple::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 9b7b15a884d..eee9945bb8a 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -377,8 +377,7 @@ class doc_generic_task_odt extends ModelePDFTask unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -565,7 +564,7 @@ class doc_generic_task_odt extends ModelePDFTask if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -575,8 +574,7 @@ class doc_generic_task_odt extends ModelePDFTask } // Replace tags of lines for tasks - try - { + try { // Security check $socid = 0; if (!empty($project->fk_soc)) $socid = $project->fk_soc; @@ -674,8 +672,7 @@ class doc_generic_task_odt extends ModelePDFTask foreach ($tmparray as $key => $val) { - try - { + try { $listlinestasktime->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -709,8 +706,7 @@ class doc_generic_task_odt extends ModelePDFTask //dol_syslog(get_class($this).'::main $tmparray'.var_export($tmparray,true)); foreach ($tmparray as $key => $val) { - try - { + try { $listtasksfiles->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -738,8 +734,7 @@ class doc_generic_task_odt extends ModelePDFTask // Replace tags of project files - try - { + try { $listlines = $odfHandler->setSegment('projectfiles'); $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($object->ref); @@ -753,8 +748,7 @@ class doc_generic_task_odt extends ModelePDFTask foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -789,8 +783,7 @@ class doc_generic_task_odt extends ModelePDFTask } if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { - try - { + try { $listlines = $odfHandler->setSegment('projectcontacts'); foreach ($contact_arrray as $contact) @@ -813,8 +806,7 @@ class doc_generic_task_odt extends ModelePDFTask foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -875,8 +867,7 @@ class doc_generic_task_odt extends ModelePDFTask return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index cb186594b84..8a409765526 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -108,8 +108,7 @@ class mod_task_simple extends ModeleNumRefTask { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -141,8 +140,7 @@ class mod_task_simple extends ModeleNumRefTask if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_task_simple::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 33850c5d882..e0bcefbd880 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -140,8 +140,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -309,8 +308,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -343,8 +341,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } // Make substitution @@ -431,7 +428,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -442,8 +439,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -467,8 +463,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -540,8 +535,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index c285f560678..409df828876 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -173,8 +173,7 @@ class pdf_azur extends ModelePDFPropales $this->posxqty = 135; $this->posxunit = 151; } - else - { + else { $this->posxtva = 110; $this->posxup = 126; $this->posxqty = 145; @@ -245,8 +244,7 @@ class pdf_azur extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } - else - { + else { $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } @@ -270,13 +268,11 @@ class pdf_azur extends ModelePDFPropales { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -304,8 +300,7 @@ class pdf_azur extends ModelePDFPropales $dir = $conf->propal->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->propal->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -509,8 +504,7 @@ class pdf_azur extends ModelePDFPropales // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -548,18 +542,16 @@ class pdf_azur extends ModelePDFPropales $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -677,8 +669,7 @@ class pdf_azur extends ModelePDFPropales { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -693,8 +684,7 @@ class pdf_azur extends ModelePDFPropales { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -712,8 +702,7 @@ class pdf_azur extends ModelePDFPropales $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; } @@ -782,8 +771,7 @@ class pdf_azur extends ModelePDFPropales $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } } - else - { + else { if (!empty($conf->product->enabled)) { $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref); } elseif (!empty($conf->service->enabled)) { @@ -836,14 +824,12 @@ class pdf_azur extends ModelePDFPropales return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR"); return 0; } @@ -1101,8 +1087,7 @@ class pdf_azur extends ModelePDFPropales { // Nothing to do } - else - { + else { //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ @@ -1494,16 +1479,14 @@ class pdf_azur extends ModelePDFPropales $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 1af66ca645e..1490dfe4adc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -232,8 +232,7 @@ class pdf_cyan extends ModelePDFPropales $pdir[0] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; $pdir[1] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; } - else - { + else { $pdir[0] = get_exdir(0, 0, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; // default $pdir[1] = get_exdir($objphoto->id, 2, 0, 0, $objphoto, 'product').$objphoto->id."/photos/"; // alternative } @@ -257,13 +256,11 @@ class pdf_cyan extends ModelePDFPropales { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -292,8 +289,7 @@ class pdf_cyan extends ModelePDFPropales $dir = $conf->propal->multidir_output[$conf->entity]; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->propal->multidir_output[$object->entity]."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -551,8 +547,7 @@ class pdf_cyan extends ModelePDFPropales $tab_height = $tab_height - $height_note; $tab_top = $posyafter + 6; } - else - { + else { $height_note = 0; } @@ -602,8 +597,7 @@ class pdf_cyan extends ModelePDFPropales // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } @@ -644,17 +638,15 @@ class pdf_cyan extends ModelePDFPropales $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -808,8 +800,7 @@ class pdf_cyan extends ModelePDFPropales { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -824,8 +815,7 @@ class pdf_cyan extends ModelePDFPropales { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -843,8 +833,7 @@ class pdf_cyan extends ModelePDFPropales $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforsignature - $heightforfooter + 1; } @@ -913,8 +902,7 @@ class pdf_cyan extends ModelePDFPropales $filetomerge_dir = $conf->service->multidir_output[$entity_product_file].'/'.get_exdir($product->id, 2, 0, 0, $product, 'product').$product->id."/photos"; } } - else - { + else { if (!empty($conf->product->enabled)) { $filetomerge_dir = $conf->product->multidir_output[$entity_product_file].'/'.get_exdir(0, 0, 0, 0, $product, 'product').dol_sanitizeFileName($product->ref); } elseif (!empty($conf->service->enabled)) { @@ -967,14 +955,12 @@ class pdf_cyan extends ModelePDFPropales return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "PROP_OUTPUTDIR"); return 0; } @@ -1232,8 +1218,7 @@ class pdf_cyan extends ModelePDFPropales { // Nothing to do } - else - { + else { //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ @@ -1568,16 +1553,14 @@ class pdf_cyan extends ModelePDFPropales $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -2006,8 +1989,7 @@ class pdf_cyan extends ModelePDFPropales { $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys } - else - { + else { $this->cols = $hookmanager->resArray; } } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index 4dde423a5e6..d342f9d6a4a 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -109,8 +109,7 @@ class mod_propale_marbre extends ModeleNumRefPropales { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -142,8 +141,7 @@ class mod_propale_marbre extends ModeleNumRefPropales if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/rapport/pdf_paiement.class.php b/htdocs/core/modules/rapport/pdf_paiement.class.php index 103d0fdffba..4f8c8221e79 100644 --- a/htdocs/core/modules/rapport/pdf_paiement.class.php +++ b/htdocs/core/modules/rapport/pdf_paiement.class.php @@ -211,8 +211,7 @@ class pdf_paiement // If global param PAYMENTS_REPORT_GROUP_BY_MOD is set, payement are ordered by paiement_code if (!empty($conf->global->PAYMENTS_REPORT_GROUP_BY_MOD)) $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiement ASC"; - else - $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; + else $sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC"; break; case "fourn": $sql = "SELECT p.datep as dp, f.ref as ref"; @@ -245,8 +244,7 @@ class pdf_paiement // If global param PAYMENTS_FOURN_REPORT_GROUP_BY_MOD is set, payement fourn are ordered by paiement_code if (!empty($conf->global->PAYMENTS_FOURN_REPORT_GROUP_BY_MOD)) $sql .= " ORDER BY paiement_code ASC, p.datep ASC, pf.fk_paiementfourn ASC"; - else - $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; + else $sql .= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC"; break; } @@ -274,8 +272,7 @@ class pdf_paiement $i++; } } - else - { + else { dol_print_error($this->db); } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 89a532c2556..1a7076095ec 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -132,8 +132,7 @@ class doc_generic_reception_odt extends ModelePdfReception unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -272,8 +271,7 @@ class doc_generic_reception_odt extends ModelePdfReception if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -301,8 +299,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (!empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact; else $socobject = $object->thirdparty; } - else - { + else { $socobject = $object->thirdparty; } @@ -371,7 +368,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -391,7 +388,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -409,7 +406,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -431,7 +428,7 @@ class doc_generic_reception_odt extends ModelePdfReception if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -440,8 +437,7 @@ class doc_generic_reception_odt extends ModelePdfReception } } // Replace tags of lines - try - { + try { $listlines = $odfHandler->setSegment('lines'); foreach ($object->lines as $line) { @@ -513,8 +509,7 @@ class doc_generic_reception_odt extends ModelePdfReception return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index 25b7b62388f..1901a9fc044 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -149,13 +149,11 @@ class pdf_squille extends ModelePdfReception { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } } - else - { + else { $filename = $obj['photo']; } @@ -177,8 +175,7 @@ class pdf_squille extends ModelePdfReception $dir = $conf->reception->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $rcpref = dol_sanitizeFileName($object->ref); $dir = $conf->reception->dir_output."/".$rcpref; $file = $dir."/".$rcpref.".pdf"; @@ -336,8 +333,7 @@ class pdf_squille extends ModelePdfReception $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -378,8 +374,7 @@ class pdf_squille extends ModelePdfReception // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (isset($imglinesize['width']) && isset($imglinesize['height'])) @@ -419,18 +414,16 @@ class pdf_squille extends ModelePdfReception $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -512,8 +505,7 @@ class pdf_squille extends ModelePdfReception { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -527,8 +519,7 @@ class pdf_squille extends ModelePdfReception { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -545,8 +536,7 @@ class pdf_squille extends ModelePdfReception $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -578,14 +568,12 @@ class pdf_squille extends ModelePdfReception return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "EXP_OUTPUTDIR"); return 0; } @@ -822,16 +810,14 @@ class pdf_squille extends ModelePdfReception $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell($w, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell($w, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -841,8 +827,7 @@ class pdf_squille extends ModelePdfReception { $posx = 105; } - else - { + else { $posx = $this->marge_gauche + 3; } //$pdf->Rect($this->marge_gauche, $this->marge_haute, $this->page_largeur-$this->marge_gauche-$this->marge_droite, 30); diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index 66576eaab76..ee3122749a3 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -114,8 +114,7 @@ class mod_reception_beryl extends ModelNumRefReception if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog("mod_reception_beryl::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 2a7e0cf287f..cff1ae3f897 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -117,8 +117,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0, true); // Disable hook for the moment if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -250,8 +249,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -313,8 +311,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc } if ((is_array($contact_arrray) && count($contact_arrray) > 0)) { - try - { + try { $listlines = $odfHandler->setSegment('companycontacts'); foreach ($contact_arrray as $array_key => $contact_id) @@ -323,8 +320,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc $tmparray = $this->get_substitutionarray_contact($contactstatic, $outputlangs, 'contact'); foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -370,7 +366,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -439,8 +435,7 @@ class doc_generic_odt extends ModeleThirdPartyDoc return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 22ec06c8aa6..ce85de4670d 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -286,8 +286,7 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode { $result = -2; } - else - { + else { // Get Mask value $mask = ''; if ($type == 0) $mask = empty($conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER) ? '' : $conf->global->COMPANY_ELEPHANT_MASK_CUSTOMER; @@ -336,13 +335,11 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode { return 0; } - else - { + else { return -1; } } - else - { + else { return -2; } } diff --git a/htdocs/core/modules/societe/mod_codeclient_monkey.php b/htdocs/core/modules/societe/mod_codeclient_monkey.php index 15519688f98..5582e6459af 100644 --- a/htdocs/core/modules/societe/mod_codeclient_monkey.php +++ b/htdocs/core/modules/societe/mod_codeclient_monkey.php @@ -145,8 +145,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { return -1; } @@ -189,8 +188,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { $result = -2; } - else - { + else { if ($this->verif_syntax($code) >= 0) { $is_dispo = $this->verif_dispo($db, $code, $soc, $type); @@ -198,19 +196,16 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { $result = -3; } - else - { + else { $result = 0; } } - else - { + else { if (dol_strlen($code) == 0) { $result = -2; } - else - { + else { $result = -1; } } @@ -250,13 +245,11 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { return 0; } - else - { + else { return -1; } } - else - { + else { return -2; } } @@ -278,8 +271,7 @@ class mod_codeclient_monkey extends ModeleThirdPartyCode { $res = -1; } - else - { + else { $res = 0; } return $res; diff --git a/htdocs/core/modules/societe/mod_codecompta_aquarium.php b/htdocs/core/modules/societe/mod_codecompta_aquarium.php index 78b0e2fae8e..27b1572555e 100644 --- a/htdocs/core/modules/societe/mod_codecompta_aquarium.php +++ b/htdocs/core/modules/societe/mod_codecompta_aquarium.php @@ -147,8 +147,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode $codetouse = (!empty($societe->code_fournisseur) ? $societe->code_fournisseur : 'SUPPCODE'); $prefix = $this->prefixsupplieraccountancycode; } - else - { + else { $this->error = 'Bad value for parameter type'; return -1; } @@ -172,8 +171,7 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode { $this->code = $codetouse; } - else - { + else { // Pour retour $this->code = $codetouse; } @@ -211,14 +209,12 @@ class mod_codecompta_aquarium extends ModeleAccountancyCode dol_syslog("mod_codecompta_aquarium::verif code '".$code."' available"); return 1; // Dispo } - else - { + else { dol_syslog("mod_codecompta_aquarium::verif code '".$code."' not available"); return 0; // Non dispo } } - else - { + else { $this->error = $db->error()." sql=".$sql; return -1; // Erreur } diff --git a/htdocs/core/modules/societe/mod_codecompta_digitaria.php b/htdocs/core/modules/societe/mod_codecompta_digitaria.php index d97ac5df0ff..3a689b8df93 100644 --- a/htdocs/core/modules/societe/mod_codecompta_digitaria.php +++ b/htdocs/core/modules/societe/mod_codecompta_digitaria.php @@ -170,8 +170,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode $prefix = $this->prefixcustomeraccountancycode; $width = $this->customeraccountancycodecharacternumber; } - else - { + else { $this->error = 'Bad value for parameter type'; return -1; } @@ -221,8 +220,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode { return 0; // return ok } - else - { + else { return -1; // return ko } } @@ -245,8 +243,7 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode { $typethirdparty = 'code_compta'; } - else - { + else { $this->error = 'Bad value for parameter type'; return -1; } @@ -262,14 +259,12 @@ class mod_codecompta_digitaria extends ModeleAccountancyCode dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' available"); return 0; // Available } - else - { + else { dol_syslog("mod_codecompta_digitaria::checkIfAccountancyCodeIsAlreadyUsed '".$code."' not available"); return -1; // Not available } } - else - { + else { $this->error = $db->error()." sql=".$sql; return -2; // Error } diff --git a/htdocs/core/modules/societe/modules_societe.class.php b/htdocs/core/modules/societe/modules_societe.class.php index a6df7aaea20..ea10843a94a 100644 --- a/htdocs/core/modules/societe/modules_societe.class.php +++ b/htdocs/core/modules/societe/modules_societe.class.php @@ -173,8 +173,7 @@ abstract class ModeleThirdPartyCode $i++; } } - else - { + else { return -1; } return $liste; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index d5ccf5dbd89..c68d1c37642 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -141,8 +141,7 @@ class doc_generic_stock_odt extends ModelePDFStock unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -295,8 +294,7 @@ class doc_generic_stock_odt extends ModelePDFStock if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -330,8 +328,7 @@ class doc_generic_stock_odt extends ModelePDFStock $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } // Make substitution @@ -418,7 +415,7 @@ class doc_generic_stock_odt extends ModelePDFStock if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -429,8 +426,7 @@ class doc_generic_stock_odt extends ModelePDFStock } } // Replace tags of lines - try - { + try { $listlines = $odfHandler->setSegment('supplierprices'); if (!empty($object->supplierprices)) { foreach ($object->supplierprices as $supplierprice) @@ -442,8 +438,7 @@ class doc_generic_stock_odt extends ModelePDFStock $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($array_lines as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -515,8 +510,7 @@ class doc_generic_stock_odt extends ModelePDFStock return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index c50f3d2a2f8..708f06a4491 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -211,8 +211,7 @@ class pdf_standard extends ModelePDFStock $dir = $conf->stock->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->stock->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -380,18 +379,16 @@ class pdf_standard extends ModelePDFStock $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -476,8 +473,7 @@ class pdf_standard extends ModelePDFStock { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -492,8 +488,7 @@ class pdf_standard extends ModelePDFStock { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -544,8 +539,7 @@ class pdf_standard extends ModelePDFStock $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, price(price2num($totalvaluesell, 'MT'), 0, $outputlangs), 0, 'R', 0); } } - else - { + else { dol_print_error($db); } @@ -570,8 +564,7 @@ class pdf_standard extends ModelePDFStock $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -705,8 +698,7 @@ class pdf_standard extends ModelePDFStock $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -745,14 +737,12 @@ class pdf_standard extends ModelePDFStock return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "PRODUCT_OUTPUTDIR"); return 0; } @@ -913,16 +903,14 @@ class pdf_standard extends ModelePDFStock $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -965,8 +953,7 @@ class pdf_standard extends ModelePDFStock { $pdf->MultiCell(150, 3, $e->label, '', 'R'); } - else - { + else { $pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R'); } @@ -1004,8 +991,7 @@ class pdf_standard extends ModelePDFStock $obj = $db->fetch_object($resqlbis); $lastmovementdate = $db->jdate($obj->datem); } - else - { + else { dol_print_error($db); } @@ -1013,8 +999,7 @@ class pdf_standard extends ModelePDFStock { $toWrite = dol_print_date($lastmovementdate, 'dayhour').' '; } - else - { + else { $toWrite = $outputlangs->transnoentities("None"); } diff --git a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php index d0e9ba9d1e4..dcf461fd9c0 100644 --- a/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_stdmovement.modules.php @@ -286,8 +286,7 @@ class pdf_stdmovement extends ModelePDFMovement { if ($year > 0) $sql .= " AND m.datem BETWEEN '".$db->idate(dol_get_first_day($year, $month, false))."' AND '".$db->idate(dol_get_last_day($year, $month, false))."'"; - else - $sql .= " AND date_format(m.datem, '%m') = '$month'"; + else $sql .= " AND date_format(m.datem, '%m') = '$month'"; } elseif ($year > 0) { @@ -363,8 +362,7 @@ class pdf_stdmovement extends ModelePDFMovement $i = 0; $help_url = 'EN:Module_Stocks_En|FR:Module_Stock|ES:Módulo_Stocks'; if ($msid) $texte = $langs->trans('StockMovementForId', $msid); - else - { + else { $texte = $langs->trans("ListOfStockMovements"); if ($id) $texte .= ' ('.$langs->trans("ForThisWarehouse").')'; } @@ -376,8 +374,7 @@ class pdf_stdmovement extends ModelePDFMovement $dir = $conf->stock->dir_output."/movement"; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); if (!empty($search_inventorycode)) $objectref .= "_".$id."_".$search_inventorycode; if ($search_type_mouvement) $objectref .= "_".$search_type_mouvement; @@ -540,18 +537,16 @@ class pdf_stdmovement extends ModelePDFMovement $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -667,8 +662,7 @@ class pdf_stdmovement extends ModelePDFMovement { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -683,8 +677,7 @@ class pdf_stdmovement extends ModelePDFMovement { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -720,8 +713,7 @@ class pdf_stdmovement extends ModelePDFMovement $pdf->SetXY($this->postotalht, $curY); $pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->postotalht, 3, $totalunit, 0, 'R', 0); } - else - { + else { dol_print_error($db); } @@ -746,8 +738,7 @@ class pdf_stdmovement extends ModelePDFMovement $tab_height = $tab_height - $height_note; $tab_top = $nexY + 6; } - else - { + else { $height_note = 0; } @@ -763,8 +754,7 @@ class pdf_stdmovement extends ModelePDFMovement $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -803,14 +793,12 @@ class pdf_stdmovement extends ModelePDFMovement return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "PRODUCT_OUTPUTDIR"); return 0; } @@ -994,16 +982,14 @@ class pdf_stdmovement extends ModelePDFMovement $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -1046,8 +1032,7 @@ class pdf_stdmovement extends ModelePDFMovement { $pdf->MultiCell(150, 3, $e->label, '', 'R'); } - else - { + else { $pdf->MultiCell(150, 3, $outputlangs->transnoentities("None"), '', 'R'); } @@ -1085,8 +1070,7 @@ class pdf_stdmovement extends ModelePDFMovement $obj = $db->fetch_object($resqlbis); $lastmovementdate = $db->jdate($obj->datem); } - else - { + else { dol_print_error($db); } @@ -1094,8 +1078,7 @@ class pdf_stdmovement extends ModelePDFMovement { $toWrite = dol_print_date($lastmovementdate, 'dayhour').' '; } - else - { + else { $toWrite = $outputlangs->transnoentities("None"); } diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 2e3b4e177d7..551d960008a 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -234,8 +234,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $dir = $conf->fournisseur->facture->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($object->id, 2, 0, 0, $object, 'invoice_supplier').$objectref; @@ -425,17 +424,15 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -536,8 +533,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -552,8 +548,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -571,8 +566,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -615,14 +609,12 @@ class pdf_canelle extends ModelePDFSuppliersInvoices return 1; // No error } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->transnoentities("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } @@ -733,8 +725,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2, 0, $outputlangs), 0, 'R', 1); } } - else - { + else { //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 @@ -1049,8 +1040,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $i++; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1148,8 +1138,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : ".dol_print_date($object->date, "day", false, $outputlangs, true), '', 'R'); } - else - { + else { $posy += 4; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(255, 0, 0); diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index c821e6b60aa..70c20a77fb3 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -193,8 +193,7 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { return -1; } diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index d7f48915308..7be80850526 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -138,8 +138,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -239,8 +238,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $dir = $conf->fournisseur->commande->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->commande->dir_output.'/'.$objectref; @@ -274,8 +272,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -308,8 +305,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -396,7 +392,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -407,8 +403,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -432,8 +427,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -507,8 +501,7 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 657160a9a1b..b08adfcb97c 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -222,8 +222,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } - else - { + else { $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -258,8 +257,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $dir = $conf->fournisseur->commande->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->commande->dir_output.'/'.$objectref; @@ -491,8 +489,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $tab_height = $tab_height - $height_note; $tab_top = $posyafter + 6; } - else - { + else { $height_note = 0; } @@ -535,8 +532,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) @@ -574,17 +570,15 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -734,8 +728,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -750,8 +743,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, $hidetop, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -769,8 +761,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, $hidetop, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -813,14 +804,12 @@ class pdf_cornas extends ModelePDFSuppliersOrders return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } @@ -1009,8 +998,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } } - else - { + else { //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 @@ -1243,16 +1231,14 @@ class pdf_cornas extends ModelePDFSuppliersOrders $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -1296,8 +1282,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); } - else - { + else { $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(255, 0, 0); @@ -1645,8 +1630,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders { $this->cols = array_replace($this->cols, $hookmanager->resArray); // array_replace is used to preserve keys } - else - { + else { $this->cols = $hookmanager->resArray; } } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index 4a27b58f8ae..c2a6af6c05e 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -238,8 +238,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } - else - { + else { $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -274,8 +273,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $dir = $conf->fournisseur->commande->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->commande->dir_output.'/'.$objectref; @@ -447,8 +445,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) @@ -467,8 +464,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $descWidth = $this->posxpicture - $curX; } - else - { + else { $descWidth = $this->posxtva - $curX; } pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); @@ -492,17 +488,15 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -617,8 +611,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -633,8 +626,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1, $object->multicurrency_code); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1, $object->multicurrency_code); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -652,8 +644,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0, $object->multicurrency_code); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -696,14 +687,12 @@ class pdf_muscadet extends ModelePDFSuppliersOrders return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } @@ -892,8 +881,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->MultiCell($largcol2, $tab2_hl, price($object->total_localtax2), $useborder, 'R', 1); } } - else - { + else { //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ //Local tax 1 @@ -1159,16 +1147,14 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -1212,8 +1198,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("OrderDate")." : ".dol_print_date($object->date_commande, "day", false, $outputlangs, true), '', 'R'); } - else - { + else { $posy += 5; $pdf->SetXY($posx, $posy); $pdf->SetTextColor(255, 0, 0); diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index df4a60b10e2..c8129f1e491 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -117,8 +117,7 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 0ad8b391faf..060394beca6 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -231,8 +231,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $dir = $conf->fournisseur->payment->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $objectrefsupplier = dol_sanitizeFileName($object->ref_supplier); $dir = $conf->fournisseur->payment->dir_output.'/'.$objectref; @@ -360,17 +359,15 @@ class pdf_standard extends ModelePDFSuppliersPayments $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -433,8 +430,7 @@ class pdf_standard extends ModelePDFSuppliersPayments { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -449,8 +445,7 @@ class pdf_standard extends ModelePDFSuppliersPayments { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -468,8 +463,7 @@ class pdf_standard extends ModelePDFSuppliersPayments $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -506,14 +500,12 @@ class pdf_standard extends ModelePDFSuppliersPayments return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_OUTPUTDIR"); return 0; } @@ -663,16 +655,14 @@ class pdf_standard extends ModelePDFSuppliersPayments $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToModuleSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 9baa8d2dafe..4ee8ed90490 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -137,8 +137,7 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog(__METHOD__, LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index c97d2f94d63..8b0d7f108a1 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -142,8 +142,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -307,8 +306,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -338,15 +336,13 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal { $socobject = $object->contact; } - else - { + else { $socobject = $object->thirdparty; // if we have a CUSTOMER contact and we dont use it as recipient we store the contact object for later use $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -432,7 +428,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -443,8 +439,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -468,8 +463,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { $listlines->setVars($key, $val, true, 'UTF-8'); } catch (OdfException $e) @@ -541,8 +535,7 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index afaf4987e04..fd5fb653a5a 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -234,8 +234,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product').$object->lines[$i]->fk_product."/photos/"; $dir = $conf->product->dir_output.'/'.$pdir; } - else - { + else { $pdir = get_exdir(0, 2, 0, 0, $objphoto, 'product').dol_sanitizeFileName($objphoto->ref).'/'; $dir = $conf->product->dir_output.'/'.$pdir; } @@ -266,8 +265,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $dir = $conf->supplier_proposal->dir_output; $file = $dir."/SPECIMEN.pdf"; } - else - { + else { $objectref = dol_sanitizeFileName($object->ref); $dir = $conf->supplier_proposal->dir_output."/".$objectref; $file = $dir."/".$objectref.".pdf"; @@ -432,8 +430,7 @@ class pdf_aurore extends ModelePDFSupplierProposal // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } if (!empty($imglinesize['width']) && !empty($imglinesize['height'])) @@ -452,8 +449,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { $descWidth = $this->posxpicture - $curX; } - else - { + else { $descWidth = $this->posxtva - $curX; } pdf_writelinedesc($pdf, $object, $i, $outputlangs, $descWidth, 3, $curX, $curY, $hideref, $hidedesc, 1); @@ -480,17 +476,15 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->setPage($pageposafter + 1); } } - else - { + else { // We found a page break // Allows data in the first page if description is long enough to break in multiples pages if (!empty($conf->global->MAIN_PDF_DATA_ON_FIRST_PAGE)) $showpricebeforepagebreak = 1; - else - $showpricebeforepagebreak = 0; + else $showpricebeforepagebreak = 0; } } - else // No pagebreak + else // No pagebreak { $pdf->commitTransaction(); } @@ -613,8 +607,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -629,8 +622,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforfooter, 0, $outputlangs, 0, 1); } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforfooter, 0, $outputlangs, 1, 1); } $this->_pagefoot($pdf, $object, $outputlangs, 1); @@ -648,8 +640,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $this->_tableau($pdf, $tab_top, $this->page_hauteur - $tab_top - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 0, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } - else - { + else { $this->_tableau($pdf, $tab_top_newpage, $this->page_hauteur - $tab_top_newpage - $heightforinfotot - $heightforfreetext - $heightforfooter, 0, $outputlangs, 1, 0); $bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 1; } @@ -694,14 +685,12 @@ class pdf_aurore extends ModelePDFSupplierProposal return 1; // No error } - else - { + else { $this->error = $langs->trans("ErrorCanNotCreateDir", $dir); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorConstantNotDefined", "SUPPLIER_PROPOSAL_OUTPUTDIR"); return 0; } @@ -943,8 +932,7 @@ class pdf_aurore extends ModelePDFSupplierProposal { // Nothing to do } - else - { + else { //Local tax 1 before VAT //if (! empty($conf->global->FACTURE_LOCAL_TAX1_OPTION) && $conf->global->FACTURE_LOCAL_TAX1_OPTION=='localtax1on') //{ @@ -1315,16 +1303,14 @@ class pdf_aurore extends ModelePDFSupplierProposal $height = pdf_getHeightForLogo($logo); $pdf->Image($logo, $this->marge_gauche, $posy, 0, $height); // width=0 (auto) } - else - { + else { $pdf->SetTextColor(200, 0, 0); $pdf->SetFont('', 'B', $default_font_size - 2); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorLogoFileNotFound", $logo), 0, 'L'); $pdf->MultiCell(100, 3, $outputlangs->transnoentities("ErrorGoToGlobalSetup"), 0, 'L'); } } - else - { + else { $text = $this->emetteur->name; $pdf->MultiCell(100, 4, $outputlangs->convToOutputCharset($text), 0, 'L'); } @@ -1453,8 +1439,7 @@ class pdf_aurore extends ModelePDFSupplierProposal else $socname = $object->thirdparty->name; $carac_client_name = $outputlangs->convToOutputCharset($socname); } - else - { + else { $carac_client_name = $outputlangs->convToOutputCharset($object->thirdparty->name); } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index 37ba98b0058..02b1c5a6684 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -109,8 +109,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal { return true; } - else - { + else { $langs->load("errors"); $this->error = $langs->trans('ErrorNumRefModel', $max); return false; @@ -142,8 +141,7 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal if ($obj) $max = intval($obj->max); else $max = 0; } - else - { + else { dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG); return -1; } diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index dedf0844245..76869791d93 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -152,8 +152,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface print 'Failed to open log file '.($dolibarr_main_prod ?basename($logfile) : $logfile); } } - else - { + else { $logLevels = array( LOG_EMERG => 'EMERG', LOG_ALERT => 'ALERT', diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 56ca1825ab4..d2f1200cc08 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -93,8 +93,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface dol_syslog("admin/syslog: facility ".$facility); } - else - { + else { $errors[] = $langs->trans("ErrorUnknownSyslogConstant", $facility); } diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index 881ba4cb469..5c2468e29c6 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -139,8 +139,7 @@ class doc_generic_user_odt extends ModelePDFUser unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -289,8 +288,7 @@ class doc_generic_user_odt extends ModelePDFUser if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -322,8 +320,7 @@ class doc_generic_user_odt extends ModelePDFUser $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } @@ -370,7 +367,7 @@ class doc_generic_user_odt extends ModelePDFUser if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -429,8 +426,7 @@ class doc_generic_user_odt extends ModelePDFUser return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 1b1d6ba1dab..9e227a43588 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -142,8 +142,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup unset($listofdir[$key]); continue; } if (!is_dir($tmpdir)) $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); - else - { + else { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.(ods|odt)'); if (count($tmpfiles)) $listoffiles = array_merge($listoffiles, $tmpfiles); } @@ -292,8 +291,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup if ($format == '1') $format = '%Y%m%d%H%M%S'; $filename = $newfiletmp.'-'.dol_print_date(dol_now(), $format).'.'.$newfileformat; } - else - { + else { $filename = $newfiletmp.'.'.$newfileformat; } $file = $dir.'/'.$filename; @@ -325,8 +323,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $contactobject = $object->contact; } } - else - { + else { $socobject = $object->thirdparty; } // Make substitution @@ -402,14 +399,13 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $reshook = $hookmanager->executeHooks('ODTSubstitution', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key=>$value) { - try - { + try { if (preg_match('/logo$/', $key)) // Image { if (file_exists($value)) $odfHandler->setImage($key, $value); else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8'); } - else // Text + else // Text { $odfHandler->setVars($key, $value, true, 'UTF-8'); } @@ -420,8 +416,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup } } // Replace tags of lines - try - { + try { $foundtagforlines = 1; try { $listlines = $odfHandler->setSegment('lines'); @@ -445,8 +440,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $reshook = $hookmanager->executeHooks('ODTSubstitutionLine', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks foreach ($tmparray as $key => $val) { - try - { + try { if (!is_array($val)) { $listlines->setVars($key, $val, true, 'UTF-8'); } @@ -520,8 +514,7 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup return 1; // Success } - else - { + else { $this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir); return -1; } diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index 2686efa6419..959d944352b 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -87,7 +87,7 @@ elseif ($modulepart == 'bank') if (!$user->rights->banque->lire) accessforbidden(); $accessallowed = 1; } -else // ticket, holiday, expensereport, societe... +else // ticket, holiday, expensereport, societe... { $result = restrictedArea($user, $modulepart, $id, $modulepart); if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) accessforbidden(); @@ -286,8 +286,7 @@ if ($cancel) header("Location: ".$backtourl); exit; } - else - { + else { dol_print_error('', 'Cancel on photo_resize with a not supported value of modulepart='.$modulepart); exit; } @@ -347,14 +346,12 @@ if ($action == 'confirm_resize' && GETPOSTISSET("file") && GETPOSTISSET("sizex") header("Location: ".$backtourl); exit; } - else - { + else { dol_print_error('', 'confirm_resize on photo_resize without backtourl defined for modulepart='.$modulepart); exit; } } - else - { + else { setEventMessages($result, null, 'errors'); $_GET['file'] = $_POST["file"]; $action = ''; @@ -417,14 +414,12 @@ if ($action == 'confirm_crop') header("Location: ".$backtourl); exit; } - else - { + else { dol_print_error('', 'confirm_crop on photo_resize without backtourl defined for modulepart='.$modulepart); exit; } } - else - { + else { setEventMessages($result, null, 'errors'); $_GET['file'] = $_POST["file"]; $action = ''; diff --git a/htdocs/core/search.php b/htdocs/core/search.php index b82536edbd2..01c7c078214 100644 --- a/htdocs/core/search.php +++ b/htdocs/core/search.php @@ -148,7 +148,6 @@ if (!empty($_SERVER['HTTP_REFERER'])) header("Location: ".$_SERVER['HTTP_REFERER']); exit; } -else -{ +else { print 'The wrapper search.php was called without any search criteria'; } diff --git a/htdocs/core/search_page.php b/htdocs/core/search_page.php index 119d7ff9a41..5d61ccecdb3 100644 --- a/htdocs/core/search_page.php +++ b/htdocs/core/search_page.php @@ -75,8 +75,7 @@ if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile $selected = -1; $searchform .= '

'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0); } -else -{ +else { $usedbyinclude = 1; // Used into next include $showtitlebefore = GETPOST('showtitlebefore', 'int'); include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php'; diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 80a7cac7de3..960e0e57401 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -218,8 +218,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) } print ''; } -else -{ +else { print $type2label[$type]; print ''; } diff --git a/htdocs/core/tpl/admin_extrafields_view.tpl.php b/htdocs/core/tpl/admin_extrafields_view.tpl.php index 96620da28d9..4a6c7d67494 100644 --- a/htdocs/core/tpl/admin_extrafields_view.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_view.tpl.php @@ -118,8 +118,7 @@ if (is_array($extrafields->attributes[$elementtype]['type']) && count($extrafiel print ""; } } -else -{ +else { $colspan = 13; if (!empty($conf->multicompany->enabled)) $colspan++; diff --git a/htdocs/core/tpl/bloc_comment.tpl.php b/htdocs/core/tpl/bloc_comment.tpl.php index 0e9e63bff12..d20894d6a03 100644 --- a/htdocs/core/tpl/bloc_comment.tpl.php +++ b/htdocs/core/tpl/bloc_comment.tpl.php @@ -112,8 +112,7 @@ if (!empty($object->comments)) $doleditor = new DolEditor('comment_description', $comment->description, '', 80, 'dolibarr_notes', 'In', 0, true, true, ROWS_3, '100%'); print $doleditor->Create(1); } - else - { + else { print $comment->description; } print '
'; // End comment-description @@ -125,8 +124,7 @@ if (!empty($object->comments)) print ''; } - else - { + else { if ($fk_user == $user->id || $user->admin == 1) { print ''; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 7e2dc1f420e..6087ca6e906 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -52,8 +52,7 @@ if ($action == 'presend') { $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); } - else - { + else { $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); } @@ -104,8 +103,7 @@ if ($action == 'presend') { $fileparams = dol_most_recent_file($diroutput.'/'.get_exdir($object->id, 2, 0, 0, $object, $object->element).$ref, preg_quote($ref, '/').'([^\-])+'); } - else - { + else { $fileparams = dol_most_recent_file($diroutput.'/'.$ref, preg_quote($ref, '/').'[^\-]+'); } @@ -161,8 +159,7 @@ if ($action == 'presend') { $liste['thirdparty'] = $object->getFullName($outputlangs)." <".$object->email.">"; } - else - { + else { if (is_object($object->thirdparty)) { foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value) { diff --git a/htdocs/core/tpl/contacts.tpl.php b/htdocs/core/tpl/contacts.tpl.php index e9f881accd2..0c1931d480f 100644 --- a/htdocs/core/tpl/contacts.tpl.php +++ b/htdocs/core/tpl/contacts.tpl.php @@ -178,8 +178,7 @@ foreach (array('internal', 'external') as $source) { $contactlist = $objectsrc->liste_contact(-1, $source); } - else - { + else { $contactlist = $object->liste_contact(-1, $source); } diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 0d2949b4e24..efb89043b6b 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -36,8 +36,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e } $value = $datenotinstring; } - else - { + else { $value = $obj->$tmpkey; } // If field is a computed field, we make computation to get value diff --git a/htdocs/core/tpl/extrafields_list_search_input.tpl.php b/htdocs/core/tpl/extrafields_list_search_input.tpl.php index d6ebb8b919f..b3512136a10 100644 --- a/htdocs/core/tpl/extrafields_list_search_input.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_input.tpl.php @@ -39,8 +39,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e // TODO // Use showInputField in a particular manner to have input with a comparison operator, not input for a specific value date-hour-minutes } - else - { + else { // for the type as 'checkbox', 'chkbxlst', 'sellist' we should use code instead of id (example: I declare a 'chkbxlst' to have a link with dictionnairy, I have to extend it with the 'code' instead 'rowid') $morecss = ''; if (in_array($typeofextrafield, array('link', 'sellist'))) $morecss = 'maxwidth200'; diff --git a/htdocs/core/tpl/extrafields_list_search_title.tpl.php b/htdocs/core/tpl/extrafields_list_search_title.tpl.php index 9a83cbb42aa..169dd34fee1 100644 --- a/htdocs/core/tpl/extrafields_list_search_title.tpl.php +++ b/htdocs/core/tpl/extrafields_list_search_title.tpl.php @@ -27,8 +27,7 @@ if (!empty($extrafieldsobjectkey)) // $extrafieldsobject is the $object->table_e if ($extrafields->attributes[$extrafieldsobjectkey]['type'][$key] == 'separate') { print ''; } - else - { + else { $tooltip = empty($extrafields->attributes[$extrafieldsobjectkey]['help'][$key]) ? '' : $extrafields->attributes[$extrafieldsobjectkey]['help'][$key]; print getTitleFieldOfList($extrafields->attributes[$extrafieldsobjectkey]['label'][$key], 0, $_SERVER["PHP_SELF"], $sortonfield, "", $param, ($align ? 'align="'.$align.'" data-titlekey="'.$key.'"' : 'data-titlekey="'.$key.'"'), $sortfield, $sortorder, '', $disablesortlink, $tooltip)."\n"; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index 198a3910747..a7379a69d94 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -87,8 +87,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] { $value = (isset($_POST["options_".$key]) ? $_POST["options_".$key] : $object->array_options["options_".$key]); } - else - { + else { $value = $object->array_options["options_".$key]; //var_dump($key.' - '.$value); } @@ -114,8 +113,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] $lastseparatorkeyfound = $key; } - else - { + else { print ''; print ''; } -else -{ +else { print ''; print ''; print ''; @@ -178,7 +177,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg print ''; } - else // Show filtree when ajax is disabled (rare) + else // Show filtree when ajax is disabled (rare) { print ''; diff --git a/htdocs/core/tpl/list_print_total.tpl.php b/htdocs/core/tpl/list_print_total.tpl.php index 33be5fb99d1..f4f6974ac08 100644 --- a/htdocs/core/tpl/list_print_total.tpl.php +++ b/htdocs/core/tpl/list_print_total.tpl.php @@ -15,8 +15,7 @@ if (isset($totalarray['pos'])) { $i++; if (!empty($totalarray['pos'][$i])) print ''.price($totalarray['val'][$totalarray['pos'][$i]]).''; - else - { + else { if ($i == 1) { if ($num < $limit) print ''.$langs->trans("Total").''; diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index 97bece99852..e0245175768 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -254,8 +254,7 @@ if (isset($conf->file->main_authentication) && preg_match('/openid/', $conf->fil $url = $conf->global->MAIN_AUTHENTICATION_OPENID_URL; if (!empty($url)) print ''.$langs->trans("LoginUsingOpenID").''; - else - { + else { $langs->load("errors"); print ''.$langs->trans("ErrorOpenIDSetupNotComplete", 'MAIN_AUTHENTICATION_OPENID_URL').''; } diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php index 492590c65e4..c507144b151 100644 --- a/htdocs/core/tpl/massactions_pre.tpl.php +++ b/htdocs/core/tpl/massactions_pre.tpl.php @@ -99,8 +99,7 @@ if ($massaction == 'presend') $fuser->fetch($thirdpartyid); $liste['thirdparty'] = $fuser->getFullName($langs)." <".$fuser->email.">"; } - else - { + else { $soc = new Societe($db); $soc->fetch($thirdpartyid); foreach ($soc->thirdparty_and_contact_email_array(1) as $key => $value) { @@ -159,8 +158,7 @@ if ($massaction == 'presend') print ' - '.$langs->trans("GoBack").''; $arrayofmassactions = array(); } - else - { + else { print $formmail->get_form(); } diff --git a/htdocs/core/tpl/object_discounts.tpl.php b/htdocs/core/tpl/object_discounts.tpl.php index 8af029ce071..10db8476bef 100644 --- a/htdocs/core/tpl/object_discounts.tpl.php +++ b/htdocs/core/tpl/object_discounts.tpl.php @@ -43,8 +43,7 @@ if ($fixedDiscount > 0) $translationKey = (!empty($discount_type)) ? 'HasRelativeDiscountFromSupplier' : 'CompanyHasRelativeDiscount'; print $langs->trans($translationKey, $fixedDiscount).'.'; } -else -{ +else { $translationKey = (!empty($discount_type)) ? 'HasNoRelativeDiscountFromSupplier' : 'CompanyHasNoRelativeDiscount'; print $langs->trans($translationKey).'.'; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 0fb1aff011d..baa57c7d1c9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -136,8 +136,7 @@ if ($nolinesbefore) { print ''; if ($conf->global->MARGIN_TYPE == "1") echo $langs->trans('BuyingPrice'); - else - echo $langs->trans('CostPrice'); + else echo $langs->trans('CostPrice'); echo ''; if (!empty($conf->global->DISPLAY_MARGIN_RATES)) echo ''.$langs->trans('MarginRate').''; if (!empty($conf->global->DISPLAY_MARK_RATES)) echo ''.$langs->trans('MarkRate').''; @@ -187,8 +186,7 @@ if ($nolinesbefore) { echo ''; echo ' '; } - else - { + else { echo ''; // Show type selector if ($forceall >= 0) @@ -214,8 +212,7 @@ if ($nolinesbefore) { elseif ((empty($conf->product->enabled) && !empty($conf->service->enabled)) || ($object->element == 'contrat' && empty($conf->global->CONTRACT_SUPPORT_PRODUCTS))) echo $langs->trans('PredefinedServicesToSell'); else echo $langs->trans('PredefinedProductsAndServicesToSell'); } - else - { + else { if (!empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToPurchase'); elseif (empty($conf->product->enabled) && !empty($conf->service->enabled)) echo $langs->trans('PredefinedServicesToPurchase'); else echo $langs->trans('PredefinedProductsAndServicesToPurchase'); @@ -232,8 +229,7 @@ if ($nolinesbefore) { // hide products in closed warehouse, but show products for internal transfer $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array')); } - else - { + else { $form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, $statustoshow, 2, '', 1, array(), $buyer->id, '1', 0, 'maxwidth500', 0, '', GETPOST('combinations', 'array')); } if (!empty($conf->global->MAIN_AUTO_OPEN_SELECT2_ON_FOCUS_FOR_CUSTOMER_PRODUCTS)) @@ -255,8 +251,7 @@ if ($nolinesbefore) { array('remise_percent' => 'discount') // html id tags that will be edited with each ajax json response key ); @@ -449,8 +443,7 @@ if ((!empty($conf->service->enabled) || ($object->element == 'contrat')) && $dat print '   '.$langs->trans("DateEndPlanned").' '; print $form->selectDate($date_end, "date_end", $usehm, $usehm, 1, "addproduct"); } - else - { + else { print $langs->trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; print $form->selectDate($date_start, 'date_start', empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, empty($conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE) ? 0 : 1, 1, "addproduct", 1, 0); print ' '.$langs->trans('to').' '; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d316afb6966..8957021d359 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -231,8 +231,7 @@ $coldisplay++; // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$margin_rate.'%'; - else - echo '%'; + else echo '%'; $coldisplay++; } elseif (!empty($conf->global->DISPLAY_MARK_RATES)) @@ -241,8 +240,7 @@ $coldisplay++; // if credit note, dont allow to modify margin if ($line->subprice < 0) echo ''.$mark_rate.'%'; - else - echo '%'; + else echo '%'; $coldisplay++; } } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 8849020b885..34f78ae7fcc 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -111,22 +111,19 @@ if (($line->info_bits & 2) == 2) { $discount->fetch($line->fk_remise_except); print ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); } - else - { + else { print ($txt ? ' - ' : '').dol_htmlentitiesbr($line->description); } } } -else -{ +else { $format = $conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE ? 'dayhour' : 'day'; if ($line->fk_product > 0) { print $form->textwithtooltip($text, $description, 3, '', '', $i, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); } - else - { + else { $type = (!empty($line->product_type) ? $line->product_type : $line->fk_product_type); if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -178,8 +175,7 @@ if ($user->rights->fournisseur->lire && $line->fk_fournprice > 0) { print $productfourn->getNomUrl(); } - else - { + else { print $productfourn->ref_supplier; } } diff --git a/htdocs/core/tpl/resource_view.tpl.php b/htdocs/core/tpl/resource_view.tpl.php index 2680a763a59..3e92af33a4d 100644 --- a/htdocs/core/tpl/resource_view.tpl.php +++ b/htdocs/core/tpl/resource_view.tpl.php @@ -50,8 +50,7 @@ if ((array) $linked_resources && count($linked_resources) > 0) print '
'; print '
'; } - else - { + else { $class = ''; if ($linked_resource['rowid'] == GETPOST('lineid')) $class = 'highlight'; diff --git a/htdocs/core/triggers/interface_20_all_Logevents.class.php b/htdocs/core/triggers/interface_20_all_Logevents.class.php index fceb1552f0b..591939c6156 100644 --- a/htdocs/core/triggers/interface_20_all_Logevents.class.php +++ b/htdocs/core/triggers/interface_20_all_Logevents.class.php @@ -203,8 +203,7 @@ class InterfaceLogevents extends DolibarrTriggers { return 1; } - else - { + else { $error = "Failed to insert security event: ".$event->error; $this->errors[] = $error; $this->error = $error; diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index 49939277f49..46a5df282d2 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -812,8 +812,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $tmpuser->fetch($object->oldcopy->fk_user_assign); $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$tmpuser->getFullName($langs); } - else - { + else { $object->actionmsg .= "\n".$langs->transnoentities("OldUser").': '.$langs->trans("None"); } if ($object->fk_user_assign > 0) @@ -822,14 +821,13 @@ class InterfaceActionsAuto extends DolibarrTriggers $tmpuser->fetch($object->fk_user_assign); $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$tmpuser->getFullName($langs); } - else - { + else { $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$langs->trans("None"); } $object->sendtoid = 0; } // TODO Merge all previous cases into this generic one - else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ... + else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, ... { // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into c_action_trigger @@ -867,8 +865,7 @@ class InterfaceActionsAuto extends DolibarrTriggers { if (count($object->sendtoid) == 1) $contactforaction->fetch(reset($object->sendtoid)); } - else - { + else { if ($object->sendtoid > 0) $contactforaction->fetch($object->sendtoid); } // Set societeforaction. @@ -952,8 +949,7 @@ class InterfaceActionsAuto extends DolibarrTriggers $_SESSION['LAST_ACTION_CREATED'] = $ret; return 1; } - else - { + else { $this->error = "Failed to insert event : ".$actioncomm->error." ".join(',', $actioncomm->errors); $this->errors = $actioncomm->errors; diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 2135f463ca7..7740191c94b 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -143,8 +143,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $this->errors = $b->errors; return -1; } - else - { + else { return 1; } } diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index be5465c06f2..ce9e156883d 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -72,8 +72,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers $this->errors = $object->context['linkto']->errors; $return = -1; } - else - { + else { $return = 1; } @@ -90,8 +89,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers $this->errors = $object->context['unlinkoff']->errors; $return = -1; } - else - { + else { $return = 1; } @@ -110,8 +108,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; } - else - { + else { $return = 1; } @@ -133,8 +130,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers if (!empty($object->oldcopy->error)) $this->errors[] = $object->oldcopy->error; $return = -1; } - else - { + else { $return = 1; } } @@ -145,8 +141,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; } - else - { + else { $return = 1; } } @@ -165,8 +160,7 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers if (!empty($object->error)) $this->errors[] = $object->error; $return = -1; } - else - { + else { $return = 1; } diff --git a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php index 6bd33c5b2f9..b3625c09e47 100644 --- a/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php +++ b/htdocs/core/triggers/interface_50_modTicket_TicketEmail.class.php @@ -171,8 +171,7 @@ class InterfaceTicketEmail extends DolibarrTriggers $ok = 1; } - else - { + else { $this->error = $userstat->error; $this->errors = $userstat->errors; } diff --git a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php index e6c2df36ee1..303f4a523ad 100644 --- a/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php +++ b/htdocs/core/triggers/interface_80_modStripe_Stripe.class.php @@ -178,8 +178,7 @@ class InterfaceStripe extends DolibarrTriggers $customer->createTaxId($customer->id, array('type'=>'eu_vat', 'value'=>$vatcleaned)); } } - else - { + else { $taxids = $customer->allTaxIds($customer->id); if (is_array($taxids->data)) { diff --git a/htdocs/core/website.inc.php b/htdocs/core/website.inc.php index 5c618b089a3..4ac9d00ca53 100644 --- a/htdocs/core/website.inc.php +++ b/htdocs/core/website.inc.php @@ -118,8 +118,7 @@ if ($_SERVER['PHP_SELF'] != DOL_URL_ROOT.'/website/index.php') // If we browsing header("Location: ".DOL_URL_ROOT.'/public/website/index.php?website='.$websitekey.'&pageid='.$newpageid.'&l='.GETPOST('l', 'aZ09')); exit; } - else - { + else { $newpageref = $obj->pageurl; header("Location: ".$newpageref.'.php?l='.GETPOST('l', 'aZ09')); exit; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index a8bca51dda3..f20ac732fd4 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -137,8 +137,7 @@ if ($action == "setlive") if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -238,15 +237,13 @@ if (empty($conf->stripeconnect->enabled)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; } - else - { + else { print img_picto($langs->trans("inactive"), 'statut5'); } } @@ -311,22 +308,19 @@ if (empty($conf->stripeconnect->enabled)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; } - else - { + else { print img_picto($langs->trans("inactive"), 'statut5'); } } print ''; } -else -{ +else { print ''.$langs->trans("StripeConnect").''; print ''.$langs->trans("StripeConnect_Mode").''; } diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 44c7db306a2..74fa1aafc43 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -66,8 +66,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } -else -{ +else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -86,8 +85,7 @@ if (!$rowid) { $list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc)); } - else - { + else { $list = \Stripe\Charge::all($option); } @@ -184,16 +182,14 @@ if (!$rowid) { $societestatic->fetch($charge->metadata->dol_thirdparty_id); } - else - { + else { $societestatic->id = 0; } if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { $memberstatic->fetch($tmparray['MEM']); } - else - { + else { $memberstatic->id = 0; } diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 33b19384085..4b68ad72b09 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -76,8 +76,7 @@ class ActionsStripeconnect $service = 'StripeTest'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } - else - { + else { $service = 'StripeLive'; } @@ -209,8 +208,7 @@ class ActionsStripeconnect $langs->load("withdrawals"); print ''.$langs->trans("StripeConnectPay").''; } - else - { + else { print ''.$langs->trans("StripeConnectPay").''; } } diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index a72e5291f58..4a56a2a1542 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -261,8 +261,7 @@ class Stripe extends CommonObject } } } - else - { + else { dol_print_error($this->db); } @@ -499,8 +498,7 @@ class Stripe extends CommonObject } } } - else - { + else { $_SESSION["stripe_payment_intent"] = $paymentintent; } } @@ -532,8 +530,7 @@ class Stripe extends CommonObject { return $paymentintent; } - else - { + else { return null; } } @@ -675,8 +672,7 @@ class Stripe extends CommonObject dol_syslog("getSetupIntent ".(is_object($setupintent) ? $setupintent->id : ''), LOG_INFO, -1); return $setupintent; } - else - { + else { dol_syslog("getSetupIntent return error=".$error, LOG_INFO, -1); return null; } @@ -721,8 +717,7 @@ class Stripe extends CommonObject { $card = $cu->sources->retrieve($cardref); } - else - { + else { $card = \Stripe\PaymentMethod::retrieve($cardref); } } else { @@ -769,8 +764,7 @@ class Stripe extends CommonObject $this->error = 'Creation of card on Stripe has failed'; } } - else - { + else { $connect = ''; if (!empty($stripeacc)) $connect = $stripeacc.'/'; $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$cu->id; @@ -793,8 +787,7 @@ class Stripe extends CommonObject $this->error = 'Creation of card on Stripe has failed'; } } - else - { + else { $connect = ''; if (!empty($stripeacc)) $connect = $stripeacc.'/'; $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$cu->id; @@ -832,8 +825,7 @@ class Stripe extends CommonObject } } } - else - { + else { dol_print_error($this->db); } @@ -944,8 +936,7 @@ class Stripe extends CommonObject { $charge->status = 'ok'; } - else - { + else { $charge->status = 'failed'; $charge->failure_code = $stripe->code; $charge->failure_message = $stripe->error; @@ -1039,16 +1030,14 @@ class Stripe extends CommonObject $charge->status = 'ok'; $charge->id = $paymentintent->id; } - else - { + else { $charge->status = 'failed'; $charge->failure_code = $stripe->code; $charge->failure_message = $stripe->error; $charge->failure_declinecode = $stripe->declinecode; } } - else - { + else { $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); } } @@ -1061,8 +1050,7 @@ class Stripe extends CommonObject { $return->message = 'Payment retreived by card status = '.$charge->status; } - else - { + else { if ($charge->source->type == 'card') { $return->message = $charge->source->card->brand." ....".$charge->source->card->last4; } elseif ($charge->source->type == 'three_d_secure') { diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 730203245f4..1efe9a7f386 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -48,8 +48,7 @@ if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) { $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test } -else -{ +else { $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 17f2423327f..741921ac63c 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -65,8 +65,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } -else -{ +else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -115,8 +114,7 @@ if (!$rowid) { { $payout = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } - else - { + else { $payout = \Stripe\Payout::all(array("limit" => $limit)); } diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index 3829eba4d0d..eb0ce7df09e 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -66,8 +66,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); } -else -{ +else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -114,8 +113,7 @@ if (!$rowid) { { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); } - else - { + else { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 08479b95871..d911e310d90 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -134,16 +134,14 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } - else - { + else { if ($object->id > 0) { $result = $object->createFromClone($user, $socid); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -411,8 +409,7 @@ if (empty($reshook)) $error++; } } // Standard creation - else - { + else { $id = $object->create($user); } @@ -443,14 +440,12 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit(); } - else - { + else { $db->rollback(); $action = 'create'; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action = 'create'; @@ -552,8 +547,7 @@ if (empty($reshook)) $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); } - else - { + else { $idprod = GETPOST('idprod', 'int'); $price_ht = ''; $tva_tx = ''; @@ -622,8 +616,7 @@ if (empty($reshook)) $productsupplier->ref_supplier = ''; } } - else - { + else { $fksoctosearch = $object->thirdparty->id; $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist } @@ -738,8 +731,7 @@ if (empty($reshook)) { $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings } - else - { + else { $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } @@ -835,8 +827,7 @@ if (empty($reshook)) unset($_POST['date_endmonth']); unset($_POST['date_endyear']); } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); @@ -1139,8 +1130,7 @@ if ($action == 'create') if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } } - else - { + else { $cond_reglement_id = $soc->cond_reglement_supplier_id; $mode_reglement_id = $soc->mode_reglement_supplier_id; if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; @@ -1895,8 +1885,7 @@ if ($action == 'create') if ($object->statut == SupplierProposal::STATUS_VALIDATED || $object->statut == SupplierProposal::STATUS_SIGNED) { if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->supplier_proposal->send_advance) { print ''; - } else - print ''; + } else print ''; } } diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 97c0ee27e4e..42c30c333d6 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -274,8 +274,7 @@ class SupplierProposal extends CommonObject { $price = $prod->multiprices[$this->thirdparty->price_level]; } - else - { + else { $price = $prod->price; } @@ -347,21 +346,18 @@ class SupplierProposal extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $supplier_proposalligne->error; $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); return -2; } @@ -431,8 +427,7 @@ class SupplierProposal extends CommonObject { $pu = $pu_ht; } - else - { + else { $pu = $pu_ttc; } @@ -493,16 +488,14 @@ class SupplierProposal extends CommonObject return -1; } } - else - { + else { $this->error = $prod->error; $this->db->rollback(); return -1; } } } - else - { + else { $product_type = $type; } @@ -623,22 +616,19 @@ class SupplierProposal extends CommonObject $this->db->commit(); return $this->line->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->line->error; $this->db->rollback(); return -2; } } - else - { + else { $this->error = 'BadStatusOfObjectToAddLine'; return -5; } @@ -809,15 +799,13 @@ class SupplierProposal extends CommonObject $this->db->commit(); return $result; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::updateline Erreur -2 SupplierProposal en mode incompatible pour cette action"); return -2; } @@ -845,13 +833,11 @@ class SupplierProposal extends CommonObject return 1; } - else - { + else { return -1; } } - else - { + else { return -2; } } @@ -1080,15 +1066,13 @@ class SupplierProposal extends CommonObject // End call triggers } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -1099,14 +1083,12 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::create done id=".$this->id); return $this->id; } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1168,8 +1150,7 @@ class SupplierProposal extends CommonObject // TODO Change product price if multi-prices } - else - { + else { $objsoc->fetch($this->socid); } @@ -1218,8 +1199,7 @@ class SupplierProposal extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -1411,8 +1391,7 @@ class SupplierProposal extends CommonObject } $this->db->free($result); } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1427,8 +1406,7 @@ class SupplierProposal extends CommonObject $this->error = "Record Not Found"; return 0; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1464,8 +1442,7 @@ class SupplierProposal extends CommonObject { $num = $this->getNextNumRef($soc); } - else - { + else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -1539,14 +1516,12 @@ class SupplierProposal extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { dol_syslog("You don't have permission to validate supplier proposal", LOG_WARNING); return -2; } @@ -1574,8 +1549,7 @@ class SupplierProposal extends CommonObject $this->date_livraison = $date_livraison; return 1; } - else - { + else { $this->error = $this->db->error(); dol_syslog(get_class($this)."::set_date_livraison Erreur SQL"); return -1; @@ -1609,8 +1583,7 @@ class SupplierProposal extends CommonObject $this->update_price(1); return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1645,8 +1618,7 @@ class SupplierProposal extends CommonObject $this->update_price(1); return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1709,8 +1681,7 @@ class SupplierProposal extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -1783,14 +1754,12 @@ class SupplierProposal extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror(); $this->db->rollback(); @@ -1958,8 +1927,7 @@ class SupplierProposal extends CommonObject return -1; } } - else - { + else { return -1; } } @@ -2024,8 +1992,7 @@ class SupplierProposal extends CommonObject { $ga[$obj->supplier_proposalid] = $obj->ref.' ('.$obj->name.')'; } - else - { + else { $ga[$i]['id'] = $obj->supplier_proposalid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2036,8 +2003,7 @@ class SupplierProposal extends CommonObject } return $ga; } - else - { + else { dol_print_error($this->db); return -1; } @@ -2134,29 +2100,25 @@ class SupplierProposal extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return 0; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); return -1; } @@ -2210,8 +2172,7 @@ class SupplierProposal extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -2341,8 +2302,7 @@ class SupplierProposal extends CommonObject } return $response; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -2410,8 +2370,7 @@ class SupplierProposal extends CommonObject $line->total_tva = 9.8; $line->remise_percent = 50; } - else - { + else { $line->total_ht = 100; $line->total_ttc = 119.6; $line->total_tva = 19.6; @@ -2470,8 +2429,7 @@ class SupplierProposal extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; @@ -2521,14 +2479,12 @@ class SupplierProposal extends CommonObject { return $numref; } - else - { + else { $this->error = $obj->error; return ""; } } - else - { + else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("SupplierProposal")); return ""; @@ -2699,8 +2655,7 @@ class SupplierProposal extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2995,8 +2950,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -3042,8 +2996,7 @@ class SupplierProposalLine extends CommonObjectLine { return $result; } - else - { + else { $this->pa_ht = $result; } } @@ -3130,8 +3083,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -3178,8 +3130,7 @@ class SupplierProposalLine extends CommonObjectLine return 1; } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -3225,8 +3176,7 @@ class SupplierProposalLine extends CommonObjectLine { return $result; } - else - { + else { $this->pa_ht = $result; } } @@ -3301,8 +3251,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -3336,8 +3285,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index 43c9b91f563..8f606ad4f67 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -66,15 +66,13 @@ if ($action == 'addcontact' && $permissiontoedit) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -87,8 +85,7 @@ elseif ($action == 'swapstatut' && $permissiontoedit) { $result = $object->swapContactStatus(GETPOST('ligne')); } - else - { + else { dol_print_error($db); } } @@ -195,8 +192,7 @@ if ($id > 0 || !empty($ref)) // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; } - else - { + else { // Contact not found print "ErrorRecordNotFound"; } diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 3f471e28b3f..3096e6fbbdb 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -167,8 +167,7 @@ if ($object->id > 0) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index e8432ad8fe4..7a575007be2 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -163,8 +163,7 @@ if ($resql) print ''.$langs->trans("Total").''.$total.''; print "

"; } -else -{ +else { dol_print_error($db); } @@ -384,8 +383,7 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa print "

"; } } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index ded5d9ca2bf..eba1db92a94 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -359,8 +359,7 @@ if ($resql) $soc->fetch($socid); $title = $langs->trans('ListOfSupplierProposals').' - '.$soc->name; } - else - { + else { $title = $langs->trans('ListOfSupplierProposals'); } @@ -951,8 +950,7 @@ if ($resql) print $formfile->showdocuments('massfilesarea_supplier_proposal', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 7e5b6aaf531..3f09ac541d3 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -111,13 +111,11 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > } } } - else - { + else { $includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot'; } } - else - { + else { $includeconferror = 'ErrorBadFormatForConfFile'; } } diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index 2508ab56040..a33f337cc96 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -53,8 +53,7 @@ if (GETPOST('action', 'alpha') == 'set') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index 566f18ac1a4..f0410f812d9 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -147,8 +147,7 @@ if ($nbofentries > 0) } print ''; } -else -{ +else { print ''; print ''; print ''; } -else -{ +else { print ''; print '
'.img_picto_common('', 'treemenu/branchbottom.gif').''; @@ -177,8 +176,7 @@ if ($nbofentries > 0) } print '
'; print '\n"; @@ -122,8 +120,7 @@ if ($conf->receiptprinter->enabled) { { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "\n"; @@ -139,8 +136,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "\n"; @@ -176,8 +172,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P { print ''; } - else - { + else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); @@ -192,8 +187,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P { print ''; } - else - { + else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index 85406c46faa..f4e86677a1b 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -97,8 +97,7 @@ if ($action == 'set') { $db->commit(); } - else - { + else { $db->rollback(); } } elseif ($action == 'updateMask') { @@ -196,8 +195,7 @@ foreach ($dirmodels as $reldir) { print img_picto($langs->trans("Activated"), 'switch_on'); } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index 46d168ddd24..e2996ad763d 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -103,8 +103,7 @@ if (GETPOST('action', 'alpha') == 'set') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -188,8 +187,7 @@ if (!empty($conf->stock->enabled)) if (empty($conf->productbatch->enabled) || !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); } - else - { + else { if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity); } @@ -208,8 +206,7 @@ if (!empty($conf->stock->enabled)) print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled); print ' '; } - else - { + else { print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; } print ''; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index d1f59325c1f..75c40e6607e 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -65,8 +65,7 @@ if ($action == 'getProducts') { } echo json_encode($prods); } - else - { + else { echo 'Failed to load category with id='.$category; } } diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index e668b01aacb..8a752a5d3a5 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -56,8 +56,7 @@ if ($query == "cat") { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } $file = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); @@ -79,8 +78,7 @@ elseif ($query == "pro") if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); } -else -{ +else { // TODO We don't need this. Size of image must be defined on HTML page, image must NOT be resize when downloaded. // The file diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index dbc68afeaf4..94cc526434e 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -135,8 +135,7 @@ foreach ($categories as $key => $categorycursor) { $maincategories[$key] = $categorycursor; } - else - { + else { $subcategories[$key] = $categorycursor; } } @@ -858,8 +857,7 @@ if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { $menus[$r++] = array('title'=>'
'.$langs->trans("New").'
', 'action'=>'New();'); } -else -{ +else { // BAR RESTAURANT specific menu $menus[$r++] = array('title'=>'
'.$langs->trans("Place").'
', 'action'=>'Floors();'); } @@ -988,8 +986,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { //echo ''; echo ''; } - else - { + else { echo ''; } ?> @@ -1023,8 +1020,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { //echo ''; print ''; } - else - { + else { print '
'; print ''; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 16012022dc9..274e47a1185 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -57,8 +57,7 @@ if (($conf->global->TAKEPOS_PHONE_BASIC_LAYOUT == 1 && $conf->browser->layout == if ($_SESSION["takeposterminal"] == "") { if ($conf->global->TAKEPOS_NUM_TERMINALS == "1") $_SESSION["takeposterminal"] = 1; - else - { + else { header("Location: ".DOL_URL_ROOT."/takepos/index.php"); exit; } @@ -118,8 +117,7 @@ if ($invoiceid > 0) { $ret = $invoice->fetch($invoiceid); } -else -{ +else { $ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); } if ($ret > 0) @@ -143,8 +141,7 @@ if ($action == 'valid' && $user->rights->facture->creer) if ($pay == "cash") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CASH'.$_SESSION["takeposterminal"]}; // For backward compatibility elseif ($pay == "card") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CB'.$_SESSION["takeposterminal"]}; // For backward compatibility elseif ($pay == "cheque") $bankaccount = $conf->global->{'CASHDESK_ID_BANKACCOUNT_CHEQUE'.$_SESSION["takeposterminal"]}; // For backward compatibility - else - { + else { $accountname = "CASHDESK_ID_BANKACCOUNT_".$pay.$_SESSION["takeposterminal"]; $bankaccount = $conf->global->$accountname; } @@ -211,8 +208,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $conf->global->STOCK_CALCULATE_ON_BILL = $savconst; } - else - { + else { $res = $invoice->validate($user); } @@ -275,8 +271,7 @@ if (($action == "addline" || $action == "freezone") && $placeid == 0) $langs->load('errors'); dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); } - else - { + else { $placeid = $invoice->create($user); if ($placeid < 0) { @@ -421,8 +416,7 @@ if ($action == "delete") { { $db->commit(); } - else - { + else { $db->rollback(); } @@ -581,8 +575,7 @@ if ($action == "valid" || $action == "history") { $sectionwithinvoicelink .= $langs->trans('RemainToPay').': '.price($remaintopay, 1, $langs, 1, -1, -1, $conf->currency).''; } - else - { + else { if ($invoice->paye) $sectionwithinvoicelink .= ''.$langs->trans("Paid").''; else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated'); } @@ -814,14 +807,12 @@ $( document ).ready(function() { $s .= " ".img_warning($langs->trans("Late")); } } - else - { + else { $s .= '
'.$langs->trans("SubscriptionNotReceived"); if ($adh->statut > 0) $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } } - else - { + else { $s .= '
'.$langs->trans("ThirdpartyNotLinkedToMember"); } $s .= ''; @@ -968,8 +959,7 @@ if ($placeid > 0) { $htmlsupplements[$line->fk_parent_line] .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } - else - { + else { $htmlsupplements[$line->fk_parent_line] .= $line->desc; } } @@ -1019,8 +1009,7 @@ if ($placeid > 0) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); } - else - { + else { $htmlforlines .= $line->desc; } } @@ -1048,8 +1037,7 @@ if ($placeid > 0) print $htmlforlines; } } - else - { + else { print ''; } } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index b2534272ae2..f370387d72e 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -52,8 +52,7 @@ if ($invoiceid > 0) { $invoice->fetch($invoiceid); } -else -{ +else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); $obj = $db->fetch_object($resql); @@ -65,8 +64,7 @@ else { $invoiceid = 0; // Invoice does not exist yet } - else - { + else { $invoice->fetch($invoiceid); } } diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 90f0aa363dc..1cad9a9ede4 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -136,8 +136,7 @@ else { { $maincategories[$key] = $categorycursor; } - else - { + else { $subcategories[$key] = $categorycursor; } } diff --git a/htdocs/takepos/reduction.php b/htdocs/takepos/reduction.php index 7be5ee85938..4d11663ea85 100644 --- a/htdocs/takepos/reduction.php +++ b/htdocs/takepos/reduction.php @@ -52,8 +52,7 @@ if ($invoiceid > 0) { $invoice->fetch($invoiceid); } -else -{ +else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); $obj = $db->fetch_object($resql); @@ -65,8 +64,7 @@ else { $invoiceid = 0; // Invoice does not exist yet } - else - { + else { $invoice->fetch($invoiceid); } } diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index fc365ae5812..dc25fa4b44a 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -2120,8 +2120,7 @@ a.tmenuimage:hover{ content: "\f249"; }'."\n"; } - else - { + else { print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one */\n"; $url = dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic, 4))."_over.png", 1); print "div.mainmenu.".$val." {\n"; @@ -2130,8 +2129,7 @@ a.tmenuimage:hover{ } $generic++; } - else - { + else { print "div.mainmenu.".$val." {\n"; print " background-image: url(".$url.");\n"; print "}\n"; diff --git a/htdocs/theme/eldy/theme_vars.inc.php b/htdocs/theme/eldy/theme_vars.inc.php index d2a11725ecf..6a4f1ebf7e1 100644 --- a/htdocs/theme/eldy/theme_vars.inc.php +++ b/htdocs/theme/eldy/theme_vars.inc.php @@ -41,8 +41,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php p { $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); } - else - { + else { // for now we use the same configuration for all types of color blind $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index c43fa9cd7d9..a7b759cfea0 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -2148,8 +2148,7 @@ div.mainmenu.website { content: "\f249"; }'; } - else - { + else { print "/* A mainmenu entry was found but img file ".$val.".png not found (check /".$val."/img/".$val.".png), so we use a generic one. */\n"; print "/* Overwrite this definition in your own css with a different content to use your own font awesome icon. */\n"; $url = dol_buildpath($path.'/theme/'.$theme.'/img/menus/generic'.(min($generic, 4))."_over.png", 1); @@ -2159,8 +2158,7 @@ div.mainmenu.website { } $generic++; } - else - { + else { print "div.mainmenu.".$val." {\n"; print " background-image: url(".$url.");\n"; print "}\n"; diff --git a/htdocs/theme/md/theme_vars.inc.php b/htdocs/theme/md/theme_vars.inc.php index ffad2cc66b5..7d492bcae6a 100644 --- a/htdocs/theme/md/theme_vars.inc.php +++ b/htdocs/theme/md/theme_vars.inc.php @@ -37,8 +37,7 @@ if (!defined('ISLOADEDBYSTEELSHEET')) // File is run after an include of a php p { $theme_datacolor = array(array(157, 56, 191), array(0, 147, 183), array(250, 190, 30), array(221, 75, 57), array(0, 166, 90), array(140, 140, 220), array(190, 120, 120), array(190, 190, 100), array(115, 125, 150), array(100, 170, 20), array(150, 135, 125), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); } - else - { + else { // for now we use the same configuration for all types of color blind $theme_datacolor = array(array(248, 220, 1), array(9, 85, 187), array(42, 208, 255), array(0, 0, 0), array(169, 169, 169), array(253, 102, 136), array(120, 154, 190), array(146, 146, 55), array(0, 52, 251), array(196, 226, 161), array(222, 160, 41), array(85, 135, 150), array(150, 135, 80), array(150, 80, 150)); } diff --git a/htdocs/ticket/agenda.php b/htdocs/ticket/agenda.php index 2c473a9de54..2fd3b2643e0 100644 --- a/htdocs/ticket/agenda.php +++ b/htdocs/ticket/agenda.php @@ -57,8 +57,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 6e400b3eeaa..2e61ce15045 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1207,8 +1207,7 @@ if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'd } print ''."\n"; } - else - { + else { print '
'; } diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 0fb5835cb4c..f701fabc2c0 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -397,8 +397,7 @@ class ActionsTicket { $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=mark_ticket_read'; // To set as read, we use a dedicated action } - else - { + else { $urlforbutton = $_SERVER['PHP_SELF'].'?track_id='.$object->track_id.'&action=set_status&new_status='.$status; } diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 4db98cfe7ad..0f6994d6a03 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -542,8 +542,7 @@ class Ticket extends CommonObject $this->db->free($resql); return 1; } - else - { + else { return 0; } } else { @@ -1354,8 +1353,7 @@ class Ticket extends CommonObject { $sql .= " SET fk_user_assign=".$id_assign_user.", fk_statut = ".Ticket::STATUS_ASSIGNED; } - else - { + else { $sql .= " SET fk_user_assign=null, fk_statut = ".Ticket::STATUS_READ; } $sql .= " WHERE rowid = ".$this->id; @@ -2767,8 +2765,7 @@ class Ticket extends CommonObject } return $response; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -2810,8 +2807,7 @@ class Ticket extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; diff --git a/htdocs/ticket/document.php b/htdocs/ticket/document.php index d48001a680e..86f671d876b 100644 --- a/htdocs/ticket/document.php +++ b/htdocs/ticket/document.php @@ -196,8 +196,7 @@ if ($object->id) include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { accessforbidden('', 0, 1); } diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 1331e2be12e..4d1cb7a5d60 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -286,8 +286,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; } -else -{ +else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/ticket/messaging.php b/htdocs/ticket/messaging.php index 0a6c8067db5..c35b60ab42e 100644 --- a/htdocs/ticket/messaging.php +++ b/htdocs/ticket/messaging.php @@ -57,8 +57,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/ticket/stats/index.php b/htdocs/ticket/stats/index.php index b39ba0fd366..e6760ba9c4d 100644 --- a/htdocs/ticket/stats/index.php +++ b/htdocs/ticket/stats/index.php @@ -85,8 +85,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenamenb = $dir.'/ticketsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filenamenb = $dir.'/ticketsnbinyear-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsnbinyear-'.$year.'.png'; } @@ -126,8 +125,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenameamount = $dir.'/ticketsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filenameamount = $dir.'/ticketsamountinyear-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsamountinyear-'.$year.'.png'; } @@ -165,8 +163,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ticketsaverage-'.$user->id.'-'.$year.'.png'; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filename_avg = $dir.'/ticketsaverage-'.$year.'.png'; $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=ticketstats&file=ticketsaverage-'.$year.'.png'; } diff --git a/htdocs/user/bank.php b/htdocs/user/bank.php index 3bdc6b5390c..a02e2c17ec6 100644 --- a/htdocs/user/bank.php +++ b/htdocs/user/bank.php @@ -72,8 +72,7 @@ if (!$bankid) { $account->fetch(0, '', $id); } -else -{ +else { $account->fetch($bankid); } if (empty($account->userid)) $account->userid = $object->id; @@ -107,8 +106,7 @@ if ($action == 'add' && !$cancel) setEventMessages($account->error, $account->errors, 'errors'); $action = 'edit'; // Force chargement page edition } - else - { + else { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); $action = ''; } @@ -138,8 +136,7 @@ if ($action == 'update' && !$cancel) setEventMessages($account->error, $account->errors, 'errors'); $action = 'edit'; // Force chargement page edition } - else - { + else { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); $action = ''; } @@ -284,8 +281,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco if ($num <= 0) print '
'.img_picto_common('', 'treemenu/branchbottom.gif').''; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 83b31569a7b..7ed4f2786b2 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -58,8 +58,7 @@ if (GETPOST('action', 'alpha') == 'set') $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -105,8 +104,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") { print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'.$langs->trans("Empty").'
'.$langs->trans("None").''; print "
"; } - else - { + else { dol_print_error($db); } } @@ -340,8 +336,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco if ($num <= 0) print '
'.$langs->trans("None").''; print "
"; } - else - { + else { dol_print_error($db); } } @@ -395,8 +390,7 @@ if ($action != 'edit' && $action != 'create') // If not bank account yet, $acco if ($num <= 0) print ''.$langs->trans("None").''; print ""; } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index cd115dbe292..3e7b36e5189 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -295,8 +295,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } - else - { + else { $langs->load("errors"); $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); @@ -326,8 +325,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -429,13 +427,11 @@ if (empty($reshook)) { { $object->entity = 1; // all users in master entity } - else - { + else { $object->entity = (!GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } } - else - { + else { $object->entity = (!GETPOST('entity', 'int') ? 0 : GETPOST('entity', 'int')); } @@ -455,8 +451,7 @@ if (empty($reshook)) { { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorBadImageFormat"), null, 'errors'); @@ -472,8 +467,7 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorLoginAlreadyExists", $object->login), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -565,8 +559,7 @@ if (empty($reshook)) { } } } - else - { + else { if ($caneditpassword) // Case we can edit only password { dol_syslog("Not allowed to change fields, only password"); @@ -603,13 +596,11 @@ if (empty($reshook)) { { setEventMessages($langs->trans("PasswordChangedAndSentTo", $object->email), null, 'mesgs'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($langs->trans("PasswordChangedTo", $newpassword), null, 'warnings'); } } @@ -666,8 +657,7 @@ if (empty($reshook)) { } } } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } @@ -765,13 +755,11 @@ if ($action == 'create' || $action == 'adduserldap') $liste[$key] = $label; } } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } @@ -822,8 +810,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_lastname; } - else - { + else { print ''; } print ''; @@ -836,8 +823,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_firstname; } - else - { + else { print ''; } print ''; @@ -855,8 +841,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_loginsmb; } - else - { + else { print ''; } print ''; @@ -887,8 +872,7 @@ if ($action == 'create' || $action == 'adduserldap') $valuetoshow .= ($valuetoshow ? ', ' : '').''; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } - else - { + else { // We do not use a field password but a field text to show new password to use. $valuetoshow .= ($valuetoshow ? ', ' : '').''; } @@ -914,8 +898,7 @@ if ($action == 'create' || $action == 'adduserldap') print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); print ''; } - else - { + else { // PARTIAL WORKAROUND $generated_fake_api_key = getRandomPassword(false); print ''; @@ -1060,8 +1043,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_phone; } - else - { + else { print ''; } print ''; @@ -1074,8 +1056,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_mobile; } - else - { + else { print ''; } print ''; @@ -1088,8 +1069,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_fax; } - else - { + else { print ''; } print ''; @@ -1102,8 +1082,7 @@ if ($action == 'create' || $action == 'adduserldap') print ''; print $ldap_mail; } - else - { + else { print ''; } print ''; @@ -1237,8 +1216,7 @@ if ($action == 'create' || $action == 'adduserldap') print "".$mc->select_entities($conf->entity); print "\n"; } - else - { + else { print ''; } } @@ -1358,8 +1336,7 @@ if ($action == 'create' || $action == 'adduserldap') print ""; } -else -{ +else { /* ************************************************************************** */ /* */ /* View and edition */ @@ -1411,8 +1388,7 @@ else } } } - else - { + else { $userDisabled = 1; $statutUACF = "ACCOUNTDISABLE"; } @@ -1430,8 +1406,7 @@ else $title = $langs->trans("Employee"); $linkback = ''.$langs->trans("BackToList").''; } - else - { + else { $title = $langs->trans("User"); $linkback = ''; @@ -1503,8 +1478,7 @@ else { print ''.$langs->trans("LoginAccountDisableInDolibarr").''; } - else - { + else { print ''.$object->login.''; } print ''."\n"; @@ -1530,13 +1504,11 @@ else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''.$langs->trans("LdapUacf_".$statutUACF, $ldap->domainFQDN).''; } - else - { + else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP"); } } - else - { + else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("PasswordOfUserInLDAP"); } } @@ -1547,8 +1519,7 @@ else if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { if ($object->pass) $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); - else - { + else { if ($user->admin) $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$langs->trans("Crypted").': '.$object->pass_indatabase_crypted; else $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''.$langs->trans("Hidden").''; } @@ -1582,8 +1553,7 @@ else { print $form->textwithpicto(yn($object->admin), $langs->trans("AdministratorDesc"), 1, "admin"); } - else - { + else { print yn($object->admin); } print ''."\n"; @@ -1826,8 +1796,7 @@ else $societe->fetch($object->socid); print $societe->getNomUrl(1, ''); } - else - { + else { print $langs->trans("ThisUserIsNot"); } if (!empty($object->contactid)) @@ -1855,8 +1824,7 @@ else $adh->ref = $adh->getFullname($langs); // Force to show login instead of id print $adh->getNomUrl(1); } - else - { + else { print $langs->trans("UserNotLinkedToMember"); } print ''; @@ -1894,8 +1862,7 @@ else $langs->load("mails"); print ''; } - else - { + else { $langs->load("mails"); print ''; } @@ -1907,8 +1874,7 @@ else { print ''; } - else - { + else { print ''; } } @@ -1955,8 +1921,7 @@ else { print ''; } - else - { + else { if ($user->id == $id) { print ''; @@ -1970,8 +1935,7 @@ else { print ''; } - else - { + else { print ''; } } @@ -2055,8 +2019,7 @@ else { print $group->getNomUrl(1); } - else - { + else { print img_object($langs->trans("ShowGroup"), "group").' '.$group->name; } print ''; @@ -2067,15 +2030,13 @@ else print img_picto($langs->trans("RemoveFromGroup"), 'unlink'); print ''; } - else - { + else { print " "; } print "\n"; } } - else - { + else { print ''.$langs->trans("None").''; } @@ -2123,8 +2084,7 @@ else { print ''; } - else - { + else { print ''; print $object->lastname; } @@ -2138,8 +2098,7 @@ else { print ''; } - else - { + else { print ''; print $object->firstname; } @@ -2152,8 +2111,7 @@ else { print ''; } - else - { + else { print ''; print $object->login; } @@ -2178,8 +2136,7 @@ else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; } - else - { + else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); } } @@ -2214,8 +2171,7 @@ else print ' ('.$langs->trans("ExternalUser").')'; print ''; } - else - { + else { print ''; $nbAdmin = $user->getNbOfUsers('active', '', 1); $nbSuperAdmin = $user->getNbOfUsers('active', 'superadmin', 1); @@ -2276,8 +2232,7 @@ else print ' '.$langs->trans("SuperAdministrator"); } } - else - { + else { $yn = yn($object->admin); print ''; print ''; @@ -2298,8 +2253,7 @@ else print $form->textwithpicto($type, $langs->trans("InternalExternalDesc")); if ($object->ldap_sid) print ' ('.$langs->trans("DomainUser").')'; } - else - { + else { // Select mode $type = 0; if ($object->contactid) $type = $object->contactid; @@ -2351,8 +2305,7 @@ else { print $form->select_dolusers($object->fk_user, 'fk_user', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); } - else - { + else { print ''; $huser = new User($db); $huser->fetch($object->fk_user); @@ -2371,8 +2324,7 @@ else { print $form->select_dolusers($object->fk_user_expense_validator, 'fk_user_expense_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); } - else - { + else { print ''; $evuser = new User($db); $evuser->fetch($object->fk_user_expense_validator); @@ -2391,8 +2343,7 @@ else { print $form->select_dolusers($object->fk_user_holiday_validator, 'fk_user_holiday_validator', 1, array($object->id), 0, '', 0, $object->entity, 0, 0, '', 0, '', 'maxwidth300'); } - else - { + else { print ''; $hvuser = new User($db); $hvuser->fetch($object->fk_user_holiday_validator); @@ -2461,8 +2412,7 @@ else { print ''; } - else - { + else { print ''; print $object->office_phone; } @@ -2475,8 +2425,7 @@ else { print ''; } - else - { + else { print ''; print $object->user_mobile; } @@ -2489,8 +2438,7 @@ else { print ''; } - else - { + else { print ''; print $object->office_fax; } @@ -2503,8 +2451,7 @@ else { print ''; } - else - { + else { print ''; print $object->email; } @@ -2538,8 +2485,7 @@ else { print ''; } - else - { + else { print ''; print $object->openid; } @@ -2558,8 +2504,7 @@ else { print ''; } - else - { + else { print ''; print $object->accountancy_code; } @@ -2632,8 +2577,7 @@ else print ' / '.img_object($langs->trans("ShowContact"), 'contact').' '.dol_trunc($contact->getFullName($langs), 32).''; } } - else - { + else { print $langs->trans("ThisUserIsNot"); } print ' ('.$langs->trans("UseTypeFieldToChange").')'; @@ -2654,8 +2598,7 @@ else $adh->ref = $adh->login; // Force to show login instead of id print $adh->getNomUrl(1); } - else - { + else { print $langs->trans("UserNotLinkedToMember"); } print ''; @@ -2675,8 +2618,7 @@ else print "".$mc->select_entities($object->entity, 'entity', '', 0, 1, false, false, 1); // last parameter 1 means, show also a choice 0=>'all entities' print "\n"; } - else - { + else { print ''; } } @@ -2705,8 +2647,7 @@ else $doleditor = new DolEditor('signature', $object->signature, '', 138, 'dolibarr_notes', 'In', false, true, empty($conf->global->FCKEDITOR_ENABLE_USERSIGN) ? 0 : 1, ROWS_4, '90%'); print $doleditor->Create(1); } - else - { + else { print dol_htmlentitiesbr($object->signature); } print ''; @@ -2733,8 +2674,7 @@ else { print ''; } - else - { + else { print ''; print $object->job; } diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 46022d066f3..54681974e04 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -289,8 +289,7 @@ class Users extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->useraccount->error); } } @@ -364,8 +363,7 @@ class Users extends DolibarrApi { $entity = (!empty($entity) ? $entity : $conf->entity); } - else - { + else { // When using API, action is done on entity of logged user because a user of entity X with permission to create user should not be able to // hack the security by giving himself permissions on another entity. $entity = (DolibarrApiAccess::$user->entity > 0 ? DolibarrApiAccess::$user->entity : $conf->entity); diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 11d0cec3654..a4daebe3b9a 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -295,17 +295,15 @@ class User extends CommonObject { $sql .= " WHERE u.entity IN (0,".$conf->entity.")"; } - else - { + else { $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database } } - else // The fetch was forced on an entity + else // The fetch was forced on an entity { if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $sql .= " WHERE u.entity IS NOT NULL"; // multicompany is on in transverse mode or user making fetch is on entity 0, so user is allowed to fetch anywhere into database - else - $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter + else $sql .= " WHERE u.entity IN (0, ".(($entity != '' && $entity >= 0) ? $entity : $conf->entity).")"; // search in entity provided in parameter } if ($sid) // permet une recherche du user par son SID ActiveDirectory ou Samba @@ -320,8 +318,7 @@ class User extends CommonObject { $sql .= " AND u.email = '".$this->db->escape($email)."'"; } - else - { + else { $sql .= " AND u.rowid = ".$id; } $sql .= " ORDER BY u.entity ASC"; // Avoid random result when there is 2 login in 2 different entities @@ -420,8 +417,7 @@ class User extends CommonObject $this->db->free($result); } - else - { + else { $this->error = "USERNOTFOUND"; dol_syslog(get_class($this)."::fetch user not found", LOG_DEBUG); @@ -429,8 +425,7 @@ class User extends CommonObject return 0; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -457,8 +452,7 @@ class User extends CommonObject } $this->db->free($resql); } - else - { + else { $this->error = $this->db->lasterror(); return -2; } @@ -525,8 +519,7 @@ class User extends CommonObject return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -592,8 +585,7 @@ class User extends CommonObject { $whereforadd = 'allmodules'; } - else - { + else { $whereforadd = "module='".$this->db->escape($allmodule)."'"; if (!empty($allperms)) $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; } @@ -629,8 +621,7 @@ class User extends CommonObject $i++; } } - else - { + else { $error++; dol_print_error($this->db); } @@ -713,8 +704,7 @@ class User extends CommonObject { $wherefordel = 'allmodules'; } - else - { + else { $wherefordel = "module='".$this->db->escape($allmodule)."'"; if (!empty($allperms)) $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; } @@ -750,8 +740,7 @@ class User extends CommonObject $i++; } } - else - { + else { $error++; dol_print_error($this->db); } @@ -833,8 +822,7 @@ class User extends CommonObject { $sql .= " AND r.entity IN (0,".(!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) ? "1," : "").$conf->entity.")"; } - else - { + else { $sql .= " AND ur.entity = ".$conf->entity; } $sql .= " AND ur.fk_user= ".$this->id; @@ -866,8 +854,7 @@ class User extends CommonObject if (empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } - else - { + else { if (empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } @@ -892,8 +879,7 @@ class User extends CommonObject $sql .= " AND r.entity = ".$conf->entity; } } - else - { + else { $sql .= " AND gr.entity = ".$conf->entity; $sql .= " AND gu.entity = ".$conf->entity; $sql .= " AND r.entity = ".$conf->entity; @@ -926,8 +912,7 @@ class User extends CommonObject if (empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } - else - { + else { if (empty($this->rights->$module->$perms)) $this->nb_rights++; // if we have already define a subperm like this $this->rights->$module->level1->level2 with llx_user_rights, we don't want override level1 because the level2 can be not define on user group if (!is_object($this->rights->$module->$perms)) $this->rights->$module->$perms = 1; @@ -948,8 +933,7 @@ class User extends CommonObject // que les droits sont en cache (car tous charges) pour cet instance de user $this->all_permissions_are_loaded = 1; } - else - { + else { // If module defined, we flag it as loaded into cache $this->_tab_loaded[$moduletag] = 1; } @@ -993,8 +977,7 @@ class User extends CommonObject $this->db->rollback(); return -$error; } - else - { + else { $this->db->commit(); return 1; } @@ -1133,8 +1116,7 @@ class User extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1200,8 +1182,7 @@ class User extends CommonObject $this->db->rollback(); return -6; } - else - { + else { $sql = "INSERT INTO ".MAIN_DB_PREFIX."user (datec,login,ldap_sid,entity)"; $sql .= " VALUES('".$this->db->idate($this->datec)."','".$this->db->escape($this->login)."','".$this->db->escape($this->ldap_sid)."',".$this->db->escape($this->entity).")"; $result = $this->db->query($sql); @@ -1253,24 +1234,21 @@ class User extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { //$this->error=$interface->error; dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1339,16 +1317,14 @@ class User extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } } - else - { + else { // $this->error deja positionne dol_syslog(get_class($this)."::create_from_contact - 0"); @@ -1424,8 +1400,7 @@ class User extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -1439,8 +1414,7 @@ class User extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { // $this->error deja positionne $this->db->rollback(); return -2; @@ -1752,8 +1726,7 @@ class User extends CommonObject $error++; } } - else - { + else { $this->error = $tmpobj->error; $this->errors = $tmpobj->errors; $error++; @@ -1786,15 +1759,13 @@ class User extends CommonObject $this->db->commit(); return $nbrowsaffected; } - else - { + else { dol_syslog(get_class($this)."::update error=".$this->error, LOG_ERR); $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -1827,8 +1798,7 @@ class User extends CommonObject $this->datelastlogin = $now; return 1; } - else - { + else { $this->error = $this->db->lasterror().' sql='.$sql; return -1; } @@ -1877,8 +1847,7 @@ class User extends CommonObject { $sql .= ", pass = null"; } - else - { + else { $sql .= ", pass = '".$this->db->escape($password)."'"; } $sql .= " WHERE rowid = ".$this->id; @@ -1912,8 +1881,7 @@ class User extends CommonObject $error++; } } - else - { + else { $this->error = $adh->error; $error++; } @@ -1932,21 +1900,18 @@ class User extends CommonObject $this->db->commit(); return $this->pass; } - else - { + else { $this->db->rollback(); return 0; } } - else - { + else { $this->db->rollback(); dol_print_error($this->db); return -1; } } - else - { + else { // We store clear password in password temporary field. // After receiving confirmation link, we will crypt it and store it in pass_crypted $sql = "UPDATE ".MAIN_DB_PREFIX."user"; @@ -1959,8 +1924,7 @@ class User extends CommonObject { return $password; } - else - { + else { dol_print_error($this->db); return -3; } @@ -2001,8 +1965,7 @@ class User extends CommonObject if ($this->conf->MAIN_LANG_DEFAULT) { $outputlangs->setDefaultLang($this->conf->MAIN_LANG_DEFAULT); } - else - { // If user has not defined its own language, we used current language + else { // If user has not defined its own language, we used current language $outputlangs = $langs; } @@ -2033,8 +1996,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } - else - { + else { $url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword&username='.urlencode($this->login)."&passwordhash=".dol_hash($password); $mesg .= $outputlangs->transnoentitiesnoconv("RequestToResetPasswordReceived")."\n"; @@ -2072,8 +2034,7 @@ class User extends CommonObject { return 1; } - else - { + else { $langs->trans("errors"); $this->error = $langs->trans("ErrorFailedToSendPassword").' '.$mailfile->error; return -1; @@ -2122,8 +2083,7 @@ class User extends CommonObject $this->db->free($resql); return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2161,8 +2121,7 @@ class User extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -2217,15 +2176,13 @@ class User extends CommonObject $this->db->commit(); return 1; } - else - { + else { dol_syslog(get_class($this)."::SetInGroup ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -2274,15 +2231,13 @@ class User extends CommonObject $this->db->commit(); return 1; } - else - { + else { dol_syslog(get_class($this)."::RemoveFromGroup ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -2774,8 +2729,7 @@ class User extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -2802,8 +2756,7 @@ class User extends CommonObject $this->db->free($resql); return $nb; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2828,8 +2781,7 @@ class User extends CommonObject $sql .= " WHERE entity = 0"; if ($admin >= 0) $sql .= " AND admin = ".$admin; } - else - { + else { $sql .= " WHERE entity IN (".getEntity('user', 0).")"; if ($limitTo == 'active') $sql .= " AND statut = 1"; if ($admin >= 0) $sql .= " AND admin = ".$admin; @@ -2844,8 +2796,7 @@ class User extends CommonObject $this->db->free($resql); return $nb; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -2917,8 +2868,7 @@ class User extends CommonObject } return $users; } - else - { + else { dol_print_error($this->db); return -1; } @@ -2952,8 +2902,7 @@ class User extends CommonObject } return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -3023,8 +2972,7 @@ class User extends CommonObject $i++; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -3083,8 +3031,7 @@ class User extends CommonObject { $childids = $this->cache_childids[$this->id]; } - else - { + else { // Init this->users $this->get_full_tree(); @@ -3196,8 +3143,7 @@ class User extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -3228,8 +3174,7 @@ class User extends CommonObject { $modele = $conf->global->USER_ADDON_PDF; } - else - { + else { $modele = 'bluesky'; } } @@ -3272,8 +3217,7 @@ class User extends CommonObject } return $user_property; } - else - { + else { dol_print_error($this->db); } } @@ -3310,13 +3254,11 @@ class User extends CommonObject $sql .= " OR t.entity = 0)"; // Show always superadmin } } - else - { + else { $sql .= " WHERE t.entity IN (".getEntity('user').")"; } } - else - { + else { $sql .= " WHERE 1"; } @@ -3365,8 +3307,7 @@ class User extends CommonObject } return $num; } - else - { + else { $this->errors[] = $this->db->lasterror(); return -1; } diff --git a/htdocs/user/class/userbankaccount.class.php b/htdocs/user/class/userbankaccount.class.php index 79df9d287ec..02a046a60ad 100644 --- a/htdocs/user/class/userbankaccount.class.php +++ b/htdocs/user/class/userbankaccount.class.php @@ -105,8 +105,7 @@ class UserBankAccount extends Account return $this->update($user); } } - else - { + else { print $this->db->error(); return 0; } @@ -142,8 +141,7 @@ class UserBankAccount extends Account if (trim($this->label) != '') $sql .= ",label = '".$this->db->escape($this->label)."'"; - else - $sql .= ",label = NULL"; + else $sql .= ",label = NULL"; $sql .= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); @@ -151,8 +149,7 @@ class UserBankAccount extends Account { return 1; } - else - { + else { dol_print_error($this->db); return 0; } @@ -204,8 +201,7 @@ class UserBankAccount extends Account return 1; } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index bc5396e9f51..f56358963c9 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -155,8 +155,7 @@ class UserGroup extends CommonObject { $result = $this->fetchCommon(0, '', ' AND nom = \''.$this->db->escape($groupname).'\''); } - else - { + else { $result = $this->fetchCommon($id); } @@ -171,8 +170,7 @@ class UserGroup extends CommonObject return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -201,8 +199,7 @@ class UserGroup extends CommonObject { $sql .= " AND g.entity IS NOT NULL"; } - else - { + else { $sql .= " AND g.entity IN (0,".$conf->entity.")"; } $sql .= " ORDER BY g.nom"; @@ -227,8 +224,7 @@ class UserGroup extends CommonObject return $ret; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -258,8 +254,7 @@ class UserGroup extends CommonObject { $sql .= " AND u.entity IS NOT NULL"; } - else - { + else { $sql .= " AND u.entity IN (0,".$conf->entity.")"; } if (!empty($excludefilter)) $sql .= ' AND ('.$excludefilter.')'; @@ -290,8 +285,7 @@ class UserGroup extends CommonObject return $ret; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -357,8 +351,7 @@ class UserGroup extends CommonObject { $whereforadd = 'allmodules'; } - else - { + else { $whereforadd = "module='".$this->db->escape($allmodule)."'"; if (!empty($allperms)) $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; } @@ -394,8 +387,7 @@ class UserGroup extends CommonObject $i++; } } - else - { + else { $error++; dol_print_error($this->db); } @@ -481,8 +473,7 @@ class UserGroup extends CommonObject { $wherefordel = 'allmodules'; } - else - { + else { $wherefordel = "module='".$this->db->escape($allmodule)."'"; if (!empty($allperms)) $whereforadd .= " AND perms='".$this->db->escape($allperms)."'"; } @@ -518,8 +509,7 @@ class UserGroup extends CommonObject $i++; } } - else - { + else { $error++; dol_print_error($this->db); } @@ -605,8 +595,7 @@ class UserGroup extends CommonObject if (empty($this->rights->$module->$perms->$subperms)) $this->nb_rights++; $this->rights->$module->$perms->$subperms = 1; } - else - { + else { if (empty($this->rights->$module->$perms)) $this->nb_rights++; $this->rights->$module->$perms = 1; } @@ -623,8 +612,7 @@ class UserGroup extends CommonObject // que les droits sont en cache (car tous charges) pour cet instance de group $this->all_permissions_are_loaded = 1; } - else - { + else { // If module defined, we flag it as loaded into cache $this->_tab_loaded[$moduletag] = 1; } @@ -902,8 +890,7 @@ class UserGroup extends CommonObject { $modele = $conf->global->USERGROUP_ADDON_PDF; } - else - { + else { $modele = 'grass'; } } diff --git a/htdocs/user/clicktodial.php b/htdocs/user/clicktodial.php index c81e4068558..302e0729bb8 100644 --- a/htdocs/user/clicktodial.php +++ b/htdocs/user/clicktodial.php @@ -122,8 +122,7 @@ if ($id > 0) $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } - else - { + else { print '     '.$form->textwithpicto($langs->trans("KeepEmptyToUseDefault").': '.$conf->global->CLICKTODIAL_URL, $langs->trans("ClickToDialUrlDesc")); } print ''; @@ -147,7 +146,7 @@ if ($id > 0) print ''; } - else // View mode + else // View mode { print ''; @@ -162,8 +161,7 @@ if ($id > 0) $langs->load("errors"); print ''.$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("ClickToDial")).''; } - else - { + else { print $form->textwithpicto((empty($object->clicktodial_url) ? $langs->trans("DefaultLink").': ' : '').$url, $langs->trans("ClickToDialUrlDesc")); } print ''; diff --git a/htdocs/user/document.php b/htdocs/user/document.php index 2b8c67d7ae6..912675dd636 100644 --- a/htdocs/user/document.php +++ b/htdocs/user/document.php @@ -172,8 +172,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { accessforbidden('', 0, 1); } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 1cd3b3edc37..524fc25b51a 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -115,8 +115,7 @@ if (empty($reshook)) { header("Location: ".DOL_URL_ROOT."/user/group/list.php?restore_lastsearch_values=1"); exit; } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } @@ -153,8 +152,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { $db->rollback(); $langs->load("errors"); @@ -163,8 +161,7 @@ if (empty($reshook)) { } } } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } @@ -190,14 +187,12 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { setEventMessages($edituser->error, $edituser->errors, 'errors'); } } } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'errors'); } @@ -232,14 +227,12 @@ if (empty($reshook)) { setEventMessages($langs->trans("GroupModified"), null, 'mesgs'); $db->commit(); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorForbidden'), null, 'mesgs'); } @@ -287,8 +280,7 @@ if ($action == 'create') print "\n"; } - else - { + else { print ''; } } @@ -318,8 +310,7 @@ if ($action == 'create') /* Visu et edition */ /* */ /* ************************************************************************** */ -else -{ +else { if ($id) { $res = $object->fetch_optionals(); @@ -488,15 +479,13 @@ else print img_picto($langs->trans("RemoveFromGroup"), 'unlink'); print ''; } - else - { + else { print "-"; } print "\n"; } } - else - { + else { print ''; } print "
".$mc->select_entities($conf->entity); print "
'.$langs->trans("None").'
"; @@ -557,8 +546,7 @@ else print "".$mc->select_entities($object->entity); print "\n"; } - else - { + else { print ''; } } diff --git a/htdocs/user/group/ldap.php b/htdocs/user/group/ldap.php index 5462167b4af..b72fc7718f9 100644 --- a/htdocs/user/group/ldap.php +++ b/htdocs/user/group/ldap.php @@ -84,8 +84,7 @@ if ($action == 'dolibarr2ldap') { setEventMessages($langs->trans("GroupSynchronized"), null, 'mesgs'); } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } } @@ -196,20 +195,17 @@ if ($result > 0) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; } - else - { + else { $result = show_ldap_content($records, 0, $records['count'], true); } } - else - { + else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } $ldap->unbind(); $ldap->close(); } -else -{ +else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 1701d2ae9c1..48c56a20218 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -117,8 +117,7 @@ if (!empty($conf->multicompany->enabled) && $conf->entity == 1 && ($conf->global { $sql .= " WHERE g.entity IS NOT NULL"; } -else -{ +else { $sql .= " WHERE g.entity IN (0,".$conf->entity.")"; } if (!empty($search_group)) natural_search(array("g.nom", "g.note"), $search_group); @@ -222,8 +221,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/user/group/perms.php b/htdocs/user/group/perms.php index 70030dbf1af..8c8a59fa536 100644 --- a/htdocs/user/group/perms.php +++ b/htdocs/user/group/perms.php @@ -189,8 +189,7 @@ if ($object->id > 0) } $db->free($result); } - else - { + else { dol_print_error($db); } @@ -325,8 +324,7 @@ if ($object->id > 0) print img_picto($langs->trans("Active"), 'tick'); print ''; } - else - { + else { // Do not own permission if ($caneditperms) { @@ -335,8 +333,7 @@ if ($object->id > 0) print ' '; } } - else - { + else { // Do not own permission if ($caneditperms) { diff --git a/htdocs/user/hierarchy.php b/htdocs/user/hierarchy.php index 3a05bb3d640..520821ad84f 100644 --- a/htdocs/user/hierarchy.php +++ b/htdocs/user/hierarchy.php @@ -80,8 +80,7 @@ if (!is_array($user_arbo) && $user_arbo < 0) { setEventMessages($userstatic->error, $userstatic->errors, 'warnings'); } -else -{ +else { // Define fulltree array $fulltree = $user_arbo; //var_dump($fulltree); @@ -113,8 +112,7 @@ else { $entitystring = $langs->trans("AllEntities"); } - else - { + else { $mc->getInfo($entity); $entitystring = $mc->label; } @@ -197,8 +195,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; print ''; diff --git a/htdocs/user/home.php b/htdocs/user/home.php index 4c46c502acc..cec26f72dcc 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -170,8 +170,7 @@ if ($resql) { print $companystatic->getNomUrl(1); } - else - { + else { print $langs->trans("InternalUser"); } if ($obj->ldap_sid) @@ -188,8 +187,7 @@ if ($resql) { $entitystring = $langs->trans("AllEntities"); } - else - { + else { $mc->getInfo($entity); $entitystring = $mc->label; } @@ -210,8 +208,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -229,8 +226,7 @@ if ($canreadperms) { $sql .= " WHERE g.entity IS NOT NULL"; } - else - { + else { $sql .= " WHERE g.entity IN (0,".$conf->entity.")"; } $sql .= $db->order("g.datec", "DESC"); @@ -284,8 +280,7 @@ if ($canreadperms) $db->free($resql); } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/user/ldap.php b/htdocs/user/ldap.php index 71410eb223a..674ef0f64b6 100644 --- a/htdocs/user/ldap.php +++ b/htdocs/user/ldap.php @@ -114,8 +114,7 @@ if ($object->ldap_sid) { print ''; } -else -{ +else { print ''; } print ''; @@ -199,21 +198,18 @@ if ($result > 0) { print ''; } - else - { + else { $result = show_ldap_content($records, 0, $records['count'], true); } } - else - { + else { print ''; } $ldap->unbind(); $ldap->close(); } -else -{ +else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index ef6e205fd0d..ca2f39b4e9f 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -580,8 +580,7 @@ while ($i < min($num, $limit)) { print $langs->trans("DomainUser"); } - else - { + else { print $langs->trans("InternalUser"); } print ''; @@ -597,8 +596,7 @@ while ($i < min($num, $limit)) { print $langs->trans("AllEntities"); } - else - { + else { $mc->getInfo($obj->entity); print $mc->label; } diff --git a/htdocs/user/note.php b/htdocs/user/note.php index ab4df07e193..988b879653f 100644 --- a/htdocs/user/note.php +++ b/htdocs/user/note.php @@ -121,8 +121,7 @@ if ($id) $doleditor = new DolEditor('note_private', $object->note_private, '', 280, 'dolibarr_notes', 'In', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); $doleditor->Create(); } - else - { + else { print dol_string_onlythesehtmltags(dol_htmlentitiesbr($object->note_private)); } print ""; diff --git a/htdocs/user/notify/card.php b/htdocs/user/notify/card.php index 84fbf2793e3..33dded8a304 100644 --- a/htdocs/user/notify/card.php +++ b/htdocs/user/notify/card.php @@ -88,8 +88,7 @@ if ($action == 'add') dol_print_error($db); } } - else - { + else { dol_print_error($db); } @@ -97,8 +96,7 @@ if ($action == 'add') { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -152,8 +150,7 @@ if ($result > 0) { print ''; } - else - { + else { print ''; } print ''."\n"; @@ -228,8 +225,7 @@ if ($result > 0) { print ' <'.$object->email.'>'; } - else - { + else { $langs->load("errors"); print '   '.img_warning().' '.$langs->trans("ErrorBadEMail", $object->email); } @@ -244,8 +240,7 @@ if ($result > 0) print ''; print ''; } - else - { + else { print ''; @@ -272,8 +267,7 @@ if ($result > 0) { $num = $db->num_rows($resql); } - else - { + else { dol_print_error($db); } @@ -312,8 +306,7 @@ if ($result > 0) { print ' <'.$obj->email.'>'; } - else - { + else { $langs->load("errors"); print '   '.img_warning().' '.$langs->trans("ErrorBadEMail", $obj->email); } @@ -421,8 +414,7 @@ if ($result > 0) { $num = $db->num_rows($resql); } - else - { + else { dol_print_error($db); } @@ -471,8 +463,7 @@ if ($result > 0) print $userstatic->getNomUrl(1); print $obj->email ? ' <'.$obj->email.'>' : $langs->trans("NoMail"); } - else - { + else { print $obj->email; } print ''; diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index f9ebd310cfa..068ea0047b1 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -325,8 +325,7 @@ if ($action == 'edit') print ''; print ''; } -else -{ +else { dol_fiche_head($head, 'guisetup', $title, -1, 'user'); $linkback = ''.$langs->trans("BackToList").''; @@ -397,14 +396,12 @@ else { print "trans("FeatureDisabledInDemo")."\" href=\"#\">".$langs->trans("Modify").""; } - else - { + else { if ($caneditfield || !empty($user->admin)) // Si utilisateur edite = utilisateur courant (pas besoin de droits particulier car il s'agit d'une page de modif d'output et non de données) ou si admin { print 'id.'">'.$langs->trans("Modify").''; } - else - { + else { print "trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Modify").""; } } diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 83289521538..43202a01028 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -73,8 +73,7 @@ if ($action == 'validatenewpassword' && $username && $passwordhash) { $message = '
'.$langs->trans("ErrorLoginDoesNotExists", $username).'
'; } - else - { + else { if (dol_verifyHash($edituser->pass_temp, $passwordhash)) { // Clear session @@ -86,8 +85,7 @@ if ($action == 'validatenewpassword' && $username && $passwordhash) header("Location: ".DOL_URL_ROOT.'/'); exit; } - else - { + else { $langs->load("errors"); $message = '
'.$langs->trans("ErrorFailedToValidatePasswordReset").'
'; } @@ -104,8 +102,7 @@ if ($action == 'buildnewpassword' && $username) { $message = '
'.$langs->trans("ErrorBadValueForCode").'
'; } - else - { + else { $edituser = new User($db); $result = $edituser->fetch('', $username, '', 1); if ($result == 0 && preg_match('/@/', $username)) @@ -118,30 +115,26 @@ if ($action == 'buildnewpassword' && $username) $message = '
'.$langs->trans("ErrorLoginDoesNotExists", $username).'
'; $username = ''; } - else - { + else { if (!$edituser->email) { $message = '
'.$langs->trans("ErrorLoginHasNoEmail").'
'; } - else - { + else { $newpassword = $edituser->setPassword($user, '', 1); if ($newpassword < 0) { // Failed $message = '
'.$langs->trans("ErrorFailedToChangePassword").'
'; } - else - { + else { // Success if ($edituser->send_password($user, $newpassword, 1) > 0) { $message = ''; $username = ''; } - else - { + else { $message .= '
'.$edituser->error.'
'; } } @@ -166,8 +159,7 @@ if (file_exists(DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/passwordforgotten { $template_dir = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/tpl/"; } -else -{ +else { $template_dir = DOL_DOCUMENT_ROOT."/core/tpl/"; } diff --git a/htdocs/user/perms.php b/htdocs/user/perms.php index 5d06973abf6..408900eb406 100644 --- a/htdocs/user/perms.php +++ b/htdocs/user/perms.php @@ -209,8 +209,7 @@ if ($result) } $db->free($result); } -else -{ +else { dol_print_error($db); } @@ -240,8 +239,7 @@ if ($result) } $db->free($result); } -else -{ +else { dol_print_error($db); } @@ -411,8 +409,7 @@ if ($result) print img_picto($langs->trans("Active"), 'tick'); print ''; } - else - { + else { // Do not own permission if ($caneditperms) { @@ -421,8 +418,7 @@ if ($result) print ''; } } - else - { + else { // Do not own permission if ($caneditperms) { diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 15e019dd311..f29cc49f35b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -106,8 +106,7 @@ if ($_POST) { if (!$features) { setEventMessages($langs->trans('ErrorFieldsRequired'), null, 'errors'); } - else - { + else { $reference = trim($reference); if (empty($reference)) { $reference = false; @@ -361,8 +360,7 @@ if (!empty($id) || !empty($ref)) { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); } - else - { + else { print ' '; } print "\n"; @@ -628,8 +626,7 @@ if (!empty($id) || !empty($ref)) print ''; } - else - { + else { if ($action === 'delete') { if ($prodcomb->fetch($valueid) > 0) { $prodstatic->fetch($prodcomb->fk_product_child); @@ -801,8 +798,7 @@ if (!empty($id) || !empty($ref)) print ''; } } - else - { + else { print ''; } print '
'.img_picto_common('', 'treemenu/branchbottom.gif').''.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.'
'.$langs->trans("ErrorFailedToReadLDAP").'
'.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')
'.$langs->trans("LoginAccountDisableInDolibarr").''.$object->login.'
'; print $langs->trans("YouMustAssignUserMailFirst"); print '
 
'.$langs->trans("None").'
'; diff --git a/htdocs/variants/create.php b/htdocs/variants/create.php index 55bf1c81f34..567dc902a5a 100644 --- a/htdocs/variants/create.php +++ b/htdocs/variants/create.php @@ -43,8 +43,7 @@ if ($_POST) { { header('Location: '.$backtopage); } - else - { + else { header('Location: '.DOL_URL_ROOT.'/variants/card.php?id='.$resid.'&backtopage='.urlencode($backtopage)); } exit; diff --git a/htdocs/webservices/admin/index.php b/htdocs/webservices/admin/index.php index 819694f5041..cb0940bb61c 100644 --- a/htdocs/webservices/admin/index.php +++ b/htdocs/webservices/admin/index.php @@ -48,8 +48,7 @@ if ($actionsave) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/webservices/server_actioncomm.php b/htdocs/webservices/server_actioncomm.php index 39ed3b3cdf5..10ef9cfbd7e 100644 --- a/htdocs/webservices/server_actioncomm.php +++ b/htdocs/webservices/server_actioncomm.php @@ -328,14 +328,12 @@ function getActionComm($authentication, $id) 'result'=>array('result_code'=>'OK', 'result_label'=>''), 'actioncomm'=>$actioncomm_result_fields); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -389,14 +387,12 @@ function getListActionCommType($authentication) 'result'=>array('result_code'=>'OK', 'result_label'=>''), 'actioncommtypes'=>$resultarray); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -482,8 +478,7 @@ function createActionComm($authentication, $actioncomm) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; diff --git a/htdocs/webservices/server_category.php b/htdocs/webservices/server_category.php index de1fb73d3c0..d7382447749 100644 --- a/htdocs/webservices/server_category.php +++ b/htdocs/webservices/server_category.php @@ -262,14 +262,12 @@ function getCategory($authentication, $id) 'categorie'=> $cat ); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } diff --git a/htdocs/webservices/server_contact.php b/htdocs/webservices/server_contact.php index 804cb3f7db1..023cdc1c4ac 100644 --- a/htdocs/webservices/server_contact.php +++ b/htdocs/webservices/server_contact.php @@ -333,14 +333,12 @@ function getContact($authentication, $id, $ref_ext) 'contact'=>$contact_result_fields ); } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref_ext='.$ref_ext; } @@ -451,8 +449,7 @@ function createContact($authentication, $contact) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -584,8 +581,7 @@ function getContactsForThirdParty($authentication, $idthirdparty) ); } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); } diff --git a/htdocs/webservices/server_invoice.php b/htdocs/webservices/server_invoice.php index 46590688f88..8b15ade0a6a 100644 --- a/htdocs/webservices/server_invoice.php +++ b/htdocs/webservices/server_invoice.php @@ -370,14 +370,12 @@ function getInvoice($authentication, $id = '', $ref = '', $ref_ext = '') 'lines' => $linesresp )); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -511,8 +509,7 @@ function getInvoicesForThirdParty($authentication, $idthirdparty) ); } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); } @@ -627,8 +624,7 @@ function createInvoice($authentication, $invoice) $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_invoice->id, 'ref'=>$new_invoice->ref, 'ref_ext'=>$new_invoice->ref_ext); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -707,14 +703,12 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' } } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id_order.' nor ref='.$ref_order.' nor ref_ext='.$ref_ext_order; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -724,8 +718,7 @@ function createInvoiceFromOrder($authentication, $id_order = '', $ref_order = '' { $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); } - else - { + else { $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref, 'ref_ext'=>$newobject->ref_ext); } diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php index 0b22ea9aab6..7018f5fb5c8 100644 --- a/htdocs/webservices/server_order.php +++ b/htdocs/webservices/server_order.php @@ -473,15 +473,13 @@ function getOrder($authentication, $id = '', $ref = '', $ref_ext = '') )); } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; @@ -640,8 +638,7 @@ function getOrdersForThirdParty($authentication, $idthirdparty) ); } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); } @@ -786,8 +783,7 @@ function createOrder($authentication, $order) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { dol_syslog("Webservice server_order:: order creation or validation failed, rollback", LOG_ERR); $db->rollback(); $error++; @@ -848,24 +844,21 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) $outputlangs = $langs; $order->generateDocument($order->modelpdf, $outputlangs); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; $errorlabel = $order->error; } } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; $errorlabel = $order->error; } } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -877,8 +870,7 @@ function validOrder($authentication, $id = '', $id_warehouse = 0) { $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); } - else - { + else { $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); } diff --git a/htdocs/webservices/server_other.php b/htdocs/webservices/server_other.php index 4ae702ade15..71ee78d3c4d 100644 --- a/htdocs/webservices/server_other.php +++ b/htdocs/webservices/server_other.php @@ -304,8 +304,7 @@ function getDocument($authentication, $modulepart, $file, $refname = '') 'document'=>$objectret ); } - else - { + else { dol_syslog("File doesn't exist ".$original_file); $errorcode = 'NOT_FOUND'; $errorlabel = ''; diff --git a/htdocs/webservices/server_payment.php b/htdocs/webservices/server_payment.php index 38dab505bac..5145c4a3b7b 100644 --- a/htdocs/webservices/server_payment.php +++ b/htdocs/webservices/server_payment.php @@ -197,8 +197,7 @@ function createPayment($authentication, $payment) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$new_payment->id); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; diff --git a/htdocs/webservices/server_productorservice.php b/htdocs/webservices/server_productorservice.php index a98d8b2a6cd..68563bfab38 100644 --- a/htdocs/webservices/server_productorservice.php +++ b/htdocs/webservices/server_productorservice.php @@ -450,14 +450,12 @@ function getProductOrService($authentication, $id = '', $ref = '', $ref_ext = '' 'product'=>$productorservice_result_fields ); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -613,8 +611,7 @@ function createProductOrService($authentication, $product) $newobject->error = 'You set a different value for stock, but correction of stock count (before='.$getstockreal.', after='.$savstockreal.') fails with error '.$newobject->error; } } - else - { + else { $error++; $newobject->error = 'You set a different value for stock but we failed to find warehouse '.$product['warehouse_ref'].' to make correction.'; } @@ -627,8 +624,7 @@ function createProductOrService($authentication, $product) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -754,8 +750,7 @@ function updateProductOrService($authentication, $product) { $error++; } - else - { + else { // Update stock if stock count is provided and differs from database after creation or update if (isset($product['stock_real']) && $product['stock_real'] != '' && !empty($conf->global->stock->enabled)) { @@ -785,8 +780,7 @@ function updateProductOrService($authentication, $product) $newobject->error = 'You set a different value for stock, but correction of stock count (before='.$getstockreal.', after='.$savstockreal.') fails with error '.$newobject->error; } } - else - { + else { $error++; $newobject->error = 'You set a different value for stock but we failed to find warehouse '.$product['warehouse_ref'].' to make correction.'; } @@ -819,8 +813,7 @@ function updateProductOrService($authentication, $product) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -890,8 +883,7 @@ function deleteProductOrService($authentication, $listofidstring) $firsterror = 'Product or service with id '.$id.' not found'; break; } - else - { + else { $result = $newobject->delete($user); if ($result <= 0) { @@ -910,8 +902,7 @@ function deleteProductOrService($authentication, $listofidstring) //$objectresp=array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'listofid'=>$listofiddeleted); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'nbdeleted'=>count($listofiddeleted)); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -983,8 +974,7 @@ function getListOfProductsOrServices($authentication, $filterproduct) $i++; } } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); @@ -998,8 +988,7 @@ function getListOfProductsOrServices($authentication, $filterproduct) 'products'=>$arrayproducts ); } - else - { + else { $objectresp = array( 'result'=>array('result_code' => 'OK', 'result_label' => ''), 'products'=>$arrayproducts @@ -1139,21 +1128,18 @@ function getProductsForCategory($authentication, $id, $lang = '') 'products'=> $products ); } - else - { + else { $errorcode = 'NORECORDS_FOR_ASSOCIATION'; $errorlabel = 'No products associated'.$sql; $objectresp = array('result'=>array('result_code' => $errorcode, 'result_label' => $errorlabel)); dol_syslog("getProductsForCategory:: ".$errorcode, LOG_DEBUG); } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } diff --git a/htdocs/webservices/server_project.php b/htdocs/webservices/server_project.php index 5bbaaaf035a..dc8fc81db2c 100644 --- a/htdocs/webservices/server_project.php +++ b/htdocs/webservices/server_project.php @@ -298,8 +298,7 @@ function createProject($authentication, $project) $error++; } } - else - { + else { $error++; } @@ -308,16 +307,14 @@ function createProject($authentication, $project) $db->commit(); $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; $errorlabel = $newobject->error; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -424,14 +421,12 @@ function getProject($authentication, $id = '', $ref = '') 'project'=>$project_result_fields ); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } diff --git a/htdocs/webservices/server_supplier_invoice.php b/htdocs/webservices/server_supplier_invoice.php index 78a00ced40e..ecf2c51fd1f 100644 --- a/htdocs/webservices/server_supplier_invoice.php +++ b/htdocs/webservices/server_supplier_invoice.php @@ -303,14 +303,12 @@ function getSupplierInvoice($authentication, $id = '', $ref = '', $ref_ext = '') )); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -441,8 +439,7 @@ function getSupplierInvoicesForThirdParty($authentication, $idthirdparty) ); } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); } diff --git a/htdocs/webservices/server_thirdparty.php b/htdocs/webservices/server_thirdparty.php index d69b481323e..1e9f8355d52 100644 --- a/htdocs/webservices/server_thirdparty.php +++ b/htdocs/webservices/server_thirdparty.php @@ -378,14 +378,12 @@ function getThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') 'result'=>array('result_code'=>'OK', 'result_label'=>''), 'thirdparty'=>$thirdparty_result_fields); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -515,8 +513,7 @@ function createThirdParty($authentication, $thirdparty) $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>''), 'id'=>$newobject->id, 'ref'=>$newobject->ref); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -750,8 +747,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) $i++; } } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); @@ -765,8 +761,7 @@ function getListOfThirdParties($authentication, $filterthirdparty) 'thirdparties'=>$arraythirdparties ); } - else - { + else { $objectresp = array( 'result'=>array('result_code' => 'OK', 'result_label' => ''), 'thirdparties'=>$arraythirdparties @@ -828,8 +823,7 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') $objectresp = array('result'=>array('result_code'=>'OK', 'result_label'=>'')); } - else - { + else { $db->rollback(); $error++; $errorcode = 'KO'; @@ -837,14 +831,12 @@ function deleteThirdParty($authentication, $id = '', $ref = '', $ref_ext = '') dol_syslog("Function: deleteThirdParty cant delete"); } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } diff --git a/htdocs/webservices/server_user.php b/htdocs/webservices/server_user.php index 8793d2f02fa..c37e920f61d 100644 --- a/htdocs/webservices/server_user.php +++ b/htdocs/webservices/server_user.php @@ -372,14 +372,12 @@ function getUser($authentication, $id, $ref = '', $ref_ext = '') ) ); } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'Object not found for id='.$id.' nor ref='.$ref.' nor ref_ext='.$ref_ext; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -426,8 +424,7 @@ function getListOfGroups($authentication) { $sql .= " WHERE g.entity IS NOT NULL"; } - else - { + else { $sql .= " WHERE g.entity IN (0,".$conf->entity.")"; } $sql .= " GROUP BY g.rowid, g.nom, g.entity, g.datec"; @@ -444,8 +441,7 @@ function getListOfGroups($authentication) $i++; } } - else - { + else { $error++; $errorcode = $db->lasterrno(); $errorlabel = $db->lasterror(); @@ -459,8 +455,7 @@ function getListOfGroups($authentication) 'groups'=>$arraygroups ); } - else - { + else { $objectresp = array( 'result'=>array('result_code' => 'OK', 'result_label' => ''), 'groups'=>$arraygroups @@ -526,8 +521,7 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $error++; $errorcode = 'ALREADY_EXIST'; $errorlabel = 'Object not create : company or contact exists '.$thirdpartywithuser['email']; } - else - { + else { $db->begin(); /* * Company creation @@ -633,14 +627,12 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) if ($thirdpartywithuser['group_id'] > 0) $edituser->SetInGroup($thirdpartywithuser['group_id'], $conf->entity); } - else - { + else { $error++; $errorcode = 'NOT_CREATE'; $errorlabel = 'Object not create : '.$edituser->error; } } - else - { + else { $error++; $errorcode = 'NOT_CREATE'; $errorlabel = 'Object not create : '.$contact->error; } @@ -651,22 +643,19 @@ function createUserFromThirdparty($authentication, $thirdpartywithuser) $error = 0; } } - else - { + else { $error++; $errors = ($thirdparty->error ? array($thirdparty->error) : $thirdparty->errors); } } } - else - { + else { // retour creation KO $error++; $errorcode = 'NOT_CREATE'; $errorlabel = 'Object not create'; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } @@ -732,20 +721,17 @@ function setUserPassword($authentication, $shortuser) 'groups'=>$arraygroups ); } - else - { + else { $error++; $errorcode = 'NOT_MODIFIED'; $errorlabel = 'Error when changing password'; } } - else - { + else { $error++; $errorcode = 'NOT_FOUND'; $errorlabel = 'User not found'; } } - else - { + else { $error++; $errorcode = 'PERMISSION_DENIED'; $errorlabel = 'User does not have permission for this request'; } From f5688b2eecf8a56effd263936ac1ac8bf0dbdf6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 01:52:25 +0200 Subject: [PATCH 06/28] add new rule --- htdocs/compta/accounting-files.php | 12 +- htdocs/compta/ajaxpayment.php | 6 +- htdocs/compta/bank/annuel.php | 27 +-- htdocs/compta/bank/bankentries_list.php | 71 ++---- htdocs/compta/bank/budget.php | 3 +- htdocs/compta/bank/card.php | 30 +-- htdocs/compta/bank/categ.php | 3 +- htdocs/compta/bank/class/account.class.php | 72 ++---- .../bank/class/api_bankaccounts.class.php | 9 +- .../bank/class/paymentvarious.class.php | 24 +- htdocs/compta/bank/graph.php | 54 ++--- htdocs/compta/bank/line.php | 51 ++--- htdocs/compta/bank/list.php | 6 +- htdocs/compta/bank/releve.php | 24 +- htdocs/compta/bank/transfer.php | 9 +- htdocs/compta/bank/treso.php | 9 +- htdocs/compta/bank/various_payment/card.php | 21 +- .../compta/bank/various_payment/document.php | 3 +- htdocs/compta/bank/various_payment/list.php | 6 +- .../compta/cashcontrol/cashcontrol_card.php | 24 +- .../compta/cashcontrol/cashcontrol_list.php | 3 +- htdocs/compta/cashcontrol/report.php | 6 +- htdocs/compta/charges/index.php | 18 +- htdocs/compta/clients.php | 3 +- htdocs/compta/deplacement/card.php | 45 ++-- .../deplacement/class/deplacement.class.php | 21 +- htdocs/compta/deplacement/document.php | 3 +- htdocs/compta/deplacement/index.php | 3 +- htdocs/compta/deplacement/list.php | 3 +- htdocs/compta/deplacement/stats/index.php | 3 +- htdocs/compta/facture/card-rec.php | 99 +++----- htdocs/compta/facture/card.php | 131 ++++------- .../facture/class/api_invoices.class.php | 9 +- .../facture/class/facture-rec.class.php | 97 +++----- htdocs/compta/facture/class/facture.class.php | 214 ++++++------------ .../facture/class/paymentterm.class.php | 18 +- htdocs/compta/facture/contact.php | 12 +- htdocs/compta/facture/document.php | 6 +- .../compta/facture/invoicetemplate_list.php | 15 +- htdocs/compta/facture/list.php | 21 +- htdocs/compta/facture/prelevement.php | 48 ++-- htdocs/compta/facture/stats/index.php | 9 +- .../facture/tpl/linkedobjectblock.tpl.php | 3 +- htdocs/compta/index.php | 48 ++-- htdocs/compta/journal/purchasesjournal.php | 5 +- htdocs/compta/journal/sellsjournal.php | 5 +- htdocs/compta/localtax/card.php | 15 +- .../compta/localtax/class/localtax.class.php | 45 ++-- htdocs/compta/localtax/clients.php | 24 +- htdocs/compta/localtax/index.php | 12 +- htdocs/compta/localtax/list.php | 3 +- htdocs/compta/localtax/quadri_detail.php | 21 +- htdocs/compta/paiement.php | 21 +- htdocs/compta/paiement/card.php | 24 +- htdocs/compta/paiement/cheque/card.php | 60 ++--- .../cheque/class/remisecheque.class.php | 75 ++---- htdocs/compta/paiement/cheque/index.php | 6 +- htdocs/compta/paiement/cheque/list.php | 6 +- .../compta/paiement/class/paiement.class.php | 69 ++---- htdocs/compta/paiement/list.php | 8 +- htdocs/compta/paiement/rapport.php | 3 +- htdocs/compta/paiement/tovalidate.php | 3 +- htdocs/compta/paiement_charge.php | 9 +- htdocs/compta/payment_sc/card.php | 9 +- htdocs/compta/paymentbybanktransfer/index.php | 9 +- htdocs/compta/prelevement/bons.php | 3 +- htdocs/compta/prelevement/card.php | 6 +- .../class/bonprelevement.class.php | 123 ++++------ .../class/ligneprelevement.class.php | 6 +- .../class/rejetprelevement.class.php | 27 +-- htdocs/compta/prelevement/create.php | 18 +- htdocs/compta/prelevement/demandes.php | 6 +- htdocs/compta/prelevement/factures.php | 6 +- htdocs/compta/prelevement/fiche-rejet.php | 9 +- htdocs/compta/prelevement/fiche-stat.php | 6 +- htdocs/compta/prelevement/index.php | 9 +- htdocs/compta/prelevement/line.php | 24 +- htdocs/compta/prelevement/list.php | 3 +- htdocs/compta/prelevement/rejets.php | 3 +- htdocs/compta/prelevement/stats.php | 6 +- htdocs/compta/recap-compta.php | 9 +- htdocs/compta/resultat/clientfourn.php | 53 ++--- htdocs/compta/resultat/index.php | 26 +-- htdocs/compta/resultat/result.php | 4 +- htdocs/compta/sociales/card.php | 30 +-- .../sociales/class/chargesociales.class.php | 27 +-- .../class/paymentsocialcontribution.class.php | 27 +-- htdocs/compta/sociales/document.php | 3 +- htdocs/compta/sociales/list.php | 12 +- htdocs/compta/sociales/payments.php | 18 +- htdocs/compta/stats/byratecountry.php | 3 +- htdocs/compta/stats/cabyprodserv.php | 3 +- htdocs/compta/stats/cabyuser.php | 5 +- htdocs/compta/stats/casoc.php | 5 +- htdocs/compta/stats/index.php | 23 +- htdocs/compta/stats/supplier_turnover.php | 18 +- .../stats/supplier_turnover_by_prodserv.php | 3 +- .../stats/supplier_turnover_by_thirdparty.php | 3 +- htdocs/compta/tva/card.php | 18 +- htdocs/compta/tva/class/tva.class.php | 51 ++--- htdocs/compta/tva/clients.php | 12 +- htdocs/compta/tva/document.php | 3 +- htdocs/compta/tva/index.php | 12 +- htdocs/compta/tva/list.php | 9 +- htdocs/compta/tva/quadri_detail.php | 18 +- htdocs/contact/agenda.php | 6 +- .../actions_contactcard_common.class.php | 9 +- .../actions_contactcard_default.class.php | 3 +- htdocs/contact/card.php | 69 ++---- htdocs/contact/class/contact.class.php | 60 ++--- htdocs/contact/consumption.php | 12 +- htdocs/contact/ldap.php | 15 +- htdocs/contact/list.php | 9 +- htdocs/contact/perso.php | 24 +- htdocs/contact/vcard.php | 3 +- htdocs/contrat/agenda.php | 3 +- htdocs/contrat/card.php | 102 +++------ htdocs/contrat/class/api_contracts.class.php | 6 +- htdocs/contrat/class/contrat.class.php | 113 ++++----- htdocs/contrat/contact.php | 6 +- htdocs/contrat/document.php | 3 +- htdocs/contrat/index.php | 33 +-- htdocs/contrat/list.php | 3 +- htdocs/contrat/services_list.php | 12 +- htdocs/cron/admin/cron.php | 6 +- htdocs/cron/card.php | 33 +-- htdocs/cron/class/cronjob.class.php | 42 ++-- htdocs/cron/list.php | 15 +- htdocs/dav/dav.class.php | 30 +-- htdocs/dav/dav.lib.php | 6 +- .../class/DataCollector/DolLogsCollector.php | 3 +- htdocs/ecm/ajax/ecmdatabase.php | 9 +- htdocs/ecm/class/ecmdirectory.class.php | 48 ++-- htdocs/ecm/class/ecmfiles.class.php | 6 +- htdocs/ecm/class/htmlecm.form.class.php | 6 +- htdocs/ecm/dir_add_card.php | 16 +- htdocs/ecm/dir_card.php | 46 ++-- htdocs/ecm/file_card.php | 27 +-- htdocs/ecm/index.php | 15 +- htdocs/ecm/index_auto.php | 15 +- .../class/emailcollector.class.php | 72 ++---- .../class/emailcollectoraction.class.php | 3 +- .../class/emailcollectorfilter.class.php | 3 +- htdocs/expedition/card.php | 150 ++++-------- .../expedition/class/api_shipments.class.php | 6 +- htdocs/expedition/class/expedition.class.php | 174 +++++--------- .../class/expeditionbatch.class.php | 12 +- htdocs/expedition/contact.php | 3 +- htdocs/expedition/index.php | 3 +- htdocs/expedition/list.php | 6 +- htdocs/expedition/shipment.php | 33 +-- htdocs/expedition/stats/index.php | 3 +- htdocs/expensereport/ajax/ajaxik.php | 12 +- htdocs/expensereport/ajax/ajaxprojet.php | 6 +- htdocs/expensereport/card.php | 159 +++++-------- .../class/api_expensereports.class.php | 3 +- .../class/expensereport.class.php | 192 ++++++---------- .../class/expensereport_ik.class.php | 12 +- .../class/expensereport_rule.class.php | 9 +- .../class/paymentexpensereport.class.php | 30 +-- htdocs/expensereport/document.php | 3 +- htdocs/expensereport/index.php | 3 +- htdocs/expensereport/list.php | 18 +- htdocs/expensereport/payment/card.php | 12 +- htdocs/expensereport/payment/payment.php | 6 +- htdocs/expensereport/stats/index.php | 3 +- .../tpl/expensereport_linktofile.tpl.php | 6 +- htdocs/fichinter/card-rec.php | 21 +- htdocs/fichinter/card.php | 72 ++---- htdocs/fichinter/class/fichinter.class.php | 87 +++---- htdocs/fichinter/contact.php | 3 +- htdocs/fichinter/document.php | 3 +- htdocs/fichinter/index.php | 3 +- htdocs/fichinter/list.php | 3 +- htdocs/fichinter/stats/index.php | 9 +- htdocs/fourn/card.php | 36 +-- .../class/api_supplier_invoices.class.php | 3 +- htdocs/fourn/class/fournisseur.class.php | 12 +- .../class/fournisseur.commande.class.php | 210 ++++++----------- .../fournisseur.commande.dispatch.class.php | 15 +- .../fourn/class/fournisseur.facture.class.php | 133 ++++------- .../fourn/class/fournisseur.product.class.php | 44 ++-- htdocs/fourn/class/paiementfourn.class.php | 48 ++-- htdocs/fourn/commande/card.php | 144 ++++-------- htdocs/fourn/commande/contact.php | 12 +- htdocs/fourn/commande/dispatch.php | 24 +- htdocs/fourn/commande/document.php | 3 +- htdocs/fourn/commande/index.php | 9 +- htdocs/fourn/commande/info.php | 6 +- htdocs/fourn/commande/list.php | 18 +- htdocs/fourn/commande/note.php | 3 +- htdocs/fourn/commande/orderstoinvoice.php | 6 +- htdocs/fourn/contact.php | 3 +- htdocs/fourn/facture/card.php | 131 ++++------- htdocs/fourn/facture/contact.php | 12 +- htdocs/fourn/facture/document.php | 3 +- htdocs/fourn/facture/impayees.php | 3 +- htdocs/fourn/facture/list.php | 6 +- htdocs/fourn/facture/paiement.php | 27 +-- htdocs/fourn/facture/rapport.php | 3 +- .../facture/tpl/linkedobjectblock.tpl.php | 3 +- htdocs/fourn/index.php | 9 +- htdocs/fourn/paiement/card.php | 24 +- htdocs/fourn/product/list.php | 3 +- htdocs/fourn/recap-fourn.php | 9 +- htdocs/ftp/admin/ftpclient.php | 15 +- htdocs/ftp/index.php | 71 ++---- htdocs/holiday/card.php | 78 +++---- htdocs/holiday/class/holiday.class.php | 108 +++------ htdocs/holiday/define_holiday.php | 12 +- htdocs/holiday/document.php | 12 +- htdocs/holiday/list.php | 9 +- htdocs/holiday/month_report.php | 3 +- htdocs/imports/class/import.class.php | 12 +- htdocs/imports/import.php | 71 ++---- 215 files changed, 1910 insertions(+), 3784 deletions(-) diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index faf2feeb7a0..b14e3adafad 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -335,8 +335,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; } - else - { + else { foreach ($files as $key => $file) { $file['id'] = $objd->id; @@ -384,8 +383,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $i++; } } - else - { + else { dol_print_error($db); } @@ -492,8 +490,7 @@ if ($result && $action == "dl" && !$error) exit(); } - else - { + else { setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); } } @@ -626,8 +623,7 @@ if (!empty($date_start) && !empty($date_stop)) { print ''.$langs->trans("NoItem").''; } - else - { + else { // Sort array by date ASC to calculate balance $totalET_debit = 0; diff --git a/htdocs/compta/ajaxpayment.php b/htdocs/compta/ajaxpayment.php index f380d8b4ee5..0129d1e5f43 100644 --- a/htdocs/compta/ajaxpayment.php +++ b/htdocs/compta/ajaxpayment.php @@ -81,13 +81,11 @@ if ($currentInvId) // Here to breakdown $remainAmount = $currentRemain - $currentAmount; // To keep value between curRemain and curAmount $result += $remainAmount; // result must be deduced by $currentAmount += $remainAmount; // curAmount put to curRemain - } else - { + } else { $currentAmount = $currentRemain; $result += $currentRemain; } - } else - { + } else { // Reset the substraction for this amount $result += price2num($currentAmount); $currentAmount = 0; diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 1f6e5e6620c..51d838878b8 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -51,8 +51,7 @@ if (!$year_start) $year_start = $year_current - 2; $year_end = $year_current; } -else -{ +else { $year_end = $year_start + 2; } @@ -108,8 +107,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -136,8 +134,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -158,8 +155,7 @@ if (!empty($id)) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); } - else - { + else { $bankaccount = new Account($db); $listid = explode(',', $id); foreach ($listid as $key => $aId) @@ -171,8 +167,7 @@ if (!empty($id)) } } } -else -{ +else { print $langs->trans("AllAccounts"); } @@ -281,8 +276,7 @@ if ($result < 0) $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); } -else -{ +else { // Calcul de $min et $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -299,8 +293,7 @@ else $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); } - else - { + else { dol_print_error($db); } $log = "graph.php: min=".$min." max=".$max; @@ -339,8 +332,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -426,8 +418,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 7d059734126..d5fb533016e 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -69,8 +69,7 @@ if ($fielvalue) if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); } -else -{ +else { if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque'); } @@ -242,15 +241,13 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' } } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("NoRecordSelected"), null, 'errors'); } } - else - { + else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors'); @@ -287,8 +284,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) { $amount = price2num($_POST["addcredit"]); } - else - { + else { $amount = - price2num($_POST["adddebit"]); } @@ -338,13 +334,11 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : '')); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $action = 'addline'; } } @@ -469,8 +463,7 @@ if ($id > 0 || !empty($ref)) } } } -else -{ +else { llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } @@ -675,8 +668,7 @@ if ($resql) print $liste; if ($numr <= 0) print ''.$langs->trans("None").''; } - else - { + else { dol_print_error($db); } @@ -793,13 +785,12 @@ if ($resql) { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); } - else // If direct entries is not done using miscellaneous payments + else // If direct entries is not done using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); } } - else - { + else { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); } } @@ -1041,8 +1032,7 @@ if ($resql) $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount); } // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show - else - { + else { $balance = $objforbalance->previoustotal; } } @@ -1129,8 +1119,7 @@ if ($resql) $balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc) $balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT'); } - else - { + else { $balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc) $balance = price2num($balance + ($sign * $objp->amount), 'MT'); } @@ -1142,8 +1131,7 @@ if ($resql) $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; } - else - { + else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -1279,8 +1267,7 @@ if ($resql) print $bankstatic->getNomUrl(1, ''); print ')'; } - else - { + else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("TransferFrom").' '; @@ -1306,8 +1293,7 @@ if ($resql) elseif ($links[$key]['type'] == 'sc') { } - else - { + else { // Show link with label $links[$key]['label'] if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - '; print ''; @@ -1317,8 +1303,7 @@ if ($resql) if ($reg[1] == 'paiement') $reg[1] = 'Payment'; print ' '.$langs->trans($reg[1]); } - else - { + else { print ' '.$links[$key]['label']; } print ''; @@ -1396,8 +1381,7 @@ if ($resql) $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; print $companystatic->getNomUrl(1); } - else - { + else { print ' '; } print ''; @@ -1450,13 +1434,11 @@ if ($resql) { print ' '.price($balancebefore).''; } - else - { + else { print ' '.price($balancebefore).''; } } - else - { + else { print '-'; } if (!$i) $totalarray['nbfield']++; @@ -1470,13 +1452,11 @@ if ($resql) { print ' '.price($balance).''; } - else - { + else { print ' '.price($balance).''; } } - else - { + else { print '-'; } if (!$i) $totalarray['nbfield']++; @@ -1523,16 +1503,14 @@ if ($resql) print img_edit(); print ''; } - else - { + else { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; print img_edit(); print ''; } - else - { + else { print ''; print img_view(); print ''; @@ -1610,8 +1588,7 @@ if ($resql) print ''; $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 042117808d5..3a15ddf72e1 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -90,8 +90,7 @@ if ($result) print ''.price($total).''; print ''.price($totalnb ?price2num($total / $totalnb, 'MT') : 0).''; } -else -{ +else { dol_print_error($db); } print ""; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 593893878e0..3af40ffb2a0 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -100,8 +100,7 @@ if ($action == 'add') { $object->account_number = ''; } - else - { + else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -168,8 +167,7 @@ if ($action == 'add') { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -206,8 +204,7 @@ if ($action == 'update') { $object->account_number = ''; } - else - { + else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -260,8 +257,7 @@ if ($action == 'update') $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu } - else - { + else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; // Force chargement page edition @@ -272,8 +268,7 @@ if ($action == 'update') { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -291,8 +286,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> header("Location: ".DOL_URL_ROOT."/compta/bank/list.php"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -399,8 +393,7 @@ if ($action == 'create') { $formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id'); } - else - { + else { print $countrynotdefined; } print ''; @@ -545,8 +538,7 @@ if ($action == 'create') print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print ''; } - else - { + else { print ''.$langs->trans("AccountancyCode").''; print 'account_number).'">'; } @@ -577,8 +569,7 @@ if ($action == 'create') /* Visu et edition */ /* */ /* ************************************************************************** */ -else -{ +else { if (($_GET["id"] || $_GET["ref"]) && $action != 'edit') { $object = new Account($db); @@ -887,8 +878,7 @@ else { print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id'); } - else - { + else { print $countrynotdefined; } print ''; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 308dad5dbca..b7bbb4d157e 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -133,8 +133,7 @@ if ($result) print ''; print ""; } - else - { + else { print "".$objp->label.""; print ''; print ''.img_edit().''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 3fcbffba3b2..cae83563b42 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -404,8 +404,7 @@ class Account extends CommonObject $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); return $rowid; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -510,8 +509,7 @@ class Account extends CommonObject $obj = $this->db->fetch_object($resql); $oper = $obj->code; } - else - { + else { dol_print_error($this->db, 'Failed to get payment type code'); return -1; } @@ -721,13 +719,11 @@ class Account extends CommonObject // End call triggers } } - else - { + else { $error++; } } - else - { + else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans("ErrorBankLabelAlreadyExists"); @@ -744,8 +740,7 @@ class Account extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1 * $error; } @@ -837,8 +832,7 @@ class Account extends CommonObject // End call triggers } } - else - { + else { $error++; $this->error = $this->db->lasterror(); dol_print_error($this->db); @@ -849,8 +843,7 @@ class Account extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1 * $error; } @@ -908,8 +901,7 @@ class Account extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_print_error($this->db); return -1; @@ -1007,13 +999,11 @@ class Account extends CommonObject return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = $this->db->lasterror; $this->errors[] = $this->error; return -1; @@ -1114,8 +1104,7 @@ class Account extends CommonObject } } } - else - { + else { $error++; $this->error = "Error ".$this->db->lasterror(); } @@ -1126,8 +1115,7 @@ class Account extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1292,8 +1280,7 @@ class Account extends CommonObject return $response; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1331,8 +1318,7 @@ class Account extends CommonObject } $this->db->free($resql); } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1476,8 +1462,7 @@ class Account extends CommonObject { return 1; } - else - { + else { return 0; } } @@ -1897,8 +1882,7 @@ class AccountLine extends CommonObject $this->db->free($result); return $ret; } - else - { + else { return -1; } } @@ -2015,8 +1999,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -$nbko; } @@ -2054,8 +2037,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -$nbko; } @@ -2086,8 +2068,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -1; @@ -2152,8 +2133,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -2190,8 +2170,7 @@ class AccountLine extends CommonObject return 1; } } - else - { + else { dol_print_error($this->db); return 0; } @@ -2257,8 +2236,7 @@ class AccountLine extends CommonObject return 1; } } - else - { + else { dol_print_error($this->db); return 0; } @@ -2334,8 +2312,7 @@ class AccountLine extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -2477,8 +2454,7 @@ class AccountLine extends CommonObject $alreadydispatched = $obj->nb; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index ad75559b362..6943d2bc5e1 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -226,8 +226,7 @@ class BankAccounts extends DolibarrApi { $amount_to = $amount; } - else - { + else { if (!$amount_to || empty($amount_to)) { throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.'); @@ -304,8 +303,7 @@ class BankAccounts extends DolibarrApi ) ); } - else - { + else { $this->db->rollback(); throw new RestException(500, $accountfrom->error.' '.$accountto->error); } @@ -339,8 +337,7 @@ class BankAccounts extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $account->error); } } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 6af394ad4b4..ec88fea3f84 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -170,8 +170,7 @@ class PaymentVarious extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -245,8 +244,7 @@ class PaymentVarious extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -431,8 +429,7 @@ class PaymentVarious extends CommonObject { $this->update_fk_bank($bank_line_id); } - else - { + else { $this->error = $acc->error; $error++; } @@ -469,14 +466,12 @@ class PaymentVarious extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -500,8 +495,7 @@ class PaymentVarious extends CommonObject { return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -677,8 +671,7 @@ class PaymentVarious extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -706,8 +699,7 @@ class PaymentVarious extends CommonObject $alreadydispatched = $obj->nb; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 347353be84f..796529a24d9 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -85,8 +85,7 @@ if ($result < 0) $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); } -else -{ +else { // Calcul $min and $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -103,8 +102,7 @@ else $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); } - else - { + else { dol_print_error($db); } if (empty($min)) $min = dol_now() - 3600 * 24; @@ -152,8 +150,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -175,8 +172,7 @@ else $solde = $row[0]; $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -200,8 +196,7 @@ else { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph } - else - { + else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -295,8 +290,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -318,8 +312,7 @@ else $solde = $row[0]; $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -344,8 +337,7 @@ else { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph } - else - { + else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -432,8 +424,7 @@ else $i++; } } - else - { + else { dol_print_error($db); } @@ -460,8 +451,7 @@ else { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph } - else - { + else { $datas[$i] = 0 + $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -558,8 +548,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -592,8 +581,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -675,8 +663,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } $sql = "SELECT date_format(b.datev,'%m')"; @@ -700,8 +687,7 @@ else } $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -771,15 +757,13 @@ if ($account) $morehtml = ''.$langs->trans("ShowAllAccounts").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1); } - else - { + else { $morehtml = ''.$langs->trans("BackToAccount").''; print $langs->trans("AllAccounts"); //print $morehtml; } } - else - { + else { $bankaccount = new Account($db); $listid = explode(',', $account); foreach ($listid as $key => $id) @@ -791,8 +775,7 @@ if ($account) } } } -else -{ +else { print $langs->trans("AllAccounts"); } @@ -809,8 +792,7 @@ if ($mode == 'showalltime') print $langs->trans("GoBack"); print ''; } -else -{ +else { print ''; print $langs->trans("ShowAllTimeBalance"); print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index bf8dc6f5649..a1c37d59050 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -100,8 +100,7 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban dol_print_error($db); } } - else - { + else { setEventMessages($langs->trans("MissingIds"), null, 'errors'); } } @@ -121,8 +120,7 @@ if ($user->rights->banque->modifier && $action == "update") { $actarget->fetch(GETPOST('accountid', 'int')); } - else - { + else { $actarget->fetch($id); } @@ -192,8 +190,7 @@ if ($user->rights->banque->modifier && $action == "update") setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -230,8 +227,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); } - else - { + else { $db->rollback(); dol_print_error($db); } @@ -325,8 +321,7 @@ if ($result) { $form->select_comptes($acct->id, 'accountid', 0, '', 0); } - else - { + else { print $acct->getNomUrl(1, 'transactions', 'reflabel'); } print ''; @@ -464,8 +459,7 @@ if ($result) } print ''; } - else - { + else { print ''.$objp->fk_type.' '.$objp->num_chq.''; } print ""; @@ -480,8 +474,7 @@ if ($result) print ''; print ''; } - else - { + else { print ''.$objp->emetteur.''; } print ""; @@ -496,8 +489,7 @@ if ($result) print ''; print ''; } - else - { + else { print ''.$objp->banque.''; } print ""; @@ -518,8 +510,7 @@ if ($result) } print ''; } - else - { + else { print ''; print dol_print_date($db->jdate($objp->do), "day"); print ''; @@ -542,8 +533,7 @@ if ($result) } print ''; } - else - { + else { print ''; print dol_print_date($db->jdate($objp->dv), "day"); print ''; @@ -561,23 +551,20 @@ if ($result) // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); } - else - { + else { print $objp->label; } print '">'; print ''; } - else - { + else { print ''; if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); } - else - { + else { print $objp->label; } print ''; @@ -592,8 +579,7 @@ if ($result) print 'rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code); print ''; } - else - { + else { print ''; print price($objp->amount); print ''; @@ -650,15 +636,13 @@ if ($result) print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; print ''; } - else - { + else { print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; print ''; } - else - { + else { print ''.$objp->num_releve.' '; } print ''; @@ -670,8 +654,7 @@ if ($result) print 'rappro ? ' checked="checked"' : '')).'">'; print ''; } - else - { + else { print ''.yn($objp->rappro).''; } print ''; diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index b1c76c529ad..bc45c708f33 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -488,8 +488,7 @@ foreach ($accounts as $key=>$type) $accountingaccount->fetch('', $objecttmp->account_number, 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); } - else - { + else { print $objecttmp->account_number; } print ''; @@ -506,8 +505,7 @@ foreach ($accounts as $key=>$type) $accountingjournal->fetch($objecttmp->fk_accountancy_journal); print $accountingjournal->getNomUrl(0, 1, 1, '', 1); } - else - { + else { print ''; } print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index c737af4a89e..65476665963 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -296,16 +296,14 @@ if (empty($numref)) { // } - else - { + else { print ''; print ''; if ($action != 'editbankreceipt' || $objp->numr != $brref) { print ''.$objp->numr.''; } - else - { + else { print ''; print ''; print ''; @@ -356,13 +354,11 @@ if (empty($numref)) print "\n
\n"; } - else - { + else { dol_print_error($db); } } -else -{ +else { /** * Show list of record into a bank statement */ @@ -554,8 +550,7 @@ else print $bankstatic->getNomUrl(1, ''); print ')'; } - else - { + else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("from").' '; @@ -626,8 +621,7 @@ else $ii++; } } - else - { + else { dol_print_error($db); } } @@ -639,8 +633,7 @@ else $totald = $totald + abs($objp->amount); print ''.price($objp->amount * -1)." \n"; } - else - { + else { $totalc = $totalc + abs($objp->amount); print ' '.price($objp->amount)."\n"; } @@ -653,8 +646,7 @@ else print img_edit(); print ""; } - else - { + else { print " "; } print ""; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index aa4c39e55ee..99a66321648 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -88,8 +88,7 @@ if ($action == 'add') { $amountto = $amount; } - else - { + else { if (!$amountto) { $error++; @@ -131,14 +130,12 @@ if ($action == 'add') setEventMessages($mesgs, null, 'mesgs'); $db->commit(); } - else - { + else { setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors'); $db->rollback(); } } - else - { + else { $error++; setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors'); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index b8d259cdc8d..929a1611775 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -73,8 +73,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) { $viewline = $vline; } - else - { + else { $viewline = 20; } @@ -305,8 +304,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $i++; } } - else - { + else { dol_print_error($db); } @@ -327,8 +325,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print ""; print "
"; } -else -{ +else { print $langs->trans("ErrorBankAccountNotFound"); } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index c4fdc3be56a..ffabd082bfa 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -164,8 +164,7 @@ if (empty($reshook)) header("Location: ".$urltogo); exit; } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -199,21 +198,18 @@ if (empty($reshook)) header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); exit; } - else - { + else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } @@ -392,8 +388,7 @@ if ($action == 'create') { print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); } - else - { + else { print ''; } print ''; @@ -565,13 +560,11 @@ if ($id) print ''; } } - else - { + else { print ''; } } - else - { + else { print ''; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index d81b9bdd41a..624ead86073 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -150,8 +150,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5f68440809c..5fa44ba8555 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -76,8 +76,7 @@ if (!GETPOST('typeid')) if ($part[0] == 'v.fk_typepayment') $typeid = $part[1]; } } -else -{ +else { $typeid = GETPOST('typeid'); } @@ -374,8 +373,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index 3780fbc1afe..fce50a977e4 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -178,8 +178,7 @@ elseif ($action == "add") $db->commit(); $action = "view"; } - else - { + else { $db->rollback; $action = "view"; } @@ -218,8 +217,7 @@ if ($action == "valid") // validate = close setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } - else - { + else { setEventMessages($langs->trans("CashFenceDone"), null); $db->commit(); } @@ -254,8 +252,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) header("Location: ".$backurlforlist); exit; } - else - { + else { if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } @@ -330,8 +327,7 @@ if ($action == "create" || $action == "start" || $action == 'close') } else dol_print_error($db); } - else - { + else { setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminaltouse), null, 'errors'); $error++; } @@ -350,8 +346,7 @@ if ($action == "create" || $action == "start" || $action == 'close') if ($key == 'cash') $sql .= " AND cp.code = 'LIQ'"; elseif ($key == 'cheque') $sql .= " AND cp.code = 'CHQ'"; elseif ($key == 'card') $sql .= " AND cp.code = 'CB'"; - else - { + else { dol_print_error('Value for key = '.$key.' not supported'); exit; } @@ -394,8 +389,7 @@ if ($action == "create" || $action == "start" || $action == 'close') print ''; print ''; } - else - { + else { print ''; } @@ -470,8 +464,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { print ''; } - else - { + else { print ''; } print ''; @@ -712,8 +705,7 @@ if (empty($action) || $action == "view" || $action == "close") print ''; print ''; } - else - { + else { print ''; } diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index a98c9ea83f5..5269c07bab2 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -260,8 +260,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; } -else -{ +else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 1ea06eba9e9..5b9079f9d72 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -173,8 +173,7 @@ if ($resql) $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; } - else - { + else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -312,8 +311,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 93065219248..991d039d1fb 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -104,8 +104,7 @@ if ($mode != 'sconly') $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 1); } -else -{ +else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 0); } @@ -241,8 +240,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''.price($totalpaye).""; print ""; } - else - { + else { dol_print_error($db); } print ''; @@ -357,8 +355,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); } - else - { + else { dol_print_error($db); } } @@ -380,8 +377,7 @@ elseif ($mysoc->localtax2_assuj == "1") $j = 2; $numlt = 3; } -else -{ +else { $j = 0; $numlt = 0; } @@ -452,8 +448,7 @@ while ($j < $numlt) print ""; $db->free($result); } - else - { + else { dol_print_error($db); } } @@ -566,8 +561,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) print "
"; } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 6c1439d5466..74cc0d594e5 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -197,8 +197,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 463d9ea699f..b688bd17907 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -71,8 +71,7 @@ if ($action == 'validate' && $user->rights->deplacement->creer) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -89,8 +88,7 @@ elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -104,8 +102,7 @@ elseif ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->depla header("Location: index.php"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -150,19 +147,16 @@ elseif ($action == 'add' && $user->rights->deplacement->creer) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } - else - { + else { $action = 'create'; } } - else - { + else { header("Location: index.php"); exit; } @@ -190,13 +184,11 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -413,8 +405,7 @@ elseif ($id) print ''; } - else - { + else { /* * Confirm delete trip */ @@ -493,8 +484,7 @@ elseif ($id) { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); } - else - { + else { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0); } print ''; @@ -529,8 +519,7 @@ elseif ($id) { print ''.$langs->trans('Modify').''; } - else - { + else { print ''.$langs->trans('Modify').''; } } @@ -541,8 +530,7 @@ elseif ($id) { print ''.$langs->trans('Validate').''; } - else - { + else { print ''.$langs->trans('Validate').''; } } @@ -553,8 +541,7 @@ elseif ($id) { print ''.$langs->trans('ClassifyRefunded').''; } - else - { + else { print ''.$langs->trans('ClassifyRefunded').''; } } @@ -563,16 +550,14 @@ elseif ($id) { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } print ''; } } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index ec4610179e2..8051d074db5 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -200,15 +200,13 @@ class Deplacement extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return $result; } } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -268,8 +266,7 @@ class Deplacement extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -313,8 +310,7 @@ class Deplacement extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -339,8 +335,7 @@ class Deplacement extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -461,8 +456,7 @@ class Deplacement extends CommonObject $i++; } } - else - { + else { dol_print_error($this->db); } @@ -508,8 +502,7 @@ class Deplacement extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 2cef0b3e6cd..4ad2044c0f1 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -124,8 +124,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 9d45bafd20f..9ed6e430c4c 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -193,8 +193,7 @@ if ($result) $i++; } } - else - { + else { print ''.$langs->trans("None").''; } print '
'; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index a4cc8f24019..1ebaeb5c6fa 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -197,8 +197,7 @@ if ($resql) print "\n"; $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index cf745b784fc..91c6546a83c 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -168,8 +168,7 @@ if (!$user->rights->societe->client->voir || $user->socid) if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index cad443940f4..8256aeacc5a 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -239,8 +239,7 @@ if (empty($reshook)) $action = "create"; } } - else - { + else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -253,8 +252,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); exit; } - else - { + else { $db->rollback(); $error++; @@ -357,8 +355,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -381,8 +378,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -419,14 +415,12 @@ if (empty($reshook)) $db->commit(); $object->fetch($object->id); // Reload lines } - else - { + else { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); } } - else - { + else { $db->rollback(); setEventMessages($line->error, $line->errors, 'errors'); } @@ -467,8 +461,7 @@ if (empty($reshook)) $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } - else - { + else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -579,8 +572,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } - else - { + else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -604,8 +596,7 @@ if (empty($reshook)) $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; } - else - { + else { $desc = $prod->description; } @@ -641,8 +632,7 @@ if (empty($reshook)) $type = $prod->type; $fk_unit = $prod->fk_unit; } - else - { + else { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); @@ -673,8 +663,7 @@ if (empty($reshook)) $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } - else - { + else { // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); @@ -739,8 +728,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } @@ -948,8 +936,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1145,8 +1132,7 @@ if ($action == 'create') print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); print ""; } - else - { + else { print ''; } @@ -1199,13 +1185,11 @@ if ($action == 'create') print ''; print "\n"; } - else - { + else { dol_print_error('', "Error, no invoice ".$object->id); } } -else -{ +else { /* * View mode */ @@ -1329,8 +1313,7 @@ else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); } - else - { + else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); } } else { @@ -1351,8 +1334,7 @@ else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } - else - { + else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -1460,8 +1442,7 @@ else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } - else - { + else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -1487,8 +1468,7 @@ else $select = 'select;'.implode(',', $list); print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); } - else - { + else { print $object->modelpdf; } print ""; @@ -1537,14 +1517,12 @@ else print ''; print ''; } - else - { + else { if ($object->frequency > 0) { print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); } - else - { + else { print $langs->trans("NotARecurringInvoiceTemplate"); } } @@ -1556,8 +1534,7 @@ else { print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); } - else - { + else { print $langs->trans("NextDateToExecution"); } print ''; @@ -1570,8 +1547,7 @@ else { if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); } - else - { + else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print ''; @@ -1583,8 +1559,7 @@ else { print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); } - else - { + else { print $langs->trans("MaxPeriodNumber"); } print ''; @@ -1592,8 +1567,7 @@ else { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer); } - else - { + else { print ''; } print ''; @@ -1603,8 +1577,7 @@ else print ''; if ($action == 'auto_validate' || $object->frequency > 0) print $form->editfieldkey($langs->trans("StatusOfGeneratedInvoices"), 'auto_validate', $object->auto_validate, $object, $user->rights->facture->creer); - else - print $langs->trans("StatusOfGeneratedInvoices"); + else print $langs->trans("StatusOfGeneratedInvoices"); print ''; $select = 'select;0:'.$langs->trans('BillStatusDraft').',1:'.$langs->trans('BillStatusValidated'); if ($action == 'auto_validate' || $object->frequency > 0) @@ -1619,8 +1592,7 @@ else print ''; if ($action == 'generate_pdf' || $object->frequency > 0) print $form->editfieldkey($langs->trans("StatusOfGeneratedDocuments"), 'generate_pdf', $object->generate_pdf, $object, $user->rights->facture->creer); - else - print $langs->trans("StatusOfGeneratedDocuments"); + else print $langs->trans("StatusOfGeneratedDocuments"); print ''; print ''; $select = 'select;0:'.$langs->trans('DoNotGenerateDoc').',1:'.$langs->trans('AutogenerateDoc'); @@ -1631,8 +1603,7 @@ else print ''; print ''; } - else - { + else { print ''; } @@ -1734,20 +1705,17 @@ else { print ''; } - else - { + else { if (empty($object->frequency) || $object->date_when <= $today) { print ''; } - else - { + else { print ''; } } } - else - { + else { print ''; } } @@ -1758,8 +1726,7 @@ else { print ''; } - else - { + else { print ''; } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ab2262844bf..68b1a6e91df 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -619,8 +619,7 @@ if (empty($reshook)) } } } - else - { + else { //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') { @@ -696,8 +695,7 @@ if (empty($reshook)) if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { if (count($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, $object->errors, 'errors'); } @@ -972,8 +970,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -981,8 +978,7 @@ if (empty($reshook)) $db->commit(); } } - else - { + else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } @@ -1176,8 +1172,7 @@ if (empty($reshook)) $searchPreviousInvoice = false; // find, exit; break; } - else - { + else { $lineIndex--; // go to previous invoice in cycle } } @@ -1470,8 +1465,7 @@ if (empty($reshook)) $amountdeposit[$tva] += $am / (1 + $tva / 100); // Convert into HT for the addline } } - else - { + else { if ($typeamount == 'amount') { $amountdeposit[0] = $valuedeposit; @@ -1725,8 +1719,7 @@ if (empty($reshook)) $error++; } } - else - { // If some invoice's lines coming from page + else { // If some invoice's lines coming from page $id = $object->create($user); for ($i = 1; $i <= $NBLINES; $i++) { @@ -1853,8 +1846,7 @@ if (empty($reshook)) { $mesg = $object->error; } - else - { + else { $nextSituationInvoice = new Facture($db); $nextSituationInvoice->fetch($id); @@ -1895,8 +1887,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit(); } - else - { + else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -1922,8 +1913,7 @@ if (empty($reshook)) $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } - else - { + else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -1971,8 +1961,7 @@ if (empty($reshook)) } $error++; } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -1999,8 +1988,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; } - else - { + else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error++; } @@ -2065,8 +2053,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } - else - { + else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -2357,8 +2344,7 @@ if (empty($reshook)) } $error++; } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -2458,8 +2444,7 @@ if (empty($reshook)) $mesg = $langs->trans("Line").' '.$i.' : '.$langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $result = -1; - } else - $object->update_percent($line, $_POST['all_progress']); + } else $object->update_percent($line, $_POST['all_progress']); } } } @@ -2540,8 +2525,7 @@ if (empty($reshook)) $searchPreviousInvoice = false; // find, exit; break; } - else - { + else { $lineIndex--; // go to previous invoice in cycle } } @@ -2569,18 +2553,15 @@ if (empty($reshook)) setEventMessages($langs->trans('Updated'), '', 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); } - else - { + else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors'); } } - else - { + else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors'); } } - else - { + else { setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors'); } } @@ -2875,8 +2856,7 @@ if ($action == 'create') $expesrc->fetch_optionals(); $object->array_options = $expesrc->array_options; } - else - { + else { $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); @@ -2895,8 +2875,7 @@ if ($action == 'create') } } } - else - { + else { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; @@ -2979,8 +2958,7 @@ if ($action == 'create') print ''; print ''."\n"; } - else - { + else { print ''.$langs->trans('Customer').''; print ''; print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); @@ -3204,8 +3182,7 @@ if ($action == 'create') print ''; } } - else - { + else { if (!empty($conf->global->INVOICE_USE_SITUATION)) { print '
'; @@ -3311,8 +3288,7 @@ if ($action == 'create') print '
'; } } - else - { + else { print '
'; if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = ' '; else $tmp = ' '; @@ -3790,8 +3766,7 @@ elseif ($id > 0 || !empty($ref)) ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); } - else - { + else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); } } else { @@ -4128,8 +4103,7 @@ elseif ($id > 0 || !empty($ref)) foreach ($facidavoir as $id) { if ($i == 0) print ' '; - else - print ','; + else print ','; $facavoir = new Facture($db); $facavoir->fetch($id); print $facavoir->getNomUrl(1); @@ -4274,8 +4248,7 @@ elseif ($id > 0 || !empty($ref)) { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); } - else - { + else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT'); } print ''; @@ -4339,8 +4312,7 @@ elseif ($id > 0 || !empty($ref)) { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } - else - { + else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -4362,8 +4334,7 @@ elseif ($id > 0 || !empty($ref)) { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } - else - { + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -4377,7 +4348,7 @@ elseif ($id > 0 || !empty($ref)) $displayWarranty = false; } - if($displayWarranty) { + if ($displayWarranty) { // Retained Warranty print ''; print ''; @@ -4433,8 +4403,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; } - else - { + else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); if (!$displayWarranty) { print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); @@ -4468,8 +4437,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; } - else - { + else { print dol_print_date($object->retained_warranty_date_limit, 'day'); } print ''; @@ -4831,8 +4799,7 @@ elseif ($id > 0 || !empty($ref)) print ''; $resteapayeraffiche = $resteapayer; @@ -4928,8 +4895,7 @@ elseif ($id > 0 || !empty($ref)) { $retainedWarranty = $total_global_ttc * $object->retained_warranty / 100; } - else - { + else { // Because one day retained warranty could be used on standard invoices $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; } @@ -5119,8 +5085,7 @@ elseif ($id > 0 || !empty($ref)) } } } - else - { + else { print ''.$langs->trans('Modify').''; } } @@ -5159,8 +5124,7 @@ elseif ($id > 0 || !empty($ref)) } else { if ($usercansend) { print ''.$langs->trans('SendMail').''; - } else - print ''.$langs->trans('SendMail').''; + } else print ''.$langs->trans('SendMail').''; } } } @@ -5179,13 +5143,11 @@ elseif ($id > 0 || !empty($ref)) print ''.$langs->trans('MakeWithdrawRequest').''; } } - else - { + else { //print ''.$langs->trans("MakeWithdrawRequest").''; } } - else - { + else { //print ''.$langs->trans("MakeWithdrawRequest").''; } } @@ -5220,8 +5182,7 @@ elseif ($id > 0 || !empty($ref)) { print ''.$langs->trans('DoPaymentBack').''; } - else - { + else { print ''.$langs->trans('DoPaymentBack').''; } } @@ -5261,16 +5222,14 @@ elseif ($id > 0 || !empty($ref)) // If one payment or one credit note was linked to this invoice print ''.$langs->trans('ClassifyPaidPartially').''; } - else - { + else { if (empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) { if ($objectidnext) { print ''.$langs->trans('ClassifyCanceled').''; } - else - { + else { print ''.$langs->trans('ClassifyCanceled').''; } } @@ -5333,8 +5292,7 @@ elseif ($id > 0 || !empty($ref)) { print ''.$langs->trans("RemoveSituationFromCycle").''; } - else - { + else { print ''.$langs->trans("RemoveSituationFromCycle").''; } } @@ -5375,8 +5333,7 @@ elseif ($id > 0 || !empty($ref)) { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } } else { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 85da9cd5c37..d56d1b5cfef 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -549,8 +549,7 @@ class Invoices extends DolibarrApi if ($updateRes > 0) { return $this->get($id); } - else - { + else { throw new RestException(405, $this->invoice->error); } } @@ -1125,8 +1124,7 @@ class Invoices extends DolibarrApi { $this->db->commit(); } - else - { + else { $this->db->rollback(); throw new RestException(500, 'Could not set paid'); } @@ -1134,8 +1132,7 @@ class Invoices extends DolibarrApi $this->db->commit(); } } - else - { + else { $this->db->rollback(); throw new RestException(500, 'Discount creation error'); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 71be89f30f5..904f59ea432 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -378,7 +378,7 @@ class FactureRec extends CommonInvoice } } } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -395,21 +395,18 @@ class FactureRec extends CommonInvoice { $this->db->rollback(); } - else - { + else { $this->db->commit(); return $this->id; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); return -1; } @@ -461,8 +458,7 @@ class FactureRec extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -585,15 +581,13 @@ class FactureRec extends CommonInvoice } return 1; } - else - { + else { $this->error = 'Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql; dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR); return -2; } } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -723,8 +717,7 @@ class FactureRec extends CommonInvoice $this->db->free($result); return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -3; } @@ -767,14 +760,12 @@ class FactureRec extends CommonInvoice $res = $this->deleteExtraFields(); if ($res < 0) $error = -4; } - else - { + else { $this->error = $this->db->lasterror(); $error = -1; } } - else - { + else { $this->error = $this->db->lasterror(); $error = -2; } @@ -784,8 +775,7 @@ class FactureRec extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return $error; } @@ -861,8 +851,7 @@ class FactureRec extends CommonInvoice { $pu = $pu_ht; } - else - { + else { $pu = $pu_ttc; } @@ -970,8 +959,7 @@ class FactureRec extends CommonInvoice $this->update_price(); return $lineId; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1046,8 +1034,7 @@ class FactureRec extends CommonInvoice { $pu = $pu_ht; } - else - { + else { $pu = $pu_ttc; } @@ -1132,8 +1119,7 @@ class FactureRec extends CommonInvoice $this->update_price(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1226,8 +1212,7 @@ class FactureRec extends CommonInvoice if ($num) $this->output .= $langs->trans("FoundXQualifiedRecurringInvoiceTemplate", $num)."\n"; - else - $this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); + else $this->output .= $langs->trans("NoQualifiedRecurringInvoiceTemplateFound"); $saventity = $conf->entity; @@ -1289,8 +1274,7 @@ class FactureRec extends CommonInvoice } } } - else - { + else { $error++; $this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n"; $this->errors[] = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity; @@ -1304,8 +1288,7 @@ class FactureRec extends CommonInvoice $nb_create++; $this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n"; } - else - { + else { $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } @@ -1435,8 +1418,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); } @@ -1457,8 +1439,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); } @@ -1480,8 +1461,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); @@ -1506,8 +1486,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); @@ -1532,8 +1511,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); @@ -1559,8 +1537,7 @@ class FactureRec extends CommonInvoice $labelStatus = $langs->trans('Active'); } } - else - { + else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); @@ -1672,7 +1649,7 @@ class FactureRec extends CommonInvoice $line->total_tva = 9.8; $line->remise_percent = 50; } - else // (product line) + else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -1762,8 +1739,7 @@ class FactureRec extends CommonInvoice if (!empty($unit)) $this->unit_frequency = $unit; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1795,8 +1771,7 @@ class FactureRec extends CommonInvoice if ($increment_nb_gen_done > 0) $this->nb_gen_done++; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1828,8 +1803,7 @@ class FactureRec extends CommonInvoice $this->nb_gen_max = $nb; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1859,8 +1833,7 @@ class FactureRec extends CommonInvoice $this->auto_validate = $validate; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1890,8 +1863,7 @@ class FactureRec extends CommonInvoice $this->generate_pdf = $validate; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1921,8 +1893,7 @@ class FactureRec extends CommonInvoice $this->modelpdf = $model; return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -2068,8 +2039,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->db->free($result); return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -3; } @@ -2150,8 +2120,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index fd6a6d32642..55adb5eb138 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -679,7 +679,7 @@ class Facture extends CommonInvoice } } } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -988,28 +988,24 @@ class Facture extends CommonInvoice $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -4; } } - else - { + else { $this->error = $langs->trans('FailedToUpdatePrice'); $this->db->rollback(); return -3; } } - else - { + else { dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -1241,8 +1237,7 @@ class Facture extends CommonInvoice $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -1646,15 +1641,13 @@ class Facture extends CommonInvoice } return 1; } - else - { + else { $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return 0; } } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1776,8 +1769,7 @@ class Facture extends CommonInvoice $this->db->free($result); return 1; } - else - { + else { $this->error = $this->db->error(); return -3; } @@ -1816,8 +1808,7 @@ class Facture extends CommonInvoice { $this->tab_previous_situation_invoice[] = $invoice; } - else - { + else { $this->tab_next_situation_invoice[] = $invoice; } } @@ -1934,8 +1925,7 @@ class Facture extends CommonInvoice $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -2022,22 +2012,19 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->error = $facligne->error; $this->db->rollback(); return -1; } } - else - { + else { $this->error = $facligne->error; $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); return -3; } @@ -2063,8 +2050,7 @@ class Facture extends CommonInvoice $sql = 'UPDATE '.MAIN_DB_PREFIX.'facture'; if (empty($ref_client)) $sql .= ' SET ref_client = NULL'; - else - $sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\''; + else $sql .= ' SET ref_client = \''.$this->db->escape($ref_client).'\''; $sql .= ' WHERE rowid = '.$this->id; dol_syslog(__METHOD__.' this->id='.$this->id.', ref_client='.$ref_client, LOG_DEBUG); @@ -2095,8 +2081,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2261,22 +2246,19 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -6; } } - else - { + else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -4; } } - else - { + else { $this->db->rollback(); return -2; } @@ -2322,8 +2304,7 @@ class Facture extends CommonInvoice if ($result < 0) $error++; // End call triggers } - else - { + else { $error++; $this->error = $this->db->lasterror(); } @@ -2333,14 +2314,12 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { return 0; } } @@ -2377,8 +2356,7 @@ class Facture extends CommonInvoice if ($result < 0) $error++; // End call triggers } - else - { + else { $error++; $this->error = $this->db->error(); dol_print_error($this->db); @@ -2389,8 +2367,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -2446,15 +2423,13 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -2; @@ -2573,8 +2548,7 @@ class Facture extends CommonInvoice } $num = $this->getNextNumRef($this->thirdparty); } - else - { + else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -2804,8 +2778,7 @@ class Facture extends CommonInvoice } } } - else - { + else { $error++; } @@ -2814,8 +2787,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -2943,14 +2915,12 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3070,8 +3040,7 @@ class Facture extends CommonInvoice { $pu = $pu_ht; } - else - { + else { $pu = $pu_ttc; } @@ -3213,22 +3182,19 @@ class Facture extends CommonInvoice $this->db->commit(); return $this->line->id; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->line->error; $this->db->rollback(); return -2; } } - else - { + else { dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -3444,15 +3410,13 @@ class Facture extends CommonInvoice $this->db->commit(); return $result; } - else - { + else { $this->error = $this->line->error; $this->db->rollback(); return -1; } } - else - { + else { $this->error = "Invoice statut makes operation forbidden"; return -2; } @@ -3573,15 +3537,13 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } } - else - { + else { $this->db->rollback(); $this->error = $line->error; return -1; @@ -3640,8 +3602,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3709,8 +3670,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3869,8 +3829,7 @@ class Facture extends CommonInvoice } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -3933,8 +3892,7 @@ class Facture extends CommonInvoice { $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; } - else - { + else { $ga[$i]['id'] = $obj->fid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -3944,8 +3902,7 @@ class Facture extends CommonInvoice } return $ga; } - else - { + else { dol_print_error($this->db); return -1; } @@ -3994,8 +3951,7 @@ class Facture extends CommonInvoice //print_r($return); return $return; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -4042,8 +3998,7 @@ class Facture extends CommonInvoice $sqlSit .= " ORDER BY fs.situation_counter"; $sql .= " AND ( f.type != ".self::TYPE_SITUATION." OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir } - else - { + else { $sql .= " AND f.type != ".self::TYPE_SITUATION; // Type non 5 si facture non avoir } @@ -4069,8 +4024,7 @@ class Facture extends CommonInvoice return $return; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -4147,8 +4101,7 @@ class Facture extends CommonInvoice $error++; } } - else - { + else { $this->error = 'WithdrawRequestErrorNilAmount'; dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount'); $error++; @@ -4167,22 +4120,19 @@ class Facture extends CommonInvoice if ($error) return -1; return 1; } - else - { + else { $this->error = "A request already exists"; dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); return 0; } } - else - { + else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::demandeprelevement Erreur -2'); return -2; } } - else - { + else { $this->error = "Status of invoice does not allow this"; dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id"); return -3; @@ -4207,8 +4157,7 @@ class Facture extends CommonInvoice { return 0; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error); return -1; @@ -4274,8 +4223,7 @@ class Facture extends CommonInvoice return $response; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4419,7 +4367,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_tva = 19.6; $line->remise_percent = 50; } - else // (product line) + else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -4506,8 +4454,7 @@ class Facture extends CommonInvoice $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4669,8 +4616,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -4760,8 +4706,7 @@ class Facture extends CommonInvoice { $hasDelay = 1; } - else - { + else { $hasDelay = 0; } } @@ -4852,8 +4797,7 @@ class Facture extends CommonInvoice return -1; } } - else - { + else { // Because one day retained warranty could be used on standard invoices $retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100; } @@ -4890,15 +4834,13 @@ class Facture extends CommonInvoice $this->retained_warranty = floatval($value); return 1; } - else - { + else { dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } } - else - { + else { dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -4933,15 +4875,13 @@ class Facture extends CommonInvoice $this->retained_warranty_date_limit = $timestamp; return 1; } - else - { + else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } } - else - { + else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -5123,8 +5063,7 @@ class FactureLigne extends CommonInvoiceLine return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -5178,8 +5117,7 @@ class FactureLigne extends CommonInvoiceLine { return $result; } - else - { + else { $this->pa_ht = $result; } } @@ -5296,8 +5234,7 @@ class FactureLigne extends CommonInvoiceLine return -3; } } - else - { + else { $result = $discount->link_to_invoice($this->rowid, 0); if ($result < 0) { @@ -5308,16 +5245,14 @@ class FactureLigne extends CommonInvoiceLine } } } - else - { + else { $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } } - else - { + else { $this->error = $discount->error; dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); @@ -5340,8 +5275,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -5395,8 +5329,7 @@ class FactureLigne extends CommonInvoiceLine { return $result; } - else - { + else { $this->pa_ht = $result; } } @@ -5475,8 +5408,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -5519,8 +5451,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -5561,8 +5492,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 427daf445c5..1fddf20b023 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -146,8 +146,7 @@ class PaymentTerm // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -203,8 +202,7 @@ class PaymentTerm // extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -240,8 +238,7 @@ class PaymentTerm // extends CommonObject $this->db->free($resql); return $ret; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -306,8 +303,7 @@ class PaymentTerm // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -346,8 +342,7 @@ class PaymentTerm // extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -397,8 +392,7 @@ class PaymentTerm // extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 8eb47268186..77ff0f813c3 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -70,15 +70,13 @@ if ($action == 'addcontact' && $user->rights->facture->creer) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -91,8 +89,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer) { $result = $object->swapContactStatus(GETPOST('ligne')); } - else - { + else { dol_print_error($db); } } @@ -208,8 +205,7 @@ if ($id > 0 || !empty($ref)) if ($res) break; } } - else - { + else { // Record not found print "ErrorRecordNotFound"; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index a901b985342..7e95b92cc3d 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -182,13 +182,11 @@ if ($id > 0 || !empty($ref)) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } - else - { + else { dol_print_error($db); } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 65e9044f4f7..8275dbcf450 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -610,8 +610,7 @@ if ($resql) { if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); } - else - { + else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print ''; @@ -660,13 +659,11 @@ if ($resql) print ''; print $langs->trans("CreateBill").''; } - else - { + else { print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); } } - else - { + else { print " "; } if (!$i) $totalarray['nbfield']++; @@ -677,8 +674,7 @@ if ($resql) $i++; } } - else - { + else { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } print ''; @@ -694,8 +690,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8b9e204f17e..7b3025db810 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -314,8 +314,7 @@ elseif ($massaction == 'withdrawrequest') $error++; setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); } - else - { + else { //Checking error $error = 0; @@ -387,8 +386,7 @@ elseif ($massaction == 'withdrawrequest') $db->commit(); $nbwithdrawrequestok++; } - else - { + else { $db->rollback(); setEventMessages($aBill->error, $aBill->errors, 'errors'); } @@ -516,8 +514,7 @@ if ($search_status != '-1' && $search_status != '') if ($search_status == '2') $sql .= " AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) if ($search_status == '3') $sql .= " AND f.fk_statut = 3"; // abandonned } - else - { + else { $sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } @@ -564,8 +561,7 @@ if (!$sall) foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); } } -else -{ +else { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } @@ -1220,8 +1216,7 @@ if ($resql) { print $obj->ref; } - else - { + else { print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); } @@ -1317,8 +1312,7 @@ if ($resql) { print $thirdpartystatic->name; } - else - { + else { print $thirdpartystatic->getNomUrl(1, 'customer'); } print ''; @@ -1620,8 +1614,7 @@ if ($resql) print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 74de1c640d4..109231a240d 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -87,8 +87,7 @@ if (empty($reshook)) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -293,13 +292,11 @@ if ($object->id > 0) { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate'); } - else - { + else { print dol_print_date($object->date, 'daytext'); } } - else - { + else { print dol_print_date($object->date, 'daytext'); } print ''; @@ -319,13 +316,11 @@ if ($object->id > 0) { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); } - else - { + else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); } } - else - { + else { print ' '; } print ''; @@ -344,16 +339,14 @@ if ($object->id > 0) { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm'); } - else - { + else { print dol_print_date($object->date_lim_reglement, 'daytext'); if ($object->hasDelay()) { print img_warning($langs->trans('Late')); } } } - else - { + else { print ' '; } print ''; @@ -370,8 +363,7 @@ if ($object->id > 0) { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id'); } - else - { + else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -389,8 +381,7 @@ if ($object->id > 0) { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); } - else - { + else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -503,8 +494,7 @@ if ($object->id > 0) $num = $db->num_rows($result_sql); $numopen = $num; } - else - { + else { dol_print_error($db); } @@ -521,8 +511,7 @@ if ($object->id > 0) $obj = $db->fetch_object($result_sql); if ($obj) $pending = $obj->amount; } - else - { + else { dol_print_error($db); } @@ -550,18 +539,15 @@ if ($object->id > 0) print ''; print ''; } - else - { + else { print ''.$langs->trans("MakeWithdrawRequest").''; } } - else - { + else { print ''.$langs->trans("MakeWithdrawRequest").''; } } - else - { + else { if ($num == 0) { if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; @@ -635,8 +621,7 @@ if ($object->id > 0) $db->free($result_sql); } - else - { + else { dol_print_error($db); } @@ -697,8 +682,7 @@ if ($object->id > 0) $db->free($result); } - else - { + else { dol_print_error($db); } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 284186b73ce..d0c7eacffc6 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -32,7 +32,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; -if(!empty($conf->category->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +if (!empty($conf->category->enabled)) require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; $WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); @@ -60,7 +60,7 @@ if ($user->socid > 0) $nowyear = strftime("%Y", dol_now()); $year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear; -if(!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2; +if (!empty($conf->global->INVOICE_STATS_GRAPHS_SHOW_2_YEARS)) $startyear=$year-2; else $startyear=$year-1; $endyear = $year; @@ -68,7 +68,7 @@ $endyear = $year; /* * View */ -if(!empty($conf->category->enabled)) $langs->load('categories'); +if (!empty($conf->category->enabled)) $langs->load('categories'); $form = new Form($db); $formcompany = new FormCompany($db); $formother = new FormOther($db); @@ -181,8 +181,7 @@ if (!$user->rights->societe->client->voir || $user->socid) if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index a02a0fc1682..571a00d6b47 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -79,8 +79,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) $total = $total + $sign * $objectlink->total_ht; echo price($objectlink->total_ht); } - else - { + else { echo ''.price($objectlink->total_ht).''; } } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 00b4987ad66..2efe20a2fc5 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -215,15 +215,13 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; print ''; } - else - { + else { print ''; } print "
'; @@ -4398,8 +4369,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; } - else - { + else { print price($object->retained_warranty).'%'; } print '
'; if ($object->type != Facture::TYPE_DEPOSIT) print $langs->trans('AlreadyPaidNoCreditNotesNoDeposits'); - else - print $langs->trans('AlreadyPaid'); + else print $langs->trans('AlreadyPaid'); print ' :'.price($totalpaye).' 
'.$langs->trans("NoRecordFound").'
'.price($tot_ttc).'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -303,15 +301,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.price($tot_ttc).''; print ''; } - else - { + else { print ''.$langs->trans("NoInvoice").''; } print "

"; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -429,8 +425,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $i++; } } - else - { + else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; @@ -438,8 +433,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -530,16 +524,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $i++; } } - else - { + else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; } - else - { + else { dol_print_error($db); } } @@ -609,8 +601,7 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire) $i++; } } - else - { + else { print ''.$langs->trans("None").''; } print '
'; @@ -687,15 +678,13 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ' '; print ''; } - else - { + else { print ''.$langs->trans("None").''; } print "
"; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -816,8 +805,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user } $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -940,8 +928,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print ' '; print ''; } - else - { + else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; @@ -949,8 +936,7 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -1050,16 +1036,14 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ' '; print ''; } - else - { + else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 1459bbf2402..91d855d4454 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -91,7 +91,7 @@ $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescPurchasesJournal").'
'; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); -else $description .= $langs->trans("DepositsAreIncluded"); +else $description .= $langs->trans("DepositsAreIncluded"); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink); @@ -239,8 +239,7 @@ foreach ($tabfac as $key => $val) print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; } - else - { + else { print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; } diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 98bd5e989f7..a7eb09de31a 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -93,7 +93,7 @@ $exportlink = ''; $builddate = dol_now(); $description = $langs->trans("DescSellsJournal").'
'; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); -else $description .= $langs->trans("DepositsAreIncluded"); +else $description .= $langs->trans("DepositsAreIncluded"); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); report_header($name, '', $period, $periodlink, $description, $builddate, $exportlink); @@ -269,8 +269,7 @@ foreach ($tabfac as $key => $val) print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; } - else - { + else { print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index 51275c7159f..e5a20b5486b 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -81,8 +81,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) header("Location: list.php?localTaxType=".$lttype); exit; } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $_GET["action"] = "create"; @@ -114,21 +113,18 @@ if ($action == 'delete') header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt); exit; } - else - { + else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -290,8 +286,7 @@ if ($id) { print ''.$langs->trans("Delete").''; } - else - { + else { print ''.$langs->trans("Delete").''; } print ""; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 6aa7c2b1a87..59adc220c8f 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -138,14 +138,12 @@ class Localtax extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -207,8 +205,7 @@ class Localtax extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -271,8 +268,7 @@ class Localtax extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -378,14 +374,12 @@ class Localtax extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -419,14 +413,12 @@ class Localtax extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -462,14 +454,12 @@ class Localtax extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -548,8 +538,7 @@ class Localtax extends CommonObject { $this->update_fk_bank($bank_line_id); } - else - { + else { $this->error = $acc->error; $ok = 0; } @@ -568,21 +557,18 @@ class Localtax extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -605,8 +591,7 @@ class Localtax extends CommonObject if ($result) { return 1; } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 61a11a042f2..12112766c24 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -54,16 +54,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } - else - { + else { $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; 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 - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -202,8 +200,7 @@ if ($calc == 0 || $calc == 2) { $intra = $langs->trans('Unknown'); } - else - { + else { $intra = ''; } } @@ -230,15 +227,13 @@ if ($calc == 0 || $calc == 2) print ''.price($total).''; print ''; } - else - { + else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; elseif ($coll_list == -2) print ''.$langs->trans("FeatureNotYetAvailable").''; - else - print ''.$langs->trans("Error").''; + else print ''.$langs->trans("Error").''; } } @@ -275,8 +270,7 @@ if ($calc == 0 || $calc == 1) { { $intra = $langs->trans('Unknown'); } - else - { + else { $intra = ''; } } @@ -305,15 +299,13 @@ if ($calc == 0 || $calc == 1) { print ''; } - else - { + else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; elseif ($coll_list == -2) print ''.$langs->trans("FeatureNotYetAvailable").''; - else - print ''.$langs->trans("Error").''; + else print ''.$langs->trans("Error").''; } } diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index a08ac99d6bd..b8a906ac818 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -53,14 +53,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else - { + else { $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; } } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -153,8 +151,7 @@ function pt($db, $sql, $date) $previousmode = ''; $previousmonth = ''; } - else - { + else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -389,8 +386,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc //'link' =>$expensereport->getNomUrl(1) ); } - else - { + else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 47a0f44be47..58ec8cb090e 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -96,8 +96,7 @@ if ($result) print ""; $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 8e2e871251f..45d34f10cce 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -64,16 +64,14 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else - { + else { $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; 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 - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -222,11 +220,9 @@ if (!is_array($x_coll) || !is_array($x_paye)) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; elseif ($x_coll == -2) print ''.$langs->trans("FeatureNotYetAvailable").''; - else - print ''.$langs->trans("Error").''; + else print ''.$langs->trans("Error").''; } -else -{ +else { $x_both = array(); //now, from these two arrays, get another array with one rate per line @@ -373,8 +369,7 @@ else print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); } - else - { + else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) @@ -533,8 +528,7 @@ else print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); } - else - { + else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); @@ -573,8 +567,7 @@ else { print $langs->trans("NA"); } - else - { + else { print price(price2num($fields['payment_amount'], 'MT')); if (isset($fields['payment_amount'])) { print ' ('.round($ratiopaymentinvoice * 100, 2).'%)'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 4a7e387987c..5c0f258a091 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -313,8 +313,7 @@ if (empty($reshook)) header('Location: '.$loc); exit; } - else - { + else { $db->rollback(); } } @@ -504,8 +503,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $form->select_comptes($accountid, 'accountid', 0, '', 2); print ''; } - else - { + else { print ' '; } print "\n"; @@ -561,8 +559,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie { $sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation } - else - { + else { $sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes } // Sort invoices by date and serial number: the older one comes first @@ -666,8 +663,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; } - else - { + else { print ''; } @@ -711,8 +707,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; } - else - { + else { print ''; print ''; } @@ -747,8 +742,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; print ''; } - else - { + else { print ''; print ''; } @@ -804,8 +798,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } $db->free($resql); } - else - { + else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index e14581f6531..f67a2e2c12a 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -66,8 +66,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement) $db->commit(); $action = ''; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -88,14 +87,12 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> header("Location: ".$backtopage); exit; } - else - { + else { header("Location: list.php"); exit; } } - else - { + else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -132,8 +129,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); exit; } - else - { + else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -148,8 +144,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors'); } } @@ -163,8 +158,7 @@ if ($action == 'setdatep' && !empty($_POST['datepday'])) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); } } @@ -414,8 +408,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -446,8 +439,7 @@ if ($user->socid == 0 && $action == '') { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index eeb578ad731..44a160b35e0 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -80,8 +80,7 @@ if ($action == 'setdate' && $user->rights->banque->cheque) setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -99,8 +98,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -118,8 +116,7 @@ if ($action == 'setref' && $user->rights->banque->cheque) setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -150,13 +147,11 @@ if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->che header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); $action = 'new'; } @@ -171,8 +166,7 @@ if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banq header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -186,8 +180,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c header("Location: index.php"); exit; } - else - { + else { setEventMessages($paiement->error, $paiement->errors, 'errors'); } } @@ -213,8 +206,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -233,8 +225,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban //exit; $action = ''; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -262,8 +253,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) dol_print_error($db, $object->error); exit; } - else - { + else { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); exit; } @@ -315,8 +305,7 @@ if ($action == 'new') print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account'); } -else -{ +else { $result = $object->fetch($id, $ref); if ($result < 0) { @@ -510,8 +499,7 @@ if ($action == 'new') { print $paymentstatic->getNomUrl(1); } - else - { + else { print ' '; } print ''; @@ -522,8 +510,7 @@ if ($action == 'new') { print $accountlinestatic->getNomUrl(1); } - else - { + else { print ' '; } print ''; @@ -544,16 +531,14 @@ if ($action == 'new') { print ''; } - else - { + else { print ''.$langs->trans('NewCheckDepositOn', $account_label).''; } print '
'; print ''; } } -else -{ +else { $paymentstatic = new Paiement($db); $accountlinestatic = new AccountLine($db); $accountstatic = new Account($db); @@ -588,8 +573,7 @@ else print ''; print ''; } - else - { + else { print $object->date_bordereau ? dol_print_date($object->date_bordereau, 'day') : ' '; } @@ -700,8 +684,7 @@ else { print $paymentstatic->getNomUrl(1); } - else - { + else { print ' '; } print ''; @@ -712,8 +695,7 @@ else { print $accountlinestatic->getNomUrl(1); } - else - { + else { print ' '; } print ''; @@ -737,8 +719,7 @@ else $i++; } } - else - { + else { print ''; print $langs->trans("None"); print ''; @@ -756,8 +737,7 @@ else print ""; } - else - { + else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 746065647d5..9d252a7456e 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -121,8 +121,7 @@ class RemiseCheque extends CommonObject { $this->ref = "(PROV".$this->id.")"; } - else - { + else { $this->ref = $obj->ref; } } @@ -130,8 +129,7 @@ class RemiseCheque extends CommonObject return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -228,8 +226,7 @@ class RemiseCheque extends CommonObject } $this->db->free($resql); } - else - { + else { $this->errno = -1026; dol_syslog("RemiseCheque::Create Error ".$this->errno, LOG_ERR); } @@ -270,8 +267,7 @@ class RemiseCheque extends CommonObject } } } - else - { + else { $this->errno = -1; $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); @@ -289,8 +285,7 @@ class RemiseCheque extends CommonObject dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->id; } - else - { + else { $this->db->rollback(); dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->errno; @@ -342,8 +337,7 @@ class RemiseCheque extends CommonObject { $this->db->commit(); } - else - { + else { $this->db->rollback(); dol_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)"); } @@ -386,14 +380,12 @@ class RemiseCheque extends CommonObject $this->ref = $numref; $this->statut = 1; } - else - { + else { $this->errno = -1029; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } } - else - { + else { $this->errno = -1033; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } @@ -405,8 +397,7 @@ class RemiseCheque extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); dol_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR); return $this->errno; @@ -489,8 +480,7 @@ class RemiseCheque extends CommonObject return $numref; } - else - { + else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank")); return ""; @@ -545,8 +535,7 @@ class RemiseCheque extends CommonObject return $response; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -585,8 +574,7 @@ class RemiseCheque extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -665,16 +653,14 @@ class RemiseCheque extends CommonObject //$outputlangs->charset_output=$sav_charset_output; return 1; } - else - { + else { //$outputlangs->charset_output=$sav_charset_output; dol_syslog("Error"); dol_print_error($this->db, $docmodel->error); return 0; } } - else - { + else { $this->error = $langs->trans("ErrorFileDoesNotExists", $dir.$file); return -1; } @@ -721,8 +707,7 @@ class RemiseCheque extends CommonObject dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)"); } } - else - { + else { $this->errno = -1031; dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)"); } @@ -731,8 +716,7 @@ class RemiseCheque extends CommonObject { $this->db->commit(); } - else - { + else { $this->db->rollback(); dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)"); } @@ -762,8 +746,7 @@ class RemiseCheque extends CommonObject { $this->updateAmount(); } - else - { + else { $this->errno = -1032; dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)"); } @@ -839,30 +822,26 @@ class RemiseCheque extends CommonObject $this->db->commit(); return $rejectedPayment->id; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } } - else - { + else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -936,14 +915,12 @@ class RemiseCheque extends CommonObject $this->date_bordereau = $date; return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } } - else - { + else { return -2; } } @@ -971,14 +948,12 @@ class RemiseCheque extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } } - else - { + else { return -2; } } diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index c85553d59a8..7971a34db0d 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -77,8 +77,7 @@ if ($resql) { print ''; print "\n"; } -else -{ +else { dol_print_error($db); } @@ -141,8 +140,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index fe1f7c31050..cda8c2a679d 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -222,8 +222,7 @@ if ($resql) $i++; } } - else - { + else { print ''; print ''.$langs->trans("None").""; print ''; @@ -232,8 +231,7 @@ if ($resql) print ""; print "\n"; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 9b0ee645fc7..99250bd9373 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -201,14 +201,12 @@ class Paiement extends CommonObject $this->db->free($resql); return 1; } - else - { + else { $this->db->free($resql); return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -243,8 +241,7 @@ class Paiement extends CommonObject $amounts = &$this->amounts; $amounts_to_update = &$this->multicurrency_amounts; } - else - { + else { $amounts = &$this->multicurrency_amounts; $amounts_to_update = &$this->amounts; } @@ -283,8 +280,7 @@ class Paiement extends CommonObject $total = $totalamount; $mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value } - else - { + else { $total = $totalamount_converted; // Maybe use price2num with MT for the converted value $mtotal = $totalamount; } @@ -340,8 +336,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."); 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 - { + else { // If invoice is a down payment, we also convert down payment to discount if ($invoice->type == Facture::TYPE_DEPOSIT) { @@ -430,14 +425,12 @@ class Paiement extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } } - else - { + else { dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.'); } } @@ -450,8 +443,7 @@ class Paiement extends CommonObject // Fin appel triggers } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -464,8 +456,7 @@ class Paiement extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -502,8 +493,7 @@ class Paiement extends CommonObject return -1; } } - else - { + else { $this->db->rollback(); return -2; } @@ -568,8 +558,7 @@ class Paiement extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error; $this->db->rollback(); return -5; @@ -731,8 +720,7 @@ class Paiement extends CommonObject // Fin appel triggers } } - else - { + else { $this->error = $acc->error; $error++; } @@ -741,8 +729,7 @@ class Paiement extends CommonObject { $this->db->commit(); } - else - { + else { $this->db->rollback(); } } @@ -751,8 +738,7 @@ class Paiement extends CommonObject { return $bank_line_id; } - else - { + else { return -1; } } @@ -777,8 +763,7 @@ class Paiement extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::update_fk_bank '.$this->error); return -1; @@ -840,8 +825,7 @@ class Paiement extends CommonObject $this->db->commit(); return 0; } - else - { + else { $this->db->rollback(); return -2; } @@ -871,8 +855,7 @@ class Paiement extends CommonObject $this->num_payment = $this->db->escape($num); return 0; } - else - { + else { $this->error = 'Error -1 '.$this->db->error(); return -2; } @@ -896,8 +879,7 @@ class Paiement extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::valide '.$this->error); return -1; @@ -920,8 +902,7 @@ class Paiement extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::reject '.$this->error); return -1; @@ -966,8 +947,7 @@ class Paiement extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -1000,8 +980,7 @@ class Paiement extends CommonObject return $billsarray; } - else - { + else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1034,8 +1013,7 @@ class Paiement extends CommonObject return $amounts; } - else - { + else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getAmountsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1119,8 +1097,7 @@ class Paiement extends CommonObject return $numref; } - else - { + else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")); return ""; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 20401d81a1a..dbdf4f4675e 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -130,8 +130,7 @@ if (GETPOST("orphelins", "alpha")) $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; } -else -{ +else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql .= " p.statut, p.num_paiement as num_payment,"; $sql .= " c.code as paiement_code,"; @@ -161,7 +160,7 @@ else if ($userid) { if ($userid == -1) $sql .= " AND f.fk_user_author IS NULL"; - else $sql .= " AND f.fk_user_author = ".$userid; + else $sql .= " AND f.fk_user_author = ".$userid; } // Search criteria $sql .= dolSqlDateFilter("p.datep", $day, $month, $year); @@ -379,8 +378,7 @@ if ($resql) print ""; print "\n"; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 76a1ce72d76..66f239fdf96 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -71,8 +71,7 @@ if ($action == 'builddoc') { $outputlangs->charset_output = $sav_charset_output; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, $obj->error); } diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index 91ef2c215e6..b978fc8e218 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -127,8 +127,7 @@ if ($resql) { print ''.$langs->trans("PaymentStatusToValidShort").''; } - else - { + else { print "-"; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index 509e20f3613..d1b448c5932 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -142,8 +142,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y header('Location: '.$loc); exit; } - else - { + else { $db->rollback(); } } @@ -284,8 +283,7 @@ if ($action == 'create') { print ''.dol_print_date($objp->date_ech, 'day').''."\n"; } - else - { + else { print "!!!\n"; } @@ -306,8 +304,7 @@ if ($action == 'create') print ''; print ''; } - else - { + else { print '-'; } print ""; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 5fdfe327056..69b425356d1 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -67,8 +67,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char header("Location: ".DOL_URL_ROOT."/compta/sociales/payments.php?mode=sconly"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -284,8 +283,7 @@ if ($resql) print "\n"; $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -317,8 +315,7 @@ if ($action == '') { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index fd87dd5e447..d2611e8a354 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -159,14 +159,12 @@ if ($resql) $i++; } } - else - { + else { print ''.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).''; } print "
"; } -else -{ +else { dol_print_error($db); } @@ -221,8 +219,7 @@ if ($result) print "
"; $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index c7c717e702b..106f848f732 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -191,8 +191,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d81e101be3d..d5051e06bfa 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -409,8 +409,7 @@ if ($id > 0 || $ref) { print ''.$langs->trans("StatusRefused").''; } - else - { + else { print " "; } @@ -443,8 +442,7 @@ if ($id > 0 || $ref) $db->free($result); } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 0c21a3e6d2b..91a165ee454 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -152,20 +152,17 @@ class BonPrelevement extends CommonObject { $result = 0; } - else - { + else { $result = -1; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } } - else - { + else { $result = -2; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } } - else - { + else { $result = -3; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } @@ -209,13 +206,11 @@ class BonPrelevement extends CommonObject { $num = $this->db->num_rows($resql); } - else - { + else { $result = -1; } } - else - { + else { /* * No aggregate */ @@ -244,8 +239,7 @@ class BonPrelevement extends CommonObject $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $result = 0; } - else - { + else { dol_syslog(get_class($this)."::addline Error -2"); $result = -2; } @@ -321,14 +315,12 @@ class BonPrelevement extends CommonObject return 1; } - else - { + else { dol_syslog(get_class($this)."::Fetch Erreur aucune ligne retournee"); return -1; } } - else - { + else { return -2; } } @@ -397,16 +389,14 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::set_credite ROLLBACK "); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible "); return -2; } @@ -491,8 +481,7 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit AddPayment Error"); $error++; } - else - { + else { $result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', ''); if ($result < 0) { @@ -517,8 +506,7 @@ class BonPrelevement extends CommonObject $error++; } } - else - { + else { dol_syslog(get_class($this)."::set_infocredit Update Bons Error"); $error++; } @@ -534,27 +522,23 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; } - else - { + else { $this->db->rollback(); dol_syslog("bon-prelevment::set_infocredit ROLLBACK "); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible "); return -1025; } } - else - { + else { dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans "); return -1027; } } - else - { + else { return -1026; } } @@ -597,8 +581,7 @@ class BonPrelevement extends CommonObject // TODO Call trigger to create a notification using notification module } - else - { + else { $error++; } @@ -610,16 +593,14 @@ class BonPrelevement extends CommonObject return 0; } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT); return -2; } @@ -664,8 +645,7 @@ class BonPrelevement extends CommonObject { $row = $this->db->fetch_row($resql); if (!$amounts) $arr[$i] = $row[0]; - else - { + else { $arr[$i] = array( $row[0], $row[1] @@ -676,8 +656,7 @@ class BonPrelevement extends CommonObject } $this->db->free($resql); } - else - { + else { dol_syslog(get_class($this)."::getListInvoices Erreur"); } @@ -715,8 +694,7 @@ class BonPrelevement extends CommonObject return $obj->nb; } - else - { + else { $error = 1; dol_syslog(get_class($this)."::SommeAPrelever Erreur -1"); dol_syslog($this->db->error()); @@ -760,8 +738,7 @@ class BonPrelevement extends CommonObject return $obj->nb; } - else - { + else { $this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error(); return -1; } @@ -849,8 +826,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG); } - else - { + else { $error++; dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } @@ -895,26 +871,22 @@ class BonPrelevement extends CommonObject $i++; //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); } - else - { + else { dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } } - else - { + else { dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); } } - else - { + else { dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); } } } - else - { + else { dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); } } @@ -941,8 +913,7 @@ class BonPrelevement extends CommonObject { $ok = 1; } - else - { + else { print $langs->trans("ModeWarning"); //"Option for real mode was not set, we stop after this simulation\n"; } } @@ -1000,14 +971,12 @@ class BonPrelevement extends CommonObject $this->id = $prev_id; $this->ref = $ref; } - else - { + else { $error++; dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->lasterror(), LOG_ERR); } } - else - { + else { $error++; dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR); } @@ -1129,15 +1098,13 @@ class BonPrelevement extends CommonObject { $this->db->commit(); } - else - { + else { $this->db->rollback(); } return count($factures_prev); } - else - { + else { return 0; } } @@ -1198,8 +1165,7 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1301,8 +1267,7 @@ class BonPrelevement extends CommonObject { return 0; } - else - { + else { return -1; } } @@ -1327,8 +1292,7 @@ class BonPrelevement extends CommonObject { return 0; } - else - { + else { return -1; } } @@ -1359,8 +1323,7 @@ class BonPrelevement extends CommonObject { $result = 0; } - else - { + else { $result = -1; dol_syslog(get_class($this)."::AddNotification Error $result"); } @@ -1464,8 +1427,7 @@ class BonPrelevement extends CommonObject } $nbtotalDrctDbtTxInf = $i; } - else - { + else { fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers $result = -2; } @@ -1475,8 +1437,7 @@ class BonPrelevement extends CommonObject { $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); } - else - { + else { fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company } @@ -1543,8 +1504,7 @@ class BonPrelevement extends CommonObject $i++; } } - else - { + else { $result = -2; } @@ -1915,8 +1875,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; } - else - { + else { fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); $result = -2; } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index 88b612554df..accd64e2694 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -97,16 +97,14 @@ class LignePrelevement $this->bon_ref = $obj->ref; $this->bon_rowid = $obj->bon_rowid; } - else - { + else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0"); } $this->db->free($resql); } - else - { + else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid"); dol_syslog($this->db->error()); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 8c033353637..1edd942fc42 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -161,8 +161,7 @@ class RejetPrelevement $error++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); } - else - { + else { $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); if ($result < 0) { @@ -192,8 +191,7 @@ class RejetPrelevement dol_syslog("RejetPrelevement::Create Commit"); $this->db->commit(); } - else - { + else { dol_syslog("RejetPrelevement::Create Rollback"); $this->db->rollback(); } @@ -228,8 +226,7 @@ class RejetPrelevement $userid = $row[0]; } } - else - { + else { dol_syslog("RejetPrelevement::_send_email Erreur lecture user"); } @@ -266,13 +263,11 @@ class RejetPrelevement { dol_syslog("RejetPrelevement::_send_email email envoye"); } - else - { + else { dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); } } - else - { + else { dol_syslog("RejetPrelevement::_send_email Userid invalide"); } } @@ -310,8 +305,7 @@ class RejetPrelevement { $row = $this->db->fetch_row($resql); if (!$amounts) $arr[$i] = $row[0]; - else - { + else { $arr[$i] = array( $row[0], $row[1] @@ -322,8 +316,7 @@ class RejetPrelevement } $this->db->free($resql); } - else - { + else { dol_syslog("getListInvoices", LOG_ERR); } @@ -359,14 +352,12 @@ class RejetPrelevement return 0; } - else - { + else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0"); return -1; } } - else - { + else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid"); return -2; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 5306b6799b9..505ad070645 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -94,8 +94,7 @@ if (empty($reshook)) $mesg .= ''.$val."
\n"; } } - else - { + else { setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); } } @@ -175,21 +174,18 @@ if ($nb) { print ''.$langs->trans("CreateAll")."\n"; } } - else - { + else { if ($mysoc->isInEEC()) { print ''.$langs->trans("CreateForSepaFRST")."\n"; print ''.$langs->trans("CreateForSepaRCUR")."\n"; } - else - { + else { print ''.$langs->trans("CreateAll")."\n"; } } } -else -{ +else { print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } @@ -308,16 +304,14 @@ if ($resql) $i++; } } - else - { + else { print ''.$langs->trans("None").''; } print ""; print ""; print "
\n"; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 181f71a678c..64ac904db6c 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -89,8 +89,7 @@ if (!$status) { $title = $langs->trans("RequestStandingOrderToTreat"); } -else -{ +else { $title = $langs->trans("RequestStandingOrderTreated"); } @@ -143,8 +142,7 @@ if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; } -else -{ +else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index fb0a5548426..bb3cced3eb4 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -135,8 +135,7 @@ if ($prev_id > 0 || $ref) dol_fiche_end(); } - else - { + else { dol_print_error($db); } } @@ -290,8 +289,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 1cc454a3d4d..4bfc07b0292 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -136,8 +136,7 @@ if ($prev_id > 0 || $ref) dol_fiche_end(); } - else - { + else { dol_print_error($db); } } @@ -221,8 +220,7 @@ if ($resql) $i++; } } - else - { + else { print ''.$langs->trans("None").''; } @@ -239,8 +237,7 @@ if ($resql) $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 18028e2059a..5dd01bad41d 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -133,8 +133,7 @@ if ($prev_id > 0 || $ref) dol_fiche_end(); } - else - { + else { $langs->load("errors"); print $langs->trans("Error"); } @@ -186,8 +185,7 @@ if ($prev_id > 0 || $ref) print ""; $db->free($resql); } - else - { + else { print $db->error().' '.$sql; } } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index eb2932fd4cb..faa56184891 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -159,14 +159,12 @@ if ($resql) $i++; } } - else - { + else { print ''.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).''; } print "
"; } -else -{ +else { dol_print_error($db); } @@ -221,8 +219,7 @@ if ($result) print "
"; $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 9169f71a377..89d6ad93636 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -103,13 +103,11 @@ if ($action == 'confirm_rejet') exit; } } - else - { + else { $action = "rejet"; } } - else - { + else { header("Location: line.php?id=".$id); exit; } @@ -162,15 +160,13 @@ if ($id) /* Historique pour certaines install */ print $langs->trans("Unknown"); } - else - { + else { print dol_print_date($rej->date_rejet, 'day'); } print ''; print ''.$langs->trans("RefusedInvoicing").''.$rej->invoicing.''; } - else - { + else { print ''.$resf.''; } } @@ -178,8 +174,7 @@ if ($id) print ''; dol_fiche_end(); } - else - { + else { dol_print_error($db); } @@ -246,13 +241,11 @@ if ($id) { print "id\">".$langs->trans("StandingOrderReject").""; } - else - { + else { print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject").""; } } - else - { + else { print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject").""; } } @@ -330,8 +323,7 @@ if ($id) $db->free($result); } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index 48f9bcc7c54..b93042df8e6 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -236,8 +236,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index 6d1994b7a4b..a7e7a6f3a53 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -118,8 +118,7 @@ if ($result) print ""; $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index c6d1962ff46..609c75e065d 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -126,8 +126,7 @@ if ($resql) print ""; $db->free(); } -else -{ +else { dol_print_error($db); } @@ -220,8 +219,7 @@ if ($resql) print ""; $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 3f2112537b1..83388f21e49 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -212,14 +212,12 @@ if ($id > 0) $db->free($resqlp); } - else - { + else { dol_print_error($db); } } } - else - { + else { dol_print_error($db); } @@ -289,8 +287,7 @@ if ($id > 0) print ""; } } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 27bc4526a3e..8d7c0343b30 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -151,7 +151,7 @@ if ($modecompta == "CREANCES-DETTES") $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesResultDue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else $description .= $langs->trans("DepositsAreIncluded"); + else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -213,8 +213,7 @@ if ($modecompta == 'BOOKKEEPING') { print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'amount', '', $param, 'class="right"', $sortfield, $sortorder); } -else -{ +else { if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], 'amount_ht', '', $param, 'class="right"', $sortfield, $sortorder); @@ -313,15 +312,13 @@ if ($modecompta == 'BOOKKEEPING') $i++; } } - else - { + else { print ''.$langs->trans("NoRecordFound").''; } } else dol_print_error($db); } -else -{ +else { /* * Factures clients */ @@ -336,8 +333,7 @@ else $sql .= " AND f.fk_statut IN (1,2)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql .= " AND f.type IN (0,1,2,5)"; - else - $sql .= " AND f.type IN (0,1,2,3,5)"; + else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } @@ -463,8 +459,7 @@ else $sql .= " AND f.fk_statut IN (1,2)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql .= " AND f.type IN (0,1,2)"; - else - $sql .= " AND f.type IN (0,1,2,3)"; + else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; } @@ -518,8 +513,7 @@ else $i++; } } - else - { + else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -768,15 +762,13 @@ else $i++; } } - else - { + else { print ' '; print ''.$langs->trans("None").''; print ''; } } - else - { + else { dol_print_error($db); } print ''; @@ -854,15 +846,13 @@ else print ''; } } - else - { + else { print ' '; print ''.$langs->trans("None").''; print ''; } } - else - { + else { dol_print_error($db); } print ''; @@ -888,8 +878,7 @@ else $sql .= " WHERE p.entity IN (".getEntity('donation').")"; $sql .= " AND fk_statut in (1,2)"; } - else - { + else { $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; @@ -936,15 +925,13 @@ else $i++; } } - else - { + else { print ' '; print ''.$langs->trans("None").''; print ''; } } - else - { + else { dol_print_error($db); } print ''; @@ -1083,8 +1070,7 @@ else $sql .= " WHERE f.fk_statut IN (1,2)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql .= " AND f.type IN (0,1,2,5)"; - else - $sql .= " AND f.type IN (0,1,2,3,5)"; + else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; @@ -1131,8 +1117,7 @@ else $sql .= " WHERE f.fk_statut IN (1,2)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql .= " AND f.type IN (0,1,2)"; - else - $sql .= " AND f.type IN (0,1,2,3)"; + else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; $sql .= " AND f.entity = ".$conf->entity; @@ -1173,8 +1158,7 @@ else print ''.price($amount)."\n"; print "\n"; } - else - { + else { // VAT really already paid $amount = 0; $sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount"; @@ -1254,8 +1238,7 @@ else } $db->free($result); } - else - { + else { dol_print_error($db); } print ' '; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index ad81a3943c1..04bed25d6b2 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -131,7 +131,7 @@ if ($modecompta == 'CREANCES-DETTES') $description = $langs->trans("RulesAmountWithTaxIncluded"); $description .= '
'.$langs->trans("RulesResultDue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= "
".$langs->trans("DepositsAreNotIncluded"); - else $description .= "
".$langs->trans("DepositsAreIncluded"); + else $description .= "
".$langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -724,8 +724,7 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' | } } } - else - { + else { dol_print_error($db); } } @@ -786,8 +785,7 @@ if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } } } - else - { + else { dol_print_error($db); } } @@ -826,8 +824,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba } } } - else - { + else { dol_print_error($db); } @@ -856,8 +853,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba } } } - else - { + else { dol_print_error($db); } } @@ -894,8 +890,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan } } } - else - { + else { dol_print_error($db); } } @@ -961,8 +956,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) } } } - else - { + else { dol_print_error($db); } } @@ -1042,8 +1036,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) $totsorties[$annee] += $decaiss[$case]; } } - else - { + else { if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) { print ''.price(price2num($decaiss_ttc[$case], 'MT')).''; @@ -1063,8 +1056,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) $totentrees[$annee] += $encaiss[$case]; } } - else - { + else { if (isset($encaiss_ttc[$case])) { print ''.price(price2num($encaiss_ttc[$case], 'MT')).''; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 66adea3371f..172929aabff 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -178,7 +178,7 @@ if ($modecompta == "CREANCES-DETTES") //$periodlink=''.img_previous().' '.img_next().''; $description = $langs->trans("RulesResultDue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else $description .= $langs->trans("DepositsAreIncluded"); + else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -375,7 +375,7 @@ elseif ($modecompta == "BOOKKEEPING") print "\n"; //var_dump($sommes); - } else // normal category + } else // normal category { $code = $cat['code']; // Category code we process diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index d7f20622a43..0cb706d3177 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -129,8 +129,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') header("Location: list.php"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -166,8 +165,7 @@ if ($action == 'add' && $user->rights->tax->charges->creer) setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } - else - { + else { $object->type = $actioncode; $object->label = GETPOST('label', 'alpha'); $object->date_ech = $dateech; @@ -211,8 +209,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; } - else - { + else { $result = $object->fetch($id); $object->date_ech = $dateech; @@ -272,8 +269,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $id = $originalId; $db->rollback(); @@ -281,8 +277,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char } } } - else - { + else { $db->rollback(); dol_print_error($db, $object->error); } @@ -432,8 +427,7 @@ if ($id > 0) { $formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1); } - else - { + else { $formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); } @@ -536,8 +530,7 @@ if ($id > 0) { print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); } - else - { + else { print dol_print_date($object->periode, "day"); } print ""; @@ -675,8 +668,7 @@ if ($id > 0) $i++; } } - else - { + else { print ''.$langs->trans("None").''; print ''; print ''; @@ -696,8 +688,7 @@ if ($id > 0) $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -768,8 +759,7 @@ if ($id > 0) print ""; } } - else - { + else { /* Social contribution not found */ dol_print_error('', $object->error); } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 6d3f4dffa4a..0c709c031d5 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -172,13 +172,11 @@ class ChargeSociales extends CommonObject return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -258,8 +256,7 @@ class ChargeSociales extends CommonObject return -1 * $error; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -329,8 +326,7 @@ class ChargeSociales extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -387,8 +383,7 @@ class ChargeSociales extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -422,13 +417,11 @@ class ChargeSociales extends CommonObject $this->db->free($result); return $obj->amount; } - else - { + else { return 0; } } - else - { + else { print $this->db->error(); return -1; } @@ -613,8 +606,7 @@ class ChargeSociales extends CommonObject $this->db->free($resql); return $amount; } - else - { + else { return -1; } } @@ -668,8 +660,7 @@ class ChargeSociales extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index bae8d28a756..9164ab39f1e 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -200,8 +200,7 @@ class PaymentSocialContribution extends CommonObject } } } - else - { + else { $error++; } } @@ -216,8 +215,7 @@ class PaymentSocialContribution extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -287,8 +285,7 @@ class PaymentSocialContribution extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -359,8 +356,7 @@ class PaymentSocialContribution extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -415,8 +411,7 @@ class PaymentSocialContribution extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -466,8 +461,7 @@ class PaymentSocialContribution extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -578,8 +572,7 @@ class PaymentSocialContribution extends CommonObject } } } - else - { + else { $this->error = $acc->error; $error++; } @@ -589,8 +582,7 @@ class PaymentSocialContribution extends CommonObject { return 1; } - else - { + else { return -1; } } @@ -614,8 +606,7 @@ class PaymentSocialContribution extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->error(); return 0; } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index 3c73c8e6614..e63c5f354d0 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -164,8 +164,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index 9d210c23d85..be5f7e6f973 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -81,8 +81,7 @@ if (!GETPOSTISSET('search_typeid')) if ($part[0] == 'cs.fk_type') $search_typeid = $part[1]; } } -else -{ +else { $search_typeid = GETPOST('search_typeid', 'int'); } @@ -209,8 +208,7 @@ if ($resql) print $countrynotdefined; print ''; } - else - { + else { print '
'; print ''."\n"; @@ -314,8 +312,7 @@ if ($resql) { print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').''; } - else - { + else { print ' '; } print "\n"; @@ -346,8 +343,7 @@ if ($resql) } print ''; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 5cfa5df06ed..05808877df9 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -93,8 +93,7 @@ if ($mode != 'sconly') $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1); } -else -{ +else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit); } @@ -209,8 +208,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print '"; print ""; } - else - { + else { dol_print_error($db); } print '
'.price($totalpaye)."
'; @@ -288,8 +286,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); } - else - { + else { dol_print_error($db); } } @@ -311,8 +308,7 @@ elseif ($mysoc->localtax2_assuj == "1") $j = 2; $numlt = 3; } -else -{ +else { $j = 0; $numlt = 0; } @@ -389,8 +385,7 @@ while ($j < $numlt) print ""; $db->free($result); } - else - { + else { dol_print_error($db); } } @@ -473,8 +468,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) print "
"; } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index acd58f90217..3859b19df91 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -78,8 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 5831467ce63..513b0ffa350 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -104,8 +104,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 4d4f56a1354..6d720b4f96d 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -97,8 +97,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } } -else -{ +else { // TODO We define q } // $date_start and $date_end are defined. We force $year_start and $nbofyear @@ -154,7 +153,7 @@ if ($modecompta == "CREANCES-DETTES") { //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else $description .= $langs->trans("DepositsAreIncluded"); + else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index bec20998cfa..85a27c7574a 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -114,8 +114,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } } -else -{ +else { // TODO We define q } @@ -180,7 +179,7 @@ if ($modecompta == "CREANCES-DETTES") //$calcmode.='
('.$langs->trans("SeeReportInInputOutputMode",'','').')'; $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else $description .= $langs->trans("DepositsAreIncluded"); + else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index d1a64e218d2..cfc521c7c13 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -124,7 +124,7 @@ if ($modecompta == "CREANCES-DETTES") $periodlink = ($year_start ? "".img_previous()." ".img_next()."" : ""); $description = $langs->trans("RulesCADue"); if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $description .= $langs->trans("DepositsAreNotIncluded"); - else $description .= $langs->trans("DepositsAreIncluded"); + else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); } @@ -260,8 +260,7 @@ if ($modecompta == 'RECETTES-DEPENSES') $i++; } } - else - { + else { dol_print_error($db); } } @@ -340,8 +339,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; } - else - { + else { if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } @@ -357,8 +355,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; } - else - { + else { if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } @@ -391,8 +388,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print '-'; } } - else - { + else { print ''; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } @@ -484,8 +480,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; } - else - { + else { print ' '; } } @@ -495,8 +490,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; } - else - { + else { print ' '; } @@ -520,8 +514,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) print '+0%'; } } - else - { + else { print ''; if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index 3ff41f4d114..e9e0ec5926c 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -290,8 +290,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; } - else - { + else { if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } @@ -307,8 +306,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; } - else - { + else { if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } @@ -341,8 +339,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) print '-'; } } - else - { + else { print ''; if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } @@ -369,8 +366,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; } - else - { + else { print ' '; } } @@ -380,8 +376,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; } - else - { + else { print ' '; } @@ -405,8 +400,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) print '+0%'; } } - else - { + else { print ''; if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index fafb967ace1..9b25488c280 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -101,8 +101,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index fcae12f744b..76f9c246e87 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -108,8 +108,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } } -else -{ +else { // TODO We define q } diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 658c9353a00..3df7419019a 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -132,8 +132,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) header("Location: list.php"); exit; } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -167,21 +166,18 @@ if ($action == 'delete') header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php'); exit; } - else - { + else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -389,13 +385,11 @@ if ($id) { print ''; } - else - { + else { print ''; } } - else - { + else { print ''; } print "
"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index c01408f3c9a..baeaff7a5d6 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -151,14 +151,12 @@ class Tva extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -225,8 +223,7 @@ class Tva extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -294,8 +291,7 @@ class Tva extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -405,14 +401,12 @@ class Tva extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -446,14 +440,12 @@ class Tva extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -489,14 +481,12 @@ class Tva extends CommonObject $this->db->free($result); return $ret; } - else - { + else { $this->db->free($result); return 0; } } - else - { + else { print $this->db->lasterror(); return -1; } @@ -613,8 +603,7 @@ class Tva extends CommonObject { $this->update_fk_bank($bank_line_id); } - else - { + else { $this->error = $acc->error; $ok = 0; } @@ -633,20 +622,17 @@ class Tva extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -3; } } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -670,8 +656,7 @@ class Tva extends CommonObject { return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -753,8 +738,7 @@ class Tva extends CommonObject $this->db->free($resql); return $amount; } - else - { + else { return -1; } } @@ -800,8 +784,7 @@ class Tva extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index bcedba7a074..158c974114d 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -67,8 +67,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } - else - { + else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; @@ -92,8 +91,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } } } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -322,8 +320,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'link' =>$expensereport->getNomUrl(1) ); } - else - { + else { $invoice_supplier->id = $x_paye[$my_paye_thirdpartyid]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_thirdpartyid]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_thirdpartyid]['type'][$id]; @@ -694,8 +691,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print $langs->trans("NA"); } - else - { + else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index fabaf1ee705..45efc9681d8 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -149,8 +149,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 0a785aa78cd..c85f2bbdb8f 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -58,8 +58,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else - { + else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; @@ -83,8 +82,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } } } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -177,8 +175,7 @@ function pt($db, $sql, $date) $previousmode = ''; $previousmonth = ''; } - else - { + else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -372,8 +369,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc //'link' =>$expensereport->getNomUrl(1) ); } - else - { + else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 003a7eabcad..98eede887c8 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -73,8 +73,7 @@ if (empty($_REQUEST['typeid'])) if ($part[0] == 't.fk_typepayment') $typeid = $part[1]; } } -else -{ +else { $typeid = $_REQUEST['typeid']; } @@ -229,8 +228,7 @@ if ($result) { $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; } - else - { + else { $type = ' '; } @@ -292,8 +290,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 79ee69a030c..6e16165ab6c 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -67,8 +67,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if (empty($q)) { if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else - { + else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; @@ -92,8 +91,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } } } - else - { + else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -316,8 +314,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'link' =>$expensereport->getNomUrl(1) ); } - else - { + else { $invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -440,8 +437,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } } - else - { + else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -621,8 +617,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } } - else - { + else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -674,8 +669,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) { print $langs->trans("NA"); } - else - { + else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 625cf524169..874a964a965 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -77,8 +77,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -160,8 +159,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } -else -{ +else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index fbd31812fe8..e005d3dca7b 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -120,8 +120,7 @@ abstract class ActionsContactCardCommon $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; } - else - { + else { $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); } @@ -223,8 +222,7 @@ abstract class ActionsContactCardCommon $objsoc->fetch($this->object->socid); $this->tpl['company'] = $objsoc->getNomUrl(1); } - else - { + else { $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany"); } @@ -310,8 +308,7 @@ abstract class ActionsContactCardCommon { $obj = $this->db->fetch_object($resql); } - else - { + else { dol_print_error($this->db); } $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 54b3f137967..6ac81ac8bd4 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -105,8 +105,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); } - else - { + else { // Confirm delete contact if ($action == 'delete' && $user->rights->societe->contact->supprimer) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index a6e5bee1898..885878138ba 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -129,20 +129,17 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } } - else - { + else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } } - else - { + else { $error = $object->error; $errors = $object->errors; } } @@ -156,8 +153,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -171,8 +167,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -278,8 +273,7 @@ if (empty($reshook)) header("Location: ".$url); exit; } - else - { + else { $db->rollback(); } } @@ -300,14 +294,12 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT.'/contact/list.php'); exit; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -351,8 +343,7 @@ if (empty($reshook)) { $errors[] = "ErrorFailedToSaveFile"; } - else - { + else { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Create thumbs @@ -360,13 +351,11 @@ if (empty($reshook)) } } } - else - { + else { $errors[] = "ErrorBadImageFormat"; } } - else - { + else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -452,8 +441,7 @@ if (empty($reshook)) } } } - else - { + else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$db->escape($object->email)."' AND entity = ".$db->escape(getEntity('mailing', 0)); $resql = $db->query($sql); } @@ -465,8 +453,7 @@ if (empty($reshook)) $object->old_firstname = ''; $action = 'view'; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } @@ -526,8 +513,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } -else -{ +else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -703,8 +689,7 @@ else { print ''; } - else - { + else { print ''; } @@ -712,8 +697,7 @@ else { print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); } - else - { + else { print $countrynotdefined; } print ''; @@ -871,8 +855,7 @@ else { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); } - else - { + else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } print ''; @@ -882,8 +865,7 @@ else { print ''; } - else - { + else { print ''; } print ''; @@ -900,8 +882,7 @@ else print '     '; print ''; } - else - { + else { print '     '; print ''; } @@ -1031,8 +1012,7 @@ else { print ''; } - else - { + else { print ''; } @@ -1070,8 +1050,7 @@ else print ''.$langs->trans("NbOfEMailingsSend").''; print ''.$object->getNbOfEMailings().''; } - else - { + else { print ''; } print ''; @@ -1096,8 +1075,7 @@ else print ''; print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).''; } - else - { + else { print ''; } print ''; @@ -1479,8 +1457,7 @@ else $langs->load("mails"); print ''; } - else - { + else { $langs->load("mails"); print ''; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index d9753001db2..fc640e7e032 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -288,8 +288,7 @@ class Contact extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; @@ -389,15 +388,13 @@ class Contact extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -597,15 +594,13 @@ class Contact extends CommonObject $this->db->commit(); return 1; } - else - { + else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; } } - else - { + else { $this->error = $this->db->lasterror().' sql='.$sql; $this->db->rollback(); return -1; @@ -762,13 +757,11 @@ class Contact extends CommonObject $this->error = $this->db->lasterror(); } } - else - { + else { $result = true; } } - else - { + else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $result = $this->db->query($sql); @@ -792,8 +785,7 @@ class Contact extends CommonObject $this->db->commit(); return 1; } - else - { + else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; @@ -846,8 +838,7 @@ class Contact extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user as u ON c.rowid = u.fk_socpeople"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON c.fk_soc = s.rowid"; if ($id) $sql .= " WHERE c.rowid = ".$id; - else - { + else { $sql .= " WHERE c.entity IN (".getEntity($this->element).")"; if ($ref_ext) { $sql .= " AND c.ref_ext = '".$this->db->escape($ref_ext)."'"; @@ -943,8 +934,7 @@ class Contact extends CommonObject } $this->db->free($resql); } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -971,8 +961,7 @@ class Contact extends CommonObject } $this->db->free($resql); } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -988,14 +977,12 @@ class Contact extends CommonObject return 1; } - else - { + else { $this->error = $langs->trans("RecordNotFound"); return 0; } } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1062,8 +1049,7 @@ class Contact extends CommonObject $this->db->free($resql); return 0; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1119,8 +1105,7 @@ class Contact extends CommonObject $i++; } } - else - { + else { $error++; $this->error = $this->db->error().' sql='.$sql; } @@ -1187,8 +1172,7 @@ class Contact extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); dol_syslog("Error ".$this->error, LOG_ERR); return -1; @@ -1236,8 +1220,7 @@ class Contact extends CommonObject $this->db->free($resql); } - else - { + else { print $this->db->error(); } } @@ -1263,8 +1246,7 @@ class Contact extends CommonObject $this->db->free($resql); return $nb; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1526,8 +1508,7 @@ class Contact extends CommonObject $this->db->rollback(); return -$error; } - else - { + else { $this->db->commit(); return 1; } @@ -1681,8 +1662,7 @@ class Contact extends CommonObject return $tab; } - else - { + else { $this->error = $this->db->error(); dol_print_error($this->db); return -1; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index ad4b5ca08f5..ff3570e7e82 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -424,8 +424,7 @@ if ($sql_select) { print $documentstaticline->getLibStatut(2); } - else - { + else { print $documentstatic->getLibStatut(2); } print ''; @@ -468,8 +467,7 @@ if ($sql_select) $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; } - else - { + else { $label = $objp->product_label; } @@ -516,14 +514,12 @@ if ($sql_select) // Add date of deposit if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; } - else - { + else { echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); } } } - else - { + else { if ($objp->fk_product > 0) { echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 842d03cb3a6..7934bbd5996 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -68,8 +68,7 @@ if ($action == 'dolibarr2ldap') setEventMessages($langs->trans("ContactSynchronized"), null, 'mesgs'); $db->commit(); } - else - { + else { setEventMessages($ldap->error, $ldap->errors, 'errors'); $db->rollback(); } @@ -107,8 +106,7 @@ if ($object->socid > 0) print ''.$langs->trans("ThirdParty").''.$thirdparty->getNomUrl(1).''; } -else -{ +else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -184,21 +182,18 @@ if ($result > 0) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; } - else - { + else { $result = show_ldap_content($records, 0, $records['count'], true); } } - else - { + else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } $ldap->unbind(); $ldap->close(); } -else -{ +else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 9e7485d189f..a6add5c7d75 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -327,8 +327,7 @@ if ($search_priv != '0' && $search_priv != '1') { $sql .= " AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".$user->id."))"; } -else -{ +else { if ($search_priv == '0') $sql .= " AND p.priv='0'"; if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; } @@ -404,8 +403,7 @@ if ($view == "recent") { $sql .= $db->order("p.datec", "DESC"); } -else -{ +else { $sql .= $db->order($sortfield, $sortorder); } @@ -923,8 +921,7 @@ while ($i < min($num, $limit)) $objsoc->fetch($obj->socid); print $objsoc->getNomUrl(1); } - else - print ' '; + else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 5a6ea3eb032..5665030b6d5 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -86,20 +86,17 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } - else - { + else { // Create thumbs $object->addThumbs($newfile); } } } - else - { + else { setEventMessages("ErrorBadImageFormat", null, 'errors'); } } - else - { + else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -112,8 +109,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- } } } - else - { + else { $error = $object->error; } } @@ -184,8 +180,7 @@ if ($action == 'edit') print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; } - else - { + else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -208,8 +203,7 @@ if ($action == 'edit') { print ''; } - else - { + else { print ''; } print ''; @@ -226,8 +220,7 @@ if ($action == 'edit') print ""; } -else -{ +else { // View mode dol_fiche_head($head, 'perso', $title, -1, 'contact'); @@ -302,8 +295,7 @@ else else print $langs->trans("BirthdayAlertOff"); print ''; } - else - { + else { print ''.$langs->trans("DateToBirth").''; } print ""; diff --git a/htdocs/contact/vcard.php b/htdocs/contact/vcard.php index 75362491424..ee325317033 100644 --- a/htdocs/contact/vcard.php +++ b/htdocs/contact/vcard.php @@ -102,8 +102,7 @@ if ($company->id) $v->setEmail($company->email, 'INTERNET'); } // when e-mail of contact and company complete different use company e-mail at first (and contact e-mail at second) - else - { + else { $v->setEmail($company->email); // support by Microsoft Outlook (2019 and possible earlier) diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 0055b0ba428..36a9c950069 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -40,8 +40,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 9f825cdf009..7a2f8cf311f 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -133,8 +133,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -303,8 +302,7 @@ if (empty($reshook)) $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; } - else - { + else { $label = $lines[$i]->product_label; } $desc = ($lines[$i]->desc && $lines[$i]->desc != $lines[$i]->libelle) ?dol_htmlentitiesbr($lines[$i]->desc) : ''; @@ -355,8 +353,7 @@ if (empty($reshook)) } } } - else - { + else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error++; } @@ -368,14 +365,12 @@ if (empty($reshook)) if ($reshook < 0) $error++; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } } - else - { + else { $result = $object->create($user); if ($result > 0) { @@ -408,8 +403,7 @@ if (empty($reshook)) $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); } - else - { + else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -514,8 +508,7 @@ if (empty($reshook)) { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } - else - { + else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -526,8 +519,7 @@ if (empty($reshook)) $fk_unit = $prod->fk_unit; } - else - { + else { $pu_ht = GETPOST('price_ht'); $price_base_type = 'HT'; $tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0 @@ -543,8 +535,7 @@ if (empty($reshook)) $fk_fournprice = $_POST['fournprice']; if (!empty($_POST['buying_price'])) $pa_ht = $_POST['buying_price']; - else - $pa_ht = null; + else $pa_ht = null; $info_bits = 0; if ($tva_npr) $info_bits |= 0x01; @@ -555,8 +546,7 @@ if (empty($reshook)) $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1; } - else - { + else { // Insert line $result = $object->addline( $desc, @@ -630,8 +620,7 @@ if (empty($reshook)) unset($_POST['date_endmonth']); unset($_POST['date_endyear']); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -692,8 +681,7 @@ if (empty($reshook)) $fk_fournprice = $_POST['fournprice']; if (!empty($_POST['buying_price'])) $pa_ht = $_POST['buying_price']; - else - $pa_ht = null; + else $pa_ht = null; $fk_unit = GETPOST('unit', 'alpha'); @@ -745,8 +733,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -760,8 +747,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -789,8 +775,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -832,8 +817,7 @@ if (empty($reshook)) header("Location: list.php?restore_lastsearch_values=1"); return; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -851,13 +835,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); return; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } } @@ -1015,15 +997,13 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1058,8 +1038,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } - else - { + else { if ($object->id > 0) { $result = $object->createFromClone($user, $socid); if ($result > 0) { @@ -1120,8 +1099,7 @@ if ($action == 'create') { $projectid = GETPOST('originid'); } - else - { + else { // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } @@ -1196,8 +1174,7 @@ if ($action == 'create') print ''; print ''; } - else - { + else { print ''; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); print ' '.$langs->trans("AddThirdParty").''; @@ -1292,8 +1269,7 @@ if ($action == 'create') print "\n"; } -else -/* *************************************************************************** */ +else /* *************************************************************************** */ /* */ /* Mode vue et edition */ /* */ @@ -1600,8 +1576,7 @@ else print ''; } - else - { + else { print ''.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."\n"; } // VAT @@ -1623,8 +1598,7 @@ else { print ''.$objp->remise_percent."%\n"; } - else - { + else { print ' '; } @@ -1709,8 +1683,7 @@ else } } // Line in mode update - else - { + else { // Ligne carac print ''; print ''; @@ -1724,8 +1697,7 @@ else print $objp->label ? ' - '.dol_trunc($objp->label, 32) : ''; print '
'; } - else - { + else { print $objp->label ? $objp->label.'
' : ''; } @@ -1802,8 +1774,7 @@ else $db->free($result); } - else - { + else { dol_print_error($db); } @@ -1874,8 +1845,7 @@ else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors'); } - else - { + else { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1); } print '
'; @@ -2112,8 +2082,7 @@ else if ($object->statut == 1) { if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->commande->order_advance->send)) { print ''; - } else - print ''; + } else print ''; } } @@ -2153,8 +2122,7 @@ else { print ''; } - else - { + else { print ''; } } @@ -2164,8 +2132,7 @@ else { print ''; } - else - { + else { print ''; } @@ -2185,8 +2152,7 @@ else { print ''; } - else - { + else { print ''; } } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index a35d3c871de..9caa33fca2d 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -465,8 +465,7 @@ class Contracts extends DolibarrApi if ($updateRes > 0) { return $this->get($id); } - else - { + else { throw new RestException(405, $this->contract->error); } } @@ -502,8 +501,7 @@ class Contracts extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->contract->error); } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 1dec473edac..304628d97cc 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -299,15 +299,13 @@ class Contrat extends CommonObject { return $numref; } - else - { + else { $this->error = $obj->error; dol_print_error($db, get_class($this)."::getNextValue ".$obj->error); return ""; } } - else - { + else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract")); return ""; @@ -411,8 +409,7 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -468,8 +465,7 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -513,8 +509,7 @@ class Contrat extends CommonObject { $num = $this->getNextNumRef($this->thirdparty); } - else - { + else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -592,8 +587,7 @@ class Contrat extends CommonObject $this->date_validation = $now; } } - else - { + else { $error++; } @@ -602,8 +596,7 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -667,8 +660,7 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -771,15 +763,13 @@ class Contrat extends CommonObject return $this->id; } } - else - { + else { dol_syslog(get_class($this)."::fetch Contract not found"); $this->error = "Contract not found"; return 0; } } - else - { + else { dol_syslog(get_class($this)."::fetch Error searching contract"); $this->error = $this->db->error(); return -1; @@ -940,8 +930,7 @@ class Contrat extends CommonObject } $this->db->free($result); } - else - { + else { dol_syslog(get_class($this)."::Fetch Error when reading lines of contracts linked to products"); return -3; } @@ -1082,7 +1071,7 @@ class Contrat extends CommonObject } } } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1146,23 +1135,20 @@ class Contrat extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } } - else - { + else { $this->error = "Failed to add contract"; dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); $this->db->rollback(); @@ -1332,8 +1318,7 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1427,8 +1412,7 @@ class Contrat extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -1506,8 +1490,7 @@ class Contrat extends CommonObject { $pu = $pu_ht; } - else - { + else { $pu = $pu_ttc; } @@ -1559,8 +1542,7 @@ class Contrat extends CommonObject { return $result; } - else - { + else { $pa_ht = $result; } } @@ -1632,21 +1614,18 @@ class Contrat extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->db->commit(); return $contractlineid; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; } } - else - { + else { dol_syslog(get_class($this)."::addline ErrorTryToAddLineOnValidatedContract", LOG_ERR); return -2; } @@ -1699,8 +1678,7 @@ class Contrat extends CommonObject $remise = round(($pu * $remise_percent / 100), 2); $price = $pu - $remise; } - else - { + else { $remise_percent = 0; } @@ -1751,8 +1729,7 @@ class Contrat extends CommonObject { return $result; } - else - { + else { $pa_ht = $result; } } @@ -1826,15 +1803,13 @@ class Contrat extends CommonObject return 1; } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::updateline Erreur -2"); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); dol_syslog(get_class($this)."::updateline Erreur -1"); @@ -1896,8 +1871,7 @@ class Contrat extends CommonObject return -1; } } - else - { + else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -1994,8 +1968,7 @@ class Contrat extends CommonObject $text .= ($mode == 7 ? '
' : ''); return $text; } - else - { + else { return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } @@ -2114,8 +2087,7 @@ class Contrat extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -2151,8 +2123,7 @@ class Contrat extends CommonObject } return $tab; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2189,8 +2160,7 @@ class Contrat extends CommonObject } return $tab; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2291,8 +2261,7 @@ class Contrat extends CommonObject return $response; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2334,8 +2303,7 @@ class Contrat extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2960,8 +2928,7 @@ class ContratLigne extends CommonObjectLine return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -3047,8 +3014,7 @@ class ContratLigne extends CommonObjectLine { return $result; } - else - { + else { $this->pa_ht = $result; } } @@ -3196,8 +3162,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -3279,8 +3244,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; @@ -3334,8 +3298,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 1da2416ce84..250d89e3e88 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -71,8 +71,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $msg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); @@ -91,8 +90,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) { $result = $object->swapContactStatus(GETPOST('ligne')); } - else - { + else { dol_print_error($db, $object->error); } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index fd3b3f66e4a..e43db63826f 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -194,8 +194,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 2a7c9c0d91a..4530d01a6af 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -141,8 +141,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } // Search by status (only expired) @@ -180,8 +179,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -299,15 +297,13 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) $i++; } } - else - { + else { print ''.$langs->trans("NoContracts").''; } print "
"; $db->free($resql); } - else - { + else { dol_print_error($db); } } @@ -384,8 +380,7 @@ if ($result) print ""; } -else -{ +else { dol_print_error($db); } @@ -440,8 +435,7 @@ if ($resql) $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); } - else - { + else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -463,8 +457,7 @@ if ($resql) print ""; } -else -{ +else { dol_print_error($db); } @@ -520,8 +513,7 @@ if ($resql) $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); } - else - { + else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -542,8 +534,7 @@ if ($resql) print ""; } -else -{ +else { dol_print_error($db); } @@ -600,8 +591,7 @@ if ($resql) $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); } - else - { + else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -622,8 +612,7 @@ if ($resql) print ""; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index a7205730817..5053b703966 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -732,8 +732,7 @@ while ($i < min($num, $limit)) } //else print $langs->trans("NoSalesRepresentativeAffected"); } - else - { + else { print ' '; } print ''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 2b81ceff5fa..62a853270e1 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -98,14 +98,12 @@ if ($search_status != '') $tmp = explode('&', $search_status); $mode = $tmp[0]; if (empty($tmp[1])) $filter = ''; - else - { + else { if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired'; if ($tmp[1] == 'filter=expired') $filter = 'expired'; } } -else -{ +else { $search_status = $mode; if ($filter == 'expired') $search_status .= '&filter=expired'; if ($filter == 'notexpired') $search_status .= '&filter=notexpired'; @@ -598,8 +596,7 @@ while ($i < min($num, $limit)) print $obj->label ? ' - '.dol_trunc($obj->label, 16) : ''; if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); } - else - { + else { if ($obj->type == 0) print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24); if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24); } @@ -725,8 +722,7 @@ while ($i < min($num, $limit)) // If contract is draft, we say line is also draft print $contractstatic->LibStatut(0, 5); } - else - { + else { print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0); } print ''; diff --git a/htdocs/cron/admin/cron.php b/htdocs/cron/admin/cron.php index b9c00885d69..fe5b015214a 100644 --- a/htdocs/cron/admin/cron.php +++ b/htdocs/cron/admin/cron.php @@ -51,8 +51,7 @@ if (!empty($actionsave)) $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -97,8 +96,7 @@ if (empty($conf->global->CRON_DISABLE_KEY_CHANGE)) if (!empty($conf->use_javascript_ajax)) print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_token" class="linkobject"'); } -else -{ +else { print (!empty($conf->global->CRON_KEY) ? $conf->global->CRON_KEY : ''); print ''; } diff --git a/htdocs/cron/card.php b/htdocs/cron/card.php index 9ebbcda6c44..0d2455ae620 100644 --- a/htdocs/cron/card.php +++ b/htdocs/cron/card.php @@ -66,15 +66,13 @@ if (!empty($cancel)) { $action = ''; } - else - { + else { if ($backtourl) { header("Location: ".$backtourl); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT.'/cron/list.php'); exit; } @@ -91,8 +89,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->cron->del setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } - else - { + else { Header("Location: ".DOL_URL_ROOT.'/cron/list.php'); exit; } @@ -106,8 +103,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); $action = ''; } - else - { + else { $now = dol_now(); // Date we start $result = $object->run_jobs($user->login); @@ -117,8 +113,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } - else - { + else { $res = $object->reprogram_jobs($user->login, $now); if ($res > 0) { @@ -126,8 +121,7 @@ if ($action == 'confirm_execute' && $confirm == "yes" && $user->rights->cron->ex else setEventMessages($langs->trans("JobFinished"), null, 'mesgs'); $action = ''; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -416,8 +410,7 @@ if (($action == "create") || ($action == "edit")) { print ""; } - else - { + else { print ""; } } @@ -473,8 +466,7 @@ if (($action == "create") || ($action == "edit")) { print $form->selectDate($object->datestart, 'datestart', 1, 1, '', "cronform"); } - else - { + else { print $form->selectDate('', 'datestart', 1, 1, '', "cronform"); } print ""; @@ -527,8 +519,7 @@ if (($action == "create") || ($action == "edit")) { print $form->selectDate($object->datenextrun, 'datenextrun', 1, 1, '', "cronform"); } - else - { + else { print $form->selectDate(-1, 'datenextrun', 1, 1, '', "cronform"); } print ""; @@ -548,8 +539,7 @@ if (($action == "create") || ($action == "edit")) print "\n"; } -else -{ +else { /* * view card */ @@ -622,8 +612,7 @@ else { print $langs->trans("AllEntities"); } - else - { + else { $mc->getInfo($object->entity); print $mc->label; } diff --git a/htdocs/cron/class/cronjob.class.php b/htdocs/cron/class/cronjob.class.php index 92a132a6789..f3c02c72cbb 100644 --- a/htdocs/cron/class/cronjob.class.php +++ b/htdocs/cron/class/cronjob.class.php @@ -280,8 +280,7 @@ class Cronjob extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -378,8 +377,7 @@ class Cronjob extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -518,8 +516,7 @@ class Cronjob extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -655,8 +652,7 @@ class Cronjob extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -697,8 +693,7 @@ class Cronjob extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -753,8 +748,7 @@ class Cronjob extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -895,8 +889,7 @@ class Cronjob extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -952,8 +945,7 @@ class Cronjob extends CommonObject $conf->entity = $savcurrententity; return -1; } - else - { + else { if (empty($user->id)) { $this->error = " User user login:".$userlogin." do not exists"; @@ -1057,8 +1049,7 @@ class Cronjob extends CommonObject { $result = call_user_func(array($object, $this->methodename), $this->params); } - else - { + else { $result = call_user_func_array(array($object, $this->methodename), $params_arr); } @@ -1079,8 +1070,7 @@ class Cronjob extends CommonObject $retval = $this->lastresult; $error++; } - else - { + else { dol_syslog(get_class($this)."::run_jobs END"); $this->lastoutput = $object->output; $this->lastresult = var_export($result, true); @@ -1117,8 +1107,7 @@ class Cronjob extends CommonObject { $result = call_user_func($this->methodename, $this->params); } - else - { + else { $result = call_user_func_array($this->methodename, $params_arr); } @@ -1132,8 +1121,7 @@ class Cronjob extends CommonObject $retval = $this->lastresult; $error++; } - else - { + else { $this->lastoutput = var_export($result, true); $this->lastresult = var_export($result, true); // Return code $retval = $this->lastresult; @@ -1202,8 +1190,7 @@ class Cronjob extends CommonObject dol_syslog(get_class($this)."::reprogram_jobs ".$this->error, LOG_ERR); return -1; } - else - { + else { if (empty($user->id)) { $this->error = " User user login:".$userlogin." do not exists"; @@ -1230,8 +1217,7 @@ class Cronjob extends CommonObject // TODO For exact frequency (every month, every year, ...), use instead a dol_time_plus_duree($time, $duration_value, $duration_unit) } } - else - { + else { //$this->datenextrun=$this->datenextrun + ($this->frequency * $this->unitfrequency); dol_syslog(get_class($this)."::reprogram_jobs datenextrun is already in future, we do not change it"); } diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index e9afad3b48b..a91dd4b9d66 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -133,8 +133,7 @@ if (empty($reshook)) setEventMessages('Security key '.$securitykey.' is wrong', null, 'errors'); $action = ''; } - else - { + else { $object = new Cronjob($db); $job = $object->fetch($id); @@ -156,8 +155,7 @@ if (empty($reshook)) } $action = ''; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -197,8 +195,7 @@ if (empty($reshook)) //else dol_print_error($db, 'Bad value for massaction'); if ($result < 0) setEventMessages($tmpcron->error, $tmpcron->errors, 'errors'); } - else - { + else { $error++; } } @@ -445,8 +442,7 @@ if ($num > 0) print $object->getNomUrl(0, '', 1); $object->ref = $obj->rowid; } - else - { + else { //print $langs->trans('CronNone'); } print ''; @@ -587,8 +583,7 @@ if ($num > 0) $i++; } } -else -{ +else { print ''.$langs->trans('CronNoJobs').''; } diff --git a/htdocs/dav/dav.class.php b/htdocs/dav/dav.class.php index 60912b86a8a..673c42e27a0 100644 --- a/htdocs/dav/dav.class.php +++ b/htdocs/dav/dav.class.php @@ -89,8 +89,7 @@ class CdavLib LEFT JOIN '.MAIN_DB_PREFIX.'socpeople AS sp ON (sp.fk_soc = sc.fk_soc AND sp.rowid = a.fk_contact) LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_cdav AS ac ON (a.id = ac.fk_object)'; } - else - { + else { $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe AS s ON (s.rowid = a.fk_soc) LEFT JOIN '.MAIN_DB_PREFIX.'socpeople AS sp ON (sp.rowid = a.fk_contact) LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_cdav AS ac ON (a.id = ac.fk_object)'; @@ -106,8 +105,7 @@ class CdavLib { $sql .= ' AND a.id = '.intval($oid); } - else - { + else { $sql .= ' AND (a.id = '.intval($oid).' OR ac.uuidext = \''.$this->db->escape($ouri).'\')'; } } @@ -161,8 +159,7 @@ class CdavLib if ($obj->percent == -1 && trim($obj->datep) != '') $type = 'VEVENT'; - else - $type = 'VTODO'; + else $type = 'VTODO'; $timezone = date_default_timezone_get(); @@ -176,8 +173,7 @@ class CdavLib $caldata .= "DTSTAMP:".gmdate('Ymd\THis', strtotime($obj->lastupd))."Z\n"; if ($obj->sourceuid == '') $caldata .= "UID:".$obj->id.'-ev-'.$calid.'-cal-'.constant('CDAV_URI_KEY')."\n"; - else - $caldata .= "UID:".$obj->sourceuid."\n"; + else $caldata .= "UID:".$obj->sourceuid."\n"; $caldata .= "SUMMARY:".$obj->label."\n"; $caldata .= "LOCATION:".$location."\n"; $caldata .= "PRIORITY:".$obj->priority."\n"; @@ -188,21 +184,18 @@ class CdavLib { if (trim($obj->datep2) != '') $caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep2) + 1)."\n"; - else - $caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep) + (25 * 3600))."\n"; + else $caldata .= "DTEND;VALUE=DATE:".date('Ymd', strtotime($obj->datep) + (25 * 3600))."\n"; } elseif (trim($obj->datep2) != '') $caldata .= "DUE;VALUE=DATE:".date('Ymd', strtotime($obj->datep2) + 1)."\n"; } - else - { + else { $caldata .= "DTSTART;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n"; if ($type == 'VEVENT') { if (trim($obj->datep2) != '') $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n"; - else - $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n"; + else $caldata .= "DTEND;TZID=".$timezone.":".strtr($obj->datep, array(" "=>"T", ":"=>"", "-"=>""))."\n"; } elseif (trim($obj->datep2) != '') $caldata .= "DUE;TZID=".$timezone.":".strtr($obj->datep2, array(" "=>"T", ":"=>"", "-"=>""))."\n"; @@ -210,8 +203,7 @@ class CdavLib $caldata .= "CLASS:PUBLIC\n"; if ($obj->transparency == 1) $caldata .= "TRANSP:TRANSPARENT\n"; - else - $caldata .= "TRANSP:OPAQUE\n"; + else $caldata .= "TRANSP:OPAQUE\n"; if ($type == 'VEVENT') $caldata .= "STATUS:CONFIRMED\n"; @@ -219,8 +211,7 @@ class CdavLib $caldata .= "STATUS:NEEDS-ACTION\n"; elseif ($obj->percent == 100) $caldata .= "STATUS:COMPLETED\n"; - else - { + else { $caldata .= "STATUS:IN-PROCESS\n"; $caldata .= "PERCENT-COMPLETE:".$obj->percent."\n"; } @@ -285,8 +276,7 @@ class CdavLib 'component' => strpos($calendardata, 'BEGIN:VEVENT') > 0 ? 'vevent' : 'vtodo', ); } - else - { + else { $calevents[] = array( // 'calendardata' => $calendardata, not necessary because etag+size are present 'uri' => $obj->id.'-ev-'.constant('CDAV_URI_KEY'), diff --git a/htdocs/dav/dav.lib.php b/htdocs/dav/dav.lib.php index b306ec7161a..bb4835c4d52 100644 --- a/htdocs/dav/dav.lib.php +++ b/htdocs/dav/dav.lib.php @@ -26,8 +26,7 @@ if (!defined('CDAV_CONTACT_TAG')) { if (isset($conf->global->CDAV_CONTACT_TAG)) define('CDAV_CONTACT_TAG', $conf->global->CDAV_CONTACT_TAG); - else - define('CDAV_CONTACT_TAG', ''); + else define('CDAV_CONTACT_TAG', ''); } // define CDAV_URI_KEY if not @@ -35,8 +34,7 @@ if (!defined('CDAV_URI_KEY')) { if (isset($conf->global->CDAV_URI_KEY)) define('CDAV_URI_KEY', $conf->global->CDAV_URI_KEY); - else - define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8)); + else define('CDAV_URI_KEY', substr(md5($_SERVER['HTTP_HOST']), 0, 8)); } diff --git a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php index fd9f993e1e8..03d91fff140 100644 --- a/htdocs/debugbar/class/DataCollector/DolLogsCollector.php +++ b/htdocs/debugbar/class/DataCollector/DolLogsCollector.php @@ -78,8 +78,7 @@ class DolLogsCollector extends MessagesCollector { $this->getStorageLogs($this->path); } - else - { + else { $log_levels = $this->getLevels(); foreach ($conf->logbuffer as $line) { diff --git a/htdocs/ecm/ajax/ecmdatabase.php b/htdocs/ecm/ajax/ecmdatabase.php index 9f4820cd723..91564ec8f80 100644 --- a/htdocs/ecm/ajax/ecmdatabase.php +++ b/htdocs/ecm/ajax/ecmdatabase.php @@ -115,14 +115,12 @@ if (isset($action) && !empty($action)) $fk_parent = $parentdirisindatabase; //break; // We found parent, we can stop the while loop } - else - { + else { dol_syslog("No"); //print "No
\n"; } } - else - { + else { dol_syslog("Parent is root"); $fk_parent = 0; // Parent is root } @@ -149,8 +147,7 @@ if (isset($action) && !empty($action)) //var_dump($sqltree); $adirwascreated = 1; } - else - { + else { dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); } } diff --git a/htdocs/ecm/class/ecmdirectory.class.php b/htdocs/ecm/class/ecmdirectory.class.php index 3bddd70bfaa..fc450e9864e 100644 --- a/htdocs/ecm/class/ecmdirectory.class.php +++ b/htdocs/ecm/class/ecmdirectory.class.php @@ -165,8 +165,7 @@ class EcmDirectory // extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_WARNING); return -1; } - else - { + else { $this->db->begin(); // Insert request @@ -208,14 +207,12 @@ class EcmDirectory // extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -274,8 +271,7 @@ class EcmDirectory // extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -303,8 +299,7 @@ class EcmDirectory // extends CommonObject $this->error = "Error ".$this->db->lasterror(); return -1; } - else - { + else { if (preg_match('/[0-9]+/', $value)) $this->cachenbofdoc = (int) $value; elseif ($value == '+') $this->cachenbofdoc++; elseif ($value == '-') $this->cachenbofdoc--; @@ -359,8 +354,7 @@ class EcmDirectory // extends CommonObject return $obj ? 1 : 0; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -399,8 +393,7 @@ class EcmDirectory // extends CommonObject $this->error = "Error ".$this->db->lasterror(); return -2; } - else - { + else { // Call trigger $result = $this->call_trigger('MYECMDIR_DELETE', $user); if ($result < 0) @@ -418,8 +411,7 @@ class EcmDirectory // extends CommonObject { $result = @dol_delete_dir_recursive($file, 0, 0); } - else - { + else { $result = @dol_delete_dir($file, 0); } } @@ -428,8 +420,7 @@ class EcmDirectory // extends CommonObject { $this->db->commit(); } - else - { + else { $this->error = 'ErrorFailToDeleteDir'; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); @@ -565,8 +556,7 @@ class EcmDirectory // extends CommonObject } return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -673,8 +663,7 @@ class EcmDirectory // extends CommonObject //print "this->cats[$i]['id_children'] est deja un tableau de $newelem elements
"; $this->cats[$obj->rowid]['id_children'][$newelempos] = $obj->rowid_fille; } - else - { + else { //print "this->cats[".$obj->rowid."]['id_children'] n'est pas encore un tableau
"; $this->cats[$obj->rowid]['id_children'] = array($obj->rowid_fille); } @@ -682,8 +671,7 @@ class EcmDirectory // extends CommonObject $i++; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -723,8 +711,7 @@ class EcmDirectory // extends CommonObject $this->cats[$id_categ]['fulllabel'] = $this->cats[$this->cats[$id_categ]['id_mere']]['fulllabel']; $this->cats[$id_categ]['fulllabel'] .= ' >> '.$this->cats[$id_categ]['label']; } - else - { + else { $this->cats[$id_categ]['fullpath'] = '_'.$id_categ; $this->cats[$id_categ]['fullrelativename'] = $this->cats[$id_categ]['label']; $this->cats[$id_categ]['fulllabel'] = $this->cats[$id_categ]['label']; @@ -768,8 +755,7 @@ class EcmDirectory // extends CommonObject { $sql .= " WHERE rowid = ".$this->id; } - else - { + else { $sql .= " WHERE entity = ".$conf->entity; } @@ -780,8 +766,7 @@ class EcmDirectory // extends CommonObject $this->cachenbofdoc = count($filelist); return $this->cachenbofdoc; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -813,8 +798,7 @@ class EcmDirectory // extends CommonObject { $this->errors = array_merge($this->errors, $interface->errors); } - else - { + else { $this->errors = $interface->errors; } } diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 6921b8aabd6..e24af560143 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -200,15 +200,13 @@ class EcmFiles extends CommonObject $obj = $this->db->fetch_object($resql); $maxposition = (int) $obj->maxposition; } - else - { + else { $this->errors[] = 'Error '.$this->db->lasterror(); return --$error; } $maxposition = $maxposition + 1; } - else - { + else { $maxposition = $this->position; } diff --git a/htdocs/ecm/class/htmlecm.form.class.php b/htdocs/ecm/class/htmlecm.form.class.php index de9f289eb79..e1e7bf40873 100644 --- a/htdocs/ecm/class/htmlecm.form.class.php +++ b/htdocs/ecm/class/htmlecm.form.class.php @@ -81,8 +81,7 @@ class FormEcm if (is_array($cate_arbo)) { if (!count($cate_arbo)) $output .= ''; - else - { + else { $output .= ''; foreach ($cate_arbo as $key => $value) { @@ -91,8 +90,7 @@ class FormEcm { $add = 'selected '; } - else - { + else { $add = ''; } $output .= ''; diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 4d6f2bdce5a..9eb95c1f198 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -57,7 +57,7 @@ if ($module == 'ecm') { $upload_dir = $conf->ecm->dir_output.'/'.$urlsection; } -else // For example $module == 'medias' +else // For example $module == 'medias' { $upload_dir = $conf->medias->multidir_output[$conf->entity]; } @@ -116,8 +116,7 @@ if ($action == 'add' && $permtoadd) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'.($module ? '&module='.$module : '')); exit; } @@ -156,7 +155,7 @@ if ($action == 'add' && $permtoadd) $action = 'create'; } } - else // For example $module == 'medias' + else // For example $module == 'medias' { $dirfornewdir = ''; if ($module == 'medias') @@ -178,8 +177,7 @@ if ($action == 'add' && $permtoadd) setEventMessages($langs->trans('ErrorFailToCreateDir', $label), null, 'errors'); $error++; } - else - { + else { setEventMessages($langs->trans("ECMSectionWasCreated", $label), null, 'mesgs'); } } @@ -193,8 +191,7 @@ if ($action == 'add' && $permtoadd) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT.'/ecm/index.php?action=file_manager'); exit; } @@ -302,8 +299,7 @@ if (empty($action) || $action == 'delete_section') { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } print ''; diff --git a/htdocs/ecm/dir_card.php b/htdocs/ecm/dir_card.php index 9b3da9d8aae..78b7d16bb5d 100644 --- a/htdocs/ecm/dir_card.php +++ b/htdocs/ecm/dir_card.php @@ -75,7 +75,7 @@ if ($module == 'ecm') $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } -else // For example $module == 'medias' +else // For example $module == 'medias' { $relativepath = $section; $upload_dir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath; @@ -111,8 +111,7 @@ if (GETPOST("sendit") && !empty($conf->global->MAIN_UPLOAD_DOC)) { $result = $ecmdir->changeNbOfFiles('+'); } - else - { + else { $langs->load("errors"); if ($resupload < 0) // Unknown error { @@ -121,14 +120,13 @@ if (GETPOST("sendit") && !empty($conf->global->MAIN_UPLOAD_DOC)) // Files infected by a virus setEventMessages($langs->trans("ErrorFileIsInfectedWithAVirus"), null, 'errors'); } - else // Known error + else // Known error { setEventMessages($langs->trans($resupload), null, 'errors'); } } } - else - { + else { // Failed transfer (exceeding the limit file?) $langs->load("errors"); setEventMessages($langs->trans("ErrorFailToCreateDir", $upload_dir), null, 'errors'); @@ -168,19 +166,16 @@ if ($action == 'confirm_deletedir' && $confirm == 'yes') setEventMessages($langs->trans($ecmdir->error, $ecmdir->label), null, 'errors'); } } - else - { + else { if ($deletedirrecursive) { $resbool = dol_delete_dir_recursive($upload_dir, 0, 1); } - else - { + else { $resbool = dol_delete_dir($upload_dir, 1); } if ($resbool) $result = 1; - else - { + else { $langs->load('errors'); setEventMessages($langs->trans("ErrorFailToDeleteDir", $upload_dir), null, 'errors'); $result = 0; @@ -204,8 +199,7 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha')) $olddir = $ecmdir->getRelativePath(0); $olddir = $conf->ecm->dir_output.'/'.$olddir; } - else - { + else { $olddir = GETPOST('section', 'alpha'); $olddir = $conf->medias->multidir_output[$conf->entity].'/'.$relativepath; } @@ -243,19 +237,16 @@ if ($action == 'update' && !GETPOST('cancel', 'alpha')) $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } - else - { + else { $db->rollback(); } } - else - { + else { $db->rollback(); setEventMessages($ecmdir->error, $ecmdir->errors, 'errors'); } } - else - { + else { $newdir = $conf->medias->multidir_output[$conf->entity].'/'.GETPOST('oldrelparentdir', 'alpha').'/'.GETPOST('label', 'alpha'); $result = @rename($olddir, $newdir); @@ -341,8 +332,7 @@ if ($module == 'ecm') $s = ' -> '.$s; $result = $tmpecmdir->fetch($tmpecmdir->fk_parent); } - else - { + else { $tmpecmdir = 0; } $i++; @@ -412,8 +402,7 @@ if ($module == 'ecm') { print dol_print_date($ecmdir->date_c, 'dayhour'); } -else -{ +else { //var_dump($upload_dir); print dol_print_date(dol_filemtime($upload_dir), 'dayhour'); } @@ -423,8 +412,7 @@ if ($module == 'ecm') { print '/ecm/'.$relativepath; } -else -{ +else { print '/'.$module.'/'.$relativepath; } print ''; @@ -478,8 +466,7 @@ if ($action != 'edit' && $action != 'delete') { print ''.$langs->trans('ECMAddSection').''; } - else - { + else { print ''.$langs->trans('ECMAddSection').''; } @@ -489,8 +476,7 @@ if ($action != 'edit' && $action != 'delete') { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } /*} diff --git a/htdocs/ecm/file_card.php b/htdocs/ecm/file_card.php index 1c94fd1700b..bddbd0f6294 100644 --- a/htdocs/ecm/file_card.php +++ b/htdocs/ecm/file_card.php @@ -114,8 +114,7 @@ if ($cancel) header("Location: ".$backtopage); exit; } - else - { + else { header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section).($module ? '&module='.urlencode($module) : '')); exit; } @@ -171,8 +170,7 @@ if ($action == 'update') require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $object->share = getRandomPassword(true); } - else - { + else { $object->share = ''; } @@ -185,8 +183,7 @@ if ($action == 'update') setEventMessages($object->error, $object->errors, 'warnings'); } } - else - { + else { // Call create to insert record $object->entity = $conf->entity; $object->filepath = preg_replace('/[\\/]+$/', '', $newdirrelativetodocument); @@ -212,8 +209,7 @@ if ($action == 'update') header('Location: '.$_SERVER["PHP_SELF"].'?urlfile='.urlencode($urlfile).'§ion='.urlencode($section)); exit; } - else - { + else { $db->rollback(); } } @@ -258,8 +254,7 @@ while ($tmpecmdir && $result > 0) $s = ' -> '.$s; $result = $tmpecmdir->fetch($tmpecmdir->fk_parent); } - else - { + else { $tmpecmdir = 0; } $i++; @@ -299,8 +294,7 @@ if (!empty($object->label)) { print $object->label; } -else -{ +else { print img_warning().' '.$langs->trans("FileNotYetIndexedInDatabase"); } print ''; @@ -349,19 +343,16 @@ if (!empty($object->share)) else print $fulllink; if ($action != 'edit') print ' '.$langs->trans("Download").''; // No target here } - else - { + else { print 'share ? ' checked="checked"' : '').' /> '; } } -else -{ +else { if ($action != 'edit') { print ''.$langs->trans("FileNotShared").''; } - else - { + else { print 'share ? ' checked="checked"' : '').' /> '; } } diff --git a/htdocs/ecm/index.php b/htdocs/ecm/index.php index 43b9ca6dcce..09350d2b245 100644 --- a/htdocs/ecm/index.php +++ b/htdocs/ecm/index.php @@ -136,8 +136,7 @@ if ($action == 'confirm_deletefile') setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile', 'alpha')), null, 'mesgs'); $result = $ecmdir->changeNbOfFiles('-'); } - else - { + else { setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile', 'alpha')), null, 'errors'); } @@ -159,8 +158,7 @@ if ($action == 'add' && $user->rights->ecm->setup) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors'); $action = "create"; } @@ -247,14 +245,12 @@ if ($action == 'refreshmanual') $fk_parent = $parentdirisindatabase; //break; // We found parent, we can stop the while loop } - else - { + else { dol_syslog("No"); //print "No
\n"; } } - else - { + else { dol_syslog("Parent is root"); $fk_parent = 0; // Parent is root } @@ -281,8 +277,7 @@ if ($action == 'refreshmanual') //var_dump($sqltree); $adirwascreated = 1; } - else - { + else { dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); } } diff --git a/htdocs/ecm/index_auto.php b/htdocs/ecm/index_auto.php index 39bdc9a1612..9b8c82ca05e 100644 --- a/htdocs/ecm/index_auto.php +++ b/htdocs/ecm/index_auto.php @@ -103,8 +103,7 @@ if ($action == 'add' && $user->rights->ecm->setup) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages('Error '.$langs->trans($ecmdir->error), null, 'errors'); $action = "create"; } @@ -222,14 +221,12 @@ if ($action == 'refreshmanual') $fk_parent = $parentdirisindatabase; //break; // We found parent, we can stop the while loop } - else - { + else { dol_syslog("No"); //print "No
\n"; } } - else - { + else { dol_syslog("Parent is root"); $fk_parent = 0; // Parent is root } @@ -256,8 +253,7 @@ if ($action == 'refreshmanual') //var_dump($sqltree); $adirwascreated = 1; } - else - { + else { dol_syslog("Failed to create directory ".$ecmdirtmp->label, LOG_ERR); } } @@ -419,8 +415,7 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i', $act print $val['label']; print ''; } - else - { + else { print ''; print $val['label']; print ''; diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index bf1a4e26de7..1cbd01d39e8 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -586,8 +586,7 @@ class EmailCollector extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -773,8 +772,7 @@ class EmailCollector extends CommonObject $tmpclass = $tmparray[0]; $tmpproperty = $tmparray[1]; } - else - { + else { $tmpproperty = $tmparray[0]; } if ($tmpclass && ($tmpclass != $object->element)) continue; // Property is for another type of object @@ -818,14 +816,12 @@ class EmailCollector extends CommonObject // Overwrite param $tmpproperty $object->$tmpproperty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; } - else - { + else { // Regex not found $object->$tmpproperty = null; } } - else - { + else { // Nothing can be done for this param $errorforthisaction++; $this->error = 'The extract rule to use has on an unknown source (must be HEADER, SUBJECT or BODY)'; @@ -863,8 +859,7 @@ class EmailCollector extends CommonObject else $object->$tmpproperty = $valuetouse; } } - else - { + else { $errorforthisaction++; $this->error = 'Bad syntax for description of action parameters: '.$actionparam; $this->errors[] = $this->error; @@ -1239,8 +1234,7 @@ class EmailCollector extends CommonObject $from = $reg[2]; $fromtext = $reg[1]; } - else - { + else { $from = $fromstring; $fromtext = ''; } @@ -1313,8 +1307,7 @@ class EmailCollector extends CommonObject { $result = $projectstatic->fetch($projectid); if ($result <= 0) $projectstatic->id = 0; - else - { + else { $projectid = $projectstatic->id; $projectfoundby = 'trackid ('.$trackid.')'; if (empty($contactid)) $contactid = $projectstatic->fk_contact; @@ -1326,8 +1319,7 @@ class EmailCollector extends CommonObject { $result = $contactstatic->fetch($contactid); if ($result <= 0) $contactstatic->id = 0; - else - { + else { $contactid = $contactstatic->id; $contactfoundby = 'trackid ('.$trackid.')'; if (empty($thirdpartyid)) $thirdpartyid = $contactstatic->fk_soc; @@ -1338,8 +1330,7 @@ class EmailCollector extends CommonObject { $result = $thirdpartystatic->fetch($thirdpartyid); if ($result <= 0) $thirdpartystatic->id = 0; - else - { + else { $thirdpartyid = $thirdpartystatic->id; $thirdpartyfoundby = 'trackid ('.$trackid.')'; } @@ -1409,8 +1400,7 @@ class EmailCollector extends CommonObject $this->error = "Action loadthirdparty or loadandcreatethirdparty has empty parameter. Must be 'SET:xxx' or 'EXTRACT:(body|subject):regex' to define how to extract data"; $this->errors[] = $this->error; } - else - { + else { $actionparam = $operation['actionparam']; $nametouseforthirdparty = ''; @@ -1445,15 +1435,13 @@ class EmailCollector extends CommonObject // Overwrite param $tmpproperty $nametouseforthirdparty = isset($regforval[count($regforval) - 1]) ?trim($regforval[count($regforval) - 1]) : null; } - else - { + else { // Regex not found $nametouseforthirdparty = null; } //var_dump($object->$tmpproperty);exit; } - else - { + else { // Nothing can be done for this param $errorforactions++; $this->error = 'The extract rule to use to load thirdparty has on an unknown source (must be HEADER, SUBJECT or BODY)'; @@ -1466,8 +1454,7 @@ class EmailCollector extends CommonObject //else $object->$tmpproperty = $reg[1]; $nametouseforthirdparty = $reg[2]; } - else - { + else { $errorforactions++; $this->error = 'Bad syntax for description of action parameters: '.$actionparam; $this->errors[] = $this->error; @@ -1511,8 +1498,7 @@ class EmailCollector extends CommonObject { $errorforactions++; } - else - { + else { $result = $thirdpartystatic->create($user); if ($result <= 0) { @@ -1598,8 +1584,7 @@ class EmailCollector extends CommonObject { $errorforactions++; } - else - { + else { $result = $actioncomm->create($user); if ($result <= 0) { @@ -1701,15 +1686,13 @@ class EmailCollector extends CommonObject { $errorforactions++; } - else - { + else { if (empty($projecttocreate->ref) || (is_numeric($projecttocreate->ref) && $projecttocreate->ref <= 0)) { $errorforactions++; $this->error = 'Failed to create project: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; } - else - { + else { // Create project $result = $projecttocreate->create($user); if ($result <= 0) @@ -1849,15 +1832,13 @@ class EmailCollector extends CommonObject { $errorforactions++; } - else - { + else { if (is_numeric($tickettocreate->ref) && $tickettocreate->ref <= 0) { $errorforactions++; $this->error = 'Failed to create ticket: Can\'t get a valid value for the field ref with numbering template = '.$modele.', thirdparty id = '.$thirdpartystatic->id; } - else - { + else { // Create project $result = $tickettocreate->create($user); if ($result <= 0) @@ -1890,13 +1871,11 @@ class EmailCollector extends CommonObject dol_syslog(imap_last_error()); } } - else - { + else { dol_syslog("EmailCollector::doCollectOneCollector message ".$imapemail." to ".$connectstringtarget." was set to read", LOG_DEBUG); } } - else - { + else { $errorforemail++; } @@ -1921,8 +1900,7 @@ class EmailCollector extends CommonObject break; } } - else - { + else { $error++; $this->db->rollback(); @@ -1933,8 +1911,7 @@ class EmailCollector extends CommonObject dol_syslog("End of loop on emails", LOG_INFO, -1); } - else - { + else { $output = $langs->trans('NoNewEmailToProcess'); } @@ -2071,8 +2048,7 @@ class EmailCollector extends CommonObject // so append parts together with blank row. if (strtolower($p->subtype) == 'plain') $plainmsg .= trim($data)."\n\n"; - else - $htmlmsg .= $data."

"; + else $htmlmsg .= $data."

"; $charset = $params['charset']; // assume all parts are same charset } diff --git a/htdocs/emailcollector/class/emailcollectoraction.class.php b/htdocs/emailcollector/class/emailcollectoraction.class.php index d0d6239a7f2..b4fdf52ca5b 100644 --- a/htdocs/emailcollector/class/emailcollectoraction.class.php +++ b/htdocs/emailcollector/class/emailcollectoraction.class.php @@ -504,8 +504,7 @@ class EmailCollectorAction extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/emailcollector/class/emailcollectorfilter.class.php b/htdocs/emailcollector/class/emailcollectorfilter.class.php index 63521e81c3a..106d57c23c5 100644 --- a/htdocs/emailcollector/class/emailcollectorfilter.class.php +++ b/htdocs/emailcollector/class/emailcollectorfilter.class.php @@ -479,8 +479,7 @@ class EmailCollectorFilter extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 95b6f6208a5..cdc4da7fe51 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -266,8 +266,7 @@ if (empty($reshook)) $totalqty += $subtotalqty; } - else - { + else { // No detail were provided for lots if (!empty($_POST[$qty])) { @@ -296,8 +295,7 @@ if (empty($reshook)) $qty = "qtyl".$i.'_'.$j; } } - else - { + else { //var_dump(GETPOST($qty,'int')); var_dump($_POST); var_dump($batch);exit; //shipment line for product with no batch management and no multiple stock location if (GETPOST($qty, 'int') > 0) $totalqty += GETPOST($qty, 'int'); @@ -342,8 +340,7 @@ if (empty($reshook)) } } } - else - { + else { if (GETPOST($qty, 'int') > 0 || (GETPOST($qty, 'int') == 0 && $conf->global->SHIPMENT_GETS_ALL_ORDER_PRODUCTS)) { $ent = "entl".$i; @@ -361,8 +358,7 @@ if (empty($reshook)) } } } - else - { + else { // batch mode if ($batch_line[$i]['qty'] > 0) { @@ -389,8 +385,7 @@ if (empty($reshook)) } } } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("QtyToShip").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; } @@ -401,8 +396,7 @@ if (empty($reshook)) header("Location: card.php?id=".$object->id); exit; } - else - { + else { $db->rollback(); $_GET["commande_id"] = GETPOST('commande_id', 'int'); $action = 'create'; @@ -420,8 +414,7 @@ if (empty($reshook)) header("Location: ".DOL_URL_ROOT.'/livraison/card.php?action=create_delivery&id='.$result); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -440,8 +433,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans($object->error), $object->errors, 'errors'); } - else - { + else { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -470,8 +462,7 @@ if (empty($reshook)) { $result = $object->setStatut(-1); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -485,8 +476,7 @@ if (empty($reshook)) header("Location: ".DOL_URL_ROOT.'/expedition/index.php'); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -601,8 +591,7 @@ if (empty($reshook)) } } } - else - { + else { // delete single warehouse line $line->id = $line_id; if (!$error && $line->delete($user) < 0) @@ -618,8 +607,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); } - else - { + else { setEventMessages($line->error, $line->errors, 'errors'); } } @@ -684,8 +672,7 @@ if (empty($reshook)) $error++; } } - else - { + else { setEventMessages($lotStock->error, $lotStock->errors, 'errors'); $error++; } @@ -738,14 +725,12 @@ if (empty($reshook)) $error++; } } - else - { + else { setEventMessages($line->error, $line->errors, 'errors'); $error++; } } - else - { + else { // create new line with new lot $line->origin_line_id = $lines[$i]->origin_line_id; $line->entrepot_id = $lotStock->warehouseid; @@ -761,15 +746,13 @@ if (empty($reshook)) } } } - else - { + else { setEventMessages($lotStock->error, $lotStock->errors, 'errors'); $error++; } } } - else - { + else { if ($lines[$i]->fk_product > 0) { // line without lot @@ -813,8 +796,7 @@ if (empty($reshook)) } } } - else - { + else { // Product no predefined $qty = "qtyl".$line_id; $line->id = $line_id; @@ -850,8 +832,7 @@ if (empty($reshook)) $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } - else - { + else { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // To redisplay the form being edited exit(); } @@ -1133,8 +1114,7 @@ if ($action == 'create') { print ''.$langs->trans("Warehouse").' ('.$langs->trans("Stock").')'; } - else - { + else { print ''.$langs->trans("Warehouse").' / '.$langs->trans("Batch").' ('.$langs->trans("Stock").')'; } } @@ -1195,8 +1175,7 @@ if ($action == 'create') print ''; } - else - { + else { print ""; if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -1232,8 +1211,7 @@ if ($action == 'create') { $quantityToBeDelivered = 0; } - else - { + else { $quantityToBeDelivered = $quantityAsked - $quantityDelivered; } $warehouse_id = GETPOST('entrepot_id', 'int'); @@ -1289,8 +1267,7 @@ if ($action == 'create') } } } - else - { + else { print $langs->trans("Service"); } print ''; @@ -1321,8 +1298,7 @@ if ($action == 'create') } } } - else - { + else { // Product need lot print ''; // end line and start a new one for lot/serial print ''; @@ -1377,8 +1353,7 @@ if ($action == 'create') print ''; } } - else - { + else { print ''; print ''; print ' '; @@ -1390,8 +1365,7 @@ if ($action == 'create') } } } - else - { + else { // ship from multiple locations if (empty($conf->productbatch->enabled) || !$product->hasbatch()) { @@ -1440,8 +1414,7 @@ if ($action == 'create') print ''; print '('.$stock.')'; } - else - { + else { print $langs->trans("Service"); } print ''; @@ -1480,8 +1453,7 @@ if ($action == 'create') } } } - else - { + else { print ''; print ''; // end line and start a new one for lot/serial @@ -1553,8 +1525,7 @@ if ($action == 'create') } print ' '; } - else - { + else { print $langs->trans("NA"); } print ''; @@ -1569,14 +1540,12 @@ if ($action == 'create') $warehouseObject->fetch($warehouse_selected_id); print img_warning().' '.$langs->trans("NoProductToShipFoundIntoStock", $warehouseObject->label); } - else - { + else { if ($line->fk_product) print img_warning().' '.$langs->trans("StockTooLow"); else print ''; } } - else - { + else { print $langs->trans("Service"); } print ''; @@ -1617,8 +1586,7 @@ if ($action == 'create') print '
'; } - else - { + else { dol_print_error($db); } } @@ -1687,8 +1655,7 @@ elseif ($id || $ref) { $numref = $object->getNextNumRef($soc); } - else - { + else { $numref = $object->ref; } @@ -1834,8 +1801,7 @@ elseif ($id || $ref) print ''; print ''; } - else - { + else { print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; } print ''; @@ -1858,8 +1824,7 @@ elseif ($id || $ref) print ' '; print ''; } - else - { + else { print $object->trueWeight; print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; } @@ -1893,8 +1858,7 @@ elseif ($id || $ref) print ' '; print ''; } - else - { + else { print $object->trueHeight; print ($object->trueHeight && $object->height_units != '') ? ' '.measuringUnitString(0, "size", $object->height_units) : ''; } @@ -1971,8 +1935,7 @@ elseif ($id || $ref) print ''; print ''; } - else - { + else { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey @@ -2004,8 +1967,7 @@ elseif ($id || $ref) { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } - else - { + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -2065,8 +2027,7 @@ elseif ($id || $ref) { print $langs->trans("QtyToShip").' - '; } - else - { + else { print $langs->trans("QtyShipped").' - '; } if (!empty($conf->stock->enabled)) @@ -2079,14 +2040,12 @@ elseif ($id || $ref) } print ''; } - else - { + else { if ($object->statut <= 1) { print ''.$langs->trans("QtyToShip").''; } - else - { + else { print ''.$langs->trans("QtyShipped").''; } if (!empty($conf->stock->enabled)) @@ -2196,8 +2155,7 @@ elseif ($id || $ref) $prod->fetch($lines[$i]->fk_product); $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label; } - else - $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); + else $label = (!empty($lines[$i]->label) ? $lines[$i]->label : $lines[$i]->product_label); print ''; @@ -2231,8 +2189,7 @@ elseif ($id || $ref) } print "\n"; } - else - { + else { print ''; if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -2343,14 +2300,12 @@ elseif ($id || $ref) print ''; } } - else - { + else { print ''; print ''.$langs->trans("NotEnoughStock").''; } } - else - { + else { print ''; print ''; // Qty to ship or shipped @@ -2365,8 +2320,7 @@ elseif ($id || $ref) print ''; } - else - { + else { // Qty to ship or shipped print ''.$lines[$i]->qty_shipped.''; @@ -2417,8 +2371,7 @@ elseif ($id || $ref) } print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); } - else - { + else { print $langs->trans("NA"); } print ''; @@ -2484,8 +2437,7 @@ elseif ($id || $ref) { print $lines[$i]->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked); } - else - { + else { print $lines[$i]->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked); } } @@ -2526,8 +2478,7 @@ elseif ($id || $ref) { print ''.$langs->trans("Validate").''; } - else - { + else { print ''.$langs->trans("Validate").''; } } @@ -2540,8 +2491,7 @@ elseif ($id || $ref) { print ''.$langs->trans("ClassifyUnbilled").''; } - else - { + else { print ''.$langs->trans("ReOpen").''; } } diff --git a/htdocs/expedition/class/api_shipments.class.php b/htdocs/expedition/class/api_shipments.class.php index e337ee5ffb8..42cb273fbcd 100644 --- a/htdocs/expedition/class/api_shipments.class.php +++ b/htdocs/expedition/class/api_shipments.class.php @@ -399,8 +399,7 @@ class Shipments extends DolibarrApi if ($updateRes > 0) { return $this->get($id); } - else - { + else { throw new RestException(405, $this->shipment->error); } } @@ -436,8 +435,7 @@ class Shipments extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->shipment->error); } } diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 1ccfe9944f7..3250ba8aa5e 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -252,14 +252,12 @@ class Expedition extends CommonObject { return $numref; } - else - { + else { dol_print_error($this->db, get_class($this)."::getNextNumRef ".$obj->error); return ""; } } - else - { + else { print $langs->trans("Error")." ".$langs->trans("Error_EXPEDITION_ADDON_NUMBER_NotDefined"); return ""; } @@ -366,8 +364,7 @@ class Expedition extends CommonObject $error++; } } - else - { // with batch management + else { // with batch management if (!$this->create_line_batch($this->lines[$i], $this->lines[$i]->array_options) > 0) { $error++; @@ -406,8 +403,7 @@ class Expedition extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); @@ -417,24 +413,21 @@ class Expedition extends CommonObject return -1 * $error; } } - else - { + else { $error++; $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } } - else - { + else { $error++; $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } } - else - { + else { $error++; $this->error = $this->db->error()." - sql=$sql"; $this->db->rollback(); @@ -504,8 +497,7 @@ class Expedition extends CommonObject { $error++; } - else - { + else { // create shipment batch lines for stockLocation foreach ($tab as $detbatch) { @@ -647,15 +639,13 @@ class Expedition extends CommonObject return 1; } - else - { + else { dol_syslog(get_class($this).'::Fetch no expedition found', LOG_ERR); $this->error = 'Delivery with id '.$id.' not found'; return 0; } } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -707,8 +697,7 @@ class Expedition extends CommonObject { $numref = $this->getNextNumRef($soc); } - else - { + else { $numref = "EXP".$this->id; } $this->newref = dol_sanitizeFileName($numref); @@ -760,8 +749,7 @@ class Expedition extends CommonObject { $qty = $obj->qty; } - else - { + else { $qty = $obj->edbqty; } if ($qty <= 0) continue; @@ -784,8 +772,7 @@ class Expedition extends CommonObject break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. @@ -800,8 +787,7 @@ class Expedition extends CommonObject } } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; @@ -876,8 +862,7 @@ class Expedition extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1 * $error; } @@ -908,8 +893,7 @@ class Expedition extends CommonObject { return $result; } - else - { + else { $this->error = $delivery->error; return $result; } @@ -968,8 +952,7 @@ class Expedition extends CommonObject $product->load_stock('warehouseopen'); $product_stock = $product->stock_warehouse[$entrepot_id]->real; } - else - $product_stock = $product->stock_reel; + else $product_stock = $product->stock_reel; $product_type = $product->type; if ($product_type == 0 && $product_stock < $qty) @@ -1165,8 +1148,7 @@ class Expedition extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -1261,8 +1243,7 @@ class Expedition extends CommonObject break; } } - else - { + else { // We increment stock of batches // We use warehouse selected for each line foreach ($lotArray as $lot) @@ -1278,8 +1259,7 @@ class Expedition extends CommonObject } } } - else - { + else { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -1358,35 +1338,30 @@ class Expedition extends CommonObject return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; }//*/ } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; } } - else - { + else { $this->db->rollback(); return -1; } @@ -1481,8 +1456,7 @@ class Expedition extends CommonObject break; } } - else - { + else { // We increment stock of batches // We use warehouse selected for each line foreach ($lotArray as $lot) @@ -1498,8 +1472,7 @@ class Expedition extends CommonObject } } } - else - { + else { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -1584,35 +1557,30 @@ class Expedition extends CommonObject return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; } } - else - { + else { $this->db->rollback(); return -1; } @@ -1770,8 +1738,7 @@ class Expedition extends CommonObject { $line->detail_batch = $newdetailbatch; } - else - { + else { $line->detail_batch = array_merge($line->detail_batch, $newdetailbatch); } } @@ -1782,8 +1749,7 @@ class Expedition extends CommonObject $this->lines[$lineindex] = $line; $lineindex++; } - else - { + else { $line->total_ht += $tabprice[0]; $line->total_localtax1 += $tabprice[9]; $line->total_localtax2 += $tabprice[10]; @@ -1797,8 +1763,7 @@ class Expedition extends CommonObject $this->db->free($resql); return 1; } - else - { + else { $this->error = $this->db->error(); return -3; } @@ -1831,14 +1796,12 @@ class Expedition extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -2039,14 +2002,12 @@ class Expedition extends CommonObject $this->date_delivery = $date_livraison; return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } } - else - { + else { return -2; } } @@ -2132,8 +2093,7 @@ class Expedition extends CommonObject $sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')"; $resql = $this->db->query($sql); } - else - { + else { $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET"; $sql .= " code='".$this->db->escape($this->update['code'])."'"; $sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'"; @@ -2208,8 +2168,7 @@ class Expedition extends CommonObject $url = str_replace('{TRACKID}', $value, $tracking); $this->tracking_url = sprintf(''.($value ? $value : 'url').'', $url, $url); } - else - { + else { $this->tracking_url = $value; } } @@ -2300,8 +2259,7 @@ class Expedition extends CommonObject { $qty = $obj->qty; } - else - { + else { $qty = $obj->edbqty; } if ($qty <= 0) continue; @@ -2322,8 +2280,7 @@ class Expedition extends CommonObject $error++; break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -2336,8 +2293,7 @@ class Expedition extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -2352,8 +2308,7 @@ class Expedition extends CommonObject } } } - else - { + else { dol_print_error($this->db); $error++; } @@ -2363,8 +2318,7 @@ class Expedition extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->statut = self::STATUS_VALIDATED; $this->db->rollback(); return -1; @@ -2408,8 +2362,7 @@ class Expedition extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->statut = self::STATUS_VALIDATED; $this->billed = 0; $this->db->rollback(); @@ -2477,8 +2430,7 @@ class Expedition extends CommonObject { $qty = $obj->qty; } - else - { + else { $qty = $obj->edbqty; } if ($qty <= 0) continue; @@ -2500,8 +2452,7 @@ class Expedition extends CommonObject $error++; break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -2514,8 +2465,7 @@ class Expedition extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -2538,8 +2488,7 @@ class Expedition extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->statut = self::STATUS_CLOSED; $this->billed = $oldbilled; $this->db->rollback(); @@ -2792,8 +2741,7 @@ class ExpeditionLigne extends CommonObjectLine return 1; } - else - { + else { $this->errors[] = $this->db->lasterror(); $this->error = $this->db->lasterror(); return -1; @@ -2886,8 +2834,7 @@ class ExpeditionLigne extends CommonObjectLine $this->db->rollback(); return -1 * $error; } - else - { + else { $error++; } } @@ -2947,8 +2894,7 @@ class ExpeditionLigne extends CommonObjectLine // End call triggers } } - else - { + else { $this->errors[] = $this->db->lasterror()." - sql=$sql"; $error++; } @@ -2957,8 +2903,7 @@ class ExpeditionLigne extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -3001,8 +2946,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[] = 'ErrorBadParameters'; $error++; } - else - { + else { $batch = $this->detail_batch[0]->batch; $batch_id = $this->detail_batch[0]->fk_origin_stock; $expedition_batch_id = $this->detail_batch[0]->id; @@ -3057,8 +3001,7 @@ class ExpeditionLigne extends CommonObjectLine $this->errors[] = $this->db->lasterror()." - ExpeditionLineBatch::fetchAll"; $error++; } - else - { + else { // caculate new total line qty foreach ($lotArray as $lot) { @@ -3156,8 +3099,7 @@ class ExpeditionLigne extends CommonObjectLine $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::update ".$errmsg, LOG_ERR); diff --git a/htdocs/expedition/class/expeditionbatch.class.php b/htdocs/expedition/class/expeditionbatch.class.php index 6c9942dd9a8..131d2abc261 100644 --- a/htdocs/expedition/class/expeditionbatch.class.php +++ b/htdocs/expedition/class/expeditionbatch.class.php @@ -91,8 +91,7 @@ class ExpeditionLineBatch extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -136,8 +135,7 @@ class ExpeditionLineBatch extends CommonObject $this->fk_expeditiondet = $id_line_expdet; return $this->id; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); @@ -167,8 +165,7 @@ class ExpeditionLineBatch extends CommonObject { return 1; } - else - { + else { return -1; } } @@ -231,8 +228,7 @@ class ExpeditionLineBatch extends CommonObject $db->free($resql); return $ret; } - else - { + else { dol_print_error($db); return -1; } diff --git a/htdocs/expedition/contact.php b/htdocs/expedition/contact.php index 36d471b59d3..1ea47ea199b 100644 --- a/htdocs/expedition/contact.php +++ b/htdocs/expedition/contact.php @@ -88,8 +88,7 @@ if ($action == 'addcontact' && $user->rights->expedition->creer) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index d3fec260d95..15dc8168a54 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -120,8 +120,7 @@ if ($resql) print ''; $i++; } - } else - { + } else { print ''.$langs->trans("None").''; } diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 999bde3fb32..b6de8adc74d 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -687,8 +687,7 @@ if ($resql) print showDimensionInBestUnit($tmparray['weight'], 0, "weight", $langs, isset($conf->global->MAIN_WEIGHT_DEFAULT_ROUND) ? $conf->global->MAIN_WEIGHT_DEFAULT_ROUND : -1, isset($conf->global->MAIN_WEIGHT_DEFAULT_UNIT) ? $conf->global->MAIN_WEIGHT_DEFAULT_UNIT : 'no'); print $form->textwithpicto('', $langs->trans('EstimatedWeight'), 1); } - else - { + else { print $object->trueWeight; print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; } @@ -804,8 +803,7 @@ if ($resql) print $formfile->showdocuments('massfilesarea_sendings', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 75ee2ef4da3..1c874d402b5 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -377,8 +377,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''; } - else - { + else { print dol_print_date($object->date_livraison, 'daytext'); if ($object->hasDelay() && !empty($object->date_livraison)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); @@ -531,8 +530,7 @@ if ($id > 0 || !empty($ref)) { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } - else - { + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -644,8 +642,7 @@ if ($id > 0 || !empty($ref)) { print ''.$langs->trans("RealStock").''; } - else - { + else { print ' '; } print "\n"; @@ -697,8 +694,7 @@ if ($id > 0 || !empty($ref)) $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; } - else - $label = (!empty($objp->label) ? $objp->label : $objp->product_label); + else $label = (!empty($objp->label) ? $objp->label : $objp->product_label); print ''; print ''; // ancre pour retourner sur la ligne @@ -739,8 +735,7 @@ if ($id > 0 || !empty($ref)) print ''; } - else - { + else { print ""; if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -776,8 +771,7 @@ if ($id > 0 || !empty($ref)) $toBeShippedTotal += $toBeShipped[$objp->fk_product]; print $toBeShipped[$objp->fk_product]; } - else - { + else { print '0 ('.$langs->trans("Service").')'; } print ''; @@ -799,8 +793,7 @@ if ($id > 0 || !empty($ref)) } print ''; } - else - { + else { print ' '; } print "\n"; @@ -844,8 +837,7 @@ if ($id > 0 || !empty($ref)) print ""; } - else - { + else { dol_print_error($db); } @@ -871,8 +863,7 @@ if ($id > 0 || !empty($ref)) print ' '.img_warning($langs->trans("WarningNoQtyLeftToSend")); } } - else - { + else { print ''.$langs->trans("CreateShipment").''; } } @@ -935,8 +926,7 @@ if ($id > 0 || !empty($ref)) $somethingshown = 1; } - else - { + else { print ''; @@ -945,8 +935,7 @@ if ($id > 0 || !empty($ref)) show_list_sending_receive('commande', $object->id); } - else - { + else { /* Order not found */ setEventMessages($langs->trans("NonExistentOrder"), null, 'errors'); } diff --git a/htdocs/expedition/stats/index.php b/htdocs/expedition/stats/index.php index db28b094e65..ce305ea41bb 100644 --- a/htdocs/expedition/stats/index.php +++ b/htdocs/expedition/stats/index.php @@ -75,8 +75,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png'; } diff --git a/htdocs/expensereport/ajax/ajaxik.php b/htdocs/expensereport/ajax/ajaxik.php index b2c89f68e41..413bc061fbf 100644 --- a/htdocs/expensereport/ajax/ajaxik.php +++ b/htdocs/expensereport/ajax/ajaxik.php @@ -52,22 +52,18 @@ $fk_c_exp_tax_cat = GETPOST('fk_c_exp_tax_cat'); if (empty($fk_expense) || $fk_expense < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_expense, 'fk_expense'))); elseif (empty($fk_c_exp_tax_cat) || $fk_c_exp_tax_cat < 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorBadValueForParameter', $fk_c_exp_tax_cat, 'fk_c_exp_tax_cat'))); -else -{ +else { // @see ndfp.class.php:3576 (method: compute_total_km) $expense = new ExpenseReport($db); if ($expense->fetch($fk_expense) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_expense' => $fk_expense)); - else - { + else { $userauthor = new User($db); if ($userauthor->fetch($expense->fk_user_author) <= 0) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'fk_user_author' => $expense->fk_user_author)); - else - { + else { $range = ExpenseReportIk::getRangeByUser($userauthor, $fk_c_exp_tax_cat); if (empty($range)) echo json_encode(array('error' => $langs->transnoentitiesnoconv('ErrorRecordNotFound'), 'range' => $range)); - else - { + else { $ikoffset = price($range->ikoffset, 0, $langs, 1, -1, -1, $conf->currency); echo json_encode(array('up' => $range->coef, 'ikoffset' => $range->ikoffset, 'title' => $langs->transnoentitiesnoconv('ExpenseRangeOffset', $offset), 'comment' => 'offset should be apply on addline or updateline')); } diff --git a/htdocs/expensereport/ajax/ajaxprojet.php b/htdocs/expensereport/ajax/ajaxprojet.php index 2fdb0cd4fdb..57b86ac9c7f 100644 --- a/htdocs/expensereport/ajax/ajaxprojet.php +++ b/htdocs/expensereport/ajax/ajaxprojet.php @@ -77,12 +77,10 @@ if (GETPOST('fk_projet') != '') echo json_encode($return_arr); } - else - { + else { echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); } } -else -{ +else { echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 2a0f804b196..c4a2d176e59 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -178,8 +178,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } - else - { + else { if ($object->id > 0) { // Because createFromClone modifies the object, we must clone it so that we can restore it later if it fails @@ -191,8 +190,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $object = $orig; $action = ''; @@ -211,8 +209,7 @@ if (empty($reshook)) header("Location: index.php"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -265,8 +262,7 @@ if (empty($reshook)) Header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action = 'create'; @@ -298,8 +294,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_POST['id']); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -357,8 +352,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } @@ -416,8 +410,7 @@ if (empty($reshook)) $mesg = $langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($emailFrom, 2), $mailfile->getValidAddress($emailTo, 2)); setEventMessages($mesg, null, 'mesgs'); } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -426,20 +419,17 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } @@ -451,8 +441,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $db->rollback(); } } @@ -543,8 +532,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -553,26 +541,22 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -666,8 +650,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -676,26 +659,22 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("FailedtoSetToApprove"), null, 'warnings'); $action = ''; } @@ -787,8 +766,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -797,26 +775,22 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("FailedtoSetToDeny"), null, 'warnings'); $action = ''; } @@ -829,8 +803,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Comment")), null, 'errors'); } - else - { + else { $object = new ExpenseReport($db); $object->fetch($id); @@ -917,8 +890,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -927,32 +899,27 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("FailedToSetToCancel"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -991,13 +958,11 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages("NOT_AUTHOR", '', 'errors'); } } @@ -1132,8 +1097,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $langs->load("other"); if ($mailfile->error) { @@ -1142,26 +1106,22 @@ if (empty($reshook)) $mesg .= '
'.$mailfile->error; setEventMessages($mesg, null, 'errors'); } - else - { + else { setEventMessages('No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS', null, 'warnings'); } } } - else - { + else { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("NoEmailSentBadSenderOrRecipientEmail"), null, 'warnings'); $action = ''; } } - else - { + else { setEventMessages($langs->trans("FailedToSetPaid"), null, 'warnings'); $action = ''; } @@ -1313,8 +1273,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$_GET['id']); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1408,8 +1367,7 @@ if (empty($reshook)) //header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); //exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1497,8 +1455,7 @@ if ($action == 'create') $object = new ExpenseReport($db); $include_users = $object->fetch_users_approver_expensereport(); if (empty($include_users)) print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateExpenseReport"); - else - { + else { $defaultselectuser = (empty($user->fk_user_expense_validator) ? $user->fk_user : $user->fk_user_expense_validator); // Will work only if supervisor has permission to approve so is inside include_users if (!empty($conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR)) $defaultselectuser = $conf->global->EXPENSEREPORT_DEFAULT_VALIDATOR; // Can force default approver if (GETPOST('fk_user_validator', 'int') > 0) $defaultselectuser = GETPOST('fk_user_validator', 'int'); @@ -1559,8 +1516,7 @@ if ($action == 'create') print ''; } -else -{ +else { if ($id > 0 || $ref) { $result = $object->fetch($id, $ref); @@ -1602,8 +1558,7 @@ else { print ''; } - else - { + else { print ''; } @@ -1661,8 +1616,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''.$langs->trans("VALIDOR").''; print ''; @@ -1698,8 +1652,7 @@ else print ''; } - else - { + else { dol_fiche_head($head, 'card', $langs->trans("ExpenseReport"), -1, 'trip'); // Clone confirmation @@ -1894,8 +1847,7 @@ else print ''.dol_print_date($object->date_cancel, 'dayhour').''; print ''; } - else - { + else { print ''; print ''.$langs->trans("ApprovedBy").''; print ''; @@ -2093,8 +2045,7 @@ else $db->free($resql); } - else - { + else { dol_print_error($db); } print ""; @@ -2201,8 +2152,7 @@ else { print price($line->value_unit_ht); } - else - { + else { $tmpvat = price2num(preg_replace('/\s*\(.*\)/', '', $line->vatrate)); $pricenettoshow = price2num($line->value_unit / (1 + $tmpvat / 100), 'MU'); print $pricenettoshow; @@ -2246,8 +2196,7 @@ else print ''; print ''; } - else - { + else { $modulepart = 'expensereport'; $thumbshown = 0; if (preg_match('/\.pdf$/i', $ecmfilesstatic->filename)) @@ -2625,8 +2574,7 @@ else dol_fiche_end(); } // end edit or not edit } // end of if result - else - { + else { dol_print_error($db); } } //fin si id > 0 @@ -2749,8 +2697,7 @@ if ($action != 'create' && $action != 'edit') { print '
'.$langs->trans('DoPayment').'
'; } - else - { + else { print ''; } } diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php index 18fef29e04c..050a7902a43 100644 --- a/htdocs/expensereport/class/api_expensereports.class.php +++ b/htdocs/expensereport/class/api_expensereports.class.php @@ -412,8 +412,7 @@ class ExpenseReports extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->expensereport->error); } } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 70d8a3d9b59..124a1fe4e7d 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -352,27 +352,23 @@ class ExpenseReport extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -4; } } - else - { + else { $this->db->rollback(); return -3; } } - else - { + else { dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -1; @@ -441,8 +437,7 @@ class ExpenseReport extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -505,15 +500,13 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -1; @@ -606,13 +599,11 @@ class ExpenseReport extends CommonObject return $result; } - else - { + else { return 0; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -659,21 +650,18 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->commit(); return 0; } } - else - { + else { $this->db->rollback(); dol_print_error($this->db); return -1; @@ -781,8 +769,7 @@ class ExpenseReport extends CommonObject } $this->db->free($resql); } - else - { + else { dol_print_error($this->db); } } @@ -947,8 +934,7 @@ class ExpenseReport extends CommonObject print ' '; print ''; } - else - { + else { $this->error = $db->lasterror(); return -1; } @@ -992,14 +978,13 @@ class ExpenseReport extends CommonObject if ($result): $this->db->free($result); return 1; - else: + else : $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); return -3; endif; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::recalculer: Error ".$this->error, LOG_ERR); return -3; @@ -1032,8 +1017,7 @@ class ExpenseReport extends CommonObject { $sql .= ' ORDER BY de.rang ASC, de.rowid ASC'; } - else - { + else { $sql .= ' ORDER BY de.rang ASC, de.date ASC'; } @@ -1083,8 +1067,7 @@ class ExpenseReport extends CommonObject $this->db->free($resql); return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::fetch_lines: Error ".$this->error, LOG_ERR); return -3; @@ -1114,16 +1097,14 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->error()." sql=".$sql; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); return -6; } } - else - { + else { $this->error = $this->db->error()." sql=".$sql; dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR); $this->db->rollback(); @@ -1159,8 +1140,7 @@ class ExpenseReport extends CommonObject { $num = $this->getNextNumRef(); } - else - { + else { $num = $this->ref; } if (empty($num) || $num < 0) return -1; @@ -1244,15 +1224,13 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1294,14 +1272,12 @@ class ExpenseReport extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_save_from_refuse expensereport already with save status", LOG_WARNING); } } @@ -1346,22 +1322,19 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::setApproved expensereport already with approve status", LOG_WARNING); } @@ -1413,22 +1386,19 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::setDeny expensereport already with refuse status", LOG_WARNING); } } @@ -1474,22 +1444,19 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_unpaid expensereport already with unpaid status", LOG_WARNING); } } @@ -1538,22 +1505,19 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -1; } } - else - { + else { dol_syslog(get_class($this)."::set_cancel expensereport already with cancel status", LOG_WARNING); } } @@ -1597,16 +1561,14 @@ class ExpenseReport extends CommonObject { return $numref; } - else - { + else { $this->error = $obj->error; $this->errors = $obj->errors; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return -1; } } - else - { + else { $this->error = "Error_EXPENSEREPORT_ADDON_NotDefined"; return -2; } @@ -1703,7 +1665,7 @@ class ExpenseReport extends CommonObject $result = $this->db->query($sql); if ($result): return 1; - else: + else : $this->error = $this->db->error(); return -1; endif; @@ -1733,7 +1695,7 @@ class ExpenseReport extends CommonObject $result = $this->db->query($sql); if ($result): return 1; - else: + else : $this->error = $this->db->error(); return -1; endif; @@ -1823,22 +1785,19 @@ class ExpenseReport extends CommonObject $this->db->commit(); return $this->line->id; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->line->error; dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; } } - else - { + else { dol_syslog(get_class($this)."::addline status of expense report must be Draft to allow use of ->addline()", LOG_ERR); $this->error = 'ErrorExpenseNotDraft'; return -3; @@ -1888,8 +1847,7 @@ class ExpenseReport extends CommonObject $new_current_total_ttc -= $amount_to_test - $rule->amount; // ex, entered 16€, limit 12€, subtracts 4€; $rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency), $langs->trans('by'.$rule->code_expense_rules_type, price($new_current_total_ttc, 0, $langs, 1, -1, -1, $conf->currency))); } - else - { + else { $this->error = 'ExpenseReportConstraintViolationWarning'; $this->errors[] = $this->error; @@ -1985,8 +1943,7 @@ class ExpenseReport extends CommonObject $num = $this->db->num_rows($resql); if ($num > 0) return true; } - else - { + else { dol_print_error($this->db); } @@ -2106,8 +2063,7 @@ class ExpenseReport extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->line->error; $this->errors = $this->line->errors; $this->db->rollback(); @@ -2188,13 +2144,11 @@ class ExpenseReport extends CommonObject if ($existe) return 1; else return 0; } - else - { + else { return 0; } } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::periode_existe Error ".$this->error, LOG_ERR); return -1; @@ -2236,8 +2190,7 @@ class ExpenseReport extends CommonObject } return $users_validator; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::fetch_users_approver_expensereport Error ".$this->error, LOG_ERR); return -1; @@ -2302,8 +2255,7 @@ class ExpenseReport extends CommonObject $i++; } } - else - { + else { dol_print_error($this->db); } return $ret; @@ -2335,8 +2287,7 @@ class ExpenseReport extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2383,8 +2334,7 @@ class ExpenseReport extends CommonObject $response->labelShort = $langs->trans("ToApprove"); $response->url = DOL_URL_ROOT.'/expensereport/list.php?mainmenu=hrm&statut=2'; } - else - { + else { $response->warning_delay = $conf->expensereport->payment->warning_delay / 60 / 60 / 24; $response->label = $langs->trans("ExpenseReportsToPay"); $response->labelShort = $langs->trans("StatusToPay"); @@ -2402,8 +2352,7 @@ class ExpenseReport extends CommonObject $response->nbtodolate++; } } - else - { + else { if ($this->db->jdate($obj->date_valid) < ($now - $conf->expensereport->payment->warning_delay)) { $response->nbtodolate++; } @@ -2412,8 +2361,7 @@ class ExpenseReport extends CommonObject return $response; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2439,8 +2387,7 @@ class ExpenseReport extends CommonObject { return ($this->datevalid ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->approve->warning_delay); } - else - return ($this->datevalid ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); + else return ($this->datevalid ? $this->datevalid : $this->date_valid) < ($now - $conf->expensereport->payment->warning_delay); } /** @@ -2464,8 +2411,7 @@ class ExpenseReport extends CommonObject $alreadydispatched = $obj->nb; } } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -2499,8 +2445,7 @@ class ExpenseReport extends CommonObject $this->db->free($resql); return $obj->amount; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -2695,8 +2640,7 @@ class ExpenseReportLine } } } - else - { + else { $error++; } @@ -2705,8 +2649,7 @@ class ExpenseReportLine $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog("ExpenseReportLine::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); @@ -2748,8 +2691,7 @@ class ExpenseReportLine $amount = (double) $obj->total_amount; } } - else - { + else { dol_print_error($this->db); } @@ -2813,15 +2755,13 @@ class ExpenseReportLine $this->errors = $tmpparent->errors; } } - else - { + else { $error++; $this->error = $tmpparent->error; $this->errors = $tmpparent->errors; } } - else - { + else { $error++; dol_print_error($this->db); } @@ -2831,8 +2771,7 @@ class ExpenseReportLine $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog("ExpenseReportLine::update Error ".$this->error, LOG_ERR); $this->db->rollback(); @@ -2868,8 +2807,7 @@ function select_expensereport_statut($selected = '', $htmlname = 'fk_statut', $u { print '
'; print ''; print ''; diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 808ba9739ba..3d0dc302283 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -41,8 +41,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 918950179c7..219e68171d2 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -163,8 +163,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) echo json_encode($outjson); } -else -{ +else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->loadLangs(array("main", "products")); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index 1612448c1bb..da99efc337d 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -288,8 +288,7 @@ class ActionsCardProduct } $this->db->free($resql); } - else - { + else { dol_print_error($this->db, $sql); } } @@ -428,8 +427,7 @@ class ActionsCardProduct } $this->db->free($resql); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index 331cecb3071..aaf9b584068 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -268,8 +268,7 @@ class ActionsCardService } $this->db->free($resql); } - else - { + else { dol_print_error($this->db, $sql); } } @@ -361,8 +360,7 @@ class ActionsCardService } $this->db->free($resql); } - else - { + else { print $sql; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 87e86e8e0bc..bd18737bd6b 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -175,8 +175,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { $langs->load("errors"); if ($result == -1) $errors[] = 'ErrorBadBarCodeSyntax'; elseif ($result == -2) $errors[] = 'ErrorBarCodeRequired'; @@ -222,12 +221,10 @@ if (empty($reshook)) if ($object->price_base_type == 'TTC') $object->price_ttc = GETPOST('price'); - else - $object->price = GETPOST('price'); + else $object->price = GETPOST('price'); if ($object->price_base_type == 'TTC') $object->price_min_ttc = GETPOST('price_min'); - else - $object->price_min = GETPOST('price_min'); + else $object->price_min = GETPOST('price_min'); $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' @@ -340,8 +337,7 @@ if (empty($reshook)) $object->multiprices["$i"] = price2num($_POST["price_".$i], 'MU'); $object->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; } - else - { + else { $object->multiprices["$i"] = ""; } } @@ -369,14 +365,12 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = "create"; @@ -391,8 +385,7 @@ if (empty($reshook)) { $action = ''; } - else - { + else { if ($object->id > 0) { $object->oldcopy = clone $object; @@ -489,15 +482,13 @@ if (empty($reshook)) $action = 'view'; } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = 'edit'; } } - else - { + else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors'); $action = 'edit'; @@ -514,8 +505,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); } - else - { + else { $db->begin(); $originalId = $id; @@ -578,8 +568,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } - else - { + else { $id = $originalId; if ($object->error == 'ErrorProductAlreadyExists') @@ -594,16 +583,14 @@ if (empty($reshook)) setEventMessages($mesg, null, 'errors'); $object->fetch($id); } - else - { + else { $db->rollback(); if (count($object->errors)) { setEventMessages($object->error, $object->errors, 'errors'); dol_print_error($db, $object->errors); } - else - { + else { setEventMessages($langs->trans($object->error), null, 'errors'); dol_print_error($db, $object->error); } @@ -613,8 +600,7 @@ if (empty($reshook)) unset($object->context['createfromclone']); } } - else - { + else { $db->rollback(); dol_print_error($db, $object->error); } @@ -632,8 +618,7 @@ if (empty($reshook)) header('Location: '.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'&delprod='.urlencode($object->ref)); exit; } - else - { + else { setEventMessages($langs->trans($object->error), null, 'errors'); $reload = 0; $action = ''; @@ -743,8 +728,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -786,8 +770,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -829,8 +812,7 @@ if (empty($reshook)) dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); } - else - { + else { $buyprice = $result; } @@ -937,8 +919,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } -else -{ +else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -1030,8 +1011,7 @@ else { $fk_barcode_type = GETPOST('fk_barcode_type'); } - else - { + else { if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; @@ -1080,8 +1060,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1215,8 +1194,7 @@ else print '
'; } - else - { + else { print ''; // Price @@ -1416,8 +1394,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1432,8 +1409,7 @@ else print ''; print ''; } - else - { + else { print ''; print ''; } @@ -1463,8 +1439,7 @@ else { $fk_barcode_type = GETPOST('fk_barcode_type'); } - else - { + else { $fk_barcode_type = $object->barcode_type; if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } @@ -1526,8 +1501,7 @@ else print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); print ''; } - else - { + else { // Nature print ''."\n"; @@ -2012,8 +1983,7 @@ else print ''; } - else - { + else { // Nature print '\n"; @@ -2042,8 +2011,7 @@ else if ($object->height) print " x ".$object->height; print ' '.measuringUnitString(0, "size", $object->length_units); } - else - { + else { print ' '; } print "\n"; @@ -2056,8 +2024,7 @@ else { print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); } - else - { + else { print ' '; } print "\n"; @@ -2070,8 +2037,7 @@ else { print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); } - else - { + else { print ' '; } print "\n"; @@ -2085,8 +2051,7 @@ else { print $object->net_measure." ".measuringUnitString($object->net_measure_units); } - else - { + else { print ' '; } } @@ -2215,8 +2180,7 @@ if ($action != 'create' && $action != 'edit') { print ''.$langs->trans('ToClone').''."\n"; } - else - { + else { print 'id.'">'.$langs->trans("ToClone").''; } } @@ -2231,18 +2195,15 @@ if ($action != 'create' && $action != 'edit') { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print 'id.'">'.$langs->trans("Delete").''; } } - else - { + else { print ''.$langs->trans("Delete").''; } } - else - { + else { print ''.$langs->trans("Delete").''; } } @@ -2276,8 +2237,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("propalid", $otherprop, 0, 1); $html .= ''; } - else - { + else { $html .= ''; } - else - { + else { $html .= ''; } - else - { + else { $html .= ''; @@ -247,8 +242,7 @@ if ($id > 0 || !empty($ref)) { print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); } - else - { + else { print price($object->price_min).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print ''; @@ -299,8 +293,7 @@ if ($id > 0 || !empty($ref)) print ''; } } - else - { + else { print ''; print ''; print ''; @@ -378,8 +371,7 @@ if ($id > 0 || !empty($ref)) { $pricesell = 'Variable'; } - else - { + else { $totallinesell = price2num($value['nb'] * ($pricesell), 'MT'); $totalsell += $totallinesell; } @@ -405,8 +397,7 @@ if ($id > 0 || !empty($ref)) print ''."\n"; } - else - { + else { $hide = ''; if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide = ' hideobject'; // By default, we do not show this. It makes screen very difficult to understand @@ -469,8 +460,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''."\n"; } - else - { + else { $colspan = 8; if (!empty($conf->stock->enabled)) $colspan++; @@ -600,8 +590,7 @@ if ($id > 0 || !empty($ref)) $qty = $object->is_sousproduit_qty; $incdec = $object->is_sousproduit_incdec; } - else - { + else { //$addchecked = ''; $qty = 0; $incdec = 0; @@ -615,8 +604,7 @@ if ($id > 0 || !empty($ref)) // Inc Dec print ''; } } - else - { + else { dol_print_error($db); } print '
'.$langs->trans("Nature").''; $statutarray = array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); @@ -1734,8 +1708,7 @@ else print ''; } // Fiche en mode visu - else - { + else { $showbarcode = empty($conf->barcode->enabled) ? 0 : 1; if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode = 0; @@ -1791,8 +1764,7 @@ else { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); } - else - { + else { $object->fetch_barcode(); print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); } @@ -1819,8 +1791,7 @@ else print ' '; print ''; } - else - { + else { print $object->barcode; } print '
'.$langs->trans("Nature").''; print $object->getLibFinished(); @@ -2025,8 +1995,7 @@ else { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); } - else - { + else { print ' '; } print "
'; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); @@ -2300,8 +2260,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("commandeid", $othercom, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftOrders").''; $html .= $langs->trans("NoDraftOrders"); @@ -2324,8 +2283,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftInvoices").''; $html .= $langs->trans("NoDraftInvoices"); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index b04560dab32..66cef158439 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -303,8 +303,7 @@ class Products extends DolibarrApi // We update price only if it was changed $pricemodified = false; if ($this->product->price_base_type != $oldproduct->price_base_type) { $pricemodified = true; - } else - { + } else { if ($this->product->tva_tx != $oldproduct->tva_tx) { $pricemodified = true; } if ($this->product->tva_npr != $oldproduct->tva_npr) { $pricemodified = true; @@ -318,8 +317,7 @@ class Products extends DolibarrApi if ($this->product->price_min_ttc != $oldproduct->price_min_ttc) { $pricemodified = true; } } - else - { + else { if ($this->product->price != $oldproduct->price) { $pricemodified = true; } if ($this->product->price_min != $oldproduct->price_min) { $pricemodified = true; @@ -805,7 +803,7 @@ class Products extends DolibarrApi $product_fourn = new ProductFournisseur($this->db); $product_fourn_list = $product_fourn->list_product_fournisseur_price($obj->rowid, '', '', 0, 0); - foreach($product_fourn_list as $tmpobj) { + foreach ($product_fourn_list as $tmpobj) { $this->_cleanObjectDatas($tmpobj); } //var_dump($product_fourn_list->db);exit; diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 0eeddd15c07..b38501cb788 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -102,8 +102,7 @@ class FormProduct { $sql .= ", pb.qty as stock"; } - else - { + else { $sql .= ", ps.reel as stock"; } } @@ -126,8 +125,7 @@ class FormProduct { $sql .= " AND e.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")"; } - else - { + else { $sql .= " AND e.statut = 1"; } @@ -179,8 +177,7 @@ class FormProduct return $num; } - else - { + else { dol_print_error($this->db); return -1; } @@ -271,8 +268,7 @@ class FormProduct if ($arraytypes['stock'] <= 0) { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } - else - { + else { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } } @@ -437,8 +433,7 @@ class FormProduct { if (!empty($fk_product)) $productIdArray[] = $fk_product; } - else - { + else { foreach ($objectLines as $line) { if ($line->fk_product) $productIdArray[] = $line->fk_product; } @@ -459,8 +454,7 @@ class FormProduct { $productIdArray = array($fk_product); // only show lot stock for product } - else - { + else { foreach ($this->cache_lot as $key => $value) { $productIdArray[] = $key; @@ -527,8 +521,7 @@ class FormProduct { return count($this->cache_lot); } - else - { + else { // clear cache $this->cache_lot = array(); $productIdList = implode(',', $productIdArray); @@ -561,8 +554,7 @@ class FormProduct return $num; } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 7b6892552d1..f072d04916e 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -457,8 +457,7 @@ class Product extends CommonObject if ($err > 0) { return 0; } - else - { + else { return 1; } } @@ -683,34 +682,29 @@ class Product extends CommonObject $error++; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } } - else - { + else { $error++; $this->error = 'ErrorFailedToGetInsertedId'; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } } - else - { + else { // Product already exists with this ref $langs->load("products"); $error++; $this->error = "ErrorProductAlreadyExists"; } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } @@ -727,14 +721,12 @@ class Product extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -$error; } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -811,8 +803,7 @@ class Product extends CommonObject $result = $mod->verif($this->db, $valuetotest, $this, 0, $typefortest); return $result; } - else - { + else { return 0; } } @@ -1104,14 +1095,12 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -$error; } } - else - { + else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); if (empty($conf->barcode->enabled) || empty($this->barcode)) { @@ -1123,8 +1112,7 @@ class Product extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; $this->errors[] = $this->error; $this->db->rollback(); @@ -1132,8 +1120,7 @@ class Product extends CommonObject } } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Update fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1281,8 +1268,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -1292,8 +1278,7 @@ class Product extends CommonObject return -$error; } } - else - { + else { $this->error = "ErrorRecordIsUsedCantDelete"; return 0; } @@ -1332,8 +1317,7 @@ class Product extends CommonObject } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1370,8 +1354,7 @@ class Product extends CommonObject } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1392,8 +1375,7 @@ class Product extends CommonObject } } } - else - { + else { // language is not current language and we didn't provide a multilang description for this language } } @@ -1435,8 +1417,7 @@ class Product extends CommonObject // End call triggers return 1; } - else - { + else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); return -1; @@ -1498,8 +1479,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1538,8 +1518,7 @@ class Product extends CommonObject } return 1; } - else - { + else { $this->error = "Error: ".$this->db->lasterror()." - ".$sql; return -1; } @@ -1581,8 +1560,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -1609,8 +1587,7 @@ class Product extends CommonObject if ($resql) { return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -1687,8 +1664,7 @@ class Product extends CommonObject { $pu_ht = $priceforthequantityarray['unitprice']; } - else - { + else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1708,8 +1684,7 @@ class Product extends CommonObject { $pu_ht = $priceforthequantityarray['unitprice']; } - else - { + else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1852,20 +1827,17 @@ class Product extends CommonObject $result = $obj->fk_product; return $result; } - else - { + else { return -1; // Ce produit n'existe pas avec cet id tarif fournisseur ou existe mais qte insuffisante, ni pour le couple produit/ref fournisseur dans la quantité. } } - else - { + else { $this->error = $this->db->lasterror(); return -3; } } } - else - { + else { $this->error = $this->db->lasterror(); return -2; } @@ -1937,14 +1909,12 @@ class Product extends CommonObject $price_min = price2num($newminprice) / (1 + ($newvat / 100)); $price_min = price2num($price_min, 'MU'); } - else - { + else { $price_min = 0; $price_min_ttc = 0; } } - else - { + else { $price = price2num($newprice, 'MU'); $price_ttc = ($newnpr != 1) ? price2num($newprice) * (1 + ($newvat / 100)) : $price; $price_ttc = price2num($price_ttc, 'MU'); @@ -1955,8 +1925,7 @@ class Product extends CommonObject $price_min_ttc = price2num($price_min_ttc, 'MU'); //print 'X'.$newminprice.'-'.$price_min; } - else - { + else { $price_min = 0; $price_min_ttc = 0; } @@ -1969,7 +1938,7 @@ class Product extends CommonObject $localtaxtype2 = $localtaxes_array['2']; $localtax2 = $localtaxes_array['3']; } - else // old method. deprecated because ot can't retreive type + else // old method. deprecated because ot can't retreive type { $localtaxtype1 = '0'; $localtax1 = get_localtax($newvat, 1); @@ -2045,8 +2014,7 @@ class Product extends CommonObject $this->db->commit(); } - else - { + else { $this->db->rollback(); dol_print_error($this->db); } @@ -2281,8 +2249,7 @@ class Product extends CommonObject } }*/ } - else - { + else { dol_print_error($this->db); return -1; } @@ -2330,15 +2297,13 @@ class Product extends CommonObject } $this->prices_by_qty_list[0] = $resultat; } - else - { + else { dol_print_error($this->db); return -1; } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2394,15 +2359,13 @@ class Product extends CommonObject } $this->prices_by_qty_list[$i] = $resultat; } - else - { + else { dol_print_error($this->db); return -1; } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2427,13 +2390,11 @@ class Product extends CommonObject return 1; } - else - { + else { return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -2507,8 +2468,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2558,8 +2518,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2661,8 +2620,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande']; return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2718,8 +2676,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -2802,8 +2759,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2855,8 +2811,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -2946,8 +2901,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3020,8 +2974,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3094,8 +3047,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3147,8 +3099,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -3182,8 +3133,7 @@ class Product extends CommonObject $i++; } } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3192,8 +3142,7 @@ class Product extends CommonObject $year = strftime('%Y', time()); $month = strftime('%m', time()); } - else - { + else { $month = 12; // We imagine we are at end of year, so we get last 12 month before, so all correct year. } $result = array(); @@ -3674,8 +3623,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); @@ -3683,16 +3631,14 @@ class Product extends CommonObject $this->error = "isFatherOfThis"; return -1; } - else - { + else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec)'; $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.')'; if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -3736,8 +3682,7 @@ class Product extends CommonObject dol_print_error($this->db); return -1; } - else - { + else { return 1; } } @@ -3800,13 +3745,11 @@ class Product extends CommonObject return true; } - else - { + else { return false; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -3896,21 +3839,18 @@ class Product extends CommonObject $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } } // If the supplier price already exists for this product and quantity - else - { + else { $this->product_fourn_price_id = $obj->rowid; return 0; } } - else - { + else { $this->error = $this->db->lasterror(); return -2; } @@ -4106,8 +4046,7 @@ class Product extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->db->commit(); return 1; } @@ -4218,8 +4157,7 @@ class Product extends CommonObject if ($obj) { $nb = $obj->nb; } } - else - { + else { return -1; } @@ -4304,8 +4242,7 @@ class Product extends CommonObject } return $prods; } - else - { + else { dol_print_error($this->db); return -1; } @@ -4369,8 +4306,7 @@ class Product extends CommonObject return $prods; } - else - { + else { dol_print_error($this->db); return -1; } @@ -4498,8 +4434,7 @@ class Product extends CommonObject $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose .= ' class="nowraponall classfortooltip"'; } - else - { + else { $linkclose = ' class="nowraponall"'; } @@ -4574,8 +4509,7 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_ADDON_PDF)) { $modele = $conf->global->PRODUCT_ADDON_PDF; } - else - { + else { $modele = 'strato'; } } @@ -4744,8 +4678,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4792,8 +4725,7 @@ class Product extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4872,8 +4804,7 @@ class Product extends CommonObject return 1; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -5019,8 +4950,7 @@ class Product extends CommonObject } return $result; } - else - { + else { dol_print_error($this->db); $this->db->rollback(); return array(); @@ -5258,8 +5188,7 @@ class Product extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -5395,8 +5324,7 @@ class Product extends CommonObject $this->db->free($resql); return $label; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR); return -1; @@ -5629,8 +5557,7 @@ class Product extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 05cfd7523e0..3c56221863c 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -120,8 +120,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -179,8 +178,7 @@ class Productbatch extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -233,8 +231,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -275,8 +272,7 @@ class Productbatch extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -331,8 +327,7 @@ class Productbatch extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -425,8 +420,7 @@ class Productbatch extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -495,8 +489,7 @@ class Productbatch extends CommonObject return $ret; } - else - { + else { $error = "Error ".$db->lasterror(); return -1; } diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 9ca53d167cf..26c627ee0e4 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -140,8 +140,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -199,8 +198,7 @@ class Propalmergepdfproduct extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -273,8 +271,7 @@ class Propalmergepdfproduct extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR); return -1; @@ -334,8 +331,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -377,8 +373,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -427,8 +422,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -470,8 +464,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -526,8 +519,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index dbdb6cb6f42..194a342d391 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -81,27 +81,23 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se //var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')); $action = 'edit'; } - else - { + else { $error++; $action = 're-edit'; if ($object->error == "isFatherOfThis") { setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } } - else - { + else { if ($object->del_sousproduit($id, GETPOST("prod_id_".$i, 'int')) > 0) { $action = 'edit'; } - else - { + else { $error++; $action = 're-edit'; setEventMessages($object->error, $object->errors, 'errors'); @@ -235,8 +231,7 @@ if ($id > 0 || !empty($ref)) { print price($object->price_ttc).' '.$langs->trans($object->price_base_type); } - else - { + else { print price($object->price).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print '
'.$langs->trans("None").'
'; if ($qty) print ''; - else - { + else { // TODO Hide field and show it when setting a qty print ''; //print ''; @@ -636,8 +624,7 @@ if ($id > 0 || !empty($ref)) print '
'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index e5702078dd2..db233fbe84c 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -314,8 +314,7 @@ if ($object->id) $checked = ' checked '; } } - else - { + else { if (array_key_exists($filetoadd['name'], $filetomerge->lines)) { $checked = ' checked '; @@ -338,8 +337,7 @@ if ($object->id) } } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 420d5aaddb2..4f40e2b6c6f 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -124,8 +124,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -163,13 +162,11 @@ class PriceExpression $this->expression = $obj->expression; return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -206,8 +203,7 @@ class PriceExpression $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -237,13 +233,11 @@ class PriceExpression { return (int) $obj->rowid; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -302,8 +296,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -360,8 +353,7 @@ class PriceExpression $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index acede724da5..7f241518e4c 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -129,8 +129,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -163,13 +162,11 @@ class PriceGlobalVariable $this->checkParameters(); return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -226,8 +223,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -283,8 +279,7 @@ class PriceGlobalVariable $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -350,8 +345,7 @@ class PriceGlobalVariable $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 0c8e25e8751..12e497c0f2c 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -145,8 +145,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -183,13 +182,11 @@ class PriceGlobalVariableUpdater $this->checkParameters(); return 1; } - else - { + else { return 0; } } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -250,8 +247,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -306,8 +302,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -400,8 +395,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -442,8 +436,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -599,8 +592,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -645,8 +637,7 @@ class PriceGlobalVariableUpdater $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index bf2f58f63f3..778f749f983 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -78,8 +78,7 @@ if ($action == 'add') if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } - else - { + else { $price_expression->title = $title; $price_expression->expression = $expression; $result = $price_expression->create($user); @@ -88,8 +87,7 @@ if ($action == 'add') $eid = $price_expression->id; setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } - else - { + else { setEventMessages("add: ".$price_expression->error, $price_expression->errors, 'errors'); } } @@ -98,8 +96,7 @@ if ($action == 'add') { setEventMessages("add find: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -118,8 +115,7 @@ if ($action == 'update') if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); } - else - { + else { $price_expression->id = $eid; $price_expression->title = $title; $price_expression->expression = $expression; @@ -128,8 +124,7 @@ if ($action == 'update') { setEventMessages("update: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } } @@ -138,8 +133,7 @@ if ($action == 'update') { setEventMessages("update find: ".$price_expression->error, $price_expression->errors, 'errors'); } - else - { + else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -221,8 +215,7 @@ if ($eid == 0) { print '
'.$langs->trans('Delete').'
'."\n"; } -else -{ +else { print ''; } print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 7cc5d3966c1..3c4ebfc6acb 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -128,8 +128,7 @@ if (empty($reshook)) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $action = ''; } - else - { + else { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -211,8 +210,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), null, 'errors'); } - else - { + else { $_POST["price"] = 0; } } @@ -316,8 +314,7 @@ if (empty($reshook)) $error++; setEventMessages($object->error, $object->errors, 'errors'); } - else - { + else { if (!empty($conf->dynamicprices->enabled) && $price_expression !== '') { //Check the expression validity by parsing it @@ -347,13 +344,11 @@ if (empty($reshook)) $db->commit(); $action = ''; } - else - { + else { $db->rollback(); } } - else - { + else { $action = 'add_price'; } } @@ -453,8 +448,7 @@ if ($id > 0 || $ref) $object->fetch_product_fournisseur_price($rowid, 1); //Ignore the math expression when getting the price print load_fiche_titre($langs->trans("ChangeSupplierPrice")); } - else - { + else { print load_fiche_titre($langs->trans("AddSupplierPrice")); } @@ -478,8 +472,7 @@ if ($id > 0 || $ref) print ''; print ''; } - else - { + else { $events = array(); $events[] = array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array()); print $form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', 'fournisseur=1', 'SelectThirdParty', 0, 0, $events); @@ -503,8 +496,7 @@ if ($id > 0 || $ref) print ''; print ''; } - else - { + else { print ''; } print ''; @@ -529,8 +521,7 @@ if ($id > 0 || $ref) print ''; print $object->fourn_qty; } - else - { + else { print ''; } // Units @@ -564,8 +555,7 @@ if ($id > 0 || $ref) $default_vat = $tmpproductsupplier->fourn_tva_tx; $default_npr = $tmpproductsupplier->fourn_tva_npr; } - else - { + else { if (empty($default_vat)) { $default_vat = $object->tva_tx; @@ -945,8 +935,7 @@ SCRIPT; { print ''.$productfourn->getNomUrl().''; } - else - { + else { print ''.$productfourn->fourn_ref.''; } @@ -1099,8 +1088,7 @@ SCRIPT; print ''; } } - else - { + else { dol_print_error($db); } @@ -1110,8 +1098,7 @@ SCRIPT; } } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 3067cc63733..ebe55716bae 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -226,8 +226,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA { $dataseries[] = array($obj->label, round($obj->nb)); } - else - { + else { $rest += $obj->nb; } $total += $obj->nb; @@ -248,8 +247,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->draw('idstatscategproduct'); print $dolgraph->show($total ? 0 : 1); } - else - { + else { while ($i < $num) { $obj = $db->fetch_object($result); @@ -386,8 +384,7 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us print '
'; } } - else - { + else { dol_print_error($db); } } @@ -457,8 +454,7 @@ function activitytrim($product_type) if ($product_type == 0) print ''.$langs->trans("ProductSellByQuarterHT").''; - else - print ''.$langs->trans("ServiceSellByQuarterHT").''; + else print ''.$langs->trans("ServiceSellByQuarterHT").''; print ''.$langs->trans("Quarter1").''; print ''.$langs->trans("Quarter2").''; print ''.$langs->trans("Quarter3").''; diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index 1ea99480bd6..c258b63de2b 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -21,8 +21,7 @@ switch ($put) echo $det->qty_view; } - else - { + else { echo -2; } @@ -41,8 +40,7 @@ switch ($put) echo $det->new_pmp; } - else - { + else { echo -2; } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 0e8ab8bda55..a5084c296a1 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -42,8 +42,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); } -else -{ +else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -81,8 +80,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; } -else -{ +else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -337,8 +335,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Modify").''."\n"; } - else - { + else { print ''.$langs->trans('Modify').''."\n"; } @@ -346,8 +343,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans("Validate").''."\n"; } - else - { + else { print ''.$langs->trans('Validate').''."\n"; } @@ -355,8 +351,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index e24fe4e0ad2..381c40d0aa4 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -466,8 +466,7 @@ class Inventory extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 3f0989251b5..373164eeae4 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -42,8 +42,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); } -else -{ +else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -81,8 +80,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; } -else -{ +else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -283,8 +281,7 @@ if ($object->id > 0) { print ''.$langs->trans("Edit").''."\n"; } - else - { + else { print ''.$langs->trans('Edit').''."\n"; } } @@ -295,8 +292,7 @@ if ($object->id > 0) { print ''.$langs->trans("Validate").''."\n"; } - else - { + else { print ''.$langs->trans('Validate').''."\n"; } } diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index f3f7621b821..c799ab7da87 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -77,8 +77,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $objectid); } -else -{ +else { $result = restrictedArea($user, 'stock', $objectid, '', 'inventory_advance'); } @@ -256,8 +255,7 @@ if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit { $num = $nbtotalofrecords; } -else -{ +else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 17dd18b567b..347281f0c75 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -292,13 +292,11 @@ if ($search_type != '' && $search_type != '-1') { $texte = $langs->trans("Services"); } - else - { + else { $texte = $langs->trans("Products"); } } -else -{ +else { $texte = $langs->trans("ProductsAndServices"); } @@ -1411,8 +1409,7 @@ if ($resql) print ""; print ''; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/product/popucom.php b/htdocs/product/popucom.php index 2c28266ad15..c21afa711e7 100644 --- a/htdocs/product/popucom.php +++ b/htdocs/product/popucom.php @@ -67,8 +67,7 @@ elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -else -{ +else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -153,8 +152,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index bf2ae9020ec..92de8b33546 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -67,8 +67,7 @@ elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } -else -{ +else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -153,8 +152,7 @@ if ($resql) } $db->free($resql); } -else -{ +else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index f2109b94795..1db2219bf63 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -170,8 +170,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); } @@ -767,8 +766,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); print ''; } - else - { + else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -787,8 +785,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ''; } } - else - { + else { if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 @@ -796,8 +793,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ''.vatrate($object->multiprices_tva_tx[1], true).''; print ''; } - else - { + else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -846,8 +842,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ' '; print ''; } - else - { + else { print $langs->trans("SellingPrice").' '.$i; if (!empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); } @@ -872,8 +867,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ { print price($object->multiprices_min_ttc[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); } - else - { + else { print price($object->multiprices_min[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); } print ''; @@ -954,8 +948,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ } } } -else -{ +else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -998,8 +991,7 @@ else if ($object->prices_by_qty[0] == 0) { print '  ('.$langs->trans("Activate").')'; } - else - { + else { print '  ('.$langs->trans("DisablePriceByQty").')'; } print ''; @@ -1289,8 +1281,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print '
'; } - else - { + else { print ''."\n"; ?> '."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } } diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index c92108d7723..045f726fe1d 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -88,8 +88,7 @@ if ($resql) { print "".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."\n"; } - else - { + else { print "Anonyme Anonyme\n"; } print "".dol_print_date($db->jdate($objp->datedon))."\n"; @@ -99,13 +98,11 @@ if ($resql) } print ""; } - else - { + else { print "Aucun don publique"; } } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7f788a84671..71e28c94da8 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -391,8 +391,7 @@ if ($action == 'add') { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); } - else - { + else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } @@ -408,8 +407,7 @@ if ($action == 'add') { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); } - else - { + else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } @@ -425,8 +423,7 @@ if ($action == 'add') { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); } - else - { + else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } @@ -442,14 +439,12 @@ if ($action == 'add') { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); } - else - { + else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } } - else - { + else { dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment"); exit; } @@ -458,8 +453,7 @@ if ($action == 'add') if (!empty($entity)) $urlback .= '&entity='.$entity; dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); } - else - { + else { $error++; $errmsg .= join('
', $adh->errors); } @@ -472,8 +466,7 @@ if ($action == 'add') Header("Location: ".$urlback); exit; } - else - { + else { $db->rollback(); } } @@ -575,8 +568,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); print ''."\n"; } -else -{ +else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); print ''; } @@ -589,8 +581,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; } -else -{ +else { print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; print ''; } @@ -733,8 +724,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) { print ''; } - else - { + else { print ''; print ''; } diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 04fe1f75fca..a955c9605f2 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -85,8 +85,7 @@ if ($id > 0) { print $langs->trans("ErrorThisMemberIsNotPublic"); } - else - { + else { print ''; print '\n"; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 459926707b8..1a885ed3596 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -153,8 +153,7 @@ if ($result) print $form->showphoto('memberphoto', $objp, 64); print ''."\n"; } - else - { + else { print "\n"; } print ""; @@ -162,8 +161,7 @@ if ($result) } print "
'.$langs->trans("Type").''.$object->type."
 
"; } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index 626aba2cd32..b3b362fa6b2 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -39,8 +39,7 @@ if (!GETPOST('transkey', 'alphanohtml') && !GETPOST('transphrase', 'alphanohtml' print 'Sorry, it seems your internet connexion is off.
'; print 'You need to be connected to network to use this software.
'; } -else -{ +else { $langs->load("error"); $langs->load("other"); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 2378728a8d3..20b029f960d 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -236,8 +236,7 @@ if ($source == 'proposal') $mesg = $proposal->error; $error++; } - else - { + else { $result = $proposal->fetch_thirdparty($proposal->socid); } @@ -277,13 +276,11 @@ if ($action != 'dosign') if ($found && !$error) // We are in a management option and no error { } - else - { + else { dol_print_error_email('ERRORNEWONLINESIGN'); } } -else -{ +else { // Print } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index d0ce716bb7d..f26d31c483d 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -133,8 +133,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); $error++; } - else - { + else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; $resql = $db->query($sql); @@ -173,8 +172,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout else dol_print_error($db); } } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); } } @@ -392,8 +390,7 @@ if ($object->format == "D") print ''."\n"; } } -else -{ +else { //display of survey topics print ''."\n"; print ''."\n"; @@ -481,8 +478,7 @@ while ($compteur < $num) } } } - else - { + else { //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs if ($compteur == $ligneamodifier) { @@ -509,8 +505,7 @@ while ($compteur < $num) print ''."\n"; } } - else - { + else { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); @@ -695,8 +690,7 @@ if ($object->allow_spy) { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; } } - else - { + else { $tmps = explode('@', $toutsujet[$i]); $meilleursujet .= dol_htmlentities($tmps[0]); } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index ea7fd71c9e6..b82dcc3360b 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -211,8 +211,7 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) if ($source && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical else $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); } - else - { + else { $token = $conf->global->PAYMENT_SECURITY_TOKEN; } if ($SECUREKEY != $token) @@ -371,8 +370,7 @@ if ($action == 'dopayment') if ($paymentmethod == 'stripe') { if (GETPOST('newamount', 'alpha')) $amount = price2num(GETPOST('newamount', 'alpha'), 'MT'); - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); $action = ''; } @@ -469,8 +467,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) setEventMessages('Failed to create card record', null, 'errors'); $action = ''; } - else - { + else { if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; @@ -497,8 +494,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) } } } - else - { + else { $vatcleaned = $vatnumber ? $vatnumber : null; /*$taxinfo = array('type'=>'vat'); @@ -670,8 +666,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) setEventMessages($paymentintent->status, null, 'errors'); $action = ''; } - else - { + else { // TODO We can alse record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); @@ -701,8 +696,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) header("Location: ".$urlko); exit; } - else - { + else { header("Location: ".$urlok); exit; } @@ -914,8 +908,7 @@ if ($source == 'order') $mesg = $order->error; $error++; } - else - { + else { $result = $order->fetch_thirdparty($order->socid); } $object = $order; @@ -1009,8 +1002,7 @@ if ($source == 'order') print ''."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } if (is_object($order->thirdparty)) print ''."\n"; @@ -1037,8 +1029,7 @@ if ($source == 'invoice') $mesg = $invoice->error; $error++; } - else - { + else { $result = $invoice->fetch_thirdparty($invoice->socid); } $object = $invoice; @@ -1103,8 +1094,7 @@ if ($source == 'invoice') print ''; } } - else - { + else { print ''.price($object->total_ttc, 1, $langs).''; } // Currency @@ -1139,8 +1129,7 @@ if ($source == 'invoice') print ''."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } if (is_object($invoice->thirdparty)) print ''."\n"; @@ -1168,8 +1157,7 @@ if ($source == 'contractline') $mesg = $contractline->error; $error++; } - else - { + else { if ($contractline->fk_contrat > 0) { $result = $contract->fetch($contractline->fk_contrat); @@ -1177,14 +1165,12 @@ if ($source == 'contractline') { $result = $contract->fetch_thirdparty($contract->socid); } - else - { + else { $mesg = $contract->error; $error++; } } - else - { + else { $mesg = 'ErrorRecordNotFound'; $error++; } @@ -1207,8 +1193,7 @@ if ($source == 'contractline') $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; $price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level]; } - else - { + else { $pu_ht = $product->price; $pu_ttc = $product->price_ttc; $price_base_type = $product->price_base_type; @@ -1294,8 +1279,7 @@ if ($source == 'contractline') { $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("DurationDays"), "w"=>$langs->trans("DurationWeeks"), "m"=>$langs->trans("DurationMonths"), "y"=>$langs->trans("DurationYears")); } - else - { + else { $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("DurationDay"), "w"=>$langs->trans("DurationWeek"), "m"=>$langs->trans("DurationMonth"), "y"=>$langs->trans("DurationYear")); } $duration = $contractline->product->duration_value.' '.$dur[$contractline->product->duration_unit]; @@ -1352,8 +1336,7 @@ if ($source == 'contractline') print ''."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } if (is_object($contract->thirdparty)) print ''."\n"; @@ -1380,8 +1363,7 @@ if ($source == 'membersubscription') $mesg = $member->error; $error++; } - else - { + else { $member->fetch_thirdparty(); $subscription = new Subscription($db); } @@ -1523,8 +1505,7 @@ if ($source == 'membersubscription') print ''."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } if (is_object($member->thirdparty)) print ''."\n"; @@ -1549,8 +1530,7 @@ if ($source == 'donation') $mesg = $don->error; $error++; } - else - { + else { $don->fetch_thirdparty(); } $object = $don; @@ -1668,8 +1648,7 @@ if ($source == 'donation') print ''."\n"; print ''."\n"; } - else - { + else { print ''."\n"; } if (is_object($don->thirdparty)) print ''."\n"; @@ -1705,8 +1684,7 @@ if ($action != 'dopayment') { print '

'.$langs->trans("DonationPaid").''; } - else - { + else { // Membership can be paid and we still allow to make renewal if ($source == 'membersubscription' && $object->datefin > dol_now()) { @@ -1796,13 +1774,11 @@ if ($action != 'dopayment') } } } - else - { + else { dol_print_error_email('ERRORNEWPAYMENT'); } } -else -{ +else { // Print } @@ -1940,8 +1916,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment { print '
'.$langs->trans("Error").'
'; } - else - { + else { print ''; //$_SESSION["paymentintent_id"] = $paymentintent->id; } @@ -1956,8 +1931,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment $langs->load("errors"); print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error'); } - else - { + else { print ''; print ''."\n"; print ''."\n"; @@ -2173,7 +2147,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment // Old code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off @@ -2241,7 +2215,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment }); /* Use 3DS source */ diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index a3f6d733fcb..a261c6101a0 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -78,8 +78,7 @@ if (empty($paymentmethod)) dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used'); exit; } -else -{ +else { dol_syslog("paymentmethod=".$paymentmethod); } @@ -187,8 +186,7 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); } - else - { + else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index b1d6c149a51..a1d562b8690 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -222,8 +222,7 @@ if (!empty($conf->paypal->enabled)) // Nothing to do dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment'); } - else - { + else { dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, '_payment'); } @@ -251,8 +250,7 @@ if (!empty($conf->paypal->enabled)) $ispaymentok = true; } - else - { + else { dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0, '_payment'); //Display a user friendly Error on the page using any of the following error information returned by PayPal @@ -262,13 +260,11 @@ if (!empty($conf->paypal->enabled)) $ErrorSeverityCode = urldecode($resArray2["L_SEVERITYCODE0"]); } } - else - { + else { dol_print_error('', 'Session expired'); } } - else - { + else { dol_print_error('', '$PAYPALTOKEN not defined'); } } @@ -420,8 +416,7 @@ if ($ispaymentok) $postactionmessages[] = $errmsg; $ispostactionok = -1; } - else - { + else { $postactionmessages[] = 'Subscription created'; $ispostactionok = 1; } @@ -443,8 +438,7 @@ if ($ispaymentok) $postactionmessages = array_merge($postactionmessages, $object->errors); $ispostactionok = -1; } - else - { + else { if ($option == 'bankviainvoice') { $postactionmessages[] = 'Invoice, payment and bank record created'; @@ -523,8 +517,7 @@ if ($ispaymentok) { $db->commit(); } - else - { + else { $db->rollback(); } @@ -590,8 +583,7 @@ if ($ispaymentok) $postactionmessages[] = $errmsg; $ispostactionok = -1; } - else - { + else { if ($file) $postactionmessages[] = 'Email sent to member (with invoice document attached)'; else $postactionmessages[] = 'Email sent to member (without any attached document)'; @@ -600,14 +592,12 @@ if ($ispaymentok) } } } - else - { + else { $postactionmessages[] = 'Failed to get a valid value for "amount paid" or "payment type" to record the payment of subscription for member '.$tmptag['MEM'].'. May be payment was already recorded.'; $ispostactionok = -1; } } - else - { + else { $postactionmessages[] = 'Member '.$tmptag['MEM'].' for subscription payed was not found'; $ispostactionok = -1; } @@ -648,8 +638,7 @@ if ($ispaymentok) { $paiement->amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id } - else - { + else { $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching $postactionmessages[] = 'Payment was done in a different currency that currency expected of company'; @@ -672,8 +661,7 @@ if ($ispaymentok) $ispostactionok = -1; $error++; } - else - { + else { $postactionmessages[] = 'Payment created'; $ispostactionok = 1; } @@ -697,14 +685,12 @@ if ($ispaymentok) $ispostactionok = -1; $error++; } - else - { + else { $postactionmessages[] = 'Bank transaction of payment created'; $ispostactionok = 1; } } - else - { + else { $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; $ispostactionok = -1; $error++; @@ -715,25 +701,21 @@ if ($ispaymentok) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { $postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type" ('.$paymentType.') to record the payment of invoice '.$tmptag['INV'].'. May be payment was already recorded.'; $ispostactionok = -1; } } - else - { + else { $postactionmessages[] = 'Invoice payed '.$tmptag['INV'].' was not found'; $ispostactionok = -1; } } - else - { + else { // Nothing done } } @@ -811,8 +793,7 @@ if ($ispaymentok) //$content.=$companylangs->trans("ThirdPartyId").': '.$tmptag['CUS']."
\n"; $content .= $companylangs->trans("Link").':
'.$url.''."
\n"; } - else - { + else { $content .= $companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived")."
\n"; } $content .= $companylangs->transnoentities("PostActionAfterPayment").' : '; @@ -825,8 +806,7 @@ if ($ispaymentok) { $content .= $companylangs->transnoentitiesnoconv("None"); } - else - { + else { $topic .= ($ispostactionok ? '' : ' ('.$companylangs->trans("WarningPostActionErrorAfterPayment").')'); $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; } @@ -865,15 +845,13 @@ if ($ispaymentok) dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); //dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0); } - else - { + else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); //dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0); } } } -else -{ +else { // Get on url call $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN; $payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID; @@ -952,8 +930,7 @@ else { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); } - else - { + else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } diff --git a/htdocs/public/stripe/confirm_payment.php b/htdocs/public/stripe/confirm_payment.php index 9a45a2cbeec..9c6346842c8 100644 --- a/htdocs/public/stripe/confirm_payment.php +++ b/htdocs/public/stripe/confirm_payment.php @@ -49,8 +49,7 @@ if (isset($_GET['connect'])) $service = 'StripeTest'; $servicestatus = 0; } - else - { + else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; $servicestatus = 1; @@ -63,8 +62,7 @@ else { $service = 'StripeTest'; $servicestatus = 0; } - else - { + else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $service = 'StripeLive'; $servicestatus = 1; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index 4291cb6f834..e3cc21b327b 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -49,8 +49,7 @@ if (isset($_GET['connect'])) $service = 'StripeTest'; $servicestatus = 0; } - else - { + else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; $servicestatus = 1; @@ -63,8 +62,7 @@ else { $service = 'StripeTest'; $servicestatus = 0; } - else - { + else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $service = 'StripeLive'; $servicestatus = 1; @@ -189,8 +187,7 @@ if ($event->type == 'payout.created') { http_response_code(200); // PHP 5.4 or greater return 1; } - else - { + else { $error++; http_response_code(500); // PHP 5.4 or greater return -1; @@ -270,8 +267,7 @@ elseif ($event->type == 'payout.paid') { http_response_code(200); // PHP 5.4 or greater return 1; } - else - { + else { $error++; http_response_code(500); // PHP 5.4 or greater return -1; @@ -344,8 +340,7 @@ elseif ($event->type == 'payment_method.attached') { { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -381,8 +376,7 @@ elseif ($event->type == 'payment_method.updated') { { $db->commit(); } - else - { + else { $db->rollback(); } } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index c326b4a6bd2..cbe88b006d4 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -46,8 +46,7 @@ if (empty($usedolheader)) trans('TicketMessagesList'), '', 'object_conversation'); $object->viewTicketMessages(false, true, $object->dao); } - else - { + else { print ''; } } else { diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index 95f2efa492a..2f18de010a0 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -106,8 +106,7 @@ if (empty($pageid)) } } } - else - { + else { if ($object->fk_default_home > 0) { $result = $objectpage->fetch($object->fk_default_home); @@ -165,8 +164,7 @@ if ($pageid == 'css') // No more used ? header('Cache-Control: no-cache'); $original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php'; } -else -{ +else { $original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php'; } diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index ce416bdd7b6..24125178f5d 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -78,8 +78,7 @@ if (empty($pageid)) $object->fetch($websiteid); $website = $object->ref; } - else - { + else { $object->fetch(0, $website); } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 3d8547f9322..2ada4b1c447 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -233,8 +233,7 @@ if (empty($reshook)) if ($object->origin == "supplierorder") $classname = 'CommandeFournisseur'; - else - $classname = ucfirst($object->origin); + else $classname = ucfirst($object->origin); $objectsrc = new $classname($db); $objectsrc->fetch($object->origin_id); @@ -354,8 +353,7 @@ if (empty($reshook)) } } } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("QtyToReceive").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; } @@ -366,8 +364,7 @@ if (empty($reshook)) header("Location: card.php?id=".$object->id); exit; } - else - { + else { $db->rollback(); $_GET["commande_id"] = GETPOST('commande_id', 'int'); $action = 'create'; @@ -388,8 +385,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans($object->error), null, 'errors'); } - else - { + else { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -418,8 +414,7 @@ if (empty($reshook)) header("Location: ".DOL_URL_ROOT.'/reception/index.php'); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -567,8 +562,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); } - else - { + else { setEventMessages($line->error, $line->errors, 'errors'); } } @@ -667,8 +661,7 @@ if (empty($reshook)) $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } } - else - { + else { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit(); } @@ -1049,8 +1042,7 @@ if ($action == 'create') print ''; } - else - { + else { print ""; if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -1089,8 +1081,7 @@ if ($action == 'create') { $quantityToBeDelivered = 0; } - else - { + else { $quantityToBeDelivered = $dispatchLines[$indiceAsked]['qty']; } $warehouse_id = $dispatchLines[$indiceAsked]['ent']; @@ -1131,8 +1122,7 @@ if ($action == 'create') print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 0, 0, $line->fk_product, '', 1); } } - else - { + else { print $langs->trans("Service"); } print ''; @@ -1195,8 +1185,7 @@ if ($action == 'create') print '
'; } - else - { + else { dol_print_error($db); } } @@ -1247,8 +1236,7 @@ elseif ($id || $ref) { $numref = $object->getNextNumRef($soc); } - else - { + else { $numref = $object->ref; } @@ -1413,8 +1401,7 @@ elseif ($id || $ref) print ''; print ''; } - else - { + else { print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; } print ''; @@ -1437,8 +1424,7 @@ elseif ($id || $ref) print ' '; print ''; } - else - { + else { print $object->trueWeight; print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; } @@ -1472,8 +1458,7 @@ elseif ($id || $ref) print ' '; print ''; } - else - { + else { print $object->trueHeight; print ($object->trueHeight && $object->height_units != '') ? ' '.measuringUnitString(0, "size", $object->height_units) : ''; } @@ -1551,8 +1536,7 @@ elseif ($id || $ref) print ''; print ''; } - else - { + else { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey @@ -1585,8 +1569,7 @@ elseif ($id || $ref) { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } - else - { + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -1640,8 +1623,7 @@ elseif ($id || $ref) { print $langs->trans("QtyToReceive").' - '; } - else - { + else { print $langs->trans("QtyReceived").' - '; } if (!empty($conf->stock->enabled)) @@ -1654,14 +1636,12 @@ elseif ($id || $ref) } print ''; } - else - { + else { if ($object->statut <= 1) { print ''.$langs->trans("QtyToReceive").''; } - else - { + else { print ''.$langs->trans("QtyReceived").''; } if (!empty($conf->stock->enabled)) @@ -1769,8 +1749,7 @@ elseif ($id || $ref) $prod->fetch($lines[$i]->fk_product); $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product->label; } - else - $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label); + else $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label); print ''; @@ -1785,8 +1764,7 @@ elseif ($id || $ref) } print "\n"; } - else - { + else { print ""; if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -1806,8 +1784,7 @@ elseif ($id || $ref) { print ''; } - else - { + else { print ''.$lines[$i]->comment.''; } @@ -1873,8 +1850,7 @@ elseif ($id || $ref) } print ''; } - else - { + else { print ''; print ''; // Qty to receive or received @@ -1888,8 +1864,7 @@ elseif ($id || $ref) } print ''; } - else - { + else { // Qty to receive or received print ''.$lines[$i]->qty.''; @@ -1926,8 +1901,7 @@ elseif ($id || $ref) print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); } - else - { + else { print $langs->trans("NA"); } print ''; @@ -1988,8 +1962,7 @@ elseif ($id || $ref) { print $line->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked); } - else - { + else { print $line->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked); } } @@ -2027,8 +2000,7 @@ elseif ($id || $ref) { print ''.$langs->trans("Validate").''; } - else - { + else { print ''.$langs->trans("Validate").''; } } @@ -2045,8 +2017,7 @@ elseif ($id || $ref) { print ''.$langs->trans("ClassifyUnbilled").''; } - else - { + else { print ''.$langs->trans("ReOpen").''; } } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index a95d6217c1c..111846347be 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -179,14 +179,12 @@ class Reception extends CommonObject { return $numref; } - else - { + else { dol_print_error($this->db, get_class($this)."::getNextNumRef ".$obj->error); return ""; } } - else - { + else { print $langs->trans("Error")." ".$langs->trans("Error_RECEPTION_ADDON_NUMBER_NotDefined"); return ""; } @@ -325,8 +323,7 @@ class Reception extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); @@ -336,16 +333,14 @@ class Reception extends CommonObject return -1 * $error; } } - else - { + else { $error++; $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } } - else - { + else { $error++; $this->error = $this->db->error()." - sql=$sql"; $this->db->rollback(); @@ -473,15 +468,13 @@ class Reception extends CommonObject return 1; } - else - { + else { dol_syslog(get_class($this).'::Fetch no reception found', LOG_ERR); $this->error = 'Delivery with id '.$id.' not found'; return 0; } } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -602,8 +595,7 @@ class Reception extends CommonObject break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. @@ -618,8 +610,7 @@ class Reception extends CommonObject } } } - else - { + else { $this->db->rollback(); $this->error = $this->db->error(); return -2; @@ -694,8 +685,7 @@ class Reception extends CommonObject $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR); @@ -867,8 +857,7 @@ class Reception extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -922,8 +911,7 @@ class Reception extends CommonObject $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed } } - else - { + else { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -1000,35 +988,30 @@ class Reception extends CommonObject return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; } } - else - { + else { $this->db->rollback(); return -1; } @@ -1274,14 +1257,12 @@ class Reception extends CommonObject $this->date_delivery = $date_livraison; return 1; } - else - { + else { $this->error = $this->db->error(); return -1; } } - else - { + else { return -2; } } @@ -1365,8 +1346,7 @@ class Reception extends CommonObject $sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')"; $resql = $this->db->query($sql); } - else - { + else { $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET"; $sql .= " code='".$this->db->escape($this->update['code'])."'"; $sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'"; @@ -1442,8 +1422,7 @@ class Reception extends CommonObject $url = str_replace('{TRACKID}', $value, $tracking); $this->tracking_url = sprintf(''.($value ? $value : 'url').'', $url, $url); } - else - { + else { $this->tracking_url = $value; } } @@ -1545,8 +1524,7 @@ class Reception extends CommonObject $error++; break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1560,8 +1538,7 @@ class Reception extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -1576,8 +1553,7 @@ class Reception extends CommonObject } } } - else - { + else { dol_print_error($this->db); $error++; } @@ -1587,8 +1563,7 @@ class Reception extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1633,8 +1608,7 @@ class Reception extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1710,8 +1684,7 @@ class Reception extends CommonObject $error++; break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1724,8 +1697,7 @@ class Reception extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -1755,8 +1727,7 @@ class Reception extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -1846,8 +1817,7 @@ class Reception extends CommonObject break; } } - else - { + else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1860,8 +1830,7 @@ class Reception extends CommonObject } } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -1912,8 +1881,7 @@ class Reception extends CommonObject return -1; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index b2d30bf7c7f..b5e526bb1b3 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -91,8 +91,7 @@ if ($action == 'addcontact' && $user->rights->reception->creer) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index c6cfcd5264c..c753cf3e873 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -279,15 +279,13 @@ if (empty($reshook)) $result = $object->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); } - else - { + else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } } - else - { + else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -335,8 +333,7 @@ if (empty($reshook)) { $lineid = $result; } - else - { + else { $lineid = 0; $error++; break; @@ -391,8 +388,7 @@ if (empty($reshook)) $db->commit(); setEventMessage($langs->trans('BillCreated', $nb_bills_created)); } - else - { + else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -585,8 +581,7 @@ if ($resql) print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; } - else - { + else { print $form->selectyesno('validate_invoices', 0, 1); } print ''; @@ -937,8 +932,7 @@ if ($resql) print ''; $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index e7e8ef7e090..4a0bcb4fd04 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -78,8 +78,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filenamenb = $dir.'/receptionsnbinyear-'.$year.'.png'; } diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index 1035d17d5f9..fa99e4610d5 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -49,8 +49,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index b403c0516f9..9f2a044525d 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -100,8 +100,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); $action = 'create'; } - else - { + else { $object->ref = $ref; $object->description = $description; $object->fk_code_type_resource = $fk_code_type_resource; @@ -119,16 +118,14 @@ if (empty($reshook)) Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { // Creation KO setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } } - else - { + else { Header("Location: list.php"); exit; } @@ -166,14 +163,12 @@ if (empty($reshook)) Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } @@ -198,13 +193,11 @@ if (empty($reshook)) Header('Location: '.DOL_URL_ROOT.'/resource/list.php'); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -228,8 +221,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) print load_fiche_titre($title, '', 'object_resource'); dol_fiche_head(''); } - else - { + else { $head = resource_prepare_head($object); dol_fiche_head($head, 'resource', $title, -1, 'resource'); } @@ -292,8 +284,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) print ''; } - else - { + else { $formconfirm = ''; // Confirm deleting resource line diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 1b4223e1fff..41c0db7ec15 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -165,8 +165,7 @@ class Dolresource extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return $this->id; } @@ -224,8 +223,7 @@ class Dolresource extends CommonObject return $this->id; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -330,8 +328,7 @@ class Dolresource extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -389,8 +386,7 @@ class Dolresource extends CommonObject return $this->id; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -428,8 +424,7 @@ class Dolresource extends CommonObject $error++; } } - else - { + else { $this->error = $this->db->lasterror(); $error++; } @@ -476,8 +471,7 @@ class Dolresource extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -568,8 +562,7 @@ class Dolresource extends CommonObject } return $num; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -646,8 +639,7 @@ class Dolresource extends CommonObject } return $num; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -725,8 +717,7 @@ class Dolresource extends CommonObject } return $num; } - else - { + else { $this->error = $this->db->lasterror(); return -1; } @@ -817,8 +808,7 @@ class Dolresource extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -925,8 +915,7 @@ class Dolresource extends CommonObject } return $num; } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 4836ed1a0f1..3eeebeaee45 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -127,8 +127,7 @@ class FormResource { $out .= ''; } - else - { + else { $out .= ''; } @@ -147,8 +146,7 @@ class FormResource $out .= ''; } } - else - { + else { dol_print_error($this->db); } diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index cbc94c2e843..dc916aa5f77 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -63,8 +63,7 @@ if ($action == 'addcontact' && $user->rights->resource->write) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index d0d4e2300d8..0e6b20923b5 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -137,8 +137,7 @@ if ($object->id > 0) include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 1ce3957071a..8e353b59788 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -98,8 +98,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Resource")), null, 'errors'); $action = ''; } - else - { + else { $objstat = fetchObjectByElement($element_id, $element, $element_ref); $objstat->element = $element; // For externals module, we need to keep @xx @@ -266,8 +265,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -298,8 +296,7 @@ if ($ret == -1) { if (!$ret) { print '
'.$langs->trans('NoResourceInDatabase').'
'; } -else -{ +else { // Confirmation suppression resource line if ($action == 'delete_resource') { @@ -412,8 +409,7 @@ else } $_SESSION['assignedtouser'] = json_encode($listofuserid); } - else - { + else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -601,8 +597,7 @@ else { $tpl = dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_add.tpl.php'); } - else - { + else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/resource_add.tpl.php'; } if (empty($conf->file->strict_mode)) { @@ -621,8 +616,7 @@ else { $tpl = dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_view.tpl.php'); } - else - { + else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/resource_view.tpl.php'; } if (empty($conf->file->strict_mode)) { diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 033d49ae8c8..4f94c6c3e17 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -282,8 +282,7 @@ if ($ret) print ''; } } -else -{ +else { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } print ''.$langs->trans("NoRecordFound").''; diff --git a/htdocs/salaries/admin/salaries.php b/htdocs/salaries/admin/salaries.php index 29e3c325ee0..b1f1f627a99 100644 --- a/htdocs/salaries/admin/salaries.php +++ b/htdocs/salaries/admin/salaries.php @@ -63,8 +63,7 @@ if ($action == 'update') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -115,8 +114,7 @@ foreach ($list as $key) { print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); } - else - { + else { print ''; } print ''; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index ade8924b0d0..d7b71edbf0b 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -159,8 +159,7 @@ if ($action == 'add' && empty($cancel)) exit; } } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -194,21 +193,18 @@ if ($action == 'delete') header("Location: ".DOL_URL_ROOT.'/salaries/list.php'); exit; } - else - { + else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } @@ -494,13 +490,11 @@ if ($id) { print ''; } - else - { + else { print ''; } } - else - { + else { print ''; } print ""; diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 82cdf3c80ce..9fddd59ce51 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -183,8 +183,7 @@ class PaymentSalary extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -264,8 +263,7 @@ class PaymentSalary extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -481,8 +479,7 @@ class PaymentSalary extends CommonObject { $this->update_fk_bank($bank_line_id); } - else - { + else { $this->error = $acc->error; $error++; } @@ -532,14 +529,12 @@ class PaymentSalary extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -563,8 +558,7 @@ class PaymentSalary extends CommonObject { return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -676,8 +670,7 @@ class PaymentSalary extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index ff709816d18..0e6a1bccba0 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -129,8 +129,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index fd6e7a3ec95..b06ad2348e4 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -68,8 +68,7 @@ if (!GETPOST('typeid', 'int')) if ($part[0] == 's.fk_typepayment') $typeid = $part[1]; } } -else -{ +else { $typeid = GETPOST('typeid', 'int'); } @@ -318,8 +317,7 @@ if ($result) $db->free($result); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index fb6663be951..307b903787e 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -54,8 +54,7 @@ if ($action == 'setcodeclient') header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -67,8 +66,7 @@ if ($action == 'setcodecompta') header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -84,8 +82,7 @@ if ($action == 'updateoptions') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -99,8 +96,7 @@ if ($action == 'updateoptions') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -114,8 +110,7 @@ if ($action == 'updateoptions') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -178,8 +173,7 @@ if ($action == 'setdoc') { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -193,8 +187,7 @@ if ($action == "setaddrefinlist") { { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -208,8 +201,7 @@ if ($action == "setaddadressinlist") { { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -223,8 +215,7 @@ if ($action == "setaskforshippingmet") { { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -238,8 +229,7 @@ if ($action == "setdisableprospectcustomer") { { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -255,8 +245,7 @@ if ($action == 'setprofid') //header("Location: ".$_SERVER["PHP_SELF"]); //exit; } - else - { + else { dol_print_error($db); } } @@ -272,8 +261,7 @@ if ($action == 'setprofidmandatory') //header("Location: ".$_SERVER["PHP_SELF"]); //exit; } - else - { + else { dol_print_error($db); } } @@ -289,8 +277,7 @@ if ($action == 'setprofidinvoicemandatory') //header("Location: ".$_SERVER["PHP_SELF"]); //exit; } - else - { + else { dol_print_error($db); } } @@ -305,8 +292,7 @@ if ($action == 'sethideinactivethirdparty') header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -318,8 +304,7 @@ if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -412,8 +397,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) print img_picto($langs->trans("Activated"), 'switch_on'); print "\n"; } - else - { + else { $disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); print ''; if (!$disabled) print ''; @@ -498,8 +482,7 @@ foreach ($arrayofmodules as $file => $modCodeCompta) print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -538,8 +521,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -608,16 +590,14 @@ foreach ($dirsociete as $dirroot) //} print ""; } - else - { + else { if (versioncompare($module->phpmin, versionphparray()) > 0) { print "\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off'); print ""; } - else - { + else { print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; @@ -644,8 +624,7 @@ foreach ($dirsociete as $dirroot) { $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; } - else - { + else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print $linkspec; @@ -715,8 +694,7 @@ foreach ($profid as $key => $val) print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -728,8 +706,7 @@ foreach ($profid as $key => $val) print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -741,8 +718,7 @@ foreach ($profid as $key => $val) print img_picto($langs->trans("Activated"), 'switch_on'); print ''; } - else - { + else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; @@ -784,8 +760,7 @@ if (!$conf->use_javascript_ajax) print $langs->trans("NotAvailableWhenAjaxDisabled"); print ""; } -else -{ +else { print ''; $arrval = array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', @@ -808,8 +783,7 @@ if (!$conf->use_javascript_ajax) print $langs->trans("NotAvailableWhenAjaxDisabled"); print ""; } -else -{ +else { print ''; $arrval = array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', @@ -834,8 +808,7 @@ if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -851,8 +824,7 @@ if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -870,8 +842,7 @@ if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -888,8 +859,7 @@ if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); } -else -{ +else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index dba483c52eb..4142231261d 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -39,8 +39,7 @@ if (GETPOST('actioncode', 'array')) $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; } -else -{ +else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index 4fe737ca31c..1622b81384d 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -68,8 +68,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) echo json_encode($outjson); } -else -{ +else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->load("companies"); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index dcf0b1a4483..0558d7d31c8 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -72,8 +72,7 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) $sql .= " OR code_client LIKE '".$db->escape($socid)."%'"; $sql .= " OR code_fournisseur LIKE '".$db->escape($socid)."%'"; } - else - { + else { $sql .= "nom LIKE '%".$db->escape($socid)."%'"; $sql .= " OR code_client LIKE '%".$db->escape($socid)."%'"; $sql .= " OR code_fournisseur LIKE '%".$db->escape($socid)."%'"; @@ -101,12 +100,10 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) echo json_encode($return_arr); } - else - { + else { echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); } } -else -{ +else { echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 70ac0577cb9..0cd103a2855 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -259,8 +259,7 @@ abstract class ActionsCardCommon } } } - else - { + else { $head = societe_prepare_head($this->object); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); @@ -335,8 +334,7 @@ abstract class ActionsCardCommon $adh->ref = $adh->getFullName($langs); $this->tpl['linked_member'] = $adh->getNomUrl(1); } - else - { + else { $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); } } diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 0601760e34a..348163195d9 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -135,18 +135,15 @@ class ActionsCardCompany extends ActionsCardCommon $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } - else - { + else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } - else - { + else { $this->tpl['tva_intra'] = $s; } } - else - { + else { // Confirm delete third party if ($action == 'delete') { @@ -174,18 +171,15 @@ class ActionsCardCompany extends ActionsCardCommon $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } - else - { + else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } - else - { + else { $this->tpl['tva_intra'] = $s; } } - else - { + else { $this->tpl['tva_intra'] = ' '; } @@ -197,8 +191,7 @@ class ActionsCardCompany extends ActionsCardCommon $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client ? "(".$socm->code_client.")" : ""); $this->tpl['parent_company'] .= ($socm->town ? ' - '.$socm->town : ''); } - else - { + else { $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); } } diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 9f236c8015e..6a93ac3e939 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -111,8 +111,7 @@ class ActionsCardIndividual extends ActionsCardCommon { $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); } - else - { + else { // Confirm delete third party if ($action == 'delete' || $conf->use_javascript_ajax) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 681d4a37fc9..77299e3ee89 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -137,8 +137,7 @@ if (empty($reshook)) $langs->load('errors'); setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv('MergeOriginThirdparty')), null, 'errors'); } - else - { + else { if (!$error && $soc_origin->fetch($soc_origin_id) < 1) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); @@ -302,8 +301,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); $db->commit(); } - else - { + else { $langs->load("errors"); setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); $db->rollback(); @@ -404,8 +402,7 @@ if (empty($reshook)) $object->name_bis = GETPOST('name', 'alpha'); $object->firstname = GETPOST('firstname', 'alpha'); } - else - { + else { $object->name = GETPOST('name', 'alpha'); } $object->entity = (GETPOSTISSET('entity') ?GETPOST('entity', 'int') : $conf->entity); @@ -609,16 +606,14 @@ if (empty($reshook)) { $errors[] = "ErrorFailedToSaveFile"; } - else - { + else { // Create thumbs $object->addThumbs($newfile); } } } } - else - { + else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -632,8 +627,7 @@ if (empty($reshook)) } // Gestion du logo de la société } - else - { + else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case { $duplicate_code_error = true; @@ -656,8 +650,7 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { $url = $_SERVER["PHP_SELF"]."?socid=".$object->id; // Old method if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url = DOL_URL_ROOT."/comm/card.php?socid=".$object->id; elseif ($object->fournisseur == 1) $url = DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; @@ -666,8 +659,7 @@ if (empty($reshook)) exit; } } - else - { + else { $db->rollback(); $action = 'create'; } @@ -684,8 +676,7 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } @@ -760,8 +751,7 @@ if (empty($reshook)) { $errors[] = "ErrorFailedToSaveFile"; } - else - { + else { // Create thumbs $object->addThumbs($newfile); @@ -777,13 +767,11 @@ if (empty($reshook)) } } } - else - { + else { $errors[] = "ErrorBadImageFormat"; } } - else - { + else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -818,21 +806,18 @@ if (empty($reshook)) header("Location: ".$backtopage); exit; } - else - { + else { header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } } - else - { + else { $object->id = $socid; $action = "edit"; } } } - else - { + else { $action = ($action == 'add' ? 'create' : 'edit'); } } @@ -849,8 +834,7 @@ if (empty($reshook)) header("Location: ".DOL_URL_ROOT."/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode($object->name)); exit; } - else - { + else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -920,8 +904,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template } -else -{ +else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -1062,8 +1045,7 @@ else { $errors[] = "ErrorFailedToSaveFile"; } - else - { + else { // Create thumbs $object->addThumbs($newfile); } @@ -1205,8 +1187,7 @@ else { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; } - else - { + else { print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; @@ -1342,8 +1323,7 @@ else { print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } - else - { + else { print ''.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } @@ -1432,8 +1412,7 @@ else $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } - else - { + else { $s .= 'country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } @@ -1485,8 +1464,7 @@ else { print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); } - else - { + else { print $countrynotdefined; } print ''; @@ -1579,8 +1557,7 @@ else print '     '; print ''; } - else - { + else { print '     '; print ''; } @@ -1837,8 +1814,7 @@ else print ''; print $object->prefix_comm; } - else - { + else { print ''; } print ''; @@ -1864,8 +1840,7 @@ else { print ''; } - else - { + else { print $object->code_client; print ''; } @@ -1905,8 +1880,7 @@ else { print ''; } - else - { + else { print $object->code_fournisseur; print ''; } @@ -1962,8 +1936,7 @@ else { print ''.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; } - else - { + else { print ''.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } @@ -2099,8 +2072,7 @@ else $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } - else - { + else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } @@ -2243,8 +2215,7 @@ else print ''; } } - else - { + else { /* * View */ @@ -2406,8 +2377,7 @@ else $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); print ''; } - else - { + else { print ''.$object->localtax1_value.''; } print ''; @@ -2500,15 +2470,13 @@ else $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); } - else - { + else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } print $s; } - else - { + else { print ' '; } print ''; @@ -2586,8 +2554,7 @@ else { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } - else - { + else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id); } print ''; @@ -2621,8 +2588,7 @@ else { $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'editparentcompany', 's.rowid <> '.$object->id, 1); } - else - { + else { $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'none', 's.rowid <> '.$object->id, 1); } print ''; @@ -2645,8 +2611,7 @@ else $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); } - else - { + else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print ''; @@ -2696,8 +2661,7 @@ else $langs->load("mails"); print ''.$langs->trans('SendMail').''; } - else - { + else { $langs->load("mails"); print ''.$langs->trans('SendMail').''; } @@ -2729,8 +2693,7 @@ else { print ''.$langs->trans('Delete').''."\n"; } - else - { + else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 91d0fe9bb1a..99e18f036aa 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -50,8 +50,7 @@ if (!$vatNumber) print '
'; print ''.$langs->transnoentities("ErrorFieldRequired", $langs->trans("VATIntraShort")).'
'; } -else -{ +else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); $countryCode = substr($vatNumber, 0, 2); @@ -127,8 +126,7 @@ else print $langs->trans("ValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; //$messagetoshow=$soapclient->response; } - else - { + else { // Syntaxe ok if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
'; print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
'; @@ -137,8 +135,7 @@ else { print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE", $countryCode).'
'; } - else - { + else { if (!empty($result['valid']) && ($result['valid'] == 1 || $result['valid'] == 'true')) { print ''.$langs->trans("Yes").''; @@ -146,8 +143,7 @@ else print $langs->trans("Name").': '.$result['name'].'
'; print $langs->trans("Address").': '.$result['address'].'
'; } - else - { + else { print ''.$langs->trans("No").''; print '
'."\n"; } diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index c50a746c444..3ec6243a2c7 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -467,8 +467,7 @@ class Thirdparties extends DolibarrApi throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.'); } - else - { + else { $db->commit(); } @@ -1313,8 +1312,7 @@ class Thirdparties extends DolibarrApi $i++; } } - else - { + else { throw new RestException(404, 'Bank account not found'); } @@ -1331,8 +1329,7 @@ class Thirdparties extends DolibarrApi { return array("success" => $result); } - else - { + else { throw new RestException(500); } } diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 06c56b027cd..803d0ddebe3 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -84,8 +84,7 @@ class Client extends Societe $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 7211802721e..00737c04504 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -112,19 +112,16 @@ class CompanyBankAccount extends Account { return 1; } - else - { + else { return 0; } } - else - { + else { return 1; } } } - else - { + else { print $this->db->error(); return 0; } @@ -167,8 +164,7 @@ class CompanyBankAccount extends Account } if (trim($this->label) != '') $sql .= ",label = '".$this->db->escape($this->label)."'"; - else - $sql .= ",label = NULL"; + else $sql .= ",label = NULL"; $sql .= " WHERE rowid = ".$this->id; $result = $this->db->query($sql); @@ -184,18 +180,15 @@ class CompanyBankAccount extends Account { return 1; } - else - { + else { return -1; } } - else - { + else { return 1; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -259,8 +252,7 @@ class CompanyBankAccount extends Account return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -308,8 +300,7 @@ class CompanyBankAccount extends Account $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1 * $error; } @@ -355,8 +346,7 @@ class CompanyBankAccount extends Account { return 0; } - else - { + else { $obj = $this->db->fetch_object($result1); $this->db->begin(); @@ -377,15 +367,13 @@ class CompanyBankAccount extends Account $this->db->rollback(); return -1; } - else - { + else { $this->db->commit(); return 1; } } } - else - { + else { dol_print_error($this->db); return -1; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index 5ba268f6687..ca75b904b11 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -440,8 +440,7 @@ class CompanyPaymentMode extends CommonObject { return 0; } - else - { + else { $obj = $this->db->fetch_object($result1); $type = ''; @@ -467,15 +466,13 @@ class CompanyPaymentMode extends CommonObject $this->db->rollback(); return -1; } - else - { + else { $this->db->commit(); return 1; } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -566,8 +563,7 @@ class CompanyPaymentMode extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index de65e05d41e..e2b24577bf9 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -827,22 +827,19 @@ class Societe extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { dol_syslog(get_class($this)."::Create echec update ".$this->error." ".join(',', $this->errors), LOG_ERR); $this->db->rollback(); return -4; } } - else - { + else { if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans("ErrorCompanyNameAlreadyExists", $this->name); // duplicate on a field (code or profid or ...) $result = -1; } - else - { + else { $this->error = $this->db->lasterror(); $result = -2; } @@ -850,8 +847,7 @@ class Societe extends CommonObject return $result; } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1007,8 +1003,7 @@ class Societe extends CommonObject } } } - else - { + else { //var_dump($conf->global->SOCIETE_EMAIL_UNIQUE); //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') @@ -1337,8 +1332,7 @@ class Societe extends CommonObject unset($this->state); } } - else - { + else { unset($this->country_code); // We clean this, in the doubt, because it may have been changed after an update of country_id unset($this->country); unset($this->state_code); @@ -1425,22 +1419,19 @@ class Societe extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } } - else - { + else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { // Doublon $this->error = $langs->trans("ErrorDuplicateField"); $result = -1; } - else - { + else { $this->error = $this->db->lasterror(); $result = -2; } @@ -1448,8 +1439,7 @@ class Societe extends CommonObject return $result; } } - else - { + else { $this->db->rollback(); dol_syslog(get_class($this)."::Update fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1675,15 +1665,13 @@ class Societe extends CommonObject // fetch optionals attributes and labels $this->fetch_optionals(); } - else - { + else { $result = 0; } $this->db->free($resql); } - else - { + else { $this->error = $this->db->lasterror(); $result = -3; } @@ -1822,8 +1810,7 @@ class Societe extends CommonObject return 1; } - else - { + else { dol_syslog($this->error, LOG_ERR); $this->db->rollback(); return -1; @@ -2051,8 +2038,7 @@ class Societe extends CommonObject { return $result; } - else - { + else { $this->error = $discount->error; return -3; } @@ -2079,8 +2065,7 @@ class Societe extends CommonObject { return $result; } - else - { + else { $this->error = $discountstatic->error; return -1; } @@ -2108,8 +2093,7 @@ class Societe extends CommonObject $sql .= " AND ug.entity = ".$conf->entity.")"; $sql .= " OR u.admin = 1)"; } - else - $sql .= " WHERE entity in (0, ".$conf->entity.")"; + else $sql .= " WHERE entity in (0, ".$conf->entity.")"; $sql .= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".$this->id; @@ -2136,8 +2120,7 @@ class Societe extends CommonObject $reparray[$i]['login'] = $obj->login; $reparray[$i]['photo'] = $obj->photo; } - else - { + else { $reparray[] = $obj->rowid; } $i++; @@ -2249,8 +2232,7 @@ class Societe extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -2335,8 +2317,7 @@ class Societe extends CommonObject { $name = $code.' '.$name; } - else - { + else { $name = $code; } } @@ -2629,8 +2610,7 @@ class Societe extends CommonObject { $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).($obj->poste ? " - ".$obj->poste : "").(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); } - else - { + else { $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); } } @@ -2638,8 +2618,7 @@ class Societe extends CommonObject } } } - else - { + else { dol_print_error($this->db); } return $contact_property; @@ -2673,8 +2652,7 @@ class Societe extends CommonObject } } } - else - { + else { dol_print_error($this->db); } return $contacts; @@ -2710,8 +2688,7 @@ class Societe extends CommonObject } } } - else - { + else { dol_print_error($this->db); } return $contacts; @@ -2750,8 +2727,7 @@ class Societe extends CommonObject } return $contact_property; } - else - { + else { dol_print_error($this->db); } } @@ -2918,8 +2894,7 @@ class Societe extends CommonObject if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; } - else - { + else { return 0; } } @@ -2954,8 +2929,7 @@ class Societe extends CommonObject if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; } - else - { + else { return 0; } } @@ -2992,8 +2966,7 @@ class Societe extends CommonObject $result = $mod->verif($this->db, $this->code_client, $this, 0); return $result; } - else - { + else { return 0; } } @@ -3029,8 +3002,7 @@ class Societe extends CommonObject $result = $mod->verif($this->db, $this->code_fournisseur, $this, 1); return $result; } - else - { + else { return 0; } } @@ -3072,14 +3044,12 @@ class Societe extends CommonObject return $result; } - else - { + else { $this->error = 'ErrorAccountancyCodeNotDefined'; return -1; } } - else - { + else { if ($type == 'customer') $this->code_compta = ''; elseif ($type == 'supplier') $this->code_compta_fournisseur = ''; @@ -3109,8 +3079,7 @@ class Societe extends CommonObject $this->parent = $id; return 1; } - else - { + else { return -1; } } @@ -3205,8 +3174,7 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($resql); $count = $obj->idprof; } - else - { + else { $count = 0; print $this->db->error(); } @@ -3306,8 +3274,7 @@ class Societe extends CommonObject if (preg_match('/(^[0-9]{8}[A-Z]{1}$)/', $string)) if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 0, 8) % 23, 1)) return 1; - else - return -1; + else return -1; //algorithm checking type code CIF $sum = $num[2] + $num[4] + $num[6]; @@ -3319,29 +3286,25 @@ class Societe extends CommonObject if (preg_match('/^[KLM]{1}/', $string)) if ($num[8] == chr(64 + $n) || $num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr($string, 1, 8) % 23, 1)) return 1; - else - return -1; + else return -1; //Check CIF if (preg_match('/^[ABCDEFGHJNPQRSUVW]{1}/', $string)) if ($num[8] == chr(64 + $n) || $num[8] == substr($n, strlen($n) - 1, 1)) return 2; - else - return -2; + else return -2; //Check NIE T if (preg_match('/^[T]{1}/', $string)) if ($num[8] == preg_match('/^[T]{1}[A-Z0-9]{8}$/', $string)) return 3; - else - return -3; + else return -3; //Check NIE XYZ if (preg_match('/^[XYZ]{1}/', $string)) if ($num[8] == substr('TRWAGMYFPDXBNJZSQVHLCKE', substr(str_replace(array('X', 'Y', 'Z'), array('0', '1', '2'), $string), 0, 8) % 23, 1)) return 3; - else - return -3; + else return -3; //Can not be verified return -4; @@ -3440,8 +3403,7 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($resql); $count = $obj->numproj; } - else - { + else { $count = 0; print $this->db->error(); } @@ -3491,8 +3453,7 @@ class Societe extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -3558,8 +3519,7 @@ class Societe extends CommonObject } return 0; } - else - { + else { return -1; } } @@ -3581,8 +3541,7 @@ class Societe extends CommonObject if ($resql = $this->db->query($sql)) return 0; } - else - { + else { return 0; } return -1; @@ -3645,16 +3604,14 @@ class Societe extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } } - else - { + else { // $this->error deja positionne dol_syslog(get_class($this)."::create_from_member - 2 - ".$this->error." - ".join(',', $this->errors), LOG_ERR); @@ -3696,7 +3653,7 @@ class Societe extends CommonObject $country_code = $tmp[1]; $country_label = $tmp[2]; } - else // For backward compatibility + else // For backward compatibility { dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -3721,7 +3678,7 @@ class Societe extends CommonObject $state_code = $tmp[1]; $state_label = $tmp[2]; } - else // For backward compatibility + else // For backward compatibility { dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -3904,8 +3861,7 @@ class Societe extends CommonObject $obj = $this->db->fetch_object($resql); return (($obj->nb > 0) ?true:false); } - else - { + else { $this->error = $this->db->lasterror(); return false; } @@ -3991,8 +3947,7 @@ class Societe extends CommonObject elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); - else - { + else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label); } } @@ -4003,8 +3958,7 @@ class Societe extends CommonObject elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1); elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2); elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3); - else - { + else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0); } } @@ -4015,8 +3969,7 @@ class Societe extends CommonObject elseif ($status == '1' || $status == 'ST_TODO') return img_action($langs->trans("StatusProspect1"), 1).' '.$langs->trans("StatusProspect1"); elseif ($status == '2' || $status == 'ST_PEND') return img_action($langs->trans("StatusProspect2"), 2).' '.$langs->trans("StatusProspect2"); elseif ($status == '3' || $status == 'ST_DONE') return img_action($langs->trans("StatusProspect3"), 3).' '.$langs->trans("StatusProspect3"); - else - { + else { return img_action(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label, 0).' '.(($langs->trans("StatusProspect".$status) != "StatusProspect".$status) ? $langs->trans("StatusProspect".$status) : $label); } } @@ -4074,8 +4027,7 @@ class Societe extends CommonObject } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } - else - return array(); + else return array(); } /** @@ -4114,8 +4066,7 @@ class Societe extends CommonObject } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } - else - return array(); + else return array(); } /** @@ -4157,8 +4108,7 @@ class Societe extends CommonObject require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $tmpobject = new FactureFournisseur($this->db); } - else - { + else { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $tmpobject = new Facture($this->db); } @@ -4194,8 +4144,7 @@ class Societe extends CommonObject } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' } - else - { + else { return array(); } } @@ -4255,8 +4204,7 @@ class Societe extends CommonObject if (!$result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); $result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); } - else - { + else { // Positionne le modele sur le nom du modele a utiliser if (!dol_strlen($modele)) { @@ -4264,8 +4212,7 @@ class Societe extends CommonObject { $modele = $conf->global->COMPANY_ADDON_PDF; } - else - { + else { print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); return 0; } diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 98bdeffa637..1f99e9bae8a 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -557,8 +557,7 @@ class SocieteAccount extends CommonObject $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index ad7383d81af..2660625bd1c 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -428,8 +428,7 @@ if ($sql_select) { print $documentstaticline->getLibStatut(2); } - else - { + else { print $documentstatic->getLibStatut(2); } print ''; @@ -472,8 +471,7 @@ if ($sql_select) $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; } - else - { + else { $label = $objp->product_label; } @@ -522,14 +520,12 @@ if ($sql_select) // Add date of deposit if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; } - else - { + else { echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); } } } - else - { + else { if ($objp->fk_product > 0) { echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index d082ae6baa5..9f3751fd5b2 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -167,8 +167,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { accessforbidden('', 0, 0); } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index 0000494a3fe..c62ec602ecd 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -120,8 +120,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + print $dolgraph->show(); print ''."\n"; } -else -{ +else { if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = ""; @@ -186,8 +185,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA { $dataseries[] = array($obj->label, round($obj->nb)); } - else - { + else { $rest += $obj->nb; } $total += $obj->nb; @@ -207,8 +205,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->draw('idgraphcateg'); print $dolgraph->show(); } - else - { + else { while ($i < $num) { $obj = $db->fetch_object($result); @@ -335,8 +332,7 @@ if ($result) print "\n"; } } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index 1df7c38d6c5..cb94da91e2f 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -1050,8 +1050,7 @@ while ($i < min($num, $limit)) { print $obj->name; } - else - { + else { print $companystatic->getNomUrl(1, '', 100, 0, 1); } print "\n"; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 2e3e3ec4532..48a31085eb4 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -123,8 +123,7 @@ if ($object->id > 0) dol_fiche_end(); } -else -{ +else { $langs->load("errors"); print $langs->trans("ErrorRecordNotFound"); } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 191f9c4bb2c..0650261cefc 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -105,8 +105,7 @@ if (empty($reshook)) dol_print_error($db); } } - else - { + else { dol_print_error($db); } @@ -114,8 +113,7 @@ if (empty($reshook)) { $db->commit(); } - else - { + else { $db->rollback(); } } @@ -264,8 +262,7 @@ if ($result > 0) print ''; print ''; } - else - { + else { print ''; print $langs->trans("YouMustCreateContactFirst"); print ''; @@ -294,8 +291,7 @@ if ($result > 0) { $num = $db->num_rows($resql); } - else - { + else { dol_print_error($db); } @@ -334,8 +330,7 @@ if ($result > 0) { print ' <'.$obj->email.'>'; } - else - { + else { $langs->load("errors"); print '   '.img_warning().' '.$langs->trans("ErrorBadEMail", $obj->email); } @@ -444,8 +439,7 @@ if ($result > 0) { $num = $db->num_rows($resql); } - else - { + else { dol_print_error($db); } @@ -494,8 +488,7 @@ if ($result > 0) print $contactstatic->getNomUrl(1); print $obj->email ? ' <'.$obj->email.'>' : $langs->trans("NoMail"); } - else - { + else { print $obj->email; } print ''; diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 6385346ce5d..2d5e0612959 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -176,8 +176,7 @@ if (empty($reshook)) { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } - else - { + else { // If this account is the default bank account, we disable others if ($companybankaccount->default_rib) { @@ -231,8 +230,7 @@ if (empty($reshook)) { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } - else - { + else { // If this account is the default bank account, we disable others if ($companypaymentmode->default_rib) { @@ -339,8 +337,7 @@ if (empty($reshook)) header('Location: '.$url); exit; } - else - { + else { $db->rollback(); } } @@ -408,8 +405,7 @@ if (empty($reshook)) header('Location: '.$url); exit; } - else - { + else { $db->rollback(); } } @@ -425,8 +421,7 @@ if (empty($reshook)) header('Location: '.$url); exit; } - else - { + else { setEventMessages($db->lasterror, null, 'errors'); } } @@ -452,13 +447,11 @@ if (empty($reshook)) header('Location: '.$url); exit; } - else - { + else { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } } - else - { + else { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } } @@ -474,13 +467,11 @@ if (empty($reshook)) header('Location: '.$url); exit; } - else - { + else { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } } - else - { + else { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } } @@ -516,8 +507,7 @@ if (empty($reshook)) $error++; setEventMessages('ThisThirdpartyIsNotACustomer', null, 'errors'); } - else - { + else { // Creation of Stripe customer + update of societe_account $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus, 1); if (!$cu) @@ -525,8 +515,7 @@ if (empty($reshook)) $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); } - else - { + else { $stripecu = $cu->id; } } @@ -541,8 +530,7 @@ if (empty($reshook)) $error++; setEventMessages('ThisPaymentModeIsNotACard', null, 'errors'); } - else - { + else { // Get the Stripe customer $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); if (!$cu) @@ -613,8 +601,7 @@ if (empty($reshook)) $stripecu = $newcu; $db->commit(); } - else - { + else { $db->rollback(); } } @@ -670,8 +657,7 @@ if (empty($reshook)) $stripesupplieracc = $newsup; $db->commit(); } - else - { + else { $db->rollback(); } } @@ -699,8 +685,7 @@ if (empty($reshook)) { $cu->invoice_settings->default_payment_method = (string) $source; // New } - else - { + else { $cu->default_source = (string) $source; // Old } $result = $cu->save(); @@ -726,8 +711,7 @@ if (empty($reshook)) $payment_method->detach(); } } - else - { + else { $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); $card = $cu->sources->retrieve("$source"); if ($card) { @@ -783,8 +767,7 @@ if (!$id) $companybankaccount->fetch(0, $object->id); $companypaymentmode->fetch(0, null, $object->id, 'card'); } -else -{ +else { $companybankaccount->fetch($id); $companypaymentmode->fetch($id); } @@ -976,8 +959,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' { $listofsources = $customerstripe->sources->data; } - else - { + else { $service = 'StripeTest'; $servicestatus = 0; if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 6d69e692a96..2f0595cf15d 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -467,8 +467,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { } print ""; } - else - { + else { print $langs->trans('None'); } @@ -476,8 +475,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; print "\n
\n"; } - else - { + else { // View mode /* ************************************************************************** */ @@ -591,8 +589,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n"; } } - else - { + else { $colspan = 9; if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan += 1; print ''.$langs->trans('None').''; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index 5ff86ff0064..e25b5c5e606 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -79,15 +79,13 @@ if ($action == 'addcontact' && $user->rights->societe->creer) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - else - { + else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; } - else - { + else { $mesg = '
'.$object->error.'
'; } } @@ -100,8 +98,7 @@ elseif ($action == 'swapstatut' && $user->rights->societe->creer) { $result = $object->swapContactStatus(GETPOST('ligne')); } - else - { + else { dol_print_error($db); } } @@ -328,16 +325,14 @@ if ($id > 0 || !empty($ref)) } print ''; } - else - { + else { print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); } - else - { + else { print ' '; } print ''; @@ -351,8 +346,7 @@ if ($id > 0 || !empty($ref)) } } } - else - { + else { // Contrat non trouve print "ErrorRecordNotFound"; } From ae06b35c63a5adde998074a5f93958c23942155b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 02:06:40 +0200 Subject: [PATCH 09/28] add new rule --- htdocs/categories/admin/categorie.php | 12 +-- htdocs/categories/card.php | 6 +- .../categories/class/api_categories.class.php | 3 +- htdocs/categories/class/categorie.class.php | 99 +++++++------------ htdocs/categories/edit.php | 9 +- htdocs/categories/index.php | 5 +- htdocs/categories/photos.php | 9 +- htdocs/categories/viewcat.php | 69 +++++-------- htdocs/collab/index.php | 9 +- htdocs/don/admin/donation.php | 33 +++---- htdocs/don/card.php | 24 ++--- htdocs/don/class/api_donations.class.php | 3 +- htdocs/don/class/don.class.php | 54 ++++------ htdocs/don/class/paymentdonation.class.php | 27 ++--- htdocs/don/document.php | 3 +- htdocs/don/list.php | 3 +- htdocs/don/payment/card.php | 12 +-- htdocs/don/payment/payment.php | 6 +- htdocs/don/stats/index.php | 3 +- 19 files changed, 130 insertions(+), 259 deletions(-) diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index 6dd313692db..017de5cd1e6 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -48,8 +48,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -62,8 +61,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -108,14 +106,12 @@ if ($conf->use_javascript_ajax) { print ajax_constantonoff('CATEGORIE_RECURSIV_ADD'); } -else -{ +else { if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; } - else - { + else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index 67adacb5aae..a91a3df7827 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -119,8 +119,7 @@ if ($action == 'add' && $user->rights->categorie->creer) header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type); exit; } - else - { + else { header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); exit; } @@ -156,8 +155,7 @@ if ($action == 'add' && $user->rights->categorie->creer) $action = 'confirmed'; $_POST["addcat"] = ''; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index d6eff682908..205e38f3e5e 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -244,8 +244,7 @@ class Categories extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->category->error); } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index dc451855c0a..d8f5ef4eeeb 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -321,8 +321,7 @@ class Categorie extends CommonObject { $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; } - else - { + else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; if (!is_null($type)) $sql .= " AND type = ".$this->db->escape($type); } @@ -362,13 +361,11 @@ class Categorie extends CommonObject return 1; } - else - { + else { return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -483,20 +480,17 @@ class Categorie extends CommonObject $this->db->commit(); return $id; } - else - { + else { $this->db->rollback(); return -3; } } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -574,8 +568,7 @@ class Categorie extends CommonObject return 1; } - else - { + else { $this->db->rollback(); dol_print_error($this->db); return -1; @@ -661,8 +654,7 @@ class Categorie extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -722,8 +714,7 @@ class Categorie extends CommonObject } } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } @@ -748,22 +739,19 @@ class Categorie extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $this->db->lasterrno(); return -3; } - else - { + else { $this->error = $this->db->lasterror(); } return -1; @@ -815,14 +803,12 @@ class Categorie extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -2; } } - else - { + else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -874,8 +860,7 @@ class Categorie extends CommonObject { $objs[] = $rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]; } - else - { + else { $obj = new $this->MAP_OBJ_CLASS[$type]($this->db); $obj->fetch($rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]); $objs[] = $obj; @@ -883,8 +868,7 @@ class Categorie extends CommonObject } return $objs; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -1046,8 +1030,7 @@ class Categorie extends CommonObject } return $cats; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1080,8 +1063,7 @@ class Categorie extends CommonObject } return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1124,8 +1106,7 @@ class Categorie extends CommonObject { $markafterid = array($markafterid); } - else - { + else { $markafterid = array(); } } @@ -1166,8 +1147,7 @@ class Categorie extends CommonObject $i++; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -1312,8 +1292,7 @@ class Categorie extends CommonObject } return $cats; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1376,8 +1355,7 @@ class Categorie extends CommonObject dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG); return 0; } - else - { + else { $this->error = $this->db->error(); return -1; } @@ -1430,8 +1408,7 @@ class Categorie extends CommonObject $linkend = ''; $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; } - else - { + else { $w[] = "".($addpicto ? img_object('', 'category') : '').$cat->label.""; } } @@ -1473,8 +1450,7 @@ class Categorie extends CommonObject } return $parents; } - else - { + else { dol_print_error($this->db); return -1; } @@ -1554,14 +1530,12 @@ class Categorie extends CommonObject } } } - else - { + else { dol_print_error($this->db); return -1; } } - else - { + else { $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type])." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id." AND c.type = ".$this->MAP_ID[$type]; @@ -1583,8 +1557,7 @@ class Categorie extends CommonObject } } } - else - { + else { dol_print_error($this->db); return -1; } @@ -1632,8 +1605,7 @@ class Categorie extends CommonObject $nom = '%'.str_replace('*', '%', $nom).'%'; if (!$case) $sql .= " AND label LIKE '".$this->db->escape($nom)."'"; - else - $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'"; + else $sql .= " AND label LIKE BINARY '".$this->db->escape($nom)."'"; } if ($id) { @@ -1652,8 +1624,7 @@ class Categorie extends CommonObject return $cats; } - else - { + else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -1879,8 +1850,7 @@ class Categorie extends CommonObject $sql2 .= " description='".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->label); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1901,8 +1871,7 @@ class Categorie extends CommonObject $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; } - else - { + else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->multilangs["$key"]["label"]); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1961,8 +1930,7 @@ class Categorie extends CommonObject } return 1; } - else - { + else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; return -1; } @@ -2067,8 +2035,7 @@ class Categorie extends CommonObject { return " AND (".implode(' AND ', $searchCategorySqlList).")"; } - else - { + else { return ""; } } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index 48bd82b9326..dfd8f01f381 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -90,8 +90,7 @@ if ($action == 'update' && $user->rights->categorie->creer) if ($parent != "-1") $object->fk_parent = $parent; - else - $object->fk_parent = ""; + else $object->fk_parent = ""; if (empty($object->label)) @@ -110,13 +109,11 @@ if ($action == 'update' && $user->rights->categorie->creer) header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index b36101750f2..d88e1a0ff8c 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -54,7 +54,7 @@ $typetext = $type; if ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans('AccountsCategoriesArea'); elseif ($type == Categorie::TYPE_WAREHOUSE) $title = $langs->trans('StocksCategoriesArea'); elseif ($type == Categorie::TYPE_ACTIONCOMM) $title = $langs->trans('ActionCommCategoriesArea'); -else $title = $langs->trans(ucfirst($type).'sCategoriesArea'); +else $title = $langs->trans(ucfirst($type).'sCategoriesArea'); $arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); @@ -207,8 +207,7 @@ if ($nbofentries > 0) tree_recur($data, $data[0], 0); print ''; } -else -{ +else { print ''; print ''; print ''; print ''; } -else -{ +else { $categstatic = new Categorie($db); $fulltree = $categstatic->get_full_arbo($type, $object->id, 1); @@ -408,8 +404,7 @@ else print ''; print ''; } - else - { + else { print ''; print '\n"; } } - else - { + else { print ''; } print "
'.img_picto_common('', 'treemenu/branchbottom.gif').''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 07e5d56d268..7443bc5b532 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -180,8 +180,7 @@ if ($object->id) print ''; print $langs->trans("AddPhoto").''; } - else - { + else { print ''; print $langs->trans("AddPhoto").''; } @@ -232,8 +231,7 @@ if ($object->id) { $filename = $obj['photo_vignette']; } - else - { + else { $filename = $obj['photo']; } @@ -281,8 +279,7 @@ if ($object->id) } } } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 803b4ae34ab..921a1f12061 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -162,8 +162,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -181,14 +180,12 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' { setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); } - else - { + else { if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -337,8 +334,7 @@ elseif (count($cats) < 1) print ''.$langs->trans("NoSubCat").'
'; print ''; @@ -451,8 +446,7 @@ if ($type == Categorie::TYPE_PRODUCT) { dol_print_error($db, $prods->error, $prods->errors); } - else - { + else { // Form to add record into a category $showclassifyform = 1; if ($showclassifyform) @@ -515,8 +509,7 @@ if ($type == Categorie::TYPE_PRODUCT) print "\n"; } } - else - { + else { print ''; } print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -534,8 +527,7 @@ if ($type == Categorie::TYPE_SUPPLIER) { dol_print_error($db, $socs->error, $socs->errors); } - else - { + else { print '
'; print ''; print ''; @@ -576,8 +568,7 @@ if ($type == Categorie::TYPE_SUPPLIER) print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -595,8 +586,7 @@ if ($type == Categorie::TYPE_CUSTOMER) { dol_print_error($db, $socs->error, $socs->errors); } - else - { + else { print ''; print ''; print ''; @@ -636,8 +626,7 @@ if ($type == Categorie::TYPE_CUSTOMER) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -658,8 +647,7 @@ if ($type == Categorie::TYPE_MEMBER) { dol_print_error($db, $prods->error, $prods->errors); } - else - { + else { print ''; print ''; print ''; @@ -701,8 +689,7 @@ if ($type == Categorie::TYPE_MEMBER) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -721,8 +708,7 @@ if ($type == Categorie::TYPE_CONTACT) { dol_print_error($db, $contacts->error, $contacts->errors); } - else - { + else { print ''; print ''; print ''; @@ -765,8 +751,7 @@ if ($type == Categorie::TYPE_CONTACT) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -787,8 +772,7 @@ if ($type == Categorie::TYPE_ACCOUNT) { dol_print_error($db, $accounts->error, $accounts->errors); } - else - { + else { print ''; print ''; print ''; @@ -829,8 +813,7 @@ if ($type == Categorie::TYPE_ACCOUNT) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -851,8 +834,7 @@ if ($type == Categorie::TYPE_PROJECT) { dol_print_error($db, $object->error, $object->errors); } - else - { + else { print ''; print ''; print ''; @@ -894,8 +876,7 @@ if ($type == Categorie::TYPE_PROJECT) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -914,8 +895,7 @@ if ($type == Categorie::TYPE_USER) { dol_print_error($db, $object->error, $object->errors); } - else - { + else { print ''; print ''; print ''; @@ -954,8 +934,7 @@ if ($type == Categorie::TYPE_USER) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -977,8 +956,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) { dol_print_error($db, $object->error, $object->errors); } - else - { + else { print ''; print ''; print ''; @@ -1020,8 +998,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) print "\n"; } } - else - { + else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index c570e12ba31..f6344f4ebf0 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -95,8 +95,7 @@ if ($action == 'add') setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs'); $action = ''; } - else - { + else { $db->rollback(); } @@ -130,13 +129,11 @@ if ($action == 'delete') header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website); exit; } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); } } diff --git a/htdocs/don/admin/donation.php b/htdocs/don/admin/donation.php index e8e7fa4f5b9..514d79dcd77 100644 --- a/htdocs/don/admin/donation.php +++ b/htdocs/don/admin/donation.php @@ -71,14 +71,12 @@ if ($action == 'specimen') header("Location: ".DOL_URL_ROOT."/document.php?modulepart=donation&file=SPECIMEN.html"); return; } - else - { + else { setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } } - else - { + else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -130,8 +128,7 @@ if ($action == 'set_DONATION_ACCOUNTINGACCOUNT') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -148,8 +145,7 @@ if ($action == 'set_DONATION_MESSAGE') { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); } - else - { + else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -165,8 +161,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -179,8 +174,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) header("Location: ".$_SERVER["PHP_SELF"]); exit; } - else - { + else { dol_print_error($db); } } @@ -223,8 +217,7 @@ if ($resql) $i++; } } -else -{ +else { dol_print_error($db); } @@ -276,15 +269,13 @@ if (is_resource($handle)) print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; } - else - { + else { print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"), 'switch_on').''; print ''; } } - else - { + else { print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; @@ -297,8 +288,7 @@ if (is_resource($handle)) print img_picto($langs->trans("Default"), 'on'); print ''; } - else - { + else { print ""; print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; print ''; @@ -371,8 +361,7 @@ if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($conf->global->DONATION_ACCOUNTINGACCOUNT, 'DONATION_ACCOUNTINGACCOUNT', 1, '', 1, 1); } -else -{ +else { print ''; } print ''; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 505d2fbed29..7af11d46ebf 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -181,8 +181,7 @@ if ($action == 'add') header("Location: ".$_SERVER['PHP_SELF'].'?id='.$res); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -196,8 +195,7 @@ if ($action == 'confirm_delete' && GETPOST("confirm") == "yes" && $user->rights- header("Location: index.php"); exit; } - else - { + else { dol_syslog($object->error, LOG_DEBUG); setEventMessages($object->error, $object->errors, 'errors'); } @@ -355,8 +353,7 @@ if ($action == 'create') print ')'; print ''; } - else - { + else { print ''; print $form->select_company($soc->id, 'socid', '(s.client = 1 OR s.client = 3) AND status=1', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); // Option to reload page to retrieve customer informations. Note, this clear other input @@ -520,8 +517,7 @@ if (!empty($id) && $action == 'edit') { print "".''.$langs->trans("Amount").' '.$langs->trans("Currency".$conf->currency).''; } - else - { + else { print ''.$langs->trans("Amount").''; print price($object->amount, 0, $langs, 0, 0, -1, $conf->currency); print ''; @@ -777,8 +773,7 @@ if (!empty($id) && $action != 'edit') print ""; $db->free($resql); } - else - { + else { dol_print_error($db); } @@ -815,8 +810,7 @@ if (!empty($id) && $action != 'edit') { print '
'.$langs->trans('DoPayment').'
'; } - else - { + else { print ''; } } @@ -834,13 +828,11 @@ if (!empty($id) && $action != 'edit') { print '"; } - else - { + else { print '"; } } - else - { + else { print '"; } diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php index 872e2009b9b..69bd1e58042 100644 --- a/htdocs/don/class/api_donations.class.php +++ b/htdocs/don/class/api_donations.class.php @@ -231,8 +231,7 @@ class Donations extends DolibarrApi { return $this->get($id); } - else - { + else { throw new RestException(500, $this->don->error); } } diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 59c293e6386..f80feff1869 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -315,8 +315,7 @@ class Don extends CommonObject $error_string[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Amount')); $err++; } - else - { + else { if ($this->amount < $minimum && $minimum > 0) { $error_string[] = $langs->trans('MinimumAmount', $langs->transnoentitiesnoconv('$minimum')); @@ -330,8 +329,7 @@ class Don extends CommonObject $this->errors = $error_string; return 0; } - else - { + else { return 1; } } @@ -423,8 +421,7 @@ class Don extends CommonObject // End call triggers } } - else - { + else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); $error++; @@ -453,8 +450,7 @@ class Don extends CommonObject $this->db->commit(); return $ret; } - else - { + else { $this->db->rollback(); return -1; } @@ -534,14 +530,12 @@ class Don extends CommonObject $this->db->commit(); $result = 1; } - else - { + else { $this->db->rollback(); $result = -1; } } - else - { + else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; $this->db->rollback(); @@ -613,8 +607,7 @@ class Don extends CommonObject $this->db->commit(); return 1; } - else - { + else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -709,8 +702,7 @@ class Don extends CommonObject } return 1; } - else - { + else { dol_print_error($this->db); return -1; } @@ -762,8 +754,7 @@ class Don extends CommonObject } } } - else - { + else { $error++; $this->error = $this->db->lasterror(); } @@ -773,8 +764,7 @@ class Don extends CommonObject $this->db->commit(); return 1; } - else - { + else { $this->db->rollback(); return -1; } @@ -805,13 +795,11 @@ class Don extends CommonObject { return 1; } - else - { + else { return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -836,13 +824,11 @@ class Don extends CommonObject { return 1; } - else - { + else { return 0; } } - else - { + else { dol_print_error($this->db); return -1; } @@ -905,8 +891,7 @@ class Don extends CommonObject $this->db->free($resql); return 1; } - else - { + else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -991,8 +976,7 @@ class Don extends CommonObject } $this->db->free($result); } - else - { + else { dol_print_error($this->db); } } @@ -1089,16 +1073,14 @@ class Don extends CommonObject dol_delete_preview($object); return 1; } - else - { + else { $outputlangs->charset_output = $sav_charset_output; dol_syslog("Erreur dans don_create"); dol_print_error($this->db, $obj->error); return 0; } } - else - { + else { print $langs->trans("Error")." ".$langs->trans("ErrorFileDoesNotExists", $file); return 0; } diff --git a/htdocs/don/class/paymentdonation.class.php b/htdocs/don/class/paymentdonation.class.php index 64644d18971..416884c3a24 100644 --- a/htdocs/don/class/paymentdonation.class.php +++ b/htdocs/don/class/paymentdonation.class.php @@ -168,8 +168,7 @@ class PaymentDonation extends CommonObject $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_donation"); $this->ref = $this->id; } - else - { + else { $error++; } } @@ -189,8 +188,7 @@ class PaymentDonation extends CommonObject $this->db->commit(); return $this->id; } - else - { + else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -259,8 +257,7 @@ class PaymentDonation extends CommonObject return 1; } - else - { + else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -342,8 +339,7 @@ class PaymentDonation extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -412,8 +408,7 @@ class PaymentDonation extends CommonObject $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } @@ -467,8 +462,7 @@ class PaymentDonation extends CommonObject $this->db->commit(); return $object->id; } - else - { + else { $this->db->rollback(); return -1; } @@ -593,8 +587,7 @@ class PaymentDonation extends CommonObject } } } - else - { + else { $this->error = $acc->error; $error++; } @@ -604,8 +597,7 @@ class PaymentDonation extends CommonObject { return 1; } - else - { + else { return -1; } } @@ -629,8 +621,7 @@ class PaymentDonation extends CommonObject { return 1; } - else - { + else { $this->error = $this->db->error(); return 0; } diff --git a/htdocs/don/document.php b/htdocs/don/document.php index f2994b95577..98884af9c6f 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -187,8 +187,7 @@ if ($object->id) $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } -else -{ +else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 65ec24b1458..8c5ad9a36e0 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -284,8 +284,7 @@ if ($resql) print "\n"; $db->free($resql); } -else -{ +else { dol_print_error($db); } diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index e1784dc4b8b..57d5fe160a0 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -64,8 +64,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->don->supp header("Location: ".DOL_URL_ROOT."/don/index.php"); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -102,8 +101,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->don->cree header('Location: card.php?id='.$object->id); exit; } - else - { + else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -254,8 +252,7 @@ if ($resql) print "\n"; $db->free($resql); } -else -{ +else { dol_print_error($db); } @@ -290,8 +287,7 @@ if (empty($action)) { print ''.$langs->trans('Delete').''; } - else - { + else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/don/payment/payment.php b/htdocs/don/payment/payment.php index b3ab7e2d360..162193dc51d 100644 --- a/htdocs/don/payment/payment.php +++ b/htdocs/don/payment/payment.php @@ -138,8 +138,7 @@ if ($action == 'add_payment') header('Location: '.$loc); exit; } - else - { + else { $db->rollback(); } } @@ -261,8 +260,7 @@ if ($action == 'create') $namef = "amount_".$objp->id; print ''; } - else - { + else { print '-'; } print ""; diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index 46b0d93d564..247656dc2ad 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -76,8 +76,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/shipmentsnbinyear-'.$user->id.'-'.$year.'.png'; } -else -{ +else { $filenamenb = $dir.'/shipmentsnbinyear-'.$year.'.png'; } From a636f81eacac399e03d99be64dd359718736d291 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 02:17:21 +0200 Subject: [PATCH 10/28] add new rule --- dev/examples/code/create_invoice.php | 9 +- dev/examples/code/create_order.php | 9 +- dev/examples/code/create_product.php | 6 +- dev/examples/code/create_user.php | 9 +- dev/initdata/dbf/importdb-products.php | 3 +- dev/initdata/dbf/importdb-thirdparties.php | 9 +- dev/initdata/dbf/includes/dbase.class.php | 9 +- dev/initdata/generate-invoice.php | 6 +- dev/initdata/generate-order.php | 6 +- dev/initdata/generate-proposal.php | 6 +- dev/initdata/generate-thirdparty.php | 3 +- dev/initdata/import-products.php | 12 +- dev/initdata/import-thirdparties.php | 15 +- dev/initdata/import-users.php | 6 +- dev/initdata/purge-data.php | 11 +- htdocs/exports/class/export.class.php | 56 +-- htdocs/exports/export.php | 45 +- htdocs/install/check.php | 63 +-- htdocs/install/inc.php | 12 +- htdocs/install/repair.php | 99 ++--- htdocs/install/step1.php | 44 +- htdocs/install/step2.php | 51 +-- htdocs/install/step5.php | 36 +- htdocs/install/upgrade.php | 15 +- htdocs/install/upgrade2.php | 451 +++++++-------------- 25 files changed, 333 insertions(+), 658 deletions(-) diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index 1b212e0a5d7..0b2c4e54697 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -87,14 +87,12 @@ if ($idobject > 0) // Change status to validated $result=$obj->validate($user); if ($result > 0) print "OK Object created with id ".$idobject."\n"; - else - { + else { $error++; dol_print_error($db, $obj->error); } } -else -{ +else { $error++; dol_print_error($db, $obj->error); } @@ -107,8 +105,7 @@ if (! $error) $db->commit(); print '--- end ok'."\n"; } -else -{ +else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index 703254ad5e9..d46913f3fcf 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -85,14 +85,12 @@ if ($idobject > 0) // Change status to validated $result=$com->valid($user); if ($result > 0) print "OK Object created with id ".$idobject."\n"; - else - { + else { $error++; dol_print_error($db, $com->error); } } -else -{ +else { $error++; dol_print_error($db, $com->error); } @@ -105,8 +103,7 @@ if (! $error) $db->commit(); print '--- end ok'."\n"; } -else -{ +else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php index 234658388df..fb09c5f6e43 100755 --- a/dev/examples/code/create_product.php +++ b/dev/examples/code/create_product.php @@ -83,8 +83,7 @@ if ($idobject > 0) { print "OK Object created with id ".$idobject."\n"; } -else -{ +else { $error++; dol_print_error($db, $myproduct->error); } @@ -96,8 +95,7 @@ if (! $error) $db->commit(); print '--- end ok'."\n"; } -else -{ +else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index 96d369085d2..79fe30b73bf 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -74,8 +74,7 @@ if ($idobject > 0) // Change status to validated $result=$obj->setStatut(1); if ($result > 0) print "OK Object created with id ".$idobject."\n"; - else - { + else { $error++; dol_print_error($db, $obj->error); } @@ -84,8 +83,7 @@ elseif ($obj->error == 'ErrorLoginAlreadyExists') { print "User with login ".$obj->login." already exists\n"; } -else -{ +else { $error++; dol_print_error($db, $obj->error); } @@ -98,8 +96,7 @@ if (! $error) $db->commit(); print '--- end ok'."\n"; } -else -{ +else { print '--- end error code='.$error."\n"; $db->rollback(); } diff --git a/dev/initdata/dbf/importdb-products.php b/dev/initdata/dbf/importdb-products.php index 845064f0688..2c06c07e103 100644 --- a/dev/initdata/dbf/importdb-products.php +++ b/dev/initdata/dbf/importdb-products.php @@ -227,8 +227,7 @@ while ($fields = $db->fetch_array($resql)) { $error++; // $errorrecord will be reset } $j++; -} else - die("error : $sql"); +} else die("error : $sql"); diff --git a/dev/initdata/dbf/importdb-thirdparties.php b/dev/initdata/dbf/importdb-thirdparties.php index 8f0eb0635f0..a6b2697eed8 100644 --- a/dev/initdata/dbf/importdb-thirdparties.php +++ b/dev/initdata/dbf/importdb-thirdparties.php @@ -179,8 +179,7 @@ while ($fields = $db->fetch_array($resql)) { $object->town = trim($fields['FVILLE']); if ($fields['FPAYS']) $object->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['FPAYS']))), 'c_country', 'label', 'rowid'); - else - $object->country_id = 1; + else $object->country_id = 1; $object->phone = trim($fields['FTEL']) ? trim($fields['FTEL']) : trim($fields['FCONTACT']); $object->phone = substr($object->phone, 0, 20); $object->fax = trim($fields['FFAX']) ? trim($fields['FFAX']) : trim($fields['FCONTACT']); @@ -299,8 +298,7 @@ while ($fields = $db->fetch_array($resql)) { $contact->town = trim($fields['LVILLE']); if ($fields['FPAYS']) $contact->country_id = dol_getIdFromCode($db, trim(ucwords(strtolower($fields['LPAYS']))), 'c_country', 'label', 'rowid'); - else - $contact->country_id = 1; + else $contact->country_id = 1; $contact->email = $fields['LMAIL']; $contact->phone = trim($fields['LTEL']) ? trim($fields['LTEL']) : trim($fields['LCONTACT']); $contact->fax = trim($fields['LFAX']) ? trim($fields['LFAX']) : trim($fields['LCONTACT']); @@ -340,8 +338,7 @@ while ($fields = $db->fetch_array($resql)) { $error++; // $errorrecord will be reset } $j++; -} else - die("error : $sql"); +} else die("error : $sql"); $db->commit(); diff --git a/dev/initdata/dbf/includes/dbase.class.php b/dev/initdata/dbf/includes/dbase.class.php index 0c2f6820a96..e70f18087c4 100644 --- a/dev/initdata/dbf/includes/dbase.class.php +++ b/dev/initdata/dbf/includes/dbase.class.php @@ -207,8 +207,7 @@ class DBase $value = true; elseif ($value == 'f' || $value == 'n') $value = false; - else - $value = null; + else $value = null; } $record[$i] = $value; } @@ -295,8 +294,7 @@ class DBase $i = unpack("S$n", $data); if ($n == 1) return (int) $i[1]; - else - return array_merge($i); + else return array_merge($i); } private static function putInt16($fd, $value) @@ -310,8 +308,7 @@ class DBase $i = unpack("L$n", $data); if ($n == 1) return (int) $i[1]; - else - return array_merge($i); + else return array_merge($i); } private static function putInt32($fd, $value) diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index 3fe058e8d3e..d4522ef047e 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -180,13 +180,11 @@ while ($i < GEN_NUMBER_FACTURE && $result >= 0) { print " OK with ref ".$object->ref."\n";; } - else - { + else { dol_print_error($db, $object->error); } } - else - { + else { dol_print_error($db, $object->error); } } diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index 1dc56aa5582..f63d50a1967 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -207,15 +207,13 @@ for ($s = 0 ; $s < GEN_NUMBER_COMMANDE ; $s++) $db->commit(); print " OK with ref ".$object->ref."\n"; } - else - { + else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); } } - else - { + else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 4c5d70aadc4..60ba418b43b 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -211,15 +211,13 @@ while ($i < GEN_NUMBER_PROPAL && $result >= 0) $db->commit(); print " OK with ref ".$object->ref."\n"; } - else - { + else { print " KO\n"; $db->rollback(); dol_print_error($db, $object->error); } } - else - { + else { dol_print_error($db, $object->error); } } diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index 05ac6416aa3..f7bde473038 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -137,8 +137,7 @@ for ($s = 0 ; $s < GEN_NUMBER_SOCIETE ; $s++) print "Company ".$s." created nom=".$soc->name."\n"; } - else - { + else { print "Error: ".$soc->error."\n"; } } diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index 4288c5bf3b1..78f3a0789f8 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -164,8 +164,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create result code = ".$ret." - ".$produit->errorsToString(); $errorrecord++; } - else - { + else { print " - Creation OK with ref ".$produit->ref." - id = ".$ret; } @@ -181,8 +180,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in updatePrice result code = ".$ret1." ".$ret2." - ".$produit->errorsToString(); $errorrecord++; } - else - { + else { print " - updatePrice OK"; } } @@ -201,8 +199,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in setMultiLangs result code = ".$ret." - ".$produit->errorsToString(); $errorrecord++; } - else - { + else { print " - setMultiLangs OK"; } } @@ -228,8 +225,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) print "Rollback any changes.\n"; $db->rollback(); } -else -{ +else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index ef1dfcc99ab..87fef83de0f 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -182,8 +182,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create result code = ".$ret." - ".$object->errorsToString(); $errorrecord++; } - else - { + else { print " - Creation OK with name ".$object->name." - id = ".$ret; } } @@ -213,8 +212,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create link with sale representative result code = ".$result." - ".$object->errorsToString(); $errorrecord++; } - else - { + else { print " - create link sale representative OK"; } } @@ -244,8 +242,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); $errorrecord++; } - else - { + else { print " - create contact OK"; } } @@ -278,8 +275,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create contact result code = ".$ret1." ".$ret2." - ".$object->errorsToString(); $errorrecord++; } - else - { + else { print " - create contact OK"; } } @@ -306,8 +302,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) print "Rollback any changes.\n"; $db->rollback(); } -else -{ +else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 4247415288c..25fa6a69e2d 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -143,8 +143,7 @@ while ($fields=fgetcsv($fhandle, $linelength, $delimiter, $enclosure, $escape)) print " - Error in create result code = ".$ret." - ".$object->errorsToString(); $errorrecord++; } - else - { + else { print " - Creation OK with login ".$object->login." - id = ".$ret; } @@ -169,8 +168,7 @@ if ($mode != 'confirmforced' && ($error || $mode != 'confirm')) print "Rollback any changes.\n"; $db->rollback(); } -else -{ +else { print "Commit all changes.\n"; $db->commit(); } diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index b1aadd56ed8..f9d8420b1e1 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -198,7 +198,7 @@ if (empty($option)) if ($option != 'all') { $listofoptions=explode(',', $option); - foreach($listofoptions as $cursoroption) + foreach ($listofoptions as $cursoroption) { if (! in_array($cursoroption, array_keys($sqls))) { print "Usage: $script_file (test|confirm) (all|option) (all|YYYY-MM-DD) [dbtype dbhost dbuser dbpassword dbname dbport]\n"; @@ -264,7 +264,7 @@ function processfamily($family, $date) global $db, $sqls; $error=0; - foreach($sqls[$family] as $sql) + foreach ($sqls[$family] as $sql) { if (preg_match('/^@/', $sql)) { @@ -302,10 +302,10 @@ function processfamily($family, $date) $db->begin(); $listofoptions=explode(',', $option); -foreach($listofoptions as $cursoroption) +foreach ($listofoptions as $cursoroption) { $oldfamily=''; - foreach($sqls as $family => $familysql) + foreach ($sqls as $family => $familysql) { if ($cursoroption && $cursoroption != 'all' && $cursoroption != $family) continue; @@ -326,8 +326,7 @@ if ($error || $mode != 'confirm') print "\nRollback any changes.\n"; $db->rollback(); } -else -{ +else { print "Commit all changes.\n"; $db->commit(); } diff --git a/htdocs/exports/class/export.class.php b/htdocs/exports/class/export.class.php index 978a3059ace..a6873f2894a 100644 --- a/htdocs/exports/class/export.class.php +++ b/htdocs/exports/class/export.class.php @@ -142,8 +142,7 @@ class Export { $bool = $user->rights->{$perm[0]}->{$perm[1]}->{$perm[2]}; } - else - { + else { $bool = $user->rights->{$perm[0]}->{$perm[1]}; } if ($perm[0] == 'user' && $user->admin) $bool = true; @@ -295,8 +294,7 @@ class Export case 'Text': if (!(strpos($ValueField, '%') === false)) $szFilterQuery .= " ".$NameField." LIKE '".$ValueField."'"; - else - $szFilterQuery .= " ".$NameField." = '".$ValueField."'"; + else $szFilterQuery .= " ".$NameField." = '".$ValueField."'"; break; case 'Date': if (strpos($ValueField, "+") > 0) @@ -306,12 +304,10 @@ class Export $szFilterQuery = "(".$this->conditionDate($NameField, trim($ValueArray[0]), ">="); $szFilterQuery .= " AND ".$this->conditionDate($NameField, trim($ValueArray[1]), "<=").")"; } - else - { + else { if (is_numeric(substr($ValueField, 0, 1))) $szFilterQuery = $this->conditionDate($NameField, trim($ValueField), "="); - else - $szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1)); + else $szFilterQuery = $this->conditionDate($NameField, trim(substr($ValueField, 1)), substr($ValueField, 0, 1)); } break; case 'Duree': @@ -325,12 +321,10 @@ class Export $szFilterQuery = "(".$NameField.">=".$ValueArray[0]; $szFilterQuery .= " AND ".$NameField."<=".$ValueArray[1].")"; } - else - { + else { if (is_numeric(substr($ValueField, 0, 1))) $szFilterQuery = " ".$NameField."=".$ValueField; - else - $szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1); + else $szFilterQuery = " ".$NameField.substr($ValueField, 0, 1).substr($ValueField, 1); } break; case 'Boolean': @@ -343,8 +337,7 @@ class Export else { if (!(strpos($ValueField, '%') === false)) $szFilterQuery = " ".$NameField." LIKE '".$ValueField."'"; - else - $szFilterQuery = " ".$NameField." = '".$ValueField."'"; + else $szFilterQuery = " ".$NameField." = '".$ValueField."'"; } break; default: @@ -367,7 +360,7 @@ class Export // TODO date_format is forbidden, not performant and not portable. Use instead BETWEEN if (strlen($Value) == 4) $Condition = " date_format(".$Field.",'%Y') ".$Sens." '".$Value."'"; elseif (strlen($Value) == 6) $Condition = " date_format(".$Field.",'%Y%m') ".$Sens." '".$Value."'"; - else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value; + else $Condition = " date_format(".$Field.",'%Y%m%d') ".$Sens." ".$Value; return $Condition; } @@ -428,8 +421,7 @@ class Export if (!empty($InfoFieldList[3])) $keyList = $InfoFieldList[3]; - else - $keyList = 'rowid'; + else $keyList = 'rowid'; $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code'); if ($InfoFieldList[1] == 'c_stcomm') $sql = 'SELECT id as id, '.$keyList.' as rowid, '.$InfoFieldList[2].' as label'.(empty($InfoFieldList[3]) ? '' : ', '.$InfoFieldList[3].' as code'); if ($InfoFieldList[1] == 'c_country') $sql = 'SELECT '.$keyList.' as rowid, '.$InfoFieldList[2].' as label, code as code'; @@ -474,8 +466,7 @@ class Export { $szFilterField .= ''; } - else - { + else { $szFilterField .= ''; } $i++; @@ -564,8 +555,7 @@ class Export $objmodel = new $classname($this->db); if (!empty($sqlquery)) $sql = $sqlquery; - else - { + else { // Define value for indice from $datatoexport $foundindice = 0; foreach ($this->array_export_code as $key => $dataset) @@ -595,8 +585,7 @@ class Export //$this->array_export_label[$indice] if ($conf->global->EXPORT_PREFIX_SPEC) $filename = $conf->global->EXPORT_PREFIX_SPEC."_".$datatoexport; - else - $filename = "export_".$datatoexport; + else $filename = "export_".$datatoexport; $filename .= '.'.$objmodel->getDriverExtension(); $dirname = $conf->export->dir_temp.'/'.$user->id; @@ -665,8 +654,7 @@ class Export } $obj->$alias = $remaintopay; } - else - { + else { // TODO FIXME Export of compute field does not work. $obj containt $obj->alias_field and formulat will contains $obj->field $computestring = $this->array_export_special[$indice][$key]; $tmp = dol_eval($computestring, 1, 0); @@ -689,15 +677,13 @@ class Export return 1; } - else - { + else { $this->error = $objmodel->error; dol_syslog("Export::build_file Error: ".$this->error, LOG_ERR); return -1; } } - else - { + else { $this->error = $this->db->error()." - sql=".$sql; return -1; } @@ -740,8 +726,7 @@ class Export $this->db->commit(); return 1; } - else - { + else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); $this->db->rollback(); @@ -777,14 +762,12 @@ class Export return 1; } - else - { + else { $this->error = "ModelNotFound"; return -2; } } - else - { + else { dol_print_error($this->db); return -3; } @@ -823,8 +806,7 @@ class Export $this->db->rollback(); return -1 * $error; } - else - { + else { $this->db->commit(); return 1; } diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 6543747d1f7..b6b0e7b7fa5 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -174,8 +174,7 @@ if ($action == 'selectfield') // Selection of field at step 2 $_SESSION["export_selected_fields"] = $array_selected; } } - else - { + else { $warnings = array(); $array_selected[$field] = count($array_selected) + 1; // We tag the key $field as "selected" @@ -223,8 +222,7 @@ if ($action == 'unselectfield') $array_selected = array(); $_SESSION["export_selected_fields"] = $array_selected; } - else - { + else { unset($array_selected[$_GET["field"]]); // Renumber fields of array_selected (from 1 to nb_elements) asort($array_selected); @@ -288,8 +286,7 @@ if ($action == 'builddoc') setEventMessages($objexport->error, $objexport->errors, 'errors'); $sqlusedforexport = $objexport->sqlusedforexport; } - else - { + else { setEventMessages($langs->trans("FileSuccessfullyBuilt"), null, 'mesgs'); $sqlusedforexport = $objexport->sqlusedforexport; } @@ -351,17 +348,14 @@ if ($action == 'add_export_model') { setEventMessages($langs->trans("ExportModelSaved", $objexport->model_name), null, 'mesgs'); } - else - { + else { $langs->load("errors"); if ($objexport->errno == 'DB_ERROR_RECORD_ALREADY_EXISTS') setEventMessages($langs->trans("ErrorExportDuplicateProfil"), null, 'errors'); - else - setEventMessages($objexport->error, $objexport->errors, 'errors'); + else setEventMessages($objexport->error, $objexport->errors, 'errors'); } } - else - { + else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ExportModelName")), null, 'errors'); } } @@ -473,15 +467,13 @@ if ($step == 1 || !$datatoexport) { print ''.img_picto($langs->trans("NewExport"), 'filenew').''; } - else - { + else { print $langs->trans("NotEnoughPermissions"); } print ''; } } - else - { + else { print ''.$langs->trans("NoExportableData").''; } print ''; @@ -615,8 +607,7 @@ if ($step == 2 && $datatoexport) { $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; } - else - { + else { $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; } if (!empty($objexport->array_export_examplevalues[0][$code])) @@ -643,8 +634,7 @@ if ($step == 2 && $datatoexport) //print ' ('.$code.')'; print ''; } - else - { + else { // Fields not selected print ''; //print $text.'-'.$htmltext."
"; @@ -673,13 +663,11 @@ if ($step == 2 && $datatoexport) { print ''.$langs->trans("NextStep").''; } - else - { + else { print ''.$langs->trans("NextStep").''; } } - else - { + else { print ''.$langs->trans("NextStep").''; } @@ -811,8 +799,7 @@ if ($step == 3 && $datatoexport) { $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; } - else - { + else { $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; } if (!empty($objexport->array_export_examplevalues[0][$code])) @@ -842,8 +829,7 @@ if ($step == 3 && $datatoexport) $tmp = $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter); print $form->textwithpicto($tmp, $szInfoFiltre); } - else - { + else { print $objexport->build_filterField($Typefieldsarray[$code], $code, $ValueFilter); } } @@ -1006,8 +992,7 @@ if ($step == 4 && $datatoexport) { $htmltext .= ''.$langs->trans("ComputedField")." -> ".$langs->trans("Method")." : ".$objexport->array_export_special[0][$code]."
"; } - else - { + else { $htmltext .= ''.$langs->trans("Table")." -> ".$langs->trans("Field").": ".$tablename." -> ".preg_replace('/^.*\./', '', $code)."
"; } if (!empty($objexport->array_export_examplevalues[0][$code])) diff --git a/htdocs/install/check.php b/htdocs/install/check.php index 408f4b2a1a8..792f72d8831 100644 --- a/htdocs/install/check.php +++ b/htdocs/install/check.php @@ -88,8 +88,7 @@ elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) // print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); $checksok = 0; // 0=error, 1=warning } -else -{ +else { print 'Ok '.$langs->trans("PHPVersion")." ".versiontostring(versionphparray()); } if (empty($force_install_nophpinfo)) print ' ('.$langs->trans("MoreInformation").')'; @@ -104,8 +103,7 @@ if (!isset($_GET["testget"]) && !isset($_POST["testpost"])) print "
\n"; $checksok = 0; } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportPOSTGETOk")."
\n"; } @@ -116,8 +114,7 @@ if (!function_exists("session_id")) print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions")."
\n"; $checksok = 0; } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportSessions")."
\n"; } @@ -129,8 +126,7 @@ if (!function_exists("imagecreate")) print 'Error '.$langs->trans("ErrorPHPDoesNotSupportGD")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportGD")."
\n"; } @@ -142,8 +138,7 @@ if (!function_exists("curl_init")) print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCurl")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportCurl")."
\n"; } @@ -152,8 +147,7 @@ if (!function_exists("easter_date")) { print 'Error '.$langs->trans("ErrorPHPDoesNotSupportCalendar")."
\n"; } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportCalendar")."
\n"; } @@ -165,8 +159,7 @@ if (!function_exists("utf8_encode")) print 'Error '.$langs->trans("ErrorPHPDoesNotSupportUTF8")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } -else -{ +else { print 'Ok '.$langs->trans("PHPSupportUTF8")."
\n"; } @@ -180,8 +173,7 @@ if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@loc print 'Error '.$langs->trans("ErrorPHPDoesNotSupportIntl")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } - else - { + else { print 'Ok '.$langs->trans("PHPSupportIntl")."
\n"; } } @@ -192,8 +184,7 @@ if (!class_exists('ZipArchive')) print 'Error '.$langs->trans("ErrorPHPDoesNotSupport", "ZIP")."
\n"; // $checksok = 0; // If ko, just warning. So check must still be 1 (otherwise no way to install) } -else -{ +else { print 'Ok '.$langs->trans("PHPSupport", "ZIP")."
\n"; } @@ -215,8 +206,7 @@ if ($memmaxorig != '') { print 'Ok '.$langs->trans("PHPMemoryOK", $memmaxorig, $memrequiredorig)."
\n"; } - else - { + else { print 'Warning '.$langs->trans("PHPMemoryTooLow", $memmaxorig, $memrequiredorig)."
\n"; } } @@ -236,13 +226,11 @@ if (is_readable($conffile) && filesize($conffile) > 8) // Already installed for all parts (config and database). We can propose upgrade. $allowupgrade = true; } - else - { + else { $allowupgrade = false; } } -else -{ +else { // If not, we create it dolibarr_install_syslog("check: we try to create conf file '".$conffile."'"); $confexists = 0; @@ -253,8 +241,7 @@ else // Success dolibarr_install_syslog("check: successfully copied file ".$conffile.".example into ".$conffile); } - else - { + else { // If failed, we try to create an empty file dolibarr_install_syslog("check: failed to copy file ".$conffile.".example into ".$conffile.". We try to create it.", LOG_WARNING); @@ -285,8 +272,7 @@ if (!file_exists($conffile)) print $langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok'); $err++; } -else -{ +else { if (dol_is_dir($conffile)) { print 'Warning '.$langs->trans("ConfFileMustBeAFileNotADir", $conffiletoshow); @@ -300,8 +286,7 @@ else { print 'Ok '.$langs->trans("ConfFileExists", $conffiletoshow); } - else - { + else { print 'Ok '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow); } print "
"; @@ -311,14 +296,12 @@ else $allowinstall = 0; } // File exists and can be modified - else - { + else { if ($confexists) { print 'Ok '.$langs->trans("ConfFileExists", $conffiletoshow); } - else - { + else { print 'Ok '.$langs->trans("ConfFileCouldBeCreated", $conffiletoshow); } print "
"; @@ -345,8 +328,7 @@ else print 'A '.$conffiletoshow.' file exists with a dolibarr_main_document_root to '.$dolibarr_main_document_root.' that seems wrong. Try to fix or remove the '.$conffiletoshow.' file.
'."\n"; dol_syslog("A '".$conffiletoshow."' file exists with a dolibarr_main_document_root to ".$dolibarr_main_document_root." that seems wrong. Try to fix or remove the '".$conffiletoshow."' file.", LOG_WARNING); } - else - { + else { require_once $dolibarr_main_document_root.'/core/lib/admin.lib.php'; // If password is encoded, we decode it @@ -440,8 +422,7 @@ else { $choice .= ''.$langs->trans("Start").''; } - else - { + else { $choice .= ($foundrecommandedchoice ? '' : '').$langs->trans("InstallNotAllowed").($foundrecommandedchoice ? '' : ''); } $choice .= ''."\n"; @@ -560,13 +541,11 @@ else { $choice .= ''.$langs->trans("NotYetAvailable").''; } - else - { + else { $choice .= ''.$langs->trans("Start").''; } } - else - { + else { $choice .= $langs->trans("NotAvailable"); } $choice .= ''; diff --git a/htdocs/install/inc.php b/htdocs/install/inc.php index 3a3adc2322c..aab1615ed64 100644 --- a/htdocs/install/inc.php +++ b/htdocs/install/inc.php @@ -124,13 +124,11 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > } } } - else - { + else { $includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot'; } } - else - { + else { $includeconferror = 'ErrorBadFormatForConfFile'; } } @@ -210,8 +208,7 @@ if (@file_exists($lockfile)) print $langs->trans("ClickHereToGoToApp"); print ''; } - else - { + else { print 'If you always reach this page, you must remove install.lock file manually.
'; } exit; @@ -365,8 +362,7 @@ function pHeader($subtitle, $next, $action = 'set', $param = '', $forcejqueryurl $jQueryCustomPath = $forcejqueryurl; $jQueryUiCustomPath = $forcejqueryurl; } - else - { + else { $jQueryCustomPath = (defined('JS_JQUERY') && constant('JS_JQUERY')) ? JS_JQUERY : false; $jQueryUiCustomPath = (defined('JS_JQUERY_UI') && constant('JS_JQUERY_UI')) ? JS_JQUERY_UI : false; } diff --git a/htdocs/install/repair.php b/htdocs/install/repair.php index 034741c7c7e..f6f5eb83003 100644 --- a/htdocs/install/repair.php +++ b/htdocs/install/repair.php @@ -124,8 +124,7 @@ if ($db->connected) dolibarr_install_syslog("repair: ".$langs->transnoentities("ServerConnection").": ".$dolibarr_main_db_host.$langs->transnoentities("OK")); $ok = 1; } -else -{ +else { print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->transnoentities("Error").""; dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; @@ -140,8 +139,7 @@ if ($ok) dolibarr_install_syslog("repair: database connection successful: ".$dolibarr_main_db_name); $ok = 1; } - else - { + else { print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->trans("Error").""; dolibarr_install_syslog("repair: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; @@ -257,8 +255,7 @@ if ($ok && GETPOST('standard', 'alpha')) $fieldname = $obj->Field; $fieldtype = $obj->Type; } - else - { + else { $fieldname = isset($obj->Key) ? $obj->Key : $obj->attname; $fieldtype = isset($obj->Type) ? $obj->Type : 'varchar'; } @@ -318,13 +315,11 @@ if ($ok && GETPOST('standard', 'alpha')) { print "KO ".$db->lasterror."
\n"; } - else - { + else { print "OK
\n"; } } - else - { + else { print ' - Mode test, no column added.'; } } @@ -332,8 +327,7 @@ if ($ok && GETPOST('standard', 'alpha')) print " \n"; } - else - { + else { dol_print_error($db); } } @@ -399,13 +393,11 @@ if ($ok && GETPOST('standard', 'alpha')) print 'Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we delete record'; } - else - { + else { print 'Widget '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module '.$name.' not enabled in entity '.$obj->entity.', we should delete record (not done, mode test)'; } } - else - { + else { //print 'Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record'; } } @@ -472,13 +464,11 @@ if ($ok && GETPOST('standard', 'alpha')) print 'Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we delete record'; } - else - { + else { print 'Constant '.$obj->file.' set in boxes_def for entity '.$obj->entity.' but MAIN_MODULE_'.strtoupper($module).' not defined in entity '.$obj->entity.', we should delete record (not done, mode test)'; } } - else - { + else { //print 'Constant '.$obj->name.' set in entity '.$obj->entity.' with value '.$obj->value.' -> Module found in entity '.$obj->entity.', we keep record'; } } @@ -567,8 +557,7 @@ if ($ok && GETPOST('restore_thirdparties_logos')) $i++; } } - else - { + else { $ok = 0; dol_print_error($db); } @@ -671,8 +660,7 @@ if ($ok && GETPOST('restore_user_pictures', 'alpha')) $i++; } } - else - { + else { $ok = 0; dol_print_error($db); } @@ -730,8 +718,7 @@ if ($ok && GETPOST('rebuild_product_thumbs', 'alpha')) $i++; } } - else - { + else { $ok = 0; dol_print_error($db); } @@ -816,16 +803,13 @@ if ($ok && GETPOST('clean_menus', 'alpha')) $error++; dol_print_error($db); } - else - print ' - Cleaned'; + else print ' - Cleaned'; } - else - { + else { print ' - Canceled (test mode)'; } } - else - { + else { print ' - Module condition '.$modulecond.' is ok, we do nothing.'; } } @@ -840,13 +824,11 @@ if ($ok && GETPOST('clean_menus', 'alpha')) $i++; } } - else - { + else { print 'No menu entries of disabled menus found'; } } - else - { + else { dol_print_error($db); } } @@ -1049,8 +1031,7 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) dol_print_error($db); } } - else - { + else { $error++; dol_print_error($db); } @@ -1066,13 +1047,11 @@ if ($ok && GETPOST('clean_product_stock_batch', 'alpha')) $i++; } } - else - { + else { print 'Nothing to do'; } } - else - { + else { dol_print_error($db); } } @@ -1156,13 +1135,11 @@ if ($ok && GETPOST('set_empty_time_spent_amount', 'alpha')) $i++; } } - else - { + else { print 'No time spent with empty line on users with a hourly rate defined'; } } - else - { + else { dol_print_error($db); } } @@ -1257,16 +1234,13 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $error++; dol_print_error($db); } - else - print ' - Cleaned'; + else print ' - Cleaned'; } - else - { + else { print ' - Canceled (test mode)'; } } - else - { + else { print ' - File of '.$key.' ('.$reloffile.') found, we do nothing.'; } } @@ -1282,13 +1256,11 @@ if ($ok && GETPOST('force_disable_of_modules_not_found', 'alpha')) $i++; } } - else - { + else { print 'No active module with missing files found by searching on MAIN_MODULE_(.*)_'.strtoupper($key).''; } } - else - { + else { dol_print_error($db); } } @@ -1334,13 +1306,11 @@ if ($ok && GETPOST('clean_perm_table', 'alpha')) $i++; } } - else - { + else { print 'No lines of a disabled external module (with id > 100000) found into table rights_def'; } } - else - { + else { dol_print_error($db); } } @@ -1392,8 +1362,7 @@ if ($ok && GETPOST('force_utf8_on_tables', 'alpha')) $resql = $db->query($sql); } } - else - { + else { print 'Not available with database type '.$db->type.''; } } @@ -1496,8 +1465,7 @@ if ($ok && GETPOST('repair_link_dispatch_lines_supplier_order_lines')) { { $resql_attach = $db->query($sql_attach); } - else - { + else { $resql_attach = true; // Force success in test mode } @@ -1552,8 +1520,7 @@ if ($oneoptionset) print $langs->trans("GoToDolibarr"); print ''; } -else -{ +else { print '
'; print $langs->trans("SetAtLeastOneOptionAsUrlParameter"); print '
'; diff --git a/htdocs/install/step1.php b/htdocs/install/step1.php index a5e6b9d3377..6bf2e1d3dff 100644 --- a/htdocs/install/step1.php +++ b/htdocs/install/step1.php @@ -231,8 +231,7 @@ if (!$error) { { $databasefortest = 'postgres'; } - else - { + else { $databasefortest = 'master'; } } @@ -275,8 +274,7 @@ if (!$error) { } } } - else - { + else { print "
\nFailed to include_once(\"".$main_dir."/core/db/".$db_type.".class.php\")
\n"; print '
'.$langs->trans("ErrorWrongValueForParameter", $langs->transnoentities("WebPagesDirectory")).'
'; //print ''; @@ -286,8 +284,7 @@ if (!$error) { } } -else -{ +else { if (isset($db)) print $db->lasterror(); if (isset($db) && !$db->connected) print '
'.$langs->trans("BecauseConnectionFailedParametersMayBeWrong").'

'; print $langs->trans("ErrorGoBackAndCorrectParameters"); @@ -318,7 +315,7 @@ if (!$error && $db->connected) $defaultCharacterSet = $db->forcecharset; $defaultDBSortingCollation = $db->forcecollate; } - else // If already created, we take current value + else // If already created, we take current value { $defaultCharacterSet = $db->getDefaultCharacterSetDatabase(); $defaultDBSortingCollation = $db->getDefaultCollationDatabase(); @@ -401,8 +398,7 @@ if (!$error && $db->connected && $action == "set") print '
'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').''; $error++; } - else - { + else { // Create .htaccess file in document directory $pathhtaccess = $main_data_dir.'/.htaccess'; if (!file_exists($pathhtaccess)) @@ -438,8 +434,7 @@ if (!$error && $db->connected && $action == "set") { dolibarr_install_syslog("step1: directory '".$dir[$i]."' exists"); } - else - { + else { if (dol_mkdir($dir[$i]) < 0) { print ""; @@ -449,8 +444,7 @@ if (!$error && $db->connected && $action == "set") print ""; $error++; } - else - { + else { dolibarr_install_syslog("step1: directory '".$dir[$i]."' created"); } } @@ -472,8 +466,7 @@ if (!$error && $db->connected && $action == "set") print ""; print '
'.$langs->trans("CorrectProblemAndReloadPage", $_SERVER['PHP_SELF'].'?testget=ok').''; } - else - { + else { //ODT templates $srcroot = $main_dir.'/install/doctemplates'; $destroot = $main_data_dir.'/doctemplates'; @@ -592,8 +585,7 @@ if (!$error && $db->connected && $action == "set") print ''; print 'Ok'; } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_USER_ALREADY_EXISTS') @@ -605,8 +597,7 @@ if (!$error && $db->connected && $action == "set") print ''; print ''.$langs->trans("LoginAlreadyExists").''; } - else - { + else { dolibarr_install_syslog("step1: failed to create user", LOG_ERR); print ''; print $langs->trans("UserCreation").' : '; @@ -618,8 +609,7 @@ if (!$error && $db->connected && $action == "set") $db->close(); } - else - { + else { print ''; print $langs->trans("UserCreation").' : '; print $dolibarr_main_db_user; @@ -668,8 +658,7 @@ if (!$error && $db->connected && $action == "set") //if ($check1 != $dolibarr_main_db_character_set) dolibarr_install_syslog('step1: value for character_set is not the one asked for database creation', LOG_WARNING); //if ($check2 != $dolibarr_main_db_collation) dolibarr_install_syslog('step1: value for collation is not the one asked for database creation', LOG_WARNING); } - else - { + else { // warning message print '
'; print $langs->trans("ErrorFailedToCreateDatabase", $dolibarr_main_db_name).'
'; @@ -735,8 +724,7 @@ if (!$error && $db->connected && $action == "set") $error = 0; } - else - { + else { dolibarr_install_syslog("step1: connection to database ".$conf->db->name." by user ".$conf->db->user." failed", LOG_ERR); print ""; print $langs->trans("DatabaseConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; @@ -755,8 +743,7 @@ if (!$error && $db->connected && $action == "set") $error++; } } - else - { + else { dolibarr_install_syslog("step1: connection to server by user ".$conf->db->user." failed", LOG_ERR); print ""; print $langs->trans("ServerConnection")." (".$langs->trans("User")." ".$conf->db->user.") : "; @@ -1031,8 +1018,7 @@ function write_conf_file($conffile) print 'Ok'; print ""; } - else - { + else { $error++; } } diff --git a/htdocs/install/step2.php b/htdocs/install/step2.php index 5b794b781bd..f33319ba57c 100644 --- a/htdocs/install/step2.php +++ b/htdocs/install/step2.php @@ -100,8 +100,7 @@ if ($action == "set") print $langs->trans("ServerConnection")." : ".$conf->db->host.'Ok'; $ok = 1; } - else - { + else { print "Failed to connect to server : ".$conf->db->host.'Error'; } @@ -111,8 +110,7 @@ if ($action == "set") { dolibarr_install_syslog("step2: successful connection to database: ".$conf->db->name); } - else - { + else { dolibarr_install_syslog("step2: failed connection to database :".$conf->db->name, LOG_ERR); print "Failed to select database ".$conf->db->name.'Error'; $ok = 0; @@ -202,8 +200,7 @@ if ($action == "set") { $buffer = preg_replace('/type=innodb/i', 'ENGINE=innodb', $buffer); } - else - { + else { // Keyword ENGINE is MySQL-specific, so scrub it for // other database types (mssql, pgsql) $buffer = preg_replace('/type=innodb/i', '', $buffer); @@ -226,15 +223,13 @@ if ($action == "set") // print "OK requete ==== $buffer"; $db->free($resql); } - else - { + else { if ($db->errno() == 'DB_ERROR_TABLE_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_TABLE_OR_KEY_ALREADY_EXISTS') { //print "Deja existante"; } - else - { + else { print "".$langs->trans("CreateTableAndPrimaryKey", $name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$buffer.'
Executed query : '.$db->lastquery; print "\n"; @@ -243,8 +238,7 @@ if ($action == "set") } } } - else - { + else { print "".$langs->trans("CreateTableAndPrimaryKey", $name); print ""; print ''.$langs->trans("Error").' Failed to open file '.$dir.$file.''; @@ -262,8 +256,7 @@ if ($action == "set") $ok = 1; } } - else - { + else { print ''.$langs->trans("ErrorFailedToFindSomeFiles", $dir).'Error'; dolibarr_install_syslog("step2: failed to find files to create database in directory ".$dir, LOG_ERR); } @@ -369,8 +362,7 @@ if ($action == "set") //print "OK requete ==== $buffer"; $db->free($resql); } - else - { + else { if ($db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_CANNOT_CREATE' || $db->errno() == 'DB_ERROR_PRIMARY_KEY_ALREADY_EXISTS' || @@ -380,8 +372,7 @@ if ($action == "set") //print "Deja existante"; $key_exists = 1; } - else - { + else { print "".$langs->trans("CreateOtherKeysForTable", $name); print "
\n".$langs->trans("Request").' '.$requestnb.' : '.$db->lastqueryerror(); print "\n"; @@ -392,8 +383,7 @@ if ($action == "set") } } } - else - { + else { print "".$langs->trans("CreateOtherKeysForTable", $name); print ""; print ''.$langs->trans("Error")." Failed to open file ".$dir.$file.""; @@ -465,15 +455,13 @@ if ($action == "set") $ok = 1; $db->free($resql); } - else - { + else { if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS' || $db->errno() == 'DB_ERROR_KEY_NAME_ALREADY_EXISTS') { //print "Insert line : ".$buffer."
\n"; } - else - { + else { $ok = 0; print "".$langs->trans("FunctionsCreation"); @@ -491,8 +479,7 @@ if ($action == "set") { print 'Ok'; } - else - { + else { print 'Error'; $ok = 1; } @@ -589,14 +576,12 @@ if ($action == "set") { //$db->free($resql); // Not required as request we launch here does not return memory needs. } - else - { + else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { //print "Insertion ligne : $buffer"; } - else - { + else { $ok = 0; $okallfile = 0; print ''.$langs->trans("ErrorSQL")." : ".$db->lasterrno()." - ".$db->lastqueryerror()." - ".$db->lasterror()."
"; @@ -614,16 +599,14 @@ if ($action == "set") { print 'Ok'; } - else - { + else { print 'Error'; $ok = 1; // Data loading are not blocking errors } } print ''; } -else -{ +else { print 'Parameter action=set not defined'; } diff --git a/htdocs/install/step5.php b/htdocs/install/step5.php index b74594ce8da..a30a6040fb9 100644 --- a/htdocs/install/step5.php +++ b/htdocs/install/step5.php @@ -187,8 +187,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) dolibarr_set_const($db, "MAIN_SECURITY_SALT", dol_print_date(dol_now(), 'dayhourlog'), 'chaine', 0, '', 0); // All entities if (function_exists('password_hash')) dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'password_hash', 'chaine', 0, '', 0); // All entities - else - dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities + else dolibarr_set_const($db, "MAIN_SECURITY_HASH_ALGO", 'sha1md5', 'chaine', 0, '', 0); // All entities } dolibarr_install_syslog('step5: DATABASE_PWD_ENCRYPTED = '.$conf->global->DATABASE_PWD_ENCRYPTED.' MAIN_SECURITY_HASH_ALGO = '.$conf->global->MAIN_SECURITY_HASH_ALGO, LOG_INFO); @@ -215,16 +214,14 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) print $langs->trans("AdminLoginCreatedSuccessfuly", $login)."
"; $success = 1; } - else - { + else { if ($newuser->error == 'ErrorLoginAlreadyExists') { dolibarr_install_syslog('step5: AdminLoginAlreadyExists', LOG_WARNING); print '
'.$langs->trans("AdminLoginAlreadyExists", $login)."

"; $success = 1; } - else - { + else { dolibarr_install_syslog('step5: FailedToCreateAdminLogin '.$newuser->error, LOG_ERR); print '
'.$langs->trans("FailedToCreateAdminLogin").' '.$newuser->error.'


'; } @@ -241,8 +238,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) $conf->global->MAIN_VERSION_FIRST_INSTALL = $targetversion; $db->commit(); } - else - { + else { //if (! $resql) dol_print_error($db,'Error in setup program'); // We ignore errors. Key may already exists $db->commit(); } @@ -293,8 +289,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) $db->commit(); } } - else - { + else { print $langs->trans("ErrorFailedToConnect")."
"; } } @@ -311,8 +306,7 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) // Define if we need to update the MAIN_VERSION_LAST_UPGRADE value in database $tagdatabase = false; if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE)) $tagdatabase = true; // We don't know what it was before, so now we consider we are version choosed. - else - { + else { $mainversionlastupgradearray = preg_split('/[.-]/', $conf->global->MAIN_VERSION_LAST_UPGRADE); $targetversionarray = preg_split('/[.-]/', $targetversion); if (versioncompare($targetversionarray, $mainversionlastupgradearray) > 0) $tagdatabase = true; @@ -327,18 +321,15 @@ if ($action == "set" || empty($action) || preg_match('/upgrade/i', $action)) if (!$resql) dol_print_error($db, 'Error in setup program'); $conf->global->MAIN_VERSION_LAST_UPGRADE = $targetversion; } - else - { + else { dolibarr_install_syslog('step5: we run an upgrade to version '.$targetversion.' but database was already upgraded to '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'. We keep MAIN_VERSION_LAST_UPGRADE as it is.'); } } - else - { + else { print $langs->trans("ErrorFailedToConnect")."
"; } } - else - { + else { dol_print_error('', 'step5.php: unknown choice of action'); } @@ -390,8 +381,7 @@ if ($action == "set" && $success) print ' '.$langs->trans("GoToSetupArea"); print '
'; } - else - { + else { // If here MAIN_VERSION_LAST_UPGRADE is not empty print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'; print $langs->trans("VersionProgram").': '.DOL_VERSION.'
'; @@ -438,8 +428,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print ' '.$langs->trans("GoToDolibarr").'...'; print '
'; } - else - { + else { // If here MAIN_VERSION_LAST_UPGRADE is not empty print $langs->trans("VersionLastUpgrade").': '.$conf->global->MAIN_VERSION_LAST_UPGRADE.'
'; print $langs->trans("VersionProgram").': '.DOL_VERSION.''; @@ -451,8 +440,7 @@ elseif (empty($action) || preg_match('/upgrade/i', $action)) print ''; } } -else -{ +else { dol_print_error('', 'step5.php: unknown choice of action'); } diff --git a/htdocs/install/upgrade.php b/htdocs/install/upgrade.php index b71707bef4b..91242b7429a 100644 --- a/htdocs/install/upgrade.php +++ b/htdocs/install/upgrade.php @@ -151,8 +151,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ServerConnection").": $dolibarr_main_db_host ".$langs->transnoentities("OK")); $ok = 1; } - else - { + else { print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->transnoentities("Error")."\n"; dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; @@ -167,8 +166,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ dolibarr_install_syslog("upgrade: Database connection successful: ".$dolibarr_main_db_name); $ok = 1; } - else - { + else { print "".$langs->trans("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)."".$langs->trans("Error")."\n"; dolibarr_install_syslog("upgrade: ".$langs->transnoentities("ErrorFailedToConnectToDatabase", $dolibarr_main_db_name)); $ok = 0; @@ -293,8 +291,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } $db->free($resql); } - else - { + else { if ($db->lasterrno() != 'DB_ERROR_NOSUCHTABLE') { print ''.$sql.' : '.$db->lasterror()."
\n"; @@ -335,8 +332,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ } sort($filesindir); } - else - { + else { print '
'.$langs->trans("ErrorCanNotReadDir", $dir).'
'; } @@ -357,8 +353,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ { print '
'.$langs->trans("ErrorNoMigrationFilesFoundForParameters").'
'; } - else - { + else { $listoffileprocessed = array(); // Protection to avoid to process twice the same file // Loop on each migrate files diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 765a8796a76..b8e9ad30076 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -68,8 +68,7 @@ $err = error_reporting(); error_reporting(0); if (!empty($conf->global->MAIN_OVERRIDE_TIME_LIMIT)) @set_time_limit((int) $conf->global->MAIN_OVERRIDE_TIME_LIMIT); -else - @set_time_limit(600); +else @set_time_limit(600); error_reporting($err); $setuplang = GETPOST("selectlang", 'aZ09', 3) ?GETPOST("selectlang", 'aZ09', 3) : 'auto'; @@ -159,8 +158,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ { dolibarr_install_syslog('upgrade2: database connection successful :'.$dolibarr_main_db_name); } - else - { + else { $error++; } } @@ -536,16 +534,14 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ print ""; print ''; } - else - { + else { print ''; print ''.$langs->trans('UpgradeExternalModule').': OK'; print ""; print ''; } } - else - { + else { //if (! empty($conf->modules)) if (!empty($conf->modules_parts['hooks'])) // If there is at least one module with one hook, we show message to say nothing was done { @@ -585,8 +581,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ print '

'.$langs->trans("MigrationFinished").'
'; } -else -{ +else { print '
'.$langs->trans('ErrorWrongParameters').'
'; $error++; } @@ -646,8 +641,7 @@ function migrate_paiements($db, $langs, $conf) $i++; } } - else - { + else { dol_print_error($db); } @@ -678,19 +672,16 @@ function migrate_paiements($db, $langs, $conf) $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; } - else - { + else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } } - else - { + else { print $langs->trans('MigrationPaymentsNothingToUpdate')."
\n"; } } - else - { + else { print $langs->trans('MigrationPaymentsNothingToUpdate')."
\n"; } @@ -753,8 +744,7 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) $i++; } } - else - { + else { dol_print_error($db); } @@ -794,8 +784,7 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) print $langs->trans('MigrationProcessPaymentUpdate', 'facid='.$facid.'-paymentid='.$row[$i]['paymentid'].'-amount='.$row[$i]['pamount'])."
\n"; } } - else - { + else { print 'ERROR'; } } @@ -804,20 +793,17 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) { print $langs->trans('MigrationSuccessfullUpdate')."
"; } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } $db->commit(); } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -879,8 +865,7 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) $i++; } } - else - { + else { dol_print_error($db); } @@ -921,8 +906,7 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) print $langs->trans('MigrationProcessPaymentUpdate', 'facid='.$facid.'-paymentid='.$row[$i]['paymentid'].'-amount='.$row[$i]['pamount'])."
\n"; } } - else - { + else { print 'ERROR'; $nberr++; } @@ -932,15 +916,13 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) { print $langs->trans('MigrationSuccessfullUpdate')."
"; } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } $db->commit(); } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -954,14 +936,12 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) { $db->commit(); } - else - { + else { print 'ERROR'; $db->rollback(); } } - else - { + else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -1032,8 +1012,7 @@ function migrate_contracts_det($db, $langs, $conf) { print $langs->trans('MigrationContractsLineCreation', $obj->cref)."
\n"; } - else - { + else { dol_print_error($db); $nberr++; } @@ -1047,19 +1026,16 @@ function migrate_contracts_det($db, $langs, $conf) $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; } - else - { + else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } } - else - { + else { print $langs->trans('MigrationContractsNothingToUpdate')."
\n"; } } - else - { + else { print $langs->trans('MigrationContractsFieldDontExist')."
\n"; // dol_print_error($db); } @@ -1133,8 +1109,7 @@ function migrate_links_transfert($db, $langs, $conf) $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; } - else - { + else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } @@ -1143,8 +1118,7 @@ function migrate_links_transfert($db, $langs, $conf) print $langs->trans('MigrationBankTransfertsNothingToUpdate')."
\n"; } } - else - { + else { dol_print_error($db); } @@ -1172,8 +1146,7 @@ function migrate_contracts_date1($db, $langs, $conf) if (!$resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) print $langs->trans('MigrationContractsEmptyDatesUpdateSuccess')."
\n"; - else - print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."
\n"; + else print $langs->trans('MigrationContractsEmptyDatesNothingToUpdate')."
\n"; $sql = "update ".MAIN_DB_PREFIX."contrat set datec=tms where datec is null"; dolibarr_install_syslog("upgrade2::migrate_contracts_date1"); @@ -1181,8 +1154,7 @@ function migrate_contracts_date1($db, $langs, $conf) if (!$resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) print $langs->trans('MigrationContractsEmptyCreationDatesUpdateSuccess')."
\n"; - else - print $langs->trans('MigrationContractsEmptyCreationDatesNothingToUpdate')."
\n"; + else print $langs->trans('MigrationContractsEmptyCreationDatesNothingToUpdate')."
\n"; print ''; } @@ -1244,12 +1216,10 @@ function migrate_contracts_date2($db, $langs, $conf) if ($nbcontratsmodifie) print $langs->trans('MigrationContractsInvalidDatesNumber', $nbcontratsmodifie)."
\n"; - else - print $langs->trans('MigrationContractsInvalidDatesNothingToUpdate')."
\n"; + else print $langs->trans('MigrationContractsInvalidDatesNothingToUpdate')."
\n"; } } - else - { + else { dol_print_error($db); } @@ -1277,8 +1247,7 @@ function migrate_contracts_date3($db, $langs, $conf) if (!$resql) dol_print_error($db); if ($db->affected_rows($resql) > 0) print $langs->trans('MigrationContractsIncoherentCreationDateUpdateSuccess')."
\n"; - else - print $langs->trans('MigrationContractsIncoherentCreationDateNothingToUpdate')."
\n"; + else print $langs->trans('MigrationContractsIncoherentCreationDateNothingToUpdate')."
\n"; print ''; } @@ -1333,8 +1302,7 @@ function migrate_contracts_open($db, $langs, $conf) if ($nbcontratsmodifie) print $langs->trans('MigrationReopenedContractsNumber', $nbcontratsmodifie)."
\n"; - else - print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; + else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; } } else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; @@ -1416,23 +1384,20 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf) $nb++; print ''.$langs->trans("OK").''; } - else - { + else { print 'Error on insert'; $error++; } print ''; } } - else - { + else { $error++; } $i++; } } - else - { + else { $error++; } @@ -1447,14 +1412,12 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf) $sql = "ALTER TABLE ".MAIN_DB_PREFIX."paiementfourn DROP COLUMN fk_facture_fourn"; $db->query($sql); } - else - { + else { print ''.$langs->trans("Error").''; $db->rollback(); } } - else - { + else { print ''.$langs->trans("AlreadyDone").''; } } @@ -1540,14 +1503,12 @@ function migrate_price_facture($db, $langs, $conf) { //print $facture->id; } - else - { + else { print "Error id=".$facture->id; $err++; } } - else - { + else { print "Error #3"; $err++; } @@ -1557,16 +1518,14 @@ function migrate_price_facture($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans("AlreadyDone"); } $db->free($resql); $db->commit(); } - else - { + else { print "Error #1 ".$db->error(); $err++; @@ -1665,8 +1624,7 @@ function migrate_price_propal($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans("AlreadyDone"); } @@ -1674,8 +1632,7 @@ function migrate_price_propal($db, $langs, $conf) $db->commit(); } - else - { + else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1754,8 +1711,7 @@ function migrate_price_contrat($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans("AlreadyDone"); } @@ -1763,8 +1719,7 @@ function migrate_price_contrat($db, $langs, $conf) $db->commit(); } - else - { + else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1861,8 +1816,7 @@ function migrate_price_commande($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans("AlreadyDone"); } @@ -1880,8 +1834,7 @@ function migrate_price_commande($db, $langs, $conf) $db->commit(); } - else - { + else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1978,8 +1931,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans("AlreadyDone"); } @@ -1997,8 +1949,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf) $db->commit(); } - else - { + else { print "Error #1 ".$db->error(); $db->rollback(); @@ -2126,19 +2077,16 @@ function migrate_commande_expedition($db, $langs, $conf) print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2202,8 +2150,7 @@ function migrate_commande_livraison($db, $langs, $conf) dol_print_error($db); } } - else - { + else { $error++; dol_print_error($db); } @@ -2219,19 +2166,16 @@ function migrate_commande_livraison($db, $langs, $conf) print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2310,14 +2254,12 @@ function migrate_detail_livraison($db, $langs, $conf) dol_print_error($db); } } - else - { + else { $error++; dol_print_error($db); } } - else - { + else { $error++; dol_print_error($db); } @@ -2333,19 +2275,16 @@ function migrate_detail_livraison($db, $langs, $conf) print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { $result = $db->DDLDescTable(MAIN_DB_PREFIX."livraisondet", "fk_origin_line"); $obj = $db->fetch_object($result); if (!$obj) @@ -2402,8 +2341,7 @@ function migrate_stocks($db, $langs, $conf) if ($resql2) { } - else - { + else { $error++; dol_print_error($db); } @@ -2416,13 +2354,11 @@ function migrate_stocks($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -2478,8 +2414,7 @@ function migrate_menus($db, $langs, $conf) if ($resql2) { } - else - { + else { $error++; dol_print_error($db); } @@ -2492,19 +2427,16 @@ function migrate_menus($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2567,8 +2499,7 @@ function migrate_commande_deliveryaddress($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2576,19 +2507,16 @@ function migrate_commande_deliveryaddress($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2670,13 +2598,11 @@ function migrate_restore_missing_links($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -2729,8 +2655,7 @@ function migrate_restore_missing_links($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2738,13 +2663,11 @@ function migrate_restore_missing_links($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -2826,24 +2749,20 @@ function migrate_project_user_resp($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2918,24 +2837,20 @@ function migrate_project_task_actors($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -3006,8 +2921,7 @@ function migrate_relationship_tables($db, $langs, $conf, $table, $fk_source, $so $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3018,24 +2932,20 @@ function migrate_relationship_tables($db, $langs, $conf, $table, $fk_source, $so { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3104,8 +3014,7 @@ function migrate_project_task_time($db, $langs, $conf) if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $newtime; else $totaltime[$obj->fk_task] = $newtime; } - else - { + else { if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $obj->task_duration; else $totaltime[$obj->fk_task] = $obj->task_duration; } @@ -3131,23 +3040,19 @@ function migrate_project_task_time($db, $langs, $conf) } } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } } - else - { + else { dol_print_error($db); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } } - else - { + else { dol_print_error($db); } @@ -3155,8 +3060,7 @@ function migrate_project_task_time($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } @@ -3229,8 +3133,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3238,26 +3141,22 @@ function migrate_customerorder_shipping($db, $langs, $conf) { $db->commit(); } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3331,16 +3230,14 @@ function migrate_shipping_delivery($db, $langs, $conf) } print ". "; } - else - { + else { $error++; dol_print_error($db); } $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3355,20 +3252,17 @@ function migrate_shipping_delivery($db, $langs, $conf) $sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."livraison DROP COLUMN fk_expedition"; $db->query($sqlDrop); } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3436,8 +3330,7 @@ function migrate_shipping_delivery2($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3445,14 +3338,12 @@ function migrate_shipping_delivery2($db, $langs, $conf) { $db->commit(); } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -3511,14 +3402,12 @@ function migrate_actioncomm_element($db, $langs, $conf) //$db->query($sqlDrop); //print ". "; } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } } @@ -3603,14 +3492,12 @@ function migrate_mode_reglement($db, $langs, $conf) { $db->commit(); } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -3694,16 +3581,14 @@ function migrate_clean_association($db, $langs, $conf) print ''.$langs->trans("RemoveDuplicates").' '.$langs->trans("Success").' ('.$num.'=>'.count($couples).')'; $db->commit(); } - else - { + else { print ''.$langs->trans("MigrationCategorieAssociation").''; print ''.$langs->trans("RemoveDuplicates").' '.$langs->trans("Failed").''; $db->rollback(); } } } - else - { + else { print ''.$langs->trans("Error").''; print '
'.$db->lasterror().'
'; } @@ -3764,8 +3649,7 @@ function migrate_categorie_association($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3786,19 +3670,16 @@ function migrate_categorie_association($db, $langs, $conf) $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3858,8 +3739,7 @@ function migrate_event_assignement($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3867,13 +3747,11 @@ function migrate_event_assignement($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -3935,8 +3813,7 @@ function migrate_event_assignement_contact($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3944,13 +3821,11 @@ function migrate_event_assignement_contact($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4022,8 +3897,7 @@ function migrate_reset_blocked_log($db, $langs, $conf) $error++; dol_print_error($db); } - else - { + else { // Add set line $object = new stdClass(); $object->id = 1; @@ -4041,21 +3915,18 @@ function migrate_reset_blocked_log($db, $langs, $conf) } } } - else - { + else { print ' - '.$langs->trans('AlreadyInV7').'
'; } } - else - { + else { dol_print_error($db); } $i++; } } - else - { + else { print $langs->trans('NothingToDo')."
\n"; } @@ -4063,13 +3934,11 @@ function migrate_reset_blocked_log($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4132,8 +4001,7 @@ function migrate_remise_entity($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -4141,13 +4009,11 @@ function migrate_remise_entity($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4207,8 +4073,7 @@ function migrate_remise_except_entity($db, $langs, $conf) $sqlSelect2 .= " WHERE fd.rowid = ".$obj->fk_facture_line; $sqlSelect2 .= " AND fd.fk_facture = f.rowid"; } - else - { + else { $sqlSelect2 = "SELECT s.entity"; $sqlSelect2 .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sqlSelect2 .= " WHERE s.rowid = ".$obj->fk_soc; @@ -4233,8 +4098,7 @@ function migrate_remise_except_entity($db, $langs, $conf) } } } - else - { + else { $error++; dol_print_error($db); } @@ -4243,8 +4107,7 @@ function migrate_remise_except_entity($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -4252,13 +4115,11 @@ function migrate_remise_except_entity($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4319,8 +4180,7 @@ function migrate_user_rights_entity($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -4328,13 +4188,11 @@ function migrate_user_rights_entity($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4395,8 +4253,7 @@ function migrate_usergroup_rights_entity($db, $langs, $conf) $i++; } } - else - { + else { print $langs->trans('AlreadyDone')."
\n"; } @@ -4404,13 +4261,11 @@ function migrate_usergroup_rights_entity($db, $langs, $conf) { $db->commit(); } - else - { + else { $db->rollback(); } } - else - { + else { dol_print_error($db); $db->rollback(); } @@ -4774,8 +4629,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->init($reloadmode); } } - else - { + else { $reg = array(); $tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg); if (!empty($reg[1])) @@ -4784,7 +4638,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo { $moduletoreloadshort = ucfirst(strtolower($reg[1])); } - else // If key is a mix of up and low case + else // If key is a mix of up and low case { $moduletoreloadshort = $reg[1]; } @@ -4796,8 +4650,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - else - { + else { dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'); $res = @dol_include_once(strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); @@ -4807,14 +4660,12 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - else - { + else { dolibarr_install_syslog('Failed to include '.strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); } } } - else - { + else { dolibarr_install_syslog("Error, can't find module with name ".$moduletoreload, LOG_WARNING); print "Error, can't find module with name ".$moduletoreload; } @@ -4949,7 +4800,7 @@ function migrate_user_photospath() // dol_delete_dir($origin.'/'.$file); } } - else // it is a file + else // it is a file { if (!dol_is_file($destin.'/'.$file)) { From def53338de2c55147ff3d7e7b95a5f5389cb2147 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 May 2020 09:07:10 +0200 Subject: [PATCH 11/28] add new rule --- build/generate_filelist_xml.php | 4 +- dev/initdemo/sftpget_and_loaddump.php | 8 +- dev/initdemo/updatedemo.php | 4 +- htdocs/core/class/cunits.class.php | 8 +- htdocs/document.php | 12 +- htdocs/main.inc.php | 36 ++-- htdocs/website/class/website.class.php | 12 +- htdocs/website/class/websitepage.class.php | 5 +- htdocs/website/index.php | 169 ++++++------------ htdocs/website/samples/wrapper.php | 18 +- .../accountancy/export-thirdpartyaccount.php | 6 +- scripts/bank/export-bank-receipts.php | 3 +- .../email_expire_services_to_customers.php | 15 +- ...ail_expire_services_to_representatives.php | 9 +- scripts/cron/cron_run_jobs.php | 9 +- scripts/emailings/mailing-send.php | 15 +- .../email_unpaid_invoices_to_customers.php | 9 +- ...ail_unpaid_invoices_to_representatives.php | 3 +- .../members/sync_members_ldap2dolibarr.php | 6 +- .../sync_members_types_ldap2dolibarr.php | 3 +- scripts/user/sync_groups_ldap2dolibarr.php | 3 +- scripts/user/sync_users_ldap2dolibarr.php | 6 +- 22 files changed, 125 insertions(+), 238 deletions(-) diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 976f2cb6ba3..581353b758b 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -110,7 +110,7 @@ print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; print "Include custom in signature : ".$includecustom."\n"; print "Include constants in signature : "; foreach ($includeconstants as $countrycode => $tmp) { - foreach($tmp as $constname => $constvalue) { + foreach ($tmp as $constname => $constvalue) { print $constname.'='.$constvalue." "; } } @@ -130,7 +130,7 @@ fputs($fp, ''."\n"); - foreach($tmp as $constname => $constvalue) { + foreach ($tmp as $constname => $constvalue) { $valueforchecksum=(empty($constvalue)?'0':$constvalue); $checksumconcat[]=$valueforchecksum; fputs($fp, ' '.$valueforchecksum.''."\n"); diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index 5b16d3afe9b..4da5ffaad58 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -95,8 +95,7 @@ if ($connection) dol_syslog("Could not authenticate with username ".$login." . and password ".preg_replace('/./', '*', $password), LOG_ERR); exit(-5); } - else - { + else { //$stream = ssh2_exec($connection, '/usr/bin/php -i'); /* print "Generate dump ".$filesys1.'.bz2'."\n"; @@ -125,14 +124,13 @@ if ($connection) $return_var=0; print strftime("%Y%m%d-%H%M%S").' '.$fullcommand."\n"; exec($fullcommand, $output, $return_var); - foreach($output as $line) print $line."\n"; + foreach ($output as $line) print $line."\n"; //ssh2_sftp_unlink($sftp, $fileinstalllock); //print $output; } } -else -{ +else { print 'Failed to connect to ssh2 to '.$server; exit(-6); } diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 0cc43a18a9d..95d5ad12c83 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -87,7 +87,7 @@ while ($year <= $currentyear) if ($delta1) { - foreach($tables as $tablekey => $tableval) + foreach ($tables as $tablekey => $tableval) { print "Correct ".$tablekey." for year ".$year." and move them to current year ".$currentyear." "; $sql="select rowid from ".MAIN_DB_PREFIX.$tablekey." where ".$tableval[0]." between '".$year."-01-01' and '".$year."-12-31' and ".$tableval[0]." < DATE_ADD(NOW(), INTERVAL -1 YEAR)"; @@ -105,7 +105,7 @@ while ($year <= $currentyear) print "."; $sql2="UPDATE ".MAIN_DB_PREFIX.$tablekey." set "; $j=0; - foreach($tableval as $field) + foreach ($tableval as $field) { if ($j) $sql2.=", "; $sql2.= $field." = ".$db->ifsql("DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR) > NOW()", "DATE_ADD(".$field.", INTERVAL ".$delta2." YEAR)", "DATE_ADD(".$field.", INTERVAL ".$delta1." YEAR)"); diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 0b56b4c0831..80ea8e2f0cc 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -432,11 +432,9 @@ class CUnits // extends CommonObject return round($value, 2); } - - /** * get scale of unit factor - * @param $id int id of unit in dictionary + * @param int $id id of unit in dictionary * @return float|int */ public function scaleOfUnitPow($id) @@ -444,9 +442,9 @@ class CUnits // extends CommonObject $base = 10; // TODO : add base col into unit dictionary table $unit = $this->db->getRow('SELECT scale, unit_type from '.MAIN_DB_PREFIX.'c_units WHERE rowid = '.intval($id)); - if ($unit){ + if ($unit) { // TODO : if base exist in unit dictionary table remove this convertion exception and update convertion infos in database exemple time hour currently scale 3600 will become scale 2 base 60 - if ($unit->unit_type == 'time'){ + if ($unit->unit_type == 'time') { return doubleval($unit->scale); } diff --git a/htdocs/document.php b/htdocs/document.php index c1ed149649e..0d08296e63e 100644 --- a/htdocs/document.php +++ b/htdocs/document.php @@ -134,19 +134,16 @@ if (!empty($hashp)) $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir //var_dump($original_file); exit; } - else - { + else { accessforbidden('Bad link. File is from another module part.', 0, 0, 1); } } - else - { + else { $modulepart = $moduleparttocheck; $original_file = (($tmp[1] ? $tmp[1].'/' : '').$ecmfile->filename); // this is relative to module dir } } - else - { + else { $langs->load("errors"); accessforbidden($langs->trans("ErrorFileNotFoundWithSharedLink"), 0, 0, 1); } @@ -185,8 +182,7 @@ if (!empty($hashp)) $accessallowed = 1; // When using hashp, link is public so we force $accessallowed $sqlprotectagainstexternals = ''; } -else -{ +else { // Basic protection (against external users only) if ($user->socid > 0) { diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 733ded3e447..569f4aa6c57 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -1340,23 +1340,17 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr else print ''."\n"; if (!defined('DISABLE_JQUERY_TABLEDND')) print ''."\n"; // jQuery jnotify - if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) - { + if (empty($conf->global->MAIN_DISABLE_JQUERY_JNOTIFY) && !defined('DISABLE_JQUERY_JNOTIFY')) { print ''."\n"; } // Flot - if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') - { - if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) - { - if (constant('JS_JQUERY_FLOT')) - { + if (empty($conf->global->MAIN_JS_GRAPH) || $conf->global->MAIN_JS_GRAPH == 'jflot') { + if (empty($conf->global->MAIN_DISABLE_JQUERY_FLOT) && !defined('DISABLE_JQUERY_FLOT')) { + if (constant('JS_JQUERY_FLOT')) { print ''."\n"; print ''."\n"; print ''."\n"; - } - else - { + } else { print ''."\n"; print ''."\n"; print ''."\n"; @@ -1375,14 +1369,12 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr } } // Chart - if ($conf->global->MAIN_JS_GRAPH == 'chart') - { + if ($conf->global->MAIN_JS_GRAPH == 'chart') { print ''."\n"; } // jQuery jeditable for Edit In Place features - if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) - { + if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !defined('DISABLE_JQUERY_JEDITABLE')) { print ''."\n"; print ''."\n"; print ''."\n"; @@ -1401,28 +1393,26 @@ function top_htmlhead($head, $title = '', $disablejs = 0, $disablehead = 0, $arr print ''."\n"; } // jQuery Timepicker - if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) - { + if (!empty($conf->global->MAIN_USE_JQUERY_TIMEPICKER) || defined('REQUIRE_JQUERY_TIMEPICKER')) { print ''."\n"; print ''."\n"; } - if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) // jQuery plugin "mutiselect", "multiple-select", "select2", ... - { + if (!defined('DISABLE_SELECT2') && (!empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT'))) { + // jQuery plugin "mutiselect", "multiple-select", "select2", ... $tmpplugin = empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) ?constant('REQUIRE_JQUERY_MULTISELECT') : $conf->global->MAIN_USE_JQUERY_MULTISELECT; print ''."\n"; // We include full because we need the support of containerCssClass } } - if (!$disablejs && !empty($conf->use_javascript_ajax)) - { + if (!$disablejs && !empty($conf->use_javascript_ajax)) { // CKEditor if ((!empty($conf->fckeditor->enabled) && (empty($conf->global->FCKEDITOR_EDITORNAME) || $conf->global->FCKEDITOR_EDITORNAME == 'ckeditor') && !defined('DISABLE_CKEDITOR')) || defined('FORCE_CKEDITOR')) { print ''."\n"; $pathckeditor = DOL_URL_ROOT.'/includes/ckeditor/ckeditor/'; $jsckeditor = 'ckeditor.js'; - if (constant('JS_CKEDITOR')) // To use external ckeditor 4 js lib - { + if (constant('JS_CKEDITOR')) { + // To use external ckeditor 4 js lib $pathckeditor = constant('JS_CKEDITOR'); } print ''."\n"; } - if (is_object($objsoc) && $objsoc->id > 0) - { + if (is_object($objsoc) && $objsoc->id > 0) { $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; } else { @@ -126,8 +122,7 @@ abstract class ActionsAdherentCardCommon $this->tpl['select_civility'] = $formcompany->select_civility($this->object->civility_id); // Predefined with third party - if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) - { + if ((isset($objsoc->typent_code) && $objsoc->typent_code == 'TE_PRIVATE')) { if (dol_strlen(trim($this->object->address)) == 0) $this->tpl['address'] = $objsoc->address; if (dol_strlen(trim($this->object->zip)) == 0) $this->object->zip = $objsoc->zip; if (dol_strlen(trim($this->object->town)) == 0) $this->object->town = $objsoc->town; @@ -159,18 +154,15 @@ abstract class ActionsAdherentCardCommon $this->tpl['select_morphy'] = $form->selectarray('morphy', $selectarray, $this->object->morphy, 0); } - if ($action == 'view' || $action == 'edit' || $action == 'delete') - { + if ($action == 'view' || $action == 'edit' || $action == 'delete') { // Emailing - if (!empty($conf->mailing->enabled)) - { + if (!empty($conf->mailing->enabled)) { $langs->load("mails"); $this->tpl['nb_emailing'] = $this->object->getNbOfEMailings(); } // Dolibarr user - if ($this->object->user_id) - { + if ($this->object->user_id) { $dolibarr_user = new User($this->db); $result = $dolibarr_user->fetch($this->object->user_id); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); @@ -178,12 +170,10 @@ abstract class ActionsAdherentCardCommon else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); } - if ($action == 'view' || $action == 'delete') - { + if ($action == 'view' || $action == 'delete') { $this->tpl['showrefnav'] = $form->showrefnav($this->object, 'id'); - if ($this->object->socid > 0) - { + if ($this->object->socid > 0) { $objsoc = new Societe($this->db); $objsoc->fetch($this->object->socid); @@ -210,8 +200,7 @@ abstract class ActionsAdherentCardCommon $this->tpl['note'] = nl2br($this->object->note); } - if ($action == 'create_user') - { + if ($action == 'create_user') { // Full firstname and lastname separated with a dot : firstname.lastname include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; @@ -259,12 +248,10 @@ abstract class ActionsAdherentCardCommon $this->object->canvas = $_POST["canvas"]; // We set country_id, and country_code label of the chosen country - if ($this->object->country_id) - { + if ($this->object->country_id) { $sql = "SELECT code, label FROM ".MAIN_DB_PREFIX."c_country WHERE rowid = ".$this->object->country_id; $resql = $this->db->query($sql); - if ($resql) - { + if ($resql) { $obj = $this->db->fetch_object($resql); $this->object->country_code = $obj->code; diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index f248256a547..db2473c55d9 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -90,8 +90,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon $this->tpl['error'] = $this->error; $this->tpl['errors'] = $this->errors; - if ($action == 'view') - { + if ($action == 'view') { // Card header $head = member_prepare_head($this->object); $title = $this->getTitle($action); @@ -107,14 +106,12 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); } else { // Confirm delete contact - if ($action == 'delete' && $user->rights->adherent->supprimer) - { + if ($action == 'delete' && $user->rights->adherent->supprimer) { $this->tpl['action_delete'] = $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$this->object->id, $langs->trans("DeleteAdherent"), $langs->trans("ConfirmDeleteAdherent"), "confirm_delete", '', 0, 1); } } - if ($action == 'list') - { + if ($action == 'list') { $this->LoadListDatas($limit, $offset, $sortfield, $sortorder); } } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php index 92f1e11d7a2..b6c0b542d27 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_create.tpl.php @@ -17,8 +17,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) -{ +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php index 36e2deab14c..92a4fbddd38 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_edit.tpl.php @@ -17,8 +17,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) -{ +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; } diff --git a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php index b738f549247..8789b2fcb34 100644 --- a/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php +++ b/htdocs/adherents/canvas/default/tpl/adherentcard_view.tpl.php @@ -17,8 +17,7 @@ */ // Protection to avoid direct call of template -if (empty($conf) || !is_object($conf)) -{ +if (empty($conf) || !is_object($conf)) { print "Error, template page can't be called as URL"; exit; } diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 7a5880fc317..cf5253e3bf8 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -55,8 +55,7 @@ $typeid = GETPOST('typeid', 'int'); $userid = GETPOST('userid', 'int'); $socid = GETPOST('socid', 'int'); -if (!empty($conf->mailmanspip->enabled)) -{ +if (!empty($conf->mailmanspip->enabled)) { include_once DOL_DOCUMENT_ROOT.'/mailmanspip/class/mailmanspip.class.php'; $langs->load('mailmanspip'); @@ -76,8 +75,7 @@ $socialnetworks = getArrayOfSocialNetworks(); $object->getCanvas($id); $canvas = $object->canvas ? $object->canvas : GETPOST("canvas"); $objcanvas = null; -if (!empty($canvas)) -{ +if (!empty($canvas)) { require_once DOL_DOCUMENT_ROOT.'/core/class/canvas.class.php'; $objcanvas = new Canvas($db, $action); $objcanvas->getCanvas('adherent', 'membercard', $canvas); @@ -86,16 +84,14 @@ if (!empty($canvas)) // Security check $result = restrictedArea($user, 'adherent', $id, '', '', 'socid', 'rowid', $objcanvas); -if ($id > 0) -{ +if ($id > 0) { // Load member $result = $object->fetch($id); // Define variables to know what current user can do on users $canadduser = ($user->admin || $user->rights->user->user->creer); // Define variables to know what current user can do on properties of user linked to edited member - if ($object->user_id) - { + if ($object->user_id) { // $User is the user who edits, $object->user_id is the id of the related user in the edited member $caneditfielduser = ((($user->id == $object->user_id) && $user->rights->user->self->creer) || (($user->id != $object->user_id) && $user->rights->user->user->creer)); @@ -107,8 +103,7 @@ if ($id > 0) // Define variables to determine what the current user can do on the members $canaddmember = $user->rights->adherent->creer; // Define variables to determine what the current user can do on the properties of a member -if ($id) -{ +if ($id) { $caneditfieldmember = $user->rights->adherent->creer; } @@ -125,34 +120,26 @@ $parameters = array('id'=>$id, 'rowid'=>$id, 'objcanvas'=>$objcanvas, 'confirm'= $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if (empty($reshook)) -{ - if ($cancel) - { - if (!empty($backtopage)) - { +if (empty($reshook)) { + if ($cancel) { + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } $action = ''; } - if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) - { + if ($action == 'setuserid' && ($user->rights->user->self->creer || $user->rights->user->user->creer)) { $error = 0; - if (empty($user->rights->user->user->creer)) // If can edit only itself user, we can link to itself only - { - if ($userid != $user->id && $userid != $object->user_id) - { + if (empty($user->rights->user->user->creer)) { // If can edit only itself user, we can link to itself only + if ($userid != $user->id && $userid != $object->user_id) { $error++; setEventMessages($langs->trans("ErrorUserPermissionAllowsToLinksToItselfOnly"), null, 'errors'); } } - if (!$error) - { - if ($userid != $object->user_id) // If link differs from currently in database - { + if (!$error) { + if ($userid != $object->user_id) { // If link differs from currently in database $result = $object->setUserId($userid); if ($result < 0) dol_print_error($object->db, $object->error); $action = ''; @@ -160,22 +147,17 @@ if (empty($reshook)) } } - if ($action == 'setsocid') - { + if ($action == 'setsocid') { $error = 0; - if (!$error) - { - if ($socid != $object->socid) // If link differs from currently in database - { + if (!$error) { + if ($socid != $object->socid) { // If link differs from currently in database $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."adherent"; $sql .= " WHERE socid = '".$socid."'"; $sql .= " AND entity = ".$conf->entity; $resql = $db->query($sql); - if ($resql) - { + if ($resql) { $obj = $db->fetch_object($resql); - if ($obj && $obj->rowid > 0) - { + if ($obj && $obj->rowid > 0) { $othermember = new Adherent($db); $othermember->fetch($obj->rowid); $thirdparty = new Societe($db); @@ -185,8 +167,7 @@ if (empty($reshook)) } } - if (!$error) - { + if (!$error) { $result = $object->setThirdPartyId($socid); if ($result < 0) dol_print_error($object->db, $object->error); $action = ''; @@ -196,16 +177,13 @@ if (empty($reshook)) } // Create user from a member - if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) - { - if ($result > 0) - { + if ($action == 'confirm_create_user' && $confirm == 'yes' && $user->rights->user->user->creer) { + if ($result > 0) { // Creation user $nuser = new User($db); $result = $nuser->create_from_member($object, GETPOST('login', 'alphanohtml')); - if ($result < 0) - { + if ($result < 0) { $langs->load("errors"); setEventMessages($langs->trans($nuser->error), null, 'errors'); } @@ -215,16 +193,13 @@ if (empty($reshook)) } // Create third party from a member - if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) - { - if ($result > 0) - { + if ($action == 'confirm_create_thirdparty' && $confirm == 'yes' && $user->rights->societe->creer) { + if ($result > 0) { // User creation $company = new Societe($db); $result = $company->create_from_member($object, GETPOST('companyname', 'alpha'), GETPOST('companyalias', 'alpha')); - if ($result < 0) - { + if ($result < 0) { $langs->load("errors"); setEventMessages($langs->trans($company->error), null, 'errors'); setEventMessages($company->error, $company->errors, 'errors'); @@ -234,15 +209,13 @@ if (empty($reshook)) } } - if ($action == 'update' && !$cancel && $user->rights->adherent->creer) - { + if ($action == 'update' && !$cancel && $user->rights->adherent->creer) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] - && isset($_POST["birthyear"]) && $_POST["birthyear"]) - { + && isset($_POST["birthyear"]) && $_POST["birthyear"]) { $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } $lastname = $_POST["lastname"]; @@ -267,16 +240,14 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Company")), null, 'errors'); } // Check if the login already exists - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($login)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); } } // Create new object - if ($result > 0 && !$error) - { + if ($result > 0 && !$error) { $object->oldcopy = clone $object; // Change values @@ -329,32 +300,27 @@ if (empty($reshook)) // Check if we need to also synchronize user information $nosyncuser = 0; - if ($object->user_id) // If linked to a user - { + if ($object->user_id) { // If linked to a user if ($user->id != $object->user_id && empty($user->rights->user->user->creer)) $nosyncuser = 1; // Disable synchronizing } // Check if we need to also synchronize password information $nosyncuserpass = 0; - if ($object->user_id) // If linked to a user - { + if ($object->user_id) { // If linked to a user if ($user->id != $object->user_id && empty($user->rights->user->user->password)) $nosyncuserpass = 1; // Disable synchronizing } $result = $object->update($user, 0, $nosyncuser, $nosyncuserpass); - if ($result >= 0 && !count($object->errors)) - { + if ($result >= 0 && !count($object->errors)) { $categories = GETPOST('memcats', 'array'); $object->setCategories($categories); // Logo/Photo save $dir = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos'; $file_OK = is_uploaded_file($_FILES['photo']['tmp_name']); - if ($file_OK) - { - if (GETPOST('deletephoto')) - { + if ($file_OK) { + if (GETPOST('deletephoto')) { require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $fileimg = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/'.$object->photo; $dirthumbs = $conf->adherent->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, 'member').'/photos/thumbs'; @@ -362,15 +328,12 @@ if (empty($reshook)) dol_delete_dir_recursive($dirthumbs); } - if (image_format_supported($_FILES['photo']['name']) > 0) - { + if (image_format_supported($_FILES['photo']['name']) > 0) { dol_mkdir($dir); - if (@is_dir($dir)) - { + if (@is_dir($dir)) { $newfile = $dir.'/'.dol_sanitizeFileName($_FILES['photo']['name']); - if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) - { + if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); } else { // Create thumbs @@ -381,8 +344,7 @@ if (empty($reshook)) setEventMessages("ErrorBadImageFormat", null, 'errors'); } } else { - switch ($_FILES['photo']['error']) - { + switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini case 2: //uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the html form $errors[] = "ErrorFileSizeTooLarge"; @@ -397,8 +359,7 @@ if (empty($reshook)) $id = $object->id; $action = ''; - if (!empty($backtopage)) - { + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } @@ -411,19 +372,16 @@ if (empty($reshook)) } } - if ($action == 'add' && $user->rights->adherent->creer) - { + if ($action == 'add' && $user->rights->adherent->creer) { if ($canvas) $object->canvas = $canvas; $birthdate = ''; if (isset($_POST["birthday"]) && $_POST["birthday"] && isset($_POST["birthmonth"]) && $_POST["birthmonth"] - && isset($_POST["birthyear"]) && $_POST["birthyear"]) - { + && isset($_POST["birthyear"]) && $_POST["birthyear"]) { $birthdate = dol_mktime(12, 0, 0, $_POST["birthmonth"], $_POST["birthday"], $_POST["birthyear"]); } $datesubscription = ''; - if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) - { + if (isset($_POST["reday"]) && isset($_POST["remonth"]) && isset($_POST["reyear"])) { $datesubscription = dol_mktime(12, 0, 0, $_POST["remonth"], $_POST["reday"], $_POST["reyear"]); } @@ -508,8 +466,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MemberNature")), null, 'errors'); } // Tests if the login already exists - if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) - { + if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) { if (empty($login)) { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login")), null, 'errors'); @@ -557,14 +514,12 @@ if (empty($reshook)) $public = 0; if (isset($public)) $public = 1; - if (!$error) - { + if (!$error) { $db->begin(); // Email about right and login does not exist $result = $object->create($user); - if ($result > 0) - { + if ($result > 0) { // Foundation categories $memcats = GETPOST('memcats', 'array'); $object->setCategories($memcats); @@ -590,13 +545,10 @@ if (empty($reshook)) } } - if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') - { + if ($user->rights->adherent->supprimer && $action == 'confirm_delete' && $confirm == 'yes') { $result = $object->delete($id, $user); - if ($result > 0) - { - if (!empty($backtopage)) - { + if ($result > 0) { + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; } else { @@ -608,8 +560,7 @@ if (empty($reshook)) } } - if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') - { + if ($user->rights->adherent->creer && $action == 'confirm_valid' && $confirm == 'yes') { $error = 0; $db->begin(); @@ -619,11 +570,9 @@ if (empty($reshook)) $result = $object->validate($user); - if ($result >= 0 && !count($object->errors)) - { + if ($result >= 0 && !count($object->errors)) { // Send confirmation email (according to parameters of member type. Otherwise generic) - if ($object->email && GETPOST("send_mail")) - { + if ($object->email && GETPOST("send_mail")) { $subject = ''; $msg = ''; @@ -641,8 +590,7 @@ if (empty($reshook)) if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) - { + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } @@ -661,8 +609,7 @@ if (empty($reshook)) $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); - if ($result < 0) - { + if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -677,8 +624,7 @@ if (empty($reshook)) } } - if (!$error) - { + if (!$error) { $db->commit(); } else { $db->rollback(); @@ -686,21 +632,17 @@ if (empty($reshook)) $action = ''; } - if ($user->rights->adherent->supprimer && $action == 'confirm_resign') - { + if ($user->rights->adherent->supprimer && $action == 'confirm_resign') { $error = 0; - if ($confirm == 'yes') - { + if ($confirm == 'yes') { $adht = new AdherentType($db); $adht->fetch($object->typeid); $result = $object->resiliate($user); - if ($result >= 0 && !count($object->errors)) - { - if ($object->email && GETPOST("send_mail")) - { + if ($result >= 0 && !count($object->errors)) { + if ($object->email && GETPOST("send_mail")) { $subject = ''; $msg = ''; @@ -718,8 +660,7 @@ if (empty($reshook)) if (!empty($labeltouse)) $arraydefaultmessage = $formmail->getEMailTemplate($db, 'member', $user, $outputlangs, 0, 1, $labeltouse); - if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) - { + if (!empty($labeltouse) && is_object($arraydefaultmessage) && $arraydefaultmessage->id > 0) { $subject = $arraydefaultmessage->topic; $msg = $arraydefaultmessage->content; } @@ -738,8 +679,7 @@ if (empty($reshook)) $moreinheader = 'X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; $result = $object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); - if ($result < 0) - { + if ($result < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -756,31 +696,24 @@ if (empty($reshook)) $action = ''; } } - if (!empty($backtopage) && !$error) - { + if (!empty($backtopage) && !$error) { header("Location: ".$backtopage); exit; } } // SPIP Management - if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') - { - if (!count($object->errors)) - { - if (!$mailmanspip->del_to_spip($object)) - { + if ($user->rights->adherent->supprimer && $action == 'confirm_del_spip' && $confirm == 'yes') { + if (!count($object->errors)) { + if (!$mailmanspip->del_to_spip($object)) { setEventMessages($langs->trans('DeleteIntoSpipError').': '.$mailmanspip->error, null, 'errors'); } } } - if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') - { - if (!count($object->errors)) - { - if (!$mailmanspip->add_to_spip($object)) - { + if ($user->rights->adherent->creer && $action == 'confirm_add_spip' && $confirm == 'yes') { + if (!count($object->errors)) { + if (!$mailmanspip->add_to_spip($object)) { setEventMessages($langs->trans('AddIntoSpipError').': '.$mailmanspip->error, null, 'errors'); } } @@ -817,13 +750,11 @@ llxHeader('', $title, $help_url); $countrynotdefined = $langs->trans("ErrorSetACountryFirst").' ('.$langs->trans("SeeAbove").')'; -if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) -{ +if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // ----------------------------------------- // When used with CANVAS // ----------------------------------------- - if (empty($object->error) && $id) - { + if (empty($object->error) && $id) { $object = new Adherent($db); $result = $object->fetch($id); if ($result <= 0) dol_print_error('', $object->error); @@ -835,8 +766,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // When used in standard mode // ----------------------------------------- - if ($action == 'create') - { + if ($action == 'create') { /* ************************************************************************** */ /* */ /* Creation mode */ @@ -847,8 +777,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // We set country_id, country_code and country for the selected country $object->country_id = GETPOST('country_id', 'int') ?GETPOST('country_id', 'int') : $mysoc->country_id; - if ($object->country_id) - { + if ($object->country_id) { $tmparray = getCountry($object->country_id, 'all'); $object->country_code = $tmparray['code']; $object->country = $tmparray['label']; @@ -858,8 +787,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) $object = new Societe($db); if ($socid > 0) $object->fetch($socid); - if (!($object->id > 0)) - { + if (!($object->id > 0)) { $langs->load("errors"); print($langs->trans('ErrorRecordNotFound')); exit; @@ -870,8 +798,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print load_fiche_titre($langs->trans("NewMember"), '', 'members'); - if ($conf->use_javascript_ajax) - { + if ($conf->use_javascript_ajax) { print "\n".''); -} -else { +} else { echo (''); diff --git a/htdocs/cashdesk/index_verif.php b/htdocs/cashdesk/index_verif.php index 0545c149dfa..204af8f51f7 100644 --- a/htdocs/cashdesk/index_verif.php +++ b/htdocs/cashdesk/index_verif.php @@ -116,12 +116,10 @@ if ($retour >= 0) header('Location: '.DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation&id=NOUV'); exit; - } - else { + } else { dol_print_error($db); } -} -else { +} else { // Load translation files required by the page $langs->loadLangs(array("other", "errors")); $retour = $langs->trans("ErrorBadLoginPassword"); diff --git a/htdocs/cashdesk/tpl/facturation1.tpl.php b/htdocs/cashdesk/tpl/facturation1.tpl.php index f1e19b4df20..0d81f6e947e 100644 --- a/htdocs/cashdesk/tpl/facturation1.tpl.php +++ b/htdocs/cashdesk/tpl/facturation1.tpl.php @@ -169,24 +169,21 @@ for ($i = 0; $i < $nbtoshow; $i++) { $langs->load("errors"); print 'transnoentitiesnoconv("CashDesk"))).'" />'; - } - else print ''; + } else print ''; print ''; print '
'; if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CB']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CB'] < 0) { $langs->load("errors"); print 'transnoentitiesnoconv("CashDesk"))).'" />'; - } - else print ''; + } else print ''; print '
'; print '
'; if (empty($_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE']) || $_SESSION['CASHDESK_ID_BANKACCOUNT_CHEQUE'] < 0) { $langs->load("errors"); print 'transnoentitiesnoconv("CashDesk")).'" />'; - } - else print ''; + } else print ''; print '
'; print '
'; print '
'; diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index d60d370172d..6fe42b35aa4 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -40,8 +40,7 @@ $langs->loadLangs(array("main", "bills", "banks")); // Affichage de la tva par taux if ($obj_facturation->montantTva()) { echo (''.$langs->trans("VAT").''.price(price2num($obj_facturation->montantTva(), 'MT'), 0, $langs, 0, 0, -1, $conf->currency).''); -} -else { +} else { echo (''.$langs->trans("VAT").''.$langs->trans("NoVAT").''); } ?> diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index a7a938fd828..b2711479596 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -96,8 +96,7 @@ switch ($action) $encaisse = $obj_facturation->montantEncaisse(); $obj_facturation->montantRendu($encaisse - $total); - } - else { + } else { //$txtDatePaiement=$_POST['txtDatePaiement']; $datePaiement = dol_mktime(0, 0, 0, $_POST['txtDatePaiementmonth'], $_POST['txtDatePaiementday'], $_POST['txtDatePaiementyear']); $txtDatePaiement = dol_print_date($datePaiement, 'dayrfc'); @@ -251,15 +250,13 @@ switch ($action) } } } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } $id = $invoice->id; - } - else { + } else { $resultcreate = $invoice->create($user, 0, 0); if ($resultcreate > 0) { @@ -327,13 +324,11 @@ switch ($action) //print 'set paid';exit; } } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } - } - else { + } else { setEventMessages($invoice->error, $invoice->errors, 'errors'); $error++; } @@ -344,8 +339,7 @@ switch ($action) { $db->commit(); $redirection = 'affIndex.php?menutpl=validation_ok&facid='.$id; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr - } - else { + } else { $db->rollback(); $redirection = 'affIndex.php?facid='.$id.'&error=1&mesg=ErrorFailedToCreateInvoice'; // Ajout de l'id de la facture, pour l'inclure dans un lien pointant directement vers celle-ci dans Dolibarr } diff --git a/htdocs/categories/admin/categorie.php b/htdocs/categories/admin/categorie.php index 017de5cd1e6..eb8af1ee44a 100644 --- a/htdocs/categories/admin/categorie.php +++ b/htdocs/categories/admin/categorie.php @@ -47,8 +47,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -60,8 +59,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { setEventMessages($db->lasterror(), null, 'errors'); } } @@ -105,13 +103,11 @@ print ''; if ($conf->use_javascript_ajax) { print ajax_constantonoff('CATEGORIE_RECURSIV_ADD'); -} -else { +} else { if (empty($conf->global->CATEGORIE_RECURSIV_ADD)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index a91a3df7827..8eb6c3d8eda 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -88,38 +88,31 @@ if ($action == 'add' && $user->rights->categorie->creer) { header("Location: ".$urlfrom); exit; - } - elseif ($idProdOrigin) + } elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type); exit; - } - elseif ($idCompanyOrigin) + } elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type); exit; - } - elseif ($idSupplierOrigin) + } elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type); exit; - } - elseif ($idMemberOrigin) + } elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type); exit; - } - elseif ($idContactOrigin) + } elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type); exit; - } - elseif ($idProjectOrigin) + } elseif ($idProjectOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProjectOrigin.'&type='.$type); exit; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); exit; } @@ -154,8 +147,7 @@ if ($action == 'add' && $user->rights->categorie->creer) { $action = 'confirmed'; $_POST["addcat"] = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -171,38 +163,31 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr { header("Location: ".$urlfrom); exit; - } - elseif ($backtopage) + } elseif ($backtopage) { header("Location: ".$backtopage); exit; - } - elseif ($idProdOrigin) + } elseif ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idCompanyOrigin) + } elseif ($idCompanyOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idCompanyOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idSupplierOrigin) + } elseif ($idSupplierOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idSupplierOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idMemberOrigin) + } elseif ($idMemberOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idMemberOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($idContactOrigin) + } elseif ($idContactOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idContactOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); exit; - } - elseif ($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/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 205e38f3e5e..1cbaf4cbe14 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -179,8 +179,7 @@ class Categories extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve category list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -243,8 +242,7 @@ class Categories extends DolibarrApi if ($this->category->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->category->error); } } diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d8f5ef4eeeb..b6255221fa3 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -316,12 +316,10 @@ class Categorie extends CommonObject if ($id > 0) { $sql .= " WHERE rowid = ".$id; - } - elseif (!empty($ref_ext)) + } elseif (!empty($ref_ext)) { $sql .= " WHERE ref_ext LIKE '".$this->db->escape($ref_ext)."'"; - } - else { + } else { $sql .= " WHERE label = '".$this->db->escape($label)."' AND entity IN (".getEntity('category').")"; if (!is_null($type)) $sql .= " AND type = ".$this->db->escape($type); } @@ -360,12 +358,10 @@ class Categorie extends CommonObject if (!empty($conf->global->MAIN_MULTILANGS)) $this->getMultiLangs(); return 1; - } - else { + } else { return 0; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -479,18 +475,15 @@ class Categorie extends CommonObject { $this->db->commit(); return $id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -567,8 +560,7 @@ class Categorie extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_print_error($this->db); return -1; @@ -653,8 +645,7 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -713,8 +704,7 @@ class Categorie extends CommonObject } } } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -738,20 +728,17 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $this->db->lasterrno(); return -3; - } - else { + } else { $this->error = $this->db->lasterror(); } return -1; @@ -802,13 +789,11 @@ class Categorie extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -859,16 +844,14 @@ class Categorie extends CommonObject if ($onlyids) { $objs[] = $rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]; - } - else { + } else { $obj = new $this->MAP_OBJ_CLASS[$type]($this->db); $obj->fetch($rec['fk_'.(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])]); $objs[] = $obj; } } return $objs; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -993,8 +976,7 @@ class Categorie extends CommonObject } $i++; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1029,8 +1011,7 @@ class Categorie extends CommonObject $cats[] = $cat; } return $cats; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1062,8 +1043,7 @@ class Categorie extends CommonObject $this->motherof[$obj->id_son] = $obj->id_parent; } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1099,18 +1079,15 @@ class Categorie extends CommonObject if (is_string($markafterid)) { $markafterid = explode(',', $markafterid); - } - elseif (is_numeric($markafterid)) + } elseif (is_numeric($markafterid)) { if ($markafterid > 0) { $markafterid = array($markafterid); - } - else { + } else { $markafterid = array(); } - } - elseif (!is_array($markafterid)) + } elseif (!is_array($markafterid)) { $markafterid = array(); } @@ -1146,8 +1123,7 @@ class Categorie extends CommonObject $this->cats[$obj->rowid]['ref_ext'] = $obj->ref_ext; $i++; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1291,8 +1267,7 @@ class Categorie extends CommonObject $cats[$rec['rowid']] = $cat; } return $cats; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1354,8 +1329,7 @@ class Categorie extends CommonObject } dol_syslog(get_class($this)."::already_exists no category with same name=".$this->label." and same parent ".$this->fk_parent." than category id=".$this->id, LOG_DEBUG); return 0; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1407,8 +1381,7 @@ class Categorie extends CommonObject $link = ''; $linkend = ''; $w[] = $link.($addpicto ? img_object('', 'category', 'class="paddingright"') : '').$cat->label.$linkend; - } - else { + } else { $w[] = "".($addpicto ? img_object('', 'category') : '').$cat->label.""; } } @@ -1449,8 +1422,7 @@ class Categorie extends CommonObject } } return $parents; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1529,13 +1501,11 @@ class Categorie extends CommonObject $cats[] = $cat; } } - } - else { + } else { dol_print_error($this->db); return -1; } - } - else { + } else { $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie_".(empty($this->MAP_CAT_TABLE[$type]) ? $type : $this->MAP_CAT_TABLE[$type])." as ct, ".MAIN_DB_PREFIX."categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_".(empty($this->MAP_CAT_FK[$type]) ? $type : $this->MAP_CAT_FK[$type])." = ".(int) $id." AND c.type = ".$this->MAP_ID[$type]; @@ -1556,8 +1526,7 @@ class Categorie extends CommonObject $cats[] = $cat; } } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1623,8 +1592,7 @@ class Categorie extends CommonObject } return $cats; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -1849,8 +1817,7 @@ class Categorie extends CommonObject $sql2 .= " SET label='".$this->db->escape($this->label)."',"; $sql2 .= " description='".$this->db->escape($this->description)."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->label); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1861,8 +1828,7 @@ class Categorie extends CommonObject $this->error = $this->db->lasterror(); return -1; } - } - elseif (isset($this->multilangs["$key"])) + } elseif (isset($this->multilangs["$key"])) { if ($this->db->num_rows($result)) // si aucune ligne dans la base { @@ -1870,8 +1836,7 @@ class Categorie extends CommonObject $sql2 .= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',"; $sql2 .= " description='".$this->db->escape($this->multilangs["$key"]["description"])."'"; $sql2 .= " WHERE fk_category=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."categorie_lang (fk_category, lang, label, description)"; $sql2 .= " VALUES(".$this->id.",'".$key."','".$this->db->escape($this->multilangs["$key"]["label"]); $sql2 .= "','".$this->db->escape($this->multilangs["$key"]["description"])."')"; @@ -1929,8 +1894,7 @@ class Categorie extends CommonObject $this->multilangs["$obj->lang"]["description"] = $obj->description; } return 1; - } - else { + } else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; return -1; } @@ -2022,8 +1986,7 @@ class Categorie extends CommonObject if (intval($searchCategory) == -2) { $searchCategorySqlList[] = " cp.fk_categorie IS NULL"; - } - elseif (intval($searchCategory) > 0) + } elseif (intval($searchCategory) > 0) { $searchCategorySqlList[] = " ".$rowIdName ." IN (SELECT fk_".$type." FROM ".MAIN_DB_PREFIX."categorie_".$type @@ -2034,8 +1997,7 @@ class Categorie extends CommonObject if (!empty($searchCategorySqlList)) { return " AND (".implode(' AND ', $searchCategorySqlList).")"; - } - else { + } else { return ""; } } diff --git a/htdocs/categories/edit.php b/htdocs/categories/edit.php index dfd8f01f381..53a343046b7 100644 --- a/htdocs/categories/edit.php +++ b/htdocs/categories/edit.php @@ -108,12 +108,10 @@ if ($action == 'update' && $user->rights->categorie->creer) { header('Location: '.DOL_URL_ROOT.'/categories/viewcat.php?id='.$object->id.'&type='.$type); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index d88e1a0ff8c..026ff2f24ac 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -134,8 +134,7 @@ if ($catname || $id > 0) print "\t\n"; } print ""; -} -else print ' '; +} else print ' '; //print ''; @@ -206,8 +205,7 @@ if ($nbofentries > 0) print ''; tree_recur($data, $data[0], 0); print ''; -} -else { +} else { print ''; print ''; print ''; print ''; print ''; -} -else { +} else { $categstatic = new Categorie($db); $fulltree = $categstatic->get_full_arbo($type, $object->id, 1); @@ -403,8 +391,7 @@ else { print ''; print ''; - } - else { + } else { print ''; print '\n"; } - } - else { + } else { print ''; } print "
'.img_picto_common('', 'treemenu/branchbottom.gif').''; diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 7443bc5b532..ba09852d61b 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -179,8 +179,7 @@ if ($object->id) { print ''; print $langs->trans("AddPhoto").''; - } - else { + } else { print ''; print $langs->trans("AddPhoto").''; } @@ -230,8 +229,7 @@ if ($object->id) if ($obj['photo_vignette']) { $filename = $obj['photo_vignette']; - } - else { + } else { $filename = $obj['photo']; } @@ -278,8 +276,7 @@ if ($object->id) print '
'.$langs->trans("NoPhotoYet")."
"; } } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index c3f87e404b7..ea36ce40edd 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -292,8 +292,7 @@ if ($action == 'edit') print ''; print ''; -} -elseif ($action != 'add') +} elseif ($action != 'add') { if ($cnt_trans) print '
'; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 921a1f12061..6c2a71fe21e 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -103,47 +103,40 @@ if ($id > 0 && $removeelem > 0) $tmpobject = new Product($db); $result = $tmpobject->fetch($removeelem); $elementtype = 'product'; - } - elseif ($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'; - } - elseif ($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'; - } - elseif ($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'; - } - elseif ($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'; - } - elseif ($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'; - } - elseif ($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); $result = $tmpobject->fetch($removeelem); $elementtype = 'project'; - } - elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) + } elseif ($type == Categorie::TYPE_USER && $user->rights->user->user->creer) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; $tmpobject = new User($db); @@ -161,8 +154,7 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi { header("Location: ".DOL_URL_ROOT.'/categories/index.php?type='.$type); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -179,13 +171,11 @@ if ($type == Categorie::TYPE_PRODUCT && $elemid && $action == 'addintocategory' if ($result >= 0) { setEventMessages($langs->trans("WasAddedSuccessfully", $newobject->ref), null, 'mesgs'); - } - else { + } else { if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { setEventMessages($langs->trans("ObjectAlreadyLinkedToCategory"), null, 'warnings'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -327,14 +317,12 @@ $cats = $object->get_filles(); if ($cats < 0) { dol_print_error($db, $cats->error, $cats->errors); -} -elseif (count($cats) < 1) +} elseif (count($cats) < 1) { print '
'.$langs->trans("NoSubCat").'
'; print ''; @@ -445,8 +432,7 @@ if ($type == Categorie::TYPE_PRODUCT) if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); - } - else { + } else { // Form to add record into a category $showclassifyform = 1; if ($showclassifyform) @@ -508,8 +494,7 @@ if ($type == Categorie::TYPE_PRODUCT) print ''; print "\n"; } - } - else { + } else { print ''; } print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -526,8 +511,7 @@ if ($type == Categorie::TYPE_SUPPLIER) if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); - } - else { + } else { print '
'; print ''; print ''; @@ -567,8 +551,7 @@ if ($type == Categorie::TYPE_SUPPLIER) print "
'.$langs->trans("ThisCategoryHasNoItems").'
\n"; @@ -585,8 +568,7 @@ if ($type == Categorie::TYPE_CUSTOMER) if ($socs < 0) { dol_print_error($db, $socs->error, $socs->errors); - } - else { + } else { print ''; print ''; print ''; @@ -625,8 +607,7 @@ if ($type == Categorie::TYPE_CUSTOMER) print ''; print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -646,8 +627,7 @@ if ($type == Categorie::TYPE_MEMBER) if ($prods < 0) { dol_print_error($db, $prods->error, $prods->errors); - } - else { + } else { print ''; print ''; print ''; @@ -688,8 +668,7 @@ if ($type == Categorie::TYPE_MEMBER) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -707,8 +686,7 @@ if ($type == Categorie::TYPE_CONTACT) if ($contacts < 0) { dol_print_error($db, $contacts->error, $contacts->errors); - } - else { + } else { print ''; print ''; print ''; @@ -750,8 +728,7 @@ if ($type == Categorie::TYPE_CONTACT) print ''; print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -771,8 +748,7 @@ if ($type == Categorie::TYPE_ACCOUNT) if ($accounts < 0) { dol_print_error($db, $accounts->error, $accounts->errors); - } - else { + } else { print ''; print ''; print ''; @@ -812,8 +788,7 @@ if ($type == Categorie::TYPE_ACCOUNT) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -833,8 +808,7 @@ if ($type == Categorie::TYPE_PROJECT) if ($objects < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -875,8 +849,7 @@ if ($type == Categorie::TYPE_PROJECT) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -894,8 +867,7 @@ if ($type == Categorie::TYPE_USER) if ($users < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -933,8 +905,7 @@ if ($type == Categorie::TYPE_USER) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; @@ -955,8 +926,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) if ($objects < 0) { dol_print_error($db, $object->error, $object->errors); - } - else { + } else { print ''; print ''; print ''; @@ -997,8 +967,7 @@ if ($type == Categorie::TYPE_WAREHOUSE) } print "\n"; } - } - else { + } else { print ''.$langs->trans("ThisCategoryHasNoItems").''; } print "\n"; diff --git a/htdocs/collab/index.php b/htdocs/collab/index.php index f6344f4ebf0..0c457fb6f47 100644 --- a/htdocs/collab/index.php +++ b/htdocs/collab/index.php @@ -94,8 +94,7 @@ if ($action == 'add') $db->commit(); setEventMessages($langs->trans("PageAdded", $objectpage->pageurl), null, 'mesgs'); $action = ''; - } - else { + } else { $db->rollback(); } @@ -128,12 +127,10 @@ if ($action == 'delete') header("Location: ".$_SERVER["PHP_SELF"].'?website='.$website); exit; - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8a4018a5458..55cca00d7d7 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -172,8 +172,7 @@ if (empty($reshook) && $action == 'confirm_clone' && $confirm == 'yes') if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($id > 0) { //$object->fetch($id); if (!empty($object->socpeopleassigned)) { @@ -241,8 +240,7 @@ if (empty($reshook) && $action == 'add') $error++; $donotclearsession = 1; $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - } - else { + } else { $object->type_code = GETPOST('actioncode', 'aZ09'); } @@ -260,13 +258,11 @@ if (empty($reshook) && $action == 'add') if (GETPOST('actioncode', 'aZ09') == 'AC_RDV' && $contact->getFullName($langs)) { $object->label = $langs->transnoentitiesnoconv("TaskRDVWith", $contact->getFullName($langs)); - } - else { + } else { if ($langs->trans("Action".$object->type_code) != "Action".$object->type_code) { $object->label = $langs->transnoentitiesnoconv("Action".$object->type_code)."\n"; - } - else { + } else { $cactioncomm->fetch($object->type_code); $object->label = $cactioncomm->label; } @@ -386,17 +382,14 @@ if (empty($reshook) && $action == 'add') { dol_syslog("Back to ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : '')); header("Location: ".$backtopage.($moreparam ? (preg_match('/\?/', $backtopage) ? '&'.$moreparam : '?'.$moreparam) : '')); - } - elseif ($idaction) + } elseif ($idaction) { header("Location: ".DOL_URL_ROOT.'/comm/action/card.php?id='.$idaction.($moreparam ? '&'.$moreparam : '')); - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/comm/action/index.php'.($moreparam ? '?'.$moreparam : '')); } exit; - } - else { + } else { // If error $db->rollback(); $langs->load("errors"); @@ -404,8 +397,7 @@ if (empty($reshook) && $action == 'add') setEventMessages($error, null, 'errors'); $action = 'create'; $donotclearsession = 1; } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; $donotclearsession = 1; @@ -482,8 +474,7 @@ if (empty($reshook) && $action == 'update') { if ($val['id'] > 0 && $val['id'] != $assignedtouser) $listofuserid[$val['id']] = $val; } - } - else { + } else { $assignedtouser = (!empty($object->userownerid) && $object->userownerid > 0 ? $object->userownerid : 0); if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>($user->id == $assignedtouser ? $transparency : '')); // Owner first } @@ -510,8 +501,7 @@ if (empty($reshook) && $action == 'update') $error++; $donotclearsession = 1; $action = 'edit'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors'); - } - else { + } else { $result = $cactioncomm->fetch(GETPOST('actioncode', 'aZ09')); } if (empty($object->userownerid)) @@ -599,8 +589,7 @@ if (empty($reshook) && $action == 'update') unset($_SESSION['assignedtouser']); $db->commit(); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -637,8 +626,7 @@ if (empty($reshook) && $action == 'confirm_delete' && GETPOST("confirm") == 'yes { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -746,8 +734,7 @@ if (empty($reshook) && GETPOST('actionmove', 'alpha') == 'mupdate') { header("Location: ".$backtopage); exit; - } - else { + } else { $action = ''; } } @@ -969,8 +956,7 @@ if ($action == 'create') if ($assignedtouser) $listofuserid[$assignedtouser] = array('id'=>$assignedtouser, 'mandatory'=>0, 'transparency'=>$object->transparency); // Owner first $listofuserid[$user->id]['transparency'] = GETPOSTISSET('transparency') ?GETPOST('transparency', 'alpha') : 1; // 1 by default at first init $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1022,8 +1008,7 @@ if ($action == 'create') $societe->fetch(GETPOST('socid', 'int')); print $societe->getNomUrl(1); print ''; - } - else { + } else { $events = array(); $events[] = array('method' => 'getContacts', 'url' => dol_buildpath('/core/ajax/contacts.php?showempty=1', 1), 'htmlname' => 'contactid', 'params' => array('add-customer-contact' => 'disabled')); //For external user force the company to user company @@ -1252,8 +1237,7 @@ if ($id > 0) if ($object->type_code != 'AC_OTH_AUTO') { $formactions->select_type_actions(GETPOST("actioncode", 'aZ09') ?GETPOST("actioncode", 'aZ09') : $object->type_code, "actioncode", "systemauto"); - } - else { + } else { print ''.$langs->trans("Action".$object->type_code); } print ''; @@ -1383,8 +1367,7 @@ if ($id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1507,8 +1490,7 @@ if ($id > 0) print ''; print ''; - } - else { + } else { print ''; print dolGetElementUrl($object->fk_element, $object->elementtype, 1); print ''; @@ -1547,8 +1529,7 @@ if ($id > 0) print '
'; print ''; - } - else { + } else { dol_fiche_head($head, 'card', $langs->trans("Action"), -1, 'action'); @@ -1691,8 +1672,7 @@ if ($id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -1778,8 +1758,7 @@ if ($id > 0) print '
'; } } - } - else { + } else { print ''.$langs->trans("None").''; } print ''; @@ -1836,8 +1815,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { print ''; - } - else { + } else { print ''; } @@ -1845,8 +1823,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { print ''; - } - else { + } else { print ''; } @@ -1854,8 +1831,7 @@ if ($id > 0) (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->delete)) { print ''; - } - else { + } else { print ''; } } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 2c21f311e5d..7c35b9979c7 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -417,13 +417,11 @@ class ActionComm extends CommonObject { $this->type_id = $cactioncomm->id; $this->type_code = $cactioncomm->code; - } - elseif ($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; - } - else { + } else { $this->error = $cactioncomm->error; return -1; } @@ -577,13 +575,11 @@ class ActionComm extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -647,8 +643,7 @@ class ActionComm extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -762,8 +757,7 @@ class ActionComm extends CommonObject $this->fetchResources(); } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -808,8 +802,7 @@ class ActionComm extends CommonObject } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -862,8 +855,7 @@ class ActionComm extends CommonObject } return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -945,13 +937,11 @@ class ActionComm extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1097,14 +1087,12 @@ class ActionComm extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::update ".join(',', $this->errors), LOG_ERR); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1163,8 +1151,7 @@ class ActionComm extends CommonObject } $db->free($resql); return $resarray; - } - else { + } else { return $db->lasterror(); } } @@ -1223,8 +1210,7 @@ class ActionComm extends CommonObject $this->db->free($resql); if (empty($load_state_board)) return $response; else return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1274,8 +1260,7 @@ class ActionComm extends CommonObject if (!empty($obj->fk_user_mod)) $this->date_modification = $this->db->jdate($obj->datem); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -1404,8 +1389,7 @@ class ActionComm extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $linkclose = ($hookmanager->resPrint ? $hookmanager->resPrint : $linkclose); */ - } - else $linkclose .= ' class="'.$classname.'"'; + } else $linkclose .= ' class="'.$classname.'"'; $url = ''; if ($option == 'birthday') @@ -1435,8 +1419,7 @@ class ActionComm extends CommonObject $libelle = $label; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) $libelle = $labeltype; $libelleshort = ''; - } - else { + } else { $libelle = (empty($this->libelle) ? $label : $this->libelle.(($label && $label != $this->libelle) ? ' '.$label : '')); if (!empty($conf->global->AGENDA_USE_EVENT_TYPE) && empty($libelle)) $libelle = $labeltype; if ($maxlength < 0) $libelleshort = $this->ref; @@ -1677,8 +1660,7 @@ class ActionComm extends CommonObject { $dateend = $this->db->jdate($obj->datep2) - (empty($conf->global->AGENDA_EXPORT_FIX_TZ) ? 0 : ($conf->global->AGENDA_EXPORT_FIX_TZ * 3600)); - } - else { + } else { // use start date as fall-back to avoid import erros on empty end date $dateend = $datestart; } @@ -1734,8 +1716,7 @@ class ActionComm extends CommonObject { $eventarray = $hookmanager->resArray; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1768,15 +1749,13 @@ class ActionComm extends CommonObject $timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0); $timestampEnd = dol_stringtotime($obj->date_end." 12:00:00", 0); - } - elseif ($obj->halfday == 1) + } elseif ($obj->halfday == 1) { $event['fulldayevent'] = false; $timestampStart = dol_stringtotime($obj->date_start." 12:00:00", 0); $timestampEnd = dol_stringtotime($obj->date_end." 23:59:59", 0); - } - else { + } else { $event['fulldayevent'] = true; $timestampStart = dol_stringtotime($obj->date_start." 00:00:00", 0); @@ -1810,8 +1789,7 @@ class ActionComm extends CommonObject { // 2 = leave wait for approval $event['summary'] = $title." - ".$obj->lastname." (wait for approval)"; - } - else { + } else { // 3 = leave approved $event['summary'] = $title." - ".$obj->lastname; } @@ -1836,8 +1814,7 @@ class ActionComm extends CommonObject $title = 'Dolibarr actions '.$mysoc->name.' - '.$more; $desc = $more; $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; - } - else { + } else { $title = 'Dolibarr actions '.$mysoc->name; $desc = $langs->transnoentities('ListOfActions'); $desc .= ' ('.$mysoc->name.' - built by Dolibarr)'; @@ -1861,8 +1838,7 @@ class ActionComm extends CommonObject dol_delete_file($outputfiletmp, 0, 1); $result = -1; } - } - else { + } else { dol_syslog(get_class($this)."::build_exportfile build_xxxfile function fails to for format=".$format." outputfiletmp=".$outputfile, LOG_ERR); dol_delete_file($outputfiletmp, 0, 1); $langs->load("errors"); diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index f987d551766..d3f4fb3f238 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -200,28 +200,23 @@ class ActionCommReminder extends CommonObject { if ($status == 1) return $langs->trans('Done'); elseif ($status == 0) return $langs->trans('ToDo'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4').' '.$langs->trans('Done'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5').' '.$langs->trans('ToDo'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Done'), 'statut4').' '.$langs->trans('Done'); elseif ($status == 0) return img_picto($langs->trans('ToDo'), 'statut5').' '.$langs->trans('ToDo'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'), 'statut4'); elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'), 'statut5'); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index a8cb6b5de8f..20b88dd73d7 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -175,8 +175,7 @@ class AgendaEvents extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve Agenda Event list : '.$db->lasterror()); } if (!count($obj_ret)) { diff --git a/htdocs/comm/action/class/cactioncomm.class.php b/htdocs/comm/action/class/cactioncomm.class.php index d3e4f93b5f7..147a6ff7ef0 100644 --- a/htdocs/comm/action/class/cactioncomm.class.php +++ b/htdocs/comm/action/class/cactioncomm.class.php @@ -104,13 +104,11 @@ class CActionComm $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -206,8 +204,7 @@ class CActionComm if ($idorcode == 'id') $this->liste_array = $repid; if ($idorcode == 'code') $this->liste_array = $repcode; return $this->liste_array; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/comm/action/class/ical.class.php b/htdocs/comm/action/class/ical.class.php index 2b74c4793d9..b806dde94f9 100644 --- a/htdocs/comm/action/class/ical.class.php +++ b/htdocs/comm/action/class/ical.class.php @@ -179,15 +179,13 @@ class ICal $tmpkey = ''; $tmpvalue = ''; } - } - elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i', $value)) + } elseif (preg_match('/^ENCODING=QUOTED-PRINTABLE:/i', $value)) { if (preg_match('/=$/', $value)) { $tmpkey = $key; $tmpvalue = $tmpvalue.preg_replace('/=$/', "", $value); // We must wait to have next line to have complete message - } - else { + } else { $value = quotedPrintDecode(preg_replace('/^ENCODING=QUOTED-PRINTABLE:/i', '', $tmpvalue.$value)); } } //$value=quotedPrintDecode($tmpvalue.$value); @@ -235,8 +233,7 @@ class ICal if (stristr($key, "DTSTART;VALUE=DATE") || stristr($key, "DTEND;VALUE=DATE")) { list($key, $value) = array($key, $value); - } - else { + } else { list($key, $value) = $this->ical_dt_date($key, $value); } } @@ -375,8 +372,7 @@ class ICal { usort($temp, array(&$this, "ical_dtstart_compare")); return $temp; - } - else { + } else { return false; } } diff --git a/htdocs/comm/action/document.php b/htdocs/comm/action/document.php index 3bd141ca964..fa4387b0861 100644 --- a/htdocs/comm/action/document.php +++ b/htdocs/comm/action/document.php @@ -215,8 +215,7 @@ if ($object->id > 0) } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -262,8 +261,7 @@ if ($object->id > 0) $permission = $user->rights->agenda->myactions->create || $user->rights->agenda->allactions->create; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7b45b3f6ceb..b83a374d1a3 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -95,8 +95,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST('search_actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -459,13 +458,11 @@ if (!empty($conf->use_javascript_ajax)) // If javascript on if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } -} -else // If javascript off +} else // If javascript off { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/showbirthday=[0-1]/i', 'showbirthday='.(empty($showbirthday) ? 1 : 0), $newparam); @@ -515,16 +512,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -548,8 +543,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before @@ -645,8 +639,7 @@ if ($resql) $event->date_start_in_calendar >= $lastdaytoshow) { // This record is out of visible range - } - else { + } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar = ($lastdaytoshow - 1); @@ -667,16 +660,14 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } $i++; } -} -else { +} else { dol_print_error($db); } @@ -692,8 +683,7 @@ if ($showbirthday) { $sql .= ' AND MONTH(birthday) = '.$month; $sql .= ' AND DAY(birthday) = '.$day; - } - else { + } else { $sql .= ' AND MONTH(birthday) = '.$month; } $sql .= ' ORDER BY birthday'; @@ -735,12 +725,10 @@ if ($showbirthday) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); $i++; } - } - else { + } else { dol_print_error($db); } } @@ -757,12 +745,10 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) { // Request only leaves for the current selected day $sql .= " AND '".$year."-".$month."-".$day."' BETWEEN x.date_debut AND x.date_fin"; - } - elseif ($action == 'show_week') + } elseif ($action == 'show_week') { // TODO: Add filter to reduce database request - } - elseif ($action == 'show_month') + } elseif ($action == 'show_month') { // TODO: Add filter to reduce database request } @@ -795,8 +781,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) { // Show no symbol for leave with state "leave approved" $event->percentage = -1; - } - elseif ($obj->status == 2) + } elseif ($obj->status == 2) { // Show TO-DO symbol for leave with state "leave wait for approval" $event->percentage = 0; @@ -805,12 +790,10 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) if ($obj->halfday == 1) { $event->label = $obj->lastname.' ('.$langs->trans("Morning").')'; - } - elseif ($obj->halfday == -1) + } elseif ($obj->halfday == -1) { $event->label = $obj->lastname.' ('.$langs->trans("Afternoon").')'; - } - else { + } else { $event->label = $obj->lastname; } @@ -823,9 +806,7 @@ if ($conf->global->AGENDA_SHOW_HOLIDAYS) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; - } - - while ($daykey <= $event->date_end_in_calendar); + } while ($daykey <= $event->date_end_in_calendar); $i++; } @@ -867,8 +848,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 - } - elseif (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']; @@ -888,8 +868,7 @@ if (count($listofextcals)) } // datecurstart and datecurend are now GMT date //var_dump($datecurstart); var_dump($datecurend); exit; - } - else { + } else { // Not a recongized record dol_syslog("Found a not recognized repeatable record with unknown date start", LOG_ERR); continue; @@ -913,8 +892,7 @@ if (count($listofextcals)) { $newevent['DTSTART;VALUE=DATE'] = dol_print_date($datecurstart, '%Y%m%d'); $newevent['DTEND;VALUE=DATE'] = dol_print_date($datecurend + 1, '%Y%m%d'); - } - else { + } else { $newevent['DTSTART'] = $datecurstart; $newevent['DTEND'] = $datecurend; } @@ -932,13 +910,11 @@ if (count($listofextcals)) { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'w'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'w'); - } - elseif ($icalevent['RRULE']['FREQ'] == 'MONTHLY') + } elseif ($icalevent['RRULE']['FREQ'] == 'MONTHLY') { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'm'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'm'); - } - elseif ($icalevent['RRULE']['FREQ'] == 'YEARLY') + } elseif ($icalevent['RRULE']['FREQ'] == 'YEARLY') { $datecurstart = dol_time_plus_duree($datecurstart, $interval, 'y'); $datecurend = dol_time_plus_duree($datecurend, $interval, 'y'); @@ -975,8 +951,7 @@ if (count($listofextcals)) //print dol_print_date($dateend,'dayhour','gmt'); $event->fulldayevent = 1; $addevent = true; - } - elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) + } elseif (!is_array($icalevent['DTSTART'])) // not fullday event (DTSTART is not array. It is a value like '19700101T000000Z' for 00:00 in greenwitch) { $datestart = $icalevent['DTSTART']; $dateend = $icalevent['DTEND']; @@ -987,8 +962,7 @@ if (count($listofextcals)) $addevent = true; //var_dump($offsettz); //var_dump(dol_print_date($datestart, 'dayhour', 'gmt')); - } - elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) + } elseif (isset($icalevent['DTSTART']['unixtime'])) // File contains a local timezone + a TZ (for example when using bluemind) { $datestart = $icalevent['DTSTART']['unixtime']; $dateend = $icalevent['DTEND']['unixtime']; @@ -1050,8 +1024,7 @@ if (count($listofextcals)) //print 'x'.$datestart.'-'.$dateend;exit; //print 'x'.$datestart.'-'.$dateend;exit; // This record is out of visible range - } - else { + } else { if ($event->date_start_in_calendar < $firstdaytoshow) $event->date_start_in_calendar = $firstdaytoshow; if ($event->date_end_in_calendar >= $lastdaytoshow) $event->date_end_in_calendar = ($lastdaytoshow - 1); @@ -1071,8 +1044,7 @@ if (count($listofextcals)) $eventarray[$daykey][] = $event; $daykey += 60 * 60 * 24; $daykeygmt += 60 * 60 * 24; // Add one day if (($event->fulldayevent ? $daykeygmt : $daykey) > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); } } } @@ -1141,8 +1113,7 @@ if (empty($action) || $action == 'show_month') // View by month { $labelshort = array(0=>'SundayMin', 1=>'MondayMin', 2=>'TuesdayMin', 3=>'WednesdayMin', 4=>'ThursdayMin', 5=>'FridayMin', 6=>'SaturdayMin'); print $langs->trans($labelshort[$numdayinweek]); - } - else print $langs->trans("Day".$numdayinweek); + } else print $langs->trans("Day".$numdayinweek); print ' '."\n"; $i++; } @@ -1200,8 +1171,7 @@ if (empty($action) || $action == 'show_month') // View by month print ''; print ''; print ''; -} -elseif ($action == 'show_week') // View by week +} elseif ($action == 'show_week') // View by week { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/showbirthday=/i', 'showbirthday_=', $newparam); // To avoid replacement when replace day= is done @@ -1255,8 +1225,7 @@ elseif ($action == 'show_week') // View by week echo ''; echo ''; echo ''; -} -else // View by day +} else // View by day { $newparam = $param; // newparam is for birthday links $newparam = preg_replace('/action=show_month&?/i', '', $newparam); @@ -1330,8 +1299,7 @@ else // View by day show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 1); print '
'; - } - else { + } else { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table show_day_events($db, $day, $month, $year, $month, $style, $eventarray, 0, $maxnbofchar, $newparam, 1, 300, 0); @@ -1452,8 +1420,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; - } - elseif ($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)) { @@ -1465,12 +1432,10 @@ 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'); - } - elseif ($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]); - } - else { + } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); @@ -1494,8 +1459,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -1510,8 +1474,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'AC_OTH_AUTO') { $cssclass .= " unmovable"; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $cssclass .= " unmovable"; } elseif ($event->date_end_in_calendar && date('Ymd', $event->date_start_in_calendar) != date('Ymd', $event->date_end_in_calendar)) { @@ -1522,8 +1485,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa { $cssclass .= " unmovable"; } - } - else { + } else { if ($user->rights->agenda->allactions->create || (($event->authorid == $user->id || $event->userownerid == $user->id) && $user->rights->agenda->myactions->create)) { @@ -1557,8 +1519,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if (empty($event->transparency) && empty($conf->global->AGENDA_NO_TRANSPARENT_ON_NOT_BUSY)) { print 'border: 2px solid #'.$colortouse.';'; - } - else { + } else { print 'background: #'.$colortouse.';'; print 'background: -webkit-gradient(linear, left top, left bottom, from(#'.dol_color_minus($colortouse, -3).'), to(#'.dol_color_minus($colortouse, -1).'));'; } @@ -1577,12 +1538,10 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($event->type_code == 'BIRTHDAY') // It's a birthday { print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'birthday', 'contact'); - } - elseif ($event->type_code == 'HOLIDAY') + } elseif ($event->type_code == 'HOLIDAY') { print $event->getNomUrl(1, $maxnbofchar, 'cal_event', 'holiday', 'user'); - } - elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') + } elseif ($event->type_code != 'BIRTHDAY' && $event->type_code != 'HOLIDAY') { // Picto if (empty($event->fulldayevent)) @@ -1625,8 +1584,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa if ($tmpyearend == $annee && $tmpmonthend == $mois && $tmpdayend == $jour) $daterange .= dol_print_date($event->date_end_in_calendar, '%H:%M'); // Il faudrait utiliser ici tzuser, mais si on ne peut pas car qd on rentre un date dans fiche action, en input la conversion local->gmt se base sur le TZ server et non user } - } - else { + } else { if ($showinfo) { print $langs->trans("EventOnFullDay")."
\n"; @@ -1681,8 +1639,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $thirdparty = new Societe($db); $thirdparty->fetch($thirdparty_id); $cachethirdparties[$thirdparty_id] = $thirdparty; - } - else $thirdparty = $cachethirdparties[$thirdparty_id]; + } else $thirdparty = $cachethirdparties[$thirdparty_id]; if (!empty($thirdparty->id)) $linerelatedto .= $thirdparty->getNomUrl(1, '', 0); } if (!empty($contact_id) && $contact_id > 0) @@ -1692,8 +1649,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa $contact = new Contact($db); $contact->fetch($contact_id); $cachecontacts[$contact_id] = $contact; - } - else $contact = $cachecontacts[$contact_id]; + } else $contact = $cachecontacts[$contact_id]; if ($linerelatedto) $linerelatedto .= ' '; if (!empty($contact->id)) $linerelatedto .= $contact->getNomUrl(1, '', 0); } @@ -1730,8 +1686,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa print ''; print '
'."\n"; $i++; - } - else { + } else { print 'global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -282,16 +281,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND c.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND c.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND c.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND c.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND c.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND c.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -413,8 +410,7 @@ if ($resql) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -564,8 +560,7 @@ if ($resql) { $userstatic->fetch($obj->fk_user_action); print $userstatic->getNomUrl(-1); - } - else print ' '; + } else print ' '; print ''; } @@ -580,8 +575,7 @@ if ($resql) { if ($actioncomm->type_picto) { $imgpicto = img_picto('', $actioncomm->type_picto); - } - else { + } else { if ($actioncomm->type_code == 'AC_RDV') $imgpicto = img_picto('', 'object_group', '', false, 0, 0, '', 'paddingright').' '; elseif ($actioncomm->type_code == 'AC_TEL') $imgpicto = img_picto('', 'object_phoning', '', false, 0, 0, '', 'paddingright').' '; elseif ($actioncomm->type_code == 'AC_FAX') $imgpicto = img_picto('', 'object_phoning_fax', '', false, 0, 0, '', 'paddingright').' '; @@ -649,8 +643,7 @@ if ($resql) $societestatic->email = $obj->socemail; print $societestatic->getNomUrl(1, '', 28); - } - else print ' '; + } else print ' '; print ''; } @@ -672,8 +665,7 @@ if ($resql) $contactListCache[$socpeopleassigned['id']] = $contact->getNomUrl(1, '', 0); $contactList[] = $contact->getNomUrl(1, '', 0); } - } - else { + } else { // use cache $contactList[] = $contactListCache[$socpeopleassigned['id']]; } @@ -681,8 +673,7 @@ if ($resql) if (!empty($contactList)) { print implode(', ', $contactList); } - } - elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event + } elseif ($obj->fk_contact > 0) //keep for retrocompatibility with faraway event { $contactstatic->id = $obj->fk_contact; $contactstatic->email = $obj->email; @@ -693,8 +684,7 @@ if ($resql) $contactstatic->phone_perso = $obj->phone_perso; $contactstatic->country_id = $obj->country_id; print $contactstatic->getNomUrl(1, '', 0); - } - else { + } else { print " "; } print ''; @@ -744,8 +734,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/action/pertype.php b/htdocs/comm/action/pertype.php index bc859ba6d2d..a769d709c4d 100644 --- a/htdocs/comm/action/pertype.php +++ b/htdocs/comm/action/pertype.php @@ -93,8 +93,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -328,8 +327,7 @@ if ($conf->use_javascript_ajax) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -375,8 +373,7 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { @@ -402,8 +399,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate(dol_mktime(0, 0, 0, 1, 1, $year) - (60 * 60 * 24 * 7))."'"; // Start 7 days before @@ -485,8 +481,7 @@ if ($resql) $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; - } - else { + } else { $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; @@ -503,8 +498,7 @@ if ($resql) { // This record is out of visible range unset($event); - } - else { + } else { //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'
'."\n"; $event->fetch_userassigned(); // This load $event->userassigned @@ -528,16 +522,14 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; } $i++; } -} -else { +} else { dol_print_error($db); } @@ -799,8 +791,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; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $numical++; if (!empty($event->icalname)) @@ -813,12 +804,10 @@ 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'); - } - elseif ($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]); - } - else { + } else { $numother++; $cssclass = 'family_other'; if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) $color = $event->type_color; } @@ -830,8 +819,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -949,8 +937,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); } } - } - else { + } else { $busy = $event->transparency; $cases1[$h][$event->id]['busy'] = $busy; $cases2[$h][$event->id]['busy'] = $busy; @@ -1013,8 +1000,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); if ($output[0]['string']) $title1 .= ($title1 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; - } - elseif (count($cases1[$h]) > 1) + } elseif (count($cases1[$h]) > 1) { $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); $color1 = '222222'; @@ -1026,8 +1012,7 @@ function show_day_events_pertype($username, $day, $month, $year, $monthshown, $s $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); if ($output[0]['string']) $title2 .= ($title2 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; - } - elseif (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 da5020cef39..dfb756dd227 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -94,8 +94,7 @@ if (GETPOST('search_actioncode', 'array')) { $actioncode = GETPOST('search_actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("search_actioncode", "alpha", 3) ?GETPOST("search_actioncode", "alpha", 3) : (GETPOST("search_actioncode", "alpha") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE)); } if ($actioncode == '' && empty($actioncodearray)) $actioncode = (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE); @@ -375,8 +374,7 @@ if ($conf->use_javascript_ajax) if (empty($reshook)) { $s .= $hookmanager->resPrint; - } - elseif ($reshook > 1) + } elseif ($reshook > 1) { $s = $hookmanager->resPrint; } @@ -434,16 +432,14 @@ if (!empty($actioncode)) if ($actioncode == 'AC_OTH') $sql .= " AND ca.type != 'systemauto'"; if ($actioncode == 'AC_OTH_AUTO') $sql .= " AND ca.type = 'systemauto'"; } - } - else { + } else { if ($actioncode == 'AC_NON_AUTO') $sql .= " AND ca.type != 'systemauto'"; elseif ($actioncode == 'AC_ALL_AUTO') $sql .= " AND ca.type = 'systemauto'"; else { if (is_array($actioncode)) { $sql .= " AND ca.code IN ('".implode("','", $actioncode)."')"; - } - else { + } else { $sql .= " AND ca.code IN ('".implode("','", explode(',', $actioncode))."')"; } } @@ -467,8 +463,7 @@ if ($action == 'show_day') $sql .= " (a.datep < '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."'"; $sql .= " AND a.datep2 > '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."')"; $sql .= ')'; -} -else { +} else { // To limit array $sql .= " AND ("; $sql .= " (a.datep BETWEEN '".$db->idate($firstdaytoshow - (60 * 60 * 24 * 2))."'"; // Start 2 day before $firstdaytoshow @@ -551,8 +546,7 @@ if ($resql) $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; - } - else { + } else { $event->date_start_in_calendar = $datep; if ($datep2 != '' && $datep2 >= $datep) $event->date_end_in_calendar = $datep2; else $event->date_end_in_calendar = $datep; @@ -569,8 +563,7 @@ if ($resql) { // This record is out of visible range unset($event); - } - else { + } else { //print $i.' - '.dol_print_date($this->date_start_in_calendar, 'dayhour').' - '.dol_print_date($this->date_end_in_calendar, 'dayhour').'
'."\n"; $event->fetch_userassigned(); // This load $event->userassigned @@ -594,8 +587,7 @@ if ($resql) $daykey += 60 * 60 * 24; if ($daykey > $event->date_end_in_calendar) $loop = false; - } - while ($loop); + } while ($loop); //print 'Event '.$i.' id='.$event->id.' (start='.dol_print_date($event->datep).'-end='.dol_print_date($event->datef); //print ' startincalendar='.dol_print_date($event->date_start_in_calendar).'-endincalendar='.dol_print_date($event->date_end_in_calendar).') was added in '.$j.' different index key of array
'; @@ -603,8 +595,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -732,8 +723,7 @@ while ($currentdaytoshow < $lastdaytoshow) { $i++; } } - } - else dol_print_error($db); + } else dol_print_error($db); } //var_dump($usernamesid); foreach ($usernamesid as $id) @@ -981,8 +971,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if (!empty($cacheusers[$event->userownerid]->color)) $color = $cacheusers[$event->userownerid]->color; if (!empty($conf->global->AGENDA_USE_COLOR_PER_EVENT_TYPE)) $color = $event->type_color; - } - elseif ($event->type_code == 'ICALEVENT') + } elseif ($event->type_code == 'ICALEVENT') { $numical++; if (!empty($event->icalname)) @@ -995,12 +984,10 @@ 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'); - } - elseif ($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]); - } - else { + } else { $numother++; $color = ($event->icalcolor ? $event->icalcolor : -1); $cssclass = (!empty($event->icalname) ? 'family_ext'.md5($event->icalname) : 'family_other'); @@ -1026,8 +1013,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & if (isset($colorindexused[$idusertouse])) { $colorindex = $colorindexused[$idusertouse]; // Color already assigned to this user - } - else { + } else { $colorindex = $nextindextouse; $colorindexused[$idusertouse] = $colorindex; if (!empty($theme_datacolor[$nextindextouse + 1])) $nextindextouse++; // Prepare to use next color @@ -1145,8 +1131,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $cases2[$h][$event->id]['string'] .= ', '.$cachecontacts[$event->contactid]->getFullName($langs); } } - } - else { + } else { $busy = $event->transparency; $cases1[$h][$event->id]['busy'] = $busy; $cases2[$h][$event->id]['busy'] = $busy; @@ -1210,8 +1195,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); if ($output[0]['string']) $title1 .= ($title1 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color1 = $output[0]['color']; - } - elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) + } elseif (is_array($cases1[$h]) && count($cases1[$h]) > 1) { $title1 = $langs->trans("Ref").' '.$ids1.($title1 ? ' - '.$title1 : ''); $color1 = '222222'; @@ -1223,8 +1207,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, & $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); if ($output[0]['string']) $title2 .= ($title2 ? ' - ' : '').$output[0]['string']; if ($output[0]['color']) $color2 = $output[0]['color']; - } - elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) + } elseif (is_array($cases2[$h]) && count($cases2[$h]) > 1) { $title2 = $langs->trans("Ref").' '.$ids2.($title2 ? ' - '.$title2 : ''); $color2 = '222222'; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index c3192f2286e..35c0f7a890e 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -186,8 +186,7 @@ if ($resql) print ''; print ''.dol_print_date(dol_filemtime($file), 'dayhour').''; print ''.dol_print_size(dol_filesize($file)).''; - } - else { + } else { print ' '; print ' '; print ' '; @@ -202,8 +201,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 17eae67eb2e..b3b11a95a36 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -330,8 +330,7 @@ if ($object->id > 0) if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id', 1); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->cond_reglement_id, 'none'); } print ""; @@ -348,8 +347,7 @@ if ($object->id > 0) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->mode_reglement_id, 'none'); } print ""; @@ -368,8 +366,7 @@ if ($object->id > 0) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_account, 'none'); } print ""; @@ -475,8 +472,7 @@ if ($object->id > 0) if ($action == 'editshipping') { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1); - } - else { + } else { $form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->shipping_method_id, 'none'); } print ""; @@ -513,8 +509,7 @@ if ($object->id > 0) { $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); - } - else { + } else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print ''; @@ -541,8 +536,7 @@ if ($object->id > 0) if ($action == 'editlevel') { $formcompany->form_prospect_level($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->fk_prospectlevel, 'prospect_level_id', 1); - } - else { + } else { print $object->getLibProspLevel(); } print ""; @@ -725,8 +719,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -810,8 +803,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -952,8 +944,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1012,8 +1003,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1082,13 +1072,11 @@ if ($object->id > 0) if ($objp->frequency && $objp->date_last_gen > 0) { print ''.dol_print_date($db->jdate($objp->date_last_gen), 'day').''; - } - else { + } else { if ($objp->dc > 0) { print ''.dol_print_date($db->jdate($objp->dc), 'day').''; - } - else { + } else { print '!!!'; } } @@ -1117,8 +1105,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1181,8 +1168,7 @@ if ($object->id > 0) if ($objp->df > 0) { print ''.dol_print_date($db->jdate($objp->df), 'day').''; - } - else { + } else { print '!!!'; } print ''; @@ -1207,8 +1193,7 @@ if ($object->id > 0) print ""; print ''; } - } - else { + } else { dol_print_error($db); } } @@ -1273,8 +1258,7 @@ if ($object->id > 0) if (empty($user->rights->facture->creer)) { print '
'; - } - else { + } else { $langs->load("bills"); $langs->load("orders"); @@ -1284,8 +1268,7 @@ if ($object->id > 0) { if (!empty($orders2invoice) && $orders2invoice > 0) print ''; else print ''; - } - else print ''; + } else print ''; } if ($object->client != 0 && $object->client != 2) print ''; @@ -1300,8 +1283,7 @@ if ($object->id > 0) if ($user->rights->agenda->myactions->create) { print ''; - } - else { + } else { print ''; } } @@ -1325,8 +1307,7 @@ if ($object->id > 0) // List of done actions show_actions_done($conf, $langs, $db, $object); } -} -else { +} else { $langs->load("errors"); print $langs->trans('ErrorRecordNotFound'); } diff --git a/htdocs/comm/contact.php b/htdocs/comm/contact.php index da7248dbecb..d3075916367 100644 --- a/htdocs/comm/contact.php +++ b/htdocs/comm/contact.php @@ -170,8 +170,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 99eddda9cad..b542a110832 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -209,20 +209,17 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoProposal").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -295,20 +292,17 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoProposal").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -375,8 +369,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } $i++; @@ -385,21 +378,18 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoOrder").''; } print ""; print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -466,8 +456,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } $i++; @@ -476,13 +465,11 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } - } - else { + } else { print ''.$langs->trans("NoSupplierOrder").''; } print ""; @@ -563,8 +550,7 @@ if (!empty($conf->societe->enabled) && $user->rights->societe->lire) } $db->free($resql); - } - else { + } else { print ''.$langs->trans("None").''; } print ""; @@ -621,8 +607,7 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print ''; @@ -708,8 +693,7 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TOD print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } @@ -795,8 +779,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } print ''.$propalstatic->LibStatut($obj->fk_statut, 3).''."\n"; @@ -807,16 +790,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propal->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } @@ -902,8 +883,7 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) print dol_print_date($db->jdate($obj->dp), 'day').''."\n"; if (!empty($conf->global->MAIN_DASHBOARD_USE_TOTAL_HT)) { print ''.price($obj->total_ht).''; - } - else { + } else { print ''.price($obj->total_ttc).''; } print ''.$orderstatic->LibStatut($obj->fk_statut, $obj->billed, 3).''."\n"; @@ -914,16 +894,14 @@ if (!empty($conf->commande->enabled) && $user->rights->commande->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/mailing/advtargetemailing.php b/htdocs/comm/mailing/advtargetemailing.php index d16c3e9e7da..da24f7bcb4f 100644 --- a/htdocs/comm/mailing/advtargetemailing.php +++ b/htdocs/comm/mailing/advtargetemailing.php @@ -87,8 +87,7 @@ if (empty($template_id)) { if ($result < 0) { setEventMessages($advTarget->error, $advTarget->errors, 'errors'); -} -else { +} else { if (!empty($advTarget->id)) { $array_query = json_decode($advTarget->filtervalue, true); } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 1e7f5fa6385..fff6140a2aa 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -93,15 +93,13 @@ if (empty($reshook)) if (!GETPOST("clone_content", 'alpha') && !GETPOST("clone_receivers", 'alpha')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { $result = $object->createFromClone($user, $object->id, GETPOST("clone_content", 'alpha'), GETPOST("clone_receivers", 'alpha')); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -118,13 +116,11 @@ if (empty($reshook)) setEventMessages('', null, 'warnings'); setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); $action = ''; - } - elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + } elseif ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { setEventMessages($langs->trans("NotEnoughPermissions"), null, 'warnings'); $action = ''; - } - else { + } else { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); if ($object->statut == 0) @@ -232,8 +228,7 @@ if (empty($reshook)) $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); $substitutionarray['__SECUREKEYPAYMENT_CONTRACTLINE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); - } - else { + } else { $substitutionarray['__SECUREKEYPAYMENT_MEMBER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_ORDER__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'order'.$obj->source_id, 2); $substitutionarray['__SECUREKEYPAYMENT_INVOICE__'] = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'invoice'.$obj->source_id, 2); @@ -312,8 +307,7 @@ if (empty($reshook)) if (!$resql2) { dol_print_error($db); - } - else { + } else { //if cheack read is use then update prospect contact status if (strpos($message, '__CHECK_READ__') !== false) { @@ -345,8 +339,7 @@ if (empty($reshook)) } //test if CHECK READ change statut prospect contact - } - else { + } else { // Mail failed $nbko++; @@ -363,8 +356,7 @@ if (empty($reshook)) $i++; } - } - else { + } else { setEventMessages($langs->transnoentitiesnoconv("NoMoreRecipientToSendTo"), null, 'mesgs'); } @@ -374,14 +366,12 @@ if (empty($reshook)) $statut = 2; // Status 'sent partially' (because at least one error) if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); - } - else { + } else { if ($nbok >= $num) { $statut = 3; // Send to everybody setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); - } - else { + } else { $statut = 2; // Status 'sent partially' (because not send to everybody) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients", $nbok), null, 'mesgs'); } @@ -394,8 +384,7 @@ if (empty($reshook)) { dol_print_error($db); } - } - else { + } else { dol_syslog($db->error()); dol_print_error($db); } @@ -462,8 +451,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("MailSuccessfulySent", $mailfile->getValidAddress($object->email_from, 2), $mailfile->getValidAddress($object->sendto, 2)), null, 'mesgs'); $action = ''; - } - else { + } else { setEventMessages($langs->trans("ResultKo").'
'.$mailfile->error.' '.$result, null, 'errors'); $action = 'test'; } @@ -600,8 +588,7 @@ if (empty($reshook)) setEventMessages($mesg, $mesgs, 'errors'); $action = "edit"; - } - else { + } else { $action = "edit"; } } @@ -615,8 +602,7 @@ if (empty($reshook)) setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -632,12 +618,10 @@ if (empty($reshook)) //setEventMessages($langs->trans("MailingSuccessfullyValidated"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { dol_print_error($db); } } @@ -660,13 +644,11 @@ if (empty($reshook)) $db->commit(); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } - } - else { + } else { dol_print_error($db); } } @@ -766,8 +748,7 @@ if ($action == 'create') print '
'; print ''; -} -else { +} else { if ($object->id > 0) { $upload_dir = $conf->mailing->dir_output."/".get_exdir($object->id, 2, 0, 1, $object, 'mailing'); @@ -823,8 +804,7 @@ else { setEventMessages($langs->trans("MailSendSetupIs2", $linktoadminemailbefore, $linktoadminemailend, $langs->transnoentitiesnoconv("MAIN_MAIL_SENDMODE"), $listofmethods['smtps']), null, 'warnings'); 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"] = ''; - } - elseif ($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'); @@ -837,8 +817,7 @@ else { setEventMessages($langs->trans("MailingNeedCommand2"), null, 'warnings'); // You can send online with constant... } $_GET["action"] = ''; - } - else { + } else { 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'); @@ -920,8 +899,7 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -929,8 +907,7 @@ else { if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -977,8 +954,7 @@ else { if (!empty($conf->fckeditor->enabled) && !empty($conf->global->FCKEDITOR_ENABLE_MAILING)) { print ''.$langs->trans("EditWithEditor").''; - } - else { + } else { print ''.$langs->trans("EditWithTextEditor").''; } @@ -990,8 +966,7 @@ else { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("TestMailing").''; - } - else { + } else { print ''.$langs->trans("TestMailing").''; } @@ -1000,12 +975,10 @@ else { if ($object->nbemail <= 0) { print ''.$langs->trans("ValidMailing").''; - } - elseif (empty($user->rights->mailing->valider)) + } elseif (empty($user->rights->mailing->valider)) { print ''.$langs->trans("ValidMailing").''; - } - else { + } else { print ''.$langs->trans("ValidMailing").''; } } @@ -1015,12 +988,10 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { print ''.$langs->trans("SendMailing").''; - } - elseif (!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").''; - } - else { + } else { print ''.$langs->trans("SendMailing").''; } } @@ -1035,8 +1006,7 @@ else { if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("ResetMailing").''; - } - else { + } else { print ''.$langs->trans("ResetMailing").''; } } @@ -1046,8 +1016,7 @@ else { if ($object->statut > 0 && (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !$user->rights->mailing->mailing_advance->delete)) { print ''.$langs->trans("DeleteMailing").''; - } - else { + } else { print ''.$langs->trans("DeleteMailing").''; } } @@ -1126,8 +1095,7 @@ else { print img_mime($listofpaths[$key]['name']).' '.$listofpaths[$key]['name']; print '
'; } - } - else { + } else { print ''.$langs->trans("NoAttachedFiles").'
'; } print ''; @@ -1148,13 +1116,11 @@ else { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor('bodyemail', $object->body, '', 600, 'dolibarr_mailings', '', false, true, empty($conf->global->FCKEDITOR_ENABLE_MAILING) ? 0 : 1, 20, '90%', $readonly); $doleditor->Create(); - } - else print dol_htmlentitiesbr($object->body); + } else print dol_htmlentitiesbr($object->body); print ''; dol_fiche_end(); - } - else { + } else { /* * Mailing en mode edition (CKeditor or HTML source) */ @@ -1200,8 +1166,7 @@ else { if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -1209,8 +1174,7 @@ else { if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -1284,8 +1248,7 @@ else { $out .= ' '; $out .= '
'; } - } - else { + } else { $out .= $langs->trans("NoAttachedFiles").'
'; } // Add link to add file @@ -1334,8 +1297,7 @@ else { print ''; print '
'; } - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index e89a645cf20..27e0c2e5b0c 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -160,8 +160,7 @@ if (GETPOST('exportcsv', 'int')) } exit; - } - else { + } else { dol_print_error($db); } exit; @@ -180,13 +179,11 @@ if ($action == 'delete') $obj->update_nb($id); setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - } - else { + } else { header("Location: list.php"); exit; } - } - else { + } else { dol_print_error($db); } } @@ -290,8 +287,7 @@ if ($object->fetch($id) >= 0) if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { $text .= $langs->trans('LimitSendingEmailing', $conf->global->MAILING_LIMIT_SENDBYWEB); - } - else { + } else { $text .= $langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } @@ -299,8 +295,7 @@ if ($object->fetch($id) >= 0) if ($text) { print $form->textwithpicto($nbemail, $text, 1, 'warning'); - } - else { + } else { print $nbemail; } } @@ -400,8 +395,7 @@ if ($object->fetch($id) >= 0) { print '
'; print ''; - } - else { + } else { print '
'; } @@ -414,8 +408,7 @@ if ($object->fetch($id) >= 0) try { $nbofrecipient = $obj->getNbOfRecipients(''); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -424,8 +417,7 @@ if ($object->fetch($id) >= 0) if ($nbofrecipient >= 0) { print $nbofrecipient; - } - else { + } else { print $langs->trans("Error").' '.img_error($obj->error); } print '
'; @@ -435,8 +427,7 @@ if ($object->fetch($id) >= 0) { try { $filter = $obj->formFilter(); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -449,8 +440,7 @@ if ($object->fetch($id) >= 0) if ($allowaddtarget) { print ''; - } - else { + } else { print ''; //print $langs->trans("MailNoChangePossible"); print " "; @@ -624,29 +614,24 @@ if ($object->fetch($id) >= 0) if (empty($obj->source_id) || empty($obj->source_type)) { print empty($obj->source_url) ? '' : $obj->source_url; // For backward compatibility - } - else { + } else { if ($obj->source_type == 'member') { $objectstaticmember->fetch($obj->source_id); print $objectstaticmember->getNomUrl(1); - } - elseif ($obj->source_type == 'user') + } elseif ($obj->source_type == 'user') { $objectstaticuser->fetch($obj->source_id); print $objectstaticuser->getNomUrl(1); - } - elseif ($obj->source_type == 'thirdparty') + } elseif ($obj->source_type == 'thirdparty') { $objectstaticcompany->fetch($obj->source_id); print $objectstaticcompany->getNomUrl(1); - } - elseif ($obj->source_type == 'contact') + } elseif ($obj->source_type == 'contact') { $objectstaticcontact->fetch($obj->source_id); print $objectstaticcontact->getNomUrl(1); - } - else { + } else { print $obj->source_url; } } @@ -666,8 +651,7 @@ if ($object->fetch($id) >= 0) print ''; print $object::libStatutDest($obj->statut, 2, ''); print ''; - } - else { + } else { // Date sent print ''.$obj->date_envoi.''; @@ -693,8 +677,7 @@ if ($object->fetch($id) >= 0) $i++; } - } - else { + } else { if ($object->statut < 2) { print ''; @@ -708,8 +691,7 @@ if ($object->fetch($id) >= 0) print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/comm/mailing/class/advtargetemailing.class.php b/htdocs/comm/mailing/class/advtargetemailing.class.php index dd6f59e80b9..983ad374980 100644 --- a/htdocs/comm/mailing/class/advtargetemailing.class.php +++ b/htdocs/comm/mailing/class/advtargetemailing.class.php @@ -165,8 +165,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -220,8 +219,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -282,8 +280,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -348,8 +345,7 @@ class AdvanceTargetingMailing extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -407,8 +403,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -448,8 +443,7 @@ class AdvanceTargetingMailing extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -683,8 +677,7 @@ class AdvanceTargetingMailing extends CommonObject if (!empty($arrayquery['contact_no_email'])) { $tmpwhere .= "(t.email IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; - } - else { + } else { $tmpwhere .= "(t.email NOT IN (SELECT email FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE t.entity IN (".getEntity('mailing').") AND email = '".$this->db->escape($arrayquery['contact_no_email'])."'))"; } $sqlwhere[] = $tmpwhere; diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index fd674945beb..e6f928d539f 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -314,8 +314,7 @@ class FormAdvTargetEmailing extends Form $i++; } } - } - else { + } else { dol_print_error($this->db); } @@ -399,8 +398,7 @@ class FormAdvTargetEmailing extends Form $i++; } } - } - else { + } else { dol_print_error($this->db); } diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index a6c44c96a8d..1bb4864876c 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -144,16 +144,14 @@ class Mailing extends CommonObject if ($this->update($user) > 0) { $this->db->commit(); - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -184,8 +182,7 @@ class Mailing extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -250,13 +247,11 @@ class Mailing extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; - } - else { + } else { dol_syslog(get_class($this)."::fetch Erreur -1"); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Erreur -2"); return -2; } @@ -363,8 +358,7 @@ class Mailing extends CommonObject ); } } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -380,8 +374,7 @@ class Mailing extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -405,8 +398,7 @@ class Mailing extends CommonObject if ($this->db->query($sql)) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -429,8 +421,7 @@ class Mailing extends CommonObject if ($resql) { return $this->delete_targets(); - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -453,8 +444,7 @@ class Mailing extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return 0; } @@ -480,8 +470,7 @@ class Mailing extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -511,8 +500,7 @@ class Mailing extends CommonObject { $obj = $this->db->fetch_object($resql); if ($obj) return $obj->nb; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -572,8 +560,7 @@ class Mailing extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index edcb12d1bb2..cf439e4314b 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -129,8 +129,7 @@ if (is_resource($handle)) } $db->free($result); - } - else { + } else { dol_print_error($db); } print ''; @@ -190,14 +189,12 @@ if ($result) { print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index dcba1333b11..d22dd130507 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -130,8 +130,7 @@ if ($filteremail) if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; -} -else { +} else { $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql .= " WHERE m.entity = ".$conf->entity; @@ -273,8 +272,7 @@ if ($resql) if ($filteremail) { print $email::libStatutDest($obj->sendstatut, 2); - } - else { + } else { print $email->LibStatut($obj->statut, 5); } print ''; @@ -295,8 +293,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/multiprix.php b/htdocs/comm/multiprix.php index 964663a976b..cd5d5c9ace9 100644 --- a/htdocs/comm/multiprix.php +++ b/htdocs/comm/multiprix.php @@ -152,8 +152,7 @@ if ($_socid > 0) } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 6b9ed10f18a..a2d27943c89 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -161,8 +161,7 @@ if (empty($reshook)) if (!GETPOST('socid', 3)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY)) { //Get difference between old and new delivery date and change lines according to difference @@ -268,9 +267,7 @@ if (empty($reshook)) if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); } - } - - elseif ($action == 'setdate' && $usercancreate) + } elseif ($action == 'setdate' && $usercancreate) { $datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']); @@ -284,14 +281,12 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $object->error); } - } - elseif ($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); - } - elseif ($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) @@ -600,13 +595,11 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit(); - } - else { + } else { $db->rollback(); $action = 'create'; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action = 'create'; @@ -630,8 +623,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -657,8 +649,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -682,8 +673,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -705,8 +695,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -758,8 +747,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -798,9 +786,7 @@ if (empty($reshook)) $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - - elseif ($action == "setabsolutediscount" && $usercancreate) { + } elseif ($action == "setabsolutediscount" && $usercancreate) { if ($_POST["remise_id"]) { if ($object->id > 0) { $result = $object->insert_discount($_POST["remise_id"]); @@ -823,8 +809,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -956,8 +941,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } 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. @@ -981,8 +965,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } 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. @@ -1309,9 +1292,7 @@ if (empty($reshook)) } 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(); - } - - elseif ($action == 'classin' && $usercancreate) { + } elseif ($action == 'classin' && $usercancreate) { // Set project $object->setProject(GETPOST('projectid', 'int')); } @@ -1329,13 +1310,9 @@ if (empty($reshook)) // Terms of payment elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - } - - elseif ($action == 'setremisepercent' && $usercancreate) { + } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); - } - - elseif ($action == 'setremiseabsolue' && $usercancreate) { + } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); } @@ -1362,9 +1339,7 @@ if (empty($reshook)) // shipping method elseif ($action == 'setshippingmethod' && $usercancreate) { $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); - } - - elseif ($action == 'update_extras') { + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); // Fill array 'array_options' with data from update form @@ -1523,8 +1498,7 @@ if ($action == 'create') if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } } - } - else { + } else { if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; } @@ -2298,8 +2272,7 @@ if ($action == 'create') if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -2466,8 +2439,7 @@ if ($action == 'create') if ($usercanvalidate) { print '
'.$langs->trans('Validate').''; - } - else print ''.$langs->trans('Validate').''; + } else print ''.$langs->trans('Validate').''; } // Create event /*if ($conf->agenda->enabled && ! empty($conf->global->MAIN_ADD_EVENT_ON_ELEMENT_CARD)) // Add hidden condition because this is not a "workflow" action so should appears somewhere else on page. @@ -2542,8 +2514,7 @@ if ($action == 'create') if ($usercanclose) { print 'socid.'">'.$langs->trans("ClassifyBilled").''; - } - else { + } else { print ''.$langs->trans("ClassifyBilled").''; } } diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index 563e71d79d3..8efc4aa5c19 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -220,8 +220,7 @@ class Proposals extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve propal list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -456,8 +455,7 @@ class Proposals extends DolibarrApi $updateRes = $this->propal->deleteline($lineid); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->propal->error); } } @@ -587,8 +585,7 @@ class Proposals extends DolibarrApi if ($this->propal->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->propal->error); } } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0827ddd64c7..5a8ddc31982 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -390,8 +390,7 @@ class Propal extends CommonObject if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; - } - else { + } else { $price = $prod->price; } @@ -472,19 +471,16 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $line->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -557,8 +553,7 @@ class Propal extends CommonObject if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -710,20 +705,17 @@ class Propal extends CommonObject { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of proposal must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -909,15 +901,13 @@ class Propal extends CommonObject $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::updateline Erreur -2 Propal en mode incompatible pour cette action"); return -2; } @@ -949,13 +939,11 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -1129,8 +1117,7 @@ class Propal extends CommonObject $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1157,8 +1144,7 @@ class Propal extends CommonObject if (!is_object($this->lines[$i])) // If this->lines is not array of objects, coming from REST API { // Convert into object this->lines[$i]. $line = (object) $this->lines[$i]; - } - else { + } else { $line = $this->lines[$i]; } // Reset fk_parent_line for line that are not child lines or special product @@ -1254,14 +1240,12 @@ class Propal extends CommonObject if ($result < 0) { $error++; } // End call triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1271,13 +1255,11 @@ class Propal extends CommonObject $this->db->commit(); dol_syslog(get_class($this)."::create done id=".$this->id); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1357,8 +1339,7 @@ class Propal extends CommonObject $object->ref_client = ''; // TODO Change product price if multi-prices - } - else { + } else { $objsoc->fetch($object->socid); } @@ -1426,8 +1407,7 @@ class Propal extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1481,8 +1461,7 @@ class Propal extends CommonObject if ($ref) { $sql .= " WHERE p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid $sql .= " AND p.ref='".$this->db->escape($ref)."'"; - } - else $sql .= " WHERE p.rowid=".$rowid; + } else $sql .= " WHERE p.rowid=".$rowid; dol_syslog(get_class($this)."::fetch", LOG_DEBUG); $resql = $this->db->query($sql); @@ -1592,8 +1571,7 @@ class Propal extends CommonObject $this->error = "Record Not Found"; return 0; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1687,8 +1665,7 @@ class Propal extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1816,8 +1793,7 @@ class Propal extends CommonObject $this->db->free($result); return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -1865,8 +1841,7 @@ class Propal extends CommonObject if (!$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($soc); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -1939,8 +1914,7 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2002,8 +1976,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2063,8 +2036,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2124,8 +2096,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2186,8 +2157,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2196,8 +2166,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2257,8 +2226,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2267,8 +2235,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2324,8 +2291,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2334,8 +2300,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -1; } } @@ -2392,8 +2357,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2459,8 +2423,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2526,8 +2489,7 @@ class Propal extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -2620,8 +2582,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->statut = $this->oldcopy->statut; $this->date_cloture = $this->oldcopy->date_cloture; $this->note_private = $this->oldcopy->note_private; @@ -2629,8 +2590,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -2679,8 +2639,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2745,8 +2704,7 @@ class Propal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2812,12 +2770,10 @@ class Propal extends CommonObject if ($shortlist == 1) { $ga[$obj->propalid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->propalid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->propalid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2827,8 +2783,7 @@ class Propal extends CommonObject } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2921,12 +2876,10 @@ class Propal extends CommonObject } } return $ga; - } - else { + } else { return -1; } - } - else return $ga; + } else return $ga; } /** @@ -3023,26 +2976,22 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG); $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -3096,8 +3045,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3106,8 +3054,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -3166,8 +3113,7 @@ class Propal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3176,8 +3122,7 @@ class Propal extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Propal status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -3234,8 +3179,7 @@ class Propal extends CommonObject } } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3370,8 +3314,7 @@ class Propal extends CommonObject } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3449,8 +3392,7 @@ class Propal extends CommonObject $line->total_ttc = 60; $line->total_tva = 10; $line->remise_percent = 50; - } - else { + } else { $line->total_ht = 100; $line->total_ttc = 120; $line->total_tva = 20; @@ -3509,8 +3451,7 @@ class Propal extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -3560,14 +3501,12 @@ class Propal extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($db,"Propale::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Proposal")); return ""; @@ -3615,14 +3554,11 @@ class Propal extends CommonObject if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; - } - elseif ($option == 'compta') { // deprecated + } elseif ($option == 'compta') { // deprecated $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; - } - elseif ($option == 'expedition') { + } elseif ($option == 'expedition') { $url = DOL_URL_ROOT.'/expedition/propal.php?id='.$this->id.$get_params; - } - elseif ($option == 'document') { + } elseif ($option == 'document') { $url = DOL_URL_ROOT.'/comm/propal/document.php?id='.$this->id.$get_params; } @@ -3970,12 +3906,10 @@ class PropaleLigne extends CommonObjectLine $this->db->free($result); return 1; - } - else { + } else { return 0; } - } - else { + } else { return -1; } } @@ -4024,8 +3958,7 @@ class PropaleLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4112,8 +4045,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -4165,8 +4097,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -4213,8 +4144,7 @@ class PropaleLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4291,8 +4221,7 @@ class PropaleLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4325,8 +4254,7 @@ class PropaleLigne extends CommonObjectLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/comm/propal/contact.php b/htdocs/comm/propal/contact.php index ac6f500cce2..da23b4fc2bc 100644 --- a/htdocs/comm/propal/contact.php +++ b/htdocs/comm/propal/contact.php @@ -55,8 +55,7 @@ if ($id > 0 || !empty($ref)) $langs->load("errors"); setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); $error++; - } - elseif ($ret < 0) + } elseif ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -65,8 +64,7 @@ if ($id > 0 || !empty($ref)) if (!$error) { $object->fetch_thirdparty(); -} -else { +} else { header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); exit; } @@ -88,14 +86,12 @@ if ($action == 'addcontact' && $user->rights->propale->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -119,8 +115,7 @@ elseif ($action == 'deletecontact' && $user->rights->propale->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/document.php b/htdocs/comm/propal/document.php index f9d89ca981d..70c67566091 100644 --- a/htdocs/comm/propal/document.php +++ b/htdocs/comm/propal/document.php @@ -179,8 +179,7 @@ if ($object->id > 0) $permtoedit = $user->rights->propal->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/comm/propal/index.php b/htdocs/comm/propal/index.php index d456a507f19..9e138c52cbe 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -163,8 +163,7 @@ if ($resql) //print ''.$langs->trans("Total").' ('.$langs->trans("CustomersOrdersRunning").')'.$totalinprocess.''; print ''.$langs->trans("Total").''.$total.''; print "
"; -} -else { +} else { dol_print_error($db); } @@ -219,8 +218,7 @@ if (!empty($conf->propal->enabled)) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total).""; } @@ -309,8 +307,7 @@ if ($resql) } print ""; print "
"; -} -else dol_print_error($db); +} else dol_print_error($db); /* @@ -393,16 +390,14 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total")."".price($total)." "; } print ""; print "
"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 9c31bd72bf7..6710ac56b58 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -414,8 +414,7 @@ if ($resql) $soc->fetch($socid); $title = $langs->trans('ListOfProposals').' - '.$soc->name; if (empty($search_societe)) $search_societe = $soc->name; - } - else { + } else { $title = $langs->trans('ListOfProposals'); } @@ -1027,8 +1026,7 @@ if ($resql) { print ''.dol_print_date($db->jdate($obj->dfv), 'day'); print ''; - } - else { + } else { print ' '; } if (!$i) $totalarray['nbfield']++; @@ -1040,8 +1038,7 @@ if ($resql) { print ''.dol_print_date($db->jdate($obj->ddelivery), 'day'); print ''; - } - else { + } else { print ' '; } if (!$i) $totalarray['nbfield']++; @@ -1166,8 +1163,7 @@ if ($resql) if ($nbofsalesrepresentative > 3) // We print only number { print $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; @@ -1189,8 +1185,7 @@ if ($resql) } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else { + } else { print ' '; } print ''; @@ -1275,8 +1270,7 @@ if ($resql) $delallowed = $user->rights->propal->creer; print $formfile->showdocuments('massfilesarea_proposals', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index c4f92d36b6a..00a79f3c1be 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -112,8 +112,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/proposalsnbinyear-'.$user->id.'-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenamenb = $dir.'/proposalsnbinyear-'.$year.'.png'; $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsnbinyear-'.$year.'.png'; } @@ -151,8 +150,7 @@ if (!$user->rights->societe->client->voir || $user->socid) { $filenameamount = $dir.'/proposalsamountinyear-'.$user->id.'-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenameamount = $dir.'/proposalsamountinyear-'.$year.'.png'; $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=propalstats&file=proposalsamountinyear-'.$year.'.png'; } @@ -190,8 +188,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -344,8 +341,7 @@ print '
'; // Show graphs print '
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 386e27f0ec3..b49f334dadd 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -223,8 +223,7 @@ if (!empty($conf->propal->enabled) && $user->rights->propale->lire) } print "

"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/comm/prospect/recap-prospect.php b/htdocs/comm/prospect/recap-prospect.php index 2edc331d71e..e393f5fce56 100644 --- a/htdocs/comm/prospect/recap-prospect.php +++ b/htdocs/comm/prospect/recap-prospect.php @@ -83,8 +83,7 @@ if ($socid > 0) print $langs->trans("FeatureNotYetAvailable"); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/recap-client.php b/htdocs/comm/recap-client.php index 170eb5b247a..284c248f1f0 100644 --- a/htdocs/comm/recap-client.php +++ b/htdocs/comm/recap-client.php @@ -83,8 +83,7 @@ if ($socid > 0) print $langs->trans("FeatureNotYetAvailable"); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/comm/remise.php b/htdocs/comm/remise.php index a735cd07028..a7517c9cb60 100644 --- a/htdocs/comm/remise.php +++ b/htdocs/comm/remise.php @@ -70,13 +70,11 @@ if (GETPOST('action', 'aZ09') == 'setremise') { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: remise.php?id=".$_GET["id"]); exit; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -250,14 +248,12 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } } @@ -307,14 +303,12 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } $db->free($resql); print ""; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/comm/remx.php b/htdocs/comm/remx.php index 62b38f9e390..ffd4c1738c0 100644 --- a/htdocs/comm/remx.php +++ b/htdocs/comm/remx.php @@ -105,8 +105,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') { $newdiscount1->description = $discount->description; $newdiscount2->description = $discount->description; - } - else { + } else { $newdiscount1->description = $discount->description.' (1)'; $newdiscount2->description = $discount->description.' (2)'; } @@ -149,8 +148,7 @@ if ($action == 'confirm_split' && GETPOST("confirm", "alpha") == 'yes') $db->commit(); header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id.($backtopage ? '&backtopage='.urlencode($backtopage) : '')); // To avoid pb whith back exit; - } - else { + } else { $db->rollback(); } } @@ -187,19 +185,16 @@ if ($action == 'setremise' && $user->rights->societe->creer) { header("Location: ".$backtopage.'&discountid='.$discountid); exit; - } - else { + } else { header("Location: remx.php?id=".$id); exit; } - } - else { + } else { $error++; setEventMessages($soc->error, $soc->errors, 'errors'); } } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldFormat", $langs->transnoentitiesnoconv("AmountHT")), null, 'errors'); } } @@ -219,8 +214,7 @@ if (GETPOST('action', 'aZ09') == 'confirm_remove' && GETPOST("confirm") == 'yes' $db->commit(); header("Location: ".$_SERVER["PHP_SELF"].'?id='.$id); // To avoid pb whith back exit; - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } @@ -294,8 +288,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); $remise_all += $obj->amount; if ($obj->fk_user == $user->id) $remise_user += $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -325,8 +318,7 @@ if ($socid > 0) $obj = $db->fetch_object($resql); $remise_all += $obj->amount; if ($obj->fk_user == $user->id) $remise_user += $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -481,8 +473,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -490,8 +481,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -499,8 +489,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -526,8 +515,7 @@ if ($socid > 0) print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; - } - else print ' '; + } else print ' '; print ''; if ($_GET["action"] == 'split' && GETPOST('remid') == $obj->rowid) @@ -537,8 +525,7 @@ if ($socid > 0) } $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -559,8 +546,7 @@ if ($socid > 0) $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, '', 0); } - } - else { + } else { dol_print_error($db); } } @@ -635,8 +621,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -644,8 +629,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -653,8 +637,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(EXCESS PAID\)/', $langs->trans("ExcessPaid"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -680,8 +663,7 @@ if ($socid > 0) print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_split($langs->trans("SplitDiscount")).''; print 'rowid.($backtopage ? '&backtopage='.urlencode($backtopage) : '').'">'.img_delete($langs->trans("RemoveDiscount")).''; print ''; - } - else print ' '; + } else print ' '; print ''; if ($_GET["action"] == 'split' && GETPOST('remid') == $obj->rowid) @@ -691,8 +673,7 @@ if ($socid > 0) } $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -713,8 +694,7 @@ if ($socid > 0) $langs->load("dict"); print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&remid='.$showconfirminfo['rowid'].($backtopage ? '&backtopage='.urlencode($backtopage) : ''), $langs->trans('SplitDiscount'), $langs->trans('ConfirmSplitDiscount', price($showconfirminfo['amount_ttc']), $langs->transnoentities("Currency".$conf->currency)), 'confirm_split', $formquestion, 0, 0); } - } - else { + } else { dol_print_error($db); } @@ -843,8 +823,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -852,8 +831,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS RECEIVED\)/', $obj->description)) { print ''; $facturestatic->id = $obj->fk_facture_source; @@ -861,8 +839,7 @@ if ($socid > 0) $facturestatic->type = $obj->type; print preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("Invoice"), $obj->description).' '.$facturestatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -891,8 +868,7 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -900,8 +876,7 @@ if ($socid > 0) print ""; print '
'; - } - else { + } else { dol_print_error($db); } } @@ -1018,8 +993,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) + } elseif (preg_match('/\(DEPOSIT\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -1027,8 +1001,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(DEPOSIT\)/', $langs->trans("InvoiceDeposit"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) + } elseif (preg_match('/\(EXCESS PAID\)/', $obj->description)) { print ''; $facturefournstatic->id = $obj->fk_invoice_supplier_source; @@ -1036,8 +1009,7 @@ if ($socid > 0) $facturefournstatic->type = $obj->type; print preg_replace('/\(EXCESS PAID\)/', $langs->trans("Invoice"), $obj->description).' '.$facturefournstatic->getNomURl(1); print ''; - } - else { + } else { print ''; print $obj->description; print ''; @@ -1065,8 +1037,7 @@ if ($socid > 0) print ''; $i++; } - } - else { + } else { $colspan = 8; if (!empty($conf->multicurrency->enabled)) $colspan += 2; print ''.$langs->trans("None").''; @@ -1074,8 +1045,7 @@ if ($socid > 0) print ""; print '
'; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 2dfb0b67c6e..a8544c94b70 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -154,8 +154,7 @@ if (empty($reshook)) if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { // Because createFromClone modifies the object, we must clone it so that we can restore it later @@ -166,8 +165,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $object = $orig; $action = ''; @@ -185,8 +183,7 @@ if (empty($reshook)) if ($result > 0) { setEventMessages($langs->trans('OrderReopened', $object->ref), null); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -200,8 +197,7 @@ if (empty($reshook)) { header('Location: list.php?restore_lastsearch_values=1'); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -230,8 +226,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -497,17 +492,14 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'classifybilled' && $usercancreate) + } elseif ($action == 'classifybilled' && $usercancreate) { $ret = $object->classifyBilled($user); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - elseif ($action == 'classifyunbilled' && $usercancreate) + } elseif ($action == 'classifyunbilled' && $usercancreate) { $ret = $object->classifyUnBilled(); if ($ret < 0) { @@ -522,17 +514,13 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setremise' && $usercancreate) { + } elseif ($action == 'setremise' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setabsolutediscount' && $usercancreate) { + } elseif ($action == 'setabsolutediscount' && $usercancreate) { if (GETPOST('remise_id')) { if ($object->id > 0) { $object->insert_discount(GETPOST('remise_id')); @@ -540,9 +528,7 @@ if (empty($reshook)) dol_print_error($db, $object->error); } } - } - - elseif ($action == 'setdate' && $usercancreate) { + } elseif ($action == 'setdate' && $usercancreate) { // 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')); @@ -550,9 +536,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setdate_livraison' && $usercancreate) { + } elseif ($action == 'setdate_livraison' && $usercancreate) { // 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')); @@ -560,9 +544,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setmode' && $usercancreate) { + } elseif ($action == 'setmode' && $usercancreate) { $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); @@ -576,21 +558,15 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); - } - - elseif ($action == 'setavailability' && $usercancreate) { + } elseif ($action == 'setavailability' && $usercancreate) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - } - - elseif ($action == 'setdemandreason' && $usercancreate) { + } elseif ($action == 'setdemandreason' && $usercancreate) { $result = $object->demand_reason(GETPOST('demand_reason_id')); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); - } - - elseif ($action == 'setconditions' && $usercancreate) { + } elseif ($action == 'setconditions' && $usercancreate) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); if ($result < 0) { dol_print_error($db, $object->error); @@ -643,13 +619,9 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setremisepercent' && $usercancreate) { + } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise($user, GETPOST('remise_percent')); - } - - elseif ($action == 'setremiseabsolue' && $usercancreate) { + } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, GETPOST('remise_absolue')); } @@ -669,8 +641,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -718,8 +689,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } - else { + } else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error++; } @@ -787,8 +757,7 @@ if (empty($reshook)) $tva_npr = $prodcustprice->lines[0]->recuperableonly; if (empty($tva_tx)) $tva_npr = 0; } - } - else { + } else { setEventMessages($prodcustprice->error, $prodcustprice->errors, 'errors'); } } @@ -808,8 +777,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } 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. @@ -832,8 +800,7 @@ if (empty($reshook)) if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } 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. @@ -1146,9 +1113,7 @@ if (empty($reshook)) } elseif ($action == 'updateline' && $usercancreate && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit(); - } - - elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) + } elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1156,8 +1121,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1192,8 +1156,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1207,8 +1170,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1245,16 +1207,12 @@ if (empty($reshook)) } } } - } - - elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) { + } elseif ($action == 'confirm_shipped' && $confirm == 'yes' && $usercanclose) { $result = $object->cloture($user); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) + } elseif ($action == 'confirm_cancel' && $confirm == 'yes' && $usercanvalidate) { $idwarehouse = GETPOST('idwarehouse'); @@ -1262,8 +1220,7 @@ if (empty($reshook)) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1334,8 +1291,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -1387,8 +1343,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -1518,12 +1473,10 @@ if ($action == 'create' && $usercancreate) // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; - } - elseif ($element == 'propal') { + } elseif ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; - } - elseif ($element == 'contract') { + } elseif ($element == 'contract') { $element = $subelement = 'contrat'; } @@ -1569,8 +1522,7 @@ if ($action == 'create' && $usercancreate) // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - } - else { + } else { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; @@ -1941,8 +1893,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -1972,8 +1923,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -2013,8 +1963,7 @@ if ($action == 'create' && $usercancreate) if (empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $qualified_for_stock_change = $object->hasProductsOrServices(2); - } - else { + } else { $qualified_for_stock_change = $object->hasProductsOrServices(1); } @@ -2368,8 +2317,7 @@ if ($action == 'create' && $usercancreate) if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index 2ba223b3866..cc7db3db852 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -223,8 +223,7 @@ class Orders extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve commande list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -569,8 +568,7 @@ class Orders extends DolibarrApi if ($this->commande->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->commande->error); } } @@ -698,7 +696,7 @@ class Orders extends DolibarrApi $result = $this->commande->set_reopen(DolibarrApiAccess::$user); if ($result < 0) { throw new RestException(405, $this->commande->error); - }elseif ($result == 0) { + } elseif ($result == 0) { throw new RestException(304); } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 3f86ce9de5b..b4abfee0c03 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -406,14 +406,12 @@ class Commande extends CommonOrder if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_COMMANDE_ADDON_NotDefined"); return ""; } @@ -466,8 +464,7 @@ class Commande extends CommonOrder if (!$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($soc); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -578,8 +575,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -664,8 +660,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -706,8 +701,7 @@ class Commande extends CommonOrder $result = $this->call_trigger('ORDER_REOPEN', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->lasterror(); dol_print_error($this->db); @@ -720,8 +714,7 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::set_reopen ".$errmsg, LOG_ERR); @@ -776,13 +769,11 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -852,8 +843,7 @@ class Commande extends CommonOrder $this->statut = self::STATUS_CANCELED; $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::cancel ".$errmsg, LOG_ERR); @@ -862,8 +852,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -1089,8 +1078,7 @@ class Commande extends CommonOrder $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1136,8 +1124,7 @@ class Commande extends CommonOrder //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } if (!$error) @@ -1158,20 +1145,17 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } } - } - else { + } else { dol_print_error($this->db); $this->db->rollback(); return -1; @@ -1274,8 +1258,7 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1406,10 +1389,8 @@ class Commande extends CommonOrder $this->valid($user); } return $ret; - } - else return -1; - } - else return -1; + } else return -1; + } else return -1; } @@ -1489,8 +1470,7 @@ class Commande extends CommonOrder if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } $label = trim($label); @@ -1649,20 +1629,17 @@ class Commande extends CommonOrder { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; dol_syslog(get_class($this)."::addline error=".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -1901,13 +1878,11 @@ class Commande extends CommonOrder return -3; } return 1; - } - else { + } else { $this->error = 'Order with id '.$id.' not found sql='.$sql; return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1971,19 +1946,16 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $line->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -2108,8 +2080,7 @@ class Commande extends CommonOrder $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -2172,8 +2143,7 @@ class Commande extends CommonOrder $this->db->free($resql); return $nb; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -2218,8 +2188,7 @@ class Commande extends CommonOrder } $this->db->free($resql); return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -2248,8 +2217,7 @@ class Commande extends CommonOrder { $row = $this->db->fetch_row($resql); return $row[0]; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -2335,31 +2303,26 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $line->error; return -1; } - } - else { + } else { $this->db->rollback(); return 0; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -1; } @@ -2418,8 +2381,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2485,8 +2447,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2547,8 +2508,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2557,8 +2517,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -2; } } @@ -2611,8 +2570,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2621,8 +2579,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -2; } } @@ -2679,12 +2636,10 @@ class Commande extends CommonOrder if ($shortlist == 1) { $ga[$obj->cid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->cid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->cid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2693,8 +2648,7 @@ class Commande extends CommonOrder } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2748,8 +2702,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2758,8 +2711,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'Command status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2818,8 +2770,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2828,8 +2779,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error_str = 'order status do not meet requirement '.$this->statut; dol_syslog(__METHOD__.$error_str, LOG_ERR); $this->error = $error_str; @@ -2885,8 +2835,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2895,8 +2844,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { return -1; } } @@ -2938,8 +2886,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyBilled ".$errmsg, LOG_ERR); @@ -2948,8 +2895,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -2991,8 +2937,7 @@ class Commande extends CommonOrder $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::classifyUnBilled ".$errmsg, LOG_ERR); @@ -3001,8 +2946,7 @@ class Commande extends CommonOrder $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3110,8 +3054,7 @@ class Commande extends CommonOrder if ($price_base_type == 'TTC') { $subprice = $pu_ttc; - } - else { + } else { $subprice = $pu_ht; } $remise = 0; @@ -3214,15 +3157,13 @@ class Commande extends CommonOrder $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = get_class($this)."::updateline Order status makes operation forbidden"; $this->errors = array('OrderStatusMakeOperationForbidden'); return -2; @@ -3316,8 +3257,7 @@ class Commande extends CommonOrder } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -3449,8 +3389,7 @@ class Commande extends CommonOrder { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { $this->error .= ($this->error ? ', '.$errmsg : $errmsg); @@ -3515,8 +3454,7 @@ class Commande extends CommonOrder } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3570,38 +3508,31 @@ class Commande extends CommonOrder $labelStatus = $langs->trans('StatusOrderCanceled'); $labelStatusShort = $langs->trans('StatusOrderCanceledShort'); $statusType = 'status9'; - } - elseif ($status == self::STATUS_DRAFT) { + } elseif ($status == self::STATUS_DRAFT) { $labelStatus = $langs->trans('StatusOrderDraft'); $labelStatusShort = $langs->trans('StatusOrderDraftShort'); $statusType = 'status0'; - } - elseif ($status == self::STATUS_VALIDATED) { + } elseif ($status == self::STATUS_VALIDATED) { $labelStatus = $langs->trans('StatusOrderValidated').$billedtext; $labelStatusShort = $langs->trans('StatusOrderValidatedShort').$billedtext; $statusType = 'status1'; - } - elseif ($status == self::STATUS_SHIPMENTONPROCESS) { + } elseif ($status == self::STATUS_SHIPMENTONPROCESS) { $labelStatus = $langs->trans('StatusOrderSentShort').$billedtext; $labelStatusShort = $langs->trans('StatusOrderSentShort').$billedtext; $statusType = 'status4'; - } - elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && (!$billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderToBill'); $labelStatusShort = $langs->trans('StatusOrderToBillShort'); $statusType = 'status4'; - } - elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && ($billed && empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderProcessed').$billedtext; $labelStatusShort = $langs->trans('StatusOrderProcessed').$billedtext; $statusType = 'status6'; - } - elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { + } elseif ($status == self::STATUS_CLOSED && (!empty($conf->global->WORKFLOW_BILL_ON_SHIPMENT))) { $labelStatus = $langs->trans('StatusOrderDelivered'); $labelStatusShort = $langs->trans('StatusOrderDelivered'); $statusType = 'status6'; - } - else { + } else { $labelStatus = $langs->trans('Unknown'); $labelStatusShort = ''; $statusType = ''; @@ -3763,8 +3694,7 @@ class Commande extends CommonOrder } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3838,8 +3768,7 @@ class Commande extends CommonOrder $line->total_ttc = 60; $line->total_tva = 10; $line->remise_percent = 50; - } - else { + } else { $line->total_ht = 100; $line->total_ttc = 120; $line->total_tva = 20; @@ -3897,8 +3826,7 @@ class Commande extends CommonOrder } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4149,8 +4077,7 @@ class OrderLine extends CommonOrderLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -4236,8 +4163,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -4282,8 +4208,7 @@ class OrderLine extends CommonOrderLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4378,8 +4303,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4426,8 +4350,7 @@ class OrderLine extends CommonOrderLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -4510,8 +4433,7 @@ class OrderLine extends CommonOrderLine } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -4550,8 +4472,7 @@ class OrderLine extends CommonOrderLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/commande/class/commandestats.class.php b/htdocs/commande/class/commandestats.class.php index cbb93b940de..5af5fb23060 100644 --- a/htdocs/commande/class/commandestats.class.php +++ b/htdocs/commande/class/commandestats.class.php @@ -78,8 +78,7 @@ class CommandeStats extends Stats $this->field = 'total_ht'; $this->field_line = 'total_ht'; $this->where .= " c.fk_statut > 0"; // Not draft and not cancelled - } - elseif ($mode == 'supplier') + } elseif ($mode == 'supplier') { $object = new CommandeFournisseur($this->db); $this->from = MAIN_DB_PREFIX.$object->table_element." as c"; diff --git a/htdocs/commande/contact.php b/htdocs/commande/contact.php index 4fd050799dc..2d11feeeee2 100644 --- a/htdocs/commande/contact.php +++ b/htdocs/commande/contact.php @@ -63,14 +63,12 @@ if ($action == 'addcontact' && $user->rights->commande->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -82,8 +80,7 @@ elseif ($action == 'swapstatut' && $user->rights->commande->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -98,8 +95,7 @@ elseif ($action == 'deletecontact' && $user->rights->commande->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -203,8 +199,7 @@ if ($id > 0 || !empty($ref)) $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } - } - else { + } else { // Contact not found print "ErrorRecordNotFound"; } diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 020b1654ac9..f78d6ce2e84 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -184,8 +184,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 516dcd56fc0..27d38378bcb 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -182,12 +182,10 @@ if ($id > 0 || !empty($ref)) $permtoedit = $user->rights->commande->creer; $param = '&id='.$object->id.'&entity='.(!empty($object->entity) ? $object->entity : $conf->entity); include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { header('Location: index.php'); exit; } diff --git a/htdocs/commande/index.php b/htdocs/commande/index.php index 53f6b20b4f6..96476caeeed 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -173,8 +173,7 @@ if ($resql) //if ($totalinprocess != $total) print ''.$langs->trans("Total").''.$total.''; print "
"; -} -else { +} else { dol_print_error($db); } @@ -231,8 +230,7 @@ if (!empty($conf->commande->enabled)) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoOrder").''; } print "
"; @@ -321,8 +319,7 @@ if ($resql) } } print "
"; -} -else dol_print_error($db); +} else dol_print_error($db); $max = 10; @@ -408,8 +405,7 @@ if (!empty($conf->commande->enabled)) } print "
"; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -493,8 +489,7 @@ if (!empty($conf->commande->enabled)) } } print "
"; - } - else dol_print_error($db); + } else dol_print_error($db); } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 088512d6fa2..63c82775ff1 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -395,8 +395,7 @@ if ($resql) $soc->fetch($socid); $title = $langs->trans('ListOfOrders').' - '.$soc->name; if (empty($search_company)) $search_company = $soc->name; - } - else { + } else { $title = $langs->trans('ListOfOrders'); } if (strval($search_status) == '0') @@ -540,8 +539,7 @@ if ($resql) { print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; - } - else { + } else { print $form->selectyesno('validate_invoices', 0, 1); } if (!empty($conf->workflow->enabled) && !empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print '     '.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").''; @@ -960,8 +958,7 @@ if ($resql) { $notshippable++; } - } - else { // Detailed code, looks bugged + } else { // Detailed code, looks bugged // stock order and stock order_supplier $stock_order = 0; $stock_order_supplier = 0; @@ -1308,8 +1305,7 @@ if ($resql) $delallowed = $user->rights->commande->creer; print $formfile->showdocuments('massfilesarea_orders', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index cae54d69bbd..c3d82821249 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -83,8 +83,7 @@ if ($action == 'create') { $error++; setEventMessages($langs->trans('Error_OrderNotChecked'), null, 'errors'); - } - else { + } else { $origin = GETPOST('origin'); $originid = GETPOST('originid'); } @@ -208,8 +207,7 @@ if (($action == 'create' || $action == 'add') && !$error) if ($db->query($sql)) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -254,14 +252,12 @@ if (($action == 'create' || $action == 'add') && !$error) { $result = $object->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } - } - else { + } else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -316,8 +312,7 @@ if (($action == 'create' || $action == 'add') && !$error) if ($result > 0) { $lineid = $result; - } - else { + } else { $lineid = 0; $error++; break; @@ -329,15 +324,13 @@ if (($action == 'create' || $action == 'add') && !$error) } } } - } - else { + } else { setEventMessages($objectsrc->error, $objectsrc->errors, 'errors'); $error++; } $ii++; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } @@ -351,8 +344,7 @@ if (($action == 'create' || $action == 'add') && !$error) $db->commit(); header('Location: '.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$id); exit; - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -721,8 +713,7 @@ if (($action != 'create' && $action != 'add') || ($action == 'create' && $error) print ''; $db->free($resql); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 35f9f60020c..0910e4ee7ad 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -114,8 +114,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenamenb = $dir.'/ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenamenb = $dir.'/ordersnbinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersnbinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersnbinyear-'.$year.'.png'; @@ -156,8 +155,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filenameamount = $dir.'/ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenameamount = $dir.'/ordersamountinyear-'.$year.'.png'; if ($mode == 'customer') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersamountinyear-'.$year.'.png'; if ($mode == 'supplier') $fileurlamount = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersamountinyear-'.$year.'.png'; @@ -196,8 +194,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -378,8 +375,7 @@ print '
'; // Show graphs print ''; - } - else { + } else { // Sort array by date ASC to calculate balance $totalET_debit = 0; diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 05f89e1bc6f..767c8f8709b 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -138,12 +138,10 @@ if ($id > 0 || !empty($ref)) { $moreparam = '&num='.urlencode($num); ; $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($num)."/"; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { Header('Location: index.php'); exit; } diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index 51d838878b8..72a7e33d3f2 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -50,8 +50,7 @@ if (!$year_start) { $year_start = $year_current - 2; $year_end = $year_current; -} -else { +} else { $year_end = $year_start + 2; } @@ -106,8 +105,7 @@ if ($resql) $encaiss[$row[1]] = $row[0]; $i++; } -} -else { +} else { dol_print_error($db); } @@ -133,8 +131,7 @@ if ($resql) $decaiss[$row[1]] = -$row[0]; $i++; } -} -else { +} else { dol_print_error($db); } @@ -154,8 +151,7 @@ if (!empty($id)) if (!preg_match('/,/', $id)) { dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); - } - else { + } else { $bankaccount = new Account($db); $listid = explode(',', $id); foreach ($listid as $key => $aId) @@ -166,8 +162,7 @@ if (!empty($id)) if ($key < (count($listid) - 1)) print ', '; } } -} -else { +} else { print $langs->trans("AllAccounts"); } @@ -252,8 +247,7 @@ if ($resql) { $obj = $db->fetch_object($resql); if ($obj) $balance = $obj->total; -} -else { +} else { dol_print_error($db); } @@ -275,8 +269,7 @@ if ($result < 0) $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); -} -else { +} else { // Calcul de $min et $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -292,8 +285,7 @@ else { $obj = $db->fetch_object($resql); $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); - } - else { + } else { dol_print_error($db); } $log = "graph.php: min=".$min." max=".$max; @@ -331,8 +323,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -417,8 +408,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index d5fb533016e..c5ded35cb51 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -68,8 +68,7 @@ if ($fielvalue) { if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque', $fieldvalue, 'bank_account&bank_account', '', '', $fieldtype); -} -else { +} else { if ($user->socid) $socid = $user->socid; $result = restrictedArea($user, 'banque'); } @@ -240,14 +239,12 @@ if ((GETPOST('confirm_savestatement', 'alpha') || GETPOST('confirm_reconcile', ' } } } - } - else { + } else { $error++; $langs->load("errors"); setEventMessages($langs->trans("NoRecordSelected"), null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorPleaseTypeBankTransactionReportName"), null, 'errors'); @@ -283,8 +280,7 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) if (price2num($_POST["addcredit"]) > 0) { $amount = price2num($_POST["addcredit"]); - } - else { + } else { $amount = - price2num($_POST["adddebit"]); } @@ -333,12 +329,10 @@ if (GETPOST('save') && !$cancel && $user->rights->banque->modifier) setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF'].($id ? "?id=".$id : '')); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $action = 'addline'; } } @@ -462,8 +456,7 @@ if ($id > 0 || !empty($ref)) } } } -} -else { +} else { llxHeader('', $langs->trans("BankTransactions"), '', '', 0, 0, array(), array(), $param); } @@ -667,8 +660,7 @@ if ($resql) if ($numr >= $nbmax) $liste = "...   ".$liste; print $liste; if ($numr <= 0) print ''.$langs->trans("None").''; - } - else { + } else { dol_print_error($db); } @@ -784,13 +776,11 @@ if ($resql) if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/bank/various_payment/card.php?action=create&accountid='.$search_account.'&backtopage='.urlencode($_SERVER['PHP_SELF'].'?id='.urlencode($search_account)), '', $user->rights->banque->modifier); - } - else // If direct entries is not done using miscellaneous payments + } else // If direct entries is not done using miscellaneous payments { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', $user->rights->banque->modifier); } - } - else { + } else { $newcardbutton = dolGetButtonTitle($langs->trans('AddBankRecord'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=addline&page='.$page.$param, '', -1); } } @@ -1036,8 +1026,7 @@ if ($resql) $balance = $objforbalance->previoustotal; } } - } - else dol_print_error($db); + } else dol_print_error($db); $balancecalculated = true; @@ -1118,8 +1107,7 @@ if ($resql) { $balance = price2num($balancebefore, 'MT'); // balance = balancebefore of previous line (sort is desc) $balancebefore = price2num($balancebefore - ($sign * $objp->amount), 'MT'); - } - else { + } else { $balancebefore = price2num($balance, 'MT'); // balancebefore = balance of previous line (sort is asc) $balance = price2num($balance + ($sign * $objp->amount), 'MT'); } @@ -1130,8 +1118,7 @@ if ($resql) $bankaccounttmp->fetch($objp->bankid); $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; - } - else { + } else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -1195,63 +1182,53 @@ if ($resql) $banktransferstatic->id = $links[$key]['url_id']; $banktransferstatic->ref = $links[$key]['label']; print ' '.$banktransferstatic->getNomUrl(0); - } - elseif ($links[$key]['type'] == 'payment') + } elseif ($links[$key]['type'] == 'payment') { $paymentstatic->id = $links[$key]['url_id']; $paymentstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_supplier') + } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $links[$key]['url_id']; // FIXME This is id, not ref of payment print ' '.$paymentsupplierstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_sc') + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; //print $langs->trans("SocialContributionPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_vat') + } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $links[$key]['url_id']; print ' '.$paymentvatstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_salary') + } elseif ($links[$key]['type'] == 'payment_salary') { $paymentsalstatic->id = $links[$key]['url_id']; $paymentsalstatic->ref = $links[$key]['url_id']; print ' '.$paymentsalstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_loan') + } elseif ($links[$key]['type'] == 'payment_loan') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print ''; - } - elseif ($links[$key]['type'] == 'payment_donation') + } elseif ($links[$key]['type'] == 'payment_donation') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print ''; - } - elseif ($links[$key]['type'] == 'payment_expensereport') + } elseif ($links[$key]['type'] == 'payment_expensereport') { $paymentexpensereportstatic->id = $links[$key]['url_id']; $paymentexpensereportstatic->ref = $links[$key]['url_id']; print ' '.$paymentexpensereportstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'payment_various') + } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->ref = $links[$key]['url_id']; print ' '.$paymentvariousstatic->getNomUrl(2); - } - elseif ($links[$key]['type'] == 'banktransfert') + } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) @@ -1266,8 +1243,7 @@ if ($resql) $bankstatic->label = $objp->bankref; print $bankstatic->getNomUrl(1, ''); print ')'; - } - else { + } else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("TransferFrom").' '; @@ -1280,20 +1256,15 @@ if ($resql) print ')'; } //var_dump($links); - } - elseif ($links[$key]['type'] == 'company') + } elseif ($links[$key]['type'] == 'company') { - } - elseif ($links[$key]['type'] == 'user') + } elseif ($links[$key]['type'] == 'user') { - } - elseif ($links[$key]['type'] == 'member') + } elseif ($links[$key]['type'] == 'member') { - } - elseif ($links[$key]['type'] == 'sc') + } elseif ($links[$key]['type'] == 'sc') { - } - else { + } else { // Show link with label $links[$key]['label'] if (!empty($objp->label) && !empty($links[$key]['label'])) print ' - '; print ''; @@ -1302,8 +1273,7 @@ if ($resql) // Label generique car entre parentheses. On l'affiche en le traduisant if ($reg[1] == 'paiement') $reg[1] = 'Payment'; print ' '.$langs->trans($reg[1]); - } - else { + } else { print ' '.$links[$key]['label']; } print ''; @@ -1380,8 +1350,7 @@ if ($resql) $companystatic->code_compta = $objp->code_compta; $companystatic->code_compta_fournisseur = $objp->code_compta_fournisseur; print $companystatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -1433,12 +1402,10 @@ if ($resql) if ($balancebefore >= 0) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } if (!$i) $totalarray['nbfield']++; @@ -1451,12 +1418,10 @@ if ($resql) if ($balance >= 0) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } if (!$i) $totalarray['nbfield']++; @@ -1502,15 +1467,13 @@ if ($resql) print ''; print img_edit(); print ''; - } - else { + } else { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { print ''; print img_edit(); print ''; - } - else { + } else { print ''; print img_view(); print ''; @@ -1560,16 +1523,14 @@ if ($resql) { if ($num < $limit && empty($offset)) print ''; else print ''; - } - elseif ($totalarray['totaldebfield'] == $i) print ''; + } elseif ($totalarray['totaldebfield'] == $i) print ''; elseif ($totalarray['totalcredfield'] == $i) print ''; elseif ($i == $posconciliatecol) { print ''; - } - else print ''; + } else print ''; } print ''; } @@ -1587,8 +1548,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index 3a15ddf72e1..8559096477d 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -89,8 +89,7 @@ if ($result) print ''; print ''; print ''; -} -else { +} else { dol_print_error($db); } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/accounting-files.php b/htdocs/compta/accounting-files.php index b14e3adafad..0c20e46e316 100644 --- a/htdocs/compta/accounting-files.php +++ b/htdocs/compta/accounting-files.php @@ -334,8 +334,7 @@ if (($action == 'searchfiles' || $action == 'dl')) { $nofile['sens'] = $objd->sens; $filesarray[$nofile['item'].'_'.$nofile['id']] = $nofile; - } - else { + } else { foreach ($files as $key => $file) { $file['id'] = $objd->id; @@ -382,14 +381,12 @@ if (($action == 'searchfiles' || $action == 'dl')) { $i++; } - } - else { + } else { dol_print_error($db); } $db->free($resd); - } - else { + } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'errors'); $error++; } @@ -489,8 +486,7 @@ if ($result && $action == "dl" && !$error) dol_delete_file($zipname); exit(); - } - else { + } else { setEventMessages($langs->trans("FailedToOpenFile", $zipname), null, 'errors'); } } @@ -622,8 +618,7 @@ if (!empty($date_start) && !empty($date_stop)) if (empty($TData)) { print '
'.$langs->trans("NoItem").'
 '.price($balancebefore).' '.price($balancebefore).'- '.price($balance).' '.price($balance).'-'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.price(-1 * $totalarray['totaldeb']).''.price(-1 * $totalarray['totaldeb']).''.price($totalarray['totalcred']).''; if ($user->rights->banque->consolidate && $action == 'reconcile') print ''; print '
'.$langs->trans("Total").''.price($total).''.price($totalnb ?price2num($total / $totalnb, 'MT') : 0).'
"; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index 3af40ffb2a0..3771d010f4f 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -99,8 +99,7 @@ if ($action == 'add') if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; - } - else { + } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -154,8 +153,7 @@ if ($action == 'add') $_GET["id"] = $id; // Force chargement page en mode visu $action = ''; - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -166,8 +164,7 @@ if ($action == 'add') if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -203,8 +200,7 @@ if ($action == 'update') if (empty($account_number) || $account_number == '-1') { $object->account_number = ''; - } - else { + } else { $object->account_number = $account_number; } $fk_accountancy_journal = GETPOST('fk_accountancy_journal', 'int'); @@ -256,8 +252,7 @@ if ($action == 'update') $object->setCategories($categories); $_GET["id"] = $_POST["id"]; // Force chargement page en mode visu - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; // Force chargement page edition @@ -267,8 +262,7 @@ if ($action == 'update') if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -285,8 +279,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); header("Location: ".DOL_URL_ROOT."/compta/bank/list.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -377,8 +370,7 @@ if ($action == 'create') if (isset($_POST["account_country_id"])) { $selectedcode = $_POST["account_country_id"] ? $_POST["account_country_id"] : $object->country_code; - } - elseif (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 ''.$langs->trans("BankAccountCountry").''; @@ -392,8 +384,7 @@ if ($action == 'create') if ($selectedcode) { $formcompany->select_departement(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : '', $selectedcode, 'account_state_id'); - } - else { + } else { print $countrynotdefined; } print ''; @@ -537,8 +528,7 @@ if ($action == 'create') print ''; print $formaccounting->select_account($object->account_number, 'account_number', 1, '', 1, 1); print ''; - } - else { + } else { print ''.$langs->trans("AccountancyCode").''; print 'account_number).'">'; } @@ -877,8 +867,7 @@ else { if ($selectedcode) { print $formcompany->select_state(isset($_POST["account_state_id"]) ? $_POST["account_state_id"] : $object->state_id, $selectedcode, 'account_state_id'); - } - else { + } else { print $countrynotdefined; } print ''; diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index b7bbb4d157e..0f71134d08a 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -132,8 +132,7 @@ if ($result) print ''; print ''; print ""; - } - else { + } else { print "".$objp->label.""; print ''; print ''.img_edit().''; diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cae83563b42..adb170ee81d 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -343,9 +343,9 @@ class Account extends CommonObject $string .= $this->code_guichet.' '; } elseif ($val == 'BankAccountNumberKey') { $string .= $this->cle_rib.' '; - }elseif ($val == 'BIC') { + } elseif ($val == 'BIC') { $string .= $this->bic.' '; - }elseif ($val == 'IBAN') { + } elseif ($val == 'IBAN') { $string .= $this->iban.' '; } } @@ -403,8 +403,7 @@ class Account extends CommonObject { $rowid = $this->db->last_insert_id(MAIN_DB_PREFIX."bank_url"); return $rowid; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -436,8 +435,7 @@ class Account extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."bank_url"; if ($fk_bank > 0) { $sql .= " WHERE fk_bank = ".$fk_bank; - } - else { $sql .= " WHERE url_id = ".$url_id." AND type = '".$type."'"; + } else { $sql .= " WHERE url_id = ".$url_id." AND type = '".$type."'"; } $sql .= " ORDER BY type, label"; @@ -463,8 +461,7 @@ class Account extends CommonObject $lines[$i]['fk_bank'] = $obj->fk_bank; $i++; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $lines; } @@ -508,8 +505,7 @@ class Account extends CommonObject { $obj = $this->db->fetch_object($resql); $oper = $obj->code; - } - else { + } else { dol_print_error($this->db, 'Failed to get payment type code'); return -1; } @@ -718,18 +714,15 @@ class Account extends CommonObject if ($result < 0) $error++; // End call triggers } - } - else { + } else { $error++; } - } - else { + } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans("ErrorBankLabelAlreadyExists"); $error++; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $error++; } @@ -739,8 +732,7 @@ class Account extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } @@ -831,8 +823,7 @@ class Account extends CommonObject if ($result < 0) $error++; // End call triggers } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); dol_print_error($this->db); @@ -842,8 +833,7 @@ class Account extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } @@ -900,8 +890,7 @@ class Account extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_print_error($this->db); return -1; @@ -998,12 +987,10 @@ class Account extends CommonObject $this->fetch_optionals(); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror; $this->errors[] = $this->error; return -1; @@ -1103,8 +1090,7 @@ class Account extends CommonObject dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR); } } - } - else { + } else { $error++; $this->error = "Error ".$this->db->lasterror(); } @@ -1114,8 +1100,7 @@ class Account extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1180,8 +1165,7 @@ class Account extends CommonObject if ($resql) { $obj = $this->db->fetch_object($resql); if ($obj->nb <= 1) $can_be_deleted = true; // Juste le solde - } - else { + } else { dol_print_error($this->db); } return $can_be_deleted; @@ -1279,8 +1263,7 @@ class Account extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1317,8 +1300,7 @@ class Account extends CommonObject $this->nb["banklines"] = $obj->nb; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -1352,8 +1334,7 @@ class Account extends CommonObject { $obj = $db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($db); + } else dol_print_error($db); return $nb; } @@ -1400,8 +1381,7 @@ class Account extends CommonObject if ($mode == 'transactions') { $url = DOL_URL_ROOT.'/compta/bank/bankentries_list.php?id='.$this->id; - } - elseif ($mode == 'receipts') + } elseif ($mode == 'receipts') { $url = DOL_URL_ROOT.'/compta/bank/releve.php?account='.$this->id; } @@ -1461,8 +1441,7 @@ class Account extends CommonObject if ($this->error_number == 0) { return 1; - } - else { + } else { return 0; } } @@ -1881,8 +1860,7 @@ class AccountLine extends CommonObject } $this->db->free($result); return $ret; - } - else { + } else { return -1; } } @@ -1969,8 +1947,7 @@ class AccountLine extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1998,8 +1975,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -$nbko; } @@ -2036,8 +2012,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -$nbko; } @@ -2067,8 +2042,7 @@ class AccountLine extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error(); return -1; @@ -2132,8 +2106,7 @@ class AccountLine extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2169,13 +2142,11 @@ class AccountLine extends CommonObject { return 1; } - } - else { + } else { dol_print_error($this->db); return 0; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return 0; } @@ -2235,13 +2206,11 @@ class AccountLine extends CommonObject { return 1; } - } - else { + } else { dol_print_error($this->db); return 0; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return 0; } @@ -2311,8 +2280,7 @@ class AccountLine extends CommonObject //$this->date_rappro = $obj->daterappro; // Not yet managed } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2453,8 +2421,7 @@ class AccountLine extends CommonObject { $alreadydispatched = $obj->nb; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/class/api_bankaccounts.class.php b/htdocs/compta/bank/class/api_bankaccounts.class.php index 6943d2bc5e1..3293f746033 100644 --- a/htdocs/compta/bank/class/api_bankaccounts.class.php +++ b/htdocs/compta/bank/class/api_bankaccounts.class.php @@ -225,8 +225,7 @@ class BankAccounts extends DolibarrApi if ($accountto->currency_code == $accountfrom->currency_code) { $amount_to = $amount; - } - else { + } else { if (!$amount_to || empty($amount_to)) { throw new RestException(422, 'You must provide amount_to value since bankaccount_from and bankaccount_to does not share the same currency.'); @@ -302,8 +301,7 @@ class BankAccounts extends DolibarrApi 'message' => 'Internal wire transfer created successfully.' ) ); - } - else { + } else { $this->db->rollback(); throw new RestException(500, $accountfrom->error.' '.$accountto->error); } @@ -336,8 +334,7 @@ class BankAccounts extends DolibarrApi if ($account->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $account->error); } } diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index ec88fea3f84..65c7e7ce2ea 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -169,8 +169,7 @@ class PaymentVarious extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -243,8 +242,7 @@ class PaymentVarious extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -428,8 +426,7 @@ class PaymentVarious extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $error++; } @@ -458,20 +455,17 @@ class PaymentVarious extends CommonObject $result = $this->call_trigger('PAYMENT_VARIOUS_CREATE', $user); if ($result < 0) $error++; // End call triggers - } - else $error++; + } else $error++; if (!$error) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -494,8 +488,7 @@ class PaymentVarious extends CommonObject if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -529,30 +522,25 @@ class PaymentVarious extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); @@ -610,8 +598,7 @@ class PaymentVarious extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -670,8 +657,7 @@ class PaymentVarious extends CommonObject $this->date_modif = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -698,8 +684,7 @@ class PaymentVarious extends CommonObject { $alreadydispatched = $obj->nb; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index d003463e5af..09cd81d4198 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -137,12 +137,10 @@ if ($id > 0 || !empty($ref)) { $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { Header('Location: index.php'); exit; } diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 796529a24d9..296211bf35c 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -84,8 +84,7 @@ if ($result < 0) $langs->load("errors"); $error++; setEventMessages($langs->trans("ErrorFailedToCreateDir"), null, 'errors'); -} -else { +} else { // Calcul $min and $max $sql = "SELECT MIN(b.datev) as min, MAX(b.datev) as max"; $sql .= " FROM ".MAIN_DB_PREFIX."bank as b"; @@ -101,8 +100,7 @@ else { $obj = $db->fetch_object($resql); $min = $db->jdate($obj->min); $max = $db->jdate($obj->max); - } - else { + } else { dol_print_error($db); } if (empty($min)) $min = dol_now() - 3600 * 24; @@ -149,8 +147,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -171,8 +168,7 @@ else { $row = $db->fetch_row($resql); $solde = $row[0]; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -195,8 +191,7 @@ else { if ($day > time()) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -289,8 +284,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -311,8 +305,7 @@ else { $row = $db->fetch_row($resql); $solde = $row[0]; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -336,8 +329,7 @@ else { if ($day > $now) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -423,8 +415,7 @@ else { $amounts[$row[0]] = $row[1]; $i++; } - } - else { + } else { dol_print_error($db); } @@ -450,8 +441,7 @@ else { if ($day > ($max + 86400)) { $datas[$i] = ''; // Valeur speciale permettant de ne pas tracer le graph - } - else { + } else { $datas[$i] = 0 + $solde + $subtotal; } $datamin[$i] = $object->min_desired; @@ -547,8 +537,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -580,8 +569,7 @@ else { $debits[$row[0]] = abs($row[1]); } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -662,8 +650,7 @@ else { $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } $sql = "SELECT date_format(b.datev,'%m')"; @@ -686,8 +673,7 @@ else { $debits[$row[0]] = abs($row[1]); } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -756,14 +742,12 @@ if ($account) { $morehtml = ''.$langs->trans("ShowAllAccounts").''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', '', $moreparam, 0, '', '', 1); - } - else { + } else { $morehtml = ''.$langs->trans("BackToAccount").''; print $langs->trans("AllAccounts"); //print $morehtml; } - } - else { + } else { $bankaccount = new Account($db); $listid = explode(',', $account); foreach ($listid as $key => $id) @@ -774,8 +758,7 @@ if ($account) if ($key < (count($listid) - 1)) print ', '; } } -} -else { +} else { print $langs->trans("AllAccounts"); } @@ -791,8 +774,7 @@ if ($mode == 'showalltime') print ''; print $langs->trans("GoBack"); print ''; -} -else { +} else { print ''; print $langs->trans("ShowAllTimeBalance"); print ''; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index a1c37d59050..d2b3e6099dd 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -76,15 +76,15 @@ if ($user->rights->banque->consolidate && $action == 'donext') { $al = new AccountLine($db); $al->dateo_next($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'doprev') +} elseif ($user->rights->banque->consolidate && $action == 'doprev') { $al = new AccountLine($db); $al->dateo_previous($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'dvnext') +} elseif ($user->rights->banque->consolidate && $action == 'dvnext') { $al = new AccountLine($db); $al->datev_next($_GET["rowid"]); -}elseif ($user->rights->banque->consolidate && $action == 'dvprev') +} elseif ($user->rights->banque->consolidate && $action == 'dvprev') { $al = new AccountLine($db); $al->datev_previous($_GET["rowid"]); @@ -99,8 +99,7 @@ if ($action == 'confirm_delete_categ' && $confirm == "yes" && $user->rights->ban { dol_print_error($db); } - } - else { + } else { setEventMessages($langs->trans("MissingIds"), null, 'errors'); } } @@ -119,8 +118,7 @@ if ($user->rights->banque->modifier && $action == "update") if (GETPOST('accountid', 'int') > 0 && !$acline->rappro && !$acline->getVentilExportCompta()) // We ask to change bank account { $actarget->fetch(GETPOST('accountid', 'int')); - } - else { + } else { $actarget->fetch($id); } @@ -189,8 +187,7 @@ if ($user->rights->banque->modifier && $action == "update") { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -226,8 +223,7 @@ if ($user->rights->banque->consolidate && ($action == 'num_releve' || $action == { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -320,8 +316,7 @@ if ($result) if (!$objp->rappro && !$bankline->getVentilExportCompta()) { $form->select_comptes($acct->id, 'accountid', 0, '', 0); - } - else { + } else { print $acct->getNomUrl(1, 'transactions', 'reflabel'); } print ''; @@ -345,8 +340,7 @@ if ($result) print $langs->trans("Payment"); print '';*/ print $paymenttmp->getNomUrl(1); - } - elseif ($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']); @@ -356,79 +350,66 @@ if ($result) print $langs->trans("Payment"); print '';*/ print $paymenttmp->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'company') { + } elseif ($links[$key]['type'] == 'company') { $societe = new Societe($db); $societe->fetch($links[$key]['url_id']); print $societe->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'sc') { + } elseif ($links[$key]['type'] == 'sc') { print ''; print img_object($langs->trans('SocialContribution'), 'bill').' '; print $langs->trans("SocialContribution").($links[$key]['label'] ? ' - '.$links[$key]['label'] : ''); print ''; - } - elseif ($links[$key]['type'] == 'payment_sc') { + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print img_object($langs->trans('Payment'), 'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_vat') { + } elseif ($links[$key]['type'] == 'payment_vat') { print ''; print img_object($langs->trans('VAT'), 'payment').' '; print $langs->trans("VATPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_salary') { + } elseif ($links[$key]['type'] == 'payment_salary') { print ''; print img_object($langs->trans('PaymentSalary'), 'payment').' '; print $langs->trans("SalaryPayment"); print ''; - } - elseif ($links[$key]['type'] == 'payment_loan') { + } elseif ($links[$key]['type'] == 'payment_loan') { print ''; print img_object($langs->trans('LoanPayment'), 'payment').' '; print $langs->trans("PaymentLoan"); print ''; - } - elseif ($links[$key]['type'] == 'loan') { + } elseif ($links[$key]['type'] == 'loan') { print ''; print img_object($langs->trans('Loan'), 'bill').' '; print $langs->trans("Loan"); print ''; - } - elseif ($links[$key]['type'] == 'member') { + } elseif ($links[$key]['type'] == 'member') { print ''; print img_object($langs->trans('Member'), 'user').' '; print $links[$key]['label']; print ''; - } - elseif ($links[$key]['type'] == 'payment_donation') { + } elseif ($links[$key]['type'] == 'payment_donation') { print ''; print img_object($langs->trans('Donation'), 'payment').' '; print $langs->trans("DonationPayment"); print ''; - } - elseif ($links[$key]['type'] == 'banktransfert') { + } elseif ($links[$key]['type'] == 'banktransfert') { print ''; print img_object($langs->trans('Transaction'), 'payment').' '; print $langs->trans("TransactionOnTheOtherAccount"); print ''; - } - elseif ($links[$key]['type'] == 'user') { + } elseif ($links[$key]['type'] == 'user') { print ''; print img_object($langs->trans('User'), 'user').' '; print $langs->trans("User"); print ''; - } - elseif ($links[$key]['type'] == 'payment_various') { + } elseif ($links[$key]['type'] == 'payment_various') { print ''; print img_object($langs->trans('VariousPayment'), 'payment').' '; print $langs->trans("VariousPayment"); print ''; - } - else { + } else { print ''; print img_object('', 'generic').' '; print $links[$key]['label']; @@ -458,8 +439,7 @@ if ($result) print '     '.$langs->trans("CheckReceipt").': '.$receipt->getNomUrl(2); } print ''; - } - else { + } else { print ''.$objp->fk_type.' '.$objp->num_chq.''; } print ""; @@ -473,8 +453,7 @@ if ($result) print ''; print ''; print ''; - } - else { + } else { print ''.$objp->emetteur.''; } print ""; @@ -488,8 +467,7 @@ if ($result) print ''; print ''; print ''; - } - else { + } else { print ''.$objp->banque.''; } print ""; @@ -509,8 +487,7 @@ if ($result) print img_edit_add().""; } print ''; - } - else { + } else { print ''; print dol_print_date($db->jdate($objp->do), "day"); print ''; @@ -532,8 +509,7 @@ if ($result) print img_edit_add().""; } print ''; - } - else { + } else { print ''; print dol_print_date($db->jdate($objp->dv), "day"); print ''; @@ -550,21 +526,18 @@ if ($result) { // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); - } - else { + } else { print $objp->label; } print '">'; print ''; - } - else { + } else { print ''; if (preg_match('/^\((.*)\)$/i', $objp->label, $reg)) { // Label generique car entre parentheses. On l'affiche en le traduisant print $langs->trans($reg[1]); - } - else { + } else { print $objp->label; } print ''; @@ -578,8 +551,7 @@ if ($result) print ''; print 'rappro ? ' disabled' : '').' value="'.price($objp->amount).'"> '.$langs->trans("Currency".$acct->currency_code); print ''; - } - else { + } else { print ''; print price($objp->amount); print ''; @@ -635,14 +607,12 @@ if ($result) { print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; print ''; - } - else { + } else { print $langs->trans("AccountStatement").' rappro ? ' disabled' : '').'>'; } if ($objp->num_releve) print '   ('.$langs->trans("AccountStatement").' '.$objp->num_releve.')'; print ''; - } - else { + } else { print ''.$objp->num_releve.' '; } print ''; @@ -653,8 +623,7 @@ if ($result) print ''; print 'rappro ? ' checked="checked"' : '')).'">'; print ''; - } - else { + } else { print ''.yn($objp->rappro).''; } print ''; @@ -677,8 +646,7 @@ if ($result) } $db->free($result); -} -else dol_print_error($db); +} else dol_print_error($db); // End of page llxFooter(); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index bc45c708f33..882244518f7 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -212,8 +212,7 @@ if ($resql) $i++; } $db->free($resql); -} -else dol_print_error($db); +} else dol_print_error($db); @@ -487,8 +486,7 @@ foreach ($accounts as $key=>$type) $accountingaccount = new AccountingAccount($db); $accountingaccount->fetch('', $objecttmp->account_number, 1); print $accountingaccount->getNomUrl(0, 1, 1, '', 1); - } - else { + } else { print $objecttmp->account_number; } print ''; @@ -504,8 +502,7 @@ foreach ($accounts as $key=>$type) $accountingjournal = new AccountingJournal($db); $accountingjournal->fetch($objecttmp->fk_accountancy_journal); print $accountingjournal->getNomUrl(0, 1, 1, '', 1); - } - else { + } else { print ''; } print ''; diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index 65476665963..4244856c9ab 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -125,8 +125,7 @@ if ($_GET["rel"] == 'prev') $found = true; } } -} -elseif ($_GET["rel"] == 'next') +} elseif ($_GET["rel"] == 'next') { // Recherche valeur pour num = numero releve precedent $sql = "SELECT DISTINCT(b.num_releve) as num"; @@ -147,8 +146,7 @@ elseif ($_GET["rel"] == 'next') $found = true; } } -} -else { +} else { // On veut le releve num $found = true; } @@ -295,15 +293,13 @@ if (empty($numref)) if (!isset($objp->numr)) { // - } - else { + } else { print ''; print ''; if ($action != 'editbankreceipt' || $objp->numr != $brref) { print ''.$objp->numr.''; - } - else { + } else { print ''; print ''; print ''; @@ -353,12 +349,10 @@ if (empty($numref)) print ''; print "\n
\n"; - } - else { + } else { dol_print_error($db); } -} -else { +} else { /** * Show list of record into a bank statement */ @@ -484,58 +478,50 @@ else { $paymentstatic->ref = $langs->trans("Payment"); print ' '.$paymentstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_supplier') + } elseif ($links[$key]['type'] == 'payment_supplier') { $paymentsupplierstatic->id = $links[$key]['url_id']; $paymentsupplierstatic->ref = $langs->trans("Payment"); print ' '.$paymentsupplierstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_sc') + } elseif ($links[$key]['type'] == 'payment_sc') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print $langs->trans("SocialContributionPayment"); print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_vat') + } elseif ($links[$key]['type'] == 'payment_vat') { $paymentvatstatic->id = $links[$key]['url_id']; $paymentvatstatic->ref = $langs->trans("Payment"); print ' '.$paymentvatstatic->getNomUrl(1); - } - elseif ($links[$key]['type'] == 'payment_salary') + } elseif ($links[$key]['type'] == 'payment_salary') { print ''; print ' '.img_object($langs->trans('ShowPayment'), 'payment').' '; print $langs->trans("Payment"); print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_donation') + } elseif ($links[$key]['type'] == 'payment_donation') { $paymentdonationstatic->id = $links[$key]['url_id']; $paymentdonationstatic->ref = $langs->trans("Payment"); print ' '.$paymentdonationstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_loan') + } elseif ($links[$key]['type'] == 'payment_loan') { $paymentloanstatic->id = $links[$key]['url_id']; $paymentloanstatic->ref = $langs->trans("Payment"); print ' '.$paymentloanstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'payment_various') + } elseif ($links[$key]['type'] == 'payment_various') { $paymentvariousstatic->id = $links[$key]['url_id']; $paymentvariousstatic->ref = $langs->trans("Payment"); print ' '.$paymentvariousstatic->getNomUrl(1); $newline = 0; - } - elseif ($links[$key]['type'] == 'banktransfert') { + } elseif ($links[$key]['type'] == 'banktransfert') { // Do not show link to transfer since there is no transfer card (avoid confusion). Can already be accessed from transaction detail. if ($objp->amount > 0) { @@ -549,8 +535,7 @@ else { $bankstatic->label = $objp->bankref; print $bankstatic->getNomUrl(1, ''); print ')'; - } - else { + } else { $bankstatic->id = $objp->bankid; $bankstatic->label = $objp->bankref; print ' ('.$langs->trans("from").' '; @@ -562,35 +547,30 @@ else { print $bankstatic->getNomUrl(1, 'transactions'); print ')'; } - } - elseif ($links[$key]['type'] == 'company') { + } elseif ($links[$key]['type'] == 'company') { $societestatic->id = $links[$key]['url_id']; $societestatic->name = $links[$key]['label']; print $societestatic->getNomUrl(1, 'company', 24); $newline = 0; - } - elseif ($links[$key]['type'] == 'member') { + } elseif ($links[$key]['type'] == 'member') { print ''; print img_object($langs->trans('ShowMember'), 'user').' '; print $links[$key]['label']; print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'user') { + } elseif ($links[$key]['type'] == 'user') { print ''; print img_object($langs->trans('ShowUser'), 'user').' '; print $links[$key]['label']; print ''; $newline = 0; - } - elseif ($links[$key]['type'] == 'sc') { + } elseif ($links[$key]['type'] == 'sc') { print ''; print img_object($langs->trans('ShowBill'), 'bill').' '; print $langs->trans("SocialContribution"); print ''; $newline = 0; - } - else { + } else { print ''; print $links[$key]['label']; print ''; @@ -620,8 +600,7 @@ else { print "
".$objc->label.""; $ii++; } - } - else { + } else { dol_print_error($db); } } @@ -632,8 +611,7 @@ else { { $totald = $totald + abs($objp->amount); print ''.price($objp->amount * -1)." \n"; - } - else { + } else { $totalc = $totalc + abs($objp->amount); print ' '.price($objp->amount)."\n"; } @@ -645,8 +623,7 @@ else { print ''; print img_edit(); print ""; - } - else { + } else { print " "; } print ""; diff --git a/htdocs/compta/bank/transfer.php b/htdocs/compta/bank/transfer.php index 99a66321648..7228c38fe50 100644 --- a/htdocs/compta/bank/transfer.php +++ b/htdocs/compta/bank/transfer.php @@ -87,8 +87,7 @@ if ($action == 'add') if ($accountto->currency_code == $accountfrom->currency_code) { $amountto = $amount; - } - else { + } else { if (!$amountto) { $error++; @@ -129,13 +128,11 @@ if ($action == 'add') $mesgs = $langs->trans("TransferFromToDone", ''.$accountfrom->label."", ''.$accountto->label."", $amount, $langs->transnoentities("Currency".$conf->currency)); setEventMessages($mesgs, null, 'mesgs'); $db->commit(); - } - else { + } else { setEventMessages($accountfrom->error.' '.$accountto->error, null, 'errors'); $db->rollback(); } - } - else { + } else { $error++; setEventMessages($langs->trans("ErrorFromToAccountsMustDiffers"), null, 'errors'); } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 929a1611775..cf494b77a90 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -72,8 +72,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($vline) { $viewline = $vline; - } - else { + } else { $viewline = 20; } @@ -289,8 +288,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) if ($obj->family == 'invoice') { $mc->getInfo($obj->entity); print "".$mc->label.""; - } - else { + } else { print ""; } } @@ -303,8 +301,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $i++; } - } - else { + } else { dol_print_error($db); } @@ -324,8 +321,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) print ""; print "
"; -} -else { +} else { print $langs->trans("ErrorBankAccountNotFound"); } diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index ffabd082bfa..071a5abf0a9 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -163,8 +163,7 @@ if (empty($reshook)) $urltogo = ($backtopage ? $backtopage : DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); header("Location: ".$urltogo); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -197,19 +196,16 @@ if (empty($reshook)) $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } @@ -371,8 +367,7 @@ if ($action == 'create') print ''; print $formaccounting->select_account($accountancy_code, 'accountancy_code', 1, null, 1, 1); print ''; - } - else // For external software + } else // For external software { print ''.$langs->trans("AccountAccounting").''; print ''; @@ -387,13 +382,11 @@ if ($action == 'create') if (!empty($conf->global->ACCOUNTANCY_COMBO_FOR_AUX)) { print $formaccounting->select_auxaccount($subledger_account, 'subledger_account', 1, ''); - } - else { + } else { print ''; } print ''; - } - else // For external software + } else // For external software { print ''.$langs->trans("SubledgerAccount").''; print ''; @@ -559,12 +552,10 @@ if ($id) } else { print ''; } - } - else { + } else { print ''; } - } - else { + } else { print ''; } diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index 624ead86073..7a89fd77986 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -149,8 +149,7 @@ if ($object->id) $permission = $user->rights->banque->modifier; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/bank/various_payment/list.php b/htdocs/compta/bank/various_payment/list.php index 5fa44ba8555..d02f75819e4 100644 --- a/htdocs/compta/bank/various_payment/list.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -75,8 +75,7 @@ if (!GETPOST('typeid')) $part = explode(':', $val); if ($part[0] == 'v.fk_typepayment') $typeid = $part[1]; } -} -else { +} else { $typeid = GETPOST('typeid'); } @@ -312,8 +311,7 @@ if ($result) $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } @@ -372,8 +370,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index fce50a977e4..b14b77d5264 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -107,8 +107,7 @@ if (GETPOST('cancel', 'alpha')) { if ($action == 'valid') { $action = 'view'; - } - else { + } else { $action = 'create'; } } @@ -144,8 +143,7 @@ if ($action == "start") $action = 'create'; $error++; } -} -elseif ($action == "add") +} elseif ($action == "add") { if (GETPOST('opening', 'alpha') == '') { @@ -177,8 +175,7 @@ elseif ($action == "add") { $db->commit(); $action = "view"; - } - else { + } else { $db->rollback; $action = "view"; } @@ -216,8 +213,7 @@ if ($action == "valid") // validate = close { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); - } - else { + } else { setEventMessages($langs->trans("CashFenceDone"), null); $db->commit(); } @@ -251,8 +247,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) setEventMessages("RecordDeleted", null, 'mesgs'); header("Location: ".$backurlforlist); exit; - } - else { + } else { if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } @@ -279,8 +274,7 @@ if ($action == "create" || $action == "start" || $action == 'close') $syear = $object->year_close; $smonth = $object->month_close; $sday = $object->day_close; - } - elseif (GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '-1') + } elseif (GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '' && GETPOST('posnumber', 'alpha') != '-1') { $posmodule = GETPOST('posmodule', 'alpha'); $terminalid = GETPOST('posnumber', 'alpha'); @@ -324,10 +318,8 @@ if ($action == "create" || $action == "start" || $action == 'close') { $obj = $db->fetch_object($resql); if ($obj) $initialbalanceforterminal[$terminalid][$key] = $obj->total; - } - else dol_print_error($db); - } - else { + } else dol_print_error($db); + } else { setEventMessages($langs->trans("SetupOfTerminalNotComplete", $terminaltouse), null, 'errors'); $error++; } @@ -366,8 +358,7 @@ if ($action == "create" || $action == "start" || $action == 'close') $theoricalamountforterminal[$terminalid][$key] = price2num($theoricalamountforterminal[$terminalid][$key] + $obj->total); $theoricalnbofinvoiceforterminal[$terminalid][$key] = $obj->nb; } - } - else dol_print_error($db); + } else dol_print_error($db); } } @@ -383,13 +374,11 @@ if ($action == "create" || $action == "start" || $action == 'close') if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; - } - elseif ($action == 'close') + } elseif ($action == 'close') { print ''; print ''; - } - else { + } else { print ''; } @@ -463,8 +452,7 @@ if ($action == "create" || $action == "start" || $action == 'close') if ($action == 'start' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '' && GETPOST('posnumber') != '-1') { print ''; - } - else { + } else { print ''; } print ''; @@ -562,8 +550,7 @@ if ($action == "create" || $action == "start" || $action == 'close') { $object->fetch($id); print $object->opening; - } - else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); + } else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); print '">'; print ''; // Amount per payment type @@ -601,8 +588,7 @@ if (empty($action) || $action == "view" || $action == "close") if ($result <= 0) { print $langs->trans("ErrorRecordNotFound"); - } - else { + } else { $head = array(); $head[0][0] = DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?id='.$object->id; $head[0][1] = $langs->trans("CashControl"); @@ -699,13 +685,11 @@ if (empty($action) || $action == "view" || $action == "close") if ($action == 'start' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '' && GETPOST('posnumber', 'int') != '-1') { print ''; - } - elseif ($action == 'close') + } elseif ($action == 'close') { print ''; print ''; - } - else { + } else { print ''; } @@ -852,8 +836,7 @@ if (empty($action) || $action == "view" || $action == "close") { $object->fetch($id); print $object->opening; - } - else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); + } else print (GETPOSTISSET('opening') ?price2num(GETPOST('opening', 'alpha')) : price($initialbalanceforterminal[$terminalid]['cash'])); print '">'; print ''; // Amount per payment type diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 5269c07bab2..0279ad5143c 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -259,8 +259,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/cashcontrol/class/cashcontrol.class.php b/htdocs/compta/cashcontrol/class/cashcontrol.class.php index 81a19389244..0f60be3c3a8 100644 --- a/htdocs/compta/cashcontrol/class/cashcontrol.class.php +++ b/htdocs/compta/cashcontrol/class/cashcontrol.class.php @@ -404,8 +404,7 @@ class CashControl extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 5b9079f9d72..f2d8e38fb15 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -172,8 +172,7 @@ if ($resql) $bankaccounttmp->fetch($objp->bankid); $cachebankaccount[$objp->bankid] = $bankaccounttmp; $bankaccount = $bankaccounttmp; - } - else { + } else { $bankaccount = $cachebankaccount[$objp->bankid]; } @@ -207,8 +206,7 @@ if ($resql) print $bankaccount->getNomUrl(1); if ($cashcontrol->posmodule == "takepos") { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'.$cashcontrol->posnumber; - } - else { + } else { $var1 = 'CASHDESK_ID_BANKACCOUNT_CASH'; } if ($objp->code == 'CHQ') { @@ -310,8 +308,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 991d039d1fb..def4fda9b10 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -103,8 +103,7 @@ if ($mode != 'sconly') { $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 1); -} -else { +} else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'object_payment', 0, '', '', $limit, 0); } @@ -216,8 +215,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } // Paid @@ -239,8 +237,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) if (!empty($conf->banque->enabled)) print ''; print ''.price($totalpaye).""; print ""; - } - else { + } else { dol_print_error($db); } print ''; @@ -332,8 +329,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } @@ -354,8 +350,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -366,18 +361,15 @@ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $j = 1; $numlt = 3; -} -elseif ($mysoc->localtax1_assuj == "1") +} elseif ($mysoc->localtax1_assuj == "1") { $j = 1; $numlt = 2; -} -elseif ($mysoc->localtax2_assuj == "1") +} elseif ($mysoc->localtax2_assuj == "1") { $j = 2; $numlt = 3; -} -else { +} else { $j = 0; $numlt = 0; } @@ -447,8 +439,7 @@ while ($j < $numlt) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -541,8 +532,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $accountstatic->accountancy_journal = $obj->accountancy_journal; $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } @@ -560,8 +550,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $db->free($result); print "
"; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/clients.php b/htdocs/compta/clients.php index 74cc0d594e5..5632e8ebc1a 100644 --- a/htdocs/compta/clients.php +++ b/htdocs/compta/clients.php @@ -196,8 +196,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index b688bd17907..d2fd1c54cce 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -70,14 +70,11 @@ if ($action == 'validate' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } -} - -elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) +} elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { $object->fetch($id); if ($object->statut == Deplacement::STATUS_VALIDATED) @@ -87,27 +84,21 @@ elseif ($action == 'classifyrefunded' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } -} - -elseif ($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) { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } -} - -elseif ($action == 'add' && $user->rights->deplacement->creer) +} elseif ($action == 'add' && $user->rights->deplacement->creer) { if (!GETPOST('cancel', 'alpha')) { @@ -146,17 +137,14 @@ elseif ($action == 'add' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } - } - else { + } else { $action = 'create'; } - } - else { + } else { header("Location: index.php"); exit; } @@ -183,12 +171,10 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -209,8 +195,7 @@ elseif ($action == 'setdated' && $user->rights->deplacement->creer) $object->fetch($id); $result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY'); if ($result < 0) dol_print_error($db, $object->error); -} -elseif ($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'); @@ -305,8 +290,7 @@ if ($action == 'create') print ''; print ''; -} -elseif ($id) +} elseif ($id) { $result = $object->fetch($id); if ($result > 0) @@ -404,8 +388,7 @@ elseif ($id) print ''; print ''; - } - else { + } else { /* * Confirm delete trip */ @@ -483,8 +466,7 @@ elseif ($id) if ($action == 'classify') { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1); - } - else { + } else { $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0); } print ''; @@ -518,8 +500,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('Modify').''; - } - else { + } else { print ''.$langs->trans('Modify').''; } } @@ -529,8 +510,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('Validate').''; - } - else { + } else { print ''.$langs->trans('Validate').''; } } @@ -540,8 +520,7 @@ elseif ($id) if ($user->rights->deplacement->creer) { print ''.$langs->trans('ClassifyRefunded').''; - } - else { + } else { print ''.$langs->trans('ClassifyRefunded').''; } } @@ -549,15 +528,13 @@ elseif ($id) if ($user->rights->deplacement->supprimer) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } print ''; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/deplacement/class/deplacement.class.php b/htdocs/compta/deplacement/class/deplacement.class.php index 8051d074db5..69baf710b95 100644 --- a/htdocs/compta/deplacement/class/deplacement.class.php +++ b/htdocs/compta/deplacement/class/deplacement.class.php @@ -199,14 +199,12 @@ class Deplacement extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return $result; } - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -265,8 +263,7 @@ class Deplacement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -309,8 +306,7 @@ class Deplacement extends CommonObject $this->extraparams = (array) json_decode($obj->extraparams, true); return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -334,8 +330,7 @@ class Deplacement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -370,30 +365,25 @@ class Deplacement extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 2) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 2 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); @@ -455,8 +445,7 @@ class Deplacement extends CommonObject $ret[$obj->code] = (($langs->trans($obj->code) != $obj->code) ? $langs->trans($obj->code) : $obj->label); $i++; } - } - else { + } else { dol_print_error($this->db); } @@ -501,8 +490,7 @@ class Deplacement extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/deplacement/document.php b/htdocs/compta/deplacement/document.php index 4ad2044c0f1..889eb390ca2 100644 --- a/htdocs/compta/deplacement/document.php +++ b/htdocs/compta/deplacement/document.php @@ -123,8 +123,7 @@ if ($object->id) $permission = $user->rights->deplacement->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/deplacement/index.php b/htdocs/compta/deplacement/index.php index 9ed6e430c4c..0cea847f9ce 100644 --- a/htdocs/compta/deplacement/index.php +++ b/htdocs/compta/deplacement/index.php @@ -192,13 +192,11 @@ if ($result) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print '
'; -} -else dol_print_error($db); +} else dol_print_error($db); print ''; diff --git a/htdocs/compta/deplacement/list.php b/htdocs/compta/deplacement/list.php index 1ebaeb5c6fa..78c1f32556d 100644 --- a/htdocs/compta/deplacement/list.php +++ b/htdocs/compta/deplacement/list.php @@ -196,8 +196,7 @@ if ($resql) print ""; print "\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 91c6546a83c..7707cb40786 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -167,8 +167,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -293,8 +292,7 @@ print '
'; // Show graphs print '"; - } - else { + } else { print ''; } @@ -1184,12 +1166,10 @@ if ($action == 'create') print ''; print ''; print "\n"; - } - else { + } else { dol_print_error('', "Error, no invoice ".$object->id); } -} -else { +} else { /* * View mode */ @@ -1312,8 +1292,7 @@ else { if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->cond_reglement_id, 'none'); } } else { @@ -1333,8 +1312,7 @@ else { if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -1441,8 +1419,7 @@ else { if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -1467,8 +1444,7 @@ else { } $select = 'select;'.implode(',', $list); print $form->editfieldval($langs->trans("Model"), 'modelpdf', $object->modelpdf, $object, $user->rights->facture->creer, $select); - } - else { + } else { print $object->modelpdf; } print ""; @@ -1516,13 +1492,11 @@ else { print ''; print ''; print '
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 8256aeacc5a..a0d09a11980 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -238,8 +238,7 @@ if (empty($reshook)) setEventMessages($oldinvoice->error, $oldinvoice->errors, 'errors'); $action = "create"; } - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -251,8 +250,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF'].'?facid='.$object->id); exit; - } - else { + } else { $db->rollback(); $error++; @@ -298,8 +296,7 @@ if (empty($reshook)) $object->titre = GETPOST('ref', 'alpha'); // deprecated $object->title = GETPOST('ref', 'alpha'); $object->ref = $object->title; - } - else dol_print_error($db, $object->error, $object->errors); + } else dol_print_error($db, $object->error, $object->errors); } // Set bank account elseif ($action == 'setbankaccount' && $user->rights->facture->creer) @@ -354,8 +351,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -377,8 +373,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -414,18 +409,15 @@ if (empty($reshook)) { $db->commit(); $object->fetch($object->id); // Reload lines - } - else { + } else { $db->rollback(); setEventMessages($db->lasterror(), null, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($line->error, $line->errors, 'errors'); } - } - elseif ($action == 'update_extras') + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -460,8 +452,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -571,8 +562,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -595,8 +585,7 @@ if (empty($reshook)) } $desc = (!empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description; - } - else { + } else { $desc = $prod->description; } @@ -631,8 +620,7 @@ if (empty($reshook)) $type = $prod->type; $fk_unit = $prod->fk_unit; - } - else { + } else { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0); @@ -662,8 +650,7 @@ if (empty($reshook)) if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); - } - else { + } else { // Insert line $result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit, 0, $date_start_fill, $date_end_fill, $fournprice, $buyingprice); @@ -727,17 +714,14 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } $action = ''; } } - } - - elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) + } elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { if (!$object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -935,8 +919,7 @@ if (empty($reshook)) unset($_POST['situations']); unset($_POST['progress']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1131,8 +1114,7 @@ if ($action == 'create') $select = array('0'=>$langs->trans('DoNotGenerateDoc'), '1'=>$langs->trans('AutoGenerateDoc')); print $form->selectarray('generate_pdf', $select, GETPOST('generate_pdf')); print "
'; - } - else { + } else { if ($object->frequency > 0) { print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency); - } - else { + } else { print $langs->trans("NotARecurringInvoiceTemplate"); } } @@ -1533,8 +1507,7 @@ else { if ($action == 'date_when' || $object->frequency > 0) { print $form->editfieldkey($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day'); - } - else { + } else { print $langs->trans("NextDateToExecution"); } print ''; @@ -1546,8 +1519,7 @@ else { if (!$object->isMaxNbGenReached()) { if (!$object->suspended && $action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late")); - } - else { + } else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print ''; @@ -1558,16 +1530,14 @@ else { if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldkey($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max, $object, $user->rights->facture->creer); - } - else { + } else { print $langs->trans("MaxPeriodNumber"); } print ''; if ($action == 'nb_gen_max' || $object->frequency > 0) { print $form->editfieldval($langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max ? $object->nb_gen_max : '', $object, $user->rights->facture->creer); - } - else { + } else { print ''; } print ''; @@ -1602,8 +1572,7 @@ else { } print ''; print ''; - } - else { + } else { print ''; } @@ -1704,18 +1673,15 @@ else { if (!empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) { print ''; - } - else { + } else { if (empty($object->frequency) || $object->date_when <= $today) { print ''; - } - else { + } else { print ''; } } - } - else { + } else { print ''; } } @@ -1725,8 +1691,7 @@ else { if (empty($object->suspended)) { print ''; - } - else { + } else { print ''; } } diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 68b1a6e91df..677701b9970 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -335,32 +335,24 @@ if (empty($reshook)) } } } - } - - elseif ($action == 'set_thirdparty' && $usercancreate) + } elseif ($action == 'set_thirdparty' && $usercancreate) { $object->fetch($id); $object->setValueFrom('fk_soc', $socid, '', null, 'int', '', $user, 'BILL_MODIFY'); header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit(); - } - - elseif ($action == 'classin' && $usercancreate) + } elseif ($action == 'classin' && $usercancreate) { $object->fetch($id); $object->setProject($_POST['projectid']); - } - - elseif ($action == 'setmode' && $usercancreate) + } elseif ($action == 'setmode' && $usercancreate) { $object->fetch($id); $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarrantyconditions' && $user->rights->facture->creer) { $object->fetch($id); $object->retained_warranty_fk_cond_reglement = 0; // To clean property @@ -373,17 +365,13 @@ if (empty($reshook)) if ($object->retained_warranty_date_limit < $object->date) $object->retained_warranty_date_limit = $object->date; $result = $object->update($user); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarranty' && $user->rights->facture->creer) { $object->fetch($id); $result = $object->setRetainedWarranty(GETPOST('retained_warranty', 'float')); if ($result < 0) dol_print_error($db, $object->error); - } - - elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) + } elseif ($action == 'setretainedwarrantydatelimit' && $user->rights->facture->creer) { $object->fetch($id); $result = $object->setRetainedWarrantyDateLimit(GETPOST('retained_warranty_date_limit', 'float')); @@ -400,9 +388,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $usercancreate) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); - } - - elseif ($action == 'setinvoicedate' && $usercancreate) + } elseif ($action == 'setinvoicedate' && $usercancreate) { $object->fetch($id); $old_date_lim_reglement = $object->date_lim_reglement; @@ -421,9 +407,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($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']); @@ -432,9 +416,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setconditions' && $usercancreate) + } elseif ($action == 'setconditions' && $usercancreate) { $object->fetch($id); $object->cond_reglement_code = 0; // To clean property @@ -450,9 +432,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($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']); @@ -464,9 +444,7 @@ if (empty($reshook)) if ($result < 0) { dol_print_error($db, $object->error); } - } - - elseif ($action == 'setrevenuestamp' && $usercancreate) + } elseif ($action == 'setrevenuestamp' && $usercancreate) { $object->fetch($id); $object->revenuestamp = GETPOST('revenuestamp'); @@ -506,15 +484,11 @@ if (empty($reshook)) elseif ($action == 'setbankaccount' && $usercancreate) { $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } - - elseif ($action == 'setremisepercent' && $usercancreate) + } elseif ($action == 'setremisepercent' && $usercancreate) { $object->fetch($id); $result = $object->set_remise($user, $_POST['remise_percent']); - } - - elseif ($action == "setabsolutediscount" && $usercancreate) + } elseif ($action == "setabsolutediscount" && $usercancreate) { // POST[remise_id] or POST[remise_id_for_payment] @@ -570,15 +544,11 @@ if (empty($reshook)) $result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'setref' && $usercancreate) + } elseif ($action == 'setref' && $usercancreate) { $object->fetch($id); $object->setValueFrom('ref', GETPOST('ref'), '', null, '', '', $user, 'BILL_MODIFY'); - } - - elseif ($action == 'setref_client' && $usercancreate) + } elseif ($action == 'setref_client' && $usercancreate) { $object->fetch($id); $object->set_ref_client(GETPOST('ref_client')); @@ -618,8 +588,7 @@ if (empty($reshook)) } } } - } - else { + } else { //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') { @@ -694,8 +663,7 @@ if (empty($reshook)) $result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result < 0) setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { if (count($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, $object->errors, 'errors'); } @@ -969,16 +937,14 @@ if (empty($reshook)) if ($result >= 0) { $db->commit(); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } } else { $db->commit(); } - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $db->rollback(); } @@ -1171,8 +1137,7 @@ if (empty($reshook)) { $searchPreviousInvoice = false; // find, exit; break; - } - else { + } else { $lineIndex--; // go to previous invoice in cycle } } @@ -1360,8 +1325,7 @@ if (empty($reshook)) if (in_array($object->type, $retainedWarrantyInvoiceAvailableType)) { $object->retained_warranty = GETPOST('retained_warranty', 'int'); $object->retained_warranty_fk_cond_reglement = GETPOST('retained_warranty_fk_cond_reglement', 'int'); - } - else { + } else { $object->retained_warranty = 0; $object->retained_warranty_fk_cond_reglement = 0; } @@ -1464,13 +1428,11 @@ if (empty($reshook)) $amount_ttc_diff += $am; $amountdeposit[$tva] += $am / (1 + $tva / 100); // Convert into HT for the addline } - } - else { + } else { if ($typeamount == 'amount') { $amountdeposit[0] = $valuedeposit; - } - elseif ($typeamount == 'variable') + } elseif ($typeamount == 'variable') { if ($result > 0) { @@ -1718,8 +1680,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else { // If some invoice's lines coming from page + } else { // If some invoice's lines coming from page $id = $object->create($user); for ($i = 1; $i <= $NBLINES; $i++) { @@ -1845,8 +1806,7 @@ if (empty($reshook)) if ($id <= 0) { $mesg = $object->error; - } - else { + } else { $nextSituationInvoice = new Facture($db); $nextSituationInvoice->fetch($id); @@ -1886,8 +1846,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); exit(); - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -1912,8 +1871,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -1960,8 +1918,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors'); } $error++; - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -1987,8 +1944,7 @@ if (empty($reshook)) if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) { $idprod = $res->fk_product_child; - } - else { + } else { setEventMessages($langs->trans('ErrorProductCombinationNotFound'), null, 'errors'); $error++; } @@ -2052,8 +2008,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -2220,9 +2175,7 @@ if (empty($reshook)) $action = ''; } } - } - - elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) + } elseif ($action == 'updateline' && $usercancreate && !GETPOST('cancel', 'alpha')) { if (!$object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -2279,16 +2232,14 @@ if (empty($reshook)) setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; - } - elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result + } elseif (GETPOST('progress') < $line->situation_percent) // TODO : use a modified $line->get_prev_progress($object->id) result { $mesg = $langs->trans("CantBeLessThanMinPercent"); setEventMessages($mesg, null, 'warnings'); $error++; $result = -1; } - } - elseif (GETPOST('progress') < $percent) + } elseif (GETPOST('progress') < $percent) { $mesg = '
'.$langs->trans("CantBeLessThanMinPercent").'
'; setEventMessages($mesg, null, 'warnings'); @@ -2343,8 +2294,7 @@ if (empty($reshook)) setEventMessages($langs->trans("ErrorFieldCantBeNegativeOnInvoice", $langs->transnoentitiesnoconv("UnitPriceHT"), $langs->transnoentitiesnoconv("CustomerAbsoluteDiscountShort")), null, 'errors'); } $error++; - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error++; } @@ -2429,9 +2379,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice + } elseif ($action == 'updatealllines' && $usercancreate && $_POST['all_percent'] == $langs->trans('Modifier')) // Update all lines of situation invoice { if (!$object->fetch($id) > 0) dol_print_error($db); if (GETPOST('all_progress') != "") @@ -2447,9 +2395,7 @@ if (empty($reshook)) } else $object->update_percent($line, $_POST['all_progress']); } } - } - - elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { + } elseif ($action == 'updateline' && $usercancreate && $_POST['cancel'] == $langs->trans('Cancel')) { header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$id); // To show again edited page exit(); } @@ -2524,8 +2470,7 @@ if (empty($reshook)) { $searchPreviousInvoice = false; // find, exit; break; - } - else { + } else { $lineIndex--; // go to previous invoice in cycle } } @@ -2552,16 +2497,13 @@ if (empty($reshook)) { setEventMessages($langs->trans('Updated'), '', 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); - } - else { + } else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceCreditNote'), array(), 'errors'); } - } - else { + } else { setEventMessages($langs->trans('ErrorOutingSituationInvoiceOnUpdate'), array(), 'errors'); } - } - else { + } else { setEventMessages($langs->trans('ErrorFindNextSituationInvoice'), array(), 'errors'); } } @@ -2583,8 +2525,7 @@ if (empty($reshook)) { dol_include_once('/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'OrderLine'; - } - elseif ($fromElement == 'propal') + } elseif ($fromElement == 'propal') { dol_include_once('/comm/'.$fromElement.'/class/'.$fromElement.'.class.php'); $lineClassName = 'PropaleLigne'; @@ -2626,8 +2567,7 @@ if (empty($reshook)) $array_options = $originLine->array_options; if ($object->type == Facture::TYPE_SITUATION) { $situation_percent = 0; - } - else { + } else { $situation_percent = 100; } $fk_prev_id = ''; @@ -2641,8 +2581,7 @@ if (empty($reshook)) } else { $error++; } - } - else { + } else { $error++; } } @@ -2855,8 +2794,7 @@ if ($action == 'create') //Replicate extrafields $expesrc->fetch_optionals(); $object->array_options = $expesrc->array_options; - } - else { + } else { $cond_reglement_id = (!empty($objectsrc->cond_reglement_id) ? $objectsrc->cond_reglement_id : (!empty($soc->cond_reglement_id) ? $soc->cond_reglement_id : 0)); $mode_reglement_id = (!empty($objectsrc->mode_reglement_id) ? $objectsrc->mode_reglement_id : (!empty($soc->mode_reglement_id) ? $soc->mode_reglement_id : 0)); $fk_account = (!empty($objectsrc->fk_account) ? $objectsrc->fk_account : (!empty($soc->fk_account) ? $soc->fk_account : 0)); @@ -2874,8 +2812,7 @@ if ($action == 'create') $object->array_options = $objectsrc->array_options; } } - } - else { + } else { $cond_reglement_id = $soc->cond_reglement_id; $mode_reglement_id = $soc->mode_reglement_id; $fk_account = $soc->fk_account; @@ -2957,8 +2894,7 @@ if ($action == 'create') print ')'; print ''; print ''."\n"; - } - else { + } else { print ''.$langs->trans('Customer').''; print ''; print $form->select_company($soc->id, 'socid', '((s.client = 1 OR s.client = 3) AND s.status=1)', 'SelectThirdParty', 0, 0, null, 0, 'minwidth300'); @@ -3181,8 +3117,7 @@ if ($action == 'create') print $desc; print '
'; } - } - else { + } else { if (!empty($conf->global->INVOICE_USE_SITUATION)) { print '
'; @@ -3287,8 +3222,7 @@ if ($action == 'create') print '
'; } - } - else { + } else { print '
'; if (empty($conf->global->INVOICE_CREDIT_NOTE_STANDALONE)) $tmp = ' '; else $tmp = ' '; @@ -3655,8 +3589,7 @@ if ($action == 'create') } print '
'; -} -elseif ($id > 0 || !empty($ref)) +} elseif ($id > 0 || !empty($ref)) { /* * Show object in view mode @@ -3765,8 +3698,7 @@ elseif ($id > 0 || !empty($ref)) array('type' => 'other', 'name' => 'idwarehouse', 'label' => $label, 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse') ?GETPOST('idwarehouse') : 'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo)) ); $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1); - } - else { + } else { $formconfirm = $form->formconfirm($_SERVER['PHP_SELF'].'?facid='.$object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1); } } else { @@ -4247,8 +4179,7 @@ elseif ($id > 0 || !empty($ref)) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->mode_reglement_id, 'none', 'CRDT'); } print ''; @@ -4311,8 +4242,7 @@ elseif ($id > 0 || !empty($ref)) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -4333,8 +4263,7 @@ elseif ($id > 0 || !empty($ref)) if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -4368,8 +4297,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; print ''; - } - else { + } else { print price($object->retained_warranty).'%'; } print ''; @@ -4402,8 +4330,7 @@ elseif ($id > 0 || !empty($ref)) $form->select_conditions_paiements($retained_warranty_fk_cond_reglement, 'retained_warranty_fk_cond_reglement', -1, 1); print ''; print ''; - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?facid='.$object->id, $object->retained_warranty_fk_cond_reglement, 'none'); if (!$displayWarranty) { print img_picto($langs->trans('RetainedWarrantyNeed100Percent'), 'warning.png', 'class="pictowarning valignmiddle" '); @@ -4436,8 +4363,7 @@ elseif ($id > 0 || !empty($ref)) print ''; print ''; print ''; - } - else { + } else { print dol_print_date($object->retained_warranty_date_limit, 'day'); } print ''; @@ -4894,8 +4820,7 @@ elseif ($id > 0 || !empty($ref)) if ($object->type == Facture::TYPE_SITUATION) { $retainedWarranty = $total_global_ttc * $object->retained_warranty / 100; - } - else { + } else { // Because one day retained warranty could be used on standard invoices $retainedWarranty = $object->total_ttc * $object->retained_warranty / 100; } @@ -4910,8 +4835,7 @@ elseif ($id > 0 || !empty($ref)) print !empty($object->retained_warranty_date_limit) ? ' '.$langs->trans("ToPayOn", dol_print_date($object->retained_warranty_date_limit, 'day')) : ''; print ' :'.price($retainedWarranty).' '; } - } - else // Credit note + } else // Credit note { $cssforamountpaymentcomplete = 'amountpaymentneutral'; @@ -5084,8 +5008,7 @@ elseif ($id > 0 || !empty($ref)) print ''.$langs->trans('Modify').''; } } - } - else { + } else { print ''.$langs->trans('Modify').''; } } @@ -5142,12 +5065,10 @@ elseif ($id > 0 || !empty($ref)) } else { print ''.$langs->trans('MakeWithdrawRequest').''; } - } - else { + } else { //print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { //print ''.$langs->trans("MakeWithdrawRequest").''; } } @@ -5181,8 +5102,7 @@ elseif ($id > 0 || !empty($ref)) if ($resteapayer == 0) { print ''.$langs->trans('DoPaymentBack').''; - } - else { + } else { print ''.$langs->trans('DoPaymentBack').''; } } @@ -5221,15 +5141,13 @@ elseif ($id > 0 || !empty($ref)) { // If one payment or one credit note was linked to this invoice print ''.$langs->trans('ClassifyPaidPartially').''; - } - else { + } else { if (empty($conf->global->INVOICE_CAN_NEVER_BE_CANCELED)) { if ($objectidnext) { print ''.$langs->trans('ClassifyCanceled').''; - } - else { + } else { print ''.$langs->trans('ClassifyCanceled').''; } } @@ -5291,8 +5209,7 @@ elseif ($id > 0 || !empty($ref)) if (($object->total_ttc - $totalcreditnotes) == 0) { print ''.$langs->trans("RemoveSituationFromCycle").''; - } - else { + } else { print ''.$langs->trans("RemoveSituationFromCycle").''; } } @@ -5315,25 +5232,19 @@ elseif ($id > 0 || !empty($ref)) //var_dump($isErasable); if ($isErasable == -4) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -3) { + } elseif ($isErasable == -3) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -2) { + } elseif ($isErasable == -2) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable == -1) { + } elseif ($isErasable == -1) { print ''.$langs->trans('Delete').''; - } - elseif ($isErasable <= 0) // Any other cases + } elseif ($isErasable <= 0) // Any other cases { print ''.$langs->trans('Delete').''; - } - elseif ($objectidnext) + } elseif ($objectidnext) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } else { diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index d56d1b5cfef..c1ed5b809da 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -244,8 +244,7 @@ class Invoices extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve invoice list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -548,8 +547,7 @@ class Invoices extends DolibarrApi $updateRes = $this->invoice->deleteline($lineid); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->invoice->error); } } @@ -1040,14 +1038,11 @@ class Invoices extends DolibarrApi $discount = new DiscountAbsolute($this->db); if ($this->invoice->type == Facture::TYPE_CREDIT_NOTE) { $discount->description = '(CREDIT_NOTE)'; - } - elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) { + } elseif ($this->invoice->type == Facture::TYPE_DEPOSIT) { $discount->description = '(DEPOSIT)'; - } - elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) { + } elseif ($this->invoice->type == Facture::TYPE_STANDARD || $this->invoice->type == Facture::TYPE_REPLACEMENT || $this->invoice->type == Facture::TYPE_SITUATION) { $discount->description = '(EXCESS RECEIVED)'; - } - else { + } else { throw new RestException(500, 'Cant convert to reduc an Invoice of this type'); } @@ -1123,16 +1118,14 @@ class Invoices extends DolibarrApi if ($result >= 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); throw new RestException(500, 'Could not set paid'); } } else { $this->db->commit(); } - } - else { + } else { $this->db->rollback(); throw new RestException(500, 'Discount creation error'); } diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 904f59ea432..581e63be08a 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -336,8 +336,7 @@ class FactureRec extends CommonInvoice if ($result_insert < 0) { $error++; - } - else { + } else { $objectline = new FactureLigneRec($this->db); if ($objectline->fetch($result_insert)) { @@ -377,8 +376,7 @@ class FactureRec extends CommonInvoice $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -394,19 +392,16 @@ class FactureRec extends CommonInvoice if ($error) { $this->db->rollback(); - } - else { + } else { $this->db->commit(); return $this->id; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -457,8 +452,7 @@ class FactureRec extends CommonInvoice } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -580,14 +574,12 @@ class FactureRec extends CommonInvoice return -3; } return 1; - } - else { + } else { $this->error = 'Bill with id '.$rowid.' or ref '.$ref.' not found sql='.$sql; dol_syslog('Facture::Fetch Error '.$this->error, LOG_ERR); return -2; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -716,8 +708,7 @@ class FactureRec extends CommonInvoice $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -759,13 +750,11 @@ class FactureRec extends CommonInvoice // Delete extrafields $res = $this->deleteExtraFields(); if ($res < 0) $error = -4; - } - else { + } else { $this->error = $this->db->lasterror(); $error = -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $error = -2; } @@ -774,8 +763,7 @@ class FactureRec extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return $error; } @@ -850,8 +838,7 @@ class FactureRec extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -958,8 +945,7 @@ class FactureRec extends CommonInvoice $this->id = $facid; $this->update_price(); return $lineId; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1033,8 +1019,7 @@ class FactureRec extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -1118,8 +1103,7 @@ class FactureRec extends CommonInvoice $this->id = $facid; $this->update_price(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1273,8 +1257,7 @@ class FactureRec extends CommonInvoice $error++; } } - } - else { + } else { $error++; $this->error = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity."\n"; $this->errors[] = "Failed to load invoice template with id=".$line->rowid.", entity=".$conf->entity; @@ -1287,8 +1270,7 @@ class FactureRec extends CommonInvoice dol_syslog("createRecurringInvoices Process invoice template ".$facturerec->ref." is finished with a success generation"); $nb_create++; $this->output .= $langs->trans("InvoiceGeneratedFromTemplate", $facture->ref, $facturerec->ref)."\n"; - } - else { + } else { $db->rollback("createRecurringInvoices Process invoice template id=".$facturerec->id.", ref=".$facturerec->ref); } @@ -1306,8 +1288,7 @@ class FactureRec extends CommonInvoice } $conf->entity = $saventity; // Restore entity context - } - else dol_print_error($db); + } else dol_print_error($db); $this->output = trim($this->output); @@ -1413,66 +1394,54 @@ class FactureRec extends CommonInvoice { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans("Draft"); } } - } - elseif ($mode == 1) + } elseif ($mode == 1) { $prefix = 'Short'; if ($recur) { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $labelStatus = $langs->trans("Draft"); } } - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($recur) { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($recur) { @@ -1480,24 +1449,20 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 4) + } elseif ($mode == 4) { $prefix = ''; if ($recur) @@ -1505,24 +1470,20 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } } - } - elseif ($mode == 5 || $mode == 6) + } elseif ($mode == 5 || $mode == 6) { $prefix = ''; if ($mode == 5) $prefix = 'Short'; @@ -1531,18 +1492,15 @@ class FactureRec extends CommonInvoice if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status4'; $labelStatus = $langs->trans('Active'); } - } - else { + } else { if ($status == self::STATUS_SUSPENDED) { $statusType = 'status6'; $labelStatus = $langs->trans('Disabled'); - } - else { + } else { $statusType = 'status0'; $labelStatus = $langs->trans('Draft'); } @@ -1631,16 +1589,14 @@ class FactureRec extends CommonInvoice $line->total_ht = -100; $line->total_ttc = -119.6; $line->total_tva = -19.6; - } - elseif ($xnbp == 2) // UP is negative (free line) + } elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice = -100; $line->total_ht = -100; $line->total_ttc = -119.6; $line->total_tva = -19.6; $line->remise_percent = 0; - } - elseif ($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]; @@ -1648,8 +1604,7 @@ class FactureRec extends CommonInvoice $line->total_ttc = 59.8; $line->total_tva = 9.8; $line->remise_percent = 50; - } - else // (product line) + } else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -1738,8 +1693,7 @@ class FactureRec extends CommonInvoice $this->frequency = $frequency; if (!empty($unit)) $this->unit_frequency = $unit; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1770,8 +1724,7 @@ class FactureRec extends CommonInvoice $this->date_when = $date; if ($increment_nb_gen_done > 0) $this->nb_gen_done++; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1802,8 +1755,7 @@ class FactureRec extends CommonInvoice { $this->nb_gen_max = $nb; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1832,8 +1784,7 @@ class FactureRec extends CommonInvoice { $this->auto_validate = $validate; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1862,8 +1813,7 @@ class FactureRec extends CommonInvoice { $this->generate_pdf = $validate; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1892,8 +1842,7 @@ class FactureRec extends CommonInvoice { $this->modelpdf = $model; return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2038,8 +1987,7 @@ class FactureLigneRec extends CommonInvoiceLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } @@ -2119,8 +2067,7 @@ class FactureLigneRec extends CommonInvoiceLine } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 55adb5eb138..28f0883bb90 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -678,8 +678,7 @@ class Facture extends CommonInvoice $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -726,8 +725,7 @@ class Facture extends CommonInvoice //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } /* @@ -787,8 +785,7 @@ class Facture extends CommonInvoice break; } } - } - elseif (!$error && empty($this->fac_rec)) // If this->lines is an array of invoice line arrays + } elseif (!$error && empty($this->fac_rec)) // If this->lines is an array of invoice line arrays { $fk_parent_line = 0; @@ -987,25 +984,21 @@ class Facture extends CommonInvoice { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -4; } - } - else { + } else { $this->error = $langs->trans('FailedToUpdatePrice'); $this->db->rollback(); return -3; } - } - else { + } else { dol_syslog(get_class($this)."::create error ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -1090,8 +1083,7 @@ class Facture extends CommonInvoice { $this->error = $facture->error; $this->errors = $facture->errors; - } - elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) + } elseif ($this->type == self::TYPE_SITUATION && !empty($conf->global->INVOICE_USE_SITUATION)) { $this->fetchObjectLinked('', '', $this->id, 'facture'); @@ -1236,8 +1228,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1362,10 +1353,8 @@ class Facture extends CommonInvoice if (!$error) { return 1; - } - else return -1; - } - else return -1; + } else return -1; + } else return -1; } /** @@ -1640,14 +1629,12 @@ class Facture extends CommonInvoice return -3; } return 1; - } - else { + } else { $this->error = 'Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1768,8 +1755,7 @@ class Facture extends CommonInvoice } $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -1807,8 +1793,7 @@ class Facture extends CommonInvoice ) { $this->tab_previous_situation_invoice[] = $invoice; - } - else { + } else { $this->tab_next_situation_invoice[] = $invoice; } } @@ -1924,8 +1909,7 @@ class Facture extends CommonInvoice } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -2011,20 +1995,17 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $facligne->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $facligne->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -3; } @@ -2080,8 +2061,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -2245,20 +2225,17 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -6; } - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -4; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -2303,8 +2280,7 @@ class Facture extends CommonInvoice $result = $this->call_trigger('BILL_PAYED', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -2313,13 +2289,11 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { return 0; } } @@ -2355,8 +2329,7 @@ class Facture extends CommonInvoice $result = $this->call_trigger('BILL_UNPAYED', $user); if ($result < 0) $error++; // End call triggers - } - else { + } else { $error++; $this->error = $this->db->error(); dol_print_error($this->db); @@ -2366,8 +2339,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2422,14 +2394,12 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -2; @@ -2538,8 +2508,7 @@ class Facture extends CommonInvoice if ($force_number) { $num = $force_number; - } - elseif (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 { @@ -2547,8 +2516,7 @@ class Facture extends CommonInvoice $this->date_lim_reglement = $this->calculate_date_lim_reglement(); } $num = $this->getNextNumRef($this->thirdparty); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -2777,8 +2745,7 @@ class Facture extends CommonInvoice $this->setFinal($user); } } - } - else { + } else { $error++; } @@ -2786,8 +2753,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2914,13 +2880,11 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -3039,8 +3003,7 @@ class Facture extends CommonInvoice if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -3181,20 +3144,17 @@ class Facture extends CommonInvoice { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -2; } - } - else { + } else { dol_syslog(get_class($this)."::addline status of order must be Draft to allow use of ->addline()", LOG_ERR); return -3; } @@ -3409,14 +3369,12 @@ class Facture extends CommonInvoice $this->update_price(1); $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Invoice statut makes operation forbidden"; return -2; } @@ -3536,14 +3494,12 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $line->error; return -1; @@ -3601,8 +3557,7 @@ class Facture extends CommonInvoice $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3669,8 +3624,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -3828,8 +3782,7 @@ class Facture extends CommonInvoice $this->date_closing = $this->db->jdate($obj->dateclosing); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3887,12 +3840,10 @@ class Facture extends CommonInvoice if ($shortlist == 1) { $ga[$obj->fid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->fid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->fid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -3901,8 +3852,7 @@ class Facture extends CommonInvoice } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3950,8 +3900,7 @@ class Facture extends CommonInvoice } //print_r($return); return $return; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3997,8 +3946,7 @@ class Facture extends CommonInvoice $sqlSit .= " GROUP BY fs.situation_cycle_ref"; $sqlSit .= " ORDER BY fs.situation_counter"; $sql .= " AND ( f.type != ".self::TYPE_SITUATION." OR f.rowid IN (".$sqlSit.") )"; // Type non 5 si facture non avoir - } - else { + } else { $sql .= " AND f.type != ".self::TYPE_SITUATION; // Type non 5 si facture non avoir } @@ -4023,8 +3971,7 @@ class Facture extends CommonInvoice } return $return; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -4100,8 +4047,7 @@ class Facture extends CommonInvoice dol_syslog(get_class($this).'::demandeprelevement Erreur'); $error++; } - } - else { + } else { $this->error = 'WithdrawRequestErrorNilAmount'; dol_syslog(get_class($this).'::demandeprelevement WithdrawRequestErrorNilAmount'); $error++; @@ -4119,20 +4065,17 @@ class Facture extends CommonInvoice if ($error) return -1; return 1; - } - else { + } else { $this->error = "A request already exists"; dol_syslog(get_class($this).'::demandeprelevement Impossible de creer une demande, demande deja en cours'); return 0; } - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::demandeprelevement Erreur -2'); return -2; } - } - else { + } else { $this->error = "Status of invoice does not allow this"; dol_syslog(get_class($this)."::demandeprelevement ".$this->error." $this->statut, $this->paye, $this->mode_reglement_id"); return -3; @@ -4156,8 +4099,7 @@ class Facture extends CommonInvoice if ($this->db->query($sql)) { return 0; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::demande_prelevement_delete Error '.$this->error); return -1; @@ -4222,8 +4164,7 @@ class Facture extends CommonInvoice } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4343,8 +4284,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = -200; $line->multicurrency_total_ttc = -239.2; $line->multicurrency_total_tva = -39.2; - } - elseif ($xnbp == 2) // UP is negative (free line) + } elseif ($xnbp == 2) // UP is negative (free line) { $line->subprice = -100; $line->total_ht = -100; @@ -4354,8 +4294,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ht = -200; $line->multicurrency_total_ttc = -239.2; $line->multicurrency_total_tva = -39.2; - } - elseif ($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]; @@ -4366,8 +4305,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_ttc = 119.6; $line->multicurrency_total_tva = 19.6; $line->remise_percent = 50; - } - else // (product line) + } else // (product line) { $prodid = mt_rand(1, $num_prods); $line->fk_product = $prodids[$prodid]; @@ -4453,8 +4391,7 @@ class Facture extends CommonInvoice } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -4615,8 +4552,7 @@ class Facture extends CommonInvoice { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(__METHOD__.' Error: '.$errmsg, LOG_ERR); @@ -4701,12 +4637,10 @@ class Facture extends CommonInvoice if (($totalpaye < $this->total_ttc - $RetainedWarrantyAmount) && $this->date_lim_reglement < ($now - $conf->facture->client->warning_delay)) { $hasDelay = 1; - } - elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) + } elseif ($totalpaye < $this->total_ttc && $this->retained_warranty_date_limit < ($now - $conf->facture->client->warning_delay)) { $hasDelay = 1; - } - else { + } else { $hasDelay = 0; } } @@ -4792,12 +4726,10 @@ class Facture extends CommonInvoice $total2BillWT += $this->total_ttc; $retainedWarrantyAmount = $total2BillWT * $this->retained_warranty / 100; - } - else { + } else { return -1; } - } - else { + } else { // Because one day retained warranty could be used on standard invoices $retainedWarrantyAmount = $this->total_ttc * $this->retained_warranty / 100; } @@ -4833,14 +4765,12 @@ class Facture extends CommonInvoice { $this->retained_warranty = floatval($value); return 1; - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarranty Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarranty, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -4874,14 +4804,12 @@ class Facture extends CommonInvoice { $this->retained_warranty_date_limit = $timestamp; return 1; - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit Erreur '.$sql.' - '.$this->db->error()); $this->error = $this->db->error(); return -1; } - } - else { + } else { dol_syslog(get_class($this).'::setRetainedWarrantyDateLimit, status of the object is incompatible'); $this->error = 'Status of the object is incompatible '.$this->statut; return -2; @@ -5062,8 +4990,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->free($result); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -5116,8 +5043,7 @@ class FactureLigne extends CommonInvoiceLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -5233,8 +5159,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->rollback(); return -3; } - } - else { + } else { $result = $discount->link_to_invoice($this->rowid, 0); if ($result < 0) { @@ -5244,15 +5169,13 @@ class FactureLigne extends CommonInvoiceLine return -3; } } - } - else { + } else { $this->error = $langs->trans("ErrorADiscountThatHasBeenRemovedIsIncluded"); dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $discount->error; dol_syslog(get_class($this)."::insert Error ".$this->error, LOG_ERR); $this->db->rollback(); @@ -5274,8 +5197,7 @@ class FactureLigne extends CommonInvoiceLine $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; @@ -5328,8 +5250,7 @@ class FactureLigne extends CommonInvoiceLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -5407,8 +5328,7 @@ class FactureLigne extends CommonInvoiceLine } $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -5450,8 +5370,7 @@ class FactureLigne extends CommonInvoiceLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -5491,8 +5410,7 @@ class FactureLigne extends CommonInvoiceLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 1fddf20b023..9888bd23d13 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -145,8 +145,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -201,8 +200,7 @@ class PaymentTerm // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -237,8 +235,7 @@ class PaymentTerm // extends CommonObject } $this->db->free($resql); return $ret; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -302,8 +299,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -341,8 +337,7 @@ class PaymentTerm // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -391,8 +386,7 @@ class PaymentTerm // extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php index 77ff0f813c3..44954d863e5 100644 --- a/htdocs/compta/facture/contact.php +++ b/htdocs/compta/facture/contact.php @@ -69,14 +69,12 @@ if ($action == 'addcontact' && $user->rights->facture->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -88,8 +86,7 @@ elseif ($action == 'swapstatut' && $user->rights->facture->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -104,8 +101,7 @@ elseif ($action == 'deletecontact' && $user->rights->facture->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -204,8 +200,7 @@ if ($id > 0 || !empty($ref)) $res = @include dol_buildpath($reldir.'/contacts.tpl.php'); if ($res) break; } - } - else { + } else { // Record not found print "ErrorRecordNotFound"; } diff --git a/htdocs/compta/facture/document.php b/htdocs/compta/facture/document.php index 7e95b92cc3d..ed9b032ae90 100644 --- a/htdocs/compta/facture/document.php +++ b/htdocs/compta/facture/document.php @@ -181,12 +181,10 @@ if ($id > 0 || !empty($ref)) $permtoedit = $user->rights->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; - } - else { + } else { dol_print_error($db); } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 8275dbcf450..dfda4a5b16d 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -609,8 +609,7 @@ if ($resql) if (!$invoicerectmp->isMaxNbGenReached()) { if (!$objp->suspended && $objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late")); - } - else { + } else { print img_info($langs->trans("MaxNumberOfGenerationReached")); } print '
'; @@ -653,17 +652,14 @@ if ($resql) if ($invoicerectmp->isMaxNbGenReached()) { print $langs->trans("MaxNumberOfGenerationReached"); - } - elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) + } elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) { print ''; print $langs->trans("CreateBill").''; - } - else { + } else { print $form->textwithpicto('', $langs->trans("DateIsNotEnough")); } - } - else { + } else { print " "; } if (!$i) $totalarray['nbfield']++; @@ -673,8 +669,7 @@ if ($resql) $i++; } - } - else { + } else { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } print ''.$langs->trans("NoRecordFound").''; @@ -689,8 +684,7 @@ if ($resql) print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 7b3025db810..c21d19ad538 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -304,8 +304,7 @@ if ($massaction == 'makepayment'){ header('Location: '.$loc); exit; -} -elseif ($massaction == 'withdrawrequest') +} elseif ($massaction == 'withdrawrequest') { $langs->load("withdrawals"); @@ -313,8 +312,7 @@ elseif ($massaction == 'withdrawrequest') { $error++; setEventMessages($langs->trans("NotEnoughPermissions"), null, 'errors'); - } - else { + } else { //Checking error $error = 0; @@ -362,12 +360,10 @@ elseif ($massaction == 'withdrawrequest') if ($numprlv > 0) { $error++; setEventMessages($objecttmp->ref.' '.$langs->trans("RequestAlreadyDone"), $objecttmp->errors, 'warnings'); - } - elseif (!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'); - } - else { + } else { $listofbills[] = $objecttmp; // $listofbills will only contains invoices with good payment method and no request already done } } @@ -385,8 +381,7 @@ elseif ($massaction == 'withdrawrequest') { $db->commit(); $nbwithdrawrequestok++; - } - else { + } else { $db->rollback(); setEventMessages($aBill->error, $aBill->errors, 'errors'); } @@ -513,8 +508,7 @@ if ($search_status != '-1' && $search_status != '') if ($search_status == '1') $sql .= " AND f.fk_statut = 1"; // unpayed if ($search_status == '2') $sql .= " AND f.fk_statut = 2"; // payed Not that some corrupted data may contains f.fk_statut = 1 AND f.paye = 1 (it means payed too but should not happend. If yes, reopen and reclassify billed) if ($search_status == '3') $sql .= " AND f.fk_statut = 3"; // abandonned - } - else { + } else { $sql .= " AND f.fk_statut IN (".$db->escape($search_status).")"; // When search_status is '1,2' for example } } @@ -560,8 +554,7 @@ if (!$sall) if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key : ''); } -} -else { +} else { $sql .= natural_search(array_keys($fieldstosearchall), $sall); } @@ -670,8 +663,7 @@ if ($resql) if ($user->rights->facture->supprimer) { if (!empty($conf->global->INVOICE_CAN_REMOVE_DRAFT_ONLY)) { $arrayofmassactions['predeletedraft'] = $langs->trans("Deletedraft"); - } - elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation + } elseif (!empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED)) { // mass deletion never possible on invoices on such situation $arrayofmassactions['predelete'] = $langs->trans("Delete"); } } @@ -1215,8 +1207,7 @@ if ($resql) if ($contextpage == 'poslist') { print $obj->ref; - } - else { + } else { print $facturestatic->getNomUrl(1, '', 200, 0, '', 0, 1); } @@ -1311,8 +1302,7 @@ if ($resql) if ($contextpage == 'poslist') { print $thirdpartystatic->name; - } - else { + } else { print $thirdpartystatic->getNomUrl(1, 'customer'); } print ''; @@ -1613,8 +1603,7 @@ if ($resql) $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index 109231a240d..7cbe336e126 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -86,8 +86,7 @@ if (empty($reshook)) $db->commit(); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } @@ -291,12 +290,10 @@ if ($object->id > 0) if ($action == 'editinvoicedate') { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date, 'invoicedate'); - } - else { + } else { print dol_print_date($object->date, 'daytext'); } - } - else { + } else { print dol_print_date($object->date, 'daytext'); } print ''; @@ -315,12 +312,10 @@ if ($object->id > 0) if ($action == 'editconditions') { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'cond_reglement_id'); - } - else { + } else { $form->form_conditions_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->cond_reglement_id, 'none'); } - } - else { + } else { print ' '; } print ''; @@ -338,15 +333,13 @@ if ($object->id > 0) if ($action == 'editpaymentterm') { $form->form_date($_SERVER['PHP_SELF'].'?id='.$object->id, $object->date_lim_reglement, 'paymentterm'); - } - else { + } else { print dol_print_date($object->date_lim_reglement, 'daytext'); if ($object->hasDelay()) { print img_warning($langs->trans('Late')); } } - } - else { + } else { print ' '; } print ''; @@ -362,8 +355,7 @@ if ($object->id > 0) if ($action == 'editmode') { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id'); - } - else { + } else { $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); } print ''; @@ -380,8 +372,7 @@ if ($object->id > 0) if ($action == 'editbankaccount') { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); - } - else { + } else { $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); } print ""; @@ -493,8 +484,7 @@ if ($object->id > 0) { $num = $db->num_rows($result_sql); $numopen = $num; - } - else { + } else { dol_print_error($db); } @@ -510,8 +500,7 @@ if ($object->id > 0) { $obj = $db->fetch_object($result_sql); if ($obj) $pending = $obj->amount; - } - else { + } else { dol_print_error($db); } @@ -538,22 +527,18 @@ if ($object->id > 0) print ''; print ''; print ''; - } - else { + } else { print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { print ''.$langs->trans("MakeWithdrawRequest").''; } - } - else { + } else { if ($num == 0) { if ($object->statut > Facture::STATUS_DRAFT) print ''.$langs->trans("MakeWithdrawRequest").''; else print ''.$langs->trans("MakeWithdrawRequest").''; - } - else print ''.$langs->trans("MakeWithdrawRequest").''; + } else print ''.$langs->trans("MakeWithdrawRequest").''; } print "

\n"; @@ -620,8 +605,7 @@ if ($object->id > 0) } $db->free($result_sql); - } - else { + } else { dol_print_error($db); } @@ -681,8 +665,7 @@ if ($object->id > 0) print ''.$langs->trans("None").''; $db->free($result); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index d0c7eacffc6..82ba8a33467 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -180,8 +180,7 @@ if (!$user->rights->societe->client->voir || $user->socid) $filename_avg = $dir.'/ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$user->id.'-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filename_avg = $dir.'/ordersaverage-'.$year.'.png'; if ($mode == 'customer') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstats&file=ordersaverage-'.$year.'.png'; if ($mode == 'supplier') $fileurl_avg = DOL_URL_ROOT.'/viewimage.php?modulepart=orderstatssupplier&file=ordersaverage-'.$year.'.png'; @@ -368,8 +367,7 @@ print '
'; // Show graphs print ''; print ''; print ''; - } - else { + } else { print ''; } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php index 571a00d6b47..ef35c03eb54 100644 --- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -78,8 +78,7 @@ foreach ($linkedObjectBlock as $key => $objectlink) // If not abandonned $total = $total + $sign * $objectlink->total_ht; echo price($objectlink->total_ht); - } - else { + } else { echo ''.price($objectlink->total_ht).''; } } diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 2efe20a2fc5..d5daadcb557 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -214,14 +214,12 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print '
'.$langs->trans("Total").''.price($tot_ttc).'
'.$langs->trans("NoInvoice").'

"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -300,14 +298,12 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.$langs->trans("Total").''; print ''.price($tot_ttc).''; print ''; - } - else { + } else { print ''.$langs->trans("NoInvoice").''; } print "

"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -424,16 +420,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) $i++; } - } - else { + } else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -523,15 +517,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU $totalam += $obj->am; $i++; } - } - else { + } else { $colspan = 5; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; - } - else { + } else { dol_print_error($db); } } @@ -600,13 +592,11 @@ if (!empty($conf->don->enabled) && $user->rights->don->lire) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print '
'; - } - else dol_print_error($db); + } else dol_print_error($db); } /** @@ -677,14 +667,12 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print ' '; print ''; - } - else { + } else { print ''.$langs->trans("None").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -804,8 +792,7 @@ if (!empty($conf->facture->enabled) && !empty($conf->commande->enabled) && $user print '
'; } $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -927,16 +914,14 @@ if (!empty($conf->facture->enabled) && $user->rights->facture->lire) print ''.price($totalam).''; print ' '; print ''; - } - else { + } else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -1035,15 +1020,13 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU print ''.price($totalam).''; print ' '; print ''; - } - else { + } else { $colspan = 6; if (!empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) $colspan++; print ''.$langs->trans("NoInvoice").''; } print '
'; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/journal/purchasesjournal.php b/htdocs/compta/journal/purchasesjournal.php index 91d855d4454..78ef32072d6 100644 --- a/htdocs/compta/journal/purchasesjournal.php +++ b/htdocs/compta/journal/purchasesjournal.php @@ -168,8 +168,7 @@ if ($result) $i++; } -} -else { +} else { dol_print_error($db); } @@ -238,8 +237,7 @@ foreach ($tabfac as $key => $val) { print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; - } - else { + } else { print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; } diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index a7eb09de31a..bd44f6c47cc 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -114,8 +114,7 @@ $sql .= " WHERE f.entity IN (".getEntity('invoice').")"; $sql .= " AND f.fk_statut > 0"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_REPLACEMENT.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_SITUATION.")"; -} -else { +} else { $sql .= " AND f.type IN (".Facture::TYPE_STANDARD.",".Facture::TYPE_STANDARD.",".Facture::TYPE_CREDIT_NOTE.",".Facture::TYPE_DEPOSIT.",".Facture::TYPE_SITUATION.")"; } @@ -195,8 +194,7 @@ if ($result) $tabcompany[$obj->rowid] = array('id'=>$obj->socid, 'name'=>$obj->name, 'client'=>$obj->client); $i++; } -} -else { +} else { dol_print_error($db); } @@ -268,8 +266,7 @@ foreach ($tabfac as $key => $val) { print ''.($mt >= 0 ?price($mt) : '').""; print ''.($mt < 0 ?price(-$mt) : '').""; - } - else { + } else { print ''.($mt < 0 ?price(-$mt) : '').""; print ''.($mt >= 0 ?price($mt) : '').""; } diff --git a/htdocs/compta/localtax/card.php b/htdocs/compta/localtax/card.php index e5a20b5486b..cd7bbfd11c2 100644 --- a/htdocs/compta/localtax/card.php +++ b/htdocs/compta/localtax/card.php @@ -80,8 +80,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $db->commit(); header("Location: list.php?localTaxType=".$lttype); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $_GET["action"] = "create"; @@ -112,19 +111,16 @@ if ($action == 'delete') $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/localtax/list.php?localTaxType='.$object->ltt); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -285,8 +281,7 @@ if ($id) if ($object->rappro == 0) { print ''.$langs->trans("Delete").''; - } - else { + } else { print ''.$langs->trans("Delete").''; } print ""; diff --git a/htdocs/compta/localtax/class/localtax.class.php b/htdocs/compta/localtax/class/localtax.class.php index 59adc220c8f..1dfeb0b8930 100644 --- a/htdocs/compta/localtax/class/localtax.class.php +++ b/htdocs/compta/localtax/class/localtax.class.php @@ -137,13 +137,11 @@ class Localtax extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -204,8 +202,7 @@ class Localtax extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -267,8 +264,7 @@ class Localtax extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -373,13 +369,11 @@ class Localtax extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -412,13 +406,11 @@ class Localtax extends CommonObject $ret = $obj->total_localtax; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -453,13 +445,11 @@ class Localtax extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -537,8 +527,7 @@ class Localtax extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $ok = 0; } @@ -556,19 +545,16 @@ class Localtax extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -590,8 +576,7 @@ class Localtax extends CommonObject $result = $this->db->query($sql); if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 12112766c24..10111dd7faa 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -53,15 +53,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q"); if (empty($q)) { - if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } - else { + if (GETPOST("month")) { $date_start = dol_get_first_day($year_start, GETPOST("month"), false); $date_end = dol_get_last_day($year_start, GETPOST("month"), false); } else { $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; 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 { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -199,8 +197,7 @@ if ($calc == 0 || $calc == 2) if ($coll->assuj == '1') { $intra = $langs->trans('Unknown'); - } - else { + } else { $intra = ''; } } @@ -226,8 +223,7 @@ if ($calc == 0 || $calc == 2) print ''.price($totalamount).''; print ''.price($total).''; print ''; - } - else { + } else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; @@ -269,8 +265,7 @@ if ($calc == 0 || $calc == 1) { if ($coll->assuj == '1') { $intra = $langs->trans('Unknown'); - } - else { + } else { $intra = ''; } } @@ -298,8 +293,7 @@ if ($calc == 0 || $calc == 1) { print ''; print ''; - } - else { + } else { $langs->load("errors"); if ($coll_list == -1) print ''.$langs->trans("ErrorNoAccountancyModuleLoaded").''; diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index b8a906ac818..8e810495ff4 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -52,13 +52,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -150,8 +148,7 @@ function pt($db, $sql, $date) $amountpaid = 0; $previousmode = ''; $previousmonth = ''; - } - else { + } else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -179,8 +176,7 @@ function pt($db, $sql, $date) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -385,8 +381,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc 'localtax2' =>$x_paye[$my_paye_rate]['localtax2_list'][$id], //'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/localtax/list.php b/htdocs/compta/localtax/list.php index 58ec8cb090e..a8b37c3ef93 100644 --- a/htdocs/compta/localtax/list.php +++ b/htdocs/compta/localtax/list.php @@ -95,8 +95,7 @@ if ($result) print ""; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index 45d34f10cce..058f6871c7d 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -63,15 +63,13 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { $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; 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 { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -221,8 +219,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) elseif ($x_coll == -2) print ''.$langs->trans("FeatureNotYetAvailable").''; else print ''.$langs->trans("Error").''; -} -else { +} else { $x_both = array(); //now, from these two arrays, get another array with one rate per line @@ -368,8 +365,7 @@ else { $product_static->type = $fields['ptype']; print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - } - else { + } else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); if (preg_match('/^\((.*)\)$/', $fields['descr'], $reg)) @@ -411,8 +407,7 @@ else { if ($type == 0) { print $langs->trans("NotUsedForGoods"); - } - else { + } else { print price($fields['payment_amount']); if (isset($fields['payment_amount'])) print ' ('.round($ratiopaymentinvoice * 100, 2).'%)'; } @@ -527,8 +522,7 @@ else { $product_static->type = $fields['ptype']; print $product_static->getNomUrl(1); if (dol_string_nohtmltag($fields['descr'])) print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); - } - else { + } else { if ($type) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); print $text.' '.dol_trunc(dol_string_nohtmltag($fields['descr']), 16); @@ -566,8 +560,7 @@ else { if ($type == 0) { print $langs->trans("NA"); - } - else { + } else { print price(price2num($fields['payment_amount'], 'MT')); if (isset($fields['payment_amount'])) { print ' ('.round($ratiopaymentinvoice * 100, 2).'%)'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 5c0f258a091..4eea16f706b 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -131,8 +131,7 @@ if (empty($reshook)) } $formquestion[$i++] = array('type' => 'hidden', 'name' => $key, 'value' => $_POST[$key]); - } - elseif (substr($key, 0, 21) == 'multicurrency_amount_') + } elseif (substr($key, 0, 21) == 'multicurrency_amount_') { $cursorfacid = substr($key, 21); $multicurrency_amounts[$cursorfacid] = price2num(trim(GETPOST($key))); @@ -312,8 +311,7 @@ if (empty($reshook)) else $loc = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id; header('Location: '.$loc); exit; - } - else { + } else { $db->rollback(); } } @@ -502,8 +500,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print ''; $form->select_comptes($accountid, 'accountid', 0, '', 2); print ''; - } - else { + } else { print ' '; } print "\n"; @@ -558,8 +555,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie if ($facture->type != Facture::TYPE_CREDIT_NOTE) { $sql .= ' AND type IN (0,1,3,5)'; // Standard invoice, replacement, deposit, situation - } - else { + } else { $sql .= ' AND type = 2'; // If paying back a credit note, we show all credit notes } // Sort invoices by date and serial number: the older one comes first @@ -662,8 +658,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } print ''; - } - else { + } else { print ''; } @@ -706,8 +701,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $multicurrency_remaintopay)."'"); print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -741,8 +735,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie print img_picto("Auto fill", 'rightarrow', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($sign * $remaintopay)."'"); print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -797,8 +790,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie //print "\n"; } $db->free($resql); - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/card.php b/htdocs/compta/paiement/card.php index f67a2e2c12a..4acfd34a53a 100644 --- a/htdocs/compta/paiement/card.php +++ b/htdocs/compta/paiement/card.php @@ -65,8 +65,7 @@ if ($action == 'setnote' && $user->rights->facture->paiement) { $db->commit(); $action = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -86,13 +85,11 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture-> { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: list.php"); exit; } - } - else { + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -128,8 +125,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture-> header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); exit; - } - else { + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); @@ -143,8 +139,7 @@ if ($action == 'setnum_paiement' && !empty($_POST['num_paiement'])) if ($res === 0) { setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors'); } } @@ -157,8 +152,7 @@ if ($action == 'setdatep' && !empty($_POST['datepday'])) if ($res === 0) { setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors'); } } @@ -407,8 +401,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -438,8 +431,7 @@ if ($user->socid == 0 && $action == '') if (!$disable_delete) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index 44a160b35e0..5c490ce3128 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -79,8 +79,7 @@ if ($action == 'setdate' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -97,8 +96,7 @@ if ($action == 'setrefext' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -115,8 +113,7 @@ if ($action == 'setref' && $user->rights->banque->cheque) { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -146,12 +143,10 @@ if ($action == 'create' && $_POST["accountid"] > 0 && $user->rights->banque->che header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($langs->trans("ErrorSelectAtLeastOne"), null, 'mesgs'); $action = 'new'; } @@ -165,8 +160,7 @@ if ($action == 'remove' && $id > 0 && $_GET["lineid"] > 0 && $user->rights->banq { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -179,8 +173,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->banque->c { header("Location: index.php"); exit; - } - else { + } else { setEventMessages($paiement->error, $paiement->errors, 'errors'); } } @@ -205,8 +198,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->banque->c header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -224,8 +216,7 @@ if ($action == 'confirm_reject_check' && $confirm == 'yes' && $user->rights->ban //header("Location: ".DOL_URL_ROOT.'/compta/paiement/card.php?id='.$paiement_id); //exit; $action = ''; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -252,8 +243,7 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { dol_print_error($db, $object->error); exit; - } - else { + } else { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); exit; } @@ -304,8 +294,7 @@ if ($action == 'new') $h++; print load_fiche_titre($langs->trans("Cheques"), '', 'bank_account'); -} -else { +} else { $result = $object->fetch($id, $ref); if ($result < 0) { @@ -498,8 +487,7 @@ if ($action == 'new') if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -509,8 +497,7 @@ if ($action == 'new') if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -530,15 +517,13 @@ if ($action == 'new') if ($user->rights->banque->cheque) { print ''; - } - else { + } else { print ''.$langs->trans('NewCheckDepositOn', $account_label).''; } print '
'; print ''; } -} -else { +} else { $paymentstatic = new Paiement($db); $accountlinestatic = new AccountLine($db); $accountstatic = new Account($db); @@ -572,8 +557,7 @@ else { print $form->selectDate($object->date_bordereau, 'datecreate_', '', '', '', "setdate"); print ''; print ''; - } - else { + } else { print $object->date_bordereau ? dol_print_date($object->date_bordereau, 'day') : ' '; } @@ -683,8 +667,7 @@ else { if ($paymentstatic->id) { print $paymentstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -694,8 +677,7 @@ else { if ($accountlinestatic->rowid) { print $accountlinestatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -718,8 +700,7 @@ else { $i++; } - } - else { + } else { print ''; print $langs->trans("None"); print ''; @@ -736,8 +717,7 @@ else { } print ""; - } - else { + } else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/class/remisecheque.class.php b/htdocs/compta/paiement/cheque/class/remisecheque.class.php index 9d252a7456e..48c58dc7219 100644 --- a/htdocs/compta/paiement/cheque/class/remisecheque.class.php +++ b/htdocs/compta/paiement/cheque/class/remisecheque.class.php @@ -120,16 +120,14 @@ class RemiseCheque extends CommonObject if ($this->statut == 0) { $this->ref = "(PROV".$this->id.")"; - } - else { + } else { $this->ref = $obj->ref; } } $this->db->free($resql); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -225,8 +223,7 @@ class RemiseCheque extends CommonObject array_push($lines, $row[0]); } $this->db->free($resql); - } - else { + } else { $this->errno = -1026; dol_syslog("RemiseCheque::Create Error ".$this->errno, LOG_ERR); } @@ -266,8 +263,7 @@ class RemiseCheque extends CommonObject dol_syslog("RemiseCheque::Create Error update amount ".$this->errno, LOG_ERR); } } - } - else { + } else { $this->errno = -1; $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); @@ -284,8 +280,7 @@ class RemiseCheque extends CommonObject $this->db->commit(); dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->id; - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Create end", LOG_DEBUG); return $this->errno; @@ -336,8 +331,7 @@ class RemiseCheque extends CommonObject if ($this->errno === 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Delete ROLLBACK ($this->errno)"); } @@ -379,13 +373,11 @@ class RemiseCheque extends CommonObject { $this->ref = $numref; $this->statut = 1; - } - else { + } else { $this->errno = -1029; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } - } - else { + } else { $this->errno = -1033; dol_syslog("Remisecheque::Validate Error ".$this->errno, LOG_ERR); } @@ -396,8 +388,7 @@ class RemiseCheque extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::Validate ".$this->errno, LOG_ERR); return $this->errno; @@ -479,8 +470,7 @@ class RemiseCheque extends CommonObject } return $numref; - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Bank")); return ""; @@ -534,8 +524,7 @@ class RemiseCheque extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -573,8 +562,7 @@ class RemiseCheque extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -652,15 +640,13 @@ class RemiseCheque extends CommonObject { //$outputlangs->charset_output=$sav_charset_output; return 1; - } - else { + } else { //$outputlangs->charset_output=$sav_charset_output; dol_syslog("Error"); dol_print_error($this->db, $docmodel->error); return 0; } - } - else { + } else { $this->error = $langs->trans("ErrorFileDoesNotExists", $dir.$file); return -1; } @@ -706,8 +692,7 @@ class RemiseCheque extends CommonObject $this->errno = -1030; dol_syslog("RemiseCheque::updateAmount ERREUR UPDATE ($this->errno)"); } - } - else { + } else { $this->errno = -1031; dol_syslog("RemiseCheque::updateAmount ERREUR SELECT ($this->errno)"); } @@ -715,8 +700,7 @@ class RemiseCheque extends CommonObject if ($this->errno === 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); dol_syslog("RemiseCheque::updateAmount ROLLBACK ($this->errno)"); } @@ -745,8 +729,7 @@ class RemiseCheque extends CommonObject if ($resql) { $this->updateAmount(); - } - else { + } else { $this->errno = -1032; dol_syslog("RemiseCheque::removeCheck ERREUR UPDATE ($this->errno)"); } @@ -821,27 +804,23 @@ class RemiseCheque extends CommonObject { $this->db->commit(); return $rejectedPayment->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $rejectedPayment->error; $this->errors = $rejectedPayment->errors; $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -914,13 +893,11 @@ class RemiseCheque extends CommonObject { $this->date_bordereau = $date; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } @@ -947,13 +924,11 @@ class RemiseCheque extends CommonObject if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } @@ -1021,8 +996,7 @@ class RemiseCheque extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/compta/paiement/cheque/index.php b/htdocs/compta/paiement/cheque/index.php index 7971a34db0d..1ee79aeafd9 100644 --- a/htdocs/compta/paiement/cheque/index.php +++ b/htdocs/compta/paiement/cheque/index.php @@ -76,8 +76,7 @@ if ($resql) { print ''.$num.''; print ''; print "\n"; -} -else { +} else { dol_print_error($db); } @@ -139,8 +138,7 @@ if ($resql) print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index cda8c2a679d..e76936c71fd 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -221,8 +221,7 @@ if ($resql) print "\n"; $i++; } - } - else { + } else { print ''; print ''.$langs->trans("None").""; print ''; @@ -230,8 +229,7 @@ if ($resql) print ""; print ""; print "\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 99250bd9373..f57e4408a6f 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -200,13 +200,11 @@ class Paiement extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -240,8 +238,7 @@ class Paiement extends CommonObject { $amounts = &$this->amounts; $amounts_to_update = &$this->multicurrency_amounts; - } - else { + } else { $amounts = &$this->multicurrency_amounts; $amounts_to_update = &$this->amounts; } @@ -279,8 +276,7 @@ class Paiement extends CommonObject { $total = $totalamount; $mtotal = $totalamount_converted; // Maybe use price2num with MT for the converted value - } - else { + } else { $total = $totalamount_converted; // Maybe use price2num with MT for the converted value $mtotal = $totalamount; } @@ -424,13 +420,11 @@ class Paiement extends CommonObject $error++; } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } - } - else { + } else { dol_syslog(get_class($this).'::Create Amount line '.$key.' not a number. We discard it.'); } } @@ -442,8 +436,7 @@ class Paiement extends CommonObject if ($result < 0) { $error++; } // Fin appel triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -455,8 +448,7 @@ class Paiement extends CommonObject $this->multicurrency_amount = $mtotal; $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -492,8 +484,7 @@ class Paiement extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -557,8 +548,7 @@ class Paiement extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error; $this->db->rollback(); return -5; @@ -719,8 +709,7 @@ class Paiement extends CommonObject if ($result < 0) { $error++; } // Fin appel triggers } - } - else { + } else { $this->error = $acc->error; $error++; } @@ -728,8 +717,7 @@ class Paiement extends CommonObject if (!$error) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); } } @@ -737,8 +725,7 @@ class Paiement extends CommonObject if (!$error) { return $bank_line_id; - } - else { + } else { return -1; } } @@ -762,8 +749,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::update_fk_bank '.$this->error); return -1; @@ -824,8 +810,7 @@ class Paiement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); return -2; } @@ -854,8 +839,7 @@ class Paiement extends CommonObject { $this->num_payment = $this->db->escape($num); return 0; - } - else { + } else { $this->error = 'Error -1 '.$this->db->error(); return -2; } @@ -878,8 +862,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::valide '.$this->error); return -1; @@ -901,8 +884,7 @@ class Paiement extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::reject '.$this->error); return -1; @@ -946,8 +928,7 @@ class Paiement extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -979,8 +960,7 @@ class Paiement extends CommonObject } return $billsarray; - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getBillsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1012,8 +992,7 @@ class Paiement extends CommonObject } return $amounts; - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this).'::getAmountsArray Error '.$this->error.' -', LOG_DEBUG); return -1; @@ -1096,8 +1075,7 @@ class Paiement extends CommonObject } return $numref; - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Invoice")); return ""; @@ -1198,8 +1176,7 @@ class Paiement extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $url = DOL_URL_ROOT.'/compta/paiement/card.php?id='.$this->id; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index dbdf4f4675e..eb2523960f3 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -129,8 +129,7 @@ if (GETPOST("orphelins", "alpha")) $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; -} -else { +} else { $sql = "SELECT DISTINCT p.rowid, p.ref, p.datep as dp, p.amount,"; // DISTINCT is to avoid duplicate when there is a link to sales representatives $sql .= " p.statut, p.num_paiement as num_payment,"; $sql .= " c.code as paiement_code,"; @@ -377,8 +376,7 @@ if ($resql) print "\n"; print ""; print "\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/paiement/rapport.php b/htdocs/compta/paiement/rapport.php index 66f239fdf96..9d3bae3140d 100644 --- a/htdocs/compta/paiement/rapport.php +++ b/htdocs/compta/paiement/rapport.php @@ -70,8 +70,7 @@ if ($action == 'builddoc') if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0) { $outputlangs->charset_output = $sav_charset_output; - } - else { + } else { $outputlangs->charset_output = $sav_charset_output; dol_print_error($db, $obj->error); } diff --git a/htdocs/compta/paiement/tovalidate.php b/htdocs/compta/paiement/tovalidate.php index b978fc8e218..349c483a5db 100644 --- a/htdocs/compta/paiement/tovalidate.php +++ b/htdocs/compta/paiement/tovalidate.php @@ -126,8 +126,7 @@ if ($resql) if ($objp->statut == 0) { print ''.$langs->trans("PaymentStatusToValidShort").''; - } - else { + } else { print "-"; } diff --git a/htdocs/compta/paiement_charge.php b/htdocs/compta/paiement_charge.php index d1b448c5932..9c5ceea22bf 100644 --- a/htdocs/compta/paiement_charge.php +++ b/htdocs/compta/paiement_charge.php @@ -141,8 +141,7 @@ if ($action == 'add_payment' || ($action == 'confirm_paiement' && $confirm == 'y $loc = DOL_URL_ROOT.'/compta/sociales/card.php?id='.$chid; header('Location: '.$loc); exit; - } - else { + } else { $db->rollback(); } } @@ -282,8 +281,7 @@ if ($action == 'create') if ($objp->date_ech > 0) { print ''.dol_print_date($objp->date_ech, 'day').''."\n"; - } - else { + } else { print "!!!\n"; } @@ -303,8 +301,7 @@ if ($action == 'create') $remaintopay = $objp->amount - $sumpaid; print ''; print ''; - } - else { + } else { print '-'; } print ""; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index 69b425356d1..fbe5d926d33 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -66,8 +66,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char $db->commit(); header("Location: ".DOL_URL_ROOT."/compta/sociales/payments.php?mode=sconly"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); } @@ -282,8 +281,7 @@ if ($resql) print "\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -314,8 +312,7 @@ if ($action == '') if (!$disable_delete) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/compta/paymentbybanktransfer/index.php b/htdocs/compta/paymentbybanktransfer/index.php index d2611e8a354..63769e2bd9e 100644 --- a/htdocs/compta/paymentbybanktransfer/index.php +++ b/htdocs/compta/paymentbybanktransfer/index.php @@ -158,13 +158,11 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoSupplierInvoiceToWithdraw", $langs->transnoentitiesnoconv("BankTransfer")).''; } print "
"; -} -else { +} else { dol_print_error($db); } @@ -218,8 +216,7 @@ if ($result) } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/bons.php b/htdocs/compta/prelevement/bons.php index 106f848f732..347b3ebb37f 100644 --- a/htdocs/compta/prelevement/bons.php +++ b/htdocs/compta/prelevement/bons.php @@ -190,8 +190,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php index d5051e06bfa..7d56cec823e 100644 --- a/htdocs/compta/prelevement/card.php +++ b/htdocs/compta/prelevement/card.php @@ -408,8 +408,7 @@ if ($id > 0 || $ref) if ($obj->statut == 3) { print ''.$langs->trans("StatusRefused").''; - } - else { + } else { print " "; } @@ -441,8 +440,7 @@ if ($id > 0 || $ref) print ''; $db->free($result); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 91a165ee454..6192d97d92f 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -151,18 +151,15 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { $result = 0; - } - else { + } else { $result = -1; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } - } - else { + } else { $result = -2; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } - } - else { + } else { $result = -3; dol_syslog(get_class($this)."::AddFacture Erreur $result"); } @@ -205,12 +202,10 @@ class BonPrelevement extends CommonObject if ($resql) { $num = $this->db->num_rows($resql); - } - else { + } else { $result = -1; } - } - else { + } else { /* * No aggregate */ @@ -238,8 +233,7 @@ class BonPrelevement extends CommonObject { $line_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_lignes"); $result = 0; - } - else { + } else { dol_syslog(get_class($this)."::addline Error -2"); $result = -2; } @@ -314,13 +308,11 @@ class BonPrelevement extends CommonObject $this->fetched = 1; return 1; - } - else { + } else { dol_syslog(get_class($this)."::Fetch Erreur aucune ligne retournee"); return -1; } - } - else { + } else { return -2; } } @@ -388,15 +380,13 @@ class BonPrelevement extends CommonObject { $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::set_credite ROLLBACK "); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_credite Ouverture transaction SQL impossible "); return -2; } @@ -480,8 +470,7 @@ class BonPrelevement extends CommonObject { dol_syslog(get_class($this)."::set_infocredit AddPayment Error"); $error++; - } - else { + } else { $result = $paiement->addPaymentToBank($user, 'payment', '(WithdrawalPayment)', $bankaccount, '', ''); if ($result < 0) { @@ -505,8 +494,7 @@ class BonPrelevement extends CommonObject dol_syslog(get_class($this)."::set_infocredit Update lines Error"); $error++; } - } - else { + } else { dol_syslog(get_class($this)."::set_infocredit Update Bons Error"); $error++; } @@ -521,24 +509,20 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog("bon-prelevment::set_infocredit ROLLBACK "); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_infocredit 1025 Open SQL transaction impossible "); return -1025; } - } - else { + } else { dol_syslog("bon-prelevment::set_infocredit 1027 Date de credit < Date de trans "); return -1027; } - } - else { + } else { return -1026; } } @@ -580,8 +564,7 @@ class BonPrelevement extends CommonObject $message .= $langs->trans("InfoTransData", price($this->amount), $this->methodes_trans[$this->method_trans], dol_print_date($date, 'day')); // TODO Call trigger to create a notification using notification module - } - else { + } else { $error++; } @@ -592,15 +575,13 @@ class BonPrelevement extends CommonObject $this->db->commit(); return 0; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::set_infotrans ROLLBACK", LOG_ERR); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::set_infotrans Ouverture transaction SQL impossible", LOG_CRIT); return -2; } @@ -655,8 +636,7 @@ class BonPrelevement extends CommonObject } } $this->db->free($resql); - } - else { + } else { dol_syslog(get_class($this)."::getListInvoices Erreur"); } @@ -693,8 +673,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); return $obj->nb; - } - else { + } else { $error = 1; dol_syslog(get_class($this)."::SommeAPrelever Erreur -1"); dol_syslog($this->db->error()); @@ -737,8 +716,7 @@ class BonPrelevement extends CommonObject $this->db->free($resql); return $obj->nb; - } - else { + } else { $this->error = get_class($this)."::NbFactureAPrelever Erreur -1 sql=".$this->db->error(); return -1; } @@ -825,8 +803,7 @@ class BonPrelevement extends CommonObject } $this->db->free($resql); dol_syslog(__METHOD__."::Read invoices, ".$i." invoices to withdraw", LOG_DEBUG); - } - else { + } else { $error++; dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } @@ -870,23 +847,19 @@ class BonPrelevement extends CommonObject $factures_prev_id[$i] = $fac[0]; $i++; //dol_syslog(__METHOD__."::RIB is ok", LOG_DEBUG); - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Error on default bank number IBAN/BIC for thirdparty reported by verif() ".$fact->socid." ".$soc->name, LOG_WARNING); $this->invoice_in_error[$fac[0]] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); $this->thirdparty_in_error[$soc->id] = "Error on default bank number IBAN/BIC for invoice ".$fact->getNomUrl(0)." for thirdparty ".$soc->getNomUrl(0); } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Failed to read company", LOG_WARNING); } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB Failed to read invoice", LOG_WARNING); } } - } - else { + } else { dol_syslog(__METHOD__."::Check RIB No invoice to process", LOG_WARNING); } } @@ -912,8 +885,7 @@ class BonPrelevement extends CommonObject if ($mode == 'real') { $ok = 1; - } - else { + } else { print $langs->trans("ModeWarning"); //"Option for real mode was not set, we stop after this simulation\n"; } } @@ -970,13 +942,11 @@ class BonPrelevement extends CommonObject $prev_id = $this->db->last_insert_id(MAIN_DB_PREFIX."prelevement_bons"); $this->id = $prev_id; $this->ref = $ref; - } - else { + } else { $error++; dol_syslog(__METHOD__."::Create withdraw receipt ".$this->db->lasterror(), LOG_ERR); } - } - else { + } else { $error++; dol_syslog(__METHOD__."::Get last withdraw receipt ".$this->db->lasterror(), LOG_ERR); } @@ -1097,14 +1067,12 @@ class BonPrelevement extends CommonObject if (!$error) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); } return count($factures_prev); - } - else { + } else { return 0; } } @@ -1164,8 +1132,7 @@ class BonPrelevement extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1224,8 +1191,7 @@ class BonPrelevement extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -1266,8 +1232,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { return 0; - } - else { + } else { return -1; } } @@ -1291,8 +1256,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { return 0; - } - else { + } else { return -1; } } @@ -1322,8 +1286,7 @@ class BonPrelevement extends CommonObject if ($this->db->query($sql)) { $result = 0; - } - else { + } else { $result = -1; dol_syslog(get_class($this)."::AddNotification Error $result"); } @@ -1426,8 +1389,7 @@ class BonPrelevement extends CommonObject $i++; } $nbtotalDrctDbtTxInf = $i; - } - else { + } else { fputs($this->file, 'ERROR DEBITOR '.$sql.$CrLf); // DEBITOR = Customers $result = -2; } @@ -1436,8 +1398,7 @@ class BonPrelevement extends CommonObject if ($result != -2) { $fileEmetteurSection .= $this->EnregEmetteurSEPA($conf, $date_actu, $nbtotalDrctDbtTxInf, $this->total, $CrLf, $format); - } - else { + } else { fputs($this->file, 'ERROR CREDITOR'.$CrLf); // CREDITOR = My company } @@ -1503,8 +1464,7 @@ class BonPrelevement extends CommonObject $this->total = $this->total + $obj->amount; $i++; } - } - else { + } else { $result = -2; } @@ -1874,8 +1834,7 @@ class BonPrelevement extends CommonObject $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; $XML_SEPA_INFO .= ' '.$CrLf; - } - else { + } else { fputs($this->file, 'INCORRECT EMETTEUR '.$XML_SEPA_INFO.$CrLf); $result = -2; } diff --git a/htdocs/compta/prelevement/class/ligneprelevement.class.php b/htdocs/compta/prelevement/class/ligneprelevement.class.php index accd64e2694..1e731b24524 100644 --- a/htdocs/compta/prelevement/class/ligneprelevement.class.php +++ b/htdocs/compta/prelevement/class/ligneprelevement.class.php @@ -96,15 +96,13 @@ class LignePrelevement $this->statut = $obj->statut; $this->bon_ref = $obj->ref; $this->bon_rowid = $obj->bon_rowid; - } - else { + } else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid numrows=0"); } $this->db->free($resql); - } - else { + } else { $result++; dol_syslog("LignePrelevement::Fetch rowid=$rowid"); dol_syslog($this->db->error()); @@ -140,20 +138,17 @@ class LignePrelevement if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); // Waiting elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); // Credited elseif ($status == 3) return img_picto($langs->trans($this->statuts[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); // Refused - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts[$status]), 'statut1'); elseif ($status == 2) return img_picto($langs->trans($this->statuts[$status]), 'statut6'); elseif ($status == 3) return img_picto($langs->trans($this->statuts[$status]), 'statut8'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut1'); elseif ($status == 2) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts[$status]), 'statut6'); diff --git a/htdocs/compta/prelevement/class/rejetprelevement.class.php b/htdocs/compta/prelevement/class/rejetprelevement.class.php index 1edd942fc42..8599987fb23 100644 --- a/htdocs/compta/prelevement/class/rejetprelevement.class.php +++ b/htdocs/compta/prelevement/class/rejetprelevement.class.php @@ -160,8 +160,7 @@ class RejetPrelevement { $error++; dol_syslog("RejetPrelevement::Create Error creation payment invoice ".$facs[$i][0]); - } - else { + } else { $result = $pai->addPaymentToBank($user, 'payment', '(InvoiceRefused)', $bankaccount, '', ''); if ($result < 0) { @@ -190,8 +189,7 @@ class RejetPrelevement { dol_syslog("RejetPrelevement::Create Commit"); $this->db->commit(); - } - else { + } else { dol_syslog("RejetPrelevement::Create Rollback"); $this->db->rollback(); } @@ -225,8 +223,7 @@ class RejetPrelevement $row = $this->db->fetch_row($resql); $userid = $row[0]; } - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Erreur lecture user"); } @@ -262,12 +259,10 @@ class RejetPrelevement if ($result) { dol_syslog("RejetPrelevement::_send_email email envoye"); - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Erreur envoi email"); } - } - else { + } else { dol_syslog("RejetPrelevement::_send_email Userid invalide"); } } @@ -315,8 +310,7 @@ class RejetPrelevement } } $this->db->free($resql); - } - else { + } else { dol_syslog("getListInvoices", LOG_ERR); } @@ -351,13 +345,11 @@ class RejetPrelevement $this->db->free($resql); return 0; - } - else { + } else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid numrows=0"); return -1; } - } - else { + } else { dol_syslog("RejetPrelevement::Fetch Erreur rowid=$rowid"); return -2; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 505ad070645..015380a669d 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -83,8 +83,7 @@ if (empty($reshook)) if ($result < 0) { setEventMessages($bprev->error, $bprev->errors, 'errors'); - } - elseif ($result == 0) + } elseif ($result == 0) { $mesg = $langs->trans("NoInvoiceCouldBeWithdrawed", $format); setEventMessages($mesg, null, 'errors'); @@ -93,8 +92,7 @@ if (empty($reshook)) { $mesg .= ''.$val."
\n"; } - } - else { + } else { setEventMessages($langs->trans("DirectDebitOrderCreated", $bprev->getNomUrl(1)), null); } } @@ -173,19 +171,16 @@ if ($nb) { } else { print '
'.$langs->trans("CreateAll")."\n"; } - } - else { + } else { if ($mysoc->isInEEC()) { print ''.$langs->trans("CreateForSepaFRST")."\n"; print ''.$langs->trans("CreateForSepaRCUR")."\n"; - } - else { + } else { print ''.$langs->trans("CreateAll")."\n"; } } -} -else { +} else { print 'transnoentitiesnoconv("StandingOrders"))).'">'.$langs->trans("CreateAll")."\n"; } @@ -303,15 +298,13 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } print ""; print ""; print "
\n"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/demandes.php b/htdocs/compta/prelevement/demandes.php index 64ac904db6c..30618de8c24 100644 --- a/htdocs/compta/prelevement/demandes.php +++ b/htdocs/compta/prelevement/demandes.php @@ -88,8 +88,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' if (!$status) { $title = $langs->trans("RequestStandingOrderToTreat"); -} -else { +} else { $title = $langs->trans("RequestStandingOrderTreated"); } @@ -141,8 +140,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); diff --git a/htdocs/compta/prelevement/factures.php b/htdocs/compta/prelevement/factures.php index bb3cced3eb4..c0fa4f55e68 100644 --- a/htdocs/compta/prelevement/factures.php +++ b/htdocs/compta/prelevement/factures.php @@ -134,8 +134,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } } @@ -245,12 +244,10 @@ if ($result) if ($obj->statut == 0) { print '-'; - } - elseif ($obj->statut == 2) + } elseif ($obj->statut == 2) { print $langs->trans("StatusCredited"); - } - elseif ($obj->statut == 3) + } elseif ($obj->statut == 3) { print ''.$langs->trans("StatusRefused").''; } @@ -288,8 +285,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php index 4bfc07b0292..65116878bb9 100644 --- a/htdocs/compta/prelevement/fiche-rejet.php +++ b/htdocs/compta/prelevement/fiche-rejet.php @@ -135,8 +135,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } } @@ -219,8 +218,7 @@ if ($resql) $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } @@ -236,8 +234,7 @@ if ($resql) print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/fiche-stat.php b/htdocs/compta/prelevement/fiche-stat.php index 5dd01bad41d..0ada15853d9 100644 --- a/htdocs/compta/prelevement/fiche-stat.php +++ b/htdocs/compta/prelevement/fiche-stat.php @@ -132,8 +132,7 @@ if ($prev_id > 0 || $ref) print ''; dol_fiche_end(); - } - else { + } else { $langs->load("errors"); print $langs->trans("Error"); } @@ -184,8 +183,7 @@ if ($prev_id > 0 || $ref) print ""; $db->free($resql); - } - else { + } else { print $db->error().' '.$sql; } } diff --git a/htdocs/compta/prelevement/index.php b/htdocs/compta/prelevement/index.php index faa56184891..d182176f0fa 100644 --- a/htdocs/compta/prelevement/index.php +++ b/htdocs/compta/prelevement/index.php @@ -158,13 +158,11 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("NoInvoiceToWithdraw", $langs->transnoentitiesnoconv("StandingOrders")).''; } print "
"; -} -else { +} else { dol_print_error($db); } @@ -218,8 +216,7 @@ if ($result) } print "
"; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/line.php b/htdocs/compta/prelevement/line.php index 89d6ad93636..fd77d6d90f6 100644 --- a/htdocs/compta/prelevement/line.php +++ b/htdocs/compta/prelevement/line.php @@ -73,9 +73,7 @@ if ($action == 'confirm_rejet') { $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Date")), null, 'errors'); - } - - elseif ($daterej > dol_now()) + } elseif ($daterej > dol_now()) { $error++; $langs->load("error"); @@ -102,12 +100,10 @@ if ($action == 'confirm_rejet') header("Location: line.php?id=".$id); exit; } - } - else { + } else { $action = "rejet"; } - } - else { + } else { header("Location: line.php?id=".$id); exit; } @@ -159,22 +155,19 @@ if ($id) { /* Historique pour certaines install */ print $langs->trans("Unknown"); - } - else { + } else { print dol_print_date($rej->date_rejet, 'day'); } print ''; print ''.$langs->trans("RefusedInvoicing").''.$rej->invoicing.''; - } - else { + } else { print ''.$resf.''; } } print ''; dol_fiche_end(); - } - else { + } else { dol_print_error($db); } @@ -240,12 +233,10 @@ if ($id) if ($user->rights->prelevement->bons->credit) { print "id\">".$langs->trans("StandingOrderReject").""; - } - else { + } else { print "trans("NotAllowed")."\">".$langs->trans("StandingOrderReject").""; } - } - else { + } else { print "trans("NotPossibleForThisStatusOfWithdrawReceiptORLine")."\">".$langs->trans("StandingOrderReject").""; } } @@ -322,8 +313,7 @@ if ($id) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/prelevement/list.php b/htdocs/compta/prelevement/list.php index b93042df8e6..3130aa475f6 100644 --- a/htdocs/compta/prelevement/list.php +++ b/htdocs/compta/prelevement/list.php @@ -235,8 +235,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/rejets.php b/htdocs/compta/prelevement/rejets.php index a7e7a6f3a53..61417a2cd5f 100644 --- a/htdocs/compta/prelevement/rejets.php +++ b/htdocs/compta/prelevement/rejets.php @@ -117,8 +117,7 @@ if ($result) print ""; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/prelevement/stats.php b/htdocs/compta/prelevement/stats.php index 609c75e065d..b12a6a2bb35 100644 --- a/htdocs/compta/prelevement/stats.php +++ b/htdocs/compta/prelevement/stats.php @@ -125,8 +125,7 @@ if ($resql) print ' '; print ""; $db->free(); -} -else { +} else { dol_print_error($db); } @@ -218,8 +217,7 @@ if ($resql) print ' '; print ""; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/recap-compta.php b/htdocs/compta/recap-compta.php index 83388f21e49..8b75ec38fce 100644 --- a/htdocs/compta/recap-compta.php +++ b/htdocs/compta/recap-compta.php @@ -211,13 +211,11 @@ if ($id > 0) } $db->free($resqlp); - } - else { + } else { dol_print_error($db); } } - } - else { + } else { dol_print_error($db); } @@ -286,8 +284,7 @@ if ($id > 0) print ""; } -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 8d7c0343b30..671921506d5 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -99,8 +99,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -154,8 +153,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -166,8 +164,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPredefinedAccountGroups"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -212,8 +209,7 @@ print_liste_field_titre(''); if ($modecompta == 'BOOKKEEPING') { print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], 'amount', '', $param, 'class="right"', $sortfield, $sortorder); -} -else { +} else { if ($modecompta == 'CREANCES-DETTES') { print_liste_field_titre("AmountHT", $_SERVER["PHP_SELF"], 'amount_ht', '', $param, 'class="right"', $sortfield, $sortorder); @@ -311,14 +307,11 @@ if ($modecompta == 'BOOKKEEPING') $i++; } - } - else { + } else { print ''.$langs->trans("NoRecordFound").''; } - } - else dol_print_error($db); -} -else { + } else dol_print_error($db); +} else { /* * Factures clients */ @@ -336,8 +329,7 @@ else { else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -462,8 +454,7 @@ else { else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT s.nom as name, s.rowid as socid, sum(pf.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."paiementfourn as p"; @@ -512,8 +503,7 @@ else { print "\n"; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -546,8 +536,7 @@ else { $sql .= " AND c.deductible = 0"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -591,8 +580,7 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -623,8 +611,7 @@ else { if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; $sql .= " AND cs.entity = ".$conf->entity; - } - elseif ($modecompta == 'RECETTES-DEPENSES') + } elseif ($modecompta == 'RECETTES-DEPENSES') { $sql = "SELECT c.id, c.libelle as label, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."c_chargesociales as c"; @@ -668,8 +655,7 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; @@ -761,14 +747,12 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -845,14 +829,12 @@ else { print ''.price(-$obj->amount_ttc).''; print ''; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -877,8 +859,7 @@ else { $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; $sql .= " WHERE p.entity IN (".getEntity('donation').")"; $sql .= " AND fk_statut in (1,2)"; - } - else { + } else { $sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(p.datedon,'%Y-%m') as dm, sum(p.amount) as amount"; $sql .= " FROM ".MAIN_DB_PREFIX."don as p"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; @@ -924,14 +905,12 @@ else { print ''; $i++; } - } - else { + } else { print ' '; print ''.$langs->trans("None").''; print ''; } - } - else { + } else { dol_print_error($db); } print ''; @@ -998,8 +977,7 @@ else { print ''.price($subtotal_ht).''; print ''.price($subtotal_ttc).''; print ''; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -1047,8 +1025,7 @@ else { print ''.price($subtotal_ht).''; print ''.price($subtotal_ttc).''; print ''; - } - else dol_print_error($db); + } else dol_print_error($db); } /* @@ -1157,8 +1134,7 @@ else { print ' '."\n"; print ''.price($amount)."\n"; print "\n"; - } - else { + } else { // VAT really already paid $amount = 0; $sql = "SELECT date_format(t.datev,'%Y-%m') as dm, sum(t.amount) as amount"; @@ -1237,8 +1213,7 @@ else { } } $db->free($result); - } - else { + } else { dol_print_error($db); } print ' '; diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 04bed25d6b2..7221e932ca6 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -78,8 +78,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -134,8 +133,7 @@ if ($modecompta == 'CREANCES-DETTES') else $description .= "
".$langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") { +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; @@ -146,8 +144,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") { $description .= '
'.$langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByYear"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -191,8 +188,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod else $sql .= " AND f.type IN (0,1,2,3,5)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -228,12 +224,10 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } $db->free($result); - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -274,17 +268,14 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } - } - else { + } else { dol_print_error($db); } - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { // Nothing from this table } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -307,8 +298,7 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod else $sql .= " AND f.type IN (0,1,2,3)"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; - } - elseif ($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"; @@ -343,12 +333,10 @@ if (!empty($conf->facture->enabled) && ($modecompta == 'CREANCES-DETTES' || $mod $i++; } $db->free($result); - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -429,8 +417,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } - } - elseif ($modecompta == "RECETTES-DEPENSES") + } elseif ($modecompta == "RECETTES-DEPENSES") { // TVA really already paid $sql = "SELECT sum(t.amount) as amount, date_format(t.datev,'%Y-%m') as dm"; @@ -493,8 +480,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom dol_print_error($db); } } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -516,8 +502,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $sql .= " AND c.deductible = 0"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($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,8 +539,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -578,8 +562,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $sql .= " AND c.deductible = 1"; if (!empty($date_start) && !empty($date_end)) $sql .= " AND cs.date_ech >= '".$db->idate($date_start)."' AND cs.date_ech <= '".$db->idate($date_end)."'"; - } - elseif ($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,8 +599,7 @@ if (!empty($conf->tax->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -664,8 +646,7 @@ if (!empty($conf->salaries->enabled) && ($modecompta == 'CREANCES-DETTES' || $mo } else { dol_print_error($db); } -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Nothing from this table } @@ -723,12 +704,10 @@ if (!empty($conf->expensereport->enabled) && ($modecompta == 'CREANCES-DETTES' | $decaiss_ttc[$obj->dm] += $obj->amount_ttc; } } - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == 'BOOKKEEPING') { +} elseif ($modecompta == 'BOOKKEEPING') { // Nothing from this table } @@ -784,12 +763,10 @@ if (!empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modecom $i++; } } - } - else { + } else { dol_print_error($db); } -} -elseif ($modecompta == 'BOOKKEEPING') { +} elseif ($modecompta == 'BOOKKEEPING') { // Nothing from this table } @@ -823,8 +800,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba $i++; } } - } - else { + } else { dol_print_error($db); } @@ -852,8 +828,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_VARPAY) && !empty($conf->ba $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -889,8 +864,7 @@ if (!empty($conf->global->ACCOUNTING_REPORTS_INCLUDE_LOAN) && !empty($conf->loan $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -955,8 +929,7 @@ if (!empty($conf->accounting->enabled) && ($modecompta == 'BOOKKEEPING')) $i++; } } - } - else { + } else { dol_print_error($db); } } @@ -1035,8 +1008,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if (!isset($totsorties[$annee])) $totsorties[$annee] = 0; $totsorties[$annee] += $decaiss[$case]; } - } - else { + } else { if (isset($decaiss_ttc[$case]) && $decaiss_ttc[$case] != 0) { print ''.price(price2num($decaiss_ttc[$case], 'MT')).''; @@ -1055,8 +1027,7 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if (!isset($totentrees[$annee])) $totentrees[$annee] = 0; $totentrees[$annee] += $encaiss[$case]; } - } - else { + } else { if (isset($encaiss_ttc[$case])) { print ''.price(price2num($encaiss_ttc[$case], 'MT')).''; diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 172929aabff..48cb8b1154e 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -90,8 +90,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; else $year_end++; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -181,8 +180,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") { +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("AnnualByAccountInputOutputMode"); $calcmode = $langs->trans("CalcModeEngagement"); $calcmode .= '
('.$langs->trans("SeeReportInDueDebtMode", '', '').')'; @@ -192,8 +190,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") { $description = $langs->trans("RulesResultInOut"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("ReportInOut").', '.$langs->trans("ByPersonalizedAccountGroups"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -248,13 +245,11 @@ if ($modecompta == 'CREANCES-DETTES') { //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'"; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { //if (! empty($date_start) && ! empty($date_end)) // $sql.= " AND p.datep >= '".$db->idate($date_start)."' AND p.datep <= '".$db->idate($date_end)."'"; -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // Get array of all report groups that are active $cats = $AccCat->getCats(); // WARNING: Computed groups must be after group they include diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 0cb706d3177..f9d5a90d543 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -128,8 +128,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes') { header("Location: list.php"); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -144,28 +143,23 @@ if ($action == 'add' && $user->rights->tax->charges->creer) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $action = 'create'; - } - elseif (!$dateperiod) + } elseif (!$dateperiod) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors'); $action = 'create'; - } - elseif (!$actioncode > 0) + } elseif (!$actioncode > 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Type")), null, 'errors'); $action = 'create'; - } - elseif (empty($amount)) + } elseif (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - elseif (!is_numeric($amount)) + } elseif (!is_numeric($amount)) { setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - else { + } else { $object->type = $actioncode; $object->label = GETPOST('label', 'alpha'); $object->date_ech = $dateech; @@ -193,23 +187,19 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->tax->charges->cre { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Date")), null, 'errors'); $action = 'edit'; - } - elseif (!$dateperiod) + } elseif (!$dateperiod) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Period")), null, 'errors'); $action = 'edit'; - } - elseif (empty($amount)) + } elseif (empty($amount)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Amount")), null, 'errors'); $action = 'edit'; - } - elseif (!is_numeric($amount)) + } elseif (!is_numeric($amount)) { setEventMessages($langs->trans("ErrorFieldMustBeANumeric", $langs->transnoentities("Amount")), null, 'errors'); $action = 'create'; - } - else { + } else { $result = $object->fetch($id); $object->date_ech = $dateech; @@ -242,16 +232,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char if (GETPOST('clone_label', 'alphanohtml')) { $object->label = GETPOST('clone_label', 'alphanohtml'); - } - else { + } else { $object->label = $langs->trans("CopyOf").' '.$object->label; } if (GETPOST('clone_for_next_month', 'int')) { $object->periode = dol_time_plus_duree($object->periode, 1, 'm'); $object->date_ech = dol_time_plus_duree($object->date_ech, 1, 'm'); - } - else { + } else { $newdateperiod = dol_mktime(0, 0, 0, GETPOST('clone_periodmonth', 'int'), GETPOST('clone_periodday', 'int'), GETPOST('clone_periodyear', 'int')); $newdateech = dol_mktime(0, 0, 0, GETPOST('clone_date_echmonth', 'int'), GETPOST('clone_date_echday', 'int'), GETPOST('clone_date_echyear', 'int')); if ($newdateperiod) $object->periode = $newdateperiod; @@ -268,16 +256,14 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && ($user->rights->tax->char header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { $id = $originalId; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } } - } - else { + } else { $db->rollback(); dol_print_error($db, $object->error); } @@ -426,8 +412,7 @@ if ($id > 0) if (!empty($conf->global->TAX_ADD_CLON_FOR_NEXT_MONTH_CHECKBOX)) { $formquestion[] = array('type' => 'checkbox', 'name' => 'clone_for_next_month', 'label' => $langs->trans("CloneTaxForNextMonth"), 'value' => 1); - } - else { + } else { $formquestion[] = array('type' => 'date', 'name' => 'clone_date_ech', 'label' => $langs->trans("Date"), 'value' => -1); $formquestion[] = array('type' => 'date', 'name' => 'clone_period', 'label' => $langs->trans("PeriodEndDate"), 'value' => -1); } @@ -529,8 +514,7 @@ if ($id > 0) if ($action == 'edit') { print $form->selectDate($object->periode, 'period', 0, 0, 0, 'charge', 1); - } - else { + } else { print dol_print_date($object->periode, "day"); } print ""; @@ -541,8 +525,7 @@ if ($id > 0) print ''.$langs->trans("AmountTTC").""; print ''; print ""; - } - else { + } else { print ''.$langs->trans("AmountTTC").''.price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; } @@ -667,8 +650,7 @@ if ($id > 0) $totalpaye += $objp->amount; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; print ''; print ''; @@ -687,8 +669,7 @@ if ($id > 0) print ''; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -758,8 +739,7 @@ if ($id > 0) print ""; } - } - else { + } else { /* Social contribution not found */ dol_print_error('', $object->error); } diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index b91d9ca31ee..cc66b56aabd 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -459,28 +459,23 @@ class Cchargesociales { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 0c709c031d5..81ae1e28f20 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -171,12 +171,10 @@ class ChargeSociales extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -250,13 +248,11 @@ class ChargeSociales extends CommonObject if (empty($error)) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1 * $error; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -325,8 +321,7 @@ class ChargeSociales extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -382,8 +377,7 @@ class ChargeSociales extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -416,12 +410,10 @@ class ChargeSociales extends CommonObject $obj = $this->db->fetch_object($result); $this->db->free($result); return $obj->amount; - } - else { + } else { return 0; } - } - else { + } else { print $this->db->error(); return -1; } @@ -605,8 +597,7 @@ class ChargeSociales extends CommonObject $this->db->free($resql); return $amount; - } - else { + } else { return -1; } } @@ -659,8 +650,7 @@ class ChargeSociales extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 9164ab39f1e..4cb81422284 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -194,13 +194,11 @@ class PaymentSocialContribution extends CommonObject if ($remaintopay == 0) { $result = $contrib->set_paid($user); - } - else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); + } else dol_syslog("Remain to pay for conrib ".$contribid." not null. We do nothing."); } } } - } - else { + } else { $error++; } } @@ -214,8 +212,7 @@ class PaymentSocialContribution extends CommonObject $this->total = $totalamount; // deprecated $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -284,8 +281,7 @@ class PaymentSocialContribution extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -355,8 +351,7 @@ class PaymentSocialContribution extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -410,8 +405,7 @@ class PaymentSocialContribution extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -460,8 +454,7 @@ class PaymentSocialContribution extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -571,8 +564,7 @@ class PaymentSocialContribution extends CommonObject if ($result <= 0) dol_print_error($this->db); } } - } - else { + } else { $this->error = $acc->error; $error++; } @@ -581,8 +573,7 @@ class PaymentSocialContribution extends CommonObject if (!$error) { return 1; - } - else { + } else { return -1; } } @@ -605,8 +596,7 @@ class PaymentSocialContribution extends CommonObject if ($result) { return 1; - } - else { + } else { $this->error = $this->db->error(); return 0; } diff --git a/htdocs/compta/sociales/document.php b/htdocs/compta/sociales/document.php index e63c5f354d0..e7d76b94a76 100644 --- a/htdocs/compta/sociales/document.php +++ b/htdocs/compta/sociales/document.php @@ -163,8 +163,7 @@ if ($object->id) $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/sociales/list.php b/htdocs/compta/sociales/list.php index be5f7e6f973..43823490ed9 100644 --- a/htdocs/compta/sociales/list.php +++ b/htdocs/compta/sociales/list.php @@ -80,8 +80,7 @@ if (!GETPOSTISSET('search_typeid')) $part = explode(':', $val); if ($part[0] == 'cs.fk_type') $search_typeid = $part[1]; } -} -else { +} else { $search_typeid = GETPOST('search_typeid', 'int'); } @@ -207,8 +206,7 @@ if ($resql) $countrynotdefined = $langs->trans("ErrorSetACountryFirst"); print $countrynotdefined; print ''; - } - else { + } else { print '
'; print ''."\n"; @@ -311,8 +309,7 @@ if ($resql) if ($obj->periode) { print 'jdate($obj->periode)).'">'.dol_print_date($db->jdate($obj->periode), 'day').''; - } - else { + } else { print ' '; } print "\n"; @@ -342,8 +339,7 @@ if ($resql) print ''; } print ''; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/sociales/payments.php b/htdocs/compta/sociales/payments.php index 05808877df9..fc1f66d5e2c 100644 --- a/htdocs/compta/sociales/payments.php +++ b/htdocs/compta/sociales/payments.php @@ -92,8 +92,7 @@ if ($mode != 'sconly') { $center = ($year ? ''.img_previous($langs->trans("Previous"), 'class="valignbottom"')." ".$langs->trans("Year").' '.$year.' '.img_next($langs->trans("Next"), 'class="valignbottom"')."" : ""); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit, 1); -} -else { +} else { print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $totalnboflines, 'title_accountancy', 0, '', '', $limit); } @@ -207,8 +206,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ''; print '"; print ""; - } - else { + } else { dol_print_error($db); } print '
 '.price($totalpaye)."
'; @@ -285,8 +283,7 @@ if (!empty($conf->tax->enabled) && $user->rights->tax->charges->lire) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -297,18 +294,15 @@ if ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj == "1") { $j = 1; $numlt = 3; -} -elseif ($mysoc->localtax1_assuj == "1") +} elseif ($mysoc->localtax1_assuj == "1") { $j = 1; $numlt = 2; -} -elseif ($mysoc->localtax2_assuj == "1") +} elseif ($mysoc->localtax2_assuj == "1") { $j = 2; $numlt = 3; -} -else { +} else { $j = 0; $numlt = 0; } @@ -384,8 +378,7 @@ while ($j < $numlt) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -467,8 +460,7 @@ if (!empty($conf->salaries->enabled) && !empty($user->rights->salaries->read)) $db->free($result); print "
"; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 3859b19df91..dc5ebd1731d 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -77,8 +77,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -208,8 +207,7 @@ if ($modecompta == "CREANCES-DETTES") { } $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByVatRate"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -219,11 +217,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 513b0ffa350..ab2c1dcadb1 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -103,8 +103,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -180,8 +179,7 @@ if ($modecompta == "CREANCES-DETTES") { } $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -191,11 +189,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } @@ -231,8 +227,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } - elseif ($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"; } @@ -254,8 +249,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " AND cp.fk_product is null"; - } - elseif ($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 6d720b4f96d..8b6caa89a8f 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -96,8 +96,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } // $date_start and $date_end are defined. We force $year_start and $nbofyear @@ -156,8 +155,7 @@ if ($modecompta == "CREANCES-DETTES") { else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByUserAuthorOfInvoice"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -166,12 +164,10 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { // TODO -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { // TODO } @@ -395,8 +391,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { @@ -415,8 +410,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } else { @@ -430,8 +424,7 @@ if (count($amount)) { } else { //print ''; } - } - elseif ($modecompta == 'CREANCES-DETTES') { + } elseif ($modecompta == 'CREANCES-DETTES') { if ($key > 0) { print ''; } diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 85a27c7574a..ab71b147b50 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -113,8 +113,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } @@ -182,8 +181,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -192,11 +190,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -222,8 +218,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($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"; } @@ -240,8 +235,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($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 .= ")"; @@ -260,8 +254,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($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"; } @@ -274,8 +267,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($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 cfc521c7c13..796ce2cc6a6 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -73,8 +73,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -127,8 +126,7 @@ if ($modecompta == "CREANCES-DETTES") else $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("TurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -140,8 +138,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description .= $langs->trans("DepositsAreIncluded"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("Turnover"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -173,8 +170,7 @@ if ($modecompta == 'CREANCES-DETTES') else $sql .= " AND f.type IN (0,1,2,3,5)"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { /* * Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les @@ -188,8 +184,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $sql .= " AND pf.fk_facture = f.rowid"; $sql .= " AND f.entity IN (".getEntity('invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($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"; @@ -223,8 +218,7 @@ if ($result) $i++; } $db->free($result); -} -else { +} else { dol_print_error($db); } @@ -259,8 +253,7 @@ if ($modecompta == 'RECETTES-DEPENSES') } $i++; } - } - else { + } else { dol_print_error($db); } } @@ -338,10 +331,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; } @@ -354,10 +345,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if ($modecompta != 'BOOKKEEPING') print ''; print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; @@ -387,11 +376,9 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print '-'; } - } - else { + } else { print ''; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; } @@ -479,8 +466,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; - } - else { + } else { print ' '; } } @@ -489,8 +475,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; - } - else { + } else { print ' '; } @@ -513,11 +498,9 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print '+0%'; } - } - else { + } else { print ''; - if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } - else { print ' '; } + if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } print ''; } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index e9e0ec5926c..c257d5d1f73 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -69,8 +69,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $month_end = $month_start - 1; if ($month_end < 1) $month_end = 12; - } - else $month_end = $month_start; + } else $month_end = $month_start; $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); } if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } @@ -121,8 +120,7 @@ if ($modecompta == "CREANCES-DETTES") $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -133,8 +131,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $name = $langs->trans("PurchaseTurnover"); $calcmode = $langs->trans("CalcModeBookkeeping"); @@ -165,8 +162,7 @@ if ($modecompta == 'CREANCES-DETTES') $sql .= " AND f.type IN (0,2)"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $sql = "SELECT date_format(p.datep,'%Y-%m') as dm, sum(pf.amount) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."facture_fourn as f"; @@ -176,8 +172,7 @@ elseif ($modecompta == "RECETTES-DEPENSES") $sql .= " AND pf.fk_facturefourn = f.rowid"; $sql .= " AND f.entity IN (".getEntity('supplier_invoice').")"; if ($socid) $sql .= " AND f.fk_soc = ".$socid; -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { $sql = "SELECT date_format(b.doc_date,'%Y-%m') as dm, sum(b.debit) as amount_ttc"; $sql .= " FROM ".MAIN_DB_PREFIX."accounting_bookkeeping as b, ".MAIN_DB_PREFIX."accounting_journal as aj"; @@ -211,8 +206,7 @@ if ($result) $i++; } $db->free($result); -} -else { +} else { dol_print_error($db); } @@ -289,10 +283,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { $now_show_delta = 1; // On a trouve le premier mois de la premiere annee generant du chiffre. print ''.price($cum_ht[$case], 1).''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; } @@ -305,10 +297,8 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) if ($modecompta != 'BOOKKEEPING') print ''; print price($cum[$case], 1); if ($modecompta != 'BOOKKEEPING') print ''; - } - else { - if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } - else { print ' '; } + } else { + if ($minyearmonth < $case && $case <= max($maxyearmonth, $nowyearmonth)) { print '0'; } else { print ' '; } } print ""; @@ -338,11 +328,9 @@ for ($mois = 1 + $nb_mois_decalage; $mois <= 12 + $nb_mois_decalage; $mois++) { print '-'; } - } - else { + } else { print ''; - if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } - else { print ' '; } + if ($minyearmonth <= $case && $case <= $maxyearmonth) { print '-'; } else { print ' '; } print ''; } @@ -365,8 +353,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total_ht[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total_ht[$annee] ?price($total_ht[$annee]) : "0").""; - } - else { + } else { print ' '; } } @@ -375,8 +362,7 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) if ($total[$annee] || ($annee >= $minyear && $annee <= max($nowyear, $maxyear))) { print ''.($total[$annee] ?price($total[$annee]) : "0").""; - } - else { + } else { print ' '; } @@ -399,11 +385,9 @@ for ($annee = $year_start; $annee <= $year_end; $annee++) { print '+0%'; } - } - else { + } else { print ''; - if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } - else { print ' '; } + if ($total[$annee] || ($minyear <= $annee && $annee <= max($nowyear, $maxyear))) { print '-'; } else { print ' '; } print ''; } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 9b25488c280..5911daaba45 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -100,8 +100,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end else $year_end++; } $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -171,8 +170,7 @@ if ($modecompta == "CREANCES-DETTES") { $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByProductsAndServices"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -180,11 +178,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } @@ -220,8 +216,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_product as cp ON p.rowid = cp.fk_product"; - } - elseif ($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"; } @@ -239,8 +234,7 @@ if ($modecompta == 'CREANCES-DETTES') if ($selected_cat === -2) // Without any category { $sql .= " AND cp.fk_product is null"; - } - elseif ($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/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 76f9c246e87..60d65049800 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -107,8 +107,7 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } if ($q == 4) { $date_start = dol_get_first_day($year_start, 10, false); $date_end = dol_get_last_day($year_start, 12, false); } -} -else { +} else { // TODO We define q } @@ -174,8 +173,7 @@ if ($modecompta == "CREANCES-DETTES") $description = $langs->trans("RulesPurchaseTurnoverDue"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "RECETTES-DEPENSES") +} elseif ($modecompta == "RECETTES-DEPENSES") { $name = $langs->trans("PurchaseTurnoverCollected").', '.$langs->trans("ByThirdParties"); $calcmode = $langs->trans("CalcModeEngagement"); @@ -183,11 +181,9 @@ elseif ($modecompta == "RECETTES-DEPENSES") $description = $langs->trans("RulesPurchaseTurnoverIn"); $builddate = dol_now(); //$exportlink=$langs->trans("NotYetAvailable"); -} -elseif ($modecompta == "BOOKKEEPING") +} elseif ($modecompta == "BOOKKEEPING") { -} -elseif ($modecompta == "BOOKKEEPINGCOLLECTED") +} elseif ($modecompta == "BOOKKEEPINGCOLLECTED") { } $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); @@ -214,8 +210,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($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"; } @@ -228,8 +223,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($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 .= ")"; @@ -244,8 +238,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " LEFT OUTER JOIN ".MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_soc"; - } - elseif ($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"; } @@ -258,8 +251,7 @@ if ($modecompta == 'CREANCES-DETTES') { if ($selected_cat === -2) // Without any category { $sql .= " AND cs.fk_soc is null"; - } - elseif ($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/tva/card.php b/htdocs/compta/tva/card.php index 3df7419019a..6fa22885dee 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -131,8 +131,7 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel")) $db->commit(); header("Location: list.php"); exit; - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -165,19 +164,16 @@ if ($action == 'delete') $db->commit(); header("Location: ".DOL_URL_ROOT.'/compta/tva/list.php'); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $mesg = 'Error try do delete a line linked to a conciliated bank transaction'; setEventMessages($mesg, null, 'errors'); } @@ -384,12 +380,10 @@ if ($id) if (!empty($user->rights->tax->charges->supprimer)) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } print "
"; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index baeaff7a5d6..3274a3eaebd 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -150,13 +150,11 @@ class Tva extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $this->db->rollback(); return -1; @@ -222,8 +220,7 @@ class Tva extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -290,8 +287,7 @@ class Tva extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -400,13 +396,11 @@ class Tva extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -439,13 +433,11 @@ class Tva extends CommonObject $ret = $obj->total_tva; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -480,13 +472,11 @@ class Tva extends CommonObject $ret = $obj->amount; $this->db->free($result); return $ret; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { print $this->db->lasterror(); return -1; } @@ -602,8 +592,7 @@ class Tva extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $ok = 0; } @@ -621,18 +610,15 @@ class Tva extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -3; } - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -655,8 +641,7 @@ class Tva extends CommonObject if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -695,8 +680,7 @@ class Tva extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -737,8 +721,7 @@ class Tva extends CommonObject $this->db->free($resql); return $amount; - } - else { + } else { return -1; } } @@ -783,8 +766,7 @@ class Tva extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index 158c974114d..52466e33d84 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -66,13 +66,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } - else { + if (GETPOST("month", 'int')) { $date_start = dol_get_first_day($year_start, GETPOST("month", 'int'), false); $date_end = dol_get_last_day($year_start, GETPOST("month", 'int'), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -84,14 +82,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -319,8 +315,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'vat' =>$x_paye[$my_paye_thirdpartyid]['vat_list'][$id], 'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { $invoice_supplier->id = $x_paye[$my_paye_thirdpartyid]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_thirdpartyid]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_thirdpartyid]['type'][$id]; @@ -690,8 +685,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { print $langs->trans("NA"); - } - else { + } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/compta/tva/document.php b/htdocs/compta/tva/document.php index 45efc9681d8..cb26304cde5 100644 --- a/htdocs/compta/tva/document.php +++ b/htdocs/compta/tva/document.php @@ -148,8 +148,7 @@ if ($object->id) $permtoedit = $user->rights->fournisseur->facture->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index c85f2bbdb8f..43db8353c4c 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -57,13 +57,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -75,14 +73,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -174,8 +170,7 @@ function pt($db, $sql, $date) $amountpaid = 0; $previousmode = ''; $previousmonth = ''; - } - else { + } else { $previousmode = $obj->mode; $previousmonth = $obj->dm; } @@ -204,8 +199,7 @@ function pt($db, $sql, $date) print ""; $db->free($result); - } - else { + } else { dol_print_error($db); } } @@ -368,8 +362,7 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) // $mc 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], //'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { //$invoice_supplier->id=$x_paye[$my_paye_rate]['facid'][$id]; //$invoice_supplier->ref=$x_paye[$my_paye_rate]['facnum'][$id]; //$invoice_supplier->type=$x_paye[$my_paye_rate]['type'][$id]; diff --git a/htdocs/compta/tva/list.php b/htdocs/compta/tva/list.php index 98eede887c8..5b09da5305c 100644 --- a/htdocs/compta/tva/list.php +++ b/htdocs/compta/tva/list.php @@ -72,8 +72,7 @@ if (empty($_REQUEST['typeid'])) $part = explode(':', $val); if ($part[0] == 't.fk_typepayment') $typeid = $part[1]; } -} -else { +} else { $typeid = $_REQUEST['typeid']; } @@ -227,8 +226,7 @@ if ($result) if ($obj->payment_code <> '') { $type = ''.$langs->trans("PaymentTypeShort".$obj->payment_code).' '.$obj->num_payment.''; - } - else { + } else { $type = ' '; } @@ -264,8 +262,7 @@ if ($result) $bankstatic->label = $obj->blabel; print $bankstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; } // Amount @@ -289,8 +286,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 6e16165ab6c..abd5fb6841c 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -66,13 +66,11 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end $q = GETPOST("q", "int"); if (empty($q)) { - if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } - else { + if (GETPOST("month", "int")) { $date_start = dol_get_first_day($year_start, GETPOST("month", "int"), false); $date_end = dol_get_last_day($year_start, GETPOST("month", "int"), false); } else { if (empty($conf->global->MAIN_INFO_VAT_RETURN) || $conf->global->MAIN_INFO_VAT_RETURN == 2) { // quaterly vat, we take last past complete quarter $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -3 - (($current_date['mon'] - $conf->global->SOCIETE_FISCAL_MONTH_START) % 3), 'm'); $date_end = dol_time_plus_duree($date_start, 3, 'm') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 3) { // yearly vat if ($current_date['mon'] < $conf->global->SOCIETE_FISCAL_MONTH_START) { if (($conf->global->SOCIETE_FISCAL_MONTH_START - $current_date['mon']) > 6) { // If period started from less than 6 years, we show past year $year_start--; @@ -84,14 +82,12 @@ if (empty($date_start) || empty($date_end)) // We define date_start and date_end } $date_start = dol_get_first_day($year_start, $conf->global->SOCIETE_FISCAL_MONTH_START, false); $date_end = dol_time_plus_duree($date_start, 1, 'y') - 1; - } - elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month + } elseif ($conf->global->MAIN_INFO_VAT_RETURN == 1) { // monthly vat, we take last past complete month $date_start = dol_time_plus_duree(dol_get_first_day($year_start, $current_date['mon'], false), -1, 'm'); $date_end = dol_time_plus_duree($date_start, 1, 'm') - 1; } } - } - else { + } else { if ($q == 1) { $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); } if ($q == 2) { $date_start = dol_get_first_day($year_start, 4, false); $date_end = dol_get_last_day($year_start, 6, false); } if ($q == 3) { $date_start = dol_get_first_day($year_start, 7, false); $date_end = dol_get_last_day($year_start, 9, false); } @@ -313,8 +309,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) 'vat' =>$x_paye[$my_paye_rate]['vat_list'][$id], 'link' =>$expensereport->getNomUrl(1) ); - } - else { + } else { $invoice_supplier->id = $x_paye[$my_paye_rate]['facid'][$id]; $invoice_supplier->ref = $x_paye[$my_paye_rate]['facnum'][$id]; $invoice_supplier->type = $x_paye[$my_paye_rate]['type'][$id]; @@ -436,8 +431,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) if (dol_string_nohtmltag($fields['descr'])) { print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } - } - else { + } else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -616,8 +610,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) if (dol_string_nohtmltag($fields['descr'])) { print ' - '.dol_trunc(dol_string_nohtmltag($fields['descr']), 24); } - } - else { + } else { if ($type) { $text = img_object($langs->trans('Service'), 'service'); } else { @@ -668,8 +661,7 @@ if (!is_array($x_coll) || !is_array($x_paye)) || ($type == 1 && $conf->global->TAX_MODE_BUY_SERVICE == 'invoice')) { print $langs->trans("NA"); - } - else { + } else { if (isset($fields['payment_amount']) && $fields['ftotal_ttc']) { $ratiopaymentinvoice = ($fields['payment_amount'] / $fields['ftotal_ttc']); } diff --git a/htdocs/contact/agenda.php b/htdocs/contact/agenda.php index 874a964a965..0ea0018632b 100644 --- a/htdocs/contact/agenda.php +++ b/htdocs/contact/agenda.php @@ -76,8 +76,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -158,8 +157,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index e005d3dca7b..415d9e47790 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -119,8 +119,7 @@ abstract class ActionsContactCardCommon { $this->tpl['company'] = $objsoc->getNomUrl(1); $this->tpl['company_id'] = $objsoc->id; - } - else { + } else { $this->tpl['company'] = $form->select_company($this->object->socid, 'socid', '', 1); } @@ -207,8 +206,7 @@ abstract class ActionsContactCardCommon $dolibarr_user = new User($this->db); $result = $dolibarr_user->fetch($this->object->user_id); $this->tpl['dolibarr_user'] = $dolibarr_user->getLoginUrl(1); - } - else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); + } else $this->tpl['dolibarr_user'] = $langs->trans("NoDolibarrAccess"); } if ($action == 'view' || $action == 'delete') @@ -221,8 +219,7 @@ abstract class ActionsContactCardCommon $objsoc->fetch($this->object->socid); $this->tpl['company'] = $objsoc->getNomUrl(1); - } - else { + } else { $this->tpl['company'] = $langs->trans("ContactNotLinkedToCompany"); } @@ -307,8 +304,7 @@ abstract class ActionsContactCardCommon if ($resql) { $obj = $this->db->fetch_object($resql); - } - else { + } else { dol_print_error($this->db); } $this->object->country_id = $langs->trans("Country".$obj->code) ? $langs->trans("Country".$obj->code) : $obj->label; diff --git a/htdocs/contact/canvas/default/actions_contactcard_default.class.php b/htdocs/contact/canvas/default/actions_contactcard_default.class.php index 6ac81ac8bd4..099c973b0a4 100644 --- a/htdocs/contact/canvas/default/actions_contactcard_default.class.php +++ b/htdocs/contact/canvas/default/actions_contactcard_default.class.php @@ -104,8 +104,7 @@ class ActionsContactCardDefault extends ActionsContactCardCommon $this->tpl['actionstodo'] = show_actions_todo($conf, $langs, $db, $objsoc, $this->object, 1); $this->tpl['actionsdone'] = show_actions_done($conf, $langs, $db, $objsoc, $this->object, 1); - } - else { + } else { // Confirm delete contact if ($action == 'delete' && $user->rights->societe->contact->supprimer) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 885878138ba..6b73172decc 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -128,18 +128,15 @@ if (empty($reshook)) if ($result2) { $db->commit(); - } - else { + } else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } - } - else { + } else { $error = $nuser->error; $errors = $nuser->errors; $db->rollback(); } - } - else { + } else { $error = $object->error; $errors = $object->errors; } } @@ -152,8 +149,7 @@ if (empty($reshook)) if ($object->setstatus(0) < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -166,8 +162,7 @@ if (empty($reshook)) if ($object->setstatus(1) < 0) { setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$id); exit; } @@ -272,8 +267,7 @@ if (empty($reshook)) else $url = 'card.php?id='.$id; header("Location: ".$url); exit; - } - else { + } else { $db->rollback(); } } @@ -293,13 +287,11 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/contact/list.php'); exit; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -342,20 +334,17 @@ if (empty($reshook)) if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; - } - else { + } else { $object->photo = dol_sanitizeFileName($_FILES['photo']['name']); // Create thumbs $object->addThumbs($newfile); } } - } - else { + } else { $errors[] = "ErrorBadImageFormat"; } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -440,8 +429,7 @@ if (empty($reshook)) $resql = $db->query($sql); } } - } - else { + } else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."mailing_unsubscribe WHERE email = '".$db->escape($object->email)."' AND entity = ".$db->escape(getEntity('mailing', 0)); $resql = $db->query($sql); } @@ -452,8 +440,7 @@ if (empty($reshook)) $object->old_lastname = ''; $object->old_firstname = ''; $action = 'view'; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } @@ -512,8 +499,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -632,8 +618,7 @@ else { print ''; print ''; print ''; - } - else { + } else { print ''; print $form->select_company($socid, 'socid', '', 'SelectThirdParty'); print ''; @@ -688,16 +673,14 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - else { + } else { print ''; } if ($object->country_id) { print $formcompany->select_state(GETPOST("state_id", 'alpha') ? GETPOST("state_id", 'alpha') : $object->state_id, $object->country_code, 'state_id'); - } - else { + } else { print $countrynotdefined; } print ''; @@ -854,8 +837,7 @@ else { if ($object->birthday) { print $form->selectDate($object->birthday, 'birthday', 0, 0, 0, "perso", 1, 0); - } - else { + } else { print $form->selectDate('', 'birthday', 0, 0, 1, "perso", 1, 0); } print ''; @@ -864,8 +846,7 @@ else { if ($object->birthday_alert) { print ''; - } - else { + } else { print ''; } print ''; @@ -881,16 +862,14 @@ else { { print '     '; print ''; - } - else { + } else { print '     '; print ''; } print ''; print ""; - } - elseif ($action == 'edit' && !empty($id)) + } elseif ($action == 'edit' && !empty($id)) { /* * Fiche en mode edition @@ -1011,8 +990,7 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - else { + } else { print ''; } @@ -1049,8 +1027,7 @@ else { $langs->load("mails"); print ''.$langs->trans("NbOfEMailingsSend").''; print ''.$object->getNbOfEMailings().''; - } - else { + } else { print ''; } print ''; @@ -1074,8 +1051,7 @@ else { print ''; print ''.$form->selectyesno('no_email', (GETPOSTISSET("no_email") ?GETPOST("no_email", 'alpha') : $noemail), 1).''; - } - else { + } else { print ''; } print ''; @@ -1220,8 +1196,7 @@ else { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(1); - } - else print $langs->trans("NoDolibarrAccess"); + } else print $langs->trans("NoDolibarrAccess"); print ''; // Photo @@ -1396,8 +1371,7 @@ else { if (!empty($conf->commande->enabled) || !empty($conf->expedition->enabled)) { print ''; - if (!empty($conf->expedition->enabled)) { print $langs->trans("ContactForOrdersOrShipments"); } - else print $langs->trans("ContactForOrders"); + if (!empty($conf->expedition->enabled)) { print $langs->trans("ContactForOrdersOrShipments"); } else print $langs->trans("ContactForOrders"); print ''; $none = $langs->trans("NoContactForAnyOrder"); if (!empty($conf->expedition->enabled)) { $none = $langs->trans("NoContactForAnyOrderOrShipments"); } @@ -1425,8 +1399,7 @@ else { $dolibarr_user = new User($db); $result = $dolibarr_user->fetch($object->user_id); print $dolibarr_user->getLoginUrl(1); - } - else print $langs->trans("NoDolibarrAccess"); + } else print $langs->trans("NoDolibarrAccess"); print ''; print ''; @@ -1456,8 +1429,7 @@ else { { $langs->load("mails"); print ''; - } - else { + } else { $langs->load("mails"); print ''; } diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index fc640e7e032..cfe41eafca2 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -287,8 +287,7 @@ class Contact extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; @@ -387,14 +386,12 @@ class Contact extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); @@ -593,14 +590,12 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; } - } - else { + } else { $this->error = $this->db->lasterror().' sql='.$sql; $this->db->rollback(); return -1; @@ -756,12 +751,10 @@ class Contact extends CommonObject $error++; $this->error = $this->db->lasterror(); } - } - else { + } else { $result = true; } - } - else { + } else { $sql = "DELETE FROM ".MAIN_DB_PREFIX."user_alert "; $sql .= "WHERE type=1 AND fk_contact=".$this->db->escape($id)." AND fk_user=".$user->id; $result = $this->db->query($sql); @@ -784,8 +777,7 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { dol_syslog(get_class($this)."::update Error ".$this->error, LOG_ERR); $this->db->rollback(); return -$error; @@ -858,8 +850,7 @@ class Contact extends CommonObject dol_syslog($this->error, LOG_ERR); return 2; - } - elseif ($num) // $num = 1 + } elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -933,8 +924,7 @@ class Contact extends CommonObject $this->user_id = $uobj->rowid; } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -960,8 +950,7 @@ class Contact extends CommonObject $this->birthday_alert = 1; } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -976,13 +965,11 @@ class Contact extends CommonObject } return 1; - } - else { + } else { $this->error = $langs->trans("RecordNotFound"); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1003,8 +990,7 @@ class Contact extends CommonObject if (in_array($this->civility_id, array('MR')) || in_array($this->civility_code, array('MR'))) { $this->gender = 'man'; - } - elseif (in_array($this->civility_id, array('MME', 'MLE')) || in_array($this->civility_code, array('MME', 'MLE'))) + } elseif (in_array($this->civility_id, array('MME', 'MLE')) || in_array($this->civility_code, array('MME', 'MLE'))) { $this->gender = 'woman'; } @@ -1048,8 +1034,7 @@ class Contact extends CommonObject } $this->db->free($resql); return 0; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1104,8 +1089,7 @@ class Contact extends CommonObject $i++; } - } - else { + } else { $error++; $this->error = $this->db->error().' sql='.$sql; } @@ -1171,8 +1155,7 @@ class Contact extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_syslog("Error ".$this->error, LOG_ERR); return -1; @@ -1219,8 +1202,7 @@ class Contact extends CommonObject } $this->db->free($resql); - } - else { + } else { print $this->db->error(); } } @@ -1245,8 +1227,7 @@ class Contact extends CommonObject $this->db->free($resql); return $nb; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1507,8 +1488,7 @@ class Contact extends CommonObject { $this->db->rollback(); return -$error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1661,8 +1641,7 @@ class Contact extends CommonObject } return $tab; - } - else { + } else { $this->error = $this->db->error(); dol_print_error($this->db); return -1; diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php index ff3570e7e82..7655e00ea3f 100644 --- a/htdocs/contact/consumption.php +++ b/htdocs/contact/consumption.php @@ -178,8 +178,7 @@ if ($type_element == 'fichinter') $where = ' WHERE f.entity IN ('.getEntity('ficheinter').')'; $dateprint = 'f.datec'; $doc_number = 'f.ref'; -} -elseif ($type_element == 'invoice') +} elseif ($type_element == 'invoice') { // Customer : show products from invoices require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $documentstatic = new Facture($db); @@ -193,8 +192,7 @@ elseif ($type_element == 'invoice') $dateprint = 'f.datef'; $doc_number = 'f.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'propal') +} elseif ($type_element == 'propal') { require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; $documentstatic = new Propal($db); @@ -208,8 +206,7 @@ elseif ($type_element == 'propal') $datePrint = 'c.datep'; $doc_number = 'c.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'order') +} elseif ($type_element == 'order') { require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; $documentstatic = new Commande($db); @@ -223,8 +220,7 @@ elseif ($type_element == 'order') $dateprint = 'c.date_commande'; $doc_number = 'c.ref'; $thirdTypeSelect = 'customer'; -} -elseif ($type_element == 'supplier_invoice') +} elseif ($type_element == 'supplier_invoice') { // Supplier : Show products from invoices. require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $documentstatic = new FactureFournisseur($db); @@ -266,8 +262,7 @@ elseif ($type_element == 'supplier_order') $dateprint = 'c.date_valid'; $doc_number = 'c.ref'; $thirdTypeSelect = 'supplier'; -} -elseif ($type_element == 'contract') +} elseif ($type_element == 'contract') { // Order require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; $documentstatic = new Contrat($db); @@ -423,8 +418,7 @@ if ($sql_select) if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); - } - else { + } else { print $documentstatic->getLibStatut(2); } print ''; @@ -466,8 +460,7 @@ if ($sql_select) } $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else { + } else { $label = $objp->product_label; } @@ -499,27 +492,23 @@ if ($sql_select) $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); // Add date of deposit if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; - } - else { + } else { echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); } } - } - else { + } else { if ($objp->fk_product > 0) { echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); diff --git a/htdocs/contact/ldap.php b/htdocs/contact/ldap.php index 7934bbd5996..f601086ad05 100644 --- a/htdocs/contact/ldap.php +++ b/htdocs/contact/ldap.php @@ -67,8 +67,7 @@ if ($action == 'dolibarr2ldap') { setEventMessages($langs->trans("ContactSynchronized"), null, 'mesgs'); $db->commit(); - } - else { + } else { setEventMessages($ldap->error, $ldap->errors, 'errors'); $db->rollback(); } @@ -105,8 +104,7 @@ if ($object->socid > 0) $thirdparty->fetch($object->socid); print ''.$langs->trans("ThirdParty").''.$thirdparty->getNomUrl(1).''; -} -else { +} else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -181,19 +179,16 @@ if ($result > 0) if (!is_array($records)) { print ''.$langs->trans("ErrorFailedToReadLDAP").''; - } - else { + } else { $result = show_ldap_content($records, 0, $records['count'], true); } - } - else { + } else { print ''.$langs->trans("LDAPRecordNotFound").' (dn='.$dn.' - search='.$search.')'; } $ldap->unbind(); $ldap->close(); -} -else { +} else { setEventMessages($ldap->error, $ldap->errors, 'errors'); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index a6add5c7d75..fe80e709b28 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -123,14 +123,12 @@ if ($type == "c") if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactcustomerlist'; $titre .= ' ('.$langs->trans("ThirdPartyCustomers").')'; $urlfiche = "card.php"; -} -elseif ($type == "f") +} elseif ($type == "f") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactsupplierlist'; $titre .= ' ('.$langs->trans("ThirdPartySuppliers").')'; $urlfiche = "card.php"; -} -elseif ($type == "o") +} elseif ($type == "o") { if (empty($contextpage) || $contextpage == 'contactlist') $contextpage = 'contactotherlist'; $titre .= ' ('.$langs->trans("OthersNotLinkedToThirdParty").')'; @@ -326,8 +324,7 @@ if (!empty($userid)) // propre au commercial if ($search_priv != '0' && $search_priv != '1') { $sql .= " AND (p.priv='0' OR (p.priv='1' AND p.fk_user_creat=".$user->id."))"; -} -else { +} else { if ($search_priv == '0') $sql .= " AND p.priv='0'"; if ($search_priv == '1') $sql .= " AND (p.priv='1' AND p.fk_user_creat=".$user->id.")"; } @@ -375,16 +372,13 @@ if ($search_import_key) $sql .= natural_search("p.import_key", $sear if ($type == "o") // filtre sur type { $sql .= " AND p.fk_soc IS NULL"; -} -elseif ($type == "f") // filtre sur type +} elseif ($type == "f") // filtre sur type { $sql .= " AND s.fournisseur = 1"; -} -elseif ($type == "c") // filtre sur type +} elseif ($type == "c") // filtre sur type { $sql .= " AND s.client IN (1, 3)"; -} -elseif ($type == "p") // filtre sur type +} elseif ($type == "p") // filtre sur type { $sql .= " AND s.client IN (2, 3)"; } @@ -402,8 +396,7 @@ $sql .= $hookmanager->resPrint; if ($view == "recent") { $sql .= $db->order("p.datec", "DESC"); -} -else { +} else { $sql .= $db->order($sortfield, $sortorder); } @@ -920,8 +913,7 @@ while ($i < min($num, $limit)) $objsoc = new Societe($db); $objsoc->fetch($obj->socid); print $objsoc->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } diff --git a/htdocs/contact/perso.php b/htdocs/contact/perso.php index 5665030b6d5..a5a1714b6e5 100644 --- a/htdocs/contact/perso.php +++ b/htdocs/contact/perso.php @@ -85,18 +85,15 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- if (!dol_move_uploaded_file($_FILES['photo']['tmp_name'], $newfile, 1, 0, $_FILES['photo']['error']) > 0) { setEventMessages($langs->trans("ErrorFailedToSaveFile"), null, 'errors'); - } - else { + } else { // Create thumbs $object->addThumbs($newfile); } } - } - else { + } else { setEventMessages("ErrorBadImageFormat", null, 'errors'); } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -108,8 +105,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->societe->contact- break; } } - } - else { + } else { $error = $object->error; } } @@ -179,8 +175,7 @@ if ($action == 'edit') $objsoc->fetch($object->socid); print ''.$langs->trans("ThirdParty").''.$objsoc->getNomUrl(1).''; - } - else { + } else { print ''.$langs->trans("ThirdParty").''; print $langs->trans("ContactNotLinkedToCompany"); print ''; @@ -202,8 +197,7 @@ if ($action == 'edit') if (!empty($object->birthday_alert)) { print ''; - } - else { + } else { print ''; } print ''; @@ -219,8 +213,7 @@ if ($action == 'edit') print ''; print ""; -} -else { +} else { // View mode dol_fiche_head($head, 'perso', $title, -1, 'contact'); @@ -294,8 +287,7 @@ else { if ($object->birthday_alert) print $langs->trans("BirthdayAlertOn"); else print $langs->trans("BirthdayAlertOff"); print ''; - } - else { + } else { print ''.$langs->trans("DateToBirth").''; } print ""; diff --git a/htdocs/contrat/agenda.php b/htdocs/contrat/agenda.php index 36a9c950069..d016cb23d75 100644 --- a/htdocs/contrat/agenda.php +++ b/htdocs/contrat/agenda.php @@ -39,8 +39,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 7a2f8cf311f..c4f923a7372 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -112,13 +112,10 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) + } elseif ($action == 'confirm_closeline' && $confirm == 'yes' && $user->rights->contrat->activer) { if (!GETPOST('dateend')) { @@ -132,8 +129,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -301,13 +297,11 @@ if (empty($reshook)) } $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; - } - else { + } else { $label = $lines[$i]->product_label; } $desc = ($lines[$i]->desc && $lines[$i]->desc != $lines[$i]->libelle) ?dol_htmlentitiesbr($lines[$i]->desc) : ''; - } - else { + } else { $desc = dol_htmlentitiesbr($lines[$i]->desc); } @@ -352,8 +346,7 @@ if (empty($reshook)) } } } - } - else { + } else { setEventMessages($srcobject->error, $srcobject->errors, 'errors'); $error++; } @@ -364,28 +357,23 @@ if (empty($reshook)) // modified by hook if ($reshook < 0) $error++; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else { + } else { $result = $object->create($user); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } $action = 'create'; } } - } - - elseif ($action == 'classin' && $user->rights->contrat->creer) + } elseif ($action == 'classin' && $user->rights->contrat->creer) { $object->setProject(GETPOST('projectid')); } @@ -402,8 +390,7 @@ if (empty($reshook)) { $idprod = 0; $tva_tx = (GETPOST('tva_tx', 'alpha') ? GETPOST('tva_tx', 'alpha') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $tva_tx = ''; } @@ -474,8 +461,7 @@ if (empty($reshook)) $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]; - } - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; @@ -507,8 +493,7 @@ if (empty($reshook)) if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); - } - else { + } else { $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); } } @@ -518,8 +503,7 @@ if (empty($reshook)) else $desc = dol_concatdesc($desc, $product_desc, '', !empty($conf->global->MAIN_CHANGE_ORDER_CONCAT_DESCRIPTION)); $fk_unit = $prod->fk_unit; - } - else { + } else { $pu_ht = GETPOST('price_ht'); $price_base_type = 'HT'; $tva_tx = GETPOST('tva_tx') ?str_replace('*', '', GETPOST('tva_tx')) : 0; // tva_tx field may be disabled, so we use vat rate 0 @@ -545,8 +529,7 @@ if (empty($reshook)) { $object->error = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, -1, $conf->currency)); $result = -1; - } - else { + } else { // Insert line $result = $object->addline( $desc, @@ -619,14 +602,11 @@ if (empty($reshook)) unset($_POST['date_endday']); unset($_POST['date_endmonth']); unset($_POST['date_endyear']); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'updateline' && $user->rights->contrat->creer && !GETPOST('cancel', 'alpha')) { $error = 0; if (!empty($date_start_update) && !empty($date_end_update) && $date_start_update > $date_end_update) @@ -732,13 +712,10 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - - elseif ($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); @@ -746,13 +723,10 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) + } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->contrat->creer) { $result = $object->validate($user); @@ -774,13 +748,10 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'reopen' && $user->rights->contrat->creer) + } elseif ($action == 'reopen' && $user->rights->contrat->creer) { $result = $object->reopen($user); if ($result < 0) @@ -807,22 +778,17 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($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) { header("Location: list.php?restore_lastsearch_values=1"); return; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - - elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) + } elseif ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contrat->creer) { if (GETPOST('newcid') > 0) { @@ -834,16 +800,13 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); return; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("RefNewContract")), null, 'errors'); } - } - elseif ($action == 'update_extras') + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -863,8 +826,7 @@ if (empty($reshook)) if ($error) { $action = 'edit_extras'; } - } - elseif ($action == 'setref_supplier') + } elseif ($action == 'setref_supplier') { $cancelbutton = GETPOST('cancel', 'alpha'); if (!$cancelbutton) { @@ -878,13 +840,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setref_customer') + } elseif ($action == 'setref_customer') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -900,13 +860,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setref') + } elseif ($action == 'setref') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -940,13 +898,11 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - elseif ($action == 'setdate_contrat') + } elseif ($action == 'setdate_contrat') { $cancelbutton = GETPOST('cancel', 'alpha'); @@ -964,8 +920,7 @@ if (empty($reshook)) header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; } - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } @@ -996,14 +951,12 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1024,8 +977,7 @@ if (empty($reshook)) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -1037,8 +989,7 @@ if (empty($reshook)) if (!GETPOST('socid', 3)) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { $result = $object->createFromClone($user, $socid); if ($result > 0) { @@ -1098,8 +1049,7 @@ if ($action == 'create') if ($element == 'project') { $projectid = GETPOST('originid'); - } - else { + } else { // For compatibility if ($element == 'order' || $element == 'commande') { $element = $subelement = 'commande'; } if ($element == 'propal') { $element = 'comm/propal'; $subelement = 'propal'; } @@ -1126,8 +1076,7 @@ if ($action == 'create') // Object source contacts list $srccontactslist = $objectsrc->liste_contact(-1, 'external', 1); } - } - else { + } else { $projectid = GETPOST('projectid', 'int'); $note_private = GETPOST("note_private"); $note_public = GETPOST("note_public"); @@ -1173,8 +1122,7 @@ if ($action == 'create') print $soc->getNomUrl(1); print ''; print ''; - } - else { + } else { print ''; print $form->select_company('', 'socid', '', 'SelectThirdParty', 1, 0, null, 0, 'minwidth300'); print ' '.$langs->trans("AddThirdParty").''; @@ -1268,8 +1216,7 @@ if ($action == 'create') } print "\n"; -} -else /* *************************************************************************** */ +} else /* *************************************************************************** */ /* */ /* Mode vue et edition */ /* */ @@ -1575,8 +1522,7 @@ else /* ************************************************************************ echo $form->textwithtooltip($text, $description, 3, '', '', $cursorline, 0, (!empty($line->fk_parent_line) ?img_picto('', 'rightarrow') : '')); print ''; - } - else { + } else { print ''.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."\n"; } // VAT @@ -1597,8 +1543,7 @@ else /* ************************************************************************ if ($objp->remise_percent > 0) { print ''.$objp->remise_percent."%\n"; - } - else { + } else { print ' '; } @@ -1655,8 +1600,7 @@ else /* ************************************************************************ $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); } - } - else print $langs->trans("Unknown"); + } else print $langs->trans("Unknown"); print '  -  '; print $langs->trans("DateEndPlanned").': '; if ($objp->date_fin) @@ -1667,8 +1611,7 @@ else /* ************************************************************************ $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print " ".img_warning($textlate); } - } - else print $langs->trans("Unknown"); + } else print $langs->trans("Unknown"); print ''; print ''; @@ -1696,8 +1639,7 @@ else /* ************************************************************************ print $productstatic->getNomUrl(1, '', 32); print $objp->label ? ' - '.dol_trunc($objp->label, 32) : ''; print '
'; - } - else { + } else { print $objp->label ? $objp->label.'
' : ''; } @@ -1773,8 +1715,7 @@ else /* ************************************************************************ } $db->free($result); - } - else { + } else { dol_print_error($db); } @@ -1844,8 +1785,7 @@ else /* ************************************************************************ if (empty($dateactend)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("DateEndReal")), null, 'errors'); - } - else { + } else { print $form->formconfirm($_SERVER["PHP_SELF"]."?id=".$object->id."&ligne=".GETPOST('ligne', 'int')."&date=".$dateactstart."&dateend=".$dateactend."&comment=".urlencode($comment), $langs->trans("CloseService"), $langs->trans("ConfirmCloseService", dol_print_date($dateactend, "%A %d %B %Y")), "confirm_closeline", '', 0, 1); } print '
'; @@ -2121,8 +2061,7 @@ else /* ************************************************************************ if ($user->rights->contrat->activer) { print ''; - } - else { + } else { print ''; } } @@ -2131,8 +2070,7 @@ else /* ************************************************************************ if ($user->rights->contrat->desactiver) { print ''; - } - else { + } else { print ''; } @@ -2151,8 +2089,7 @@ else /* ************************************************************************ if (($user->rights->contrat->creer && $object->statut == 0) || $user->rights->contrat->supprimer) { print ''; - } - else { + } else { print ''; } } diff --git a/htdocs/contrat/class/api_contracts.class.php b/htdocs/contrat/class/api_contracts.class.php index 9caa33fca2d..ffe66208afe 100644 --- a/htdocs/contrat/class/api_contracts.class.php +++ b/htdocs/contrat/class/api_contracts.class.php @@ -169,8 +169,7 @@ class Contracts extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve contrat list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -464,8 +463,7 @@ class Contracts extends DolibarrApi $updateRes = $this->contract->deleteline($lineid, DolibarrApiAccess::$user); if ($updateRes > 0) { return $this->get($id); - } - else { + } else { throw new RestException(405, $this->contract->error); } } @@ -500,8 +498,7 @@ class Contracts extends DolibarrApi if ($this->contract->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->contract->error); } } diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 304628d97cc..a702847e23b 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -298,14 +298,12 @@ class Contrat extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; dol_print_error($db, get_class($this)."::getNextValue ".$obj->error); return ""; } - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Contract")); return ""; @@ -408,8 +406,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -464,8 +461,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -504,12 +500,10 @@ class Contrat extends CommonObject if ($force_number) { $num = $force_number; - } - elseif (!$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); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -586,8 +580,7 @@ class Contrat extends CommonObject $this->brouillon = 0; $this->date_validation = $now; } - } - else { + } else { $error++; } @@ -595,8 +588,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -659,8 +651,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -712,8 +703,7 @@ class Contrat extends CommonObject $this->error = 'Fetch found several records.'; dol_syslog($this->error, LOG_ERR); $result = -2; - } - elseif ($num) // $num = 1 + } elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); if ($obj) @@ -762,14 +752,12 @@ class Contrat extends CommonObject return $this->id; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Contract not found"); $this->error = "Contract not found"; return 0; } - } - else { + } else { dol_syslog(get_class($this)."::fetch Error searching contract"); $this->error = $this->db->error(); return -1; @@ -929,8 +917,7 @@ class Contrat extends CommonObject $pos++; } $this->db->free($result); - } - else { + } else { dol_syslog(get_class($this)."::Fetch Error when reading lines of contracts linked to products"); return -3; } @@ -1070,8 +1057,7 @@ class Contrat extends CommonObject $error++; } } - } - else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) + } else // Old behaviour, if linked_object has only one link per type, so is something like array('contract'=>id1)) { $origin_id = $tmp_origin_id; $ret = $this->add_object_linked($origin, $origin_id); @@ -1118,8 +1104,7 @@ class Contrat extends CommonObject //print $objcontact->code.'-'.$objcontact->source.'-'.$objcontact->fk_socpeople."\n"; $this->add_contact($objcontact->fk_socpeople, $objcontact->code, $objcontact->source); // May failed because of duplicate key or because code of contact type does not exists for new object } - } - else dol_print_error($resqlcontact); + } else dol_print_error($resqlcontact); } } @@ -1134,21 +1119,18 @@ class Contrat extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { dol_syslog(get_class($this)."::create - 30 - ".$this->error, LOG_ERR); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = "Failed to add contract"; dol_syslog(get_class($this)."::create - 20 - ".$this->error, LOG_ERR); $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $langs->trans("UnknownError: ".$this->db->error()." -", LOG_DEBUG); $this->db->rollback(); @@ -1317,8 +1299,7 @@ class Contrat extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1411,8 +1392,7 @@ class Contrat extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1489,8 +1469,7 @@ class Contrat extends CommonObject if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -1541,8 +1520,7 @@ class Contrat extends CommonObject if (($result = $this->defineBuyPrice($pu_ht, $remise_percent, $fk_product)) < 0) { return $result; - } - else { + } else { $pa_ht = $result; } } @@ -1613,19 +1591,16 @@ class Contrat extends CommonObject { $this->db->rollback(); return -1; - } - else { + } else { $this->db->commit(); return $contractlineid; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; } - } - else { + } else { dol_syslog(get_class($this)."::addline ErrorTryToAddLineOnValidatedContract", LOG_ERR); return -2; } @@ -1677,8 +1652,7 @@ class Contrat extends CommonObject { $remise = round(($pu * $remise_percent / 100), 2); $price = $pu - $remise; - } - else { + } else { $remise_percent = 0; } @@ -1728,8 +1702,7 @@ class Contrat extends CommonObject if (($result = $this->defineBuyPrice($pu, $remise_percent)) < 0) { return $result; - } - else { + } else { $pa_ht = $result; } } @@ -1752,14 +1725,10 @@ class Contrat extends CommonObject $sql .= ", total_ttc='".price2num($total_ttc)."'"; $sql .= ", fk_product_fournisseur_price=".($fk_fournprice > 0 ? $fk_fournprice : "null"); $sql .= ", buy_price_ht='".price2num($pa_ht)."'"; - if ($date_start > 0) { $sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; } - else { $sql .= ",date_ouverture_prevue=null"; } - if ($date_end > 0) { $sql .= ",date_fin_validite='".$this->db->idate($date_end)."'"; } - else { $sql .= ",date_fin_validite=null"; } - if ($date_debut_reel > 0) { $sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'"; } - else { $sql .= ",date_ouverture=null"; } - if ($date_fin_reel > 0) { $sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'"; } - else { $sql .= ",date_cloture=null"; } + if ($date_start > 0) { $sql .= ",date_ouverture_prevue='".$this->db->idate($date_start)."'"; } else { $sql .= ",date_ouverture_prevue=null"; } + if ($date_end > 0) { $sql .= ",date_fin_validite='".$this->db->idate($date_end)."'"; } else { $sql .= ",date_fin_validite=null"; } + if ($date_debut_reel > 0) { $sql .= ",date_ouverture='".$this->db->idate($date_debut_reel)."'"; } else { $sql .= ",date_ouverture=null"; } + if ($date_fin_reel > 0) { $sql .= ",date_cloture='".$this->db->idate($date_fin_reel)."'"; } else { $sql .= ",date_cloture=null"; } $sql .= ", fk_unit=".($fk_unit ? "'".$this->db->escape($fk_unit)."'" : "null"); $sql .= " WHERE rowid = ".$rowid; @@ -1802,14 +1771,12 @@ class Contrat extends CommonObject $this->db->commit(); return 1; } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::updateline Erreur -2"); return -2; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error(); dol_syslog(get_class($this)."::updateline Erreur -1"); @@ -1870,8 +1837,7 @@ class Contrat extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = 'ErrorDeleteLineNotAllowedByObjectStatus'; return -2; } @@ -1967,8 +1933,7 @@ class Contrat extends CommonObject $text .= ($mode != 7 || $this->nbofservicesclosed > 0) ? ($this->nbofservicesclosed.ContratLigne::LibStatut(5, 3, -1, 'class="marginleft2"')) : ''; $text .= ($mode == 7 ? '' : ''); return $text; - } - else { + } else { return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode); } } @@ -2086,8 +2051,7 @@ class Contrat extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2122,8 +2086,7 @@ class Contrat extends CommonObject $i++; } return $tab; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2159,8 +2122,7 @@ class Contrat extends CommonObject $i++; } return $tab; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2192,8 +2154,7 @@ class Contrat extends CommonObject $sql .= " WHERE c.statut = 1"; $sql .= " AND c.rowid = cd.fk_contrat"; $sql .= " AND cd.statut = 0"; - } - elseif ($mode == 'expired') + } elseif ($mode == 'expired') { $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql .= $this->from; @@ -2201,8 +2162,7 @@ class Contrat extends CommonObject $sql .= " AND c.rowid = cd.fk_contrat"; $sql .= " AND cd.statut = 4"; $sql .= " AND cd.date_fin_validite < '".$this->db->idate(dol_now())."'"; - } - elseif ($mode == 'active') + } elseif ($mode == 'active') { $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql .= $this->from; @@ -2228,8 +2188,7 @@ class Contrat extends CommonObject $label = $langs->trans("BoardNotActivatedServices"); $labelShort = $langs->trans("BoardNotActivatedServicesShort"); $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=0&sortfield=cd.date_fin_validite&sortorder=asc'; - } - elseif ($mode == 'expired') { + } elseif ($mode == 'expired') { $warning_delay = $conf->contrat->services->expires->warning_delay; $url = DOL_URL_ROOT.'/contrat/services_list.php?mainmenu=commercial&leftmenu=contracts&mode=4&filter=expired&sortfield=cd.date_fin_validite&sortorder=asc'; $label = $langs->trans("BoardExpiredServices"); @@ -2260,8 +2219,7 @@ class Contrat extends CommonObject } return $response; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2302,8 +2260,7 @@ class Contrat extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2759,11 +2716,7 @@ class ContratLigne extends CommonObjectLine global $langs; $langs->load("contracts"); - if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); } - elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); } - elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); } - elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); } - elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } + if ($status == self::STATUS_INITIAL) { $labelStatus = $langs->trans("ServiceStatusInitial"); $labelStatusShort = $langs->trans("ServiceStatusInitial"); } elseif ($status == self::STATUS_OPEN && $expired == -1) { $labelStatus = $langs->trans("ServiceStatusRunning"); $labelStatusShort = $langs->trans("ServiceStatusRunning"); } elseif ($status == self::STATUS_OPEN && $expired == 0) { $labelStatus = $langs->trans("ServiceStatusNotLate"); $labelStatusShort = $langs->trans("ServiceStatusNotLateShort"); } elseif ($status == self::STATUS_OPEN && $expired == 1) { $labelStatus = $langs->trans("ServiceStatusLate"); $labelStatusShort = $langs->trans("ServiceStatusLateShort"); } elseif ($status == self::STATUS_CLOSED) { $labelStatus = $langs->trans("ServiceStatusClosed"); $labelStatusShort = $langs->trans("ServiceStatusClosed"); } $statusType = 'status'.$status; if ($status == self::STATUS_OPEN && $expired == 1) $statusType = 'status1'; @@ -2927,8 +2880,7 @@ class ContratLigne extends CommonObjectLine $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -3013,8 +2965,7 @@ class ContratLigne extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -3161,8 +3112,7 @@ class ContratLigne extends CommonObjectLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -3243,8 +3193,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error()." sql=".$sql; return -1; @@ -3297,8 +3246,7 @@ class ContratLigne extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 250d89e3e88..02d9c71776d 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -70,8 +70,7 @@ if ($action == 'addcontact' && $user->rights->contrat->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $msg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); @@ -89,8 +88,7 @@ if ($action == 'swapstatut' && $user->rights->contrat->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db, $object->error); } } diff --git a/htdocs/contrat/document.php b/htdocs/contrat/document.php index e43db63826f..d60d54258bb 100644 --- a/htdocs/contrat/document.php +++ b/htdocs/contrat/document.php @@ -193,8 +193,7 @@ if ($object->id) $permtoedit = $user->rights->contrat->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/contrat/index.php b/htdocs/contrat/index.php index 4530d01a6af..40a9a4100da 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -140,8 +140,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } // Search by status (only expired) @@ -178,8 +177,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -296,14 +294,12 @@ if (!empty($conf->contrat->enabled) && $user->rights->contrat->lire) //$tot_ttc+=$obj->total_ttc; $i++; } - } - else { + } else { print ''.$langs->trans("NoContracts").''; } print "
"; $db->free($resql); - } - else { + } else { dol_print_error($db); } } @@ -379,8 +375,7 @@ if ($result) $db->free($result); print ""; -} -else { +} else { dol_print_error($db); } @@ -434,8 +429,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -456,8 +450,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } @@ -512,8 +505,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -533,8 +525,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } @@ -590,8 +581,7 @@ if ($resql) $productstatic->ref = $obj->pref; $productstatic->entity = $obj->pentity; print $productstatic->getNomUrl(1, '', 20); - } - else { + } else { print ''.img_object($langs->trans("ShowService"), "service"); if ($obj->label) print ' '.dol_trunc($obj->label, 20).''; else print ' '.dol_trunc($obj->note, 20); @@ -611,8 +601,7 @@ if ($resql) $db->free(); print ""; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 5053b703966..3627661c727 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -708,8 +708,7 @@ while ($i < min($num, $limit)) if ($nbofsalesrepresentative > 3) { // We print only number print $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; @@ -731,8 +730,7 @@ while ($i < min($num, $limit)) } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else { + } else { print ' '; } print ''; diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 62a853270e1..fd46b8eba98 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -102,8 +102,7 @@ if ($search_status != '') if ($tmp[1] == 'filter=notexpired') $filter = 'notexpired'; if ($tmp[1] == 'filter=expired') $filter = 'expired'; } -} -else { +} else { $search_status = $mode; if ($filter == 'expired') $search_status .= '&filter=expired'; if ($filter == 'notexpired') $search_status .= '&filter=notexpired'; @@ -595,8 +594,7 @@ while ($i < min($num, $limit)) print $productstatic->getNomUrl(1, '', 24); print $obj->label ? ' - '.dol_trunc($obj->label, 16) : ''; if (!empty($obj->description) && !empty($conf->global->PRODUCT_DESC_IN_LIST)) print '
'.dol_nl2br($obj->description); - } - else { + } else { if ($obj->type == 0) print img_object($obj->description, 'product').' '.dol_trunc($obj->description, 24); if ($obj->type == 1) print img_object($obj->description, 'service').' '.dol_trunc($obj->description, 24); } @@ -679,8 +677,7 @@ while ($i < min($num, $limit)) $warning_delay = $conf->contrat->services->expires->warning_delay / 3600 / 24; $textlate = $langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($warning_delay) >= 0 ? '+' : '').ceil($warning_delay).' '.$langs->trans("days"); print img_warning($textlate); - } - else print '    '; + } else print '    '; print ''; if (!$i) $totalarray['nbfield']++; } @@ -721,8 +718,7 @@ while ($i < min($num, $limit)) { // If contract is draft, we say line is also draft print $contractstatic->LibStatut(0, 5); - } - else { + } else { print $staticcontratligne->LibStatut($obj->statut, 5, ($obj->date_fin_validite && $db->jdate($obj->date_fin_validite) < $now) ? 1 : 0); } print ''; diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 2d6695ff6cb..f9f10f636ca 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -40,8 +40,7 @@ if ($cancel) { header("Location: ".$backtopageforcancel); exit; - } - elseif (!empty($backtopage)) + } elseif (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -57,8 +56,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { if ($object->fields[$key]['type'] == 'duration') { if (GETPOST($key.'hour') == '' && GETPOST($key.'min') == '') continue; // The field was not submited to be edited - } - else { + } else { if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited } // Ignore special fields @@ -106,15 +104,13 @@ if ($action == 'add' && !empty($permissiontoadd)) $urltogo = preg_replace('/--IDFORBACKTOPAGE--/', $object->id, $urltogo); // New method to autoselect project after a New on another form object creation header("Location: ".$urltogo); exit; - } - else { + } else { // Creation KO if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); $action = 'create'; } - } - else { + } else { $action = 'create'; } } @@ -127,15 +123,12 @@ if ($action == 'update' && !empty($permissiontoadd)) // Check if field was submited to be edited if ($object->fields[$key]['type'] == 'duration') { if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited - } - elseif ($object->fields[$key]['type'] == 'boolean') { + } elseif ($object->fields[$key]['type'] == 'boolean') { if (!GETPOSTISSET($key)) { $object->$key = 0; // use 0 instead null if the field is defined as not null continue; } - } - - else { + } else { if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited } // Ignore special fields @@ -178,14 +171,12 @@ if ($action == 'update' && !empty($permissiontoadd)) if ($result > 0) { $action = 'view'; - } - else { + } else { // Creation KO setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit'; } - } - else { + } else { $action = 'edit'; } } @@ -204,8 +195,7 @@ if ($action == "update_extras" && !empty($permissiontoadd)) { setEventMessages($langs->trans('RecordSaved'), null, 'mesgs'); $action = 'view'; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = 'edit_extras'; } @@ -227,8 +217,7 @@ if ($action == 'confirm_delete' && !empty($permissiontodelete)) setEventMessages("RecordDeleted", null, 'mesgs'); header("Location: ".$backurlforlist); exit; - } - else { + } else { if (!empty($object->errors)) setEventMessages(null, $object->errors, 'errors'); else setEventMessages($object->error, null, 'errors'); } @@ -263,8 +252,7 @@ if ($action == 'confirm_deleteline' && $confirm == 'yes' && !empty($permissionto setEventMessages($langs->trans('RecordDeleted'), null, 'mesgs'); header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -291,8 +279,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -319,8 +306,7 @@ if ($action == 'confirm_close' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -332,8 +318,7 @@ if ($action == 'confirm_setdraft' && $confirm == 'yes' && $permissiontoadd) if ($result >= 0) { // Nothing else done - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -360,8 +345,7 @@ if ($action == 'confirm_reopen' && $confirm == 'yes' && $permissiontoadd) $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -372,8 +356,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { $objectutil = dol_clone($object, 1); // To avoid to denaturate loaded object when setting some properties for clone or if createFromClone modifies the object. We use native clone to keep this->db valid. //$objectutil->date = dol_mktime(12, 0, 0, GETPOST('newdatemonth', 'int'), GETPOST('newdateday', 'int'), GETPOST('newdateyear', 'int')); // ... @@ -385,8 +368,7 @@ if ($action == 'confirm_clone' && $confirm == 'yes' && !empty($permissiontoadd)) else $newid = $result; header("Location: ".$_SERVER['PHP_SELF'].'?id='.$newid); // Open record of new object exit; - } - else { + } else { setEventMessages($objectutil->error, $objectutil->errors, 'errors'); $action = ''; } diff --git a/htdocs/core/actions_builddoc.inc.php b/htdocs/core/actions_builddoc.inc.php index f4b5f1fbb4c..eb51796eccd 100644 --- a/htdocs/core/actions_builddoc.inc.php +++ b/htdocs/core/actions_builddoc.inc.php @@ -37,8 +37,7 @@ if ($action == 'builddoc' && $permissiontoadd) if (is_numeric(GETPOST('model', 'alpha'))) { $error = $langs->trans("ErrorFieldRequired", $langs->transnoentities("Model")); - } - else { + } else { // Reload to get all modified line records and be ready for hooks $ret = $object->fetch($id); $ret = $object->fetch_thirdparty(); @@ -88,8 +87,7 @@ if ($action == 'builddoc' && $permissiontoadd) { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; - } - else { + } else { if (empty($donotredirect)) // This is set when include is done by bulk action "Bill Orders" { setEventMessages($langs->trans("FileGenerated"), null); @@ -132,8 +130,7 @@ if ($action == 'remove_file' && $permissiontoadd) header('Location: '.$urltoredirect); exit; - } - else { + } else { setEventMessages('BugFoundVarUploaddirnotDefined', null, 'errors'); } } diff --git a/htdocs/core/actions_comments.inc.php b/htdocs/core/actions_comments.inc.php index 3d18c2d7c24..c352f07f9f7 100644 --- a/htdocs/core/actions_comments.inc.php +++ b/htdocs/core/actions_comments.inc.php @@ -49,8 +49,7 @@ if ($action == 'addcomment') setEventMessages($langs->trans("CommentAdded"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } @@ -66,8 +65,7 @@ if ($action === 'updatecomment') setEventMessages($langs->trans("CommentAdded"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1#comment' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } @@ -82,8 +80,7 @@ if ($action == 'deletecomment') setEventMessages($langs->trans("CommentDeleted"), null, 'mesgs'); header('Location: '.$varpage.'?id='.$id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { setEventMessages($comment->error, $comment->errors, 'errors'); $action = ''; } diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index 5a044d7a464..46a6a31c202 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -122,8 +122,7 @@ if ($action == 'add') $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'create'; } - } - else { + } else { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); @@ -148,8 +147,7 @@ if ($action == 'add') { $params['options'] = array($parameters=>null); } - } - else { + } else { //Esle it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { @@ -189,22 +187,19 @@ if ($action == 'add') setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { $error++; $mesg = $extrafields->error; setEventMessages($mesg, null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialNorUpperCharacters", $langs->transnoentities("AttributeCode")); setEventMessages($mesg, null, 'errors'); $action = 'create'; } - } - else { + } else { setEventMessages($mesg, null, 'errors'); } } @@ -288,8 +283,7 @@ if ($action == 'update') $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); $action = 'edit'; } - } - else { + } else { $error++; $langs->load("errors"); $mesg[] = $langs->trans("ErrorBadFormatValueList", $param_ligne); @@ -313,8 +307,7 @@ if ($action == 'update') { $params['options'] = array($parameters=>null); } - } - else { + } else { //Esle it's separated key/value and coma list foreach ($parameters_array as $param_ligne) { @@ -354,21 +347,18 @@ if ($action == 'update') setEventMessages($langs->trans('SetupSaved'), null, 'mesgs'); header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { $error++; $mesg = $extrafields->error; setEventMessages($mesg, null, 'errors'); } - } - else { + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode")); setEventMessages($mesg, null, 'errors'); } - } - else { + } else { setEventMessages($mesg, null, 'errors'); } } @@ -384,10 +374,8 @@ if ($action == 'delete') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else $mesg = $extrafields->error; - } - else { + } else $mesg = $extrafields->error; + } else { $error++; $langs->load("errors"); $mesg = $langs->trans("ErrorFieldCanNotContainSpecialCharacters", $langs->transnoentities("AttributeCode")); diff --git a/htdocs/core/actions_fetchobject.inc.php b/htdocs/core/actions_fetchobject.inc.php index 6da2b0e674e..a77fc6e5ff6 100644 --- a/htdocs/core/actions_fetchobject.inc.php +++ b/htdocs/core/actions_fetchobject.inc.php @@ -37,16 +37,14 @@ if (($id > 0 || (!empty($ref) && !in_array($action, array('create', 'createtask' { $object->fetch_thirdparty(); $id = $object->id; - } - else { + } else { if (empty($object->error) && !count($object->errors)) { if ($ret < 0) // if $ret == 0, it means not found. { setEventMessages('Fetch on object (type '.get_class($object).') return an error without filling $object->error nor $object->errors', null, 'errors'); } - } - else setEventMessages($object->error, $object->errors, 'errors'); + } else setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } } diff --git a/htdocs/core/actions_linkedfiles.inc.php b/htdocs/core/actions_linkedfiles.inc.php index aeb86f9c609..ea55052f880 100644 --- a/htdocs/core/actions_linkedfiles.inc.php +++ b/htdocs/core/actions_linkedfiles.inc.php @@ -41,8 +41,7 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) $error++; if ($_FILES['userfile']['error'][$key] == 1 || $_FILES['userfile']['error'][$key] == 2) { setEventMessages($langs->trans('ErrorFileSizeTooLarge'), null, 'errors'); - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("File")), null, 'errors'); } } @@ -58,15 +57,13 @@ if (GETPOST('sendit', 'alpha') && !empty($conf->global->MAIN_UPLOAD_DOC)) if (!empty($upload_dirold) && !empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $result = dol_add_file_process($upload_dirold, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); - } - elseif (!empty($upload_dir)) + } elseif (!empty($upload_dir)) { $result = dol_add_file_process($upload_dir, $allowoverwrite, 1, 'userfile', GETPOST('savingdocmask', 'alpha'), null, '', $generatethumbs); } } } -} -elseif (GETPOST('linkit', 'none') && !empty($conf->global->MAIN_UPLOAD_DOC)) +} elseif (GETPOST('linkit', 'none') && !empty($conf->global->MAIN_UPLOAD_DOC)) { $link = GETPOST('link', 'alpha'); if ($link) @@ -86,8 +83,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if (GETPOST('section', 'alpha')) { // For a delete from the ECM module, upload_dir is ECM root dir and urlfile contains relative path from upload_dir $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; - } - else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. + } else // For a delete from the file manager into another module, or from documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. { $urlfile = basename($urlfile); $file = $upload_dir.(preg_match('/\/$/', $upload_dir) ? '' : '/').$urlfile; @@ -124,8 +120,7 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') } else { setEventMessages($langs->trans("ErrorFailToDeleteFile", $urlfile), null, 'errors'); } - } - elseif ($linkid) // delete of external link + } elseif ($linkid) // delete of external link { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $link = new Link($db); @@ -148,15 +143,13 @@ if ($action == 'confirm_deletefile' && $confirm == 'yes') if ($backtopage) { header('Location: '.$backtopage); exit; - } - else { + } else { $tmpurl = $_SERVER["PHP_SELF"].'?id='.$object->id.(GETPOST('section_dir', 'alpha') ? '§ion_dir='.urlencode(GETPOST('section_dir', 'alpha')) : '').(!empty($withproject) ? '&withproject=1' : ''); header('Location: '.$tmpurl); exit; } } -} -elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) +} elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST('link', 'alpha')) { require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php'; $langs->load('link'); @@ -175,12 +168,10 @@ elseif ($action == 'confirm_updateline' && GETPOST('save', 'alpha') && GETPOST(' { setEventMessages($langs->trans("ErrorFailedToUpdateLink", $link->label), null, 'mesgs'); } - } - else { + } else { //error fetching } -} -elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) +} elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) { // For documents pages, upload_dir contains already path to file from module dir, so we clean path into urlfile. if (!empty($upload_dir)) @@ -233,13 +224,11 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) } setEventMessages($langs->trans("FileRenamed"), null); - } - else { + } else { $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorFailToRenameFile", $filenamefrom, $filenameto), null, 'errors'); } - } - else { + } else { $langs->load("errors"); // key must be loaded because we can't rely on loading during output, we need var substitution to be done now. setEventMessages($langs->trans("ErrorDestinationAlreadyExists", $filenameto), null, 'errors'); } @@ -265,8 +254,7 @@ elseif ($action == 'renamefile' && GETPOST('renamefilesave', 'alpha')) require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; $ecmfile->share = getRandomPassword(true); } - } - else { + } else { $ecmfile->share = ''; } $result = $ecmfile->update($user); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 41660a47815..23c76ae81fb 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -180,8 +180,7 @@ if (!$error && $massaction == 'confirm_presend') 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 + } elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $sendtoid[] = $val; @@ -210,8 +209,7 @@ if (!$error && $massaction == 'confirm_presend') if ($val == 'thirdparty') // Id of third party { $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val) // Id du contact + } elseif ($val) // Id du contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); //$sendtoid[] = $val; TODO Add also id of contact in CC ? @@ -256,20 +254,17 @@ if (!$error && $massaction == 'confirm_presend') if ($objectobj->element == 'societe') { $sendto = $objectobj->email; - } - elseif ($objectobj->element == 'expensereport') + } elseif ($objectobj->element == 'expensereport') { $fuser = new User($db); $fuser->fetch($objectobj->fk_user_author); $sendto = $fuser->email; - } - elseif ($objectobj->element == 'holiday') + } elseif ($objectobj->element == 'holiday') { $fuser = new User($db); $fuser->fetch($objectobj->fk_user); $sendto = $fuser->email; - } - elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) + } elseif ($objectobj->element == 'facture' && !empty($listofobjectcontacts[$objectid])) { $emails_to_sends = array(); $objectobj->fetch_thirdparty(); @@ -283,8 +278,7 @@ if (!$error && $massaction == 'confirm_presend') if (count($emails_to_sends) > 0) { $sendto = implode(',', $emails_to_sends); } - } - else { + } else { $objectobj->fetch_thirdparty(); $sendto = $objectobj->thirdparty->email; } @@ -335,8 +329,7 @@ if (!$error && $massaction == 'confirm_presend') 'names'=>array($filename), 'mimes'=>array($mime) ); - } - else { + } else { $nbignored++; $langs->load("errors"); $resaction .= '
'.$langs->trans('ErrorCantReadFile', $file).'

'; @@ -362,19 +355,15 @@ if (!$error && $massaction == 'confirm_presend') $fromtype = GETPOST('fromtype'); if ($fromtype === 'user') { $from = $user->getFullName($langs).' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { + } elseif ($fromtype === 'company') { $from = $conf->global->MAIN_INFO_SOCIETE_NOM.' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + } 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)) { + } 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)) { + } 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); @@ -382,8 +371,7 @@ if (!$error && $massaction == 'confirm_presend') { $from = $obj->label.' <'.$obj->email.'>'; } - } - else { + } else { $from = $_POST['fromname'].' <'.$_POST['frommail'].'>'; } @@ -410,8 +398,7 @@ if (!$error && $massaction == 'confirm_presend') { $looparray[$key]->thirdparty = $thirdparty; // Force thirdparty on object } - } - else { + } else { $objectforloop = new $objectclass($db); $objectforloop->thirdparty = $thirdparty; // Force thirdparty on object (even if object was not loaded) $looparray[0] = $objectforloop; @@ -461,8 +448,7 @@ if (!$error && $massaction == 'confirm_presend') ); } } - } - elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])) { + } elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])) { // Create form object // if "one email per recipient" isn't check we must separate $attachedfiles by object $attachedfiles = $attachedfilesThirdpartyObj[$thirdparty->id][$objectid]; @@ -478,8 +464,7 @@ if (!$error && $massaction == 'confirm_presend') $trackid = 'thi'.$thirdparty->id; if ($objecttmp->element == 'expensereport') $trackid = 'use'.$thirdparty->id; if ($objecttmp->element == 'holiday') $trackid = 'use'.$thirdparty->id; - } - else { + } else { $trackid = strtolower(get_class($objecttmp)); if (get_class($objecttmp) == 'Contrat') $trackid = 'con'; if (get_class($objecttmp) == 'Propal') $trackid = 'pro'; @@ -503,8 +488,7 @@ if (!$error && $massaction == 'confirm_presend') if ($mailfile->error) { $resaction .= '
'.$mailfile->error.'
'; - } - else { + } else { $result = $mailfile->sendfile(); if ($result) { @@ -569,15 +553,13 @@ if (!$error && $massaction == 'confirm_presend') $nbsent++; // Nb of object sent } - } - else { + } else { $langs->load("other"); if ($mailfile->error) { $resaction .= $langs->trans('ErrorFailedToSendMail', $from, $sendto); $resaction .= '
'.$mailfile->error.'
'; - } - else { + } else { $resaction .= '
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; } } @@ -598,8 +580,7 @@ if (!$error && $massaction == 'confirm_presend') //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); setEventMessages($resaction, null, 'mesgs'); - } - else { + } else { //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file setEventMessages($resaction, null, 'warnings'); } @@ -714,14 +695,12 @@ if ($massaction == 'confirm_createbills') // Create bills from orders { $result = $objecttmp->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } - } - else { + } else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -779,8 +758,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders if ($result > 0) { $lineid = $result; - } - else { + } else { $lineid = 0; $error++; break; @@ -870,8 +848,7 @@ if ($massaction == 'confirm_createbills') // Create bills from orders header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); exit; - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -901,16 +878,14 @@ if (!$error && $massaction == 'cancelorders') setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); $error++; break; - } - else $result = $cmd->cancel(); + } else $result = $cmd->cancel(); if ($result < 0) { setEventMessages($cmd->error, $cmd->errors, 'errors'); $error++; break; - } - else $nbok++; + } else $nbok++; } if (!$error) { @@ -918,8 +893,7 @@ if (!$error && $massaction == 'cancelorders') setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -1020,12 +994,10 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } - } - else { + } else { // Create empty PDF $formatarray = pdf_getFormat(); $page_largeur = $formatarray['width']; @@ -1082,8 +1054,7 @@ if (!$error && $massaction == "builddoc" && $permissiontoread && !GETPOST('butto $langs->load("exports"); setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); } } @@ -1139,16 +1110,13 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); $error++; break; - } - elseif ($result < 0) + } elseif ($result < 0) { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1160,8 +1128,7 @@ if (!$error && $massaction == 'validate' && $permissiontoadd) if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -1183,8 +1150,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio $error++; break; } else $nbok++; - } - else { + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1196,8 +1162,7 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permissio setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -1244,10 +1209,8 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1259,8 +1222,7 @@ if (!$error && ($massaction == 'delete' || ($action == 'delete' && $confirm == ' if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } //var_dump($listofobjectthirdparties);exit; @@ -1304,10 +1266,8 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; - } - else $nbok++; - } - else { + } else $nbok++; + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -1319,8 +1279,7 @@ if (!$error && $massaction == 'generate_doc' && $permissiontoread) if ($nbok > 1) setEventMessages($langs->trans("RecordsGenerated", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordGenerated", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index e2da8a4170c..e88fc937e38 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -75,8 +75,7 @@ if ($action == 'print_file' && $user->rights->printing->read) { setEventMessages($printer->error, $printer->errors); setEventMessages($langs->transnoentitiesnoconv("FileWasSentToPrinter", basename(GETPOST('file', 'alpha'))).' '.$langs->transnoentitiesnoconv("ViaModule").' '.$printer->name, null); } - } - catch (Exception $e) + } catch (Exception $e) { $ret = 1; setEventMessages($e->getMessage(), null, 'errors'); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index df461e47a95..bc38d9839af 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -120,38 +120,32 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST if ($object->element == 'user' && $result == 0) $result = 1; // Even if not found, we consider ok $thirdparty = $object->thirdparty; $sendtosocid = $thirdparty->id; - } - elseif ($object->element == 'member' || $object->element == 'user') + } elseif ($object->element == 'member' || $object->element == 'user') { $thirdparty = $object; if ($object->socid > 0) $sendtosocid = $object->socid; - } - elseif ($object->element == 'expensereport') + } elseif ($object->element == 'expensereport') { $tmpuser = new User($db); $tmpuser->fetch($object->fk_user_author); $thirdparty = $tmpuser; if ($object->socid > 0) $sendtosocid = $object->socid; - } - elseif ($object->element == 'societe') + } elseif ($object->element == 'societe') { $thirdparty = $object; if ($thirdparty->id > 0) $sendtosocid = $thirdparty->id; - } - elseif ($object->element == 'contact') + } elseif ($object->element == 'contact') { $contact = $object; if ($contact->id > 0) $sendtosocid = $contact->fetch_thirdparty()->id; - } - else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported"); + } else dol_print_error('', "Use actions_sendmails.in.php for an element/object '".$object->element."' that is not supported"); if (is_object($hookmanager)) { $parameters = array(); $reshook = $hookmanager->executeHooks('initSendToSocid', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks } - } - else $thirdparty = $mysoc; + } else $thirdparty = $mysoc; if ($result > 0) { @@ -189,8 +183,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->getFullName($langs), ' ', array(",")).' <'.$contact->email.'>'; - } - elseif ($val) // $val is the Id of a contact + } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); $sendtoid[] = $val; @@ -239,8 +232,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST elseif ($val == 'contact') // Key selected means current contact { $tmparray[] = dol_string_nospecial($contact->name, ' ', array(",")).' <'.$contact->email.'>'; - } - elseif ($val) // $val is the Id of a contact + } elseif ($val) // $val is the Id of a contact { $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); //$sendtoid[] = $val; TODO Add also id of contact in CC ? @@ -277,22 +269,17 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $fromtype = GETPOST('fromtype', 'alpha'); if ($fromtype === 'robot') { $from = dol_string_nospecial($conf->global->MAIN_MAIL_EMAIL_FROM, ' ', array(",")).' <'.$conf->global->MAIN_MAIL_EMAIL_FROM.'>'; - } - elseif ($fromtype === 'user') { + } elseif ($fromtype === 'user') { $from = dol_string_nospecial($user->getFullName($langs), ' ', array(",")).' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { + } elseif ($fromtype === 'company') { $from = dol_string_nospecial($conf->global->MAIN_INFO_SOCIETE_NOM, ' ', array(",")).' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + } 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)) { + } 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)) { + } elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { $sql = 'SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile'; $sql .= ' WHERE rowid = '.(int) $reg[1]; $resql = $db->query($sql); @@ -301,8 +288,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST { $from = dol_string_nospecial($obj->label, ' ', array(",")).' <'.$obj->email.'>'; } - } - else { + } else { $from = dol_string_nospecial($_POST['fromname'], ' ', array(",")).' <'.$_POST['frommail'].'>'; } @@ -419,8 +405,7 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST { setEventMessages($mailfile->error, $mailfile->errors, 'errors'); $action = 'presend'; - } - else { + } else { $result = $mailfile->sendfile(); if ($result) { @@ -478,16 +463,14 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST if (isset($paramname2) || isset($paramval2)) $moreparam .= '&'.($paramname2 ? $paramname2 : 'mid').'='.$paramval2; header('Location: '.$_SERVER["PHP_SELF"].'?'.($paramname ? $paramname : 'id').'='.(is_object($object) ? $object->id : '').$moreparam); exit; - } - else { + } else { $langs->load("other"); $mesg = '
'; if ($mailfile->error) { $mesg .= $langs->transnoentities('ErrorFailedToSendMail', dol_escape_htmltag($from), dol_escape_htmltag($sendto)); $mesg .= '
'.$mailfile->error; - } - else { + } else { $mesg .= 'No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS'; } $mesg .= '
'; @@ -496,15 +479,13 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $action = 'presend'; } } - } - else { + } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("MailTo")), null, 'warnings'); dol_syslog('Try to send email with no recipient defined', LOG_WARNING); $action = 'presend'; } - } - else { + } else { $langs->load("other"); setEventMessages($langs->trans('ErrorFailedToReadObject', $object->element), null, 'errors'); dol_syslog('Failed to read data of object id='.$object->id.' element='.$object->element); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index ea407375e12..05be4a31d18 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -50,8 +50,7 @@ if ($action == 'update' && is_array($arrayofparameters)) { $db->commit(); if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); if (empty($nomessageinupdate)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); } @@ -110,8 +109,7 @@ if ($action == 'setModuleOptions') { $db->commit(); if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); if (empty($nomessageinsetmoduleoptions)) setEventMessages($langs->trans("SetupNotSaved"), null, 'errors'); } diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index d5cf3ae1b48..9fb743f1208 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -68,8 +68,7 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call //dol_print_error($db,$ecmdir->error); //exit; } -} -else // For no ajax call +} else // For no ajax call { $rootdirfordoc = $conf->ecm->dir_output; @@ -85,8 +84,7 @@ else // For no ajax call } $relativepath = $ecmdir->getRelativePath(); // Example 'mydir/' - } - elseif (GETPOST('section_dir')) + } elseif (GETPOST('section_dir')) { $relativepath = GETPOST('section_dir'); } @@ -258,8 +256,7 @@ if ($type == 'directory') if (!preg_match('/pageid=/', $param)) $param .= '&pageid='.urlencode(GETPOST('pageid', 'int')); //if (!preg_match('/backtopage=/',$param)) $param.='&backtopage='.urlencode($_SERVER["PHP_SELF"].'?file_manager=1&website='.$websitekey.'&pageid='.$pageid); } - } - else { + } else { $relativepath = $ecmdir->getRelativePath(); $upload_dir = $conf->ecm->dir_output.'/'.$relativepath; } @@ -268,8 +265,7 @@ if ($type == 'directory') if (($section === '0' || empty($section)) && ($module != 'medias')) { $filearray = array(); - } - else { + } else { $filearray = dol_dir_list($upload_dir, "files", 0, '', array('^\.', '(\.meta|_preview.*\.png)$', '^temp$', '^CVS$'), $sortfield, $sorting, 1); } @@ -279,13 +275,11 @@ if ($type == 'directory') if (isset($search_doc_ref) && $search_doc_ref != '') $param .= '&search_doc_ref='.$search_doc_ref; $textifempty = $langs->trans('NoFileFound'); - } - elseif ($section === '0') + } elseif ($section === '0') { if ($module == 'ecm') $textifempty = '
'.$langs->trans("DirNotSynchronizedSyncFirst").'

'; else $textifempty = $langs->trans('NoFileFound'); - } - else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection")); + } else $textifempty = ($showonrightsize == 'featurenotyetavailable' ? $langs->trans("FeatureNotYetAvailable") : $langs->trans("ECMSelectASection")); if ($module == 'medias') { @@ -293,8 +287,7 @@ if ($type == 'directory') $modulepart = 'medias'; $perm = ($user->rights->website->write || $user->rights->emailing->creer); $title = 'none'; - } - elseif ($module == 'ecm') // DMS/ECM -> manual structure + } elseif ($module == 'ecm') // DMS/ECM -> manual structure { if ($user->rights->ecm->read) { @@ -317,8 +310,7 @@ if ($type == 'directory') $perm = $user->rights->ecm->upload; $modulepart = 'ecm'; $title = ''; // Use default - } - else { + } else { $useinecm = 5; $modulepart = 'ecm'; $perm = $user->rights->ecm->upload; diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index f5ac3e2e422..620643da8f2 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -49,8 +49,7 @@ if (!isset($mode) || $mode != 'noajax') // For ajax call $preopened = GETPOST('preopened'); if ($selecteddir != '/') $selecteddir = preg_replace('/\/$/', '', $selecteddir); // We removed last '/' except if it is '/' -} -else // For no ajax call +} else // For no ajax call { //if (GETPOST('preopened')) { $_GET['dir'] = $_POST['dir'] = GETPOST('preopened'); } @@ -73,8 +72,7 @@ if ($modulepart == 'ecm') { $fullpathselecteddir = $conf->ecm->dir_output.'/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened = $conf->ecm->dir_output.'/'.($preopened != '/' ? $preopened : ''); -} -elseif ($modulepart == 'medias') +} elseif ($modulepart == 'medias') { $fullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($selecteddir != '/' ? $selecteddir : ''); $fullpathpreopened = $dolibarr_main_data_root.'/medias/'.($preopened != '/' ? $preopened : ''); @@ -95,8 +93,7 @@ if (preg_match('/\.\./', $fullpathselecteddir) || preg_match('/[<>|]/', $fullpat if ($modulepart == 'ecm') { if (!$user->rights->ecm->read) accessforbidden(); -} -elseif ($modulepart == 'medias') +} elseif ($modulepart == 'medias') { // Always allowed } @@ -471,8 +468,7 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, if ($modulepart == 'ecm') { $newfullpathselecteddir = $conf->ecm->dir_output.'/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); - } - elseif ($modulepart == 'medias') + } elseif ($modulepart == 'medias') { $newfullpathselecteddir = $dolibarr_main_data_root.'/medias/'.($val['fullrelativename'] != '/' ? $val['fullrelativename'] : ''); } @@ -486,7 +482,6 @@ function treeOutputForAbsoluteDir($sqltree, $selecteddir, $fullpathselecteddir, echo "\n"; } - } - else print "PermissionDenied"; + } else print "PermissionDenied"; } } diff --git a/htdocs/core/ajax/check_notifications.php b/htdocs/core/ajax/check_notifications.php index 674dab95842..98d7d00a8dc 100644 --- a/htdocs/core/ajax/check_notifications.php +++ b/htdocs/core/ajax/check_notifications.php @@ -60,8 +60,7 @@ if ($time >= $_SESSION['auto_check_events_not_before']) dol_syslog("We ask to check browser notification on a too large period. We fix this with current date."); $starttime = $time; } - } - else { + } else { $starttime = $time; } @@ -108,8 +107,7 @@ if ($time >= $_SESSION['auto_check_events_not_before']) $eventfound[] = $event; } - } - else { + } else { dol_syslog("Error sql = ".$db->lasterror(), LOG_ERR); } } diff --git a/htdocs/core/ajax/constantonoff.php b/htdocs/core/ajax/constantonoff.php index c7e5bbd8991..1ed8ca34076 100644 --- a/htdocs/core/ajax/constantonoff.php +++ b/htdocs/core/ajax/constantonoff.php @@ -57,8 +57,7 @@ if (!empty($action) && !empty($name)) if ($action == 'set') { dolibarr_set_const($db, $name, $value, 'chaine', 0, '', $entity); - } - elseif ($action == 'del') + } elseif ($action == 'del') { dolibarr_del_const($db, $name, $entity); } diff --git a/htdocs/core/ajax/extraparams.php b/htdocs/core/ajax/extraparams.php index a3db4505f70..803155ce784 100644 --- a/htdocs/core/ajax/extraparams.php +++ b/htdocs/core/ajax/extraparams.php @@ -51,20 +51,11 @@ if (!empty($id) && !empty($element) && !empty($htmlelement) && !empty($type)) $classpath = $subelement = $element; // For compatibility - if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } - 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'; } + if ($element == 'order' || $element == 'commande') { $classpath = $subelement = 'commande'; } 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'; } - elseif ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } - else $classname = ucfirst($subelement); + if ($element == 'order_supplier') { $classname = 'CommandeFournisseur'; } elseif ($element == 'invoice_supplier') { $classname = 'FactureFournisseur'; } else $classname = ucfirst($subelement); $object = new $classname($db); $object->fetch($id); diff --git a/htdocs/core/ajax/loadinplace.php b/htdocs/core/ajax/loadinplace.php index 742e22a5a9f..b1a72868312 100644 --- a/htdocs/core/ajax/loadinplace.php +++ b/htdocs/core/ajax/loadinplace.php @@ -62,8 +62,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e elseif ($element == 'order_supplier') { $element = 'fournisseur'; $subelement = 'commande'; - } - elseif ($element == 'invoice_supplier') { + } elseif ($element == 'invoice_supplier') { $element = 'fournisseur'; $subelement = 'facture'; } @@ -83,8 +82,7 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e { $ret = $form->$methodname(); if ($ret > 0) echo json_encode($form->$cachename); - } - elseif (!empty($ext_element)) + } elseif (!empty($ext_element)) { $module = $subelement = $ext_element; if (preg_match('/^([^_]+)_([^_]+)/i', $ext_element, $regs)) @@ -99,14 +97,12 @@ if (!empty($field) && !empty($element) && !empty($table_element) && !empty($fk_e $ret = $object->$methodname($fk_element); if ($ret > 0) echo json_encode($object->$cachename); } - } - else { + } else { $object = new GenericObject($db); $value = $object->$loadmethod($table_element, $fk_element, $field); echo $value; } - } - else { + } else { echo $langs->transnoentities('NotEnoughPermissions'); } } diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 6466df89a07..6c9f97bfbb0 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -58,11 +58,9 @@ print ''; $return .= ''; - } - else { + } else { $return .= ''; $return .= ''; } - } - else { + } else { $return .= ''; $return .= ''; } - } - else { + } else { if (empty($maxHeight) || $photo_vignette && $imgarray['height'] > $maxHeight) { $return .= ''; $return .= ''; - } - else { + } else { $return .= ''; $return .= ''; } @@ -7443,8 +7218,7 @@ abstract class CommonObject { $return .= ''; if (($nbphoto % $nbbyrow) == 0) $return .= ''; - } - elseif ($nbbyrow < 0) $return .= ''; + } elseif ($nbbyrow < 0) $return .= ''; } if (empty($size)) { // Format origine @@ -7533,8 +7307,7 @@ abstract class CommonObject { if (isset($info['type']) && ($info['type'] == 'duration')) return true; else return false; - } - else return false; + } else return false; } /** @@ -7549,8 +7322,7 @@ abstract class CommonObject { if (isset($info['type']) && ($info['type'] == 'int' || preg_match('/^integer/i', $info['type']))) return true; else return false; - } - else return false; + } else return false; } /** @@ -7654,12 +7426,10 @@ abstract class CommonObject if (empty($this->{$field})) { $queryarray[$field] = null; - } - else { + } else { $queryarray[$field] = $this->db->idate($this->{$field}); } - } - elseif ($this->isArray($info)) + } elseif ($this->isArray($info)) { if (!empty($this->{$field})) { if (!is_array($this->{$field})) { @@ -7669,14 +7439,12 @@ abstract class CommonObject } else { $queryarray[$field] = null; } - } - elseif ($this->isDuration($info)) + } elseif ($this->isDuration($info)) { // $this->{$field} may be null, '', 0, '0', 123, '123' if ($this->{$field} != '' || !empty($info['notnull'])) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 else $queryarray[$field] = null; - } - elseif ($this->isInt($info) || $this->isFloat($info)) + } elseif ($this->isInt($info) || $this->isFloat($info)) { if ($field == 'entity' && is_null($this->{$field})) $queryarray[$field] = $conf->entity; else { @@ -7684,11 +7452,9 @@ abstract class CommonObject if ($this->{$field} != '' || !empty($info['notnull'])) { if ($this->isInt($info)) $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 if ($this->isFloat($info)) $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 - } - else $queryarray[$field] = null; + } else $queryarray[$field] = null; } - } - else { + } else { $queryarray[$field] = $this->{$field}; } @@ -7713,8 +7479,7 @@ abstract class CommonObject { if (empty($obj->{$field}) || $obj->{$field} === '0000-00-00 00:00:00' || $obj->{$field} === '1000-01-01 00:00:00') $this->{$field} = 0; else $this->{$field} = strtotime($obj->{$field}); - } - elseif ($this->isArray($info)) + } elseif ($this->isArray($info)) { if (!empty($obj->{$field})) { $this->{$field} = @unserialize($obj->{$field}); @@ -7723,8 +7488,7 @@ abstract class CommonObject } else { $this->{$field} = array(); } - } - elseif ($this->isInt($info)) + } elseif ($this->isInt($info)) { if ($field == 'rowid') $this->id = (int) $obj->{$field}; else { @@ -7732,8 +7496,7 @@ abstract class CommonObject { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; - } - else { + } else { if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (int) $obj->{$field}; } else { @@ -7741,23 +7504,20 @@ abstract class CommonObject } } } - } - elseif ($this->isFloat($info)) + } elseif ($this->isFloat($info)) { if ($this->isForcedToNullIfZero($info)) { if (empty($obj->{$field})) $this->{$field} = null; else $this->{$field} = (double) $obj->{$field}; - } - else { + } else { if (!is_null($obj->{$field}) || (isset($info['notnull']) && $info['notnull'] == 1)) { $this->{$field} = (double) $obj->{$field}; } else { $this->{$field} = null; } } - } - else { + } else { $this->{$field} = $obj->{$field}; } } @@ -7970,12 +7730,10 @@ abstract class CommonObject { $this->setVarsFromFetchObj($obj); return $this->id; - } - else { + } else { return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; return -1; @@ -8023,8 +7781,7 @@ abstract class CommonObject } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; return -1; @@ -8151,8 +7908,7 @@ abstract class CommonObject return -1; } } - } - elseif (!empty($this->fk_element) && !empty($this->childtables)) // If object has childs linked with a foreign key field, we check all child tables. + } elseif (!empty($this->fk_element) && !empty($this->childtables)) // If object has childs linked with a foreign key field, we check all child tables. { $objectisused = $this->isObjectUsed($this->id); if (!empty($objectisused)) @@ -8318,8 +8074,7 @@ abstract class CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; diff --git a/htdocs/core/class/commonobjectline.class.php b/htdocs/core/class/commonobjectline.class.php index 9edbe27aae0..f92004120ff 100644 --- a/htdocs/core/class/commonobjectline.class.php +++ b/htdocs/core/class/commonobjectline.class.php @@ -82,8 +82,7 @@ abstract class CommonObjectLine extends CommonObject $label = $res[$label_type]; $this->db->free($resql); return $label; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR); return -1; diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 50330f26b17..6c832c4788d 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -175,8 +175,7 @@ abstract class CommonStickerGenerator $hauteur = abs($y1 - $y2); if ($length > $hauteur) { $Pointilles = ($length / $nbPointilles) / 2; // taille des pointilles - } - else { + } else { $Pointilles = ($hauteur / $nbPointilles) / 2; } for ($i = $x1; $i <= $x2; $i += $Pointilles + $Pointilles) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index e535a4f0ca4..4bcbf3e2e99 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -251,8 +251,7 @@ class Conf { try { date_default_timezone_set($this->global->MAIN_SERVER_TZ); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog("Error: Bad value for parameter MAIN_SERVER_TZ=".$this->global->MAIN_SERVER_TZ, LOG_ERR); } @@ -334,8 +333,7 @@ class Conf // For backward compatibility $this->$module->$dirname = $rootfordata."/".$name; - } - else { + } else { // For multicompany sharings $this->$module->$multidirname = array($this->entity => $rootfortemp."/".$name."/temp"); diff --git a/htdocs/core/class/coreobject.class.php b/htdocs/core/class/coreobject.class.php index 0b017022e41..caaeb706c32 100644 --- a/htdocs/core/class/coreobject.class.php +++ b/htdocs/core/class/coreobject.class.php @@ -74,8 +74,7 @@ class CoreObject extends CommonObject $this->is_clone = false; return true; - } - else { + } else { return false; } } @@ -92,8 +91,7 @@ class CoreObject extends CommonObject if (isset($this->fields[$field]) && method_exists($this, 'is_'.$type)) { return $this->{'is_'.$type}($this->fields[$field]); - } - else { + } else { return false; } } @@ -197,8 +195,7 @@ class CoreObject extends CommonObject $this->{$className}[] = $o; } - } - else { + } else { $this->errors[] = $this->db->lasterror(); } } @@ -253,8 +250,7 @@ class CoreObject extends CommonObject $result = $this->call_trigger(strtoupper($this->element).'_UPDATE', $user); if ($result < 0) $error++; else $this->saveChild($user); - } - else { + } else { $error++; $this->error = $this->db->lasterror(); $this->errors[] = $this->error; @@ -264,8 +260,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -292,8 +287,7 @@ class CoreObject extends CommonObject $result = $this->call_trigger(strtoupper($this->element).'_CREATE', $user); if ($result < 0) $error++; else $this->saveChild($user); - } - else { + } else { $error++; $this->error = $this->db->lasterror(); $this->errors[] = $this->error; @@ -303,8 +297,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -349,8 +342,7 @@ class CoreObject extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; $this->db->rollback(); @@ -386,8 +378,7 @@ class CoreObject extends CommonObject if (empty($date)) { $this->{$field} = 0; - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $this->{$field} = dol_stringtotime($date); } @@ -409,15 +400,12 @@ class CoreObject extends CommonObject if ($this->checkFieldType($key, 'date')) { $this->setDate($key, $value); - } - elseif ($this->checkFieldType($key, 'float')) + } elseif ($this->checkFieldType($key, 'float')) { $this->{$key} = (double) price2num($value); - } - elseif ($this->checkFieldType($key, 'int')) { + } elseif ($this->checkFieldType($key, 'int')) { $this->{$key} = (int) price2num($value); - } - else { + } else { $this->{$key} = dol_string_nohtmltag($value); } } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 9f49e77f35a..34ef707b674 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -132,8 +132,7 @@ class Cstate // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -175,8 +174,7 @@ class Cstate // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -262,8 +260,7 @@ class Cstate // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 8e567a552b2..07d3563088e 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -136,8 +136,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -184,8 +183,7 @@ class Ctypent // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -238,8 +236,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -277,8 +274,7 @@ class Ctypent // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 80ea8e2f0cc..ac7b07ea5a9 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -135,8 +135,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -194,8 +193,7 @@ class CUnits // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -234,14 +232,11 @@ class CUnits // extends CommonObject foreach ($filter as $key => $value) { if ($key == 't.rowid' || $key == 't.active' || $key == 't.scale') { $sqlwhere[] = $key.'='.(int) $value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 't.unit_type' || $key == 't.code' || $key == 't.short_label') { + } elseif ($key == 't.unit_type' || $key == 't.code' || $key == 't.short_label') { $sqlwhere[] = $key.' = \''.$this->db->escape($value).'\''; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -337,8 +332,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -376,8 +370,7 @@ class CUnits // extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -395,8 +388,7 @@ class CUnits // extends CommonObject if ($mode == 'short_label'){ return dol_getIdFromCode($this->db, $code, 'c_units', 'short_label', 'rowid'); - } - elseif ($mode == 'code'){ + } elseif ($mode == 'code'){ return dol_getIdFromCode($this->db, $code, 'c_units', 'code', 'rowid'); } diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 8cf13771d35..4cddc65d636 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -187,13 +187,11 @@ class DiscountAbsolute $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -262,8 +260,7 @@ class DiscountAbsolute { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."societe_remise_except"); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror().' - sql='.$sql; return -1; } @@ -300,8 +297,7 @@ class DiscountAbsolute $this->error = 'ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved'; return -2; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -327,8 +323,7 @@ class DiscountAbsolute $this->error = 'ErrorThisPartOrAnotherIsAlreadyUsedSoDiscountSerieCantBeRemoved'; return -2; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -363,14 +358,12 @@ class DiscountAbsolute { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - elseif ($this->fk_invoice_supplier_source) { + } elseif ($this->fk_invoice_supplier_source) { $sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn"; $sql .= " set paye=0, fk_statut=1"; $sql .= " WHERE (type = 2 or type = 3) AND rowid=".$this->fk_invoice_supplier_source; @@ -381,19 +374,16 @@ class DiscountAbsolute { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; } - } - else { + } else { $this->db->commit(); return 1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -449,8 +439,7 @@ class DiscountAbsolute $this->fk_facture = $rowidinvoice; } return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -480,8 +469,7 @@ class DiscountAbsolute if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->error(); return -3; } @@ -557,15 +545,13 @@ class DiscountAbsolute $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql .= ' AND f.type = 3'; - } - elseif ($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'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id; $sql .= ' AND f.type = 3'; - } - else { + } else { $this->error = get_class($this)."::getSumDepositsUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -577,8 +563,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency == 1) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -601,15 +586,13 @@ class DiscountAbsolute $sql .= ' FROM '.MAIN_DB_PREFIX.'societe_remise_except as rc, '.MAIN_DB_PREFIX.'facture as f'; $sql .= ' WHERE rc.fk_facture_source=f.rowid AND rc.fk_facture = '.$invoice->id; $sql .= ' AND f.type IN ('.$invoice::TYPE_STANDARD.', '.$invoice::TYPE_CREDIT_NOTE.', '.$invoice::TYPE_SITUATION.')'; // Find discount coming from credit note or excess received - } - elseif ($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'; $sql .= ' WHERE rc.fk_invoice_supplier_source=f.rowid AND rc.fk_invoice_supplier = '.$invoice->id; $sql .= ' AND f.type IN ('.$invoice::TYPE_STANDARD.', '.$invoice::TYPE_CREDIT_NOTE.')'; // Find discount coming from credit note or excess paid - } - else { + } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -621,8 +604,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency == 1) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -643,14 +625,12 @@ class DiscountAbsolute $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'; $sql .= ' WHERE rc.fk_facture IS NULL AND rc.fk_facture_source = '.$invoice->id; - } - elseif ($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'; $sql .= ' WHERE rc.fk_invoice_supplier IS NULL AND rc.fk_invoice_supplier_source = '.$invoice->id; - } - else { + } else { $this->error = get_class($this)."::getSumCreditNotesUsed was called with a bad object as a first parameter"; dol_print_error($this->error); return -1; @@ -662,8 +642,7 @@ class DiscountAbsolute $obj = $this->db->fetch_object($resql); if ($multicurrency) return $obj->multicurrency_amount; else return $obj->amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 743f2968289..2b148a96e8a 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -55,16 +55,14 @@ class DolGeoIP { require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } - } - elseif ($type == 'city') + } elseif ($type == 'city') { // geoip may have been already included with PEAR if ($geoipversion == '2' || ($geoipversion != 'php' && !function_exists('geoip_country_code_by_name'))) { require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } - } - else { print 'ErrorBadParameterInConstructor'; return 0; } + } else { print 'ErrorBadParameterInConstructor'; return 0; } // Here, function exists (embedded into PHP or exists because we made include) if (empty($type) || empty($datfile)) @@ -85,19 +83,16 @@ class DolGeoIP { try { $this->gi = new GeoIp2\Database\Reader($datfile); // '/usr/local/share/GeoIP/GeoIP2-City.mmdb' - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); dol_syslog('DolGeoIP '.$this->errorlabel, LOG_ERR); return 0; } - } - elseif (function_exists('geoip_open')) + } elseif (function_exists('geoip_open')) { $this->gi = geoip_open($datfile, GEOIP_STANDARD); - } - else { + } else { $this->gi = 'NOGI'; // We are using embedded php geoip functions //print 'function_exists(geoip_country_code_by_name))='.function_exists('geoip_country_code_by_name'); //print geoip_database_info(); @@ -125,8 +120,7 @@ class DolGeoIP { // geoip_country_code_by_addr does not exists return strtolower(geoip_country_code_by_name($ip)); - } - else { + } else { if (preg_match('/^[0-9]+.[0-9]+\.[0-9]+\.[0-9]+/', $ip)) { if ($geoipversion == '2') @@ -134,30 +128,25 @@ class DolGeoIP try { $record = $this->gi->country($ip); return strtolower($record->country->isoCode); - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { if (!function_exists('geoip_country_code_by_addr')) return strtolower(geoip_country_code_by_name($this->gi, $ip)); return strtolower(geoip_country_code_by_addr($this->gi, $ip)); } - } - else { + } else { if ($geoipversion == '2') { try { $record = $this->gi->country($ip); return strtolower($record->country->isoCode); - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { if (!function_exists('geoip_country_code_by_addr_v6')) return strtolower(geoip_country_code_by_name_v6($this->gi, $ip)); return strtolower(geoip_country_code_by_addr_v6($this->gi, $ip)); } @@ -188,13 +177,11 @@ class DolGeoIP try { $record = $this->gi->country($name); return $record->country->isoCode; - } - catch (Exception $e) { + } catch (Exception $e) { //return $e->getMessage(); return ''; } - } - else { + } else { return geoip_country_code_by_name($this->gi, $name); } } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index b840f767a97..4ca072897bb 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -472,12 +472,10 @@ class DolGraph { //print 'ee'.join(',',$theme_bgcoloronglet); $this->bgcolor = $theme_bgcoloronglet; - } - else { + } else { $this->bgcolor = $theme_bgcolor; } - } - else { + } else { $this->bgcolor = $bg_color; } } @@ -500,12 +498,10 @@ class DolGraph { //print 'ee'.join(',',$theme_bgcoloronglet); $this->bgcolorgrid = $theme_bgcoloronglet; - } - else { + } else { $this->bgcolorgrid = $theme_bgcolor; } - } - else { + } else { $this->bgcolorgrid = $bg_colorgrid; } } @@ -721,8 +717,7 @@ class DolGraph foreach ($values as $x => $y) { if (isset($y)) $serie[$i] .= 'd'.$i.'.push({"label":"'.dol_escape_js($legends[$x]).'", "data":'.$y.'});'."\n"; } - } - else { + } else { foreach ($values as $x => $y) { if (isset($y)) $serie[$i] .= 'd'.$i.'.push(['.$x.', '.$y.']);'."\n"; } @@ -753,8 +748,7 @@ class DolGraph if ($nblot < 0) { $this->stringtoshow .= ''."\n"; - } - else { + } else { while ($i < $nblot) { $this->stringtoshow .= ''."\n"; @@ -893,8 +887,7 @@ class DolGraph elseif ($i == $firstlot + 1) $align = 'center'; else $align = 'left'; $this->stringtoshow .= 'bars: { lineWidth: 1, show: true, align: "'.$align.'", barWidth: 0.45 }, '; - } - else $this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, '; + } else $this->stringtoshow.='bars: { lineWidth: 1, show: true, align: "'.($i==$firstlot?'center':'left').'", barWidth: 0.5 }, '; } if (isset($this->type[$i]) && ($this->type[$i] == 'lines' || $this->type[$i] == 'linesnopoint')) $this->stringtoshow .= 'lines: { show: true, fill: false }, points: { show: '.($this->type[$i] == 'linesnopoint' ? 'false' : 'true').' }, '; $this->stringtoshow .= 'color: "#'.$color.'", label: "'.(isset($this->Legend[$i]) ? dol_escape_js($this->Legend[$i]) : '').'", data: d'.$i.' }'; @@ -1051,8 +1044,7 @@ class DolGraph if ($nblot < 0) { $this->stringtoshow .= ''; - } - else { + } else { while ($i < $nblot) { //$this->stringtoshow .= ''."\n"; @@ -1095,8 +1087,7 @@ class DolGraph if (strpos($tmp, '-') !== false) { $foundnegativecolor++; $color = '#FFFFFF'; // If $val is '-123' - } - else $color = "#".$tmp; // If $val is '123' or '#123' + } else $color = "#".$tmp; // If $val is '123' or '#123' } $this->stringtoshow .= "'".$color."'"; $i++; diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index e390565748a..25a0d2a25c5 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -350,28 +350,23 @@ class EmailSenderProfile extends CommonObject { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); @@ -424,8 +419,7 @@ class EmailSenderProfile extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index cd6e3b42e0a..bffd23f05d2 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -173,8 +173,7 @@ class Events // extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."events"); return $this->id; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -259,8 +258,7 @@ class Events // extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 4157870972d..c82e877fa80 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -253,10 +253,8 @@ class ExtraFields $this->error = ''; $this->errno = 0; return 1; - } - else return -2; - } - else { + } else return -2; + } else { return -1; } } @@ -337,14 +335,12 @@ class ExtraFields $resql = $this->db->query($sql, 1, 'dml'); } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); return -1; } - } - else { + } else { return 0; } } @@ -398,12 +394,10 @@ class ExtraFields if (is_array($param) && count($param) > 0) { $params = serialize($param); - } - elseif (strlen($param) > 0) + } elseif (strlen($param) > 0) { $params = trim($param); - } - else { + } else { $params = ''; } @@ -461,8 +455,7 @@ class ExtraFields if ($this->db->query($sql)) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); return -1; @@ -522,8 +515,7 @@ class ExtraFields } return $result; - } - else { + } else { return 0; } } @@ -556,13 +548,11 @@ class ExtraFields if ($resql) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } - } - else { + } else { return 0; } } @@ -651,25 +641,21 @@ class ExtraFields if ($unique) { $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." ADD UNIQUE INDEX uk_".$table."_".$attrname." (".$attrname.")"; - } - else { + } else { $sql = "ALTER TABLE ".MAIN_DB_PREFIX.$table." DROP INDEX uk_".$table."_".$attrname; } dol_syslog(get_class($this).'::update', LOG_DEBUG); $resql = $this->db->query($sql, 1, 'dml'); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } - } - else { + } else { return 0; } } @@ -727,12 +713,10 @@ class ExtraFields if (is_array($param) && count($param) > 0) { $params = serialize($param); - } - elseif (strlen($param) > 0) + } elseif (strlen($param) > 0) { $params = trim($param); - } - else { + } else { $params = ''; } @@ -743,8 +727,7 @@ class ExtraFields $sql_del .= " WHERE name = '".$attrname."'"; $sql_del .= " AND entity IN (0, ".($entity === '' ? $conf->entity : $entity).")"; $sql_del .= " AND elementtype = '".$elementtype."'"; - } - else { + } else { // We want on all entities ($entities = '0'), we delete on all only (we keep setup specific to each entity) $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; $sql_del .= " WHERE name = '".$attrname."'"; @@ -809,14 +792,12 @@ class ExtraFields { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); dol_print_error($this->db); return -1; } - } - else { + } else { return 0; } } @@ -916,8 +897,7 @@ class ExtraFields } } if ($elementtype) $this->attributes[$elementtype]['loaded'] = 1; // If nothing found, we also save tag 'loaded' - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this)."::fetch_name_optionals_label ".$this->error, LOG_ERR); } @@ -974,8 +954,7 @@ class ExtraFields $totalizable = $this->attributes[$extrafieldsobjectkey]['totalizable'][$key]; $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } - else // Old usage + } else // Old usage { $label = $this->attribute_label[$key]; $type = $this->attribute_type[$key]; @@ -1003,37 +982,29 @@ class ExtraFields if ($type == 'date') { $morecss = 'minwidth100imp'; - } - elseif ($type == 'datetime' || $type == 'link') + } elseif ($type == 'datetime' || $type == 'link') { $morecss = 'minwidth200imp'; - } - elseif (in_array($type, array('int', 'integer', 'double', 'price'))) + } elseif (in_array($type, array('int', 'integer', 'double', 'price'))) { $morecss = 'maxwidth75'; - } - elseif ($type == 'password') + } elseif ($type == 'password') { $morecss = 'maxwidth100'; - } - elseif ($type == 'url') + } elseif ($type == 'url') { $morecss = 'minwidth400'; - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $morecss = ''; - } - else { + } else { if (round($size) < 12) { $morecss = 'minwidth100'; - } - elseif (round($size) <= 48) + } elseif (round($size) <= 48) { $morecss = 'minwidth200'; - } - else { + } else { $morecss = 'minwidth400'; } } @@ -1051,46 +1022,38 @@ class ExtraFields // TODO Must also support $moreparam $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); - } - elseif (in_array($type, array('int', 'integer'))) + } elseif (in_array($type, array('int', 'integer'))) { $tmp = explode(',', $size); $newsize = $tmp[0]; $out = ''; - } - elseif (preg_match('/varchar/', $type)) + } elseif (preg_match('/varchar/', $type)) { $out = ''; - } - elseif (in_array($type, array('mail', 'phone', 'url'))) + } elseif (in_array($type, array('mail', 'phone', 'url'))) { $out = ''; - } - elseif ($type == 'text') + } elseif ($type == 'text') { if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, false, ROWS_5, '90%'); $out = $doleditor->Create(1); - } - else { + } else { $out = ''; } - } - elseif ($type == 'html') + } elseif ($type == 'html') { if (!preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field { require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($keyprefix.$key.$keysuffix, $value, '', 200, 'dolibarr_notes', 'In', false, false, !empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_5, '90%'); $out = $doleditor->Create(1); - } - else { + } else { $out = ''; } - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { if (empty($mode)) { @@ -1101,26 +1064,22 @@ class ExtraFields $checked = ' value="1" '; } $out = ''; - } - else { + } else { $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); } - } - elseif ($type == 'price') + } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); } $out = ' '.$langs->getCurrencySymbol($conf->currency); - } - elseif ($type == 'double') + } elseif ($type == 'double') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. $value = price($value); } $out = ' '; - } - elseif ($type == 'select') + } elseif ($type == 'select') { $out = ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) @@ -1144,8 +1103,7 @@ class ExtraFields $out .= ''; } $out .= ''; - } - elseif ($type == 'sellist') + } elseif ($type == 'sellist') { $out = ''; if (!empty($conf->use_javascript_ajax) && !empty($conf->global->MAIN_EXTRAFIELDS_USE_SELECT2)) @@ -1304,13 +1262,11 @@ class ExtraFields } } $out .= ''; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); $out = $form->multiselectarray($keyprefix.$key.$keysuffix, (empty($param['options']) ?null:$param['options']), $value_arr, '', 0, '', 0, '100%'); - } - elseif ($type == 'radio') + } elseif ($type == 'radio') { $out = ''; foreach ($param['options'] as $keyopt => $val) @@ -1321,13 +1277,11 @@ class ExtraFields $out .= ($value == $keyopt ? 'checked' : ''); $out .= '/>
'; } - } - elseif ($type == 'chkbxlst') + } elseif ($type == 'chkbxlst') { if (is_array($value)) { $value_arr = $value; - } - else { + } else { $value_arr = explode(',', $value); } @@ -1525,14 +1479,12 @@ class ExtraFields $out = $form->multiselectarray($keyprefix.$key.$keysuffix, $data, $value_arr, '', 0, '', 0, '100%'); } } - } - elseif ($type == 'link') + } elseif ($type == 'link') { $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath' $showempty = (($required && $default != '') ? 0 : 1); $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss); - } - elseif ($type == 'password') + } elseif ($type == 'password') { // If prefix is 'search_', field is used as a filter, we use a common text field. $out = ''; // Hidden field to reduce impact of evil Google Chrome autopopulate bug. @@ -1580,8 +1532,7 @@ class ExtraFields $list = dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1); $help = $this->attributes[$extrafieldsobjectkey]['help'][$key]; $hidden = (empty($list) ? 1 : 0); // If $list empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) - } - else // Old usage + } else // Old usage { //dol_syslog("Warning: parameter 'extrafieldsobjectkey' is missing", LOG_WARNING); $label = $this->attribute_label[$key]; @@ -1608,17 +1559,14 @@ class ExtraFields { $showsize = 10; $value = dol_print_date($value, 'day'); - } - elseif ($type == 'datetime') + } elseif ($type == 'datetime') { $showsize = 19; $value = dol_print_date($value, 'dayhour'); - } - elseif ($type == 'int') + } elseif ($type == 'int') { $showsize = 10; - } - elseif ($type == 'double') + } elseif ($type == 'double') { if (!empty($value)) { //$value=price($value); @@ -1626,38 +1574,31 @@ class ExtraFields $number_decimals = $sizeparts[1]; $value = price($value, 0, $langs, 0, 0, $number_decimals, ''); } - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $checked = ''; if (!empty($value)) { $checked = ' checked '; } $value = ''; - } - elseif ($type == 'mail') + } elseif ($type == 'mail') { $value = dol_print_email($value, 0, 0, 0, 64, 1, 1); - } - elseif ($type == 'url') + } elseif ($type == 'url') { $value = dol_print_url($value, '_blank', 32, 1); - } - elseif ($type == 'phone') + } elseif ($type == 'phone') { $value = dol_print_phone($value, '', 0, 0, '', ' ', 'phone'); - } - elseif ($type == 'price') + } elseif ($type == 'price') { //$value = price($value, 0, $langs, 0, 0, -1, $conf->currency); if ($value || $value == '0') $value = price($value, 0, $langs, 0, 0, -1); - } - elseif ($type == 'select') + } elseif ($type == 'select') { if ($langfile && $param['options'][$value]) $value = $langs->trans($param['options'][$value]); else $value = $param['options'][$value]; - } - elseif ($type == 'sellist') + } elseif ($type == 'sellist') { $param_list = array_keys($param['options']); $InfoFieldList = explode(":", $param_list[0]); @@ -1718,8 +1659,7 @@ class ExtraFields $value .= $obj->$field_toshow.' '; } } - } - else { + } else { $translabel = ''; if (!empty($obj->{$InfoFieldList[1]})) { $translabel = $langs->trans($obj->{$InfoFieldList[1]}); @@ -1730,14 +1670,11 @@ class ExtraFields $value = $obj->{$InfoFieldList[1]}; } } - } - else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); - } - elseif ($type == 'radio') + } else dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); + } elseif ($type == 'radio') { $value = $param['options'][$value]; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $value_arr = explode(',', $value); $value = ''; @@ -1749,8 +1686,7 @@ class ExtraFields } } $value = '
    '.implode(' ', $toprint).'
'; - } - elseif ($type == 'chkbxlst') + } elseif ($type == 'chkbxlst') { $value_arr = explode(',', $value); @@ -1817,8 +1753,7 @@ class ExtraFields } else { dol_syslog(get_class($this).'::showOutputField error '.$this->db->lasterror(), LOG_WARNING); } - } - elseif ($type == 'link') + } elseif ($type == 'link') { $out = ''; @@ -1839,26 +1774,21 @@ class ExtraFields $object->fetch($value); $value = $object->getNomUrl(3); } - } - else { + } else { dol_syslog('Error bad setup of extrafield', LOG_WARNING); return 'Error bad setup of extrafield'; } } - } - elseif ($type == 'text') + } elseif ($type == 'text') { $value = dol_htmlentitiesbr($value); - } - elseif ($type == 'html') + } elseif ($type == 'html') { $value = dol_htmlentitiesbr($value); - } - elseif ($type == 'password') + } elseif ($type == 'password') { $value = dol_trunc(preg_replace('/./i', '*', $value), 8, 'right', 'UTF-8', 1); - } - else { + } else { $showsize = round($size); if ($showsize > 48) $showsize = 48; } @@ -1888,36 +1818,28 @@ class ExtraFields if ($type == 'date') { $align = "center"; - } - elseif ($type == 'datetime') + } elseif ($type == 'datetime') { $align = "center"; - } - elseif ($type == 'int') + } elseif ($type == 'int') { $align = "right"; - } - elseif ($type == 'price') + } elseif ($type == 'price') { $align = "right"; - } - elseif ($type == 'double') + } elseif ($type == 'double') { $align = "right"; - } - elseif ($type == 'boolean') + } elseif ($type == 'boolean') { $align = "center"; - } - elseif ($type == 'radio') + } elseif ($type == 'radio') { $align = "center"; - } - elseif ($type == 'checkbox') + } elseif ($type == 'checkbox') { $align = "center"; - } - elseif ($type == 'price') + } elseif ($type == 'price') { $align = "right"; } @@ -2040,14 +1962,12 @@ class ExtraFields // Clean parameters // TODO GMT date in memory must be GMT so we should add gm=true in parameters $value_key = dol_mktime(0, 0, 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]); - } - elseif (in_array($key_type, array('datetime'))) + } elseif (in_array($key_type, array('datetime'))) { // Clean parameters // 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"]); - } - elseif (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)) { @@ -2055,13 +1975,11 @@ class ExtraFields } else { $value_key = ''; } - } - elseif (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); - } - else { + } else { $value_key = GETPOST("options_".$key); if (in_array($key_type, array('link')) && $value_key == '-1') $value_key = ''; } @@ -2073,12 +1991,10 @@ class ExtraFields $langs->load('errors'); setEventMessages($langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors'); return -1; - } - else { + } else { return 1; } - } - else { + } else { return 0; } } @@ -2098,8 +2014,7 @@ class ExtraFields if (is_string($extrafieldsobjectkey) && is_array($this->attributes[$extrafieldsobjectkey]['label'])) { $extralabels = $this->attributes[$extrafieldsobjectkey]['label']; - } - else { + } else { $extralabels = $extrafieldsobjectkey; } @@ -2121,22 +2036,19 @@ class ExtraFields if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."year")) continue; // Value was not provided, we should not set it. // Clean parameters $value_key = dol_mktime(GETPOST($keysuffix."options_".$key.$keyprefix."hour", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."min", 'int'), 0, GETPOST($keysuffix."options_".$key.$keyprefix."month", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."day", 'int'), GETPOST($keysuffix."options_".$key.$keyprefix."year", 'int')); - } - elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) + } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $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); - } - elseif (in_array($key_type, array('price', 'double', 'int'))) + } elseif (in_array($key_type, array('price', 'double', 'int'))) { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); $value_key = price2num($value_arr); - } - else { + } else { if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) continue; // Value was not provided, we should not set it. $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); } diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index f549c7520f7..c941a3a0745 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -64,46 +64,36 @@ class FileUpload if ($element == 'propal') { $pathname = 'comm/propal'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'facture') { + } elseif ($element == 'facture') { $pathname = 'compta/facture'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'project') { + } elseif ($element == 'project') { $element = $pathname = 'projet'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'project_task') { + } elseif ($element == 'project_task') { $pathname = 'projet'; $filename = 'task'; $dir_output = $conf->projet->dir_output; $parentForeignKey = 'fk_project'; $parentClass = 'Project'; $parentElement = 'projet'; $parentObject = 'project'; - } - elseif ($element == 'fichinter') { + } elseif ($element == 'fichinter') { $element = 'ficheinter'; $dir_output = $conf->$element->dir_output; - } - elseif ($element == 'order_supplier') { + } elseif ($element == 'order_supplier') { $pathname = 'fourn'; $filename = 'fournisseur.commande'; $dir_output = $conf->fournisseur->commande->dir_output; - } - elseif ($element == 'invoice_supplier') { + } elseif ($element == 'invoice_supplier') { $pathname = 'fourn'; $filename = 'fournisseur.facture'; $dir_output = $conf->fournisseur->facture->dir_output; - } - elseif ($element == 'product') { + } elseif ($element == 'product') { $dir_output = $conf->product->multidir_output[$conf->entity]; - } - elseif ($element == 'productbatch') { + } elseif ($element == 'productbatch') { $dir_output = $conf->productbatch->multidir_output[$conf->entity]; - } - elseif ($element == 'action') { + } elseif ($element == 'action') { $pathname = 'comm/action'; $filename = 'actioncomm'; $dir_output = $conf->agenda->dir_output; - } - elseif ($element == 'chargesociales') { + } elseif ($element == 'chargesociales') { $pathname = 'compta/sociales'; $filename = 'chargesociales'; $dir_output = $conf->tax->dir_output; } else { @@ -298,8 +288,7 @@ class FileUpload if (preg_match('/error/i', $res)) return false; return true; - } - else { + } else { return false; } } @@ -450,8 +439,7 @@ class FileUpload } else { dol_move_uploaded_file($uploaded_file, $file_path, 1, 0, 0, 0, 'userfile'); } - } - else { + } else { // Non-multipart uploads (PUT method support) file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0); } @@ -467,8 +455,7 @@ class FileUpload $file->{$version.'_url'} = $options['upload_url'].rawurlencode($tmp[0].'_mini.'.$tmp[1]); } } - } - elseif ($this->options['discard_aborted_uploads']) + } elseif ($this->options['discard_aborted_uploads']) { unlink($file_path); $file->error = 'abort'; @@ -491,8 +478,7 @@ class FileUpload if ($file_name) { $info = $this->getFileObject($file_name); - } - else { + } else { $info = $this->getFileObjects(); } header('Content-type: application/json'); diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index a09d0bc3e30..0686b68115a 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -157,14 +157,12 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return $result; } - } - else { + } else { $this->error = $this->db->lasterror()." sql=".$sql; $this->db->rollback(); return -1; @@ -204,8 +202,7 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog($this->error, LOG_ERR); $this->db->rollback(); @@ -239,8 +236,7 @@ class Fiscalyear extends CommonObject $this->statut = $obj->statut; return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -264,8 +260,7 @@ class Fiscalyear extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -299,27 +294,22 @@ class Fiscalyear extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut4').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1 && !empty($this->statuts_short[$status])) return img_picto($langs->trans($this->statuts_short[$status]), 'statut8').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 0 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut4'); elseif ($status == 1 && !empty($this->statuts_short[$status])) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); @@ -364,8 +354,7 @@ class Fiscalyear extends CommonObject $this->date_modification = $this->db->jdate($obj->tms); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -396,8 +385,7 @@ class Fiscalyear extends CommonObject { $obj = $this->db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $nb; } @@ -428,8 +416,7 @@ class Fiscalyear extends CommonObject { $obj = $this->db->fetch_object($resql); $nb = $obj->nb; - } - else dol_print_error($this->db); + } else dol_print_error($this->db); return $nb; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 353102b6189..bfccd8e9b03 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -124,8 +124,7 @@ class Form } if ($fieldrequired) $ret .= ''; $ret .= ''."\n"; - } - else { + } else { if ($fieldrequired) $ret .= ''; if ($help) { $ret .= $this->textwithpicto($langs->trans($text), $help); @@ -134,8 +133,7 @@ class Form } if ($fieldrequired) $ret .= ''; } - } - else { + } else { if (empty($notabletag) && GETPOST('action', 'aZ09') != 'edit'.$htmlname && $perm) $ret .= '
'; if ($fieldrequired) $ret .= ''; if ($help) { @@ -188,8 +186,7 @@ class Form if (!empty($conf->global->MAIN_USE_JQUERY_JEDITABLE) && !preg_match('/^select;|datehourpicker/', $typeofdata)) // TODO add jquery timepicker and support select { $ret .= $this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $editvalue, $extObject, $custommsg); - } - else { + } else { if (GETPOST('action', 'aZ09') == 'edit'.$htmlname) { $ret .= "\n"; @@ -203,14 +200,12 @@ class Form { $tmp = explode(':', $typeofdata); $ret .= ''; - } - elseif (preg_match('/^(numeric|amount)/', $typeofdata)) + } elseif (preg_match('/^(numeric|amount)/', $typeofdata)) { $tmp = explode(':', $typeofdata); $valuetoshow = price2num($editvalue ? $editvalue : $value); $ret .= ''; - } - elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor' + } elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) // if wysiwyg is enabled $typeofdata = 'ckeditor' { $tmp = explode(':', $typeofdata); $cols = $tmp[2]; @@ -228,16 +223,13 @@ class Form $valuetoshow = str_replace('&', '&', $valuetoshow); $ret .= dol_string_neverthesehtmltags($valuetoshow, array('textarea')); $ret .= ''; - } - elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') + } elseif ($typeofdata == 'day' || $typeofdata == 'datepicker') { $ret .= $this->selectDate($value, $htmlname, 0, 0, 1, 'form'.$htmlname, 1, 0); - } - elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') + } elseif ($typeofdata == 'dayhour' || $typeofdata == 'datehourpicker') { $ret .= $this->selectDate($value, $htmlname, 1, 1, 1, 'form'.$htmlname, 1, 0); - } - elseif (preg_match('/^select;/', $typeofdata)) + } elseif (preg_match('/^select;/', $typeofdata)) { $arraydata = explode(',', preg_replace('/^select;/', '', $typeofdata)); $arraylist = array(); @@ -248,8 +240,7 @@ class Form $arraylist[$tmpkey] = $tmp[1]; } $ret .= $this->selectarray($htmlname, $arraylist, $value); - } - elseif (preg_match('/^ckeditor/', $typeofdata)) + } elseif (preg_match('/^ckeditor/', $typeofdata)) { $tmp = explode(':', $typeofdata); // Example: ckeditor:dolibarr_zzz:width:height:savemethod:toolbarstartexpanded:rows:cols:uselocalbrowser require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; @@ -267,8 +258,7 @@ class Form if (empty($notabletag)) $ret .= '
'."\n"; $ret .= ''."\n"; - } - else { + } else { if (preg_match('/^(email)/', $typeofdata)) $ret .= dol_print_email($value, 0, 0, 0, 0, 1); elseif (preg_match('/^(amount|numeric)/', $typeofdata)) $ret .= ($value != '' ? price($value, '', $langs, 0, -1, -1, $conf->currency) : ''); elseif (preg_match('/^text/', $typeofdata) || preg_match('/^note/', $typeofdata)) $ret .= dol_htmlentitiesbr($value); @@ -285,8 +275,7 @@ class Form $arraylist[$tmp[0]] = $tmp[1]; } $ret .= $arraylist[$value]; - } - elseif (preg_match('/^ckeditor/', $typeofdata)) + } elseif (preg_match('/^ckeditor/', $typeofdata)) { $tmpcontent = dol_htmlentitiesbr($value); if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) @@ -298,8 +287,7 @@ class Form // We dont use dol_escape_htmltag to get the html formating active, but this need we must also // clean data from some dangerous html $ret .= dol_string_onlythesehtmltags(dol_htmlentitiesbr($tmpcontent)); - } - else { + } else { $ret .= dol_escape_htmltag($value); } @@ -437,8 +425,7 @@ class Form if (!empty($tmp[1])) $inputOption = $tmp[1]; if (!empty($tmp[2])) $savemethod = $tmp[2]; $out .= ''."\n"; - } - elseif ((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]; @@ -446,22 +433,19 @@ class Form if (!empty($tmp[2])) $savemethod = $tmp[2]; $out .= ''."\n"; // Use for timestamp format - } - elseif (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; - } - elseif (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]); - } - elseif (preg_match('/^ckeditor/', $inputType)) + } elseif (preg_match('/^ckeditor/', $inputType)) { $tmp = explode(':', $inputType); $inputType = $tmp[0]; $toolbar = $tmp[1]; @@ -472,8 +456,7 @@ class Form if (!empty($conf->fckeditor->enabled)) { $out .= ''."\n"; - } - else { + } else { $inputType = 'textarea'; } } @@ -492,8 +475,7 @@ class Form $out .= ''."\n"; if (!empty($custommsg['error'])) $out .= ''."\n"; - } - else $out .= ''."\n"; + } else $out .= ''."\n"; } if ($inputType == 'textarea') { $out .= ''."\n"; @@ -501,8 +483,7 @@ class Form } $out .= ''.$value.''."\n"; $out .= ''.(!empty($editvalue) ? $editvalue : $value).''."\n"; - } - else { + } else { $out = $value; } @@ -550,8 +531,7 @@ class Form if ($tooltiptrigger == '') { $htmltext = str_replace('"', '"', $htmltext); - } - else { + } else { $classfortooltip = 'classfortooltiponclick'; $textfordialog .= ''; } @@ -560,15 +540,13 @@ class Form $paramfortooltipimg = ' class="'.$classfortooltip.($notabs != 3 ? ' inline-block' : '').($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'"'; if ($tooltiptrigger == '') $paramfortooltipimg .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on img tag to store tooltip else $paramfortooltipimg .= ' dolid="'.$tooltiptrigger.'"'; - } - else $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag + } else $paramfortooltipimg = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag if ($tooltipon == 1 || $tooltipon == 3) { $paramfortooltiptd = ' class="'.($tooltipon == 3 ? 'cursorpointer ' : '').$classfortooltip.' inline-block'.($extracss ? ' '.$extracss : '').'" style="padding: 0px;'.($extrastyle ? ' '.$extrastyle : '').'" '; if ($tooltiptrigger == '') $paramfortooltiptd .= ' title="'.($noencodehtmltext ? $htmltext : dol_escape_htmltag($htmltext, 1)).'"'; // Attribut to put on td tag to store tooltip else $paramfortooltiptd .= ' dolid="'.$tooltiptrigger.'"'; - } - else $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag + } else $paramfortooltiptd = ($extracss ? ' class="'.$extracss.'"' : '').($extrastyle ? ' style="'.$extrastyle.'"' : ''); // Attribut to put on td text tag if (empty($notabs)) $s .= ''; elseif ($notabs == 2) $s .= '
'; // Define value if value is before @@ -849,8 +827,7 @@ class Form { $foundselected = true; $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } @@ -1357,8 +1326,7 @@ class Form } } $out .= ''."\n"; - } - else { + } else { dol_print_error($this->db); } @@ -1438,8 +1406,7 @@ class Form } print ''; return $qualifiedlines; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1569,8 +1536,7 @@ class Form if ($showfunction && $obj->poste) $out .= ' ('.$obj->poste.')'; if (($showsoc > 0) && $obj->company) $out .= ' - ('.$obj->company.')'; $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { if (in_array($obj->rowid, $selected)) { $out .= $contactstatic->getFullName($langs); @@ -1591,8 +1556,7 @@ class Form } $i++; } - } - else { + } else { $out .= ''; @@ -1616,8 +1580,7 @@ class Form $this->num = $num; return $out; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -1691,8 +1654,7 @@ class Form { // Build list includeUsers to have only hierarchy $includeUsers = implode(",", $user->getAllChildIds(0)); - } - elseif ($include == 'hierarchyme') + } elseif ($include == 'hierarchyme') { // Build list includeUsers to have only hierarchy and current user $includeUsers = implode(",", $user->getAllChildIds(1)); @@ -1713,15 +1675,13 @@ class Form $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."entity as e ON e.rowid=u.entity"; if ($force_entity) $sql .= " WHERE u.entity IN (0,".$force_entity.")"; else $sql .= " WHERE u.entity IS NOT NULL"; - } - else { + } else { if (!empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug"; $sql .= " ON ug.fk_user = u.rowid"; $sql .= " WHERE ug.entity = ".$conf->entity; - } - else { + } else { $sql .= " WHERE u.entity IN (0,".$conf->entity.")"; } } @@ -1738,8 +1698,7 @@ class Form if (empty($conf->global->MAIN_FIRSTNAME_NAME_POSITION)) // MAIN_FIRSTNAME_NAME_POSITION is 0 means firstname+lastname { $sql .= " ORDER BY u.firstname ASC"; - } - else { + } else { $sql .= " ORDER BY u.lastname ASC"; } @@ -1778,8 +1737,7 @@ class Form $out .= ''; @@ -2397,8 +2342,7 @@ class Form array_push($outarray, $optJson); } } - } - else { + } else { if (!empty($conf->dynamicprices->enabled) && !empty($objp->fk_price_expression)) { $price_product = new Product($this->db); $price_product->fetch($objp->rowid, '', '', 1); @@ -2430,8 +2374,7 @@ class Form if (empty($outputmode)) return $out; return $outarray; - } - else { + } else { dol_print_error($db); } } @@ -2581,8 +2524,7 @@ class Form { $opt .= ' - '.price($objp2->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp2->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp2->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp2->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2591,8 +2533,7 @@ class Form $outpricebasetype = $objp2->price_base_type; $outtva_tx = $objp2->tva_tx; } - } - else { + } else { dol_print_error($this->db); } } @@ -2609,8 +2550,7 @@ class Form $outval .= ' - '.price($objp->unitprice, 0, $langs, 0, 0, -1, $conf->currency)."/"; $opt .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outval .= $langs->transnoentities("Unit"); - } - else { + } else { $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $opt .= $langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding @@ -2644,8 +2584,7 @@ class Form { $opt .= ' - '.price($objp->custprice, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp->custprice, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp->custprice_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp->custprice_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2664,8 +2603,7 @@ class Form { $opt .= ' - '.price($objp->price, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("HT"); $outval .= ' - '.price($objp->price, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("HT"); - } - else { + } else { $opt .= ' - '.price($objp->price_ttc, 1, $langs, 0, 0, -1, $conf->currency).' '.$langs->trans("TTC"); $outval .= ' - '.price($objp->price_ttc, 0, $langs, 0, 0, -1, $conf->currency).' '.$langs->transnoentities("TTC"); } @@ -2682,7 +2620,7 @@ class Form if ($objp->stock > 0) { $outval .= ' - '; - }elseif ($objp->stock <= 0) { + } elseif ($objp->stock <= 0) { $outval .= ' - '; } $outval .= $langs->transnoentities("Stock").':'.$objp->stock; @@ -2701,7 +2639,7 @@ class Form $outval .= ' - '.$langs->transnoentities("VirtualStock").':'; if ($virtualstock > 0) { $outval .= ' - '; - }elseif ($virtualstock <= 0) { + } elseif ($virtualstock <= 0) { $outval .= ' - '; } $outval .= $virtualstock; @@ -2753,8 +2691,7 @@ class Form $urloption = ($socid > 0 ? 'socid='.$socid.'&' : '').'htmlname='.$htmlname.'&outjson=1&price_level='.$price_level.'&type='.$filtertype.'&mode=2&status='.$status.'&finished='.$finished.'&alsoproductwithnosupplierprice='.$alsoproductwithnosupplierprice; print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); print ($hidelabel ? '' : $langs->trans("RefOrLabel").' : ').''; - } - else { + } else { print $this->select_produits_fournisseurs_list($socid, $selected, $htmlname, $filtertype, $filtre, '', -1, 0, 0, $alsoproductwithnosupplierprice, $morecss); } } @@ -2963,8 +2900,7 @@ class Form $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/"; $optlabel .= $langs->trans("Unit"); // Do not use strtolower because it breaks utf8 encoding $outvallabel .= $langs->transnoentities("Unit"); - } - else { + } else { $optlabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 1, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $outvallabel .= ' - '.price($objp->fprice * (!empty($conf->global->DISPLAY_DISCOUNTED_SUPPLIER_PRICE) ? (1 - $objp->remise_percent / 100) : 1), 0, $langs, 0, 0, -1, $conf->currency)."/".$objp->quantity; $optlabel .= ' '.$langs->trans("Units"); // Do not use strtolower because it breaks utf8 encoding @@ -2999,14 +2935,12 @@ class Form $optlabel .= " - ".$reputations[$objp->supplier_reputation]; $outvallabel .= " - ".$reputations[$objp->supplier_reputation]; } - } - else { + } else { if (empty($alsoproductwithnosupplierprice)) // No supplier price defined for couple product/supplier { $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").''; $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); - } - else // No supplier price defined for product, even on other suppliers + } else // No supplier price defined for product, even on other suppliers { $optlabel .= " - ".$langs->trans("NoPriceDefinedForThisSupplier").''; $outvallabel .= ' - '.$langs->transnoentities("NoPriceDefinedForThisSupplier"); @@ -3054,8 +2988,7 @@ class Form if (empty($outputmode)) return $out; return $outarray; - } - else { + } else { dol_print_error($this->db); } } @@ -3100,8 +3033,7 @@ class Form if (!$num) { $form .= ''; - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; $form .= ''; @@ -3144,8 +3076,7 @@ class Form if ($objp->quantity == 1) { $opt .= $langs->trans("Unit"); - } - else { + } else { $opt .= $langs->trans("Units"); } if ($objp->quantity > 1) @@ -3164,8 +3095,7 @@ class Form $form .= ''; $this->db->free($result); return $form; - } - else { + } else { dol_print_error($this->db); } } @@ -3206,8 +3136,7 @@ class Form if ($selected && $selected == $obj->rowid) { print ''; - } - else { + } else { print ''; } $i++; @@ -3215,8 +3144,7 @@ class Form } print ''; return $num; - } - else { + } else { dol_print_error($this->db); } } @@ -3263,8 +3191,7 @@ class Form //$this->cache_conditions_paiements=dol_sort_array($this->cache_conditions_paiements, 'label', 'asc', 0, 0, 1); // We use the field sortorder of table return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3311,8 +3238,7 @@ class Form $this->cache_availability = dol_sort_array($this->cache_availability, 'label', 'asc', 0, 0, 1); return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3342,8 +3268,7 @@ class Form if ($selected == $id) { print ''; @@ -3770,8 +3690,7 @@ class Form } } } - } - else { + } else { dol_syslog("Error sql=".$sql.", error=".$this->error, LOG_ERR); } if ($opt == '') @@ -3816,8 +3735,7 @@ class Form if ($selected == $res->rowid) { $return .= ''; - } - else { + } else { $return .= ''; } } @@ -3875,8 +3793,7 @@ class Form if ($selected == $obj->rowid) { print ''; @@ -4187,19 +4096,16 @@ class Form if ($input['type'] == 'text') { $more .= '
'.$input['label'].'
'."\n"; - } - elseif ($input['type'] == 'password') + } elseif ($input['type'] == 'password') { $more .= '
'.$input['label'].'
'."\n"; - } - elseif ($input['type'] == 'select') + } elseif ($input['type'] == 'select') { $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $this->selectarray($input['name'], $input['values'], $input['default'], 1, 0, 0, $moreattr, 0, 0, 0, '', $morecss); $more .= '
'."\n"; - } - elseif ($input['type'] == 'checkbox') + } elseif ($input['type'] == 'checkbox') { $more .= '
'; $more .= '
'.$input['label'].'
'; @@ -4209,8 +4115,7 @@ class Form if (isset($input['disabled'])) $more .= ' disabled'; $more .= ' />
'; $more .= '
'."\n"; - } - elseif ($input['type'] == 'radio') + } elseif ($input['type'] == 'radio') { $i = 0; foreach ($input['values'] as $selkey => $selval) @@ -4225,8 +4130,7 @@ class Form $more .= '
'."\n"; $i++; } - } - elseif ($input['type'] == 'date') + } elseif ($input['type'] == 'date') { $more .= '
'.$input['label'].'
'; $more .= '
'; @@ -4237,16 +4141,13 @@ class Form $formquestion[] = array('name'=>$input['name'].'year'); $formquestion[] = array('name'=>$input['name'].'hour'); $formquestion[] = array('name'=>$input['name'].'min'); - } - elseif ($input['type'] == 'other') + } elseif ($input['type'] == 'other') { $more .= '
'; if (!empty($input['label'])) $more .= $input['label'].'
'; $more .= $input['value']; $more .= '
'."\n"; - } - - elseif ($input['type'] == 'onecolumn') + } elseif ($input['type'] == 'onecolumn') { $moreonecolumn .= '
'; $moreonecolumn .= $input['value']; @@ -4371,8 +4272,7 @@ class Form }); '; $formconfirm .= "\n"; - } - else { + } else { $formconfirm .= "\n\n"; if (empty($disableformtag)) $formconfirm .= '
'."\n"; @@ -4455,16 +4355,14 @@ class Form $out .= $formproject->select_projects($socid, $selected, $htmlname, $maxlength, 0, 1, $discard_closed, $forcefocus, 0, 0, '', 1); $out .= ''; $out .= ''; - } - else { + } else { if ($selected) { $projet = new Project($this->db); $projet->fetch($selected); //print ''.$projet->title.''; $out .= $projet->getNomUrl(0, '', 1); - } - else { + } else { $out .= " "; } } @@ -4499,8 +4397,7 @@ class Form $this->select_conditions_paiements($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_conditions_paiements(); @@ -4533,8 +4430,7 @@ class Form $this->selectAvailabilityDelay($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_availability(); @@ -4566,8 +4462,7 @@ class Form $this->selectInputReason($selected, $htmlname, -1, $addempty); print ''; print ''; - } - else { + } else { if ($selected) { $this->loadCacheInputReason(); @@ -4616,8 +4511,7 @@ class Form $ret .= ''; $ret .= '
'; $ret .= '
'; - } - else { + } else { if ($displayhour) $ret .= dol_print_date($selected, 'dayhour'); else $ret .= dol_print_date($selected, 'day'); } @@ -4651,8 +4545,7 @@ class Form print $this->select_dolusers($selected, $htmlname, 1, $exclude, 0, $include); print ''; print ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; @@ -4690,8 +4583,7 @@ class Form $this->select_types_paiements($selected, $htmlname, $filtertype, 0, $addempty, 0, 0, $active); print ''; print ''; - } - else { + } else { if ($selected) { $this->load_cache_types_paiements(); @@ -4723,8 +4615,7 @@ class Form print $this->selectMultiCurrency($selected, $htmlname, 0); print ''; print ''; - } - else { + } else { dol_include_once('/core/lib/company.lib.php'); print !empty($selected) ? currency_name($selected, 1) : ' '; } @@ -4757,14 +4648,12 @@ class Form print ' '; print ''; print ''; - } - else { + } else { if (!empty($rate)) { print price($rate, 1, $langs, 1, 0); if ($currency && $rate != 1) print '   ('.price($rate, 1, $langs, 1, 0).' '.$currency.' = 1 '.$conf->currency.')'; - } - else { + } else { print 1; } } @@ -4802,8 +4691,7 @@ class Form { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL") $translationKey = 'HasAbsoluteDiscountFromSupplier'; // If we want deposit to be substracted to payments only and not to total of final invoice else $translationKey = 'HasCreditNoteFromSupplier'; - } - else { + } else { if (!$filter || $filter == "fk_invoice_supplier_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS PAID)%')") $translationKey = 'HasAbsoluteDiscountFromSupplier'; else $translationKey = 'HasCreditNoteFromSupplier'; } @@ -4812,8 +4700,7 @@ class Form { if (!$filter || $filter == "fk_facture_source IS NULL") $translationKey = 'CompanyHasAbsoluteDiscount'; // If we want deposit to be substracted to payments only and not to total of final invoice else $translationKey = 'CompanyHasCreditNote'; - } - else { + } else { if (!$filter || $filter == "fk_facture_source IS NULL OR (description LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%')") $translationKey = 'CompanyHasAbsoluteDiscount'; else $translationKey = 'CompanyHasCreditNote'; } @@ -4851,13 +4738,11 @@ class Form print ''; } print ''; - } - else { + } else { if ($selected) { print $selected; - } - else { + } else { print "0"; } } @@ -4895,8 +4780,7 @@ class Form print ''; print ''; print ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; @@ -4938,16 +4822,14 @@ class Form $out .= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); $out .= ''; $out .= ''; - } - else { + } else { if ($selected) { require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $soc = new Societe($this->db); $soc->fetch($selected); $out .= $soc->getNomUrl($langs); - } - else { + } else { $out .= " "; } } @@ -4995,16 +4877,14 @@ class Form if ($selected && $selected == $code_iso) { $out .= ''; @@ -5128,13 +5008,11 @@ class Form } return $num; - } - else { + } else { $this->error = ''.$langs->trans("ErrorNoVATRateDefinedForSellerCountry", $country_code).''; return -1; } - } - else { + } else { $this->error = ''.$this->db->error().''; return -2; } @@ -5189,8 +5067,7 @@ class Form if ($societe_vendeuse->id == $mysoc->id) { $return .= ''.$langs->trans("ErrorYourCountryIsNotDefined").''; - } - else { + } else { $return .= ''.$langs->trans("ErrorSupplierCountryIsNotDefined").''; } return $return; @@ -5205,8 +5082,7 @@ class Form if (is_object($societe_vendeuse)) { $code_country = "'".$societe_vendeuse->country_code."'"; - } - else { + } else { $code_country = "'".$mysoc->country_code."'"; // Pour compatibilite ascendente } if (!empty($conf->global->SERVICE_ARE_ECOMMERCE_200238EC)) // If option to have vat for end customer for services is on @@ -5221,12 +5097,10 @@ class Form { $code_country .= ",'".$societe_acheteuse->country_code."'"; } - } - elseif (!$idprod) // We don't know type of product + } elseif (!$idprod) // We don't know type of product { $code_country .= ",'".$societe_acheteuse->country_code."'"; - } - else { + } else { $prodstatic = new Product($this->db); $prodstatic->fetch($idprod); if ($prodstatic->type == Product::TYPE_SERVICE) // We know product is a service @@ -5300,8 +5174,7 @@ class Form $return .= ' selected'; $selectedfound = true; } - } - elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) + } elseif ($rate['txtva'] == $defaulttx && $rate['nprtva'] == $defaultnpr) { $return .= ' selected'; $selectedfound = true; @@ -5312,8 +5185,7 @@ class Form if ($mysoc->country_code == 'IN' || !empty($conf->global->MAIN_VAT_LABEL_IS_POSITIVE_RATES)) { $return .= $rate['labelpositiverates']; - } - else { + } else { $return .= vatrate($rate['label']); } //$return.=($rate['code']?' '.$rate['code']:''); @@ -5323,8 +5195,7 @@ class Form } if (!$options_only) $return .= ''; - } - else { + } else { $return .= $this->error; } @@ -5425,8 +5296,7 @@ class Form $sday = (!empty($reg[3]) ? $reg[3] : ''); $shour = (!empty($reg[4]) ? $reg[4] : ''); $smin = (!empty($reg[5]) ? $reg[5] : ''); - } - elseif (strval($set_time) != '' && $set_time != -1) + } elseif (strval($set_time) != '' && $set_time != -1) { // set_time est un timestamps (0 possible) $syear = dol_print_date($set_time, "%Y"); @@ -5437,14 +5307,12 @@ class Form $shour = dol_print_date($set_time, "%H"); $smin = dol_print_date($set_time, "%M"); $ssec = dol_print_date($set_time, "%S"); - } - else { + } else { $shour = ''; $smin = ''; $ssec = ''; } - } - else { + } else { // Date est '' ou vaut -1 $syear = ''; $smonth = ''; @@ -5491,14 +5359,12 @@ class Form $base = DOL_URL_ROOT.'/core/'; $retstring .= ' onClick="showDP(\''.$base.'\',\''.$prefix.'\',\''.$langs->trans("FormatDateShortJavaInput").'\',\''.$langs->defaultlang.'\');"'; $retstring .= '>'.img_object($langs->trans("SelectDate"), 'calendarday', 'class="datecallink"').''; - } - else $retstring .= ''; + } else $retstring .= ''; $retstring .= ''."\n"; $retstring .= ''."\n"; $retstring .= ''."\n"; - } - elseif ($usecalendar == 'jquery') + } elseif ($usecalendar == 'jquery') { if (!$disabled) { @@ -5551,8 +5417,7 @@ class Form $retstring.=' });'; $retstring.='});'; $retstring.="";*/ - } - else { + } else { $retstring .= ''; } @@ -5560,8 +5425,7 @@ class Form $retstring .= ''."\n"; $retstring .= ''."\n"; $retstring .= ''."\n"; - } - else { + } else { $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; } } @@ -5602,8 +5466,7 @@ class Form if ($emptydate || $set_time == -1) { $retstring .= ''; - } - else { + } else { $retstring .= ''; for ($year = $syear - 10; $year < $syear + 10; $year++) @@ -5678,8 +5541,7 @@ class Form $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(\''.dol_print_date(dol_now(), '%d', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'month\').val(\''.dol_print_date(dol_now(), '%m', 'tzuser').'\');'; $reset_scripts .= 'jQuery(\'#'.$prefix.'year\').val(\''.dol_print_date(dol_now(), '%Y', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'\').val(d.toLocaleDateString(\''.str_replace('_', '-', $langs->defaultlang).'\'));'; $reset_scripts .= 'jQuery(\'#'.$prefix.'day\').val(d.getDate().pad());'; @@ -5705,8 +5567,7 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(\''.dol_print_date(dol_now(), '%H', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'hour\').val(d.getHours().pad());'; } @@ -5721,8 +5582,7 @@ class Form if ($addnowlink == 1) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(\''.dol_print_date(dol_now(), '%M', 'tzuser').'\');'; - } - elseif ($addnowlink == 2) + } elseif ($addnowlink == 2) { $reset_scripts .= 'jQuery(\'#'.$prefix.'min\').val(d.getMinutes().pad());'; } @@ -5827,12 +5687,10 @@ class Form $retstring .= ">".$hour.""; } $retstring .= ""; - } - elseif ($typehour == 'text' || $typehour == 'textselect') + } elseif ($typehour == 'text' || $typehour == 'textselect') { $retstring .= ''; - } - else return 'BadValueForParameterTypeHour'; + } else return 'BadValueForParameterTypeHour'; if ($typehour != 'text') $retstring .= ' '.$langs->trans('HourShort'); else $retstring .= ':'; @@ -5851,8 +5709,7 @@ class Form $retstring .= '>'.$min.''; } $retstring .= ""; - } - elseif ($typehour == 'text') + } elseif ($typehour == 'text') { $retstring .= ''; } @@ -5947,8 +5804,7 @@ class Form $out .= ''; if ($placeholder) $placeholder = ' placeholder="'.$placeholder.'"'; $out .= ''; - } - else { + } else { // Immediate load of table record. Note: filter is inside $objecttmp->filter $out .= $this->selectForFormsList($objecttmp, $htmlname, $preselectedvalue, $showempty, $searchkey, $placeholder, $morecss, $moreparams, $forcecombo, 0, $disabled); } @@ -5976,8 +5832,7 @@ class Form if (preg_match('/^\'(.*)\'$/', $tmpescaped, $regbis)) { $tmpescaped = "'".$db->escape($regbis[1])."'"; - } - else { + } else { $tmpescaped = $db->escape($tmpescaped); } return $db->escape($tmp[0]).' '.strtoupper($db->escape($tmp[1]))." ".$tmpescaped; @@ -6019,8 +5874,7 @@ class Form if ($val['showoncombobox']) $tmpfieldstoshow .= ($tmpfieldstoshow ? ',' : '').'t.'.$key; } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; - } - else { + } else { // For backward compatibility $objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); } @@ -6029,8 +5883,7 @@ class Form { if (isset($objecttmp->fields['ref'])) { $fieldstoshow = 't.ref'; - } - else { + } else { $langs->load("errors"); $this->error = $langs->trans("ErrorNoFieldWithAttributeShowoncombobox"); return $langs->trans('ErrorNoFieldWithAttributeShowoncombobox'); @@ -6118,12 +5971,10 @@ class Form if ($preselectedvalue > 0 && $preselectedvalue == $obj->rowid) { $out .= ''; - } - else { + } else { $out .= ''; } - } - else { + } else { array_push($outarray, array('key'=>$obj->rowid, 'value'=>$label, 'label'=>$label)); } @@ -6133,8 +5984,7 @@ class Form } $out .= ''."\n"; - } - else { + } else { dol_print_error($this->db); } @@ -6240,8 +6090,7 @@ class Form { if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value)); else $selectOptionValue = $key.' - '.($maxlen ?dol_trunc($value, $maxlen) : $value); - } - else { + } else { if (empty($nohtmlescape)) $selectOptionValue = dol_escape_htmltag($maxlen ?dol_trunc($value, $maxlen) : $value); else $selectOptionValue = $maxlen ?dol_trunc($value, $maxlen) : $value; if ($value == '' || $value == '-') $selectOptionValue = ' '; @@ -6369,8 +6218,7 @@ class Form if ($acceptdelayedhtml) { $delayedhtmlcontent .= $outdelayed; - } - else { + } else { $out .= $outdelayed; } return $out; @@ -6486,8 +6334,7 @@ class Form if ($acceptdelayedhtml) { $delayedhtmlcontent .= $outdelayed; - } - else { + } else { $out .= $outdelayed; } return $out; @@ -6534,8 +6381,7 @@ class Form if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; - } - else { + } else { $out .= 'return record.text;'; } $out .= '};'."\n"; @@ -6543,8 +6389,7 @@ class Form if ($elemtype == 'category') { $out .= 'return \' \'+record.text+\'\';'; - } - else { + } else { $out .= 'return record.text;'; } $out .= '};'."\n"; @@ -6559,8 +6404,7 @@ class Form templateSelection: formatSelection /* For 4.0 */ }); });'."\n"; - } - elseif ($addjscombo == 2) + } elseif ($addjscombo == 2) { // Add other js lib // TODO external lib multiselect/jquery.multi-select.js must have been loaded to use this multiselect plugin @@ -6817,41 +6661,31 @@ class Form if ($objecttype == 'facture') { $tplpath = 'compta/'.$element; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'facturerec') { + } elseif ($objecttype == 'facturerec') { $tplpath = 'compta/facture'; $tplname = 'linkedobjectblockForRec'; if (empty($conf->facture->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'propal') { + } elseif ($objecttype == 'propal') { $tplpath = 'comm/'.$element; if (empty($conf->propal->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'supplier_proposal') { + } elseif ($objecttype == 'supplier_proposal') { if (empty($conf->supplier_proposal->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { + } elseif ($objecttype == 'shipping' || $objecttype == 'shipment') { $tplpath = 'expedition'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'reception') { + } elseif ($objecttype == 'reception') { $tplpath = 'reception'; if (empty($conf->reception->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'delivery') { + } elseif ($objecttype == 'delivery') { $tplpath = 'livraison'; if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled - } - elseif ($objecttype == 'invoice_supplier') { + } elseif ($objecttype == 'invoice_supplier') { $tplpath = 'fourn/facture'; - } - elseif ($objecttype == 'order_supplier') { + } elseif ($objecttype == 'order_supplier') { $tplpath = 'fourn/commande'; - } - elseif ($objecttype == 'expensereport') { + } elseif ($objecttype == 'expensereport') { $tplpath = 'expensereport'; - } - elseif ($objecttype == 'subscription') { + } elseif ($objecttype == 'subscription') { $tplpath = 'adherents'; } @@ -6959,8 +6793,7 @@ class Form { $possiblelinks = array_merge($possiblelinks, $hookmanager->resArray); } - } - elseif ($reshook > 0) + } elseif ($reshook > 0) { if (is_array($hookmanager->resArray) && count($hookmanager->resArray)) { @@ -7047,8 +6880,7 @@ class Form '; - } - else { + } else { $linktoelem = ''; } @@ -7098,8 +6930,7 @@ class Form { $resultyesno .= ''."\n"; $resultyesno .= ''."\n"; - } - else { + } else { $selected = (($useempty && $value != '0' && $value != 'no') ? '' : ' selected'); $resultyesno .= ''."\n"; $resultyesno .= ''."\n"; @@ -7142,8 +6973,7 @@ class Form if ($selected == $obj->rowid) { print ''; $i++; } - } - else { + } else { if ($show_empty) $out .= ''."\n"; $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($this->db); } @@ -7809,8 +7618,7 @@ class Form } } } - } - else { + } else { dol_print_error($db); } @@ -7844,8 +7652,7 @@ class Form $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($db); } @@ -7886,8 +7693,7 @@ class Form $out .= ''; } $out .= ''; - } - else { + } else { dol_print_error($db); } @@ -7983,8 +7789,7 @@ class Form if ($socid > 0 && (empty($obj->fk_soc) || $obj->fk_soc == $socid) && empty($usertofilter->rights->societe->lire)) { // Do nothing - } - else { + } else { if ($discard_closed == 1 && $obj->fk_statut == Project::STATUS_CLOSED) { $i++; @@ -8003,13 +7808,11 @@ class Form { $disabled = 1; $labeltoshow .= ' - '.$langs->trans("Draft"); - } - elseif ($obj->fk_statut == Project::STATUS_CLOSED) + } elseif ($obj->fk_statut == Project::STATUS_CLOSED) { if ($discard_closed == 2) $disabled = 1; $labeltoshow .= ' - '.$langs->trans("Closed"); - } - elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) + } elseif ($socid > 0 && (!empty($obj->fk_soc) && $obj->fk_soc != $socid)) { $disabled = 1; $labeltoshow .= ' - '.$langs->trans("LinkedToAnotherCompany"); @@ -8021,13 +7824,11 @@ class Form $out .= ''; - } - else { + } else { $out .= ''; } } @@ -183,8 +182,7 @@ class FormAdmin if ($file == $selected) { $menuarray[$prefix.'_'.$file] = ''; - } - else { + } else { $menuarray[$prefix.'_'.$file] = ''; } } @@ -383,8 +381,7 @@ class FormAdmin $i++; } - } - else { + } else { dol_print_error($this->db); return ''; } @@ -402,8 +399,7 @@ class FormAdmin if ($selected == $key) { $out .= ''; - } - else { + } else { $out .= ''; } } diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index 8c27666dfc4..104daf6de0e 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -176,8 +176,7 @@ class FormBarCode } $out .= ""; $out .= ajax_combobox("select_".$htmlname); - } - else { + } else { dol_print_error($this->db); } return $out; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index a5e31916827..f4e551c6452 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -166,8 +166,7 @@ class FormCompany extends Form } print Form::selectarray($htmlname, $options, $selected); - } - else dol_print_error($this->db); + } else dol_print_error($this->db); if (!empty($htmlname) && $user->admin) print ' '.info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; print ''; @@ -241,8 +240,7 @@ class FormCompany extends Form if ($obj->code == '0') // Le code peut etre une chaine { $out .= ''; - } - else { + } else { if (!$country || $country != $obj->country) { // Affiche la rupture si on est en mode liste multipays @@ -256,8 +254,7 @@ class FormCompany extends Form if (!empty($selected) && $selected == $obj->rowid) { $out .= ''; - } - else { + } else { if ($country == '' || $country != $obj->country) { // Show break @@ -354,8 +346,7 @@ class FormCompany extends Form if ($selected > 0 && $selected == $obj->code) { print ''; - } - else { + } else { print ''; } } @@ -363,8 +354,7 @@ class FormCompany extends Form } } print ''; - } - else { + } else { dol_print_error($this->db); } } @@ -405,8 +395,7 @@ class FormCompany extends Form if ($selected == $obj->code) { $out .= ''; $firstCompany = $obj->rowid; - } - else { + } else { print ''; @@ -695,8 +679,7 @@ class FormCompany extends Form print "\n"; print ajax_combobox($htmlname); return $firstCompany; - } - else { + } else { dol_print_error($this->db); return 0; } @@ -838,8 +821,7 @@ class FormCompany extends Form 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 } - } - elseif ($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 / @@ -902,8 +884,7 @@ class FormCompany extends Form if ($selected == $valors[$i]) { print ''; - } - else { + } else { $disabled = 0; if ($obj->statut == 0) { @@ -128,8 +126,7 @@ class FormContract if ($hideunselectables && $disabled) { $resultat = ''; - } - else { + } else { $resultat = '
\n"; @@ -331,8 +327,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (preg_match('/\.sql$/i', $file)) $filesindir[] = $file; } sort($filesindir); - } - else { + } else { print '
'.$langs->trans("ErrorCanNotReadDir", $dir).'
'; } @@ -342,8 +337,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (preg_match('/'.$from.'/i', $file)) { $filelist[] = $file; - } - elseif (preg_match('/'.$to.'/i', $file)) // First test may be false if we migrate from x.y.* to x.y.* + } elseif (preg_match('/'.$to.'/i', $file)) // First test may be false if we migrate from x.y.* to x.y.* { $filelist[] = $file; } @@ -352,8 +346,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if (count($filelist) == 0) { print '
'.$langs->trans("ErrorNoMigrationFilesFoundForParameters").'
'; - } - else { + } else { $listoffileprocessed = array(); // Protection to avoid to process twice the same file // Loop on each migrate files diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index b8e9ad30076..13e50732566 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -126,8 +126,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ $dolibarr_main_db_pass = preg_replace('/crypted:/i', '', $dolibarr_main_db_pass); $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_pass); $dolibarr_main_db_encrypted_pass = $dolibarr_main_db_pass; // We need to set this as it is used to know the password was initially crypted - } - else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); + } else $dolibarr_main_db_pass = dol_decode($dolibarr_main_db_encrypted_pass); } // $conf is already instancied inside inc.php @@ -157,8 +156,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ if ($db->database_selected) { dolibarr_install_syslog('upgrade2: database connection successful :'.$dolibarr_main_db_name); - } - else { + } else { $error++; } } @@ -533,15 +531,13 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ print $hookmanager->error; print ""; print ''; - } - else { + } else { print ''; print ''.$langs->trans('UpgradeExternalModule').': OK'; print ""; print ''; } - } - else { + } else { //if (! empty($conf->modules)) if (!empty($conf->modules_parts['hooks'])) // If there is at least one module with one hook, we show message to say nothing was done { @@ -580,8 +576,7 @@ if (!GETPOST('action', 'aZ09') || preg_match('/upgrade/i', GETPOST('action', 'aZ migrate_rename_directories($db, $langs, $conf, '/banque/bordereau', '/bank/checkdeposits'); print '

'.$langs->trans("MigrationFinished").'
'; -} -else { +} else { print '
'.$langs->trans('ErrorWrongParameters').'
'; $error++; } @@ -640,8 +635,7 @@ function migrate_paiements($db, $langs, $conf) $row[$i][2] = $obj->amount; $i++; } - } - else { + } else { dol_print_error($db); } @@ -671,17 +665,14 @@ function migrate_paiements($db, $langs, $conf) { $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; - } - else { + } else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } - } - else { + } else { print $langs->trans('MigrationPaymentsNothingToUpdate')."
\n"; } - } - else { + } else { print $langs->trans('MigrationPaymentsNothingToUpdate')."
\n"; } @@ -743,8 +734,7 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) } $i++; } - } - else { + } else { dol_print_error($db); } @@ -783,8 +773,7 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) print $langs->trans('MigrationProcessPaymentUpdate', 'facid='.$facid.'-paymentid='.$row[$i]['paymentid'].'-amount='.$row[$i]['pamount'])."
\n"; } - } - else { + } else { print 'ERROR'; } } @@ -792,18 +781,15 @@ function migrate_paiements_orphelins_1($db, $langs, $conf) if ($res > 0) { print $langs->trans('MigrationSuccessfullUpdate')."
"; - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } $db->commit(); - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -864,8 +850,7 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) } $i++; } - } - else { + } else { dol_print_error($db); } @@ -905,8 +890,7 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) print $langs->trans('MigrationProcessPaymentUpdate', 'facid='.$facid.'-paymentid='.$row[$i]['paymentid'].'-amount='.$row[$i]['pamount'])."
\n"; } - } - else { + } else { print 'ERROR'; $nberr++; } @@ -915,14 +899,12 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) if ($res > 0) { print $langs->trans('MigrationSuccessfullUpdate')."
"; - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } $db->commit(); - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -935,13 +917,11 @@ function migrate_paiements_orphelins_2($db, $langs, $conf) if (!$nberr) { $db->commit(); - } - else { + } else { print 'ERROR'; $db->rollback(); } - } - else { + } else { print $langs->trans('MigrationPaymentsNothingUpdatable')."
\n"; } @@ -1011,8 +991,7 @@ function migrate_contracts_det($db, $langs, $conf) if ($db->query($sql)) { print $langs->trans('MigrationContractsLineCreation', $obj->cref)."
\n"; - } - else { + } else { dol_print_error($db); $nberr++; } @@ -1025,17 +1004,14 @@ function migrate_contracts_det($db, $langs, $conf) // $db->rollback(); $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; - } - else { + } else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } - } - else { + } else { print $langs->trans('MigrationContractsNothingToUpdate')."
\n"; } - } - else { + } else { print $langs->trans('MigrationContractsFieldDontExist')."
\n"; // dol_print_error($db); } @@ -1108,17 +1084,14 @@ function migrate_links_transfert($db, $langs, $conf) // $db->rollback(); $db->commit(); print $langs->trans('MigrationSuccessfullUpdate')."
"; - } - else { + } else { $db->rollback(); print $langs->trans('MigrationUpdateFailed').'
'; } - } - else { + } else { print $langs->trans('MigrationBankTransfertsNothingToUpdate')."
\n"; } - } - else { + } else { dol_print_error($db); } @@ -1218,8 +1191,7 @@ function migrate_contracts_date2($db, $langs, $conf) print $langs->trans('MigrationContractsInvalidDatesNumber', $nbcontratsmodifie)."
\n"; else print $langs->trans('MigrationContractsInvalidDatesNothingToUpdate')."
\n"; } - } - else { + } else { dol_print_error($db); } @@ -1304,8 +1276,7 @@ function migrate_contracts_open($db, $langs, $conf) print $langs->trans('MigrationReopenedContractsNumber', $nbcontratsmodifie)."
\n"; else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; } - } - else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; + } else print $langs->trans('MigrationReopeningContractsNothingToUpdate')."
\n"; print ''; } @@ -1383,21 +1354,18 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf) { $nb++; print ''.$langs->trans("OK").''; - } - else { + } else { print 'Error on insert'; $error++; } print ''; } - } - else { + } else { $error++; } $i++; } - } - else { + } else { $error++; } @@ -1411,13 +1379,11 @@ function migrate_paiementfourn_facturefourn($db, $langs, $conf) $sql = "ALTER TABLE ".MAIN_DB_PREFIX."paiementfourn DROP COLUMN fk_facture_fourn"; $db->query($sql); - } - else { + } else { print ''.$langs->trans("Error").''; $db->rollback(); } - } - else { + } else { print ''.$langs->trans("AlreadyDone").''; } } @@ -1502,13 +1468,11 @@ function migrate_price_facture($db, $langs, $conf) if ($facture->update_price() > 0) { //print $facture->id; - } - else { + } else { print "Error id=".$facture->id; $err++; } - } - else { + } else { print "Error #3"; $err++; } @@ -1517,15 +1481,13 @@ function migrate_price_facture($db, $langs, $conf) $i++; } - } - else { + } else { print $langs->trans("AlreadyDone"); } $db->free($resql); $db->commit(); - } - else { + } else { print "Error #1 ".$db->error(); $err++; @@ -1623,16 +1585,14 @@ function migrate_price_propal($db, $langs, $conf) */ $i++; } - } - else { + } else { print $langs->trans("AlreadyDone"); } $db->free($resql); $db->commit(); - } - else { + } else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1710,16 +1670,14 @@ function migrate_price_contrat($db, $langs, $conf) $i++; } - } - else { + } else { print $langs->trans("AlreadyDone"); } $db->free($resql); $db->commit(); - } - else { + } else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1815,8 +1773,7 @@ function migrate_price_commande($db, $langs, $conf) */ $i++; } - } - else { + } else { print $langs->trans("AlreadyDone"); } @@ -1833,8 +1790,7 @@ function migrate_price_commande($db, $langs, $conf) */ $db->commit(); - } - else { + } else { print "Error #1 ".$db->error(); $db->rollback(); @@ -1930,8 +1886,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf) */ $i++; } - } - else { + } else { print $langs->trans("AlreadyDone"); } @@ -1948,8 +1903,7 @@ function migrate_price_commande_fournisseur($db, $langs, $conf) */ $db->commit(); - } - else { + } else { print "Error #1 ".$db->error(); $db->rollback(); @@ -2076,17 +2030,14 @@ function migrate_commande_expedition($db, $langs, $conf) $sql = "ALTER TABLE ".MAIN_DB_PREFIX."expedition DROP COLUMN fk_commande"; print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2149,8 +2100,7 @@ function migrate_commande_livraison($db, $langs, $conf) $error++; dol_print_error($db); } - } - else { + } else { $error++; dol_print_error($db); } @@ -2165,17 +2115,14 @@ function migrate_commande_livraison($db, $langs, $conf) $sql = "ALTER TABLE ".MAIN_DB_PREFIX."livraison DROP COLUMN fk_commande"; print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2253,13 +2200,11 @@ function migrate_detail_livraison($db, $langs, $conf) $error++; dol_print_error($db); } - } - else { + } else { $error++; dol_print_error($db); } - } - else { + } else { $error++; dol_print_error($db); } @@ -2274,17 +2219,14 @@ function migrate_detail_livraison($db, $langs, $conf) $sql = "ALTER TABLE ".MAIN_DB_PREFIX."livraisondet CHANGE fk_commande_ligne fk_origin_line integer"; print $langs->trans('FieldRenamed')."
\n"; $db->query($sql); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { $result = $db->DDLDescTable(MAIN_DB_PREFIX."livraisondet", "fk_origin_line"); $obj = $db->fetch_object($result); if (!$obj) @@ -2340,8 +2282,7 @@ function migrate_stocks($db, $langs, $conf) $resql2 = $db->query($sql); if ($resql2) { - } - else { + } else { $error++; dol_print_error($db); } @@ -2353,12 +2294,10 @@ function migrate_stocks($db, $langs, $conf) if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -2413,8 +2352,7 @@ function migrate_menus($db, $langs, $conf) $resql2 = $db->query($sql); if ($resql2) { - } - else { + } else { $error++; dol_print_error($db); } @@ -2426,17 +2364,14 @@ function migrate_menus($db, $langs, $conf) if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2498,25 +2433,21 @@ function migrate_commande_deliveryaddress($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2591,18 +2522,15 @@ function migrate_restore_missing_links($db, $langs, $conf) //print ". "; $i++; } - } - else print $langs->trans('AlreadyDone')."
\n"; + } else print $langs->trans('AlreadyDone')."
\n"; if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -2654,20 +2582,17 @@ function migrate_restore_missing_links($db, $langs, $conf) //print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -2748,21 +2673,17 @@ function migrate_project_user_resp($db, $langs, $conf) if ($db->query($sqlDrop)) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2836,21 +2757,17 @@ function migrate_project_task_actors($db, $langs, $conf) if ($db->query($sqlDrop)) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } print ''; @@ -2920,8 +2837,7 @@ function migrate_relationship_tables($db, $langs, $conf, $table, $fk_source, $so print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -2931,21 +2847,17 @@ function migrate_relationship_tables($db, $langs, $conf, $table, $fk_source, $so if ($db->query($sqlDrop)) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3013,8 +2925,7 @@ function migrate_project_task_time($db, $langs, $conf) $oldtime++; if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $newtime; else $totaltime[$obj->fk_task] = $newtime; - } - else { + } else { if (!empty($totaltime[$obj->fk_task])) $totaltime[$obj->fk_task] += $obj->task_duration; else $totaltime[$obj->fk_task] = $obj->task_duration; } @@ -3039,28 +2950,23 @@ function migrate_project_task_time($db, $langs, $conf) dol_print_error($db); } } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } - } - else { + } else { dol_print_error($db); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } - } - else { + } else { dol_print_error($db); } if ($error == 0) { $db->commit(); - } - else { + } else { $db->rollback(); } @@ -3132,31 +3038,26 @@ function migrate_customerorder_shipping($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if ($error == 0) { $db->commit(); - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3229,15 +3130,13 @@ function migrate_shipping_delivery($db, $langs, $conf) dol_print_error($db); } print ". "; - } - else { + } else { $error++; dol_print_error($db); } $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3251,18 +3150,15 @@ function migrate_shipping_delivery($db, $langs, $conf) // DDL commands must not be inside a transaction $sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."livraison DROP COLUMN fk_expedition"; $db->query($sqlDrop); - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3329,21 +3225,18 @@ function migrate_shipping_delivery2($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if ($error == 0) { $db->commit(); - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -3401,13 +3294,11 @@ function migrate_actioncomm_element($db, $langs, $conf) //$sqlDrop = "ALTER TABLE ".MAIN_DB_PREFIX."actioncomm DROP COLUMN ".$field; //$db->query($sqlDrop); //print ". "; - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } } @@ -3491,13 +3382,11 @@ function migrate_mode_reglement($db, $langs, $conf) if (!$error) { $db->commit(); - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -3580,15 +3469,13 @@ function migrate_clean_association($db, $langs, $conf) print ''.$langs->trans("MigrationCategorieAssociation").''; print ''.$langs->trans("RemoveDuplicates").' '.$langs->trans("Success").' ('.$num.'=>'.count($couples).')'; $db->commit(); - } - else { + } else { print ''.$langs->trans("MigrationCategorieAssociation").''; print ''.$langs->trans("RemoveDuplicates").' '.$langs->trans("Failed").''; $db->rollback(); } } - } - else { + } else { print ''.$langs->trans("Error").''; print '
'.$db->lasterror().'
'; } @@ -3648,8 +3535,7 @@ function migrate_categorie_association($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3669,17 +3555,14 @@ function migrate_categorie_association($db, $langs, $conf) */ $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } @@ -3738,20 +3621,17 @@ function migrate_event_assignement($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -3812,20 +3692,17 @@ function migrate_event_assignement_contact($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -3896,8 +3773,7 @@ function migrate_reset_blocked_log($db, $langs, $conf) { $error++; dol_print_error($db); - } - else { + } else { // Add set line $object = new stdClass(); $object->id = 1; @@ -3914,31 +3790,26 @@ function migrate_reset_blocked_log($db, $langs, $conf) $error++; } } - } - else { + } else { print ' - '.$langs->trans('AlreadyInV7').'
'; } - } - else { + } else { dol_print_error($db); } $i++; } - } - else { + } else { print $langs->trans('NothingToDo')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -4000,20 +3871,17 @@ function migrate_remise_entity($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -4065,15 +3933,13 @@ function migrate_remise_except_entity($db, $langs, $conf) $sqlSelect2 = "SELECT f.entity"; $sqlSelect2 .= " FROM ".MAIN_DB_PREFIX."facture as f"; $sqlSelect2 .= " WHERE f.rowid = ".$fk_facture; - } - elseif (!empty($obj->fk_facture_line)) + } elseif (!empty($obj->fk_facture_line)) { $sqlSelect2 = "SELECT f.entity"; $sqlSelect2 .= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."facturedet as fd"; $sqlSelect2 .= " WHERE fd.rowid = ".$obj->fk_facture_line; $sqlSelect2 .= " AND fd.fk_facture = f.rowid"; - } - else { + } else { $sqlSelect2 = "SELECT s.entity"; $sqlSelect2 .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sqlSelect2 .= " WHERE s.rowid = ".$obj->fk_soc; @@ -4097,8 +3963,7 @@ function migrate_remise_except_entity($db, $langs, $conf) dol_print_error($db); } } - } - else { + } else { $error++; dol_print_error($db); } @@ -4106,20 +3971,17 @@ function migrate_remise_except_entity($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -4179,20 +4041,17 @@ function migrate_user_rights_entity($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -4252,20 +4111,17 @@ function migrate_usergroup_rights_entity($db, $langs, $conf) print ". "; $i++; } - } - else { + } else { print $langs->trans('AlreadyDone')."
\n"; } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { dol_print_error($db); $db->rollback(); } @@ -4448,8 +4304,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_API') + } elseif ($moduletoreload == 'MAIN_MODULE_API') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Rest API module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modApi.class.php'; @@ -4458,8 +4313,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_BARCODE') + } elseif ($moduletoreload == 'MAIN_MODULE_BARCODE') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Barcode module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modBarcode.class.php'; @@ -4468,8 +4322,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_CRON') + } elseif ($moduletoreload == 'MAIN_MODULE_CRON') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modCron.class.php'; @@ -4478,8 +4331,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_SOCIETE') + } elseif ($moduletoreload == 'MAIN_MODULE_SOCIETE') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Societe module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modSociete.class.php'; @@ -4488,8 +4340,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_PRODUIT') // Permission has changed into 2.7 + } elseif ($moduletoreload == 'MAIN_MODULE_PRODUIT') // Permission has changed into 2.7 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Produit module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modProduct.class.php'; @@ -4498,8 +4349,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_SERVICE') // Permission has changed into 2.7 + } elseif ($moduletoreload == 'MAIN_MODULE_SERVICE') // Permission has changed into 2.7 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Service module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modService.class.php'; @@ -4508,8 +4358,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_COMMANDE') // Permission has changed into 2.9 + } elseif ($moduletoreload == 'MAIN_MODULE_COMMANDE') // Permission has changed into 2.9 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Commande module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modCommande.class.php'; @@ -4518,8 +4367,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_FACTURE') // Permission has changed into 2.9 + } elseif ($moduletoreload == 'MAIN_MODULE_FACTURE') // Permission has changed into 2.9 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Facture module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modFacture.class.php'; @@ -4528,8 +4376,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') // Permission has changed into 2.9 + } elseif ($moduletoreload == 'MAIN_MODULE_FOURNISSEUR') // Permission has changed into 2.9 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Fournisseur module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modFournisseur.class.php'; @@ -4538,8 +4385,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_HOLIDAY') // Permission and tabs has changed into 3.8 + } elseif ($moduletoreload == 'MAIN_MODULE_HOLIDAY') // Permission and tabs has changed into 3.8 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Leave Request module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modHoliday.class.php'; @@ -4548,8 +4394,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0 + } elseif ($moduletoreload == 'MAIN_MODULE_DEPLACEMENT') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Deplacement module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modDeplacement.class.php'; @@ -4558,8 +4403,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_EXPENSEREPORT') + } elseif ($moduletoreload == 'MAIN_MODULE_EXPENSEREPORT') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Expense Report module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modExpenseReport.class.php'; @@ -4568,8 +4412,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_DON') // Permission has changed into 3.0 + } elseif ($moduletoreload == 'MAIN_MODULE_DON') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Don module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modDon.class.php'; @@ -4578,8 +4421,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo //$mod->remove('noboxes'); $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_ECM') // Permission has changed into 3.0 and 3.1 + } elseif ($moduletoreload == 'MAIN_MODULE_ECM') // Permission has changed into 3.0 and 3.1 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate ECM module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modECM.class.php'; @@ -4588,8 +4430,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); // We need to remove because a permission id has been removed $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_PAYBOX') // Permission has changed into 3.0 + } elseif ($moduletoreload == 'MAIN_MODULE_PAYBOX') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Paybox module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modPaybox.class.php'; @@ -4598,8 +4439,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); // We need to remove because id of module has changed $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_SUPPLIERPROPOSAL') // Module after 3.5 + } elseif ($moduletoreload == 'MAIN_MODULE_SUPPLIERPROPOSAL') // Module after 3.5 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Supplier Proposal module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modSupplierProposal.class.php'; @@ -4608,8 +4448,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); // We need to remove because id of module has changed $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') // Permission has changed into 3.0 + } elseif ($moduletoreload == 'MAIN_MODULE_OPENSURVEY') // Permission has changed into 3.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Opensurvey module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modOpenSurvey.class.php'; @@ -4618,8 +4457,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); // We need to remove because menu entries has changed $mod->init($reloadmode); } - } - elseif ($moduletoreload == 'MAIN_MODULE_TAKEPOS') // Permission has changed into 10.0 + } elseif ($moduletoreload == 'MAIN_MODULE_TAKEPOS') // Permission has changed into 10.0 { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Takepos module"); $res = @include_once DOL_DOCUMENT_ROOT.'/core/modules/modTakePos.class.php'; @@ -4628,8 +4466,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod->remove('noboxes'); // We need to remove because menu entries has changed $mod->init($reloadmode); } - } - else { + } else { $reg = array(); $tmp = preg_match('/MAIN_MODULE_([a-zA-Z0-9]+)/', $moduletoreload, $reg); if (!empty($reg[1])) @@ -4637,8 +4474,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo if (strtoupper($moduletoreload) == $moduletoreload) // If key is un uppercase { $moduletoreloadshort = ucfirst(strtolower($reg[1])); - } - else // If key is a mix of up and low case + } else // If key is a mix of up and low case { $moduletoreloadshort = $reg[1]; } @@ -4649,8 +4485,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod = new $classname($db); //$mod->remove('noboxes'); $mod->init($reloadmode); - } - else { + } else { dolibarr_install_syslog('Failed to include '.DOL_DOCUMENT_ROOT.'/core/modules/mod'.$moduletoreloadshort.'.class.php'); $res = @dol_include_once(strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); @@ -4659,13 +4494,11 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod = new $classname($db); //$mod->remove('noboxes'); $mod->init($reloadmode); - } - else { + } else { dolibarr_install_syslog('Failed to include '.strtolower($moduletoreloadshort).'/core/modules/mod'.$moduletoreloadshort.'.class.php'); } } - } - else { + } else { dolibarr_install_syslog("Error, can't find module with name ".$moduletoreload, LOG_WARNING); print "Error, can't find module with name ".$moduletoreload; } @@ -4799,8 +4632,7 @@ function migrate_user_photospath() } // dol_delete_dir($origin.'/'.$file); } - } - else // it is a file + } else // it is a file { if (!dol_is_file($destin.'/'.$file)) { diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index 80f30552473..544593dc16c 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -118,17 +118,14 @@ if ($action == 'add') $db->commit(); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $_GET["commande_id"] = $_POST["commande_id"]; $action = 'create'; } -} - -elseif ($action == 'confirm_valid' && $confirm == 'yes' && +} elseif ($action == 'confirm_valid' && $confirm == 'yes' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->expedition->livraison_advance->validate))) ) @@ -165,8 +162,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->expeditio if (!empty($backtopage)) header("Location: ".$backtopage); else header("Location: ".DOL_URL_ROOT.'/expedition/list.php?restore_lastsearch_values=1'); exit; - } - else { + } else { $db->rollback(); } } @@ -259,8 +255,7 @@ $formfile = new FormFile($db); if ($action == 'create') // Create. Seems to no be used { -} -else // View +} else // View { if ($object->id > 0) { @@ -450,8 +445,7 @@ else // View print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 1); print ''; print ''; - } - else { + } else { print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; } print ''; @@ -472,8 +466,7 @@ else // View if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -570,8 +563,7 @@ else // View } $label = (!empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $object->lines[$i]->product_label; - } - else { + } else { $label = (!empty($object->lines[$i]->label) ? $object->lines[$i]->label : $object->lines[$i]->product_label); } @@ -591,8 +583,7 @@ else // View { print (!empty($object->lines[$i]->description) && $object->lines[$i]->description != $object->lines[$i]->product_label) ? '
'.dol_htmlentitiesbr($object->lines[$i]->description) : ''; } - } - else { + } else { print ""; if ($object->lines[$i]->fk_product_type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -668,8 +659,7 @@ else // View if ($conf->expedition_bon->enabled) { print ''.$langs->trans("Delete").''; - } - else { + } else { print ''.$langs->trans("Delete").''; } } @@ -712,13 +702,11 @@ else // View // Rien a droite print ''; - } - else { + } else { /* Expedition non trouvee */ print "Expedition inexistante ou acces refuse"; } - } - else { + } else { /* Expedition non trouvee */ print "Expedition inexistante ou acces refuse"; } diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 4d00c414cb1..6199bc4ec88 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -215,22 +215,19 @@ class Livraison extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $error++; $this->error = $this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->db->rollback(); return -3; } - } - else { + } else { $error++; $this->error = $this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->db->rollback(); return -2; } - } - else { + } else { $error++; $this->error = $this->db->lasterror()." - sql=".$this->db->lastqueryerror; $this->db->rollback(); @@ -341,14 +338,12 @@ class Livraison extends CommonObject } return 1; - } - else { + } else { $this->error = 'Delivery with id '.$id.' not found sql='.$sql; dol_syslog(get_class($this).'::fetch Error '.$this->error, LOG_ERR); return -2; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -394,8 +389,7 @@ class Livraison extends CommonObject if (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) // empty should not happened, but when it occurs, the test save life { $numref = $objMod->livraison_get_num($soc, $this); - } - else { + } else { $numref = $this->ref; } $this->newref = dol_sanitizeFileName($numref); @@ -494,15 +488,13 @@ class Livraison extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } } } - } - else { + } else { $this->error = "Non autorise"; dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR); return -1; @@ -625,8 +617,7 @@ class Livraison extends CommonObject $this->update_price(); return 1; - } - else { + } else { return 0; } } @@ -695,20 +686,17 @@ class Livraison extends CommonObject // End call triggers return 1; - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; @@ -978,15 +966,13 @@ class Livraison extends CommonObject if ($row[0] == $objSourceLine->rowid) { $array[$i]['qty'] = $objSourceLine->qty - $row[1]; - } - else { + } else { $array[$i]['qty'] = $objSourceLine->qty; } $array[$i]['ref'] = $objSourceLine->ref; $array[$i]['label'] = $objSourceLine->label ? $objSourceLine->label : $objSourceLine->description; - } - elseif ($objSourceLine->qty - $row[1] < 0) + } elseif ($objSourceLine->qty - $row[1] < 0) { $array[$i]['qty'] = $objSourceLine->qty - $row[1]." Erreur livraison !"; $array[$i]['ref'] = $objSourceLine->ref; @@ -996,8 +982,7 @@ class Livraison extends CommonObject $i++; } return $array; - } - else { + } else { $this->error = $this->db->error()." - sql=$sqlSourceLine"; return -1; } @@ -1026,13 +1011,11 @@ class Livraison extends CommonObject { $this->date_delivery = $date_livraison; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 266b7d2bc09..8f82e94b8f9 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -68,8 +68,7 @@ if (empty($reshook)) if ($result > 0) { setEventMessages($langs->trans('LoanPaid'), null, 'mesgs'); - } - else { + } else { setEventMessages($loan->error, null, 'errors'); } } @@ -84,8 +83,7 @@ if (empty($reshook)) setEventMessages($langs->trans('LoanDeleted'), null, 'mesgs'); header("Location: index.php"); exit; - } - else { + } else { setEventMessages($loan->error, null, 'errors'); } } @@ -151,8 +149,7 @@ if (empty($reshook)) $action = 'create'; } } - } - else { + } else { header("Location: index.php"); exit(); } @@ -173,8 +170,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); $action = 'edit'; - } - else { + } else { $object->datestart = $datestart; $object->dateend = $dateend; $object->capital = $capital; @@ -197,13 +193,11 @@ if (empty($reshook)) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } @@ -268,8 +262,7 @@ if ($action == 'create') print ''.$langs->trans("Account").''; $form->select_comptes(GETPOST("accountid"), "accountid", 0, "courant=1", 1); // Show list of bank account with courant print ''; - } - else { + } else { print ''.$langs->trans("Account").''; print $langs->trans("NoBankAccountDefined"); print ''; @@ -352,8 +345,7 @@ if ($action == 'create') print ''; print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : $conf->global->LOAN_ACCOUNTING_ACCOUNT_INTEREST, 'accountancy_account_interest', 1, '', 1, 1); print ''; - } - else // For external software + } else // For external software { // Accountancy_account_capital print ''.$langs->trans("LoanAccountancyCapitalCode").''; @@ -476,8 +468,7 @@ if ($id > 0) print ''.$langs->trans("LoanCapital").''; print ''; print ''; - } - else { + } else { print ''.$langs->trans("LoanCapital").''.price($object->capital, 0, $outputlangs, 1, -1, -1, $conf->currency).''; } @@ -487,8 +478,7 @@ if ($id > 0) print ''.$langs->trans("Insurance").''; print ''; print ''; - } - else { + } else { print ''.$langs->trans("Insurance").''.price($object->insurance_amount, 0, $outputlangs, 1, -1, -1, $conf->currency).''; } @@ -498,8 +488,7 @@ if ($id > 0) if ($action == 'edit') { print $form->selectDate($object->datestart, 'start', 0, 0, 0, 'update', 1, 0); - } - else { + } else { print dol_print_date($object->datestart, "day"); } print ""; @@ -510,8 +499,7 @@ if ($id > 0) if ($action == 'edit') { print $form->selectDate($object->dateend, 'end', 0, 0, 0, 'update', 1, 0); - } - else { + } else { print dol_print_date($object->dateend, "day"); } print ""; @@ -522,8 +510,7 @@ if ($id > 0) if ($action == 'edit') { print ''; - } - else { + } else { print $object->nbterm; } print ''; @@ -534,8 +521,7 @@ if ($id > 0) if ($action == 'edit') { print '%'; - } - else { + } else { print price($object->rate).'%'; } print ''; @@ -551,13 +537,11 @@ if ($id > 0) if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($object->account_capital, 'accountancy_account_capital', 1, '', 1, 1); - } - else { + } else { print ''; } print ''; - } - else { + } else { print ''; print $langs->trans("LoanAccountancyCapitalCode"); print ''; @@ -587,13 +571,11 @@ if ($id > 0) if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($object->account_insurance, 'accountancy_account_insurance', 1, '', 1, 1); - } - else { + } else { print ''; } print ''; - } - else { + } else { print ''; print $langs->trans("LoanAccountancyInsuranceCode"); print ''; @@ -623,13 +605,11 @@ if ($id > 0) if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($object->account_interest, 'accountancy_account_interest', 1, '', 1, 1); - } - else { + } else { print ''; } print ''; - } - else { + } else { print ''; print $langs->trans("LoanAccountancyInterestCode"); print ''; @@ -723,8 +703,7 @@ if ($id > 0) print ''; $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -784,8 +763,7 @@ if ($id > 0) print ""; } } - } - else { + } else { // Loan not found dol_print_error('', $object->error); } diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index d38593c9710..a072199dc01 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -160,13 +160,11 @@ class Loan extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->db->free($resql); return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -256,8 +254,7 @@ class Loan extends CommonObject //dol_syslog("Loans::create this->id=".$this->id); $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -326,8 +323,7 @@ class Loan extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -371,8 +367,7 @@ class Loan extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -496,8 +491,7 @@ class Loan extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -566,8 +560,7 @@ class Loan extends CommonObject $this->db->free($resql); return $amount; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -612,13 +605,11 @@ class Loan extends CommonObject $this->db->free($result); return 1; - } - else { + } else { $this->db->free($result); return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 8089dc3e176..7405a63e3b9 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -170,8 +170,7 @@ class LoanSchedule extends CommonObject if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_loan"); - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -182,8 +181,7 @@ class LoanSchedule extends CommonObject $this->amount_capital = $totalamount; $this->db->commit(); return $this->id; - } - else { + } else { $this->errors[] = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -255,8 +253,7 @@ class LoanSchedule extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -318,8 +315,7 @@ class LoanSchedule extends CommonObject { $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -359,8 +355,7 @@ class LoanSchedule extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -445,8 +440,7 @@ class LoanSchedule extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index 5c50a1fea89..40479677fd0 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -165,8 +165,7 @@ class PaymentLoan extends CommonObject if ($resql) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_loan"); - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -177,8 +176,7 @@ class PaymentLoan extends CommonObject $this->amount_capital = $totalamount; $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -252,8 +250,7 @@ class PaymentLoan extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -323,8 +320,7 @@ class PaymentLoan extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -375,8 +371,7 @@ class PaymentLoan extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -454,8 +449,7 @@ class PaymentLoan extends CommonObject $result = $acc->add_url_line($bank_line_id, $fk_loan, DOL_URL_ROOT.'/loan/card.php?id=', ($this->label ? $this->label : ''), 'loan'); if ($result <= 0) dol_print_error($this->db); } - } - else { + } else { $this->error = $acc->error; $error++; } @@ -464,8 +458,7 @@ class PaymentLoan extends CommonObject if (!$error) { return 1; - } - else { + } else { return -1; } } @@ -489,8 +482,7 @@ class PaymentLoan extends CommonObject { $this->fk_bank = $id_bank; return 1; - } - else { + } else { $this->error = $this->db->error(); return 0; } diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index 93eca8cb7b4..442f8768390 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -158,8 +158,7 @@ if ($object->id) $permtoedit = $user->rights->loan->write; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/loan/list.php b/htdocs/loan/list.php index 5a4b9364555..fc0e766ed9b 100644 --- a/htdocs/loan/list.php +++ b/htdocs/loan/list.php @@ -120,8 +120,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else { +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -260,8 +259,7 @@ if ($resql) print ''."\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/loan/payment/card.php b/htdocs/loan/payment/card.php index 6d912cc7149..31619be511b 100644 --- a/htdocs/loan/payment/card.php +++ b/htdocs/loan/payment/card.php @@ -63,8 +63,7 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->loan->del $db->commit(); header("Location: ".DOL_URL_ROOT."/loan/list.php"); exit; - } - else { + } else { setEventMessages($payment->error, $payment->errors, 'errors'); $db->rollback(); } @@ -100,8 +99,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->loan->wri header('Location: card.php?id='.$payment->id); exit; - } - else { + } else { setEventMessages($payment->error, $payment->errors, 'errors'); $db->rollback(); } @@ -252,8 +250,7 @@ if ($resql) print "\n"; $db->free($resql); -} -else { +} else { dol_print_error($db); } @@ -283,8 +280,7 @@ if (empty($action) && !empty($user->rights->loan->delete)) if (!$disable_delete) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 3ccc6a77b3f..de5a43220ef 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -155,8 +155,7 @@ if ($action == 'add_payment') { setEventMessages($payment->error, $payment->errors, 'errors'); $error++; - } - elseif (isset($line)) + } elseif (isset($line)) { $line->fk_bank = $payment->fk_bank; $line->update($user); @@ -169,8 +168,7 @@ if ($action == 'add_payment') $loc = DOL_URL_ROOT.'/loan/card.php?id='.$chid; header('Location: '.$loc); exit; - } - else { + } else { $db->rollback(); } } @@ -289,8 +287,7 @@ if ($action == 'create') if ($loan->datestart > 0) { print ''.dol_print_date($loan->datestart, 'day').''; - } - else { + } else { print '!!!'; } @@ -304,24 +301,21 @@ if ($action == 'create') if ($sumpaid < $loan->capital) { print $langs->trans("LoanCapital").': '; - } - else { + } else { print '-'; } print '
'; if ($sumpaid < $loan->capital) { print $langs->trans("Insurance").': '; - } - else { + } else { print '-'; } print '
'; if ($sumpaid < $loan->capital) { print $langs->trans("Interest").': '; - } - else { + } else { print '-'; } print ""; diff --git a/htdocs/loan/schedule.php b/htdocs/loan/schedule.php index fb3cd86ebe3..adcdf4ca049 100644 --- a/htdocs/loan/schedule.php +++ b/htdocs/loan/schedule.php @@ -237,8 +237,7 @@ if ($object->nbterm > 0 && count($echeance->lines) == 0) $i++; $capital = $cap_rest; } -} -elseif (count($echeance->lines) > 0) +} elseif (count($echeance->lines) > 0) { $i = 1; $capital = $object->capital; diff --git a/htdocs/mailmanspip/class/mailmanspip.class.php b/htdocs/mailmanspip/class/mailmanspip.class.php index dec81411a33..46e8d017eca 100644 --- a/htdocs/mailmanspip/class/mailmanspip.class.php +++ b/htdocs/mailmanspip/class/mailmanspip.class.php @@ -208,14 +208,10 @@ class MailmanSpip if ($result) { return 1; - } - else $this->error = $mydb->lasterror(); - } - else $this->error = 'Failed to connect to SPIP'; - } - else $this->error = 'BadSPIPConfiguration'; - } - else $this->error = 'SPIPNotEnabled'; + } else $this->error = $mydb->lasterror(); + } else $this->error = 'Failed to connect to SPIP'; + } else $this->error = 'BadSPIPConfiguration'; + } else $this->error = 'SPIPNotEnabled'; return 0; } @@ -249,14 +245,10 @@ class MailmanSpip if ($result) { return 1; - } - else $this->error = $mydb->lasterror(); - } - else $this->error = 'Failed to connect to SPIP'; - } - else $this->error = 'BadSPIPConfiguration'; - } - else $this->error = 'SPIPNotEnabled'; + } else $this->error = $mydb->lasterror(); + } else $this->error = 'Failed to connect to SPIP'; + } else $this->error = 'BadSPIPConfiguration'; + } else $this->error = 'SPIPNotEnabled'; return 0; } @@ -290,23 +282,18 @@ class MailmanSpip // nous avons au moins une reponse $mydb->close($result); return 1; - } - else { + } else { // nous n'avons pas de reponse => n'existe pas $mydb->close($result); return 0; } - } - else { + } else { $this->error = $mydb->lasterror(); $mydb->close(); } - } - else $this->error = 'Failed to connect to SPIP'; - } - else $this->error = 'BadSPIPConfiguration'; - } - else $this->error = 'SPIPNotEnabled'; + } else $this->error = 'Failed to connect to SPIP'; + } else $this->error = 'BadSPIPConfiguration'; + } else $this->error = 'SPIPNotEnabled'; return -1; } @@ -371,12 +358,10 @@ class MailmanSpip { $this->mladded_ko[$list] = $object->email; return -2; - } - else $this->mladded_ok[$list] = $object->email; + } else $this->mladded_ok[$list] = $object->email; } return count($lists); - } - else { + } else { $this->error = "ADHERENT_MAILMAN_URL not defined"; return -1; } @@ -444,12 +429,10 @@ class MailmanSpip { $this->mlremoved_ko[$list] = $object->email; return -2; - } - else $this->mlremoved_ok[$list] = $object->email; + } else $this->mlremoved_ok[$list] = $object->email; } return count($lists); - } - else { + } else { $this->error = "ADHERENT_MAILMAN_UNSUB_URL not defined"; return -1; } diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index e174e383993..9efea04e415 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -47,8 +47,7 @@ if (preg_match('/set_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -60,8 +59,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -71,8 +69,7 @@ if ($action == 'remises') if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', $_POST['MARGIN_METHODE_FOR_DISCOUNT'], 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else { + } else { dol_print_error($db); } } @@ -82,8 +79,7 @@ if ($action == 'typemarges') if (dolibarr_set_const($db, 'MARGIN_TYPE', $_POST['MARGIN_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else { + } else { dol_print_error($db); } } @@ -93,8 +89,7 @@ if ($action == 'contact') if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', $_POST['AGENT_CONTACT_TYPE'], 'chaine', 0, '', $conf->entity) > 0) { setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); - } - else { + } else { dol_print_error($db); } } @@ -161,13 +156,11 @@ print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARGIN_RATES'); -} -else { +} else { if (empty($conf->global->DISPLAY_MARGIN_RATES)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } @@ -182,13 +175,11 @@ print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('DISPLAY_MARK_RATES'); -} -else { +} else { if (empty($conf->global->DISPLAY_MARK_RATES)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } @@ -203,13 +194,11 @@ print ''; if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff('ForceBuyingPriceIfNull'); -} -else { +} else { if (empty($conf->global->ForceBuyingPriceIfNull)) { print ''.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index 8dfaecc7d41..6ff9cdc7274 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -303,8 +303,7 @@ if ($result) } print ""; print ''; -} -else { +} else { dol_print_error($db); } $db->free($result); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 20d2b2a1b52..e1fd6876e0f 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -108,8 +108,7 @@ if ($socid > 0) { if (!$sortorder) $sortorder = "DESC"; if (!$sortfield) $sortfield = "f.datef"; } -} -else { +} else { print ''.$langs->trans('ThirdPartyName').''; print ''; print $form->select_company(null, 'socid', '(client=1 OR client=3)', 1, 0, 0); @@ -125,8 +124,7 @@ if (!$sortfield) { $sortfield = "f.datef"; $sortorder = "DESC"; - } - else { + } else { $sortfield = "s.nom"; $sortorder = "ASC"; } @@ -267,8 +265,7 @@ if ($result) if (!empty($client)) { print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&socid=".$socid, '', $sortfield, $sortorder); print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&socid=".$socid, 'align="center"', $sortfield, $sortorder); - } - else print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder); + } else print_liste_field_titre("Customer", $_SERVER["PHP_SELF"], "s.nom", "", "&socid=".$socid, '', $sortfield, $sortorder); print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "buying_price", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); print_liste_field_titre("Margin", $_SERVER["PHP_SELF"], "marge", "", "&socid=".$socid, 'align="right"', $sortfield, $sortorder); @@ -295,8 +292,7 @@ if ($result) { $marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : ''; - } - else { + } else { $marginRate = ($pa != 0) ? (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ? (100 * $marge / $pv) : ''; } @@ -310,8 +306,7 @@ if ($result) print "\n"; print ""; print dol_print_date($db->jdate($objp->datef), 'day').""; - } - else { + } else { $companystatic->id = $objp->socid; $companystatic->name = $objp->name; $companystatic->client = $objp->client; @@ -363,8 +358,7 @@ if ($result) print ""; print ''; -} -else { +} else { dol_print_error($db); } $db->free($result); diff --git a/htdocs/margin/lib/margins.lib.php b/htdocs/margin/lib/margins.lib.php index 41618b174fa..fdfea1610bf 100644 --- a/htdocs/margin/lib/margins.lib.php +++ b/htdocs/margin/lib/margins.lib.php @@ -127,12 +127,10 @@ function getMarginInfos($pvht, $remise_percent, $tva_tx, $localtax1_tx, $localta if ($product->fetch_product_fournisseur_price($fk_pa)) { $paht_ret = $product->fourn_unitprice * (1 - $product->fourn_remise_percent / 100); - } - else { + } else { $paht_ret = $paht; } - } - else { + } else { $paht_ret = $paht; } diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 3e2fd804ff6..cb67cb0d58f 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -61,8 +61,7 @@ if (!$sortfield) { $sortfield = "f.datef"; $sortorder = "DESC"; - } - else { + } else { $sortfield = "p.ref"; $sortorder = "ASC"; } @@ -112,8 +111,7 @@ if ($id > 0) { if (!$sortorder) $sortorder = "DESC"; if (!$sortfield) $sortfield = "f.datef"; -} -else { +} else { print ''.$langs->trans('ChooseProduct/Service').''; print ''; $form->select_produits('', 'id', '', 20, 0, 1, 2, '', 1, array(), 0, 'All'); @@ -238,8 +236,7 @@ if ($result) if ($id > 0) { print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", "&id=".$id, '', $sortfield, $sortorder); print_liste_field_titre("DateInvoice", $_SERVER["PHP_SELF"], "f.datef", "", "&id=".$id, 'align="center"', $sortfield, $sortorder); - } - else { + } else { print_liste_field_titre("ProductService", $_SERVER["PHP_SELF"], "p.ref", "", "&id=".$id, '', $sortfield, $sortorder); } print_liste_field_titre("SellingPrice", $_SERVER["PHP_SELF"], "selling_price", "", "&id=".$id, 'align="right"', $sortfield, $sortorder); @@ -267,8 +264,7 @@ if ($result) { $marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : ''; - } - else { + } else { $marginRate = ($pa != 0) ? (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ? (100 * $marge / $pv) : ''; } @@ -282,8 +278,7 @@ if ($result) print "\n"; print ""; print dol_print_date($db->jdate($objp->datef), 'day').""; - } - else { + } else { print ''; if ($objp->rowid > 0) { @@ -294,8 +289,7 @@ if ($result) $product_static->entity = $objp->pentity; $text = $product_static->getNomUrl(1); print $text .= ' - '.$objp->label; - } - else { + } else { print img_object('', 'product').' '.$langs->trans("NotPredefinedProducts"); } print "\n"; @@ -339,8 +333,7 @@ if ($result) print ""; print ''; -} -else { +} else { dol_print_error($db); } $db->free($result); diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 489946e43fe..70cbf6a9e42 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -229,8 +229,7 @@ if ($id > 0 || !empty($ref)) { $marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : ''; - } - else { + } else { $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; } diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index c04537fa99e..c9711bd99ef 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -235,8 +235,7 @@ if ($socid > 0) { $marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : ''; - } - else { + } else { $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; } @@ -253,8 +252,7 @@ if ($socid > 0) print "".(($markRate === '') ? 'n/a' : price(price2num($markRate, 'MT'))."%")."\n"; print ' '; print "\n"; - } - else { + } else { dol_print_error($db); } print ""; @@ -262,8 +260,7 @@ if ($socid > 0) print '
'; $db->free($result); -} -else { +} else { dol_print_error('', 'Parameter socid not defined'); } diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 1ef1f9c1f50..e50539fd05b 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -160,20 +160,17 @@ if (!defined('NOREQUIREUSER')) { */ // By default conf->entity is 1, but we change this if we ask another value. -if (session_id() && !empty($_SESSION["dol_entity"])) // Entity inside an opened session -{ +if (session_id() && !empty($_SESSION["dol_entity"])) { + // Entity inside an opened session $conf->entity = $_SESSION["dol_entity"]; -} -elseif (!empty($_ENV["dol_entity"])) // Entity inside a CLI script -{ +} elseif (!empty($_ENV["dol_entity"])) { + // Entity inside a CLI script $conf->entity = $_ENV["dol_entity"]; -} -elseif (GETPOSTISSET("loginfunction") && GETPOST("entity", 'int')) // Just after a login page -{ +} elseif (GETPOSTISSET("loginfunction") && GETPOST("entity", 'int')) { + // Just after a login page $conf->entity = GETPOST("entity", 'int'); -} -elseif (defined('DOLENTITY') && is_numeric(DOLENTITY)) // For public page with MultiCompany module -{ +} elseif (defined('DOLENTITY') && is_numeric(DOLENTITY)) { + // For public page with MultiCompany module $conf->entity = DOLENTITY; } diff --git a/htdocs/mrp/ajax/ajax_bom.php b/htdocs/mrp/ajax/ajax_bom.php index d5c1355d361..57f1089c2e2 100644 --- a/htdocs/mrp/ajax/ajax_bom.php +++ b/htdocs/mrp/ajax/ajax_bom.php @@ -49,7 +49,6 @@ if ($result > 0) unset($object->fields); unset($object->db); echo json_encode($object); -} -else { +} else { echo 'Failed to load category with id='.$idbom; } diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index 5cf3d5798f8..404a3329133 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -421,14 +421,11 @@ class Mo extends CommonObject foreach ($filter as $key => $value) { if ($key == 't.rowid') { $sqlwhere[] = $key.'='.$value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 'customsql') { + } elseif ($key == 'customsql') { $sqlwhere[] = $value; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -582,8 +579,7 @@ class Mo extends CommonObject setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); $this->db->commit(); return 1; - } - else { + } else { setEventMessages($this->error, $this->errors, 'errors'); $this->db->rollback(); return -1; @@ -655,8 +651,7 @@ class Mo extends CommonObject $error++; $this->error = "BadValueForquantityToConsume"; break; - } - else { + } else { $moline->fk_product = $line->fk_product; $moline->role = 'toconsume'; $moline->position = $line->position; @@ -762,14 +757,12 @@ class Mo extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; //dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_MRP_MO_ADDON_NotDefined"); return ""; } @@ -814,8 +807,7 @@ class Mo extends CommonObject { $this->fetch_product(); $num = $this->getNextNumRef($this->product); - } - else { + } else { $num = $this->ref; } $this->newref = $num; @@ -896,8 +888,7 @@ class Mo extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1024,8 +1015,7 @@ class Mo extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -1141,8 +1131,7 @@ class Mo extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -1175,8 +1164,7 @@ class Mo extends CommonObject $this->error = $this->error; $this->errors = $this->errors; return $result; - } - else { + } else { $this->lines = $result; return $this->lines; } @@ -1322,8 +1310,7 @@ class Mo extends CommonObject $productstatic->fetch($line->fk_product); $this->tpl['label'] .= $productstatic->getNomUrl(1); //$this->tpl['label'].= ' - '.$productstatic->label; - } - else { + } else { // If origin MRP line is not a product, but another MRP // TODO } @@ -1506,14 +1493,11 @@ class MoLine extends CommonObjectLine foreach ($filter as $key => $value) { if ($key == 't.rowid') { $sqlwhere[] = $key.'='.$value; - } - elseif (strpos($key, 'date') !== false) { + } elseif (strpos($key, 'date') !== false) { $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; - } - elseif ($key == 'customsql') { + } elseif ($key == 'customsql') { $sqlwhere[] = $value; - } - else { + } else { $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; } } diff --git a/htdocs/mrp/index.php b/htdocs/mrp/index.php index e05a93494f3..d4359dcae90 100644 --- a/htdocs/mrp/index.php +++ b/htdocs/mrp/index.php @@ -136,8 +136,7 @@ if ($conf->use_javascript_ajax) print ""; print "
"; - } - else { + } else { dol_print_error($db); } } @@ -194,8 +193,7 @@ if ($resql) } print ""; print "
"; -} -else { +} else { dol_print_error($db); } @@ -246,8 +244,7 @@ if ($resql) } print ""; print "
"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/mrp/mo_agenda.php b/htdocs/mrp/mo_agenda.php index 5b18f18d1ca..6630688b64a 100644 --- a/htdocs/mrp/mo_agenda.php +++ b/htdocs/mrp/mo_agenda.php @@ -48,8 +48,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); @@ -215,8 +214,7 @@ if ($object->id > 0) if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) { print '
'.$langs->trans("AddAction").''; - } - else { + } else { print ''.$langs->trans("AddAction").''; } } diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index eda7d0c30ca..a4ab216156c 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -192,8 +192,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, 0, 0, 0); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -623,8 +622,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; - } - else { + } else { print ''.$langs->trans('Modify').''."\n"; } } @@ -637,8 +635,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { print ''.$langs->trans("Validate").''; - } - else { + } else { $langs->load("errors"); print ''.$langs->trans("Validate").''; } @@ -672,8 +669,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd)) { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 9ed658ab1c1..86aefd8a5d5 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -183,8 +183,7 @@ if ($object->id) $relativepathwithnofile = 'mo/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { accessforbidden('', 0, 1); } diff --git a/htdocs/mrp/mo_list.php b/htdocs/mrp/mo_list.php index 9866dabf8e0..64441a4fec9 100644 --- a/htdocs/mrp/mo_list.php +++ b/htdocs/mrp/mo_list.php @@ -279,8 +279,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else { +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -415,8 +414,7 @@ foreach ($object->fields as $key => $val) if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); - } - elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 6c800446595..b168371c0ea 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -352,8 +352,7 @@ if (empty($reshook)) } } } - } - else { + } else { $consumptioncomplete = false; $productioncomplete = false; } @@ -406,8 +405,7 @@ if (empty($reshook)) $object->generateDocument($model, $outputlangs, 0, 0, 0); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -591,8 +589,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) { print ''.$langs->trans("Validate").''; - } - else { + } else { $langs->load("errors"); print ''.$langs->trans("Validate").''; } diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index 50bd5d6cdcf..27bf6dc1c8f 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -409,8 +409,7 @@ class MultiCurrency extends CommonObject { $this->rate = $currencyRate; return 1; - } - else { + } else { $this->rate = null; $this->errors = $currencyRate->errors; return -1; @@ -562,8 +561,7 @@ class MultiCurrency extends CommonObject { if ($way == 'dolibarr') return $amount * $multicurrency_tx; else return $amount / $multicurrency_tx; - } - else return $amount; + } else return $amount; } /** @@ -657,8 +655,7 @@ class MultiCurrency extends CommonObject if ($obj->fetch(null, $code) > 0) { $obj->updateRate($rate); - } - elseif ($addifnotfound) + } elseif ($addifnotfound) { self::addRateFromDolibarr($code, $rate); } @@ -666,8 +663,7 @@ class MultiCurrency extends CommonObject } return 1; - } - else { + } else { dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); diff --git a/htdocs/opensurvey/card.php b/htdocs/opensurvey/card.php index 1a794ac76d9..7322c70780c 100644 --- a/htdocs/opensurvey/card.php +++ b/htdocs/opensurvey/card.php @@ -241,8 +241,7 @@ print $langs->trans("Title").''; if ($action == 'edit') { print ''; -} -else print dol_htmlentities($object->titre); +} else print dol_htmlentities($object->titre); print ''; // Description @@ -251,8 +250,7 @@ if ($action == 'edit') { $doleditor = new DolEditor('nouveauxcommentaires', $object->description, '', 120, 'dolibarr_notes', 'In', 1, 1, 1, ROWS_7, '90%'); $doleditor->Create(0, ''); -} -else { +} else { print (dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)); } print ''; @@ -264,8 +262,7 @@ if (!$object->fk_user_creat) { if ($action == 'edit') { print ''; - } - else print dol_print_email($object->mail_admin, 0, 0, 1); + } else print dol_print_email($object->mail_admin, 0, 0, 1); print ''; } @@ -274,8 +271,7 @@ print ''.$langs->trans('ToReceiveEMailForEachVote').'mailsonde ? 'checked="checked"' : '').'">'; -} -else { +} else { print yn($object->mailsonde); //If option is active and linked user does not have an email, we show a warning @@ -292,8 +288,7 @@ print ''.$langs->trans('CanComment').''; if ($action == 'edit') { print 'allow_comments ? 'checked="checked"' : '').'">'; -} -else print yn($object->allow_comments); +} else print yn($object->allow_comments); print ''; // Users can see others vote @@ -301,8 +296,7 @@ print ''.$langs->trans('CanSeeOthersVote').''; if ($action == 'edit') { print 'allow_spy ? 'checked="checked"' : '').'">'; -} -else print yn($object->allow_spy); +} else print yn($object->allow_spy); print ''; // Expire date @@ -407,8 +401,7 @@ if ($comments) { print dol_htmlentities($comment->usercomment).': '.dol_nl2br(dol_htmlentities($comment->comment))."
"; } -} -else { +} else { print $langs->trans("NoCommentYet").'
'; } diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index f7541f2ebe0..19a29f5fa71 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -199,8 +199,7 @@ class Opensurveysondage extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -261,8 +260,7 @@ class Opensurveysondage extends CommonObject $this->date_m = $this->db->jdate($obj->tls); $ret = 1; - } - else { + } else { $sondage = ($id ? 'id='.$id : 'sondageid='.$numsurvey); $this->error = 'Fetch no poll found for '.$sondage; dol_syslog($this->error, LOG_ERR); @@ -270,8 +268,7 @@ class Opensurveysondage extends CommonObject } $this->db->free($resql); - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); $ret = -1; } @@ -339,8 +336,7 @@ class Opensurveysondage extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -404,8 +400,7 @@ class Opensurveysondage extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -453,8 +448,7 @@ class Opensurveysondage extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -495,8 +489,7 @@ class Opensurveysondage extends CommonObject $ret[] = $tmp; $i++; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); $this->lines = $ret; diff --git a/htdocs/opensurvey/exportcsv.php b/htdocs/opensurvey/exportcsv.php index 2125ac76774..6f9a699273b 100644 --- a/htdocs/opensurvey/exportcsv.php +++ b/htdocs/opensurvey/exportcsv.php @@ -108,13 +108,11 @@ if ($resql) { $input .= 'OK;'; $somme[$k]++; - } - elseif ($car == "2") + } elseif ($car == "2") { $input .= 'KO;'; $somme[$k]++; - } - else { + } else { $input .= ';'; } } @@ -122,8 +120,7 @@ if ($resql) $input .= "\r\n"; $i++; } -} -else dol_print_error($db); +} else dol_print_error($db); $filesize = strlen($input); diff --git a/htdocs/opensurvey/fonctions.php b/htdocs/opensurvey/fonctions.php index 2fa067ba9a3..635fc3ceb5c 100644 --- a/htdocs/opensurvey/fonctions.php +++ b/htdocs/opensurvey/fonctions.php @@ -103,8 +103,7 @@ function llxHeaderSurvey($title, $head = "", $disablejs = 0, $disablehead = 0, $ $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width = 150; - } - elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) + } elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); diff --git a/htdocs/opensurvey/index.php b/htdocs/opensurvey/index.php index 20609602ad2..50198e5202f 100644 --- a/htdocs/opensurvey/index.php +++ b/htdocs/opensurvey/index.php @@ -52,8 +52,7 @@ if ($resql) { $obj = $db->fetch_object($resql); $nbsondages = $obj->nb; -} -else dol_print_error($db, ''); +} else dol_print_error($db, ''); $title = $langs->trans("OpenSurveyArea"); diff --git a/htdocs/opensurvey/list.php b/htdocs/opensurvey/list.php index 918c8e20ef9..4fcbb93a18c 100644 --- a/htdocs/opensurvey/list.php +++ b/htdocs/opensurvey/list.php @@ -190,8 +190,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; -} -else { +} else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -356,8 +355,7 @@ while ($i < min($num, $limit)) { $obj2 = $db->fetch_object($resql2); $nbuser = $obj2->nb; - } - else dol_print_error($db); + } else dol_print_error($db); $opensurvey_static->id = $obj->rowid; $opensurvey_static->ref = $obj->rowid; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index c86c6919f00..59f605daf31 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -70,12 +70,10 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') { $nouveauchoix .= "1"; - } - elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') + } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') { $nouveauchoix .= "2"; - } - else { // sinon c'est 0 + } else { // sinon c'est 0 $nouveauchoix .= "0"; } } @@ -93,8 +91,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout { setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); $error++; - } - else { + } else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; $resql = $db->query($sql); @@ -134,12 +131,10 @@ if ($testmodifier) if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') { $nouveauchoix .= "1"; - } - elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') + } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') { $nouveauchoix .= "2"; - } - else { // sinon c'est 0 + } else { // sinon c'est 0 $nouveauchoix .= "0"; } } @@ -260,8 +255,7 @@ if (isset($_POST["ajoutercolonne"]) && $object->format == "D") } $adresseadmin = $object->mail_admin; - } - else { + } else { $erreur_ajout_date = "yes"; } } @@ -449,8 +443,7 @@ print $langs->trans("Title").''; if ($action == 'edit') { print ''; -} -else print dol_htmlentities($object->titre); +} else print dol_htmlentities($object->titre); print ''; // Expire date @@ -533,8 +526,7 @@ if (GETPOST('ajoutsujet')) print '     '; print ''; print '

'."\n"; - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; $formother = new FormOther($db); @@ -749,8 +741,7 @@ if ($object->format == "D") print ''."\n"; } -} -else { +} else { // Show titles print ''."\n"; print ''."\n"; @@ -836,8 +827,7 @@ while ($compteur < $num) if (((string) $car) == "0") $sumagainst[$i]++; } } - } - else { + } else { //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs if ($compteur == $ligneamodifier) { @@ -863,8 +853,7 @@ while ($compteur < $num) } print ''."\n"; } - } - else { + } else { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); @@ -1058,8 +1047,7 @@ for ($i = 0; $i < $nbcolonnes; $i++) } else { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').($toutsujet[$i] ? ' ('.dol_print_date($toutsujet[$i], '%A').')' : ''); } - } - else { + } else { $tmps = explode('@', $toutsujet[$i]); $meilleursujet .= dol_htmlentities($tmps[0]); } diff --git a/htdocs/opensurvey/wizard/choix_date.php b/htdocs/opensurvey/wizard/choix_date.php index 4254199ec96..17d60d4a406 100644 --- a/htdocs/opensurvey/wizard/choix_date.php +++ b/htdocs/opensurvey/wizard/choix_date.php @@ -209,8 +209,7 @@ llxHeader('', $langs->trans("OpenSurvey"), "", '', 0, 0, $arrayofjs, $arrayofcss if (!isset($_SESSION["nbrecaseshoraires"])) { $_SESSION["nbrecaseshoraires"] = 5; -} -elseif (GETPOST('ajoutcases') && $_SESSION["nbrecaseshoraires"] == 5) +} elseif (GETPOST('ajoutcases') && $_SESSION["nbrecaseshoraires"] == 5) { $_SESSION["nbrecaseshoraires"] = 10; } @@ -319,8 +318,7 @@ $premierjourmois = date("N", mktime(0, 0, 0, $_SESSION["mois"], 1, $_SESSION["an if (is_integer($_SESSION["mois"]) && $_SESSION["mois"] > 0 && $_SESSION["mois"] < 13) { $motmois = dol_print_date(mktime(0, 0, 0, $_SESSION["mois"], 10), '%B'); -} -else { +} else { $motmois = dol_print_date(dol_now(), '%B'); } diff --git a/htdocs/opensurvey/wizard/create_survey.php b/htdocs/opensurvey/wizard/create_survey.php index 9752a4c43c4..5d7363b4c9f 100644 --- a/htdocs/opensurvey/wizard/create_survey.php +++ b/htdocs/opensurvey/wizard/create_survey.php @@ -88,8 +88,7 @@ if (GETPOST("creation_sondage_date") || GETPOST("creation_sondage_autre")) { $testdate = true; $_SESSION['champdatefin'] = dol_print_date($champdatefin, 'dayrfc'); - } - else { + } else { $testdate = true; $_SESSION['champdatefin'] = dol_print_date($champdatefin, 'dayrfc'); //$testdate = false; @@ -191,8 +190,7 @@ if (GETPOST('choix_sondage')) else print ''; print ''; print '
trans("TypeDate") : $langs->trans("TypeClassic")).')">'; -} -else { +} else { // Show image to selecte between date survey or other survey print '
'."\n"; print ' '."\n"; diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index 5e21326062c..cb1ad560158 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -79,8 +79,7 @@ if ($action == 'setvalue' && $user->admin) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); dol_print_error($db); } diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php index 94dff45e543..71f4b25829b 100644 --- a/htdocs/paypal/admin/paypal.php +++ b/htdocs/paypal/admin/paypal.php @@ -79,8 +79,7 @@ if ($action == 'setvalue' && $user->admin) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -94,8 +93,7 @@ if ($action == "setlive") if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -149,8 +147,7 @@ if (empty($conf->global->PAYPAL_API_SANDBOX)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } diff --git a/htdocs/paypal/lib/paypal.lib.php b/htdocs/paypal/lib/paypal.lib.php index 6da045aaf4f..18ebce49479 100644 --- a/htdocs/paypal/lib/paypal.lib.php +++ b/htdocs/paypal/lib/paypal.lib.php @@ -259,8 +259,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, $payPalURL = $API_Url.$token; header("Location: ".$payPalURL); exit; - } - else { + } else { //Display a user friendly Error on the page using any of the following error information returned by PayPal $ErrorCode = urldecode($resArray["L_ERRORCODE0"]); $ErrorShortMsg = urldecode($resArray["L_SHORTMESSAGE0"]); @@ -270,8 +269,7 @@ function print_paypal_redirect($paymentAmount, $currencyCodeType, $paymentType, if ($ErrorCode == 10729) { $mesg .= "PayPal can't accept payments for this thirdparty. An address is defined but is not complete (missing State).
Ask system administrator to fix address or to setup Paypal module to accept payments even on not complete addresses (remove option PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS).
\n"; - } - else { + } else { $mesg = $langs->trans('SetExpressCheckoutAPICallFailed')."
\n"; $mesg .= $langs->trans('DetailedErrorMessage').": ".$ErrorLongMsg."
\n"; $mesg .= $langs->trans('ShortErrorMessage').": ".$ErrorShortMsg."
\n"; @@ -345,8 +343,7 @@ function callSetExpressCheckout($paymentAmount, $currencyCodeType, $paymentType, if (empty($conf->global->PAYPAL_REQUIRE_VALID_SHIPPING_ADDRESS)) { $nvpstr = $nvpstr."&NOSHIPPING=1"; // An empty or not complete shipping address will be accepted - } - else { + } else { $nvpstr = $nvpstr."&NOSHIPPING=0"; // A valid shipping address is required (full required fields mandatory) } $nvpstr = $nvpstr."&SOLUTIONTYPE=".urlencode($solutionType); @@ -589,8 +586,7 @@ function hash_call($methodName, $nvpStr) { $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; - } - else { + } else { $API_Endpoint = "https://api-3t.paypal.com/nvp"; $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; } @@ -668,8 +664,7 @@ function hash_call($methodName, $nvpStr) $_SESSION['curl_error_msg'] = curl_error($ch); //Execute the Error handling module to display errors. - } - else { + } else { //closing the curl curl_close($ch); } diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index 1c495bdb5ae..5fbe0f6e9cd 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -52,8 +52,7 @@ if (!empty($conf->global->PAYPAL_API_SANDBOX) || GETPOST('forcesandbox', 'alpha' { $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp"; $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token="; -} -else { +} else { $API_Endpoint = "https://api-3t.paypal.com/nvp"; $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token="; } diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index 5282684f81f..02fd4545c84 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -73,8 +73,7 @@ if ($action == 'setconst' && $user->admin) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -92,8 +91,7 @@ if ($action == 'setvalue' && $user->admin) { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null); - } - else { + } else { $db->rollback(); dol_print_error($db); } @@ -159,8 +157,7 @@ if ($mode == 'setup' && $user->admin) if ($key['varname'] == 'PRINTGCP_TOKEN_ACCESS') { print $langs->trans("IsTokenGenerated"); - } - else { + } else { print $langs->trans($key['varname']); } print ''; @@ -196,8 +193,7 @@ if ($mode == 'setup' && $user->admin) $storage = new DoliStorage($db, $conf); try { $tokenobj = $storage->retrieveAccessToken($OAUTH_SERVICENAME_GOOGLE); - } - catch (Exception $e) + } catch (Exception $e) { // Return an error if token not found } @@ -263,13 +259,11 @@ if ($mode == 'config' && $user->admin) if (!empty($conf->use_javascript_ajax)) { print ajax_constantonoff($printer->active); - } - else { + } else { if (empty($conf->global->{$printer->conf})) { print '
'.img_picto($langs->trans("Disabled"), 'off').''; - } - else { + } else { print ''.img_picto($langs->trans("Enabled"), 'on').''; } } @@ -303,8 +297,7 @@ if ($mode == 'test' && $user->admin) } else { setEventMessages($printer->error, $printer->errors, 'errors'); } - } - else { + } else { print $langs->trans('PleaseConfigureDriverfromList'); } } else { diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index a1077a4f845..752ddecbea8 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -182,8 +182,7 @@ if ($action != 'create_updater' && $action != 'edit_updater') print 'id.'">'.img_delete().''; print ''; } - } - else { + } else { print ''; @@ -274,8 +273,7 @@ if ($action != 'create_variable' && $action != 'edit_variable') print 'id.'">'.img_delete().''; print ''; } - } - else { + } else { print ''; diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 8ac181e64c9..23b1cb43f56 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -81,8 +81,7 @@ if ($action == 'setcodeproduct') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -110,16 +109,14 @@ if ($action == 'other') $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES_BY_QTY', 0, 'chaine', 0, '', $conf->entity); $res = dolibarr_set_const($db, 'PRODUIT_CUSTOMER_PRICES', 0, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'PRODUCT_PRICE_UNIQ', 1, 'chaine', 0, '', $conf->entity); - } - else { + } else { $multirule = explode('&', $princingrules); foreach ($multirule as $rulesselected) { $res = dolibarr_set_const($db, $rulesselected, 1, 'chaine', 0, '', $conf->entity); } } - } - else // We clear this mode + } else // We clear this mode { if (strpos($rule, '&') === false) { $res = dolibarr_set_const($db, $rule, 0, 'chaine', 0, '', $conf->entity); @@ -199,13 +196,11 @@ if ($action == 'specimen') // For products { header("Location: ".DOL_URL_ROOT."/document.php?modulepart=product&file=SPECIMEN.pdf"); return; - } - else { + } else { setEventMessages($obj->error, $obj->errors, 'errors'); dol_syslog($obj->error, LOG_ERR); } - } - else { + } else { setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors'); dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR); } @@ -266,8 +261,7 @@ if ($action) if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("SetupNotError"), null, 'errors'); } } @@ -284,8 +278,7 @@ if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $tab = $langs->trans('Services'); -} -elseif (empty($conf->service->enabled)) +} elseif (empty($conf->service->enabled)) { $title = $langs->trans('ProductSetup'); $tab = $langs->trans('Products'); @@ -333,8 +326,7 @@ foreach ($dirproduct as $dirroot) try { dol_include_once($dirroot.$file.'.php'); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -356,8 +348,7 @@ foreach ($dirproduct as $dirroot) print '\n"; - } - else { + } else { $disabled = false; if (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); print ''; - } - else { + } else { print '"; @@ -480,8 +469,7 @@ foreach ($dirmodels as $reldir) if ($conf->global->PRODUCT_ADDON_PDF == $name) { print img_picto($langs->trans("Default"), 'on'); - } - else { + } else { print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; @@ -507,8 +495,7 @@ foreach ($dirmodels as $reldir) if ($module->type == 'pdf') { print ''.img_object($langs->trans("Preview"), 'contract').''; - } - else { + } else { print img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print ''; @@ -561,8 +548,7 @@ print ''; if (empty($conf->multicompany->enabled)) { print ''; -} -else { +} else { print ''; } print ''; -} -else { +} else { print ''; - } - else { + } else { print ''; print ''; } @@ -1193,8 +1170,7 @@ else { print '
'.$langs->trans("CreateSurveyDate").'
'; print $langs->trans("None"); print '
'; print $langs->trans("None"); print '
'."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; @@ -397,8 +388,7 @@ if ($resql) array_push($def, $array[0]); $i++; } -} -else { +} else { dol_print_error($db); } @@ -468,8 +458,7 @@ foreach ($dirmodels as $reldir) print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''."\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "
'.$langs->trans("PricingRule").''.$form->textwithpicto($langs->trans("PricingRule"), $langs->trans("SamePriceAlsoForSharedCompanies"), 1).''; @@ -605,8 +591,7 @@ if (empty($conf->use_javascript_ajax)) print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print ''; $arrval = array( '0'=>$langs->trans("No"), @@ -730,8 +715,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) print img_picto($langs->trans("Active"), 'tick'); print ''; print ''.$langs->trans("Disable").''; - } - else { + } else { print ' '; print ''.$langs->trans("Activate").''; } @@ -742,8 +726,7 @@ if (!empty($conf->global->PRODUCT_CANVAS_ABILITY)) } closedir($handle); } - } - else { + } else { setEventMessages($dir.' '.$langs->trans("IsNotADir"), null, 'errors'); } } diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index 7814c3bcda8..1e67a1d469a 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -65,8 +65,7 @@ if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $textobject = $langs->trans('Services'); -} -elseif (empty($conf->service->enabled)) +} elseif (empty($conf->service->enabled)) { $title = $langs->trans('ProductSetup'); $textobject = $langs->trans('Products'); diff --git a/htdocs/product/admin/product_supplier_extrafields.php b/htdocs/product/admin/product_supplier_extrafields.php index d35e6012e1f..b400843ab5c 100644 --- a/htdocs/product/admin/product_supplier_extrafields.php +++ b/htdocs/product/admin/product_supplier_extrafields.php @@ -66,8 +66,7 @@ if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $textobject = $langs->trans('Services'); -} -elseif (empty($conf->service->enabled)) +} elseif (empty($conf->service->enabled)) { $title = $langs->trans('ProductSetup'); $textobject = $langs->trans('Products'); diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 898d23ae8fb..ce7bcf733a5 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -120,8 +120,7 @@ if ($action == 'convert') { $newprice = price2num($objectstatic->multiprices_ttc[$level], 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->multiprices_min_ttc[$level]; - } - else { + } else { $newprice = price2num($objectstatic->multiprices[$level], 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->multiprices_min[$level]; } @@ -150,8 +149,7 @@ if ($action == 'convert') { $newprice = price2num($objectstatic->price_ttc, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->price_min_ttc; - } - else { + } else { $newprice = price2num($objectstatic->price, 'MU'); // Second param must be MU (we want a unit price so 'MU'. If unit price was on 4 decimal, we must keep 4 decimals) $newminprice = $objectstatic->price_min; } @@ -174,8 +172,7 @@ if ($action == 'convert') $i++; } - } - else dol_print_error($db); + } else dol_print_error($db); } $fourn = new Fournisseur($db); @@ -243,14 +240,12 @@ if ($action == 'convert') $i++; } - } - else dol_print_error($db); + } else dol_print_error($db); if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } @@ -259,8 +254,7 @@ if ($action == 'convert') { if ($nbrecordsmodified > 0) setEventMessages($langs->trans("RecordsModified", $nbrecordsmodified), null, 'mesgs'); else setEventMessages($langs->trans("NoRecordFound"), null, 'warnings'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -285,8 +279,7 @@ if (empty($mysoc->country_code)) $langs->load("errors"); $warnpicto = img_error($langs->trans("WarningMandatorySetupNotComplete")); print '
'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").''; -} -else { +} else { print '
'; print ''; print ''; diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index 3d0dc302283..acd698d9f37 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -40,8 +40,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/product/ajax/products.php b/htdocs/product/ajax/products.php index 219e68171d2..f206d868347 100644 --- a/htdocs/product/ajax/products.php +++ b/htdocs/product/ajax/products.php @@ -162,8 +162,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) } echo json_encode($outjson); -} -else { +} else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->loadLangs(array("main", "products")); diff --git a/htdocs/product/canvas/product/actions_card_product.class.php b/htdocs/product/canvas/product/actions_card_product.class.php index da99efc337d..c14bfaf5e74 100644 --- a/htdocs/product/canvas/product/actions_card_product.class.php +++ b/htdocs/product/canvas/product/actions_card_product.class.php @@ -287,8 +287,7 @@ class ActionsCardProduct $i++; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db, $sql); } } @@ -406,14 +405,12 @@ class ActionsCardProduct $this->type = $obj->fk_product_type; $this->entity = $obj->entity; $datas[$alias] = $this->getNomUrl(1, '', 24); - } - elseif ($alias == 'stock') + } elseif ($alias == 'stock') { $this->load_stock(); if ($this->stock_reel < $obj->seuil_stock_alerte) $datas[$alias] = $this->stock_reel.' '.img_warning($langs->trans("StockTooLow")); else $datas[$alias] = $this->stock_reel; - } - elseif ($alias == 'label') $datas[$alias] = dol_trunc($obj->$alias, 40); + } elseif ($alias == 'label') $datas[$alias] = dol_trunc($obj->$alias, 40); elseif (preg_match('/price/i', $alias)) $datas[$alias] = price($obj->$alias); elseif ($alias == 'datem') $datas[$alias] = dol_print_date($this->db->jdate($obj->$alias), 'day'); elseif ($alias == 'status') $datas[$alias] = $this->LibStatut($obj->$alias, 5); @@ -426,8 +423,7 @@ class ActionsCardProduct $i++; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/product/canvas/service/actions_card_service.class.php b/htdocs/product/canvas/service/actions_card_service.class.php index aaf9b584068..0518cfed475 100644 --- a/htdocs/product/canvas/service/actions_card_service.class.php +++ b/htdocs/product/canvas/service/actions_card_service.class.php @@ -205,8 +205,7 @@ class ActionsCardService if ($this->object->duration_value > 1) { $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); - } - elseif ($this->object->duration_value > 0) + } elseif ($this->object->duration_value > 0) { $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } @@ -267,8 +266,7 @@ class ActionsCardService $i++; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db, $sql); } } @@ -359,8 +357,7 @@ class ActionsCardService $i++; } $this->db->free($resql); - } - else { + } else { print $sql; } } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index bd18737bd6b..657add84bd1 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -174,8 +174,7 @@ if (empty($reshook)) $result = $object->setValueFrom('barcode', GETPOST('barcode'), '', null, 'text', '', $user, 'PRODUCT_MODIFY'); header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { $langs->load("errors"); if ($result == -1) $errors[] = 'ErrorBadBarCodeSyntax'; elseif ($result == -2) $errors[] = 'ErrorBarCodeRequired'; @@ -336,8 +335,7 @@ if (empty($reshook)) { $object->multiprices["$i"] = price2num($_POST["price_".$i], 'MU'); $object->multiprices_base_type["$i"] = $_POST["multiprices_base_type_".$i]; - } - else { + } else { $object->multiprices["$i"] = ""; } } @@ -364,13 +362,11 @@ if (empty($reshook)) if (preg_match('/\?/', $backtopage)) $backtopage .= '&socid='.$object->id; // Old method header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: ".$_SERVER['PHP_SELF']."?id=".$id); exit; } - } - else { + } else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = "create"; @@ -384,8 +380,7 @@ if (empty($reshook)) if (GETPOST('cancel', 'alpha')) { $action = ''; - } - else { + } else { if ($object->id > 0) { $object->oldcopy = clone $object; @@ -481,14 +476,12 @@ if (empty($reshook)) $object->setCategories($categories); $action = 'view'; - } - else { + } else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); $action = 'edit'; } - } - else { + } else { if (count($object->errors)) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans("ErrorProductBadRefOrLabel"), null, 'errors'); $action = 'edit'; @@ -504,8 +497,7 @@ if (empty($reshook)) if (!GETPOST('clone_content') && !GETPOST('clone_prices')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { $db->begin(); $originalId = $id; @@ -567,8 +559,7 @@ if (empty($reshook)) header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; - } - else { + } else { $id = $originalId; if ($object->error == 'ErrorProductAlreadyExists') @@ -582,15 +573,13 @@ if (empty($reshook)) $mesg .= ' '.$langs->trans("ShowCardHere").'.'; setEventMessages($mesg, null, 'errors'); $object->fetch($id); - } - else { + } else { $db->rollback(); if (count($object->errors)) { setEventMessages($object->error, $object->errors, 'errors'); dol_print_error($db, $object->errors); - } - else { + } else { setEventMessages($langs->trans($object->error), null, 'errors'); dol_print_error($db, $object->error); } @@ -599,8 +588,7 @@ if (empty($reshook)) unset($object->context['createfromclone']); } - } - else { + } else { $db->rollback(); dol_print_error($db, $object->error); } @@ -617,8 +605,7 @@ if (empty($reshook)) { header('Location: '.DOL_URL_ROOT.'/product/list.php?type='.$object->type.'&delprod='.urlencode($object->ref)); exit; - } - else { + } else { setEventMessages($langs->trans($object->error), null, 'errors'); $reload = 0; $action = ''; @@ -640,8 +627,7 @@ if (empty($reshook)) exit; } $thirpdartyid = $propal->socid; - } - elseif (GETPOST('commandeid') > 0) + } elseif (GETPOST('commandeid') > 0) { $commande = new Commande($db); $result = $commande->fetch(GETPOST('commandeid')); @@ -651,8 +637,7 @@ if (empty($reshook)) exit; } $thirpdartyid = $commande->socid; - } - elseif (GETPOST('factureid') > 0) + } elseif (GETPOST('factureid') > 0) { $facture = new Facture($db); $result = $facture->fetch(GETPOST('factureid')); @@ -727,8 +712,7 @@ if (empty($reshook)) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); - } - else { + } else { $buyprice = $result; } @@ -769,8 +753,7 @@ if (empty($reshook)) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); - } - else { + } else { $buyprice = $result; } @@ -811,8 +794,7 @@ if (empty($reshook)) { dol_syslog($langs->trans('FailedToGetCostPrice')); setEventMessages($langs->trans('FailedToGetCostPrice'), null, 'errors'); - } - else { + } else { $buyprice = $result; } @@ -852,8 +834,7 @@ if (empty($reshook)) exit; } } - } - else { + } else { $action = ""; setEventMessages($langs->trans("WarningSelectOneDocument"), null, 'warnings'); } @@ -918,8 +899,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) } $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -955,8 +935,7 @@ else { if ($type == 1) { $picto = 'service'; $title = $langs->trans("NewService"); - } - else { + } else { $picto = 'product'; $title = $langs->trans("NewProduct"); } @@ -1010,8 +989,7 @@ else { if (isset($_POST['fk_barcode_type'])) { $fk_barcode_type = GETPOST('fk_barcode_type'); - } - else { + } else { if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbarcode.class.php'; @@ -1059,8 +1037,7 @@ else { print '
'.$form->textwithpicto($langs->trans("DesiredStock"), $langs->trans("DesiredStockDesc"), 1).''; print ''; print '
'; print '
'; - } - else { + } else { print ''; // Price @@ -1298,8 +1274,7 @@ else { } print $formaccounting->select_account($accountancy_code_buy_export, 'accountancy_code_buy_export', 1, null, 1, 1, ''); print ''; - } - else // For external software + } else // For external software { // Accountancy_code_sell print ''; @@ -1348,14 +1323,10 @@ else { print ''; print ''; - } - - /* - * Product card - */ - - elseif ($object->id > 0) - { + } elseif ($object->id > 0) { + /* + * Product card + */ // Fiche en mode edition if ($action == 'edit' && $usercancreate) { @@ -1393,8 +1364,7 @@ else { { print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -1408,8 +1378,7 @@ else { { print ''; print ''; - } - else { + } else { print ''; print ''; } @@ -1438,8 +1407,7 @@ else { if (isset($_POST['fk_barcode_type'])) { $fk_barcode_type = GETPOST('fk_barcode_type'); - } - else { + } else { $fk_barcode_type = $object->barcode_type; if (empty($fk_barcode_type) && !empty($conf->global->PRODUIT_DEFAULT_BARCODE_TYPE)) $fk_barcode_type = $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE; } @@ -1500,8 +1468,7 @@ else { print ' '; print $formproduct->selectMeasuringUnits("duration_unit", "time", $object->duration_unit, 0, 1); print ''; - } - else { + } else { // Nature print ''; - } - else // For external software - { + } else { + // For external software // Accountancy_code_sell print ''; print ''."\n"; @@ -1974,16 +1938,14 @@ else { if ($object->duration_value > 1) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); - } - elseif ($object->duration_value > 0) + } elseif ($object->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? $langs->trans($dur[$object->duration_unit]) : '')." "; print ''; - } - else { + } else { // Nature print '\n"; @@ -2010,8 +1971,7 @@ else { if ($object->width) print " x ".$object->width; if ($object->height) print " x ".$object->height; print ' '.measuringUnitString(0, "size", $object->length_units); - } - else { + } else { print ' '; } print "\n"; @@ -2023,8 +1983,7 @@ else { if ($object->surface != '') { print $object->surface." ".measuringUnitString(0, "surface", $object->surface_units); - } - else { + } else { print ' '; } print "\n"; @@ -2036,8 +1995,7 @@ else { if ($object->volume != '') { print $object->volume." ".measuringUnitString(0, "volume", $object->volume_units); - } - else { + } else { print ' '; } print "\n"; @@ -2050,8 +2008,7 @@ else { if ($object->net_measure != '') { print $object->net_measure." ".measuringUnitString($object->net_measure_units); - } - else { + } else { print ' '; } } @@ -2105,8 +2062,7 @@ else { dol_fiche_end(); } - } - elseif ($action != 'create') + } elseif ($action != 'create') { exit; } @@ -2179,8 +2135,7 @@ if ($action != 'create' && $action != 'edit') if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { print ''.$langs->trans('ToClone').''."\n"; - } - else { + } else { print 'id.'">'.$langs->trans("ToClone").''; } } @@ -2194,16 +2149,13 @@ if ($action != 'create' && $action != 'edit') if (!empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile)) { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print 'id.'">'.$langs->trans("Delete").''; } - } - else { + } else { print ''.$langs->trans("Delete").''; } - } - else { + } else { print ''.$langs->trans("Delete").''; } } @@ -2236,8 +2188,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $langs->trans("AddToDraftProposals").''; - } - else { + } else { $html .= ''; - } - else { + } else { $html .= ''; - } - else { + } else { $html .= ''; @@ -241,8 +235,7 @@ if ($id > 0 || !empty($ref)) if ($object->price_base_type == 'TTC') { print price($object->price_min_ttc).' '.$langs->trans($object->price_base_type); - } - else { + } else { print price($object->price_min).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print ''; @@ -292,8 +285,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''; } - } - else { + } else { print ''; print ''; print ''; @@ -370,8 +362,7 @@ if ($id > 0 || !empty($ref)) if (!empty($conf->global->PRODUIT_MULTIPRICES)) { $pricesell = 'Variable'; - } - else { + } else { $totallinesell = price2num($value['nb'] * ($pricesell), 'MT'); $totalsell += $totallinesell; } @@ -389,15 +380,13 @@ if ($id > 0 || !empty($ref)) { print ''; print ''; - } - else { + } else { print ''; print ''; } print ''."\n"; - } - else { + } else { $hide = ''; if (empty($conf->global->PRODUCT_SHOW_SUB_SUB_PRODUCTS)) $hide = ' hideobject'; // By default, we do not show this. It makes screen very difficult to understand @@ -459,8 +448,7 @@ if ($id > 0 || !empty($ref)) } print ''; print ''."\n"; - } - else { + } else { $colspan = 8; if (!empty($conf->stock->enabled)) $colspan++; @@ -589,8 +577,7 @@ if ($id > 0 || !empty($ref)) //$addchecked = ' checked'; $qty = $object->is_sousproduit_qty; $incdec = $object->is_sousproduit_incdec; - } - else { + } else { //$addchecked = ''; $qty = 0; $incdec = 0; @@ -623,8 +610,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''; } - } - else { + } else { dol_print_error($db); } print '
'.$langs->trans("ProductAccountancySellCode").'
'.$langs->trans("Nature").''; $statutarray = array('-1'=>' ', '1' => $langs->trans("Finished"), '0' => $langs->trans("RowMaterial")); @@ -1656,9 +1623,8 @@ else { print ''; print $formaccounting->select_account($object->accountancy_code_buy_export, 'accountancy_code_buy_export', 1, '', 1, 1); print '
'.$langs->trans("ProductAccountancySellCode").''; @@ -1763,8 +1729,7 @@ else { if ($action == 'editbarcodetype') { print $formbarcode->formBarcodeType($_SERVER['PHP_SELF'].'?id='.$object->id, $object->barcode_type, 'fk_barcode_type'); - } - else { + } else { $object->fetch_barcode(); print $object->barcode_type_label ? $object->barcode_type_label : ($object->barcode ? '
'.$langs->trans("SetDefaultBarcodeType").'
' : ''); } @@ -1790,8 +1755,7 @@ else { print ''; print ' '; print ''; - } - else { + } else { print $object->barcode; } print '
'.$langs->trans("Nature").''; print $object->getLibFinished(); @@ -1994,8 +1956,7 @@ else { if ($object->weight != '') { print $object->weight." ".measuringUnitString(0, "weight", $object->weight_units); - } - else { + } else { print ' '; } print "
'; $html .= $form->selectarray("propalid", $otherprop, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftProposals").''; $html .= $langs->trans("NoDraftProposals"); @@ -2259,8 +2210,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $langs->trans("AddToDraftOrders").''; $html .= $form->selectarray("commandeid", $othercom, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftOrders").''; $html .= $langs->trans("NoDraftOrders"); @@ -2282,8 +2232,7 @@ if (!empty($conf->global->PRODUCT_ADD_FORM_ADD_TO) && $object->id && ($action == $html .= $langs->trans("AddToDraftInvoices").''; $html .= $form->selectarray("factureid", $otherinvoice, 0, 1); $html .= '
'; $html .= $langs->trans("AddToDraftInvoices").''; $html .= $langs->trans("NoDraftInvoices"); diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php index 66cef158439..e7fce1b480f 100644 --- a/htdocs/product/class/api_products.class.php +++ b/htdocs/product/class/api_products.class.php @@ -221,8 +221,7 @@ class Products extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -316,8 +315,7 @@ class Products extends DolibarrApi } if ($this->product->price_min_ttc != $oldproduct->price_min_ttc) { $pricemodified = true; } - } - else { + } else { if ($this->product->price != $oldproduct->price) { $pricemodified = true; } if ($this->product->price_min != $oldproduct->price_min) { $pricemodified = true; @@ -811,8 +809,7 @@ class Products extends DolibarrApi $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve product list : '.$db->lasterror()); } if (!count($obj_ret)) { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index b38501cb788..30445615413 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -101,12 +101,10 @@ class FormProduct if (!empty($batch)) { $sql .= ", pb.qty as stock"; - } - else { + } else { $sql .= ", ps.reel as stock"; } - } - elseif ($sumStock) + } elseif ($sumStock) { $sql .= ", sum(ps.reel) as stock"; } @@ -124,8 +122,7 @@ class FormProduct if (count($warehouseStatus)) { $sql .= " AND e.statut IN (".$this->db->escape(implode(',', $warehouseStatus)).")"; - } - else { + } else { $sql .= " AND e.statut = 1"; } @@ -176,8 +173,7 @@ class FormProduct } return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -267,8 +263,7 @@ class FormProduct { if ($arraytypes['stock'] <= 0) { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; - } - else { + } else { $label .= ' ('.$langs->trans("Stock").':'.$arraytypes['stock'].')'; } } @@ -432,8 +427,7 @@ class FormProduct if (!is_array($objectLines) || !count($objectLines)) { if (!empty($fk_product)) $productIdArray[] = $fk_product; - } - else { + } else { foreach ($objectLines as $line) { if ($line->fk_product) $productIdArray[] = $line->fk_product; } @@ -453,8 +447,7 @@ class FormProduct if (!empty($fk_product)) { $productIdArray = array($fk_product); // only show lot stock for product - } - else { + } else { foreach ($this->cache_lot as $key => $value) { $productIdArray[] = $key; @@ -471,8 +464,7 @@ class FormProduct $label .= $arraytypes['batch']; if ($arraytypes['qty'] <= 0) { $label .= ' ('.$langs->trans("Stock").' '.$arraytypes['qty'].')'; - } - else { + } else { $label .= ' ('.$langs->trans("Stock").' '.$arraytypes['qty'].')'; } @@ -520,8 +512,7 @@ class FormProduct if ($cacheLoaded) { return count($this->cache_lot); - } - else { + } else { // clear cache $this->cache_lot = array(); $productIdList = implode(',', $productIdArray); @@ -553,8 +544,7 @@ class FormProduct } return $num; - } - else { + } else { dol_print_error($this->db); return -1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index f072d04916e..6e559c3e7fb 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -456,8 +456,7 @@ class Product extends CommonObject if ($err > 0) { return 0; - } - else { + } else { return 1; } } @@ -681,30 +680,25 @@ class Product extends CommonObject if ($this->update($id, $user, true, 'add') <= 0) { $error++; } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } - } - else { + } else { $error++; $this->error = 'ErrorFailedToGetInsertedId'; } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } - } - else { + } else { // Product already exists with this ref $langs->load("products"); $error++; $this->error = "ErrorProductAlreadyExists"; } - } - else { + } else { $error++; $this->error = $this->db->lasterror(); } @@ -720,13 +714,11 @@ class Product extends CommonObject if (!$error) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -$error; } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -756,11 +748,9 @@ class Product extends CommonObject if ($rescode) { if ($rescode == -1) { $this->errors[] = 'ErrorBadBarCodeSyntax'; - } - elseif ($rescode == -2) { + } elseif ($rescode == -2) { $this->errors[] = 'ErrorBarCodeRequired'; - } - elseif ($rescode == -3) { + } elseif ($rescode == -3) { // Note: Common usage is to have barcode unique. For variants, we should have a different barcode. $this->errors[] = 'ErrorBarCodeAlreadyUsed'; } @@ -802,8 +792,7 @@ class Product extends CommonObject dol_syslog(get_class($this)."::check_barcode value=".$valuetotest." type=".$typefortest." module=".$module); $result = $mod->verif($this->db, $valuetotest, $this, 0, $typefortest); return $result; - } - else { + } else { return 0; } } @@ -1094,13 +1083,11 @@ class Product extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -$error; } - } - else { + } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); if (empty($conf->barcode->enabled) || empty($this->barcode)) { @@ -1111,16 +1098,14 @@ class Product extends CommonObject $this->errors[] = $this->error; $this->db->rollback(); return -1; - } - else { + } else { $this->error = $langs->trans("Error")." : ".$this->db->error()." - ".$sql; $this->errors[] = $this->error; $this->db->rollback(); return -2; } } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::Update fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1267,8 +1252,7 @@ class Product extends CommonObject if (!$error) { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -1277,8 +1261,7 @@ class Product extends CommonObject $this->db->rollback(); return -$error; } - } - else { + } else { $this->error = "ErrorRecordIsUsedCantDelete"; return 0; } @@ -1316,8 +1299,7 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note='".$this->db->escape($this->other)."'"; } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1334,8 +1316,7 @@ class Product extends CommonObject $this->error = $this->db->lasterror(); return -1; } - } - elseif (isset($this->multilangs[$key])) { + } elseif (isset($this->multilangs[$key])) { $sql = "SELECT rowid"; $sql .= " FROM ".MAIN_DB_PREFIX."product_lang"; $sql .= " WHERE fk_product=".$this->id; @@ -1353,8 +1334,7 @@ class Product extends CommonObject $sql2 .= ", note='".$this->db->escape($this->multilangs["$key"]["other"])."'"; } $sql2 .= " WHERE fk_product=".$this->id." AND lang='".$this->db->escape($key)."'"; - } - else { + } else { $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description"; if (!empty($conf->global->PRODUCT_USE_OTHER_FIELD_IN_TRANSLATION)) { $sql2 .= ", note"; } @@ -1374,8 +1354,7 @@ class Product extends CommonObject return -1; } } - } - else { + } else { // language is not current language and we didn't provide a multilang description for this language } } @@ -1416,8 +1395,7 @@ class Product extends CommonObject } // End call triggers return 1; - } - else { + } else { $this->error = $this->db->lasterror(); dol_syslog(get_class($this).'::delMultiLangs error='.$this->error, LOG_ERR); return -1; @@ -1478,8 +1456,7 @@ class Product extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1517,8 +1494,7 @@ class Product extends CommonObject $this->multilangs["$obj->lang"]["other"] = $obj->other; } return 1; - } - else { + } else { $this->error = "Error: ".$this->db->lasterror()." - ".$sql; return -1; } @@ -1559,8 +1535,7 @@ class Product extends CommonObject $this->error = $this->db->lasterror(); dol_print_error($this->db); return -1; - } - else { + } else { return 1; } } @@ -1586,8 +1561,7 @@ class Product extends CommonObject $resql = $this->db->query($sql); if ($resql) { return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -1663,8 +1637,7 @@ class Product extends CommonObject if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1683,8 +1656,7 @@ class Product extends CommonObject if ($priceforthequantityarray['price_base_type'] == 'HT') { $pu_ht = $priceforthequantityarray['unitprice']; - } - else { + } else { $pu_ttc = $priceforthequantityarray['unitprice']; } break; @@ -1766,8 +1738,7 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $this->packaging = $obj->packaging; $result = $obj->fk_product; return $result; - } - else // If not found + } else // If not found { // We do a second search by doing a select again but searching with less reliable criteria: couple qty/id product, and if set fourn_ref or fk_soc. $sql = "SELECT pfp.rowid, pfp.price as price, pfp.quantity as quantity, pfp.fk_soc,"; @@ -1826,18 +1797,15 @@ class Product extends CommonObject if (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING)) $this->packaging = $obj->packaging; $result = $obj->fk_product; return $result; - } - else { + } else { return -1; // Ce produit n'existe pas avec cet id tarif fournisseur ou existe mais qte insuffisante, ni pour le couple produit/ref fournisseur dans la quantité. } - } - else { + } else { $this->error = $this->db->lasterror(); return -3; } } - } - else { + } else { $this->error = $this->db->lasterror(); return -2; } @@ -1908,13 +1876,11 @@ class Product extends CommonObject $price_min_ttc = price2num($newminprice, 'MU'); $price_min = price2num($newminprice) / (1 + ($newvat / 100)); $price_min = price2num($price_min, 'MU'); - } - else { + } else { $price_min = 0; $price_min_ttc = 0; } - } - else { + } else { $price = price2num($newprice, 'MU'); $price_ttc = ($newnpr != 1) ? price2num($newprice) * (1 + ($newvat / 100)) : $price; $price_ttc = price2num($price_ttc, 'MU'); @@ -1924,8 +1890,7 @@ class Product extends CommonObject $price_min_ttc = price2num($newminprice) * (1 + ($newvat / 100)); $price_min_ttc = price2num($price_min_ttc, 'MU'); //print 'X'.$newminprice.'-'.$price_min; - } - else { + } else { $price_min = 0; $price_min_ttc = 0; } @@ -1937,8 +1902,7 @@ class Product extends CommonObject $localtax1 = $localtaxes_array['1']; $localtaxtype2 = $localtaxes_array['2']; $localtax2 = $localtaxes_array['3']; - } - else // old method. deprecated because ot can't retreive type + } else // old method. deprecated because ot can't retreive type { $localtaxtype1 = '0'; $localtax1 = get_localtax($newvat, 1); @@ -2013,8 +1977,7 @@ class Product extends CommonObject // End call triggers $this->db->commit(); - } - else { + } else { $this->db->rollback(); dol_print_error($this->db); } @@ -2248,18 +2211,15 @@ class Product extends CommonObject return -1; } }*/ - } - else { + } else { dol_print_error($this->db); return -1; } } - } - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && empty($ignore_price_load)) // prices per customers + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES) && empty($ignore_price_load)) // prices per customers { // Nothing loaded by default. List may be very long. - } - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) && empty($ignore_price_load)) // prices per quantity + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY) && empty($ignore_price_load)) // prices per quantity { $sql = "SELECT price, price_ttc, price_min, price_min_ttc,"; $sql .= " price_base_type, tva_tx, default_vat_code, tosell, price_by_qty, rowid"; @@ -2296,19 +2256,16 @@ class Product extends CommonObject $ii++; } $this->prices_by_qty_list[0] = $resultat; - } - else { + } else { dol_print_error($this->db); return -1; } } - } - else { + } else { dol_print_error($this->db); return -1; } - } - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES) && empty($ignore_price_load)) // prices per customer and quantity + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES) && empty($ignore_price_load)) // prices per customer and quantity { for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i++) { @@ -2358,14 +2315,12 @@ class Product extends CommonObject $ii++; } $this->prices_by_qty_list[$i] = $resultat; - } - else { + } else { dol_print_error($this->db); return -1; } } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2389,12 +2344,10 @@ class Product extends CommonObject $this->stock_warehouse = array(); return 1; - } - else { + } else { return 0; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2467,8 +2420,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_propale = $hookmanager->resArray['stats_propale']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2517,8 +2469,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_proposal_supplier = $hookmanager->resArray['stats_proposal_supplier']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2619,8 +2570,7 @@ class Product extends CommonObject $reshook = $hookmanager->executeHooks('loadStatsCustomerOrder', $parameters, $this, $action); if ($reshook > 0) $this->stats_commande = $hookmanager->resArray['stats_commande']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2675,8 +2625,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_commande_fournisseur = $hookmanager->resArray['stats_commande_fournisseur']; return 1; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -2758,8 +2707,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_expedition = $hookmanager->resArray['stats_expedition']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2810,8 +2758,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_reception = $hookmanager->resArray['stats_reception']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2900,8 +2847,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_mrptoproduce = $hookmanager->resArray['stats_mrptoproduce']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2973,8 +2919,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_contrat = $hookmanager->resArray['stats_contrat']; return 1; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3046,8 +2991,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_facture = $hookmanager->resArray['stats_facture']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3098,8 +3042,7 @@ class Product extends CommonObject if ($reshook > 0) $this->stats_facture_fournisseur = $hookmanager->resArray['stats_facture_fournisseur']; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -3132,8 +3075,7 @@ class Product extends CommonObject } $i++; } - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; return -1; } @@ -3141,8 +3083,7 @@ class Product extends CommonObject if (empty($year)) { $year = strftime('%Y', time()); $month = strftime('%m', time()); - } - else { + } else { $month = 12; // We imagine we are at end of year, so we get last 12 month before, so all correct year. } $result = array(); @@ -3622,23 +3563,20 @@ class Product extends CommonObject if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; - } - else { + } else { $result = $this->db->query($sql); if ($result) { $num = $this->db->num_rows($result); if ($num > 0) { $this->error = "isFatherOfThis"; return -1; - } - else { + } else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'product_association(fk_product_pere,fk_product_fils,qty,incdec)'; $sql .= ' VALUES ('.$id_pere.', '.$id_fils.', '.$qty.', '.$incdec.')'; if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; - } - else { + } else { return 1; } } @@ -3681,8 +3619,7 @@ class Product extends CommonObject if (!$this->db->query($sql)) { dol_print_error($this->db); return -1; - } - else { + } else { return 1; } } @@ -3744,12 +3681,10 @@ class Product extends CommonObject $this->is_sousproduit_incdec = $obj->incdec; return true; - } - else { + } else { return false; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -3838,8 +3773,7 @@ class Product extends CommonObject if ($this->db->query($sql)) { $this->product_fourn_price_id = $this->db->last_insert_id(MAIN_DB_PREFIX."product_fournisseur_price"); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -3849,8 +3783,7 @@ class Product extends CommonObject $this->product_fourn_price_id = $obj->rowid; return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); return -2; } @@ -4045,8 +3978,7 @@ class Product extends CommonObject if (!$resql) { $this->db->rollback(); return -1; - } - else { + } else { $this->db->commit(); return 1; } @@ -4156,8 +4088,7 @@ class Product extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj) { $nb = $obj->nb; } - } - else { + } else { return -1; } @@ -4241,8 +4172,7 @@ class Product extends CommonObject $prods[$record['id']]['entity'] = $record['entity']; } return $prods; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -4305,8 +4235,7 @@ class Product extends CommonObject } return $prods; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -4433,8 +4362,7 @@ class Product extends CommonObject $linkclose .= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose .= ' class="nowraponall classfortooltip"'; - } - else { + } else { $linkclose = ' class="nowraponall"'; } @@ -4508,8 +4436,7 @@ class Product extends CommonObject if (!dol_strlen($modele)) { if (!empty($conf->global->PRODUCT_ADDON_PDF)) { $modele = $conf->global->PRODUCT_ADDON_PDF; - } - else { + } else { $modele = 'strato'; } } @@ -4591,27 +4518,22 @@ class Product extends CommonObject if ($type == 0) { $labelStatus = $langs->trans('ProductStatusNotOnSellShort'); $labelStatusShort = $langs->trans('ProductStatusNotOnSell'); - } - elseif ($type == 1) { + } elseif ($type == 1) { $labelStatus = $langs->trans('ProductStatusNotOnBuyShort'); $labelStatusShort = $langs->trans('ProductStatusNotOnBuy'); - } - elseif ($type == 2) { + } elseif ($type == 2) { $labelStatus = $langs->trans('ProductStatusNotOnBatch'); $labelStatusShort = $langs->trans('ProductStatusNotOnBatchShort'); } - } - elseif ($status == 1) { + } elseif ($status == 1) { // $type 0=Status "to sell", 1=Status "to buy", 2=Status "to Batch" if ($type == 0) { $labelStatus = $langs->trans('ProductStatusOnSellShort'); $labelStatusShort = $langs->trans('ProductStatusOnSell'); - } - elseif ($type == 1) { + } elseif ($type == 1) { $labelStatus = $langs->trans('ProductStatusOnBuyShort'); $labelStatusShort = $langs->trans('ProductStatusOnBuy'); - } - elseif ($type == 2) { + } elseif ($type == 2) { $labelStatus = $langs->trans('ProductStatusOnBatch'); $labelStatusShort = $langs->trans('ProductStatusOnBatchShort'); } @@ -4677,8 +4599,7 @@ class Product extends CommonObject if ($result >= 0) { $this->db->commit(); return 1; - } - else { + } else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4724,8 +4645,7 @@ class Product extends CommonObject if ($result >= 0) { $this->db->commit(); return 1; - } - else { + } else { $this->error = $movementstock->error; $this->errors = $movementstock->errors; @@ -4803,8 +4723,7 @@ class Product extends CommonObject } return 1; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -4888,24 +4807,19 @@ class Product extends CommonObject // Stock decrease mode if (!empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT) || !empty($conf->global->STOCK_CALCULATE_ON_SHIPMENT_CLOSE)) { $this->stock_theorique -= ($stock_commande_client - $stock_sending_client); - } - elseif (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) { + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_VALIDATE_ORDER)) { $this->stock_theorique += 0; - } - elseif (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_BILL)) { $this->stock_theorique -= $stock_commande_client; } // Stock Increase mode if (!empty($conf->global->STOCK_CALCULATE_ON_RECEPTION) || !empty($conf->global->STOCK_CALCULATE_ON_RECEPTION_CLOSE)) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); - } - elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_DISPATCH_ORDER)) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); - } - elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER)) { $this->stock_theorique -= $stock_reception_fournisseur; - } - elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { + } elseif (!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) { $this->stock_theorique += ($stock_commande_fournisseur - $stock_reception_fournisseur); } @@ -4949,8 +4863,7 @@ class Product extends CommonObject $i++; } return $result; - } - else { + } else { dol_print_error($this->db); $this->db->rollback(); return array(); @@ -5187,8 +5100,7 @@ class Product extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -5323,8 +5235,7 @@ class Product extends CommonObject $label = ($label_type == 'short' ? $res[$label_type] : 'unit'.$res['code']); $this->db->free($resql); return $label; - } - else { + } else { $this->error = $this->db->error().' sql='.$sql; dol_syslog(get_class($this)."::getLabelOfUnit Error ".$this->error, LOG_ERR); return -1; @@ -5556,8 +5467,7 @@ class Product extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index 3c56221863c..db59efcdfb7 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -119,8 +119,7 @@ class Productbatch extends CommonObject { $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -177,8 +176,7 @@ class Productbatch extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -230,8 +228,7 @@ class Productbatch extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -271,8 +268,7 @@ class Productbatch extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -326,8 +322,7 @@ class Productbatch extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -419,8 +414,7 @@ class Productbatch extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -488,8 +482,7 @@ class Productbatch extends CommonObject $db->free($resql); return $ret; - } - else { + } else { $error = "Error ".$db->lasterror(); return -1; } diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index 26c627ee0e4..331708ff096 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -139,8 +139,7 @@ class Propalmergepdfproduct extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -197,8 +196,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -270,8 +268,7 @@ class Propalmergepdfproduct extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch_by_product ".$this->error, LOG_ERR); return -1; @@ -330,8 +327,7 @@ class Propalmergepdfproduct extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -372,8 +368,7 @@ class Propalmergepdfproduct extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -421,8 +416,7 @@ class Propalmergepdfproduct extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -463,8 +457,7 @@ class Propalmergepdfproduct extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -518,8 +511,7 @@ class Propalmergepdfproduct extends CommonObject { $this->db->commit(); return $object->id; - } - else { + } else { $this->db->rollback(); return -1; } diff --git a/htdocs/product/composition/card.php b/htdocs/product/composition/card.php index 194a342d391..975dcfda831 100644 --- a/htdocs/product/composition/card.php +++ b/htdocs/product/composition/card.php @@ -80,24 +80,20 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se { //var_dump($i.' '.GETPOST("prod_id_".$i, 'int'), $qty, GETPOST("prod_incdec_".$i, 'int')); $action = 'edit'; - } - else { + } else { $error++; $action = 're-edit'; if ($object->error == "isFatherOfThis") { setEventMessages($langs->trans("ErrorAssociationIsFatherOfThis"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } - } - else { + } else { if ($object->del_sousproduit($id, GETPOST("prod_id_".$i, 'int')) > 0) { $action = 'edit'; - } - else { + } else { $error++; $action = 're-edit'; setEventMessages($object->error, $object->errors, 'errors'); @@ -110,8 +106,7 @@ if ($action == 'add_prod' && ($user->rights->produit->creer || $user->rights->se header("Location: ".$_SERVER["PHP_SELF"].'?id='.$object->id); exit; } -} -elseif ($action === 'save_composed_product') +} elseif ($action === 'save_composed_product') { $TProduct = GETPOST('TProduct', 'array'); if (!empty($TProduct)) @@ -230,8 +225,7 @@ if ($id > 0 || !empty($ref)) if ($object->price_base_type == 'TTC') { print price($object->price_ttc).' '.$langs->trans($object->price_base_type); - } - else { + } else { print price($object->price).' '.$langs->trans($object->price_base_type ? $object->price_base_type : 'HT'); } print '
'.$value['qty'].'
'.$langs->trans("None").'
'.$nb_of_subproduct.''.($value['incdec'] == 1 ? 'x' : '').'
'; diff --git a/htdocs/product/document.php b/htdocs/product/document.php index db233fbe84c..4f505bff187 100644 --- a/htdocs/product/document.php +++ b/htdocs/product/document.php @@ -313,8 +313,7 @@ if ($object->id) $filename = $filetoadd['name'].' - '.$langs->trans('Language_'.$default_lang); $checked = ' checked '; } - } - else { + } else { if (array_key_exists($filetoadd['name'], $filetomerge->lines)) { $checked = ' checked '; @@ -336,8 +335,7 @@ if ($object->id) print ''; } } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index 4f40e2b6c6f..cf498d6f998 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -123,8 +123,7 @@ class PriceExpression } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -161,12 +160,10 @@ class PriceExpression $this->title = $obj->title; $this->expression = $obj->expression; return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -202,8 +199,7 @@ class PriceExpression $this->db->free($resql); return $retarray; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -232,12 +228,10 @@ class PriceExpression if ($obj) { return (int) $obj->rowid; - } - else { + } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -295,8 +289,7 @@ class PriceExpression } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -352,8 +345,7 @@ class PriceExpression } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index 7f241518e4c..f2ab8006b02 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -128,8 +128,7 @@ class PriceGlobalVariable } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -161,12 +160,10 @@ class PriceGlobalVariable $this->value = $obj->value; $this->checkParameters(); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -222,8 +219,7 @@ class PriceGlobalVariable } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -278,8 +274,7 @@ class PriceGlobalVariable } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -344,8 +339,7 @@ class PriceGlobalVariable $this->db->free($resql); return $retarray; - } - else { + } else { $this->error = $this->db->error(); return -1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 12e497c0f2c..6706dded094 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -144,8 +144,7 @@ class PriceGlobalVariableUpdater } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -181,12 +180,10 @@ class PriceGlobalVariableUpdater $this->last_status = $obj->last_status; $this->checkParameters(); return 1; - } - else { + } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -246,8 +243,7 @@ class PriceGlobalVariableUpdater } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -301,8 +297,7 @@ class PriceGlobalVariableUpdater } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -394,8 +389,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -435,8 +429,7 @@ class PriceGlobalVariableUpdater $this->db->free($resql); return $retarray; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -591,8 +584,7 @@ class PriceGlobalVariableUpdater } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -636,8 +628,7 @@ class PriceGlobalVariableUpdater } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } diff --git a/htdocs/product/dynamic_price/class/price_parser.class.php b/htdocs/product/dynamic_price/class/price_parser.class.php index 6659dc56054..7a7dd5aac56 100644 --- a/htdocs/product/dynamic_price/class/price_parser.class.php +++ b/htdocs/product/dynamic_price/class/price_parser.class.php @@ -103,20 +103,16 @@ class PriceParser if (in_array($code, array(9, 14, 19, 20))) //Errors which have 0 arg { return $langs->trans("ErrorPriceExpression".$code); - } - elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) //Errors which have 1 arg + } elseif (in_array($code, array(1, 2, 3, 4, 5, 8, 10, 11, 17, 21, 22))) //Errors which have 1 arg { return $langs->trans("ErrorPriceExpression".$code, $info); - } - elseif (in_array($code, array(6, 23))) //Errors which have 2 args + } elseif (in_array($code, array(6, 23))) //Errors which have 2 args { return $langs->trans("ErrorPriceExpression".$code, $info[0], $info[1]); - } - elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) //Internal errors + } elseif (in_array($code, array(7, 12, 13, 15, 16, 18))) //Internal errors { return $langs->trans("ErrorPriceExpressionInternal", $code); - } - else //Unknown errors + } else //Unknown errors { return $langs->trans("ErrorPriceExpressionUnknown", $code); } @@ -276,7 +272,7 @@ class PriceParser if ($res < 0) { $this->error_parser = array(25, null); return -1; - } elseif ($res == 0) { + } elseif ($res == 0) { $supplier_min_price = 0; } else { $supplier_min_price = $productFournisseur->fourn_unitprice; diff --git a/htdocs/product/dynamic_price/editor.php b/htdocs/product/dynamic_price/editor.php index 778f749f983..c8855b0665e 100644 --- a/htdocs/product/dynamic_price/editor.php +++ b/htdocs/product/dynamic_price/editor.php @@ -54,8 +54,7 @@ $price_globals = new PriceGlobalVariable($db); if (empty($eid)) //This also disables fetch when eid == 0 { $eid = 0; -} -elseif ($action != 'delete') +} elseif ($action != 'delete') { $price_expression->fetch($eid); } @@ -77,8 +76,7 @@ if ($action == 'add') $price_result = $priceparser->testExpression($id, $expression); if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); - } - else { + } else { $price_expression->title = $title; $price_expression->expression = $expression; $result = $price_expression->create($user); @@ -86,17 +84,14 @@ if ($action == 'add') { $eid = $price_expression->id; setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages("add: ".$price_expression->error, $price_expression->errors, 'errors'); } } - } - elseif ($result < 0) + } elseif ($result < 0) { setEventMessages("add find: ".$price_expression->error, $price_expression->errors, 'errors'); - } - else { + } else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -114,8 +109,7 @@ if ($action == 'update') $price_result = $priceparser->testExpression($id, $expression); if ($price_result < 0) { //Expression is not valid setEventMessages($priceparser->translatedError(), null, 'errors'); - } - else { + } else { $price_expression->id = $eid; $price_expression->title = $title; $price_expression->expression = $expression; @@ -123,17 +117,14 @@ if ($action == 'update') if ($result < 0) { setEventMessages("update: ".$price_expression->error, $price_expression->errors, 'errors'); - } - else { + } else { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); } } - } - elseif ($result < 0) + } elseif ($result < 0) { setEventMessages("update find: ".$price_expression->error, $price_expression->errors, 'errors'); - } - else { + } else { setEventMessages($langs->trans("ErrorRecordAlreadyExists"), null, 'errors'); } } @@ -214,8 +205,7 @@ print ''.$langs->trans("Back").''; if ($eid == 0) { print '
'.$langs->trans('Delete').'
'."\n"; -} -else { +} else { print ''; } print ''; diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index 3c4ebfc6acb..efcf0b33553 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -127,8 +127,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $action = ''; - } - else { + } else { $error++; setEventMessages($object->error, $object->errors, 'errors'); } @@ -209,8 +208,7 @@ if (empty($reshook)) $error++; $langs->load("errors"); setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Price")), null, 'errors'); - } - else { + } else { $_POST["price"] = 0; } } @@ -253,8 +251,7 @@ if (empty($reshook)) $productLink = $object->getNomUrl(1, 'supplier'); setEventMessages($langs->trans("ReferenceSupplierIsAlreadyAssociatedWithAProduct", $productLink), null, 'errors'); - } - elseif ($ret < 0) + } elseif ($ret < 0) { $error++; setEventMessages($object->error, $object->errors, 'errors'); @@ -284,8 +281,8 @@ if (empty($reshook)) $sql .= '"'.$value.'", '; } $sql = substr($sql, 0, strlen($sql) - 2).')'; - } // else update the existing one - else { + } else { + // update the existing one $sql = "UPDATE ".MAIN_DB_PREFIX."product_fournisseur_price_extrafields SET "; foreach ($extrafield_values as $key => $value) { $sql .= str_replace('options_', '', $key).' = "'.$value.'", '; @@ -313,8 +310,7 @@ if (empty($reshook)) { $error++; setEventMessages($object->error, $object->errors, 'errors'); - } - else { + } else { if (!empty($conf->dynamicprices->enabled) && $price_expression !== '') { //Check the expression validity by parsing it @@ -343,12 +339,10 @@ if (empty($reshook)) { $db->commit(); $action = ''; - } - else { + } else { $db->rollback(); } - } - else { + } else { $action = 'add_price'; } } @@ -447,8 +441,7 @@ if ($id > 0 || $ref) { $object->fetch_product_fournisseur_price($rowid, 1); //Ignore the math expression when getting the price print load_fiche_titre($langs->trans("ChangeSupplierPrice")); - } - else { + } else { print load_fiche_titre($langs->trans("AddSupplierPrice")); } @@ -471,8 +464,7 @@ if ($id > 0 || $ref) print ''; print ''; print ''; - } - else { + } else { $events = array(); $events[] = array('method' => 'getVatRates', 'url' => dol_buildpath('/core/ajax/vatrates.php', 1), 'htmlname' => 'tva_tx', 'params' => array()); print $form->select_company(GETPOST("id_fourn", 'alpha'), 'id_fourn', 'fournisseur=1', 'SelectThirdParty', 0, 0, $events); @@ -495,8 +487,7 @@ if ($id > 0 || $ref) { print ''; print ''; - } - else { + } else { print ''; } print ''; @@ -520,8 +511,7 @@ if ($id > 0 || $ref) { print ''; print $object->fourn_qty; - } - else { + } else { print ''; } // Units @@ -554,8 +544,7 @@ if ($id > 0 || $ref) $tmpproductsupplier->fetch_product_fournisseur_price($rowid, 1); $default_vat = $tmpproductsupplier->fourn_tva_tx; $default_npr = $tmpproductsupplier->fourn_tva_npr; - } - else { + } else { if (empty($default_vat)) { $default_vat = $object->tva_tx; @@ -934,8 +923,7 @@ SCRIPT; if ($usercancreate) // change required right here { print ''.$productfourn->getNomUrl().''; - } - else { + } else { print ''.$productfourn->fourn_ref.''; } @@ -1087,8 +1075,7 @@ SCRIPT; print ''; } - } - else { + } else { dol_print_error($db); } @@ -1097,8 +1084,7 @@ SCRIPT; } } } -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index ebe55716bae..f2a9ea98b79 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -225,8 +225,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA if ($i < $nbmax) { $dataseries[] = array($obj->label, round($obj->nb)); - } - else { + } else { $rest += $obj->nb; } $total += $obj->nb; @@ -246,8 +245,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->setHeight('200'); $dolgraph->draw('idstatscategproduct'); print $dolgraph->show($total ? 0 : 1); - } - else { + } else { while ($i < $num) { $obj = $db->fetch_object($result); @@ -383,8 +381,7 @@ if ((!empty($conf->product->enabled) || !empty($conf->service->enabled)) && ($us print ''; print '
'; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/product/inventory/ajax/ajax.inventory.php b/htdocs/product/inventory/ajax/ajax.inventory.php index c258b63de2b..85dd488df6f 100644 --- a/htdocs/product/inventory/ajax/ajax.inventory.php +++ b/htdocs/product/inventory/ajax/ajax.inventory.php @@ -20,8 +20,7 @@ switch ($put) $res = $det->update($user); echo $det->qty_view; - } - else { + } else { echo -2; } @@ -39,8 +38,7 @@ switch ($put) $det->update($user); echo $det->new_pmp; - } - else { + } else { echo -2; } diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index a5084c296a1..9f3afa55738 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -41,8 +41,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); -} -else { +} else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -79,8 +78,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; -} -else { +} else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -334,24 +332,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($permissiontoadd) { print ''.$langs->trans("Modify").''."\n"; - } - else { + } else { print ''.$langs->trans('Modify').''."\n"; } if ($permissiontoadd) { print ''.$langs->trans("Validate").''."\n"; - } - else { + } else { print ''.$langs->trans('Validate').''."\n"; } if ($permissiontodelete) { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 381c40d0aa4..983a7a4acb9 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -371,8 +371,7 @@ class Inventory extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -465,8 +464,7 @@ class Inventory extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 373164eeae4..5261b0432b8 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -41,8 +41,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $id); -} -else { +} else { $result = restrictedArea($user, 'stock', $id, '', 'inventory_advance'); } @@ -79,8 +78,7 @@ if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $permissiontoadd = $user->rights->stock->creer; $permissiontodelete = $user->rights->stock->supprimer; -} -else { +} else { $permissiontoadd = $user->rights->stock->inventory_advance->write; $permissiontodelete = $user->rights->stock->inventory_advance->write; } @@ -266,8 +264,7 @@ if ($object->id > 0) print ''; print ''; print '
'; - } - else { + } else { print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook @@ -280,8 +277,7 @@ if ($object->id > 0) if ($permissiontoadd) { print ''.$langs->trans("Edit").''."\n"; - } - else { + } else { print ''.$langs->trans('Edit').''."\n"; } } @@ -291,8 +287,7 @@ if ($object->id > 0) if ($permissiontoadd) { print ''.$langs->trans("Validate").''."\n"; - } - else { + } else { print ''.$langs->trans('Validate').''."\n"; } } diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index c799ab7da87..4d451fcbeec 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -76,8 +76,7 @@ if ($user->socid > 0) // Protection if external user if (empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $result = restrictedArea($user, 'stock', $objectid); -} -else { +} else { $result = restrictedArea($user, 'stock', $objectid, '', 'inventory_advance'); } @@ -254,8 +253,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if (is_numeric($nbtotalofrecords) && ($limit > $nbtotalofrecords || empty($limit))) { $num = $nbtotalofrecords; -} -else { +} else { if ($limit) $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -376,8 +374,7 @@ foreach ($object->fields as $key => $val) if (is_array($val['arrayofkeyval'])) print $form->selectarray('search_'.$key, $val['arrayofkeyval'], $search[$key], $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth75'); elseif (strpos($val['type'], 'integer:') === 0) { print $object->showInputField($val, $key, $search[$key], '', '', 'search_', 'maxwidth150', 1); - } - elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; + } elseif (!preg_match('/^(date|timestamp)/', $val['type'])) print ''; print ''; } } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 347281f0c75..e3889258df7 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -291,12 +291,10 @@ if ($search_type != '' && $search_type != '-1') if ($search_type == 1) { $texte = $langs->trans("Services"); - } - else { + } else { $texte = $langs->trans("Products"); } -} -else { +} else { $texte = $langs->trans("ProductsAndServices"); } @@ -450,8 +448,7 @@ if ($resql) if ($search_type == 0) { $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; - } - elseif ($search_type == 1) + } elseif ($search_type == 1) { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } @@ -1058,15 +1055,13 @@ if ($resql) if ((float) $duration_value > 1) { $dur = array("i"=>$langs->trans("Minutes"), "h"=>$langs->trans("Hours"), "d"=>$langs->trans("Days"), "w"=>$langs->trans("Weeks"), "m"=>$langs->trans("Months"), "y"=>$langs->trans("Years")); - } - elseif ((float) $duration_value > 0) + } elseif ((float) $duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } print $duration_value; print ((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : ''); - } - elseif (!preg_match('/^[a-z]$/i', $obj->duration)) // If duration is a simple char (like 's' of 'm'), we do not show value + } elseif (!preg_match('/^[a-z]$/i', $obj->duration)) // If duration is a simple char (like 's' of 'm'), we do not show value { print $obj->duration; } @@ -1213,8 +1208,7 @@ if ($resql) { $htmltext = $product_fourn->display_price_product_fournisseur(1, 1, 0, 1); print $form->textwithpicto(price($product_fourn->fourn_unitprice * (1 - $product_fourn->fourn_remise_percent / 100) - $product_fourn->fourn_remise).' '.$langs->trans("HT"), $htmltext); - } - else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); + } else print price($product_fourn->fourn_unitprice).' '.$langs->trans("HT"); } } } @@ -1408,8 +1402,7 @@ if ($resql) print ""; print "
"; print ''; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/product/popucom.php b/htdocs/product/popucom.php index c21afa711e7..a0ee53a5758 100644 --- a/htdocs/product/popucom.php +++ b/htdocs/product/popucom.php @@ -62,12 +62,10 @@ $helpurl = ''; if ($type == '0') { $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; -} -elseif ($type == '1') +} elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; -} -else { +} else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -151,8 +149,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 92de8b33546..b48afc6d162 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -62,12 +62,10 @@ $helpurl = ''; if ($type == '0') { $helpurl = 'EN:Module_Products|FR:Module_Produits|ES:Módulo_Productos'; -} -elseif ($type == '1') +} elseif ($type == '1') { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; -} -else { +} else { $helpurl = 'EN:Module_Services_En|FR:Module_Services|ES:Módulo_Servicios'; } $title = $langs->trans("Statistics"); @@ -151,8 +149,7 @@ if ($resql) $i++; } $db->free($resql); -} -else { +} else { dol_print_error($db); } //var_dump($infoprod); diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 1db2219bf63..2c1bc26d092 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -169,8 +169,7 @@ if (empty($reshook)) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } @@ -274,8 +273,7 @@ if (empty($reshook)) break; } } - } - elseif (!$error) + } elseif (!$error) { $tva_tx_txt = GETPOST('tva_tx', 'alpha'); // tva_tx can be '8.5' or '8.5*' or '8.5 (XXX)' or '8.5* (XXX)' @@ -765,8 +763,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ echo vatrate($positiverates.($object->default_vat_code ? ' ('.$object->default_vat_code.')' : ''), '%', $object->tva_npr); //print vatrate($object->multiprices_tva_tx[$soc->price_level], true); print ''; - } - else { + } else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -784,16 +781,14 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ else print vatrate($object->tva_tx . ($object->tva_npr ? '*' : ''), true);*/ print ''; } - } - else { + } else { if (!empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility { // We show only vat for level 1 print ''.$langs->trans("DefaultTaxRate").''; print ''.vatrate($object->multiprices_tva_tx[1], true).''; print ''; - } - else { + } else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -841,8 +836,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ print ''; print ' '; print ''; - } - else { + } else { print $langs->trans("SellingPrice").' '.$i; if (!empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel); } @@ -866,8 +860,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ if ($object->multiprices_base_type[$i] == 'TTC') { print price($object->multiprices_min_ttc[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); - } - else { + } else { print price($object->multiprices_min[$i]).' '.$langs->trans($object->multiprices_base_type[$i]); } print ''; @@ -947,8 +940,7 @@ if (!empty($conf->global->PRODUIT_MULTIPRICES) || !empty($conf->global->PRODUIT_ } } } -} -else { +} else { // TVA print ''.$langs->trans("DefaultTaxRate").''; @@ -990,8 +982,7 @@ else { print ''.$langs->trans("PriceByQuantity"); if ($object->prices_by_qty[0] == 0) { print '  ('.$langs->trans("Activate").')'; - } - else { + } else { print '  ('.$langs->trans("DisablePriceByQty").')'; } print ''; @@ -1280,8 +1271,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) print ''; print '
'; - } - else { + } else { print ''."\n"; ?> '; -} -elseif ($object->id > 0) +} elseif ($object->id > 0) { /* * Show or edit @@ -885,8 +874,7 @@ elseif ($object->id > 0) { $texthelp = $langs->trans("IfNeedToUseOtherObjectKeepEmpty"); print $form->textwithtooltip($text.' '.img_help(), $texthelp, 1, 0, '', '', 2); - } - else print $text; + } else print $text; print ''; } @@ -974,8 +962,7 @@ elseif ($object->id > 0) } print ''; - } - else { + } else { dol_fiche_head($head, 'project', $langs->trans("Project"), -1, ($object->public ? 'projectpub' : 'project')); // Project card @@ -1228,8 +1215,7 @@ elseif ($object->id > 0) if ($userWrite > 0) { print '
'.$langs->trans("Modify").''; - } - else { + } else { print ''.$langs->trans('Modify').''; } } @@ -1240,8 +1226,7 @@ elseif ($object->id > 0) if ($userWrite > 0) { print ''.$langs->trans("Validate").''; - } - else { + } else { print ''.$langs->trans('Validate').''; } } @@ -1252,8 +1237,7 @@ elseif ($object->id > 0) if ($userWrite > 0) { print ''.$langs->trans("Close").''; - } - else { + } else { print ''.$langs->trans('Close').''; } } @@ -1264,8 +1248,7 @@ elseif ($object->id > 0) if ($userWrite > 0) { print ''.$langs->trans("ReOpen").''; - } - else { + } else { print ''.$langs->trans('ReOpen').''; } } @@ -1331,8 +1314,7 @@ elseif ($object->id > 0) if ($userWrite > 0) { print ''.$langs->trans('ToClone').''; - } - else { + } else { print ''.$langs->trans('ToClone').''; } } @@ -1343,8 +1325,7 @@ elseif ($object->id > 0) if ($userDelete > 0 || ($object->statut == 0 && $user->rights->projet->creer)) { print ''.$langs->trans("Delete").''; - } - else { + } else { print ''.$langs->trans('Delete').''; } } @@ -1401,8 +1382,7 @@ elseif ($object->id > 0) // Hook to add more things on page $parameters = array(); $reshook = $hookmanager->executeHooks('mainCardTabAddMore', $parameters, $object, $action); // Note that $action and $object may have been modified by hook -} -else { +} else { print $langs->trans("RecordNotFound"); } diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 77feddb91bd..5ef21879c7f 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -171,8 +171,7 @@ class Projects extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve project list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -452,8 +451,7 @@ class Projects extends DolibarrApi if ($this->project->update(DolibarrApiAccess::$user) >= 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->project->error); } } diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 1a16d9ce199..084292d0727 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -173,8 +173,7 @@ class Tasks extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve task list : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -450,8 +449,7 @@ class Tasks extends DolibarrApi if ($this->task->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); - } - else { + } else { throw new RestException(500, $this->task->error); } } diff --git a/htdocs/projet/class/project.class.php b/htdocs/projet/class/project.class.php index 8337a625415..7389af9083c 100644 --- a/htdocs/projet/class/project.class.php +++ b/htdocs/projet/class/project.class.php @@ -306,8 +306,7 @@ class Project extends CommonObject if ($result < 0) { $error++; } // End call triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errno = $this->db->lasterrno(); $error++; @@ -332,8 +331,7 @@ class Project extends CommonObject { $this->db->commit(); return $ret; - } - else { + } else { $this->db->rollback(); return -1; } @@ -439,27 +437,23 @@ class Project extends CommonObject { $this->db->commit(); $result = 1; - } - else { + } else { $this->db->rollback(); $result = -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->error; $this->db->rollback(); if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $result = -4; - } - else { + } else { $result = -2; } dol_syslog(get_class($this)."::update error ".$result." ".$this->error, LOG_ERR); } - } - else { + } else { dol_syslog(get_class($this)."::update ref null"); $result = -1; } @@ -487,8 +481,7 @@ class Project extends CommonObject if (!empty($id)) { $sql .= " WHERE rowid=".$id; - } - elseif (!empty($ref)) + } elseif (!empty($ref)) { $sql .= " WHERE ref='".$this->db->escape($ref)."'"; $sql .= " AND entity IN (".getEntity('project').")"; @@ -547,8 +540,7 @@ class Project extends CommonObject $this->db->free($resql); return 0; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -578,35 +570,28 @@ class Project extends CommonObject if ($type == 'agenda') { $sql = "SELECT id as rowid FROM ".MAIN_DB_PREFIX."actioncomm WHERE fk_project IN (".$ids.") AND entity IN (".getEntity('agenda').")"; - } - elseif ($type == 'expensereport') + } elseif ($type == 'expensereport') { $sql = "SELECT ed.rowid FROM ".MAIN_DB_PREFIX."expensereport as e, ".MAIN_DB_PREFIX."expensereport_det as ed WHERE e.rowid = ed.fk_expensereport AND e.entity IN (".getEntity('expensereport').") AND ed.fk_projet IN (".$ids.")"; - } - elseif ($type == 'project_task') + } elseif ($type == 'project_task') { $sql = "SELECT DISTINCT pt.rowid FROM ".MAIN_DB_PREFIX."projet_task as pt WHERE pt.fk_projet IN (".$ids.")"; - } - elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user + } elseif ($type == 'project_task_time') // Case we want to duplicate line foreach user { $sql = "SELECT DISTINCT pt.rowid, ptt.fk_user FROM ".MAIN_DB_PREFIX."projet_task as pt, ".MAIN_DB_PREFIX."projet_task_time as ptt WHERE pt.rowid = ptt.fk_task AND pt.fk_projet IN (".$ids.")"; - } - elseif ($type == 'stock_mouvement') + } elseif ($type == 'stock_mouvement') { $sql = 'SELECT ms.rowid, ms.fk_user_author as fk_user FROM '.MAIN_DB_PREFIX."stock_mouvement as ms, ".MAIN_DB_PREFIX."entrepot as e WHERE e.rowid = ms.fk_entrepot AND e.entity IN (".getEntity('stock').") AND ms.origintype = 'project' AND ms.fk_origin IN (".$ids.") AND ms.type_mouvement = 1"; - } - elseif ($type == 'loan') + } elseif ($type == 'loan') { $sql = 'SELECT l.rowid, l.fk_user_author as fk_user FROM '.MAIN_DB_PREFIX."loan as l WHERE l.entity IN (".getEntity('loan').") AND l.fk_projet IN (".$ids.")"; - } - else { + } else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX.$tablename." WHERE ".$projectkey." IN (".$ids.") AND entity IN (".getEntity($type).")"; } if ($dates > 0 && $type == 'loan'){ $sql .= " AND (dateend > '".$this->db->idate($dates)."' OR dateend IS NULL)"; - } - elseif ($dates > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table + } elseif ($dates > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table { if (empty($datefieldname) && !empty($this->table_element_date)) $datefieldname = $this->table_element_date; if (empty($datefieldname)) return 'Error this object has no date field defined'; @@ -615,8 +600,7 @@ class Project extends CommonObject if ($datee > 0 && $type == 'loan'){ $sql .= " AND (datestart < '".$this->db->idate($datee)."' OR datestart IS NULL)"; - } - elseif ($datee > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table + } elseif ($datee > 0 && ($type != 'project_task')) // For table project_taks, we want the filter on date apply on project_time_spent table { if (empty($datefieldname) && !empty($this->table_element_date)) $datefieldname = $this->table_element_date; if (empty($datefieldname)) return 'Error this object has no date field defined'; @@ -646,8 +630,7 @@ class Project extends CommonObject /* Return array even if empty*/ return $elements; - } - else { + } else { dol_print_error($this->db); } } @@ -797,8 +780,7 @@ class Project extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::delete ".$errmsg, LOG_ERR); @@ -890,15 +872,13 @@ class Project extends CommonObject $this->statut = 1; $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = join(',', $this->errors); dol_syslog(get_class($this)."::setValid ".$this->error, LOG_ERR); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -948,15 +928,13 @@ class Project extends CommonObject $this->statut = 2; $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); $this->error = join(',', $this->errors); dol_syslog(get_class($this)."::setClose ".$this->error, LOG_ERR); return -1; } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->lasterror(); return -1; @@ -1054,16 +1032,13 @@ class Project extends CommonObject { if (preg_match('/\.php$/', $option)) { $url = dol_buildpath($option, 1).'?id='.$this->id; - } - elseif ($option == 'task') + } elseif ($option == 'task') { $url = DOL_URL_ROOT.'/projet/tasks.php?id='.$this->id; - } - elseif ($option == 'preview') + } elseif ($option == 'preview') { $url = DOL_URL_ROOT.'/projet/element.php?id='.$this->id; - } - else { + } else { $url = DOL_URL_ROOT.'/projet/card.php?id='.$this->id; } // Add param to save lastsearch_values or not @@ -1179,12 +1154,10 @@ class Project extends CommonObject if (($mode == 'read' && !empty($user->rights->projet->all->lire)) || ($mode == 'write' && !empty($user->rights->projet->all->creer)) || ($mode == 'delete' && !empty($user->rights->projet->all->supprimer))) { $userAccess = 1; - } - elseif ($this->public && (($mode == 'read' && !empty($user->rights->projet->lire)) || ($mode == 'write' && !empty($user->rights->projet->creer)) || ($mode == 'delete' && !empty($user->rights->projet->supprimer)))) + } elseif ($this->public && (($mode == 'read' && !empty($user->rights->projet->lire)) || ($mode == 'write' && !empty($user->rights->projet->creer)) || ($mode == 'delete' && !empty($user->rights->projet->supprimer)))) { $userAccess = 1; - } - else { + } else { foreach (array('internal', 'external') as $source) { $userRole = $this->liste_contact(4, $source); @@ -1234,12 +1207,10 @@ class Project extends CommonObject if ($mode == 0) { $sql.= " LEFT JOIN " . MAIN_DB_PREFIX . "element_contact as ec ON ec.element_id = p.rowid"; - } - elseif ($mode == 1) + } elseif ($mode == 1) { $sql.= ", " . MAIN_DB_PREFIX . "element_contact as ec"; - } - elseif ($mode == 2) + } elseif ($mode == 2) { // No filter. Use this if user has permission to see all project } @@ -1260,8 +1231,7 @@ class Project extends CommonObject { $listofprojectcontacttype[$obj->rowid]=$obj->code; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0]='0'; // To avoid syntax error if not found if ($mode == 0) @@ -1270,16 +1240,14 @@ class Project extends CommonObject $sql.= " OR ( ec.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).")"; $sql.= " AND ec.fk_socpeople = ".$user->id.")"; $sql.= " )"; - } - elseif ($mode == 1) + } elseif ($mode == 1) { $sql.= " AND ec.element_id = p.rowid"; $sql.= " AND ("; $sql.= " ( ec.fk_c_type_contact IN (".join(',', array_keys($listofprojectcontacttype)).")"; $sql.= " AND ec.fk_socpeople = ".$user->id.")"; $sql.= " )"; - } - elseif ($mode == 2) + } elseif ($mode == 2) { // No filter. Use this if user has permission to see all project } @@ -1308,8 +1276,7 @@ class Project extends CommonObject $result = implode(',', $temp); return $result; } - } - else { + } else { dol_print_error($this->db); } @@ -1416,8 +1383,7 @@ class Project extends CommonObject { $clone_project->note_private = ''; $clone_project->note_public = ''; - } - else { + } else { $this->db->begin(); $res = $clone_project->update_note(dol_html_entity_decode($clone_project->note_public, ENT_QUOTES), '_public'); if ($res < 0) @@ -1425,8 +1391,7 @@ class Project extends CommonObject $this->error .= $clone_project->error; $error++; $this->db->rollback(); - } - else { + } else { $this->db->commit(); } @@ -1437,8 +1402,7 @@ class Project extends CommonObject $this->error .= $clone_project->error; $error++; $this->db->rollback(); - } - else { + } else { $this->db->commit(); } } @@ -1461,8 +1425,7 @@ class Project extends CommonObject $langs->load("errors"); $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); $error++; - } - else { + } else { if ($clone_project->error != '') { $this->error .= $clone_project->error; @@ -1493,8 +1456,7 @@ class Project extends CommonObject $error++; } } - } - else { + } else { $this->error .= $langs->trans('ErrorInternalErrorDetected').':dol_mkdir'; $error++; } @@ -1523,8 +1485,7 @@ class Project extends CommonObject { $this->error .= $result_clone->error; $error++; - } - else { + } else { $new_task_id = $result_clone; $taskstatic->fetch($tasktoclone->id); @@ -1562,8 +1523,7 @@ class Project extends CommonObject { $this->db->commit(); return $clone_project_id; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : ".$this->error, LOG_ERR); return -1; @@ -1656,8 +1616,7 @@ class Project extends CommonObject { $sql .= " SET fk_project=".$this->id; $sql .= " WHERE id=".$elementSelectId; - } - else { + } else { $sql .= " SET fk_projet=".$this->id; $sql .= " WHERE rowid=".$elementSelectId; } @@ -1782,8 +1741,7 @@ class Project extends CommonObject { $this->weekWorkLoad[$day] = $obj->task_duration; $this->weekWorkLoadPerTask[$day][$obj->fk_task] = $obj->task_duration; - } - else { + } else { $this->weekWorkLoad[$day] += $obj->task_duration; $this->weekWorkLoadPerTask[$day][$obj->fk_task] += $obj->task_duration; } @@ -1792,8 +1750,7 @@ class Project extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -1847,8 +1804,7 @@ class Project extends CommonObject { $this->monthWorkLoad[$week_number] = $obj->task_duration; $this->monthWorkLoadPerTask[$week_number][$obj->fk_task] = $obj->task_duration; - } - else { + } else { $this->monthWorkLoad[$week_number] += $obj->task_duration; $this->monthWorkLoadPerTask[$week_number][$obj->fk_task] += $obj->task_duration; } @@ -1857,8 +1813,7 @@ class Project extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -1927,8 +1882,7 @@ class Project extends CommonObject } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1985,8 +1939,7 @@ class Project extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; @@ -2052,8 +2005,7 @@ class Project extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/projet/class/projectstats.class.php b/htdocs/projet/class/projectstats.class.php index 1452b0e919f..cb6150b6dc7 100644 --- a/htdocs/projet/class/projectstats.class.php +++ b/htdocs/projet/class/projectstats.class.php @@ -92,8 +92,7 @@ class ProjectStats extends Stats $label.' ('.price(price2num($row[0], 'MT'), 1, $langs, 1, -1, -1, $conf->currency).')', $row[0] ); - } - else $other += $row[1]; + } else $other += $row[1]; $i++; } if ($num > $limit) @@ -280,8 +279,7 @@ class ProjectStats extends Stats $foundintocache = 1; $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $filedate; - } - else { + } else { dol_syslog(get_class($this).'::'.__FUNCTION__." cache file ".$newpathofdestfile." is not found or older than now - cachedelay (".$nowgmt." - ".$cachedelay.") so we can't use it."); } } @@ -291,8 +289,7 @@ class ProjectStats extends Stats { dol_syslog(get_class($this).'::'.__FUNCTION__." read data from cache file ".$newpathofdestfile." ".$filedate."."); $data = json_decode(file_get_contents($newpathofdestfile), true); - } - else { + } else { $year = $startyear; while ($year <= $endyear) { @@ -326,8 +323,7 @@ class ProjectStats extends Stats fclose($fp); if (!empty($conf->global->MAIN_UMASK)) $newmask = $conf->global->MAIN_UMASK; @chmod($newpathofdestfile, octdec($newmask)); - } - else dol_syslog("Failed to write cache file", LOG_ERR); + } else dol_syslog("Failed to write cache file", LOG_ERR); $this->lastfetchdate[get_class($this).'_'.__FUNCTION__] = $nowgmt; } diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index cc74e565385..10f5a36d67f 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -225,8 +225,7 @@ class Task extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -327,8 +326,7 @@ class Task extends CommonObject } else { return 0; } - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -437,8 +435,7 @@ class Task extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -540,8 +537,7 @@ class Task extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { //Delete associated link file if ($conf->projet->dir_output) { @@ -585,8 +581,7 @@ class Task extends CommonObject dol_syslog(get_class($this)."::hasChildren", LOG_DEBUG); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - else { + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } else { $obj = $this->db->fetch_object($resql); if ($obj) $ret = $obj->nb; $this->db->free($resql); @@ -595,8 +590,7 @@ class Task extends CommonObject if (!$error) { return $ret; - } - else { + } else { return -1; } } @@ -617,8 +611,7 @@ class Task extends CommonObject dol_syslog(get_class($this)."::hasTimeSpent", LOG_DEBUG); $resql = $this->db->query($sql); - if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } - else { + if (!$resql) { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } else { $obj = $this->db->fetch_object($resql); if ($obj) $ret = $obj->nb; $this->db->free($resql); @@ -627,8 +620,7 @@ class Task extends CommonObject if (!$error) { return $ret; - } - else { + } else { return -1; } } @@ -791,8 +783,7 @@ class Task extends CommonObject $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; $sql .= " AND t.fk_projet = p.rowid"; - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($filteronprojuser > 0) { @@ -808,8 +799,7 @@ class Task extends CommonObject } $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec2"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as ctc2"; - } - else { + } else { $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task as t on t.fk_projet = p.rowid"; if ($includebilltime) { @@ -818,8 +808,7 @@ class Task extends CommonObject } $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet_task_extrafields as efpt ON (t.rowid = efpt.fk_object)"; $sql .= " WHERE p.entity IN (".getEntity('project').")"; - } - else return 'BadValueForParameterMode'; + } else return 'BadValueForParameterMode'; if ($filteronprojuser > 0) { @@ -965,8 +954,7 @@ class Task extends CommonObject $i++; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); } @@ -1044,8 +1032,7 @@ class Task extends CommonObject $i++; } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); } @@ -1136,8 +1123,7 @@ class Task extends CommonObject if ($result < 0) { $ret = -1; } // End call triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $ret = -1; } @@ -1172,8 +1158,7 @@ class Task extends CommonObject if ($ret > 0) { $this->db->commit(); - } - else { + } else { $this->db->rollback(); } return $ret; @@ -1233,8 +1218,7 @@ class Task extends CommonObject $this->timespent_nblines = ($obj->nblines ? $obj->nblines : 0); $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); } return $result; @@ -1289,8 +1273,7 @@ class Task extends CommonObject $this->db->free($resql); return $result; - } - else { + } else { dol_print_error($this->db); return $result; } @@ -1341,8 +1324,7 @@ class Task extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -1427,8 +1409,7 @@ class Task extends CommonObject } $this->db->free($resql); - } - else { + } else { dol_print_error($this->db); $this->error = "Error ".$this->db->lasterror(); return -1; @@ -1488,13 +1469,10 @@ class Task extends CommonObject { $this->db->rollback(); $ret = -1; - } - else $ret = 1; + } else $ret = 1; // End call triggers - } - else $ret = 1; - } - else { + } else $ret = 1; + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); $ret = -1; @@ -1564,8 +1542,7 @@ class Task extends CommonObject if ($this->db->query($sql)) { $result = 0; - } - else { + } else { $this->error = $this->db->lasterror(); $result = -2; } @@ -1581,8 +1558,7 @@ class Task extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1694,8 +1670,7 @@ class Task extends CommonObject { $clone_task->note_private = ''; $clone_task->note_public = ''; - } - else { + } else { $this->db->begin(); $res = $clone_task->update_note(dol_html_entity_decode($clone_task->note_public, ENT_QUOTES), '_public'); if ($res < 0) @@ -1703,8 +1678,7 @@ class Task extends CommonObject $this->error .= $clone_task->error; $error++; $this->db->rollback(); - } - else { + } else { $this->db->commit(); } @@ -1715,8 +1689,7 @@ class Task extends CommonObject $this->error .= $clone_task->error; $error++; $this->db->rollback(); - } - else { + } else { $this->db->commit(); } } @@ -1735,8 +1708,7 @@ class Task extends CommonObject { $projectstatic->fetch($project_id); $clone_project_ref = $projectstatic->ref; - } - else { + } else { $clone_project_ref = $ori_project_ref; } @@ -1783,8 +1755,7 @@ class Task extends CommonObject $langs->load("errors"); $this->error .= $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); $error++; - } - else { + } else { if ($clone_task->error != '') { $this->error .= $clone_task->error; @@ -1808,8 +1779,7 @@ class Task extends CommonObject { $this->db->commit(); return $clone_task_id; - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::createFromClone nbError: ".$error." error : ".$this->error, LOG_ERR); return -1; @@ -1856,12 +1826,10 @@ class Task extends CommonObject if ($mode == 0) { return $langs->trans($this->statuts[$status]); - } - elseif ($mode == 1) + } elseif ($mode == 1) { return $langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts_short[$status]); @@ -1869,8 +1837,7 @@ class Task extends CommonObject elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts_short[$status]); elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts_short[$status]); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0'); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1'); @@ -1878,8 +1845,7 @@ class Task extends CommonObject elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6'); elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans($this->statuts_short[$status]), 'statut0').' '.$langs->trans($this->statuts[$status]); elseif ($status == 1) return img_picto($langs->trans($this->statuts_short[$status]), 'statut1').' '.$langs->trans($this->statuts[$status]); @@ -1887,8 +1853,7 @@ class Task extends CommonObject elseif ($status == 3) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); elseif ($status == 4) return img_picto($langs->trans($this->statuts_short[$status]), 'statut6').' '.$langs->trans($this->statuts[$status]); elseif ($status == 5) return img_picto($langs->trans($this->statuts_short[$status]), 'statut5').' '.$langs->trans($this->statuts[$status]); - } - elseif ($mode == 5) + } elseif ($mode == 5) { /*if ($status==0) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); elseif ($status==1) return $langs->trans($this->statuts_short[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); @@ -1899,8 +1864,7 @@ class Task extends CommonObject */ //else return $this->progress.' %'; return ' '; - } - elseif ($mode == 6) + } elseif ($mode == 6) { /*if ($status==0) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut0'); elseif ($status==1) return $langs->trans($this->statuts[$status]).' '.img_picto($langs->trans($this->statuts_short[$status]),'statut1'); @@ -2012,8 +1976,7 @@ class Task extends CommonObject } return $response; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2060,8 +2023,7 @@ class Task extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->error(); return -1; diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index 1ab6189674a..722736fe9b8 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -82,8 +82,7 @@ class TaskStats extends Stats $row[1], $row[0] ); - } - else $other += $row[1]; + } else $other += $row[1]; $i++; } if ($num > $limit) diff --git a/htdocs/projet/contact.php b/htdocs/projet/contact.php index fde1563eac2..b8f1a24013d 100644 --- a/htdocs/projet/contact.php +++ b/htdocs/projet/contact.php @@ -73,14 +73,12 @@ if ($action == 'addcontact' && $user->rights->projet->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -92,8 +90,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne', 'int')); - } - else { + } else { dol_print_error($db); } } @@ -108,8 +105,7 @@ if (($action == 'deleteline' || $action == 'deletecontact') && $user->rights->pr { header("Location: contact.php?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/projet/document.php b/htdocs/projet/document.php index 5b0409d7246..9015ef0d4d4 100644 --- a/htdocs/projet/document.php +++ b/htdocs/projet/document.php @@ -157,8 +157,7 @@ if ($object->id > 0) $permission = ($userWrite > 0); $permtoedit = ($userWrite > 0); include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { dol_print_error('', 'NoRecordFound'); } diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 3907259e230..84612ef76ce 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -568,8 +568,7 @@ if ($action == "addelement") { setEventMessages($object->error, $object->errors, 'errors'); } -} -elseif ($action == "unlink") +} elseif ($action == "unlink") { $tablename = GETPOST("tablename", "aZ09"); $projectField = GETPOSTISSET('projectfield') ? GETPOST('projectfield', 'aZ09') : 'fk_projet'; @@ -685,18 +684,15 @@ foreach ($listofreferent as $key => $value) { $tmp = $element->getSumOfAmount($elementuser, $dates, $datee); $total_ht_by_line = price2num($tmp['amount'], 'MT'); - } - else { + } else { $tmp = $element->getSumOfAmount('', $dates, $datee); $total_ht_by_line = price2num($tmp['amount'], 'MT'); } - } - elseif ($key == 'loan') { + } elseif ($key == 'loan') { if ((empty($dates) && empty($datee)) || (intval($dates) <= $element->datestart && intval($datee) >= $element->dateend)) { // Get total loan $total_ht_by_line = -$element->capital; - } - else { + } else { // Get loan schedule according to date filter $total_ht_by_line = 0; $loanScheduleStatic = new LoanSchedule($element->db); @@ -715,8 +711,7 @@ foreach ($listofreferent as $key => $value) } } } - } - else $total_ht_by_line = $element->total_ht; + } else $total_ht_by_line = $element->total_ht; // Define $total_ttc_by_line if ($tablename == 'don' || $tablename == 'chargesociales' || $tablename == 'payment_various' || $tablename == 'payment_salary') $total_ttc_by_line = $element->amount; @@ -726,11 +721,9 @@ foreach ($listofreferent as $key => $value) { $defaultvat = get_default_tva($mysoc, $mysoc); $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT'); - } - elseif ($key == 'loan') { + } elseif ($key == 'loan') { $total_ttc_by_line = $total_ht_by_line; // For loan there is actually no taxe managed in Dolibarr - } - else $total_ttc_by_line = $element->total_ttc; + } else $total_ttc_by_line = $element->total_ttc; // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases if ($tablename == 'payment_various') @@ -844,8 +837,7 @@ foreach ($listofreferent as $key => $value) if ($selectList < 0) { setEventMessages($formproject->error, $formproject->errors, 'errors'); - } - elseif ($selectList) + } elseif ($selectList) { // Define form with the combo list of elements to link $addform .= '
'; @@ -951,8 +943,7 @@ foreach ($listofreferent as $key => $value) if ($tablename != 'expensereport_det') { if (method_exists($element, 'fetch_thirdparty')) $element->fetch_thirdparty(); - } - else { + } else { $expensereport = new ExpenseReport($db); $expensereport->fetch($element->fk_expensereport); } @@ -997,19 +988,16 @@ foreach ($listofreferent as $key => $value) if ($tablename == 'expensereport_det') { print $expensereport->getNomUrl(1); - } - else { + } else { // Show ref with link if ($element instanceof Task) { print $element->getNomUrl(1, 'withproject', 'time'); print ' - '.dol_trunc($element->label, 48); - } - elseif ($key == 'loan') { + } elseif ($key == 'loan') { print $element->getNomUrl(1); print ' - '.dol_trunc($element->label, 48); - } - else print $element->getNomUrl(1); + } else print $element->getNomUrl(1); $element_doc = $element->element; $filename = dol_sanitizeFileName($element->ref); @@ -1018,8 +1006,7 @@ foreach ($listofreferent as $key => $value) if ($element_doc === 'order_supplier') { $element_doc = 'commande_fournisseur'; $filedir = $conf->fournisseur->commande->multidir_output[$element->entity].'/'.dol_sanitizeFileName($element->ref); - } - elseif ($element_doc === 'invoice_supplier') { + } elseif ($element_doc === 'invoice_supplier') { $element_doc = 'facture_fournisseur'; $filename = get_exdir($element->id, 2, 0, 0, $element, 'product').dol_sanitizeFileName($element->ref); $filedir = $conf->fournisseur->facture->multidir_output[$element->entity].'/'.get_exdir($element->id, 2, 0, 0, $element, 'invoice_supplier').dol_sanitizeFileName($element->ref); @@ -1047,8 +1034,7 @@ foreach ($listofreferent as $key => $value) if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_order') { $date = ($element->date_commande ? $element->date_commande : $element->date_valid); - } - elseif ($tablename == 'supplier_proposal') $date = $element->date_validation; // There is no other date for this + } elseif ($tablename == 'supplier_proposal') $date = $element->date_validation; // There is no other date for this elseif ($tablename == 'fichinter') $date = $element->datev; // There is no other date for this elseif ($tablename == 'projet_task') $date = ''; // We show no date. Showing date of beginning of task make user think it is date of time consumed else { @@ -1059,8 +1045,7 @@ foreach ($listofreferent as $key => $value) $date = $element->$datefieldname; } } - } - elseif ($key == 'loan') { + } elseif ($key == 'loan') { $date = $element->datestart; } @@ -1069,16 +1054,14 @@ foreach ($listofreferent as $key => $value) { print dol_print_date($element->datep, 'dayhour'); if ($element->datef && $element->datef > $element->datep) print " - ".dol_print_date($element->datef, 'dayhour'); - } - elseif (in_array($tablename, array('projet_task'))) + } elseif (in_array($tablename, array('projet_task'))) { $tmpprojtime = $element->getSumOfAmount($elementuser, $dates, $datee); // $element is a task. $elementuser may be empty print ''; print convertSecondToTime($tmpprojtime['nbseconds'], 'allhourmin'); print ''; $total_time_by_line = $tmpprojtime['nbseconds']; - } - else print dol_print_date($date, 'day'); + } else print dol_print_date($date, 'day'); print ''; // Third party or user @@ -1089,14 +1072,12 @@ foreach ($listofreferent as $key => $value) $tmpuser = new User($db); $tmpuser->fetch($expensereport->fk_user_author); print $tmpuser->getNomUrl(1, '', 48); - } - elseif ($tablename == 'payment_salary') + } elseif ($tablename == 'payment_salary') { $tmpuser = new User($db); $tmpuser->fetch($element->fk_user); print $tmpuser->getNomUrl(1, '', 48); - } - elseif ($tablename == 'don' || $tablename == 'stock_mouvement') + } elseif ($tablename == 'don' || $tablename == 'stock_mouvement') { if ($element->fk_user_author > 0) { @@ -1104,8 +1085,7 @@ foreach ($listofreferent as $key => $value) $tmpuser2->fetch($element->fk_user_author); print $tmpuser2->getNomUrl(1, '', 48); } - } - elseif ($tablename == 'projet_task' && $key == 'project_task_time') // if $key == 'project_task', we don't want details per user + } elseif ($tablename == 'projet_task' && $key == 'project_task_time') // if $key == 'project_task', we don't want details per user { print $elementuser->getNomUrl(1); } @@ -1140,12 +1120,10 @@ foreach ($listofreferent as $key => $value) $langs->load("errors"); $warning = $langs->trans("WarningSomeLinesWithNullHourlyRate", $conf->currency); } - } - else { + } else { $othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } - } - elseif ($key == 'loan') $total_ht_by_line = $element->capital; + } elseif ($key == 'loan') $total_ht_by_line = $element->capital; else { $total_ht_by_line = $element->total_ht; } @@ -1169,8 +1147,7 @@ foreach ($listofreferent as $key => $value) } if ($warning) print ' '.img_warning($warning); print ''; - } - else print ''; + } else print ''; // Amount inc tax if (empty($value['disableamount'])) @@ -1186,12 +1163,10 @@ foreach ($listofreferent as $key => $value) // TODO Permission to read daily rate $defaultvat = get_default_tva($mysoc, $mysoc); $total_ttc_by_line = price2num($total_ht_by_line * (1 + ($defaultvat / 100)), 'MT'); - } - else { + } else { $othermessage = $form->textwithpicto($langs->trans("NotAvailable"), $langs->trans("ModuleSalaryToDefineHourlyRateMustBeEnabled")); } - } - elseif ($key == 'loan') $total_ttc_by_line = $element->capital - $element->getSumPayment(); + } elseif ($key == 'loan') $total_ttc_by_line = $element->capital - $element->getSumPayment(); else { $total_ttc_by_line = $element->total_ttc; } @@ -1215,32 +1190,27 @@ foreach ($listofreferent as $key => $value) } if ($warning) print ' '.img_warning($warning); print ''; - } - else print ''; + } else print ''; // Status print ''; if ($tablename == 'expensereport_det') { print $expensereport->getLibStatut(5); - } - elseif ($element instanceof CommonInvoice) + } elseif ($element instanceof CommonInvoice) { //This applies for Facture and FactureFournisseur print $element->getLibStatut(5, $element->getSommePaiement()); - } - elseif ($element instanceof Task) + } elseif ($element instanceof Task) { if ($element->progress != '') { print $element->progress.' %'; } - } - elseif ($tablename == 'stock_mouvement') + } elseif ($tablename == 'stock_mouvement') { print $element->getLibStatut(3); - } - else { + } else { print $element->getLibStatut(5); } print ''; @@ -1314,8 +1284,7 @@ foreach ($listofreferent as $key => $value) print ''; print ' '; print ''; - } - else { + } else { if (!is_array($elementarray)) // error { print $elementarray; diff --git a/htdocs/projet/ganttchart.inc.php b/htdocs/projet/ganttchart.inc.php index 5f88db6344d..457345d2fe3 100644 --- a/htdocs/projet/ganttchart.inc.php +++ b/htdocs/projet/ganttchart.inc.php @@ -195,8 +195,7 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje if ($project_id && $level < 0) { $parent = '-'.$project_id; - } - else { + } else { $parent = $task["task_parent_alternate_id"]; //$parent = $task["task_parent"]; } @@ -207,8 +206,7 @@ function constructGanttLine($tarr, $task, $task_dependencies, $level = 0, $proje { //$link=DOL_URL_ROOT.'/projet/tasks.php?withproject=1&id='.abs($task["task_id"]); $link = ''; - } - else { + } else { $link = DOL_URL_ROOT.'/projet/tasks/contact.php?withproject=1&id='.$task["task_id"]; } diff --git a/htdocs/projet/ganttview.php b/htdocs/projet/ganttview.php index 2cecf9c85ba..d578f372777 100644 --- a/htdocs/projet/ganttview.php +++ b/htdocs/projet/ganttview.php @@ -281,8 +281,7 @@ if (count($tasksarray) > 0) $tasks[$taskcursor]['task_is_group'] = 1; $tasks[$taskcursor]['task_css'] = 'ggroupblack'; //$tasks[$taskcursor]['task_css'] = 'gtaskblue'; - } - elseif ($task->hasChildren() > 0) { + } elseif ($task->hasChildren() > 0) { $tasks[$taskcursor]['task_is_group'] = 1; //$tasks[$taskcursor]['task_is_group'] = 0; $tasks[$taskcursor]['task_css'] = 'ggroupblack'; @@ -379,13 +378,11 @@ if (count($tasksarray) > 0) print '
'."\n"; print ''; - } - else { + } else { $langs->load("admin"); print $langs->trans("AvailableOnlyIfJavascriptAndAjaxNotDisabled"); } -} -else { +} else { print '
'.$langs->trans("NoTasks").'
'; } diff --git a/htdocs/projet/graph_opportunities.inc.php b/htdocs/projet/graph_opportunities.inc.php index 90f172f2fe2..a18b2dc54a5 100644 --- a/htdocs/projet/graph_opportunities.inc.php +++ b/htdocs/projet/graph_opportunities.inc.php @@ -98,8 +98,7 @@ if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) print ""; print "
"; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/projet/index.php b/htdocs/projet/index.php index 261b7529907..f4edfdea548 100644 --- a/htdocs/projet/index.php +++ b/htdocs/projet/index.php @@ -140,8 +140,7 @@ if ($resql) } $i++; } -} -else dol_print_error($db); +} else dol_print_error($db); //var_dump($listofoppcode); @@ -272,8 +271,7 @@ if ($resql) } } print "
"; -} -else dol_print_error($db); +} else dol_print_error($db); $companystatic = new Societe($db); // We need a clean new object for next loop because current one has some properties set. @@ -326,8 +324,7 @@ if ($resql) $companystatic->status = $obj->status; print $companystatic->getNomUrl(1); - } - else { + } else { print $langs->trans("OthersNotLinkedToThirdParty"); } print ''; @@ -351,8 +348,7 @@ if ($resql) } $db->free($resql); -} -else { +} else { dol_print_error($db); } print ""; diff --git a/htdocs/projet/info.php b/htdocs/projet/info.php index 772188ec261..6c73d2cfc8b 100644 --- a/htdocs/projet/info.php +++ b/htdocs/projet/info.php @@ -52,8 +52,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 98d9d49fd8e..70ad0f61e96 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -233,8 +233,7 @@ if (empty($reshook)) } else { setEventMessages($langs->trans("DontHaveTheValidateStatus", $objecttmp->ref), null, 'warnings'); } - } - else { + } else { setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); $error++; break; @@ -246,8 +245,7 @@ if (empty($reshook)) if ($nbok > 1) setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs'); else setEventMessages($langs->trans("RecordsClosed", $nbok), null, 'mesgs'); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -282,8 +280,7 @@ if ($resql) { $listofprojectcontacttype[$obj->rowid] = $obj->code; } -} -else dol_print_error($db); +} else dol_print_error($db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is only once. @@ -749,8 +746,7 @@ while ($i < min($num, $limit)) if ($obj->socid) { print $socstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -769,8 +765,7 @@ while ($i < min($num, $limit)) if ($nbofsalesrepresentative > 3) // We print only number { print $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($db); $j = 0; @@ -790,8 +785,7 @@ while ($i < min($num, $limit)) } } //else print $langs->trans("NoSalesRepresentativeAffected"); - } - else { + } else { print ' '; } print ''; diff --git a/htdocs/projet/stats/index.php b/htdocs/projet/stats/index.php index 38d12081b4f..6d56b2088e9 100644 --- a/htdocs/projet/stats/index.php +++ b/htdocs/projet/stats/index.php @@ -350,8 +350,7 @@ print ''; print '
'; $stringtoshow .= ''; @@ -607,8 +598,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third print ''; } -} -elseif ($id > 0 || !empty($ref)) +} elseif ($id > 0 || !empty($ref)) { $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields @@ -805,8 +795,7 @@ elseif ($id > 0 || !empty($ref)) // Show all lines in taskarray (recursive function to go down on tree) $j = 0; $level = 0; $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields); - } - else { + } else { $colspan = 10; if ($object->usage_bill_time) $colspan += 2; print ''; @@ -829,8 +818,7 @@ elseif ($id > 0 || !empty($ref)) include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; cleanCorruptedTree($db, 'projet_task', 'fk_task_parent'); } - } - else { + } else { if ($nboftaskshown < count($tasksarray) && !GETPOST('search_user_id', 'int')) { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; diff --git a/htdocs/projet/tasks/comment.php b/htdocs/projet/tasks/comment.php index 905a6adedbf..e8a4ae93168 100644 --- a/htdocs/projet/tasks/comment.php +++ b/htdocs/projet/tasks/comment.php @@ -74,8 +74,7 @@ if (!empty($project_ref) && !empty($withproject)) if (count($objectsarray) > 0) { $id = $objectsarray[0]->id; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ? '' : '&mode='.$mode)); } } @@ -279,8 +278,7 @@ if ($id > 0 || !empty($ref)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; diff --git a/htdocs/projet/tasks/contact.php b/htdocs/projet/tasks/contact.php index 303ee19425a..2c3737c6788 100644 --- a/htdocs/projet/tasks/contact.php +++ b/htdocs/projet/tasks/contact.php @@ -68,16 +68,14 @@ if ($action == 'addcontact' && $user->rights->projet->creer) if ($result <= 0) { dol_print_error($db, $projectstatic->error, $projectstatic->errors); - } - else { + } else { $contactsofproject = $projectstatic->getListContactId('internal'); foreach ($contactsofproject as $key => $val) { $result = $object->add_contact($val, GETPOST("type"), GETPOST("source")); } } - } - else { + } else { $result = $object->add_contact($idfortaskuser, GETPOST("type"), GETPOST("source")); } } @@ -86,14 +84,12 @@ if ($action == 'addcontact' && $user->rights->projet->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -105,8 +101,7 @@ if ($action == 'swapstatut' && $user->rights->projet->creer) if ($object->fetch($id, $ref)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -121,8 +116,7 @@ if ($action == 'deleteline' && $user->rights->projet->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$object->id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { dol_print_error($db); } } @@ -136,8 +130,7 @@ if (!empty($project_ref) && !empty($withproject)) if (count($tasksarray) > 0) { $id = $tasksarray[0]->id; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode)); exit; } @@ -318,8 +311,7 @@ if ($id > 0 || !empty($ref)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; @@ -538,8 +530,7 @@ if ($id > 0 || !empty($ref)) } } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { $stringtoshow .= $px1->show(); $stringtoshow .= "
\n"; if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index c70a9b042d5..f395a4ee27a 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -236,8 +236,7 @@ if ($action == 'createtask' && $user->rights->projet->creer) setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Label")), null, 'errors'); $action = 'create'; $error++; - } - elseif (empty($_POST['task_parent'])) + } elseif (empty($_POST['task_parent'])) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("ChildOfProjectTask")), null, 'errors'); $action = 'create'; @@ -273,15 +272,13 @@ if ($action == 'createtask' && $user->rights->projet->creer) if ($taskid > 0) { $result = $task->add_contact($_POST["userid"], 'TASKEXECUTIVE', 'internal'); - } - else { + } else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("projects"); setEventMessages($langs->trans('NewTaskRefSuggested'), '', 'warnings'); $duplicate_code_error = true; - } - else { + } else { setEventMessages($task->error, $task->errors, 'errors'); } $action = 'create'; @@ -295,22 +292,19 @@ if ($action == 'createtask' && $user->rights->projet->creer) { header("Location: ".$backtopage); exit; - } - elseif (empty($projectid)) + } elseif (empty($projectid)) { header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php'.(empty($mode) ? '' : '?mode='.$mode)); exit; } $id = $projectid; } - } - else { + } else { if (!empty($backtopage)) { header("Location: ".$backtopage); exit; - } - elseif (empty($id)) + } elseif (empty($id)) { // We go back on task list header("Location: ".DOL_URL_ROOT.'/projet/tasks/list.php'.(empty($mode) ? '' : '?mode='.$mode)); @@ -504,8 +498,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $langs->load("errors"); print $langs->trans("WarningProjectClosed"); print ''; - } - else { + } else { print '
'; print ''; print ''; @@ -532,8 +525,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (empty($duplicate_code_error)) { print (GETPOSTISSET("ref") ?GETPOST("ref", 'alpha') : $defaultref); - } - else { + } else { print $defaultref; } print ''; @@ -553,8 +545,7 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third if (is_array($contactsofproject) && count($contactsofproject)) { print $form->select_dolusers($user->id, 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, '', 'maxwidth300'); - } - else { + } else { print $langs->trans("NoUserAssignedToTheProject"); } print '
'.$langs->trans("NoTasks").'
"; - } - else { + } else { print "ErrorRecordNotFound"; } } diff --git a/htdocs/projet/tasks/document.php b/htdocs/projet/tasks/document.php index 80183db3d60..1493542c5ed 100644 --- a/htdocs/projet/tasks/document.php +++ b/htdocs/projet/tasks/document.php @@ -79,8 +79,7 @@ if (!empty($project_ref) && !empty($withproject)) { $id = $tasksarray[0]->id; $object->fetch($id); - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode)); exit; } @@ -102,8 +101,7 @@ if ($id > 0 || !empty($ref)) $object->project = clone $projectstatic; $upload_dir = $conf->projet->dir_output.'/'.dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref); - } - else { + } else { dol_print_error($db); } } @@ -269,8 +267,7 @@ if ($object->id > 0) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; @@ -316,8 +313,7 @@ if ($object->id > 0) $permtoedit = $user->rights->projet->creer; $relativepathwithnofile = dol_sanitizeFileName($projectstatic->ref).'/'.dol_sanitizeFileName($object->ref).'/'; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { header('Location: index.php'); exit; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index c25546bccbf..8930220f6ec 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -245,8 +245,7 @@ if ($resql) { $listofprojectcontacttype[$obj->rowid] = $obj->code; } -} -else dol_print_error($db); +} else dol_print_error($db); if (count($listofprojectcontacttype) == 0) $listofprojectcontacttype[0] = '0'; // To avoid sql syntax error if not found // Get id of types of contacts for tasks (This list never contains a lot of elements) $listoftaskcontacttype = array(); @@ -260,8 +259,7 @@ if ($resql) { $listoftaskcontacttype[$obj->rowid] = $obj->code; } -} -else dol_print_error($db); +} else dol_print_error($db); if (count($listoftaskcontacttype) == 0) $listoftaskcontacttype[0] = '0'; // To avoid sql syntax error if not found $distinct = 'DISTINCT'; // We add distinct until we are added a protection to be sure a contact of a project and task is assigned only once. @@ -752,8 +750,7 @@ while ($i < min($num, $limit)) $socstatic->id = $obj->socid; $socstatic->name = $obj->name; print $socstatic->getNomUrl(1); - } - else { + } else { print ' '; } print ''; @@ -854,8 +851,7 @@ while ($i < min($num, $limit)) print convertSecondToTime($obj->tobill, 'allhourmin'); $totalarray['val']['t.tobill'] += $obj->tobill; $totalarray['totaltobill'] += $obj->tobill; - } - else { + } else { print ''.$langs->trans("NA").''; } print ''; @@ -872,8 +868,7 @@ while ($i < min($num, $limit)) print convertSecondToTime($obj->billed, 'allhourmin'); $totalarray['val']['t.billed'] += $obj->billed; $totalarray['totalbilled'] += $obj->billed; - } - else { + } else { print ''.$langs->trans("NA").''; } print ''; @@ -938,8 +933,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota { if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").''; else print ''.$langs->trans("Totalforthispage").''; - } - elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''; + } elseif ($totalarray['totalplannedworkloadfield'] == $i) print ''.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''; elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''; elseif ($totalarray['totalprogress_calculatedfield'] == $i) print ''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; elseif ($totalarray['totalprogress_declaredfield'] == $i) print ''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationdeclared'] / $totalarray['totalplannedworkload'], 2).' %' : '').''; diff --git a/htdocs/projet/tasks/note.php b/htdocs/projet/tasks/note.php index 737346570f4..7af9bbbacef 100644 --- a/htdocs/projet/tasks/note.php +++ b/htdocs/projet/tasks/note.php @@ -57,8 +57,7 @@ if ($id > 0 || !empty($ref)) if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $object->project = clone $projectstatic; - } - else { + } else { dol_print_error($db); } } @@ -74,8 +73,7 @@ if (!empty($project_ref) && !empty($withproject)) { $id = $tasksarray[0]->id; $object->fetch($id); - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ? '' : '&mode='.$mode)); } } @@ -241,8 +239,7 @@ if ($object->id > 0) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; diff --git a/htdocs/projet/tasks/stats/index.php b/htdocs/projet/tasks/stats/index.php index bbb275ef5df..a0bf33b34ba 100644 --- a/htdocs/projet/tasks/stats/index.php +++ b/htdocs/projet/tasks/stats/index.php @@ -199,8 +199,7 @@ print '
'; print '
'; $stringtoshow .= ''; // Other attributes @@ -601,8 +595,7 @@ if ($id > 0 || !empty($ref)) if ($user->rights->projet->creer) { print ''.$langs->trans('Modify').''; - } - else { + } else { print ''.$langs->trans('Modify').''; } @@ -612,12 +605,10 @@ if ($id > 0 || !empty($ref)) if (!$object->hasChildren() && !$object->hasTimeSpent()) { print ''.$langs->trans('Delete').''; - } - else { + } else { print ''.$langs->trans('Delete').''; } - } - else { + } else { print ''.$langs->trans('Delete').''; } diff --git a/htdocs/projet/tasks/time.php b/htdocs/projet/tasks/time.php index 95c50b9b62d..6c482264bbf 100644 --- a/htdocs/projet/tasks/time.php +++ b/htdocs/projet/tasks/time.php @@ -154,15 +154,13 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if ($id || $ref) { $object->fetch($id, $ref); - } - else { + } else { if (!GETPOST('taskid', 'int') || GETPOST('taskid', 'int') < 0) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Task")), null, 'errors'); $action = 'createtime'; $error++; - } - else { + } else { $object->fetch(GETPOST('taskid', 'int')); } } @@ -176,8 +174,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) setEventMessages($langs->trans("ProjectMustBeValidatedFirst"), null, 'errors'); $action = 'createtime'; $error++; - } - else { + } else { $object->timespent_note = $_POST["timespent_note"]; if (GETPOST('progress', 'int') > 0) $object->progress = GETPOST('progress', 'int'); // If progress is -1 (not defined), we do not change value $object->timespent_duration = $_POST["timespent_durationhour"] * 60 * 60; // We store duration in seconds @@ -186,8 +183,7 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) { $object->timespent_date = dol_mktime(GETPOST("timehour"), GETPOST("timemin"), 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); $object->timespent_withhour = 1; - } - else { + } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timemonth"), GETPOST("timeday"), GETPOST("timeyear")); } $object->timespent_fk_user = $_POST["userid"]; @@ -195,15 +191,13 @@ if ($action == 'addtimespent' && $user->rights->projet->lire) if ($result >= 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans($object->error), null, 'errors'); $error++; } } } - } - else { + } else { if (empty($id)) $action = 'createtime'; else $action = 'createtime'; } @@ -238,8 +232,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $object->timespent_withhour = 1; - } - else { + } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } $object->timespent_fk_user = $_POST["userid_line"]; @@ -247,13 +240,11 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if ($result >= 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans($object->error), null, 'errors'); $error++; } - } - else { + } else { $object->fetch($id, $ref); // TODO Check that ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids)) @@ -266,8 +257,7 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel { $object->timespent_date = dol_mktime(GETPOST("timelinehour"), GETPOST("timelinemin"), 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); $object->timespent_withhour = 1; - } - else { + } else { $object->timespent_date = dol_mktime(12, 0, 0, GETPOST("timelinemonth"), GETPOST("timelineday"), GETPOST("timelineyear")); } $object->timespent_fk_user = $_POST["userid_line"]; @@ -276,14 +266,12 @@ if (($action == 'updateline' || $action == 'updatesplitline') && !$_POST["cancel if ($result >= 0) { setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans($object->error), null, 'errors'); $error++; } } - } - else { + } else { $action = ''; } } @@ -300,8 +288,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->l setEventMessages($langs->trans($object->error), null, 'errors'); $error++; $action = ''; - } - else { + } else { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } } @@ -315,8 +302,7 @@ if (!empty($project_ref) && !empty($withproject)) if (count($tasksarray) > 0) { $id = $tasksarray[0]->id; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.($withproject ? '&withproject=1' : '').(empty($mode) ? '' : '&mode='.$mode)); exit; } @@ -332,14 +318,12 @@ if (GETPOST('projectid', 'int') > 0) $result = $projectstatic->fetch($projectidforalltimes); if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $res = $projectstatic->fetch_optionals(); -} -elseif (GETPOST('project_ref', 'alpha')) +} elseif (GETPOST('project_ref', 'alpha')) { $projectstatic->fetch(0, GETPOST('project_ref', 'alpha')); $projectidforalltimes = $projectstatic->id; $withproject = 1; -} -elseif ($id > 0) +} elseif ($id > 0) { $object->fetch($id); $result = $projectstatic->fetch($object->fk_project); @@ -353,8 +337,7 @@ if ($action == 'confirm_generateinvoice') if (!($projectstatic->thirdparty->id > 0)) { setEventMessages($langs->trans("ThirdPartyRequiredToGenerateInvoice"), null, 'errors'); - } - else { + } else { include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; @@ -392,8 +375,7 @@ if ($action == 'confirm_generateinvoice') $txtva = $dataforprice['tva_tx']; $localtax1 = $dataforprice['localtax1']; $localtax2 = $dataforprice['localtax2']; - } - else { + } else { $pu_ht = 0; $txtva = get_default_tva($mysoc, $projectstatic->thirdparty); $localtax1 = get_default_localtax($mysoc, $projectstatic->thirdparty, 1); @@ -406,8 +388,7 @@ if ($action == 'confirm_generateinvoice') if ($invoiceToUse) { $tmpinvoice->fetch($invoiceToUse); - } - else { + } else { $result = $tmpinvoice->create($user); if ($result <= 0) { @@ -458,8 +439,7 @@ if ($action == 'confirm_generateinvoice') break; } } - } - elseif ($generateinvoicemode == 'onelineperperiod') { + } elseif ($generateinvoicemode == 'onelineperperiod') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { @@ -502,8 +482,7 @@ if ($action == 'confirm_generateinvoice') break; } } - } - elseif ($generateinvoicemode == 'onelinepertask') { + } elseif ($generateinvoicemode == 'onelinepertask') { $arrayoftasks = array(); foreach ($toselect as $key => $value) { @@ -553,8 +532,7 @@ if ($action == 'confirm_generateinvoice') //var_dump($tmpinvoice); $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -584,8 +562,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $result = $projectstatic->fetch($projectidforalltimes); if (!empty($projectstatic->socid)) $projectstatic->fetch_thirdparty(); $res = $projectstatic->fetch_optionals(); - } - elseif ($object->fetch($id, $ref) >= 0) + } elseif ($object->fetch($id, $ref) >= 0) { if (!empty($conf->global->PROJECT_ALLOW_COMMENT_ON_TASK) && method_exists($object, 'fetchComments') && empty($object->comments)) $object->fetchComments(); $result = $projectstatic->fetch($object->fk_project); @@ -742,14 +719,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { $backtourl = $_SERVER['PHP_SELF'].'?projectid='.$projectstatic->id.($withproject ? '&withproject=1' : ''); $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').'&projectid='.$projectstatic->id.'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); - } - else // We are on tab 'Time Spent' of task + } else // We are on tab 'Time Spent' of task { $backtourl = $_SERVER['PHP_SELF'].'?id='.$object->id.($withproject ? '&withproject=1' : ''); $linktocreatetimeUrl = $_SERVER['PHP_SELF'].'?'.($withproject ? 'withproject=1' : '').($object->id > 0 ? '&id='.$object->id : '&projectid='.$projectstatic->id).'&action=createtime'.$param.'&backtopage='.urlencode($backtourl); } - } - else { + } else { $linktocreatetimeBtnStatus = -2; $linktocreatetimeHelpText = $langs->trans("NotOwnerOfProject"); } @@ -788,8 +763,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; @@ -855,8 +829,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $tmparray = $object->getSummaryOfTimeSpent(); if ($tmparray['total_duration'] > 0) print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; else print '0 %'; - } - else print ''.$langs->trans("WorkloadNotDefined").''; + } else print ''.$langs->trans("WorkloadNotDefined").''; print ''; print ''; @@ -1051,8 +1024,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (is_numeric($nbtotalofrecords) && $limit > $nbtotalofrecords) { $num = $nbtotalofrecords; - } - else { + } else { $sql .= $db->plimit($limit + 1, $offset); $resql = $db->query($sql); @@ -1074,8 +1046,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $title = $langs->trans("ListTaskTimeUserProject"); print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'generic', 0, $linktocreatetime, '', $limit); - } - else { + } else { print ''."\n"; $title = $langs->trans("ListTaskTimeForTask"); @@ -1091,8 +1062,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) $i++; } $db->free($resql); - } - else { + } else { dol_print_error($db); } @@ -1150,8 +1120,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($projectstatic->public) $contactsofproject = array(); print $form->select_dolusers((GETPOST('userid', 'int') ? GETPOST('userid', 'int') : $userid), 'userid', 0, '', 0, '', $contactsofproject, 0, 0, 0, '', 0, $langs->trans("ResourceNotAssignedToProject"), 'maxwidth200'); - } - else { + } else { if ($nboftasks) { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).' '.$langs->trans('FirstAddRessourceToAllocateTime'); } @@ -1310,10 +1279,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (empty($task_time->task_date_withhour)) { print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else { + } else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } else { print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); } print ''; @@ -1329,8 +1296,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { $formproject->selectTasks(-1, GETPOST('taskid', 'int') ?GETPOST('taskid', 'int') : $task_time->fk_task, 'taskid', 0, 0, 1, 1, 0, 0, 'maxwidth300', $projectstatic->id, ''); - } - else { + } else { $tasktmp->id = $task_time->fk_task; $tasktmp->ref = $task_time->ref; $tasktmp->label = $task_time->label; @@ -1370,8 +1336,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } - } - else { + } else { $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; $userstatic->firstname = $task_time->firstname; @@ -1390,14 +1355,12 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; - } - else { + } else { print dol_nl2br($task_time->note); } print ''; if (!$i) $totalarray['nbfield']++; - } - elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) + } elseif ($action == 'editline' && $_GET['lineid'] == $task_time->rowid) { print ''; } @@ -1410,8 +1373,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print ''; print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else { + } else { print convertSecondToTime($task_time->task_duration, 'allhourmin'); } print ''; @@ -1451,12 +1413,10 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print $tmpinvoice->getNomUrl(1); } - } - else { + } else { print $langs->trans("No"); } - } - else { + } else { print ''.$langs->trans("NA").''; } } @@ -1484,8 +1444,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) print ''; print '
'; print ''; - } - elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks + } elseif ($user->rights->projet->lire || $user->rights->projet->all->creer) // Read project and enter time consumed on assigned tasks { if ($task_time->fk_user == $user->id || in_array($task_time->fk_user, $childids) || $user->rights->projet->all->creer) { @@ -1537,10 +1496,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (empty($task_time->task_date_withhour)) { print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); - } - else { + } else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline', 1, 1, 2, "timespent_date", 1, 0); + } else { print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); } print ''; @@ -1588,8 +1545,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } - } - else { + } else { $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; $userstatic->firstname = $task_time->firstname; @@ -1607,13 +1563,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; - } - else { + } else { print dol_nl2br($task_time->note); } print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + } elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; } @@ -1626,8 +1580,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print ''; print $form->select_duration('new_duration', $task_time->task_duration, 0, 'text'); - } - else { + } else { print convertSecondToTime($task_time->task_duration, 'allhourmin'); } print ''; @@ -1681,10 +1634,8 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if (empty($task_time->task_date_withhour)) { print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 3, 3, 2, "timespent_date", 1, 0); - } - else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); - } - else { + } else print $form->selectDate(($date2 ? $date2 : $date1), 'timeline_2', 1, 1, 2, "timespent_date", 1, 0); + } else { print dol_print_date(($date2 ? $date2 : $date1), ($task_time->task_date_withhour ? 'dayhour' : 'day')); } print ''; @@ -1732,8 +1683,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) } else { print img_error($langs->trans('FirstAddRessourceToAllocateTime')).$langs->trans('FirstAddRessourceToAllocateTime'); } - } - else { + } else { $userstatic->id = $task_time->fk_user; $userstatic->lastname = $task_time->lastname; $userstatic->firstname = $task_time->firstname; @@ -1751,13 +1701,11 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) if ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; - } - else { + } else { print dol_nl2br($task_time->note); } print ''; - } - elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) + } elseif ($action == 'splitline' && $_GET['lineid'] == $task_time->rowid) { print ''; } @@ -1770,8 +1718,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { print ''; print $form->select_duration('new_duration_2', 0, 0, 'text'); - } - else { + } else { print convertSecondToTime($task_time->task_duration, 'allhourmin'); } print ''; @@ -1828,8 +1775,7 @@ if (($id > 0 || !empty($ref)) || $projectidforalltimes > 0) { if ($num < $limit && empty($offset)) print ''; else print ''; - } - elseif ($totalarray['totaldurationfield'] == $i) print ''; + } elseif ($totalarray['totaldurationfield'] == $i) print ''; elseif ($totalarray['totalvaluefield'] == $i) print ''; //elseif ($totalarray['totalvaluebilledfield'] == $i) print ''; else print ''; diff --git a/htdocs/public/agenda/agendaexport.php b/htdocs/public/agenda/agendaexport.php index ff8611ee0a4..9530757b283 100644 --- a/htdocs/public/agenda/agendaexport.php +++ b/htdocs/public/agenda/agendaexport.php @@ -109,8 +109,7 @@ if ($reshook < 0) { print '
'.$hookmanager->error.'
'; } llxFooterVierge(); -} -elseif (empty($reshook)) { +} elseif (empty($reshook)) { // Check exportkey if (empty($_GET["exportkey"]) || $conf->global->MAIN_AGENDA_XCAL_EXPORTKEY != $_GET["exportkey"]) { $user->getrights(); @@ -188,8 +187,7 @@ if ($format == 'ical' || $format == 'vcal') //header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); exit; - } - else { + } else { print 'Error '.$agenda->error; exit; @@ -225,8 +223,7 @@ if ($format == 'rss') // header("Location: ".DOL_URL_ROOT.'/document.php?modulepart=agenda&file='.urlencode($filename)); exit; - } - else { + } else { print 'Error '.$agenda->error; exit; diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 13419207e07..9eb0579680a 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -90,8 +90,7 @@ if ($result < 0) echo "User Error:".$user->error; dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); exit; -} -else { +} else { if (empty($user->id)) { echo " User login:".$userlogin." do not exists"; @@ -166,8 +165,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) echo "\nUser Error: ".$user->error."\n"; dol_syslog("cron_run_jobs.php:: User Error:".$user->error, LOG_ERR); exit(-1); - } - else { + } else { if ($result == 0) { echo "\nUser login: ".$userlogin." does not exists for entity ".$conf->entity."\n"; @@ -204,8 +202,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) echo "You can also enable module Log if not yet enabled, run again and take a look into dolibarr.log file\n"; dol_syslog("cron_run_jobs.php::run_jobs Error".$cronjob->error, LOG_ERR); $nbofjobslaunchedko++; - } - else { + } else { $nbofjobslaunchedok++; } @@ -222,8 +219,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) } echo " - reprogrammed\n"; - } - else { + } else { echo " - not qualified\n"; dol_syslog("cron_run_jobs.php job not qualified line->datenextrun:".dol_print_date($line->datenextrun, 'dayhourrfc')." line->datestart:".dol_print_date($line->datestart, 'dayhourrfc')." line->dateend:".dol_print_date($line->dateend, 'dayhourrfc')." now:".dol_print_date($now, 'dayhourrfc')); @@ -233,8 +229,7 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) $conf = $savconf; echo "Result: ".($nbofjobs)." jobs - ".($nbofjobslaunchedok + $nbofjobslaunchedko)." launched = ".$nbofjobslaunchedok." OK + ".$nbofjobslaunchedko." KO"; -} -else { +} else { echo "Result: No active jobs found."; } diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 7e4f1b1b0d7..768b7d42392 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -151,8 +151,7 @@ foreach ($modulesdir as $dir) if ($objMod->numero > 0) { $j = $objMod->numero; - } - else { + } else { $j = 1000 + $i; } @@ -173,8 +172,7 @@ foreach ($modulesdir as $dir) $j++; $i++; } - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR); } @@ -378,8 +376,7 @@ foreach ($demoprofiles as $profilearray) { print "\n".''; print ''; - } - else { + } else { $modulo = ($j % $nbcolsmod); //if ($modulo == 0) print ''; print ''; @@ -431,8 +428,7 @@ if (!empty($conf->google->enabled) && !empty($conf->global->MAIN_GOOGLE_AD_CLIEN print 'src="http://pagead2.googlesyndication.com/pagead/show_ads.js">'."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } } diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 045f726fe1d..49114b89f46 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -87,8 +87,7 @@ if ($resql) if ($objp->public) { print "\n"; - } - else { + } else { print "\n"; } print "\n"; @@ -97,12 +96,10 @@ if ($resql) $i++; } print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { $stringtoshow .= $px1->show(); $stringtoshow .= "
\n"; } diff --git a/htdocs/projet/tasks/task.php b/htdocs/projet/tasks/task.php index 93f3ca3b01e..7a109eb1f50 100644 --- a/htdocs/projet/tasks/task.php +++ b/htdocs/projet/tasks/task.php @@ -113,8 +113,7 @@ if ($action == 'update' && !$_POST["cancel"] && $user->rights->projet->creer) setEventMessages($object->error, $object->errors, 'errors'); } } - } - else { + } else { $action = 'edit'; } } @@ -130,8 +129,7 @@ if ($action == 'confirm_delete' && $confirm == "yes" && $user->rights->projet->s { header('Location: '.DOL_URL_ROOT.'/projet/tasks.php?restore_lastsearch_values=1&id='.$projectstatic->id.($withproject ? '&withproject=1' : '')); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -147,8 +145,7 @@ if (!empty($project_ref) && !empty($withproject)) if (count($tasksarray) > 0) { $id = $tasksarray[0]->id; - } - else { + } else { header("Location: ".DOL_URL_ROOT.'/projet/tasks.php?id='.$projectstatic->id.(empty($mode) ? '' : '&mode='.$mode)); } } @@ -459,8 +456,7 @@ if ($id > 0 || !empty($ref)) print ''; print ''; - } - else { + } else { /* * Fiche tache en mode visu */ @@ -478,8 +474,7 @@ if ($id > 0 || !empty($ref)) { $projectsListId = $projectstatic->getProjectsAuthorizedForUser($user, 0, 1); $object->next_prev_filter = " fk_projet in (".$projectsListId.")"; - } - else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; + } else $object->next_prev_filter = " fk_projet = ".$projectstatic->id; $morehtmlref = ''; @@ -563,8 +558,7 @@ if ($id > 0 || !empty($ref)) $tmparray = $object->getSummaryOfTimeSpent(); if ($tmparray['total_duration'] > 0 && !empty($object->planned_workload)) print round($tmparray['total_duration'] / $object->planned_workload * 100, 2).' %'; else print '0 %'; - } - else print ''.$langs->trans("WorkloadNotDefined").''; + } else print ''.$langs->trans("WorkloadNotDefined").''; print '
'.$langs->trans("Total").''.$langs->trans("Totalforthispage").''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.convertSecondToTime($totalarray['totalduration'], 'allhourmin').''.price($totalarray['totalvalue']).''.price($totalarray['totalvaluebilled']).'
".dolGetFirstLastname($objp->firstname, $objp->lastname)." ".$objp->societe."Anonyme Anonyme".dol_print_date($db->jdate($objp->datedon))."
"; - } - else { + } else { print "Aucun don publique"; } -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 71e28c94da8..7eb45f008e6 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -107,13 +107,11 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $ { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_small); $width = 150; - } - elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) + } elseif (!empty($mysoc->logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/'.$mysoc->logo); $width = 150; - } - elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) + } elseif (is_readable(DOL_DOCUMENT_ROOT.'/theme/dolibarr_logo.svg')) { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_logo.svg'; $width = 150; @@ -343,10 +341,8 @@ if ($action == 'add') if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; $to = $adh->makeSubstitution($conf->global->MAIN_INFO_SOCIETE_MAIL); $from = $conf->global->ADHERENT_MAIL_FROM; @@ -375,8 +371,7 @@ if ($action == 'add') { $urlback = $conf->global->MEMBER_URL_REDIRECT_SUBSCRIPTION; // TODO Make replacement of __AMOUNT__, etc... - } - else $urlback = $_SERVER["PHP_SELF"]."?action=added"; + } else $urlback = $_SERVER["PHP_SELF"]."?action=added"; if (!empty($conf->global->MEMBER_NEWFORM_PAYONLINE) && $conf->global->MEMBER_NEWFORM_PAYONLINE != '-1') { @@ -390,13 +385,11 @@ if ($action == 'add') if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } - else { + } else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } - } - elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paybox') { $urlback = DOL_MAIN_URL_ROOT.'/public/paybox/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); @@ -406,13 +399,11 @@ if ($action == 'add') if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } - else { + } else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } - } - elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'paypal') { $urlback = DOL_MAIN_URL_ROOT.'/public/paypal/newpayment.php?from=membernewform&source=membersubscription&ref='.urlencode($adh->ref); if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); @@ -422,13 +413,11 @@ if ($action == 'add') if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } - else { + } else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } - } - elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') + } elseif ($conf->global->MEMBER_NEWFORM_PAYONLINE == 'stripe') { $urlback = DOL_MAIN_URL_ROOT.'/public/stripe/newpayment.php?from=membernewform&source=membersubscription&ref='.$adh->ref; if (price2num(GETPOST('amount', 'alpha'))) $urlback .= '&amount='.price2num(GETPOST('amount', 'alpha')); @@ -438,13 +427,11 @@ if ($action == 'add') if (!empty($conf->global->PAYMENT_SECURITY_TOKEN_UNIQUE)) { $urlback .= '&securekey='.urlencode(dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.'membersubscription'.$adh->ref, 2)); - } - else { + } else { $urlback .= '&securekey='.urlencode($conf->global->PAYMENT_SECURITY_TOKEN); } } - } - else { + } else { dol_print_error('', "Autosubscribe form is setup to ask an online payment for a not managed online payment"); exit; } @@ -452,8 +439,7 @@ if ($action == 'add') if (!empty($entity)) $urlback .= '&entity='.$entity; dol_syslog("member ".$adh->ref." was created, we redirect to ".$urlback); - } - else { + } else { $error++; $errmsg .= join('
', $adh->errors); } @@ -465,8 +451,7 @@ if ($action == 'add') Header("Location: ".$urlback); exit; - } - else { + } else { $db->rollback(); } } @@ -567,8 +552,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCETYPE)) print ''.$langs->trans("Type").' *'; print $form->selectarray("type", $adht->liste_array(), GETPOST('type') ?GETPOST('type') : $defaulttype, $isempty); print ''."\n"; -} -else { +} else { $adht->fetch($conf->global->MEMBER_NEWFORM_FORCETYPE); print ''; } @@ -580,8 +564,7 @@ if (empty($conf->global->MEMBER_NEWFORM_FORCEMORPHY)) print ''.$langs->trans('MemberNature').' *'."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy'), 1); print ''."\n"; -} -else { +} else { print $morphys[$conf->global->MEMBER_NEWFORM_FORCEMORPHY]; print ''; } @@ -723,8 +706,7 @@ if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT) if (!empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { print ''; - } - else { + } else { print ''; print ''; } diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index a955c9605f2..c1677b2902b 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -84,8 +84,7 @@ if ($id > 0) if (empty($object->public)) { print $langs->trans("ErrorThisMemberIsNotPublic"); - } - else { + } else { print ''; print '\n"; diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 1a885ed3596..cb5b9308ed4 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -152,16 +152,14 @@ if ($result) print ''."\n"; - } - else { + } else { print "\n"; } print ""; $i++; } print "
'.$langs->trans("Type").''.$object->type."
'; print $form->showphoto('memberphoto', $objp, 64); print ' 
"; -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/public/notice.php b/htdocs/public/notice.php index b3b362fa6b2..a86b8c68e42 100644 --- a/htdocs/public/notice.php +++ b/htdocs/public/notice.php @@ -38,8 +38,7 @@ if (!GETPOST('transkey', 'alphanohtml') && !GETPOST('transphrase', 'alphanohtml' { print 'Sorry, it seems your internet connexion is off.
'; print 'You need to be connected to network to use this software.
'; -} -else { +} else { $langs->load("error"); $langs->load("other"); diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 20b029f960d..2031c11a3ad 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -174,8 +174,7 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width = 150; -} -elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); @@ -235,8 +234,7 @@ if ($source == 'proposal') { $mesg = $proposal->error; $error++; - } - else { + } else { $result = $proposal->fetch_thirdparty($proposal->socid); } @@ -275,12 +273,10 @@ if ($action != 'dosign') { if ($found && !$error) // We are in a management option and no error { - } - else { + } else { dol_print_error_email('ERRORNEWONLINESIGN'); } -} -else { +} else { // Print } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index f26d31c483d..4f437c07740 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -108,12 +108,10 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout if (isset($_POST["choix$i"]) && $_POST["choix$i"] == '1') { $nouveauchoix .= "1"; - } - elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') + } elseif (isset($_POST["choix$i"]) && $_POST["choix$i"] == '2') { $nouveauchoix .= "2"; - } - else { // sinon c'est 0 + } else { // sinon c'est 0 $nouveauchoix .= "0"; } } @@ -132,8 +130,7 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout { setEventMessages($langs->trans("VoteNameAlreadyExists"), null, 'errors'); $error++; - } - else { + } else { $sql = 'INSERT INTO '.MAIN_DB_PREFIX.'opensurvey_user_studs (nom, id_sondage, reponses)'; $sql .= " VALUES ('".$db->escape($nom)."', '".$db->escape($numsondage)."','".$db->escape($nouveauchoix)."')"; $resql = $db->query($sql); @@ -168,11 +165,9 @@ if (GETPOST("boutonp") || GETPOST("boutonp.x") || GETPOST("boutonp_x")) // bout $result = $cmailfile->sendfile(); } } - } - else dol_print_error($db); + } else dol_print_error($db); } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Name")), null, 'errors'); } } @@ -208,12 +203,10 @@ if ($testmodifier) if (isset($_POST["choix".$i]) && $_POST["choix".$i] == '1') { $nouveauchoix .= "1"; - } - elseif (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') + } elseif (isset($_POST["choix".$i]) && $_POST["choix".$i] == '2') { $nouveauchoix .= "2"; - } - else { // sinon c'est 0 + } else { // sinon c'est 0 $nouveauchoix .= "0"; } } @@ -389,8 +382,7 @@ if ($object->format == "D") print ''."\n"; } -} -else { +} else { //display of survey topics print ''."\n"; print ''."\n"; @@ -477,8 +469,7 @@ while ($compteur < $num) if (((string) $car) == "0") $sumagainst[$i]++; } } - } - else { + } else { //sinon on remplace les choix de l'utilisateur par une ligne de checkbox pour recuperer de nouvelles valeurs if ($compteur == $ligneamodifier) { @@ -504,8 +495,7 @@ while ($compteur < $num) } print ''."\n"; } - } - else { + } else { for ($i = 0; $i < $nbcolonnes; $i++) { $car = substr($ensemblereponses, $i, 1); @@ -689,8 +679,7 @@ if ($object->allow_spy) { } else { $meilleursujet .= dol_print_date($toutsujet[$i], 'daytext').' ('.dol_print_date($toutsujet[$i], '%A').')'; } - } - else { + } else { $tmps = explode('@', $toutsujet[$i]); $meilleursujet .= dol_htmlentities($tmps[0]); } diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index b82dcc3360b..746fcffcfa4 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -210,8 +210,7 @@ if (!empty($conf->global->PAYMENT_SECURITY_TOKEN)) { if ($source && $REF) $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN.$source.$REF, 2); // Use the source in the hash to avoid duplicates if the references are identical else $token = dol_hash($conf->global->PAYMENT_SECURITY_TOKEN, 2); - } - else { + } else { $token = $conf->global->PAYMENT_SECURITY_TOKEN; } if ($SECUREKEY != $token) @@ -466,8 +465,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) dol_syslog('Failed to create card record', LOG_WARNING, 0, '_stripe'); setEventMessages('Failed to create card record', null, 'errors'); $action = ''; - } - else { + } else { if (!empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; if (!empty($dol_id)) $metadata["dol_id"] = $dol_id; if (!empty($dol_type)) $metadata["dol_type"] = $dol_type; @@ -493,8 +491,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) } } } - } - else { + } else { $vatcleaned = $vatnumber ? $vatnumber : null; /*$taxinfo = array('type'=>'vat'); @@ -648,8 +645,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) } else { $paymentintent = \Stripe\PaymentIntent::retrieve($paymentintent_id, array("stripe_account" => $stripeacc)); } - } - catch (Exception $e) + } catch (Exception $e) { $error++; $errormessage = "CantRetreivePaymentIntent ".$e->getMessage(); @@ -665,8 +661,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) dol_syslog($errormessage, LOG_WARNING, 0, '_stripe'); setEventMessages($paymentintent->status, null, 'errors'); $action = ''; - } - else { + } else { // TODO We can alse record the payment mode into llx_societe_rib with stripe $paymentintent->payment_method // Note that with other old Stripe architecture (using Charge API), the payment mode was not recorded, so it is not mandatory to do it here. //dol_syslog("Create payment_method for ".$paymentintent->payment_method, LOG_DEBUG, 0, '_stripe'); @@ -695,8 +690,7 @@ if ($action == 'charge' && !empty($conf->stripe->enabled)) { header("Location: ".$urlko); exit; - } - else { + } else { header("Location: ".$urlok); exit; } @@ -769,8 +763,7 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width = 150; -} -elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); @@ -870,8 +863,7 @@ if (!$source) { print ''; print ''; - } - else { + } else { print ''.price($amount).''; print ''; print ''; @@ -907,8 +899,7 @@ if ($source == 'order') { $mesg = $order->error; $error++; - } - else { + } else { $result = $order->fetch_thirdparty($order->socid); } $object = $order; @@ -964,8 +955,7 @@ if ($source == 'order') { print ''; print ''; - } - else { + } else { print ''.price($amount).''; print ''; print ''; @@ -1001,8 +991,7 @@ if ($source == 'order') print ''."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } if (is_object($order->thirdparty)) print ''."\n"; @@ -1028,8 +1017,7 @@ if ($source == 'invoice') { $mesg = $invoice->error; $error++; - } - else { + } else { $result = $invoice->fetch_thirdparty($invoice->socid); } $object = $invoice; @@ -1087,14 +1075,12 @@ if ($source == 'invoice') { print ''; print ''; - } - else { + } else { print ''.price($amount).''; print ''; print ''; } - } - else { + } else { print ''.price($object->total_ttc, 1, $langs).''; } // Currency @@ -1128,8 +1114,7 @@ if ($source == 'invoice') print ''."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } if (is_object($invoice->thirdparty)) print ''."\n"; @@ -1156,21 +1141,18 @@ if ($source == 'contractline') { $mesg = $contractline->error; $error++; - } - else { + } else { if ($contractline->fk_contrat > 0) { $result = $contract->fetch($contractline->fk_contrat); if ($result > 0) { $result = $contract->fetch_thirdparty($contract->socid); - } - else { + } else { $mesg = $contract->error; $error++; } - } - else { + } else { $mesg = 'ErrorRecordNotFound'; $error++; } @@ -1192,8 +1174,7 @@ if ($source == 'contractline') $pu_ht = $product->multiprices[$contract->thirdparty->price_level]; $pu_ttc = $product->multiprices_ttc[$contract->thirdparty->price_level]; $price_base_type = $product->multiprices_base_type[$contract->thirdparty->price_level]; - } - else { + } else { $pu_ht = $product->price; $pu_ttc = $product->price_ttc; $price_base_type = $product->price_base_type; @@ -1278,8 +1259,7 @@ if ($source == 'contractline') if ($contractline->product->duration_value > 1) { $dur = array("h"=>$langs->trans("Hours"), "d"=>$langs->trans("DurationDays"), "w"=>$langs->trans("DurationWeeks"), "m"=>$langs->trans("DurationMonths"), "y"=>$langs->trans("DurationYears")); - } - else { + } else { $dur = array("h"=>$langs->trans("Hour"), "d"=>$langs->trans("DurationDay"), "w"=>$langs->trans("DurationWeek"), "m"=>$langs->trans("DurationMonth"), "y"=>$langs->trans("DurationYear")); } $duration = $contractline->product->duration_value.' '.$dur[$contractline->product->duration_unit]; @@ -1298,8 +1278,7 @@ if ($source == 'contractline') { print ''; print ''; - } - else { + } else { print ''.price($amount).''; print ''; print ''; @@ -1335,8 +1314,7 @@ if ($source == 'contractline') print ''."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } if (is_object($contract->thirdparty)) print ''."\n"; @@ -1362,8 +1340,7 @@ if ($source == 'membersubscription') { $mesg = $member->error; $error++; - } - else { + } else { $member->fetch_thirdparty(); $subscription = new Subscription($db); } @@ -1450,8 +1427,7 @@ if ($source == 'membersubscription') if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; } - } - else { + } else { if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } @@ -1464,8 +1440,7 @@ if ($source == 'membersubscription') if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; print ''; - } - else { + } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''.price($valtoshow).''; @@ -1504,8 +1479,7 @@ if ($source == 'membersubscription') print ''."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } if (is_object($member->thirdparty)) print ''."\n"; @@ -1529,8 +1503,7 @@ if ($source == 'donation') { $mesg = $don->error; $error++; - } - else { + } else { $don->fetch_thirdparty(); } $object = $don; @@ -1593,8 +1566,7 @@ if ($source == 'donation') if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; } - } - else { + } else { if (!empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; } @@ -1607,8 +1579,7 @@ if ($source == 'donation') if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''; print ''; - } - else { + } else { $valtoshow = $amount; if (!empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow = max($conf->global->MEMBER_MIN_AMOUNT, $valtoshow); print ''.price($valtoshow).''; @@ -1647,8 +1618,7 @@ if ($source == 'donation') print ''."\n"; print ''."\n"; print ''."\n"; - } - else { + } else { print ''."\n"; } if (is_object($don->thirdparty)) print ''."\n"; @@ -1675,16 +1645,13 @@ if ($action != 'dopayment') if ($source == 'order' && $object->billed) { print '

'.$langs->trans("OrderBilled").''; - } - elseif ($source == 'invoice' && $object->paye) + } elseif ($source == 'invoice' && $object->paye) { print '

'.$langs->trans("InvoicePaid").''; - } - elseif ($source == 'donation' && $object->paid) + } elseif ($source == 'donation' && $object->paid) { print '

'.$langs->trans("DonationPaid").''; - } - else { + } else { // Membership can be paid and we still allow to make renewal if ($source == 'membersubscription' && $object->datefin > dol_now()) { @@ -1773,12 +1740,10 @@ if ($action != 'dopayment') '; } } - } - else { + } else { dol_print_error_email('ERRORNEWPAYMENT'); } -} -else { +} else { // Print } @@ -1915,8 +1880,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment if (empty($paymentintent)) { print '
'.$langs->trans("Error").'
'; - } - else { + } else { print ''; //$_SESSION["paymentintent_id"] = $paymentintent->id; } @@ -1930,8 +1894,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment { $langs->load("errors"); print info_admin($langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Stripe")), 0, 0, 'error'); - } - else { + } else { print ''; print ''."\n"; print ''."\n"; @@ -1993,8 +1956,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment $_SESSION['ipaddress'] = ($remoteip ? $remoteip : 'unknown'); // Payer ip $_SESSION['payerID'] = is_object($stripecu) ? $stripecu->id : ''; $_SESSION['TRANSACTIONID'] = $sessionstripe->id; - } - catch (Exception $e) + } catch (Exception $e) { print $e->getMessage(); } @@ -2042,8 +2004,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) + } elseif (!empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { ?> // Code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION set @@ -2146,8 +2107,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment }); // Old code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off @@ -2214,8 +2174,7 @@ if (preg_match('/^dopayment/', $action)) // If we choosed/click on the payment } }); /* Use 3DS source */ diff --git a/htdocs/public/payment/paymentko.php b/htdocs/public/payment/paymentko.php index a261c6101a0..c42677d8b21 100644 --- a/htdocs/public/payment/paymentko.php +++ b/htdocs/public/payment/paymentko.php @@ -77,8 +77,7 @@ if (empty($paymentmethod)) { dol_print_error(null, 'The back url does not contains a parameter fulltag that should help us to find the payment method used'); exit; -} -else { +} else { dol_syslog("paymentmethod=".$paymentmethod); } @@ -158,10 +157,8 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentFailed"); @@ -185,8 +182,7 @@ if (!empty($_SESSION['ipaddress'])) // To avoid to make action twice if ($result) { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } - else { + } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } @@ -225,8 +221,7 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width = 150; -} -elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index a1d562b8690..4bb899b930e 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -163,8 +163,7 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/thumbs/'.$logosmall); $width = 150; -} -elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) +} elseif (!empty($logo) && is_readable($conf->mycompany->dir_output.'/logos/'.$logo)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); $urllogofull = $dolibarr_main_url_root.'/viewimage.php?modulepart=mycompany&entity='.$conf->entity.'&file='.urlencode('logos/'.$logo); @@ -221,8 +220,7 @@ if (!empty($conf->paypal->enabled)) { // Nothing to do dol_syslog("Call to GetExpressCheckoutDetails return ".$ack, LOG_DEBUG, 0, '_payment'); - } - else { + } else { dol_syslog("Call to GetExpressCheckoutDetails return error: ".json_encode($resArray), LOG_WARNING, '_payment'); } @@ -249,8 +247,7 @@ if (!empty($conf->paypal->enabled)) $NOTE = urldecode($resArray2["NOTE"]); $ispaymentok = true; - } - else { + } else { dol_syslog("Call to DoExpressCheckoutPayment return error: ".json_encode($resArray2), LOG_WARNING, 0, '_payment'); //Display a user friendly Error on the page using any of the following error information returned by PayPal @@ -259,12 +256,10 @@ if (!empty($conf->paypal->enabled)) $ErrorLongMsg = urldecode($resArray2["L_LONGMESSAGE0"]); $ErrorSeverityCode = urldecode($resArray2["L_SEVERITYCODE0"]); } - } - else { + } else { dol_print_error('', 'Session expired'); } - } - else { + } else { dol_print_error('', '$PAYPALTOKEN not defined'); } } @@ -415,8 +410,7 @@ if ($ispaymentok) $errmsg = $object->error; $postactionmessages[] = $errmsg; $ispostactionok = -1; - } - else { + } else { $postactionmessages[] = 'Subscription created'; $ispostactionok = 1; } @@ -437,8 +431,7 @@ if ($ispaymentok) $postactionmessages[] = $object->error; $postactionmessages = array_merge($postactionmessages, $object->errors); $ispostactionok = -1; - } - else { + } else { if ($option == 'bankviainvoice') { $postactionmessages[] = 'Invoice, payment and bank record created'; @@ -502,8 +495,7 @@ if ($ispaymentok) $postactionmessages[] = $errmsg; $ispostactionok = -1; } - } - catch (Exception $e) { + } catch (Exception $e) { $error++; $errmsg = 'Failed to save customer stripe id in database ; '.$e->getMessage(); $postactionmessages[] = $errmsg; @@ -516,8 +508,7 @@ if ($ispaymentok) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } @@ -582,8 +573,7 @@ if ($ispaymentok) $errmsg = $object->error; $postactionmessages[] = $errmsg; $ispostactionok = -1; - } - else { + } else { if ($file) $postactionmessages[] = 'Email sent to member (with invoice document attached)'; else $postactionmessages[] = 'Email sent to member (without any attached document)'; @@ -591,18 +581,15 @@ if ($ispaymentok) } } } - } - else { + } else { $postactionmessages[] = 'Failed to get a valid value for "amount paid" or "payment type" to record the payment of subscription for member '.$tmptag['MEM'].'. May be payment was already recorded.'; $ispostactionok = -1; } - } - else { + } else { $postactionmessages[] = 'Member '.$tmptag['MEM'].' for subscription payed was not found'; $ispostactionok = -1; } - } - elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0) + } elseif (array_key_exists('INV', $tmptag) && $tmptag['INV'] > 0) { // Record payment include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; @@ -637,8 +624,7 @@ if ($ispaymentok) if ($currencyCodeType == $conf->currency) { $paiement->amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching with invoice id - } - else { + } else { $paiement->multicurrency_amounts = array($invoice->id => $FinalPaymentAmt); // Array with all payments dispatching $postactionmessages[] = 'Payment was done in a different currency that currency expected of company'; @@ -660,8 +646,7 @@ if ($ispaymentok) $postactionmessages[] = $paiement->error.' '.join("
\n", $paiement->errors); $ispostactionok = -1; $error++; - } - else { + } else { $postactionmessages[] = 'Payment created'; $ispostactionok = 1; } @@ -684,13 +669,11 @@ if ($ispaymentok) $postactionmessages[] = $paiement->error.' '.join("
\n", $paiement->errors); $ispostactionok = -1; $error++; - } - else { + } else { $postactionmessages[] = 'Bank transaction of payment created'; $ispostactionok = 1; } - } - else { + } else { $postactionmessages[] = 'Setup of bank account to use in module '.$paymentmethod.' was not set. No way to record the payment.'; $ispostactionok = -1; $error++; @@ -700,22 +683,18 @@ if ($ispaymentok) if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } - } - else { + } else { $postactionmessages[] = 'Failed to get a valid value for "amount paid" ('.$FinalPaymentAmt.') or "payment type" ('.$paymentType.') to record the payment of invoice '.$tmptag['INV'].'. May be payment was already recorded.'; $ispostactionok = -1; } - } - else { + } else { $postactionmessages[] = 'Invoice payed '.$tmptag['INV'].' was not found'; $ispostactionok = -1; } - } - else { + } else { // Nothing done } } @@ -770,10 +749,8 @@ if ($ispaymentok) if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived"); @@ -784,16 +761,14 @@ if ($ispaymentok) $content .= ''.$companylangs->trans("PaymentSubscription")."

\n"; $content .= $companylangs->trans("MemberId").': '.$tmptag['MEM']."
\n"; $content .= $companylangs->trans("Link").': '.$url.''."
\n"; - } - elseif (array_key_exists('INV', $tmptag)) + } elseif (array_key_exists('INV', $tmptag)) { $url = $urlwithroot."/compta/facture/card.php?id=".$tmptag['INV']; $content .= ''.$companylangs->trans("Payment")."

\n"; $content .= $companylangs->trans("InvoiceId").': '.$tmptag['INV']."
\n"; //$content.=$companylangs->trans("ThirdPartyId").': '.$tmptag['CUS']."
\n"; $content .= $companylangs->trans("Link").': '.$url.''."
\n"; - } - else { + } else { $content .= $companylangs->transnoentitiesnoconv("NewOnlinePaymentReceived")."
\n"; } $content .= $companylangs->transnoentities("PostActionAfterPayment").' : '; @@ -801,12 +776,10 @@ if ($ispaymentok) { //$topic.=' ('.$companylangs->transnoentitiesnoconv("Status").' '.$companylangs->transnoentitiesnoconv("OK").')'; $content .= ''.$companylangs->transnoentitiesnoconv("OK").''; - } - elseif ($ispostactionok == 0) + } elseif ($ispostactionok == 0) { $content .= $companylangs->transnoentitiesnoconv("None"); - } - else { + } else { $topic .= ($ispostactionok ? '' : ' ('.$companylangs->trans("WarningPostActionErrorAfterPayment").')'); $content .= ''.$companylangs->transnoentitiesnoconv("Error").''; } @@ -844,14 +817,12 @@ if ($ispaymentok) { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); //dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0); - } - else { + } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); //dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0); } } -} -else { +} else { // Get on url call $onlinetoken = empty($PAYPALTOKEN) ? $_SESSION['onlinetoken'] : $PAYPALTOKEN; $payerID = empty($PAYPALPAYERID) ? $_SESSION['payerID'] : $PAYPALPAYERID; @@ -902,10 +873,8 @@ else { if (preg_match('/\d\.\d/', $appli)) { if (!preg_match('/'.preg_quote(DOL_VERSION).'/', $appli)) $appli .= " (".DOL_VERSION.")"; // If new title contains a version that is different than core - } - else $appli .= " ".DOL_VERSION; - } - else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; + } else $appli .= " ".DOL_VERSION; $urlback = $_SERVER["REQUEST_URI"]; $topic = '['.$appli.'] '.$companylangs->transnoentitiesnoconv("ValidationOfPaymentFailed"); @@ -929,8 +898,7 @@ else { if ($result) { dol_syslog("EMail sent to ".$sendto, LOG_DEBUG, 0, '_payment'); - } - else { + } else { dol_syslog("Failed to send EMail to ".$sendto, LOG_ERR, 0, '_payment'); } } diff --git a/htdocs/public/stripe/confirm_payment.php b/htdocs/public/stripe/confirm_payment.php index 9c6346842c8..683a537fe69 100644 --- a/htdocs/public/stripe/confirm_payment.php +++ b/htdocs/public/stripe/confirm_payment.php @@ -48,21 +48,18 @@ if (isset($_GET['connect'])) $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY; $service = 'StripeTest'; $servicestatus = 0; - } - else { + } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; $servicestatus = 1; } -} -else { +} else { if (isset($_GET['test'])) { $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; $service = 'StripeTest'; $servicestatus = 0; - } - else { + } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $service = 'StripeLive'; $servicestatus = 1; diff --git a/htdocs/public/stripe/ipn.php b/htdocs/public/stripe/ipn.php index e3cc21b327b..d3a9521bf25 100644 --- a/htdocs/public/stripe/ipn.php +++ b/htdocs/public/stripe/ipn.php @@ -48,21 +48,18 @@ if (isset($_GET['connect'])) $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_CONNECT_KEY; $service = 'StripeTest'; $servicestatus = 0; - } - else { + } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_CONNECT_KEY; $service = 'StripeLive'; $servicestatus = 1; } -} -else { +} else { if (isset($_GET['test'])) { $endpoint_secret = $conf->global->STRIPE_TEST_WEBHOOK_KEY; $service = 'StripeTest'; $servicestatus = 0; - } - else { + } else { $endpoint_secret = $conf->global->STRIPE_LIVE_WEBHOOK_KEY; $service = 'StripeLive'; $servicestatus = 1; @@ -89,8 +86,7 @@ $error = 0; try { $event = \Stripe\Webhook::constructEvent($payload, $sig_header, $endpoint_secret); -} -catch (\UnexpectedValueException $e) { +} catch (\UnexpectedValueException $e) { // Invalid payload http_response_code(400); // PHP 5.4 or greater exit(); @@ -123,12 +119,10 @@ if (!empty($conf->multicompany->enabled) && !empty($conf->stripeconnect->enabled { $obj = $db->fetch_object($result); $key = $obj->entity; - } - else { + } else { $key = 1; } - } - else { + } else { $key = 1; } $ret = $mc->switchEntity($key); @@ -186,14 +180,12 @@ if ($event->type == 'payout.created') { http_response_code(200); // PHP 5.4 or greater return 1; - } - else { + } else { $error++; http_response_code(500); // PHP 5.4 or greater return -1; } -} -elseif ($event->type == 'payout.paid') { +} elseif ($event->type == 'payout.paid') { global $conf; $error = 0; $result = dolibarr_set_const($db, $service."_NEXTPAYOUT", null, 'chaine', 0, '', $conf->entity); @@ -266,41 +258,32 @@ elseif ($event->type == 'payout.paid') { http_response_code(200); // PHP 5.4 or greater return 1; - } - else { + } else { $error++; http_response_code(500); // PHP 5.4 or greater return -1; } -} -elseif ($event->type == 'customer.source.created') { +} elseif ($event->type == 'customer.source.created') { //TODO: save customer's source -} -elseif ($event->type == 'customer.source.updated') { +} elseif ($event->type == 'customer.source.updated') { //TODO: update customer's source -} -elseif ($event->type == 'customer.source.delete') { +} elseif ($event->type == 'customer.source.delete') { //TODO: delete customer's source -} -elseif ($event->type == 'customer.deleted') { +} elseif ($event->type == 'customer.deleted') { $db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_account WHERE key_account = '".$db->escape($event->data->object->id)."' and site='stripe'"; $db->query($sql); $db->commit(); -} -elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). +} elseif ($event->type == 'payment_intent.succeeded') { // Called when making payment with PaymentIntent method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). // TODO: create fees // TODO: Redirect to paymentok.php -} -elseif ($event->type == 'payment_intent.payment_failed') { +} elseif ($event->type == 'payment_intent.payment_failed') { // TODO: Redirect to paymentko.php -} -elseif ($event->type == 'checkout.session.completed') // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). +} elseif ($event->type == 'checkout.session.completed') // Called when making payment with new Checkout method ($conf->global->STRIPE_USE_NEW_CHECKOUT is on). { // TODO: create fees // TODO: Redirect to paymentok.php -} -elseif ($event->type == 'payment_method.attached') { +} elseif ($event->type == 'payment_method.attached') { require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; $societeaccount = new SocieteAccount($db); @@ -339,13 +322,11 @@ elseif ($event->type == 'payment_method.attached') { if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } -} -elseif ($event->type == 'payment_method.updated') { +} elseif ($event->type == 'payment_method.updated') { require_once DOL_DOCUMENT_ROOT.'/societe/class/companypaymentmode.class.php'; $companypaymentmode = new CompanyPaymentMode($db); $companypaymentmode->fetch(0, '', 0, '', " AND stripe_card_ref = '".$db->escape($event->data->object->id)."'"); @@ -375,25 +356,20 @@ elseif ($event->type == 'payment_method.updated') { if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } -} -elseif ($event->type == 'payment_method.detached') { +} elseif ($event->type == 'payment_method.detached') { $db->begin(); $sql = "DELETE FROM ".MAIN_DB_PREFIX."societe_rib WHERE ref = '".$db->escape($event->data->object->id)."' and status = ".$servicestatus; $db->query($sql); $db->commit(); -} -elseif ($event->type == 'charge.succeeded') { +} elseif ($event->type == 'charge.succeeded') { // TODO: create fees // TODO: Redirect to paymentok.php -} -elseif ($event->type == 'charge.failed') { +} elseif ($event->type == 'charge.failed') { // TODO: Redirect to paymentko.php -} -elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated == true)) { +} elseif (($event->type == 'source.chargeable') && ($event->data->object->type == 'three_d_secure') && ($event->data->object->three_d_secure->authenticated == true)) { // This event is deprecated. } diff --git a/htdocs/public/test/test_arrays.php b/htdocs/public/test/test_arrays.php index cbe88b006d4..ffa4b24fc59 100644 --- a/htdocs/public/test/test_arrays.php +++ b/htdocs/public/test/test_arrays.php @@ -45,8 +45,7 @@ if (empty($usedolheader)) trans("ErrorFieldRequired", $langs->transnoentities("TicketEmailNotificationFrom")).'
'; print $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentities("Ticket")); print '
'; - } - else { + } else { print '
'.$langs->trans('TicketPublicInfoCreateTicket').'
'; $formticket->showForm(); } diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 51e120cdbd5..2b9ab94c5b1 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -187,8 +187,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a if ($action == "add_message") { $action = 'presend'; - } - else { + } else { $action = ''; } } @@ -371,8 +370,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Message list print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'object_conversation'); $object->viewTicketMessages(false, true, $object->dao); - } - else { + } else { print ''; } } else { diff --git a/htdocs/public/website/index.php b/htdocs/public/website/index.php index 2f18de010a0..d09b8e10012 100644 --- a/htdocs/public/website/index.php +++ b/htdocs/public/website/index.php @@ -95,8 +95,7 @@ if (empty($pageid)) if ($result > 0) { $pageid = $objectpage->id; - } - elseif ($result == 0) + } elseif ($result == 0) { // Page not found from ref=pageurl, we try using alternative alias $result = $objectpage->fetch(0, $object->id, null, $pageref); @@ -105,8 +104,7 @@ if (empty($pageid)) $pageid = $objectpage->id; } } - } - else { + } else { if ($object->fk_default_home > 0) { $result = $objectpage->fetch($object->fk_default_home); @@ -163,8 +161,7 @@ if ($pageid == 'css') // No more used ? //else header('Cache-Control: no-cache'); $original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/styles.css.php'; -} -else { +} else { $original_file = $dolibarr_main_data_root.'/website/'.$websitekey.'/page'.$pageid.'.tpl.php'; } diff --git a/htdocs/public/website/styles.css.php b/htdocs/public/website/styles.css.php index 24125178f5d..8854c13ea52 100644 --- a/htdocs/public/website/styles.css.php +++ b/htdocs/public/website/styles.css.php @@ -77,8 +77,7 @@ if (empty($pageid)) { $object->fetch($websiteid); $website = $object->ref; - } - else { + } else { $object->fetch(0, $website); } diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 2ada4b1c447..7bc99977943 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -79,7 +79,7 @@ else { $result = restrictedArea($user, 'reception'); if ($origin == 'supplierorder') { if (empty($user->rights->fournisseur->commande->lire) && empty($user->rights->fournisseur->commande->read)) accessforbidden(); - }elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden(); + } elseif (empty($user->rights->{$origin}->lire) && empty($user->rights->{$origin}->read)) accessforbidden(); } $action = GETPOST('action', 'alpha'); @@ -352,8 +352,7 @@ if (empty($reshook)) $error++; } } - } - else { + } else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("QtyToReceive").'/'.$langs->transnoentitiesnoconv("Warehouse")), null, 'errors'); $error++; } @@ -363,15 +362,12 @@ if (empty($reshook)) $db->commit(); header("Location: card.php?id=".$object->id); exit; - } - else { + } else { $db->rollback(); $_GET["commande_id"] = GETPOST('commande_id', 'int'); $action = 'create'; } - } - - elseif ($action == 'confirm_valid' && $confirm == 'yes' && + } elseif ($action == 'confirm_valid' && $confirm == 'yes' && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->creer)) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) ) @@ -384,8 +380,7 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->trans($object->error), null, 'errors'); - } - else { + } else { // Define output language if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { @@ -404,17 +399,14 @@ if (empty($reshook)) if ($result < 0) dol_print_error($db, $result); } } - } - - elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->reception->supprimer) + } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->reception->supprimer) { $result = $object->delete($user); if ($result > 0) { header("Location: ".DOL_URL_ROOT.'/reception/index.php'); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -512,9 +504,7 @@ if (empty($reshook)) $ret = dol_delete_file($file, 0, 0, 0, $object); if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - } - - elseif ($action == 'classifybilled') + } elseif ($action == 'classifybilled') { $object->fetch($id); $result = $object->set_billed(); @@ -522,9 +512,7 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); } - } - - elseif ($action == 'classifyclosed') + } elseif ($action == 'classifyclosed') { $object->fetch($id); $result = $object->setClosed(); @@ -561,8 +549,7 @@ if (empty($reshook)) if (!$error) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); - } - else { + } else { setEventMessages($line->error, $line->errors, 'errors'); } } @@ -624,8 +611,7 @@ if (empty($reshook)) setEventMessages($line->error, $line->errors, 'errors'); $error++; } - } - else // Product no predefined + } else // Product no predefined { $qty = "qtyl".$line_id; $line->id = $line_id; @@ -660,8 +646,7 @@ if (empty($reshook)) $ret = $object->fetch($object->id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - else { + } else { header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id); // Pour reaffichage de la fiche en cours d'edition exit(); } @@ -1041,8 +1026,7 @@ if ($action == 'create') } print ''; - } - else { + } else { print ""; if ($type == 1) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -1080,8 +1064,7 @@ if ($action == 'create') if ($line->product_type == 1 && empty($conf->global->STOCK_SUPPORTS_SERVICES)) { $quantityToBeDelivered = 0; - } - else { + } else { $quantityToBeDelivered = $dispatchLines[$indiceAsked]['qty']; } $warehouse_id = $dispatchLines[$indiceAsked]['ent']; @@ -1102,8 +1085,7 @@ if ($action == 'create') if (GETPOST('qtyl'.$indiceAsked, 'int')) $defaultqty = GETPOST('qtyl'.$indiceAsked, 'int'); print ''; print ''; - } - else print $langs->trans("NA"); + } else print $langs->trans("NA"); print ''; // Stock @@ -1121,8 +1103,7 @@ if ($action == 'create') print ''; print $formproduct->selectWarehouses($tmpentrepot_id, 'entl'.$indiceAsked, '', 0, 0, $line->fk_product, '', 1); } - } - else { + } else { print $langs->trans("Service"); } print ''; @@ -1139,8 +1120,7 @@ if ($action == 'create') print ''; print $form->selectDate($dispatchLines[$indiceAsked]['DLUO'], 'dluo'.$indiceAsked, '', '', 1, ""); print ''; - } - else { + } else { print ''; } } @@ -1184,13 +1164,11 @@ if ($action == 'create') print ''; print '
'; - } - else { + } else { dol_print_error($db); } } -} -elseif ($id || $ref) +} elseif ($id || $ref) /* *************************************************************************** */ /* */ /* Edit and view mode */ @@ -1235,8 +1213,7 @@ elseif ($id || $ref) if ($objectref == 'PROV') { $numref = $object->getNextNumRef($soc); - } - else { + } else { $numref = $object->ref; } @@ -1400,8 +1377,7 @@ elseif ($id || $ref) print $form->selectDate($object->date_delivery ? $object->date_delivery : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print ''; - } - else { + } else { print $object->date_delivery ? dol_print_date($object->date_delivery, 'dayhour') : ' '; } print ''; @@ -1423,8 +1399,7 @@ elseif ($id || $ref) print ' '; print ' '; print ''; - } - else { + } else { print $object->trueWeight; print ($object->trueWeight && $object->weight_units != '') ? ' '.measuringUnitString(0, "weight", $object->weight_units) : ''; } @@ -1457,8 +1432,7 @@ elseif ($id || $ref) print ' '; print ' '; print ''; - } - else { + } else { print $object->trueHeight; print ($object->trueHeight && $object->height_units != '') ? ' '.measuringUnitString(0, "size", $object->height_units) : ''; } @@ -1489,8 +1463,7 @@ elseif ($id || $ref) if ($volumeUnit < 50) { print showDimensionInBestUnit($calculatedVolume, $volumeUnit, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND) ? $conf->global->MAIN_VOLUME_DEFAULT_ROUND : -1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT) ? $conf->global->MAIN_VOLUME_DEFAULT_UNIT : 'no'); - } - else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); + } else print $calculatedVolume.' '.measuringUnitString(0, "volume", $volumeUnit); } if ($totalVolume > 0) { @@ -1535,8 +1508,7 @@ elseif ($id || $ref) if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); print ''; print ''; - } - else { + } else { if ($object->shipping_method_id > 0) { // Get code using getLabelFromKey @@ -1568,8 +1540,7 @@ elseif ($id || $ref) if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?id='.$object->id); } print ''; @@ -1622,8 +1593,7 @@ elseif ($id || $ref) if ($object->statut <= 1) { print $langs->trans("QtyToReceive").' - '; - } - else { + } else { print $langs->trans("QtyReceived").' - '; } if (!empty($conf->stock->enabled)) @@ -1635,13 +1605,11 @@ elseif ($id || $ref) print $langs->trans("Batch"); } print ''; - } - else { + } else { if ($object->statut <= 1) { print ''.$langs->trans("QtyToReceive").''; - } - else { + } else { print ''.$langs->trans("QtyReceived").''; } if (!empty($conf->stock->enabled)) @@ -1748,8 +1716,7 @@ elseif ($id || $ref) $prod = new Product($db); $prod->fetch($lines[$i]->fk_product); $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product->label; - } - else $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label); + } else $label = (!empty($lines[$i]->product->label) ? $lines[$i]->product->label : $lines[$i]->product->product_label); print ''; @@ -1763,8 +1730,7 @@ elseif ($id || $ref) print (!empty($lines[$i]->product->description) && $lines[$i]->description != $lines[$i]->product->description) ? '
'.dol_htmlentitiesbr($lines[$i]->description) : ''; } print "\n"; - } - else { + } else { print ""; if ($lines[$i]->product_type == Product::TYPE_SERVICE) $text = img_object($langs->trans('Service'), 'service'); else $text = img_object($langs->trans('Product'), 'product'); @@ -1783,8 +1749,7 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { print ''; - } - else { + } else { print ''.$lines[$i]->comment.''; } @@ -1849,8 +1814,7 @@ elseif ($id || $ref) print ''; } print ''; - } - else { + } else { print ''; print ''; // Qty to receive or received @@ -1863,8 +1827,7 @@ elseif ($id || $ref) } } print ''; - } - else { + } else { // Qty to receive or received print ''.$lines[$i]->qty.''; @@ -1900,8 +1863,7 @@ elseif ($id || $ref) $detail .= '
'; print $form->textwithtooltip(img_picto('', 'object_barcode').' '.$langs->trans("DetailBatchNumber"), $detail); - } - else { + } else { print $langs->trans("NA"); } print ''; @@ -1929,8 +1891,7 @@ elseif ($id || $ref) print ''; print '
'; print '
'; - } - elseif ($object->statut == Reception::STATUS_DRAFT) + } elseif ($object->statut == Reception::STATUS_DRAFT) { // edit-delete buttons print ''; @@ -1961,8 +1922,7 @@ elseif ($id || $ref) if ($action == 'editline' && $lines[$i]->id == $line_id) { print $line->showOptionals($extrafields, 'edit', array('colspan'=>$colspan), $indiceAsked); - } - else { + } else { print $line->showOptionals($extrafields, 'view', array('colspan'=>$colspan), $indiceAsked); } } @@ -1999,8 +1959,7 @@ elseif ($id || $ref) || (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->reception->reception_advance->validate))) { print ''.$langs->trans("Validate").''; - } - else { + } else { print ''.$langs->trans("Validate").''; } } @@ -2016,8 +1975,7 @@ elseif ($id || $ref) if (!empty($conf->facture->enabled) && !empty($conf->global->WORKFLOW_BILL_ON_RECEPTION)) // Quand l'option est on, il faut avoir le bouton en plus et non en remplacement du Close ? { print ''.$langs->trans("ClassifyUnbilled").''; - } - else { + } else { print ''.$langs->trans("ReOpen").''; } } @@ -2029,8 +1987,7 @@ elseif ($id || $ref) if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->reception->reception_advance->send) { print ''.$langs->trans('SendByMail').''; - } - else print ''.$langs->trans('SendByMail').''; + } else print ''.$langs->trans('SendByMail').''; } } diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 111846347be..f4cbb08ee9e 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -178,13 +178,11 @@ class Reception extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { dol_print_error($this->db, get_class($this)."::getNextNumRef ".$obj->error); return ""; } - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_RECEPTION_ADDON_NUMBER_NotDefined"); return ""; } @@ -322,8 +320,7 @@ class Reception extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::create ".$errmsg, LOG_ERR); @@ -332,15 +329,13 @@ class Reception extends CommonObject $this->db->rollback(); return -1 * $error; } - } - else { + } else { $error++; $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } - } - else { + } else { $error++; $this->error = $this->db->error()." - sql=$sql"; $this->db->rollback(); @@ -467,14 +462,12 @@ class Reception extends CommonObject } return 1; - } - else { + } else { dol_syslog(get_class($this).'::Fetch no reception found', LOG_ERR); $this->error = 'Delivery with id '.$id.' not found'; return 0; } - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -523,8 +516,7 @@ class Reception extends CommonObject if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) // empty should not happened, but when it occurs, the test save life { $numref = $this->getNextNumRef($soc); - } - else { + } else { $numref = $this->ref; } @@ -594,8 +586,7 @@ class Reception extends CommonObject $this->errors = array_merge($this->errors, $mouvS->errors); break; } - } - else { + } else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record. @@ -609,8 +600,7 @@ class Reception extends CommonObject } } } - } - else { + } else { $this->db->rollback(); $this->error = $this->db->error(); return -2; @@ -684,8 +674,7 @@ class Reception extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { foreach ($this->errors as $errmsg) { dol_syslog(get_class($this)."::valid ".$errmsg, LOG_ERR); @@ -856,8 +845,7 @@ class Reception extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -910,8 +898,7 @@ class Reception extends CommonObject $result = $mouvS->livraison($user, $obj->fk_product, $obj->fk_entrepot, $obj->qty, 0, $langs->trans("ReceptionDeletedInDolibarr", $this->ref), '', $obj->eatby, $obj->sellby, $obj->batch); // Price is set to 0, because we don't want to see WAP changed } - } - else { + } else { $error++; $this->errors[] = "Error ".$this->db->lasterror(); } } @@ -987,31 +974,26 @@ class Reception extends CommonObject } return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror()." - sql=$sql"; $this->db->rollback(); return -1; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -1069,8 +1051,7 @@ class Reception extends CommonObject } return 1; - } - else { + } else { return -1; } } @@ -1256,13 +1237,11 @@ class Reception extends CommonObject { $this->date_delivery = $date_livraison; return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } - } - else { + } else { return -2; } } @@ -1345,8 +1324,7 @@ class Reception extends CommonObject $sql = "INSERT INTO ".MAIN_DB_PREFIX."c_shipment_mode (code, libelle, description, tracking)"; $sql .= " VALUES ('".$this->db->escape($this->update['code'])."','".$this->db->escape($this->update['libelle'])."','".$this->db->escape($this->update['description'])."','".$this->db->escape($this->update['tracking'])."')"; $resql = $this->db->query($sql); - } - else { + } else { $sql = "UPDATE ".MAIN_DB_PREFIX."c_shipment_mode SET"; $sql .= " code='".$this->db->escape($this->update['code'])."'"; $sql .= ",libelle='".$this->db->escape($this->update['libelle'])."'"; @@ -1421,8 +1399,7 @@ class Reception extends CommonObject { $url = str_replace('{TRACKID}', $value, $tracking); $this->tracking_url = sprintf(''.($value ? $value : 'url').'', $url, $url); - } - else { + } else { $this->tracking_url = $value; } } @@ -1523,8 +1500,7 @@ class Reception extends CommonObject $this->errors = $mouvS->errors; $error++; break; } - } - else { + } else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1537,8 +1513,7 @@ class Reception extends CommonObject } } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1552,8 +1527,7 @@ class Reception extends CommonObject $error++; } } - } - else { + } else { dol_print_error($this->db); $error++; } @@ -1562,8 +1536,7 @@ class Reception extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1607,8 +1580,7 @@ class Reception extends CommonObject if (empty($error)) { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1683,8 +1655,7 @@ class Reception extends CommonObject $this->errors = $mouvS->errors; $error++; break; } - } - else { + } else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1696,8 +1667,7 @@ class Reception extends CommonObject } } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1726,8 +1696,7 @@ class Reception extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1816,8 +1785,7 @@ class Reception extends CommonObject $error++; break; } - } - else { + } else { // line with batch detail // We decrement stock of product (and sub-products) -> update table llx_product_stock (key of this table is fk_product+fk_entrepot) and add a movement record @@ -1829,8 +1797,7 @@ class Reception extends CommonObject } } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1880,8 +1847,7 @@ class Reception extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; diff --git a/htdocs/reception/contact.php b/htdocs/reception/contact.php index b5e526bb1b3..4e8605ac74a 100644 --- a/htdocs/reception/contact.php +++ b/htdocs/reception/contact.php @@ -90,8 +90,7 @@ if ($action == 'addcontact' && $user->rights->reception->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($objectsrc->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); @@ -119,8 +118,7 @@ elseif ($action == 'deletecontact' && $user->rights->reception->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/reception/index.php b/htdocs/reception/index.php index b9786229468..e3951458e40 100644 --- a/htdocs/reception/index.php +++ b/htdocs/reception/index.php @@ -120,8 +120,7 @@ if ($resql) print ''; $i++; } - } - else { + } else { print ''.$langs->trans("None").''; } @@ -182,16 +181,14 @@ if ($resql) $orderstatic->id = $obj->commande_fournisseur_id; $orderstatic->ref = $obj->commande_fournisseur_ref; print $orderstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; $i++; } print "

"; } $db->free($resql); -} -else dol_print_error($db); +} else dol_print_error($db); diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index c753cf3e873..93aba12eb00 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -192,8 +192,7 @@ if (empty($reshook)) $object->add_object_linked('reception', $value); // add supplier order linked object } } - } - else { + } else { $object->socid = $rcp->socid; $object->type = FactureFournisseur::TYPE_STANDARD; $object->cond_reglement_id = $rcp->thirdparty->cond_reglement_supplier_id; @@ -278,14 +277,12 @@ if (empty($reshook)) { $result = $object->insert_discount($discountid); //$result=$discount->link_to_invoice($lineid,$id); - } - else { + } else { setEventMessages($discount->error, $discount->errors, 'errors'); $error++; break; } - } - else { + } else { // Positive line $product_type = ($lines[$i]->product_type ? $lines[$i]->product_type : 0); // Date start @@ -332,8 +329,7 @@ if (empty($reshook)) if ($result > 0) { $lineid = $result; - } - else { + } else { $lineid = 0; $error++; break; @@ -387,8 +383,7 @@ if (empty($reshook)) { $db->commit(); setEventMessage($langs->trans('BillCreated', $nb_bills_created)); - } - else { + } else { $db->rollback(); $action = 'create'; $_GET["origin"] = $_POST["origin"]; @@ -580,8 +575,7 @@ if ($resql) { print $form->selectyesno('validate_invoices', 0, 1, 1); print ' ('.$langs->trans("AutoValidationNotPossibleWhenStockIsDecreasedOnInvoiceValidation").')'; - } - else { + } else { print $form->selectyesno('validate_invoices', 0, 1); } print ''; @@ -931,8 +925,7 @@ if ($resql) print "
"; print ''; $db->free($resql); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/reception/stats/index.php b/htdocs/reception/stats/index.php index 4a0bcb4fd04..5079671dafd 100644 --- a/htdocs/reception/stats/index.php +++ b/htdocs/reception/stats/index.php @@ -77,8 +77,7 @@ $data = $stats->getNbByMonthWithPrevYear($endyear, $startyear); if (!$user->rights->societe->client->voir || $user->socid) { $filenamenb = $dir.'/receptionsnbinyear-'.$user->id.'-'.$year.'.png'; -} -else { +} else { $filenamenb = $dir.'/receptionsnbinyear-'.$year.'.png'; } @@ -289,8 +288,7 @@ print '
'; // Show graphs print ''; } -} -else { +} else { $colspan = 1; foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) $colspan++; } print ''; diff --git a/htdocs/salaries/admin/salaries.php b/htdocs/salaries/admin/salaries.php index b1f1f627a99..a824a7d8eee 100644 --- a/htdocs/salaries/admin/salaries.php +++ b/htdocs/salaries/admin/salaries.php @@ -62,8 +62,7 @@ if ($action == 'update') if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -113,8 +112,7 @@ foreach ($list as $key) if (!empty($conf->accounting->enabled)) { print $formaccounting->select_account($conf->global->$key, $key, 1, '', 1, 1); - } - else { + } else { print ''; } print ''; diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index d7b71edbf0b..94add08291c 100644 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -158,8 +158,7 @@ if ($action == 'add' && empty($cancel)) header("Location: list.php"); exit; } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); $action = "create"; @@ -192,19 +191,16 @@ if ($action == 'delete') $db->commit(); header("Location: ".DOL_URL_ROOT.'/salaries/list.php'); exit; - } - else { + } else { $object->error = $accountline->error; $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages('Error try do delete a line linked to a conciliated bank transaction', null, 'errors'); } } @@ -489,12 +485,10 @@ if ($id) if (!empty($user->rights->salaries->delete)) { print ''; - } - else { + } else { print ''; } - } - else { + } else { print ''; } print ""; diff --git a/htdocs/salaries/class/paymentsalary.class.php b/htdocs/salaries/class/paymentsalary.class.php index 9fddd59ce51..34b58a5c0e4 100644 --- a/htdocs/salaries/class/paymentsalary.class.php +++ b/htdocs/salaries/class/paymentsalary.class.php @@ -182,8 +182,7 @@ class PaymentSalary extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -262,8 +261,7 @@ class PaymentSalary extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -478,8 +476,7 @@ class PaymentSalary extends CommonObject if ($bank_line_id > 0) { $this->update_fk_bank($bank_line_id); - } - else { + } else { $this->error = $acc->error; $error++; } @@ -521,20 +518,17 @@ class PaymentSalary extends CommonObject $result = $this->call_trigger('PAYMENT_SALARY_CREATE', $user); if ($result < 0) $error++; // End call triggers - } - else $error++; + } else $error++; if (!$error) { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; @@ -557,8 +551,7 @@ class PaymentSalary extends CommonObject if ($result) { return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -616,8 +609,7 @@ class PaymentSalary extends CommonObject $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks if ($reshook > 0) $linkclose = $hookmanager->resPrint; */ - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -669,8 +661,7 @@ class PaymentSalary extends CommonObject $this->date_creation = $this->db->jdate($obj->datec); } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/salaries/document.php b/htdocs/salaries/document.php index 0e6a1bccba0..69680df6a2a 100644 --- a/htdocs/salaries/document.php +++ b/htdocs/salaries/document.php @@ -128,8 +128,7 @@ if ($object->id) $permission = $user->rights->salaries->write; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/salaries/list.php b/htdocs/salaries/list.php index b06ad2348e4..6c4ee37a979 100644 --- a/htdocs/salaries/list.php +++ b/htdocs/salaries/list.php @@ -67,8 +67,7 @@ if (!GETPOST('typeid', 'int')) $part = explode(':', $val); if ($part[0] == 's.fk_typepayment') $typeid = $part[1]; } -} -else { +} else { $typeid = GETPOST('typeid', 'int'); } @@ -287,8 +286,7 @@ if ($result) } $accountstatic->label = $obj->blabel; print $accountstatic->getNomUrl(1); - } - else print ' '; + } else print ' '; print ''; if (!$i) $totalarray['nbfield']++; } @@ -316,8 +314,7 @@ if ($result) print ''; $db->free($result); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index b0023de8b64..06beda8ce41 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -256,8 +256,7 @@ print '
'; // Show graphs print '
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; /*print $px2->show(); diff --git a/htdocs/resource/agenda.php b/htdocs/resource/agenda.php index fa99e4610d5..72d055da41d 100644 --- a/htdocs/resource/agenda.php +++ b/htdocs/resource/agenda.php @@ -48,8 +48,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/resource/card.php b/htdocs/resource/card.php index 9f2a044525d..8d965c69c2c 100644 --- a/htdocs/resource/card.php +++ b/htdocs/resource/card.php @@ -99,8 +99,7 @@ if (empty($reshook)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Ref")), null, 'errors'); $action = 'create'; - } - else { + } else { $object->ref = $ref; $object->description = $description; $object->fk_code_type_resource = $fk_code_type_resource; @@ -117,15 +116,13 @@ if (empty($reshook)) setEventMessages($langs->trans('ResourceCreatedWithSuccess'), null, 'mesgs'); Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { // Creation KO setEventMessages($object->error, $object->errors, 'errors'); $action = 'create'; } } - } - else { + } else { Header("Location: list.php"); exit; } @@ -162,13 +159,11 @@ if (empty($reshook)) { Header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $error++; } @@ -192,12 +187,10 @@ if (empty($reshook)) setEventMessages($langs->trans('RessourceSuccessfullyDeleted'), null, 'mesgs'); Header('Location: '.DOL_URL_ROOT.'/resource/list.php'); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -220,8 +213,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) { print load_fiche_titre($title, '', 'object_resource'); dol_fiche_head(''); - } - else { + } else { $head = resource_prepare_head($object); dol_fiche_head($head, 'resource', $title, -1, 'resource'); } @@ -283,8 +275,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) print ''; print ''; - } - else { + } else { $formconfirm = ''; // Confirm deleting resource line @@ -384,8 +375,7 @@ if ($action == 'create' || $object->fetch($id, $ref) > 0) } } print ''; -} -else { +} else { dol_print_error(); } diff --git a/htdocs/resource/class/dolresource.class.php b/htdocs/resource/class/dolresource.class.php index 41c0db7ec15..294f36e5589 100644 --- a/htdocs/resource/class/dolresource.class.php +++ b/htdocs/resource/class/dolresource.class.php @@ -164,8 +164,7 @@ class Dolresource extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return $this->id; } @@ -222,8 +221,7 @@ class Dolresource extends CommonObject $this->db->free($resql); return $this->id; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); dol_syslog(get_class($this)."::fetch ".$this->error, LOG_ERR); return -1; @@ -327,8 +325,7 @@ class Dolresource extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -385,8 +382,7 @@ class Dolresource extends CommonObject $this->db->free($resql); return $this->id; - } - else { + } else { $this->error = "Error ".$this->db->lasterror(); return -1; } @@ -423,8 +419,7 @@ class Dolresource extends CommonObject $this->error = $this->db->lasterror(); $error++; } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -470,8 +465,7 @@ class Dolresource extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -516,11 +510,9 @@ class Dolresource extends CommonObject foreach ($filter as $key => $value) { if (strpos($key, 'date')) { $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; - } - elseif (strpos($key, 'ef.') !== false) { + } elseif (strpos($key, 'ef.') !== false) { $sql .= $value; - } - else { + } else { $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -561,8 +553,7 @@ class Dolresource extends CommonObject $this->db->free($resql); } return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -601,8 +592,7 @@ class Dolresource extends CommonObject foreach ($filter as $key => $value) { if (strpos($key, 'date')) { $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; - } - else { + } else { $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -638,8 +628,7 @@ class Dolresource extends CommonObject $this->db->free($resql); } return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -682,8 +671,7 @@ class Dolresource extends CommonObject foreach ($filter as $key => $value) { if (strpos($key, 'date')) { $sql .= ' AND '.$key.' = \''.$this->db->idate($value).'\''; - } - else { + } else { $sql .= ' AND '.$key.' LIKE \'%'.$this->db->escape($value).'%\''; } } @@ -716,8 +704,7 @@ class Dolresource extends CommonObject $this->db->free($resql); } return $num; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -807,8 +794,7 @@ class Dolresource extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -914,8 +900,7 @@ class Dolresource extends CommonObject $i++; } return $num; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -967,8 +952,7 @@ class Dolresource extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; diff --git a/htdocs/resource/class/html.formresource.class.php b/htdocs/resource/class/html.formresource.class.php index 3eeebeaee45..451ca9922b1 100644 --- a/htdocs/resource/class/html.formresource.class.php +++ b/htdocs/resource/class/html.formresource.class.php @@ -126,8 +126,7 @@ class FormResource if ($selected > 0 && $selected == $resourcestat->lines[$i]->id) { $out .= ''; - } - else { + } else { $out .= ''; } @@ -145,8 +144,7 @@ class FormResource $out .= ''; } - } - else { + } else { dol_print_error($this->db); } diff --git a/htdocs/resource/contact.php b/htdocs/resource/contact.php index dc916aa5f77..ee20d918648 100644 --- a/htdocs/resource/contact.php +++ b/htdocs/resource/contact.php @@ -62,8 +62,7 @@ if ($action == 'addcontact' && $user->rights->resource->write) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = $langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"); @@ -90,8 +89,7 @@ elseif ($action == 'deletecontact' && $user->rights->resource->write) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/resource/document.php b/htdocs/resource/document.php index 0e6b20923b5..077430cf4bb 100644 --- a/htdocs/resource/document.php +++ b/htdocs/resource/document.php @@ -136,8 +136,7 @@ if ($object->id > 0) $permission = $user->rights->resource->write; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/resource/element_resource.php b/htdocs/resource/element_resource.php index 8e353b59788..dd3a02e18e3 100644 --- a/htdocs/resource/element_resource.php +++ b/htdocs/resource/element_resource.php @@ -97,8 +97,7 @@ if (empty($reshook)) $error++; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Resource")), null, 'errors'); $action = ''; - } - else { + } else { $objstat = fetchObjectByElement($element_id, $element, $element_ref); $objstat->element = $element; // For externals module, we need to keep @xx @@ -168,8 +167,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ResourceLinkedWithSuccess'), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF'].'?element='.$element.'&element_id='.$objstat->id); exit; - } - elseif ($objstat) + } elseif ($objstat) { setEventMessages($objstat->error, $objstat->errors, 'errors'); } @@ -264,8 +262,7 @@ if (empty($reshook)) setEventMessages($langs->trans('RessourceLineSuccessfullyDeleted'), null, 'mesgs'); header("Location: ".$_SERVER['PHP_SELF']."?element=".$element."&element_id=".$element_id); exit; - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -295,8 +292,7 @@ if ($ret == -1) { } if (!$ret) { print '
'.$langs->trans('NoResourceInDatabase').'
'; -} -else { +} else { // Confirmation suppression resource line if ($action == 'delete_resource') { @@ -408,8 +404,7 @@ else { } } $_SESSION['assignedtouser'] = json_encode($listofuserid); - } - else { + } else { if (!empty($_SESSION['assignedtouser'])) { $listofuserid = json_decode($_SESSION['assignedtouser'], true); @@ -596,8 +591,7 @@ else { if (file_exists(dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_add.tpl.php'))) { $tpl = dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_add.tpl.php'); - } - else { + } else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/resource_add.tpl.php'; } if (empty($conf->file->strict_mode)) { @@ -615,8 +609,7 @@ else { if (file_exists(dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_view.tpl.php'))) { $tpl = dol_buildpath($reldir.'/resource_'.$element_prop['element'].'_view.tpl.php'); - } - else { + } else { $tpl = DOL_DOCUMENT_ROOT.$reldir.'/resource_view.tpl.php'; } if (empty($conf->file->strict_mode)) { diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 4f94c6c3e17..4dca64b47a6 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -281,8 +281,7 @@ if ($ret) print '
'.$langs->trans("NoRecordFound").'
\n"; - } - else { + } else { $disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); print ''; - } - else { + } else { print ''; @@ -520,8 +501,7 @@ if ($resql) array_push($def, $array[0]); $i++; } -} -else { +} else { dol_print_error($db); } @@ -551,8 +531,7 @@ foreach ($dirsociete as $dirroot) try { dol_include_once($dirroot.'doc/'.$file); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -589,15 +568,13 @@ foreach ($dirsociete as $dirroot) // print img_picto($langs->trans("Enabled"),'on'); //} print ""; - } - else { + } else { if (versioncompare($module->phpmin, versionphparray()) > 0) { print ""; - } - else { + } else { print ""; @@ -623,8 +600,7 @@ foreach ($dirsociete as $dirroot) if ($module->type == 'pdf') { $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; - } - else { + } else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } print $linkspec; @@ -693,8 +669,7 @@ foreach ($profid as $key => $val) print ''; - } - else { + } else { print ''; @@ -705,8 +680,7 @@ foreach ($profid as $key => $val) print ''; - } - else { + } else { print ''; @@ -717,8 +691,7 @@ foreach ($profid as $key => $val) print ''; - } - else { + } else { print ''; @@ -759,8 +732,7 @@ if (!$conf->use_javascript_ajax) print '"; -} -else { +} else { print '"; -} -else { +} else { print ''; - } - elseif ($mysoc->localtax1_assuj == "1") + } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= ''; - } - elseif ($mysoc->localtax2_assuj == "1") + } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= ''; } } - } - else { + } else { $head = societe_prepare_head($this->object); $this->tpl['showhead'] = dol_get_fiche_head($head, 'card', '', 0, 'company'); @@ -306,8 +303,7 @@ abstract class ActionsCardCommon if ($nbofsalesrepresentative > 3) // We print only number { $this->tpl['sales_representatives'] .= $nbofsalesrepresentative; - } - elseif ($nbofsalesrepresentative > 0) + } elseif ($nbofsalesrepresentative > 0) { $userstatic = new User($this->db); $i = 0; @@ -320,8 +316,7 @@ abstract class ActionsCardCommon $i++; if ($i < $nbofsalesrepresentative) $this->tpl['sales_representatives'] .= ', '; } - } - else $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); + } else $this->tpl['sales_representatives'] .= $langs->trans("NoSalesRepresentativeAffected"); // Linked member if (!empty($conf->adherent->enabled)) @@ -333,8 +328,7 @@ abstract class ActionsCardCommon { $adh->ref = $adh->getFullName($langs); $this->tpl['linked_member'] = $adh->getNomUrl(1); - } - else { + } else { $this->tpl['linked_member'] = $langs->trans("ThirdpartyNotLinkedToMember"); } } @@ -351,13 +345,11 @@ abstract class ActionsCardCommon $this->tpl['localtax'] .= ''; $this->tpl['localtax'] .= ''; $this->tpl['localtax'] .= ''; - } - elseif ($mysoc->localtax1_assuj == "1") + } elseif ($mysoc->localtax1_assuj == "1") { $this->tpl['localtax'] .= ''; $this->tpl['localtax'] .= ''; - } - elseif ($mysoc->localtax2_assuj == "1") + } elseif ($mysoc->localtax2_assuj == "1") { $this->tpl['localtax'] .= ''; $this->tpl['localtax'] .= ''; diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index 348163195d9..73453aff62e 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -134,16 +134,13 @@ class ActionsCardCompany extends ActionsCardCommon { $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else { + } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } - } - else { + } else { $this->tpl['tva_intra'] = $s; } - } - else { + } else { // Confirm delete third party if ($action == 'delete') { @@ -170,16 +167,13 @@ class ActionsCardCompany extends ActionsCardCommon { $s .= ''.$langs->trans("VATIntraCheck").''; $this->tpl['tva_intra'] = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else { + } else { $this->tpl['tva_intra'] = $s.'object->country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } - } - else { + } else { $this->tpl['tva_intra'] = $s; } - } - else { + } else { $this->tpl['tva_intra'] = ' '; } @@ -190,8 +184,7 @@ class ActionsCardCompany extends ActionsCardCommon $socm->fetch($this->object->parent); $this->tpl['parent_company'] = $socm->getNomUrl(1).' '.($socm->code_client ? "(".$socm->code_client.")" : ""); $this->tpl['parent_company'] .= ($socm->town ? ' - '.$socm->town : ''); - } - else { + } else { $this->tpl['parent_company'] = $langs->trans("NoParentCompany"); } } diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index 6a93ac3e939..3abb9e9b6f7 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -110,8 +110,7 @@ class ActionsCardIndividual extends ActionsCardCommon if ($action == 'create' || $action == 'edit') { $this->tpl['select_civility'] = $formcompany->select_civility(GETPOST('civility_id')); - } - else { + } else { // Confirm delete third party if ($action == 'delete' || $conf->use_javascript_ajax) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 77299e3ee89..f468f4f63ce 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -136,8 +136,7 @@ if (empty($reshook)) { $langs->load('errors'); setEventMessages($langs->trans('ErrorThirdPartyIdIsMandatory', $langs->transnoentitiesnoconv('MergeOriginThirdparty')), null, 'errors'); - } - else { + } else { if (!$error && $soc_origin->fetch($soc_origin_id) < 1) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); @@ -300,8 +299,7 @@ if (empty($reshook)) { setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); $db->commit(); - } - else { + } else { $langs->load("errors"); setEventMessages($langs->trans('ErrorsThirdpartyMerge'), null, 'errors'); $db->rollback(); @@ -389,8 +387,7 @@ if (empty($reshook)) { $ret = $object->fetch($socid); $object->oldcopy = clone $object; - } - else $object->canvas = $canvas; + } else $object->canvas = $canvas; if (GETPOST("private", 'int') == 1) // Ask to create a contact { @@ -401,8 +398,7 @@ if (empty($reshook)) // Add non official properties $object->name_bis = GETPOST('name', 'alpha'); $object->firstname = GETPOST('firstname', 'alpha'); - } - else { + } else { $object->name = GETPOST('name', 'alpha'); } $object->entity = (GETPOSTISSET('entity') ?GETPOST('entity', 'int') : $conf->entity); @@ -605,15 +601,13 @@ if (empty($reshook)) if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; - } - else { + } else { // Create thumbs $object->addThumbs($newfile); } } } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -626,8 +620,7 @@ if (empty($reshook)) } } // Gestion du logo de la société - } - else { + } else { if ($db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') // TODO Sometime errors on duplicate on profid and not on code, so we must manage this case { $duplicate_code_error = true; @@ -649,8 +642,7 @@ if (empty($reshook)) if (preg_match('/\?/', $backtopage)) $backtopage .= '&socid='.$object->id; // Old method header("Location: ".$backtopage); exit; - } - else { + } else { $url = $_SERVER["PHP_SELF"]."?socid=".$object->id; // Old method if (($object->client == 1 || $object->client == 3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) $url = DOL_URL_ROOT."/comm/card.php?socid=".$object->id; elseif ($object->fournisseur == 1) $url = DOL_URL_ROOT."/fourn/card.php?socid=".$object->id; @@ -658,8 +650,7 @@ if (empty($reshook)) header("Location: ".$url); exit; } - } - else { + } else { $db->rollback(); $action = 'create'; } @@ -675,8 +666,7 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } @@ -750,8 +740,7 @@ if (empty($reshook)) if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; - } - else { + } else { // Create thumbs $object->addThumbs($newfile); @@ -766,12 +755,10 @@ if (empty($reshook)) } } } - } - else { + } else { $errors[] = "ErrorBadImageFormat"; } - } - else { + } else { switch ($_FILES['photo']['error']) { case 1: //uploaded file exceeds the upload_max_filesize directive in php.ini @@ -805,19 +792,16 @@ if (empty($reshook)) { header("Location: ".$backtopage); exit; - } - else { + } else { header("Location: ".$_SERVER["PHP_SELF"]."?socid=".$socid); exit; } - } - else { + } else { $object->id = $socid; $action = "edit"; } } - } - else { + } else { $action = ($action == 'add' ? 'create' : 'edit'); } } @@ -833,8 +817,7 @@ if (empty($reshook)) { header("Location: ".DOL_URL_ROOT."/societe/list.php?restore_lastsearch_values=1&delsoc=".urlencode($object->name)); exit; - } - else { + } else { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); $error++; @@ -903,8 +886,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // ----------------------------------------- $objcanvas->assign_values($action, $object->id, $object->ref); // Set value for templates $objcanvas->display_canvas($action); // Show template -} -else { +} else { // ----------------------------------------- // When used in standard mode // ----------------------------------------- @@ -972,8 +954,7 @@ else { $object->code_client = GETPOST('customer_code', 'alpha'); $object->fournisseur = GETPOST('fournisseur') ?GETPOST('fournisseur') : $object->fournisseur; $object->code_fournisseur = GETPOST('supplier_code', 'alpha'); - } - else { + } else { setEventMessages($langs->trans('NewCustomerSupplierCodeProposed'), '', 'warnings'); } @@ -1044,8 +1025,7 @@ else { if (!$result > 0) { $errors[] = "ErrorFailedToSaveFile"; - } - else { + } else { // Create thumbs $object->addThumbs($newfile); } @@ -1186,8 +1166,7 @@ else { if ($object->particulier || $private) { print ''.$langs->trans('ThirdPartyName').' / '.$langs->trans('LastName', 'name').''; - } - else { + } else { print ''.$form->editfieldkey('ThirdPartyName', 'name', '', $object, 0).''; } print 'global->SOCIETE_USEPREFIX) ? ' colspan="3"' : '').'>'; @@ -1322,8 +1301,7 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - elseif ($mysoc->localtax1_assuj == "1") + } elseif ($mysoc->localtax1_assuj == "1") { print ''; - } - elseif ($mysoc->localtax2_assuj == "1") + } elseif ($mysoc->localtax2_assuj == "1") { print ''; @@ -1556,16 +1530,14 @@ else { { print '     '; print ''; - } - else { + } else { print '     '; print ''; } print ''."\n"; print ''."\n"; - } - elseif ($action == 'edit') + } elseif ($action == 'edit') { //print load_fiche_titre($langs->trans("EditCompany")); @@ -1813,8 +1785,7 @@ else { { print ''; print $object->prefix_comm; - } - else { + } else { print ''; } print ''; @@ -1835,12 +1806,10 @@ else { if (empty($tmpcode) && !empty($object->oldcopy->code_client)) $tmpcode = $object->oldcopy->code_client; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeClient->code_auto)) $tmpcode = $modCodeClient->getNextValue($object, 0); print ''; - } - elseif ($object->codeclient_modifiable()) + } elseif ($object->codeclient_modifiable()) { print ''; - } - else { + } else { print $object->code_client; print ''; } @@ -1875,12 +1844,10 @@ else { if (empty($tmpcode) && !empty($object->oldcopy->code_fournisseur)) $tmpcode = $object->oldcopy->code_fournisseur; // When there is an error to update a thirdparty, the number for supplier and customer code is kept to old value. if (empty($tmpcode) && !empty($modCodeFournisseur->code_auto)) $tmpcode = $modCodeFournisseur->getNextValue($object, 1); print ''; - } - elseif ($object->codefournisseur_modifiable()) + } elseif ($object->codefournisseur_modifiable()) { print ''; - } - else { + } else { print $object->code_fournisseur; print ''; } @@ -1935,8 +1902,7 @@ else { if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { print ''; - } - elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") + } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { print ''; - } - elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") + } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { print ''; - } - else { + } else { print ''; } print ''; @@ -2397,8 +2358,7 @@ else { } print ''; } - } - elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") + } elseif ($mysoc->localtax1_assuj == "1" && $mysoc->localtax2_assuj != "1") { print ''; } - } - elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") + } elseif ($mysoc->localtax2_assuj == "1" && $mysoc->localtax1_assuj != "1") { print ''; @@ -2553,8 +2510,7 @@ else { if ($action != 'editincoterm') { print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); - } - else { + } else { print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms) ? $object->location_incoterms : ''), $_SERVER['PHP_SELF'].'?socid='.$object->id); } print ''; @@ -2587,8 +2543,7 @@ else { if ($action == 'editparentcompany') { $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'editparentcompany', 's.rowid <> '.$object->id, 1); - } - else { + } else { $form->form_thirdparty($_SERVER['PHP_SELF'].'?socid='.$object->id, $object->parent, 'none', 's.rowid <> '.$object->id, 1); } print ''; @@ -2610,8 +2565,7 @@ else { { $adh->ref = $adh->getFullName($langs); print $adh->getNomUrl(1); - } - else { + } else { print ''.$langs->trans("ThirdpartyNotLinkedToMember").''; } print ''; @@ -2660,8 +2614,7 @@ else { { $langs->load("mails"); print ''.$langs->trans('SendMail').''; - } - else { + } else { $langs->load("mails"); print ''.$langs->trans('SendMail').''; } @@ -2692,8 +2645,7 @@ else { if ($conf->use_javascript_ajax && empty($conf->dol_use_jmobile)) // We can't use preloaded confirm form with jmobile { print ''.$langs->trans('Delete').''."\n"; - } - else { + } else { print ''.$langs->trans('Delete').''."\n"; } } diff --git a/htdocs/societe/checkvat/checkVatPopup.php b/htdocs/societe/checkvat/checkVatPopup.php index 99e18f036aa..725cab96065 100644 --- a/htdocs/societe/checkvat/checkVatPopup.php +++ b/htdocs/societe/checkvat/checkVatPopup.php @@ -49,8 +49,7 @@ if (!$vatNumber) { print '
'; print ''.$langs->transnoentities("ErrorFieldRequired", $langs->trans("VATIntraShort")).'
'; -} -else { +} else { $vatNumber = preg_replace('/\^\w/', '', $vatNumber); $vatNumber = str_replace(array(' ', '.'), '', $vatNumber); $countryCode = substr($vatNumber, 0, 2); @@ -101,18 +100,15 @@ else { { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
'; $messagetoshow = $soapclient->response; - } - elseif (preg_match('/TIMEOUT/i', $result['faultstring'])) + } elseif (preg_match('/TIMEOUT/i', $result['faultstring'])) { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
'; $messagetoshow = $soapclient->response; - } - elseif (preg_match('/SERVER_BUSY/i', $result['faultstring'])) + } elseif (preg_match('/SERVER_BUSY/i', $result['faultstring'])) { print ''.$langs->trans("ErrorServiceUnavailableTryLater").'
'; $messagetoshow = $soapclient->response; - } - elseif ($result['faultstring']) + } elseif ($result['faultstring']) { print ''.$langs->trans("Error").'
'; $messagetoshow = $result['faultstring']; @@ -125,8 +121,7 @@ else { print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; print $langs->trans("ValueIsValid").': '.$langs->trans("No").' (Might be a non europeen VAT)
'; //$messagetoshow=$soapclient->response; - } - else { + } else { // Syntaxe ok if ($result['requestDate']) print $langs->trans("Date").': '.$result['requestDate'].'
'; print $langs->trans("VATIntraSyntaxIsValid").': '.$langs->trans("Yes").'
'; @@ -134,16 +129,14 @@ else { if (preg_match('/MS_UNAVAILABLE/i', $result['faultstring'])) { print ''.$langs->trans("ErrorVATCheckMS_UNAVAILABLE", $countryCode).'
'; - } - else { + } else { if (!empty($result['valid']) && ($result['valid'] == 1 || $result['valid'] == 'true')) { print ''.$langs->trans("Yes").''; print '
'; print $langs->trans("Name").': '.$result['name'].'
'; print $langs->trans("Address").': '.$result['address'].'
'; - } - else { + } else { print ''.$langs->trans("No").''; print '
'."\n"; } diff --git a/htdocs/societe/class/api_contacts.class.php b/htdocs/societe/class/api_contacts.class.php index bfaed41f21b..37d9239265f 100644 --- a/htdocs/societe/class/api_contacts.class.php +++ b/htdocs/societe/class/api_contacts.class.php @@ -208,8 +208,7 @@ class Contacts extends DolibarrApi $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve contacts : '.$sql); } if (!count($obj_ret)) diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 3ec6243a2c7..ca3e4385837 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -143,9 +143,7 @@ class Thirdparties extends DolibarrApi // Select thirdparties of given category if ($category > 0) { - if (!empty($mode) && $mode != 4) { $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid"; } - elseif (!empty($mode) && $mode == 4) { $sql .= " AND cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid"; } - else { $sql .= " AND ((c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid))"; } + if (!empty($mode) && $mode != 4) { $sql .= " AND c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid"; } elseif (!empty($mode) && $mode == 4) { $sql .= " AND cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid"; } else { $sql .= " AND ((c.fk_categorie = ".$db->escape($category)." AND c.fk_soc = t.rowid) OR (cc.fk_categorie = ".$db->escape($category)." AND cc.fk_soc = t.rowid))"; } } if ((!DolibarrApiAccess::$user->rights->societe->client->voir && !$socids) || $search_sale > 0) $sql .= " AND t.rowid = sc.fk_soc"; @@ -195,8 +193,7 @@ class Thirdparties extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieve thirdparties : '.$db->lasterror()); } if (!count($obj_ret)) { @@ -466,8 +463,7 @@ class Thirdparties extends DolibarrApi $db->rollback(); throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.'); - } - else { + } else { $db->commit(); } @@ -1104,8 +1100,7 @@ class Thirdparties extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(404, 'Account not found'); } @@ -1311,8 +1306,7 @@ class Thirdparties extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(404, 'Bank account not found'); } @@ -1328,8 +1322,7 @@ class Thirdparties extends DolibarrApi if ($result > 0) { return array("success" => $result); - } - else { + } else { throw new RestException(500); } } diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index 803d0ddebe3..3b289547f8d 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -83,8 +83,7 @@ class Client extends Societe } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; diff --git a/htdocs/societe/class/companybankaccount.class.php b/htdocs/societe/class/companybankaccount.class.php index 00737c04504..283c32573e0 100644 --- a/htdocs/societe/class/companybankaccount.class.php +++ b/htdocs/societe/class/companybankaccount.class.php @@ -111,17 +111,14 @@ class CompanyBankAccount extends Account if (!$error) { return 1; - } - else { + } else { return 0; } - } - else { + } else { return 1; } } - } - else { + } else { print $this->db->error(); return 0; } @@ -179,16 +176,13 @@ class CompanyBankAccount extends Account if (!$error) { return 1; - } - else { + } else { return -1; } - } - else { + } else { return 1; } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -251,8 +245,7 @@ class CompanyBankAccount extends Account $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -299,8 +292,7 @@ class CompanyBankAccount extends Account { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1 * $error; } @@ -345,8 +337,7 @@ class CompanyBankAccount extends Account if ($this->db->num_rows($result1) == 0) { return 0; - } - else { + } else { $obj = $this->db->fetch_object($result1); $this->db->begin(); @@ -366,14 +357,12 @@ class CompanyBankAccount extends Account dol_print_error($this->db); $this->db->rollback(); return -1; - } - else { + } else { $this->db->commit(); return 1; } } - } - else { + } else { dol_print_error($this->db); return -1; } diff --git a/htdocs/societe/class/companypaymentmode.class.php b/htdocs/societe/class/companypaymentmode.class.php index ca75b904b11..93f0d13b498 100644 --- a/htdocs/societe/class/companypaymentmode.class.php +++ b/htdocs/societe/class/companypaymentmode.class.php @@ -404,8 +404,7 @@ class CompanyPaymentMode extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -439,8 +438,7 @@ class CompanyPaymentMode extends CommonObject if ($this->db->num_rows($result1) == 0) { return 0; - } - else { + } else { $obj = $this->db->fetch_object($result1); $type = ''; @@ -465,14 +463,12 @@ class CompanyPaymentMode extends CommonObject dol_print_error($this->db); $this->db->rollback(); return -1; - } - else { + } else { $this->db->commit(); return 1; } } - } - else { + } else { dol_print_error($this->db); return -1; } @@ -562,8 +558,7 @@ class CompanyPaymentMode extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index e2b24577bf9..03290f1581d 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -818,36 +818,31 @@ class Societe extends CommonObject $result = $this->call_trigger('COMPANY_CREATE', $user); if ($result < 0) $error++; // End call triggers - } - else $error++; + } else $error++; if (!$error) { dol_syslog(get_class($this)."::Create success id=".$this->id); $this->db->commit(); return $this->id; - } - else { + } else { dol_syslog(get_class($this)."::Create echec update ".$this->error." ".join(',', $this->errors), LOG_ERR); $this->db->rollback(); return -4; } - } - else { + } else { if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $this->error = $langs->trans("ErrorCompanyNameAlreadyExists", $this->name); // duplicate on a field (code or profid or ...) $result = -1; - } - else { + } else { $this->error = $this->db->lasterror(); $result = -2; } $this->db->rollback(); return $result; } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::Create fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -925,16 +920,13 @@ class Societe extends CommonObject if ($rescode == -1) { $this->errors[] = 'ErrorBadCustomerCodeSyntax'; - } - elseif ($rescode == -2) + } elseif ($rescode == -2) { $this->errors[] = 'ErrorCustomerCodeRequired'; - } - elseif ($rescode == -3) + } elseif ($rescode == -3) { $this->errors[] = 'ErrorCustomerCodeAlreadyUsed'; - } - elseif ($rescode == -4) + } elseif ($rescode == -4) { $this->errors[] = 'ErrorPrefixRequired'; } @@ -950,16 +942,13 @@ class Societe extends CommonObject if ($rescode == -1) { $this->errors[] = 'ErrorBadSupplierCodeSyntax'; - } - elseif ($rescode == -2) + } elseif ($rescode == -2) { $this->errors[] = 'ErrorSupplierCodeRequired'; - } - elseif ($rescode == -3) + } elseif ($rescode == -3) { $this->errors[] = 'ErrorSupplierCodeAlreadyUsed'; - } - elseif ($rescode == -5) + } elseif ($rescode == -5) { $this->errors[] = 'ErrorPrefixRequired'; } @@ -1002,8 +991,7 @@ class Societe extends CommonObject $this->errors[] = $langs->transcountry('ProfId'.$i, $this->country_code)." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')'; } } - } - else { + } else { //var_dump($conf->global->SOCIETE_EMAIL_UNIQUE); //var_dump($conf->global->SOCIETE_EMAIL_MANDATORY); if ($key == 'EMAIL') @@ -1248,20 +1236,16 @@ class Societe extends CommonObject if ($this->localtax1_value != '') { $sql .= ",localtax1_value =".$this->localtax1_value; - } - else $sql .= ",localtax1_value =0.000"; - } - else $sql .= ",localtax1_value =0.000"; + } else $sql .= ",localtax1_value =0.000"; + } else $sql .= ",localtax1_value =0.000"; if ($this->localtax2_assuj == 1) { if ($this->localtax2_value != '') { $sql .= ",localtax2_value =".$this->localtax2_value; - } - else $sql .= ",localtax2_value =0.000"; - } - else $sql .= ",localtax2_value =0.000"; + } else $sql .= ",localtax2_value =0.000"; + } else $sql .= ",localtax2_value =0.000"; $sql .= ",capital = ".($this->capital == '' ? "null" : $this->capital); @@ -1331,8 +1315,7 @@ class Societe extends CommonObject unset($this->state_code); unset($this->state); } - } - else { + } else { unset($this->country_code); // We clean this, in the doubt, because it may have been changed after an update of country_id unset($this->country); unset($this->state_code); @@ -1375,8 +1358,7 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::update ".$this->error, LOG_ERR); $error++; } - } - elseif ($result < 0) + } elseif ($result < 0) { $this->error = $lmember->error; $error++; @@ -1418,28 +1400,24 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::Update success"); $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') { // Doublon $this->error = $langs->trans("ErrorDuplicateField"); $result = -1; - } - else { + } else { $this->error = $this->db->lasterror(); $result = -2; } $this->db->rollback(); return $result; } - } - else { + } else { $this->db->rollback(); dol_syslog(get_class($this)."::Update fails verify ".join(',', $this->errors), LOG_WARNING); return -3; @@ -1531,8 +1509,7 @@ class Societe extends CommonObject $this->error = 'Fetch found several records. Rename one of thirdparties to avoid duplicate.'; dol_syslog($this->error, LOG_ERR); $result = -2; - } - elseif ($num) // $num = 1 + } elseif ($num) // $num = 1 { $obj = $this->db->fetch_object($resql); @@ -1664,14 +1641,12 @@ class Societe extends CommonObject // fetch optionals attributes and labels $this->fetch_optionals(); - } - else { + } else { $result = 0; } $this->db->free($resql); - } - else { + } else { $this->error = $this->db->lasterror(); $result = -3; } @@ -1809,14 +1784,12 @@ class Societe extends CommonObject } return 1; - } - else { + } else { dol_syslog($this->error, LOG_ERR); $this->db->rollback(); return -1; } - } - else dol_syslog("Can't remove thirdparty with id ".$id.". There is ".$objectisused." childs", LOG_WARNING); + } else dol_syslog("Can't remove thirdparty with id ".$id.". There is ".$objectisused." childs", LOG_WARNING); return 0; } @@ -1842,8 +1815,7 @@ class Societe extends CommonObject { $this->client = $newclient; return 1; - } - else return -1; + } else return -1; } return 0; } @@ -2037,13 +2009,11 @@ class Societe extends CommonObject if ($result > 0) { return $result; - } - else { + } else { $this->error = $discount->error; return -3; } - } - else return 0; + } else return 0; } /** @@ -2064,8 +2034,7 @@ class Societe extends CommonObject if ($result >= 0) { return $result; - } - else { + } else { $this->error = $discountstatic->error; return -1; } @@ -2092,8 +2061,7 @@ class Societe extends CommonObject $sql .= " WHERE ((ug.fk_user = sc.fk_user"; $sql .= " AND ug.entity = ".$conf->entity.")"; $sql .= " OR u.admin = 1)"; - } - else $sql .= " WHERE entity in (0, ".$conf->entity.")"; + } else $sql .= " WHERE entity in (0, ".$conf->entity.")"; $sql .= " AND u.rowid = sc.fk_user AND sc.fk_soc = ".$this->id; @@ -2119,15 +2087,13 @@ class Societe extends CommonObject $reparray[$i]['entity'] = $obj->entity; $reparray[$i]['login'] = $obj->login; $reparray[$i]['photo'] = $obj->photo; - } - else { + } else { $reparray[] = $obj->rowid; } $i++; } return $reparray; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2231,8 +2197,7 @@ class Societe extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } @@ -2316,8 +2281,7 @@ class Societe extends CommonObject if ($conf->global->SOCIETE_ADD_REF_IN_LIST == 1) { $name = $code.' '.$name; - } - else { + } else { $name = $code; } } @@ -2332,8 +2296,7 @@ class Societe extends CommonObject $label .= '
'; $label .= Form::showphoto('societe', $this, 0, 40, 0, '', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. $label .= '
'; - } - elseif (!empty($this->logo_squarred) && class_exists('Form')) + } elseif (!empty($this->logo_squarred) && class_exists('Form')) { /*$label.= '
'; $label.= Form::showphoto('societe', $this, 0, 40, 0, 'photowithmargin', 'mini', 0); // Important, we must force height so image will have height tags and if image is inside a tooltip, the tooltip manager can calculate height and position correctly the tooltip. @@ -2346,38 +2309,31 @@ class Societe extends CommonObject { $label .= ''.$langs->trans("ShowCustomer").''; $linkstart = ''; $linkstart = ''; $linkstart = ''; $linkstart = ''; $linkstart = ''; $linkstart = ''; $linkstart = ''; $linkstart = 'poste : "").(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); - } - else { + } else { $contact_property[$obj->rowid] = trim(dolGetFirstLastname($obj->firstname, $obj->lastname)).(($mode != 'poste' && $property) ? " ".$sepa.$property.$sepb : ''); } } $i++; } } - } - else { + } else { dol_print_error($this->db); } return $contact_property; @@ -2651,8 +2605,7 @@ class Societe extends CommonObject $i++; } } - } - else { + } else { dol_print_error($this->db); } return $contacts; @@ -2687,8 +2640,7 @@ class Societe extends CommonObject $i++; } } - } - else { + } else { dol_print_error($this->db); } return $contacts; @@ -2726,8 +2678,7 @@ class Societe extends CommonObject elseif ($mode == 'mobile') $contact_property = $obj->phone_mobile; } return $contact_property; - } - else { + } else { dol_print_error($this->db); } } @@ -2751,8 +2702,7 @@ class Societe extends CommonObject if ($mode == 'label') { return $bac->getRibLabel(true); - } - elseif ($mode == 'rum') + } elseif ($mode == 'rum') { if (empty($bac->rum)) { @@ -2762,8 +2712,7 @@ class Societe extends CommonObject $bac->rum = $prelevement->buildRumNumber($bac->thirdparty->code_client, $bac->datec, $bac->id); } return $bac->rum; - } - elseif ($mode == 'format') + } elseif ($mode == 'format') { return $bac->frstrecur; } @@ -2893,8 +2842,7 @@ class Societe extends CommonObject if ($mod->code_modifiable_invalide && $this->check_codeclient() < 0) return 1; if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; - } - else { + } else { return 0; } } @@ -2928,8 +2876,7 @@ class Societe extends CommonObject if ($mod->code_modifiable_invalide && $this->check_codefournisseur() < 0) return 1; if ($mod->code_modifiable) return 1; // A mettre en dernier return 0; - } - else { + } else { return 0; } } @@ -2965,8 +2912,7 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::check_codeclient code_client=".$this->code_client." module=".$module); $result = $mod->verif($this->db, $this->code_client, $this, 0); return $result; - } - else { + } else { return 0; } } @@ -3001,8 +2947,7 @@ class Societe extends CommonObject dol_syslog(get_class($this)."::check_codefournisseur code_fournisseur=".$this->code_fournisseur." module=".$module); $result = $mod->verif($this->db, $this->code_fournisseur, $this, 1); return $result; - } - else { + } else { return 0; } } @@ -3043,13 +2988,11 @@ class Societe extends CommonObject elseif ($type == 'supplier') $this->code_compta_fournisseur = $mod->code; return $result; - } - else { + } else { $this->error = 'ErrorAccountancyCodeNotDefined'; return -1; } - } - else { + } else { if ($type == 'customer') $this->code_compta = ''; elseif ($type == 'supplier') $this->code_compta_fournisseur = ''; @@ -3078,12 +3021,10 @@ class Societe extends CommonObject { $this->parent = $id; return 1; - } - else { + } else { return -1; } - } - else return -1; + } else return -1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps @@ -3173,8 +3114,7 @@ class Societe extends CommonObject { $obj = $this->db->fetch_object($resql); $count = $obj->idprof; - } - else { + } else { $count = 0; print $this->db->error(); } @@ -3324,8 +3264,7 @@ class Societe extends CommonObject //Check NIF if (preg_match('/(^[0-9]{9}$)/', $string)) { return 1; - } - else { + } else { return -1; } } @@ -3379,8 +3318,7 @@ class Societe extends CommonObject if ($url) { return ''.$langs->trans("Check").''; } - } - else { + } else { return $hookmanager->resPrint; } @@ -3402,8 +3340,7 @@ class Societe extends CommonObject { $obj = $this->db->fetch_object($resql); $count = $obj->numproj; - } - else { + } else { $count = 0; print $this->db->error(); } @@ -3452,8 +3389,7 @@ class Societe extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -3471,11 +3407,9 @@ class Societe extends CommonObject $isacompany = empty($conf->global->MAIN_UNKNOWN_CUSTOMERS_ARE_COMPANIES) ? 0 : 1; // 0 by default if (!empty($this->tva_intra)) { $isacompany = 1; - } - elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { + } elseif (!empty($this->idprof1) || !empty($this->idprof2) || !empty($this->idprof3) || !empty($this->idprof4) || !empty($this->idprof5) || !empty($this->idprof6)) { $isacompany = 1; - } - elseif (!empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') + } elseif (!empty($this->typent_code) && $this->typent_code != 'TE_UNKNOWN') { // TODO Add a field is_a_company into dictionary if (preg_match('/^TE_PRIVATE/', $this->typent_code)) $isacompany = 0; @@ -3518,8 +3452,7 @@ class Societe extends CommonObject $this->SupplierCategories[$obj->rowid] = $obj->label; } return 0; - } - else { + } else { return -1; } } @@ -3540,8 +3473,7 @@ class Societe extends CommonObject $sql .= " VALUES (".$categorie_id.", ".$this->id.")"; if ($resql = $this->db->query($sql)) return 0; - } - else { + } else { return 0; } return -1; @@ -3603,15 +3535,13 @@ class Societe extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } - } - else { + } else { // $this->error deja positionne dol_syslog(get_class($this)."::create_from_member - 2 - ".$this->error." - ".join(',', $this->errors), LOG_ERR); @@ -3652,8 +3582,7 @@ class Societe extends CommonObject { $country_code = $tmp[1]; $country_label = $tmp[2]; - } - else // For backward compatibility + } else // For backward compatibility { dol_syslog("Your country setup use an old syntax. Reedit it using setup area.", LOG_WARNING); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -3677,8 +3606,7 @@ class Societe extends CommonObject { $state_code = $tmp[1]; $state_label = $tmp[2]; - } - else // For backward compatibility + } else // For backward compatibility { dol_syslog("Your state setup use an old syntax. Reedit it using setup area.", LOG_ERR); include_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; @@ -3816,8 +3744,7 @@ class Societe extends CommonObject if ($resql) { return ($this->db->num_rows($resql) > 0); - } - else return false; + } else return false; } /** @@ -3837,8 +3764,7 @@ class Societe extends CommonObject if ($resql) { return ($this->db->num_rows($resql) > 0); - } - else return false; + } else return false; } /** @@ -3860,8 +3786,7 @@ class Societe extends CommonObject { $obj = $this->db->fetch_object($resql); return (($obj->nb > 0) ?true:false); - } - else { + } else { $this->error = $this->db->lasterror(); return false; } @@ -4026,8 +3951,7 @@ class Societe extends CommonObject } } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' - } - else return array(); + } else return array(); } /** @@ -4065,8 +3989,7 @@ class Societe extends CommonObject } } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' - } - else return array(); + } else return array(); } /** @@ -4107,8 +4030,7 @@ class Societe extends CommonObject { require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; $tmpobject = new FactureFournisseur($this->db); - } - else { + } else { require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; $tmpobject = new Facture($this->db); } @@ -4143,8 +4065,7 @@ class Societe extends CommonObject } } return array('opened'=>$outstandingOpened, 'total_ht'=>$outstandingTotal, 'total_ttc'=>$outstandingTotalIncTax); // 'opened' is 'incl taxes' - } - else { + } else { return array(); } } @@ -4203,16 +4124,14 @@ class Societe extends CommonObject $result = $companybankaccount->fetch($moreparams['use_companybankid']); if (!$result) dol_print_error($this->db, $companybankaccount->error, $companybankaccount->errors); $result = $companybankaccount->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams); - } - else { + } else { // Positionne le modele sur le nom du modele a utiliser if (!dol_strlen($modele)) { if (!empty($conf->global->COMPANY_ADDON_PDF)) { $modele = $conf->global->COMPANY_ADDON_PDF; - } - else { + } else { print $langs->trans("Error")." ".$langs->trans("Error_COMPANY_ADDON_PDF_NotDefined"); return 0; } diff --git a/htdocs/societe/class/societeaccount.class.php b/htdocs/societe/class/societeaccount.class.php index 1f99e9bae8a..ba32086cc4d 100644 --- a/htdocs/societe/class/societeaccount.class.php +++ b/htdocs/societe/class/societeaccount.class.php @@ -433,8 +433,7 @@ class SocieteAccount extends CommonObject } $linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"'; - } - else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); + } else $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); $linkstart = ''; @@ -477,33 +476,27 @@ class SocieteAccount extends CommonObject $prefix = ''; if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 1) + } elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); elseif ($status == 0) return $langs->trans('Disabled'); - } - elseif ($mode == 2) + } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 3) + } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 4) + } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'), 'statut4').' '.$langs->trans('Enabled'); elseif ($status == 0) return img_picto($langs->trans('Disabled'), 'statut5').' '.$langs->trans('Disabled'); - } - elseif ($mode == 5) + } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); - } - elseif ($mode == 6) + } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'), 'statut4'); elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'), 'statut5'); @@ -556,8 +549,7 @@ class SocieteAccount extends CommonObject } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 2660625bd1c..312835e1a80 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -427,8 +427,7 @@ if ($sql_select) if ($type_element == 'contract') { print $documentstaticline->getLibStatut(2); - } - else { + } else { print $documentstatic->getLibStatut(2); } print ''; @@ -470,8 +469,7 @@ if ($sql_select) } $label = (!empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label; - } - else { + } else { $label = $objp->product_label; } @@ -505,27 +503,23 @@ if ($sql_select) $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessReceived", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(EXCESS PAID)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromExcessPaid", $discount->getNomUrl(0)); - } - elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) + } elseif ($objp->description == '(DEPOSIT)' && $objp->fk_remise_except > 0) { $discount = new DiscountAbsolute($db); $discount->fetch($objp->fk_remise_except); echo ($txt ? ' - ' : '').$langs->transnoentities("DiscountFromDeposit", $discount->getNomUrl(0)); // Add date of deposit if (!empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec).')'; - } - else { + } else { echo ($txt ? ' - ' : '').dol_htmlentitiesbr($objp->description); } } - } - else { + } else { if ($objp->fk_product > 0) { echo $form->textwithtooltip($text, $description, 3, '', '', $i, 0, ''); @@ -603,8 +597,7 @@ if ($sql_select) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num); } $db->free($resql); -} -elseif (empty($type_element) || $type_element == -1) +} elseif (empty($type_element) || $type_element == -1) { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); @@ -621,8 +614,7 @@ elseif (empty($type_element) || $type_element == -1) print '
'; print "
'; -if ($mesg) { print $mesg; } -else { +if ($mesg) { print $mesg; } else { print $px1->show(); print "
\n"; print $px2->show(); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 307b903787e..21ee679292a 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -53,8 +53,7 @@ if ($action == 'setcodeclient') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -65,8 +64,7 @@ if ($action == 'setcodecompta') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -81,8 +79,7 @@ if ($action == 'updateoptions') if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -95,8 +92,7 @@ if ($action == 'updateoptions') if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -109,8 +105,7 @@ if ($action == 'updateoptions') if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -172,8 +167,7 @@ if ($action == 'setdoc') if ($result1 && $result2) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -186,8 +180,7 @@ if ($action == "setaddrefinlist") { if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -200,8 +193,7 @@ if ($action == "setaddadressinlist") { if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -214,8 +206,7 @@ if ($action == "setaskforshippingmet") { if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -228,8 +219,7 @@ if ($action == "setdisableprospectcustomer") { if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -244,8 +234,7 @@ if ($action == 'setprofid') { //header("Location: ".$_SERVER["PHP_SELF"]); //exit; - } - else { + } else { dol_print_error($db); } } @@ -260,8 +249,7 @@ if ($action == 'setprofidmandatory') { //header("Location: ".$_SERVER["PHP_SELF"]); //exit; - } - else { + } else { dol_print_error($db); } } @@ -276,8 +264,7 @@ if ($action == 'setprofidinvoicemandatory') { //header("Location: ".$_SERVER["PHP_SELF"]); //exit; - } - else { + } else { dol_print_error($db); } } @@ -291,8 +278,7 @@ if ($action == 'sethideinactivethirdparty') { header("Location: ".$_SERVER["PHP_SELF"]); exit; - } - else { + } else { dol_print_error($db); } } @@ -303,8 +289,7 @@ if ($action == 'setonsearchandlistgooncustomerorsuppliercard') { if (!$error) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -363,8 +348,7 @@ foreach ($dirsociete as $dirroot) try { dol_include_once($dirroot.$file.'.php'); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -396,8 +380,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) print '
'."\n"; print img_picto($langs->trans("Activated"), 'switch_on'); print "'; if (!$disabled) print ''; @@ -450,8 +433,7 @@ foreach ($dirsociete as $dirroot) try { dol_include_once($dirroot.$file.'.php'); - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog($e->getMessage(), LOG_ERR); } @@ -481,8 +463,7 @@ foreach ($arrayofmodules as $file => $modCodeCompta) print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print '\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off'); print "\n"; print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print "'; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; print img_picto($langs->trans("Activated"), 'switch_on'); print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; $arrval = array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', @@ -782,8 +754,7 @@ if (!$conf->use_javascript_ajax) print ''; print $langs->trans("NotAvailableWhenAjaxDisabled"); print "'; $arrval = array('0'=>$langs->trans("No"), '1'=>$langs->trans("Yes").' ('.$langs->trans("NumberOfKeyToSearch", 1).')', @@ -807,8 +778,7 @@ if (!empty($conf->global->SOCIETE_ADD_REF_IN_LIST)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -823,8 +793,7 @@ if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -841,8 +810,7 @@ if (!empty($conf->global->SOCIETE_ASK_FOR_SHIPPING_METHOD)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } @@ -858,8 +826,7 @@ if (!empty($conf->global->SOCIETE_DISABLE_PROSPECTSCUSTOMERS)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } diff --git a/htdocs/societe/agenda.php b/htdocs/societe/agenda.php index 4142231261d..61d473f5c43 100644 --- a/htdocs/societe/agenda.php +++ b/htdocs/societe/agenda.php @@ -38,8 +38,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = GETPOST('actioncode', 'array', 3); if (!count($actioncode)) $actioncode = '0'; -} -else { +} else { $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT)); } $search_agenda_label = GETPOST('search_agenda_label'); diff --git a/htdocs/societe/ajax/company.php b/htdocs/societe/ajax/company.php index 1622b81384d..dc2d60df5e6 100644 --- a/htdocs/societe/ajax/company.php +++ b/htdocs/societe/ajax/company.php @@ -67,8 +67,7 @@ if (!empty($action) && $action == 'fetch' && !empty($id)) } echo json_encode($outjson); -} -else { +} else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; $langs->load("companies"); diff --git a/htdocs/societe/ajaxcompanies.php b/htdocs/societe/ajaxcompanies.php index 0558d7d31c8..b98a5f75d5b 100644 --- a/htdocs/societe/ajaxcompanies.php +++ b/htdocs/societe/ajaxcompanies.php @@ -71,8 +71,7 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) $sql .= "nom LIKE '".$db->escape($socid)."%'"; $sql .= " OR code_client LIKE '".$db->escape($socid)."%'"; $sql .= " OR code_fournisseur LIKE '".$db->escape($socid)."%'"; - } - else { + } else { $sql .= "nom LIKE '%".$db->escape($socid)."%'"; $sql .= " OR code_client LIKE '%".$db->escape($socid)."%'"; $sql .= " OR code_fournisseur LIKE '%".$db->escape($socid)."%'"; @@ -99,11 +98,9 @@ if (GETPOST('newcompany') || GETPOST('socid', 'int') || GETPOST('id_fourn')) } echo json_encode($return_arr); - } - else { + } else { echo json_encode(array('nom'=>'Error', 'label'=>'Error', 'key'=>'Error', 'value'=>'Error')); } -} -else { +} else { echo json_encode(array('nom'=>'ErrorBadParameter', 'label'=>'ErrorBadParameter', 'key'=>'ErrorBadParameter', 'value'=>'ErrorBadParameter')); } diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0cd103a2855..fa650a4e1fd 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -244,22 +244,19 @@ abstract class ActionsCardCommon $this->tpl['localtax'] .= ''.$langs->trans("LocalTax2IsUsedES").''; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '
'.$langs->trans("LocalTax1IsUsedES").''; $this->tpl['localtax'] .= $form->selectyesno('localtax1assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '
'.$langs->trans("LocalTax2IsUsedES").''; $this->tpl['localtax'] .= $form->selectyesno('localtax2assuj_value', $this->object->localtax1_assuj, 1); $this->tpl['localtax'] .= '
'.yn($this->object->localtax1_assuj).''.$langs->trans("LocalTax2IsUsedES").''.yn($this->object->localtax2_assuj).'
'.$langs->trans("LocalTax1IsUsedES").''.yn($this->object->localtax1_assuj).'
'.$langs->trans("LocalTax2IsUsedES").''.yn($this->object->localtax2_assuj).'
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } - else { + } else { print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } @@ -1411,8 +1389,7 @@ else { print "\n"; $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else { + } else { $s .= 'country_id).'" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } @@ -1431,14 +1408,12 @@ else { print ''.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2 : 0), 1); print '
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print $form->selectyesno('localtax1assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX1 : 0), 1); print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print $form->selectyesno('localtax2assuj_value', (isset($conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2) ? $conf->global->THIRDPARTY_DEFAULT_USELOCALTAX2 : 0), 1); @@ -1463,8 +1438,7 @@ else { if ($object->country_id) { print $formcompany->select_juridicalstatus($object->forme_juridique_code, $object->country_code, '', 'forme_juridique_code'); - } - else { + } else { print $countrynotdefined; } print '
'.$form->editfieldkey('Region-State', 'state_id', '', $object, 0).''; - } - else { + } else { print '
'.$form->editfieldkey('State', 'state_id', '', $object, 0).''; } @@ -2022,8 +1988,7 @@ else { print ''; } print '
'.$form->editfieldkey($langs->transcountry("LocalTax1IsUsed", $mysoc->country_code), 'localtax1assuj_value', '', $object, 0).''; print $form->selectyesno('localtax1assuj_value', $object->localtax1_assuj, 1); @@ -2034,8 +1999,7 @@ else { print ''; } print '
'.$form->editfieldkey($langs->transcountry("LocalTax2IsUsed", $mysoc->country_code), 'localtax2assuj_value', '', $object, 0).''; print $form->selectyesno('localtax2assuj_value', $object->localtax2_assuj, 1); @@ -2071,8 +2035,7 @@ else { print "\n"; $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else { + } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } @@ -2214,8 +2177,7 @@ else { print ''; } - } - else { + } else { /* * View */ @@ -2376,8 +2338,7 @@ else { print ''; $formcompany->select_localtax(1, $object->localtax1_value, "lt1"); print ''.$object->localtax1_value.'
'.$langs->transcountry("LocalTax1IsUsed", $mysoc->country_code).''; print yn($object->localtax1_assuj); @@ -2418,8 +2378,7 @@ else { } print '
'.$langs->transcountry("LocalTax2IsUsed", $mysoc->country_code).''; print yn($object->localtax2_assuj); @@ -2469,14 +2428,12 @@ else { print "\n"; $s .= ''.$langs->trans("VATIntraCheck").''; $s = $form->textwithpicto($s, $langs->trans("VATIntraCheckDesc", $langs->transnoentitiesnoconv("VATIntraCheck")), 1); - } - else { + } else { $s .= 'country_id).'" class="hideonsmartphone" target="_blank">'.img_picto($langs->trans("VATIntraCheckableOnEUSite"), 'help').''; } } print $s; - } - else { + } else { print ' '; } print '
'.$langs->trans("SelectElementAndClick", $langs->transnoentitiesnoconv("Search")).'
"; -} -else { +} else { print_barre_liste($langs->trans('ProductsIntoElements').' '.$typeElementString.' '.$button, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', ''); print ''."\n"; diff --git a/htdocs/societe/document.php b/htdocs/societe/document.php index 9f3751fd5b2..ba0241a90f7 100644 --- a/htdocs/societe/document.php +++ b/htdocs/societe/document.php @@ -166,8 +166,7 @@ if ($object->id) $permtoedit = $user->rights->societe->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { accessforbidden('', 0, 0); } diff --git a/htdocs/societe/index.php b/htdocs/societe/index.php index c62ec602ecd..85c27a29b7e 100644 --- a/htdocs/societe/index.php +++ b/htdocs/societe/index.php @@ -95,8 +95,7 @@ if ($result) if (!empty($conf->societe->enabled) && $objp->client == 0 && $objp->fournisseur == 0) { $found = 1; $third['other']++; } if ($found) $total++; } -} -else dol_print_error($db); +} else dol_print_error($db); print '
'; print '
'."\n"; @@ -119,8 +118,7 @@ if (!empty($conf->use_javascript_ajax) && ((round($third['prospect']) ? 1 : 0) + $dolgraph->draw('idgraphthirdparties'); print $dolgraph->show(); print ''."\n"; -} -else { +} else { if (!empty($conf->societe->enabled) && $user->rights->societe->lire && empty($conf->global->SOCIETE_DISABLE_PROSPECTS) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS_STATS)) { $statstring = ""; @@ -184,8 +182,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA if ($i < $nbmax) { $dataseries[] = array($obj->label, round($obj->nb)); - } - else { + } else { $rest += $obj->nb; } $total += $obj->nb; @@ -204,8 +201,7 @@ if (!empty($conf->categorie->enabled) && !empty($conf->global->CATEGORY_GRAPHSTA $dolgraph->setHeight('200'); $dolgraph->draw('idgraphcateg'); print $dolgraph->show(); - } - else { + } else { while ($i < $num) { $obj = $db->fetch_object($result); @@ -331,8 +327,7 @@ if ($result) print ''; print "\n"; } -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index cb94da91e2f..4ead540eb8b 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -386,8 +386,7 @@ if ($resql) if ($level == $obj->code) $level = $langs->trans($obj->label); $tab_level[$obj->code] = $level; } -} -else dol_print_error($db); +} else dol_print_error($db); $sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; $sql .= " s.entity,"; @@ -1049,8 +1048,7 @@ while ($i < min($num, $limit)) if ($contextpage == 'poslist') { print $obj->name; - } - else { + } else { print $companystatic->getNomUrl(1, '', 100, 0, 1); } print "\n"; diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 48a31085eb4..866a0e0964f 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -122,8 +122,7 @@ if ($object->id > 0) include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php'; dol_fiche_end(); -} -else { +} else { $langs->load("errors"); print $langs->trans("ErrorRecordNotFound"); } diff --git a/htdocs/societe/notify/card.php b/htdocs/societe/notify/card.php index 0650261cefc..2a0d2603e5b 100644 --- a/htdocs/societe/notify/card.php +++ b/htdocs/societe/notify/card.php @@ -104,16 +104,14 @@ if (empty($reshook)) $error++; dol_print_error($db); } - } - else { + } else { dol_print_error($db); } if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -261,8 +259,7 @@ if ($result > 0) print ''; print ''; print ''; - } - else { + } else { print ''; @@ -290,8 +287,7 @@ if ($result > 0) if ($resql) { $num = $db->num_rows($resql); - } - else { + } else { dol_print_error($db); } @@ -329,8 +325,7 @@ if ($result > 0) if (isValidEmail($obj->email)) { print ' <'.$obj->email.'>'; - } - else { + } else { $langs->load("errors"); print '   '.img_warning().' '.$langs->trans("ErrorBadEMail", $obj->email); } @@ -438,8 +433,7 @@ if ($result > 0) if ($resql) { $num = $db->num_rows($resql); - } - else { + } else { dol_print_error($db); } @@ -487,8 +481,7 @@ if ($result > 0) $contactstatic->firstname = $obj->firstname; print $contactstatic->getNomUrl(1); print $obj->email ? ' <'.$obj->email.'>' : $langs->trans("NoMail"); - } - else { + } else { print $obj->email; } print ''; @@ -522,8 +515,7 @@ if ($result > 0) print '
'; print $langs->trans("YouMustCreateContactFirst"); print '
'; print ''; -} -else dol_print_error('', 'RecordNotFound'); +} else dol_print_error('', 'RecordNotFound'); // End of page llxFooter(); diff --git a/htdocs/societe/paymentmodes.php b/htdocs/societe/paymentmodes.php index 2d5e0612959..fa01e2db095 100644 --- a/htdocs/societe/paymentmodes.php +++ b/htdocs/societe/paymentmodes.php @@ -175,8 +175,7 @@ if (empty($reshook)) if (!$result) { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); - } - else { + } else { // If this account is the default bank account, we disable others if ($companybankaccount->default_rib) { @@ -229,8 +228,7 @@ if (empty($reshook)) if (!$result) { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); - } - else { + } else { // If this account is the default bank account, we disable others if ($companypaymentmode->default_rib) { @@ -336,8 +334,7 @@ if (empty($reshook)) $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; - } - else { + } else { $db->rollback(); } } @@ -404,8 +401,7 @@ if (empty($reshook)) $url = $_SERVER["PHP_SELF"].'?socid='.$object->id; header('Location: '.$url); exit; - } - else { + } else { $db->rollback(); } } @@ -420,8 +416,7 @@ if (empty($reshook)) $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; - } - else { + } else { setEventMessages($db->lasterror, null, 'errors'); } } @@ -446,12 +441,10 @@ if (empty($reshook)) $url = $_SERVER['PHP_SELF']."?socid=".$object->id; header('Location: '.$url); exit; - } - else { + } else { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } - } - else { + } else { setEventMessages($companypaymentmode->error, $companypaymentmode->errors, 'errors'); } } @@ -466,12 +459,10 @@ if (empty($reshook)) $url = $_SERVER['PHP_SELF']."?socid=".$object->id; header('Location: '.$url); exit; - } - else { + } else { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } - } - else { + } else { setEventMessages($companybankaccount->error, $companybankaccount->errors, 'errors'); } } @@ -506,16 +497,14 @@ if (empty($reshook)) { $error++; setEventMessages('ThisThirdpartyIsNotACustomer', null, 'errors'); - } - else { + } else { // Creation of Stripe customer + update of societe_account $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus, 1); if (!$cu) { $error++; setEventMessages($stripe->error, $stripe->errors, 'errors'); - } - else { + } else { $stripecu = $cu->id; } } @@ -529,8 +518,7 @@ if (empty($reshook)) { $error++; setEventMessages('ThisPaymentModeIsNotACard', null, 'errors'); - } - else { + } else { // Get the Stripe customer $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); if (!$cu) @@ -600,8 +588,7 @@ if (empty($reshook)) { $stripecu = $newcu; $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -656,8 +643,7 @@ if (empty($reshook)) { $stripesupplieracc = $newsup; $db->commit(); - } - else { + } else { $db->rollback(); } } @@ -670,22 +656,19 @@ if (empty($reshook)) $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; - } - catch (Exception $e) + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } - } - elseif ($action == 'setassourcedefault') // Set as default when payment mode defined remotely only + } elseif ($action == 'setassourcedefault') // Set as default when payment mode defined remotely only { try { $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); if (preg_match('/pm_/', $source)) { $cu->invoice_settings->default_payment_method = (string) $source; // New - } - else { + } else { $cu->default_source = (string) $source; // Old } $result = $cu->save(); @@ -693,14 +676,12 @@ if (empty($reshook)) $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; - } - catch (Exception $e) + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } - } - elseif ($action == 'deletecard' && $source) + } elseif ($action == 'deletecard' && $source) { try { if (preg_match('/pm_/', $source)) @@ -710,8 +691,7 @@ if (empty($reshook)) { $payment_method->detach(); } - } - else { + } else { $cu = $stripe->customerStripe($object, $stripeacc, $servicestatus); $card = $cu->sources->retrieve("$source"); if ($card) { @@ -727,8 +707,7 @@ if (empty($reshook)) $url = DOL_URL_ROOT.'/societe/paymentmodes.php?socid='.$object->id; header('Location: '.$url); exit; - } - catch (Exception $e) + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); @@ -766,8 +745,7 @@ if (!$id) { $companybankaccount->fetch(0, $object->id); $companypaymentmode->fetch(0, null, $object->id, 'card'); -} -else { +} else { $companybankaccount->fetch($id); $companypaymentmode->fetch($id); } @@ -958,8 +936,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if (empty($conf->global->STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION)) { $listofsources = $customerstripe->sources->data; - } - else { + } else { $service = 'StripeTest'; $servicestatus = 0; if (!empty($conf->global->STRIPE_LIVE) && !GETPOST('forcesandbox', 'alpha')) @@ -980,16 +957,14 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' } $listofsources = $paymentmethodobjs->data; - } - catch (Exception $e) + } catch (Exception $e) { $error++; setEventMessages($e->getMessage(), null, 'errors'); } } } - } - catch (Exception $e) + } catch (Exception $e) { dol_syslog("Error when searching/loading Stripe customer for thirdparty id =".$object->id); } @@ -1086,8 +1061,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($companypaymentmodetemp->country_code); print $img ? $img.' ' : ''; print getCountry($companypaymentmodetemp->country_code, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; print ''; // Default print ''; @@ -1134,8 +1108,7 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $i++; } } - } - else dol_print_error($db); + } else dol_print_error($db); } // Show remote sources (not already shown as local source) @@ -1175,20 +1148,16 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' if ($src->object == 'card') { print img_credit_card($src->brand); - } - elseif ($src->object == 'source' && $src->type == 'card') + } elseif ($src->object == 'source' && $src->type == 'card') { print img_credit_card($src->card->brand); - } - elseif ($src->object == 'source' && $src->type == 'sepa_debit') + } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print ''; - } - elseif ($src->object == 'payment_method' && $src->type == 'card') + } elseif ($src->object == 'payment_method' && $src->type == 'card') { print img_credit_card($src->card->brand); - } - elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print ''; } @@ -1204,10 +1173,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($src->country); print $img ? $img.' ' : ''; print getCountry($src->country, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - elseif ($src->object == 'source' && $src->type == 'card') + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } elseif ($src->object == 'source' && $src->type == 'card') { print ''.$src->owner->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; @@ -1217,10 +1184,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($src->card->country); print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - elseif ($src->object == 'source' && $src->type == 'sepa_debit') + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } elseif ($src->object == 'source' && $src->type == 'sepa_debit') { print 'SEPA debit'; print ''; @@ -1229,10 +1194,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($src->sepa_debit->country); print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - elseif ($src->object == 'payment_method' && $src->type == 'card') + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } elseif ($src->object == 'payment_method' && $src->type == 'card') { print ''.$src->billing_details->name.'
....'.$src->card->last4.' - '.$src->card->exp_month.'/'.$src->card->exp_year.''; print ''; @@ -1242,10 +1205,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($src->card->country); print $img ? $img.' ' : ''; print getCountry($src->card->country, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } elseif ($src->object == 'payment_method' && $src->type == 'sepa_debit') { print 'SEPA debit'; print ''; @@ -1254,10 +1215,8 @@ if ($socid && $action != 'edit' && $action != 'create' && $action != 'editcard' $img = picto_from_langcode($src->sepa_debit->country); print $img ? $img.' ' : ''; print getCountry($src->sepa_debit->country, 1); - } - else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; - } - else { + } else print img_warning().' '.$langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CompanyCountry")).''; + } else { print ''; } print ''; diff --git a/htdocs/societe/price.php b/htdocs/societe/price.php index 2f0595cf15d..278a85fa7f5 100644 --- a/htdocs/societe/price.php +++ b/htdocs/societe/price.php @@ -466,16 +466,14 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print ''; } print ""; - } - else { + } else { print $langs->trans('None'); } print "\n".'

\n"; - } - else { + } else { // View mode /* ************************************************************************** */ @@ -588,8 +586,7 @@ if (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { print "\n"; } - } - else { + } else { $colspan = 9; if ($user->rights->produit->supprimer || $user->rights->service->supprimer) $colspan += 1; print ''.$langs->trans('None').''; diff --git a/htdocs/societe/societecontact.php b/htdocs/societe/societecontact.php index e25b5c5e606..1369f29a185 100644 --- a/htdocs/societe/societecontact.php +++ b/htdocs/societe/societecontact.php @@ -78,14 +78,12 @@ if ($action == 'addcontact' && $user->rights->societe->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); $mesg = '
'.$langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType").'
'; - } - else { + } else { $mesg = '
'.$object->error.'
'; } } @@ -97,8 +95,7 @@ elseif ($action == 'swapstatut' && $user->rights->societe->creer) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -113,8 +110,7 @@ elseif ($action == 'deletecontact' && $user->rights->societe->creer) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -324,15 +320,13 @@ if ($id > 0 || !empty($ref)) print " ".img_warning($langs->trans("SubscriptionLate")); } print ''; - } - else { + } else { print ''; if ($objp->subscription == 'yes') { print $langs->trans("SubscriptionNotReceived"); if ($objp->statut > 0) print " ".img_warning(); - } - else { + } else { print ' '; } print ''; @@ -345,8 +339,7 @@ if ($id > 0 || !empty($ref)) } } } - } - else { + } else { // Contrat non trouve print "ErrorRecordNotFound"; } diff --git a/htdocs/societe/tpl/linesalesrepresentative.tpl.php b/htdocs/societe/tpl/linesalesrepresentative.tpl.php index 11b2d033b69..8ee338fba44 100644 --- a/htdocs/societe/tpl/linesalesrepresentative.tpl.php +++ b/htdocs/societe/tpl/linesalesrepresentative.tpl.php @@ -48,6 +48,5 @@ if ($nbofsalesrepresentative > 0) print $userstatic->getNomUrl(-1); print ' '; } -} -else print ''.$langs->trans("NoSalesRepresentativeAffected").''; +} else print ''.$langs->trans("NoSalesRepresentativeAffected").''; print ''; diff --git a/htdocs/stripe/admin/stripe.php b/htdocs/stripe/admin/stripe.php index f20ac732fd4..728c076d1c8 100644 --- a/htdocs/stripe/admin/stripe.php +++ b/htdocs/stripe/admin/stripe.php @@ -136,8 +136,7 @@ if ($action == "setlive") $res = dolibarr_set_const($db, "STRIPE_LIVE", $liveenable, 'yesno', 0, '', $conf->entity); if ($res > 0) { setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } @@ -236,14 +235,12 @@ if (empty($conf->stripeconnect->enabled)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); - } - else { + } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; - } - else { + } else { print img_picto($langs->trans("inactive"), 'statut5'); } } @@ -307,20 +304,17 @@ if (empty($conf->stripeconnect->enabled)) { print ''; print img_picto($langs->trans("Activated"), 'switch_on'); - } - else { + } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); } //print $endpoint; - } - else { + } else { print img_picto($langs->trans("inactive"), 'statut5'); } } print ''; -} -else { +} else { print ''.$langs->trans("StripeConnect").''; print ''.$langs->trans("StripeConnect_Mode").''; } diff --git a/htdocs/stripe/charge.php b/htdocs/stripe/charge.php index 74fa1aafc43..5672176168a 100644 --- a/htdocs/stripe/charge.php +++ b/htdocs/stripe/charge.php @@ -65,8 +65,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $service = 'StripeTest'; $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} -else { +} else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -84,8 +83,7 @@ if (!$rowid) if ($stripeacc) { $list = \Stripe\Charge::all($option, array("stripe_account" => $stripeacc)); - } - else { + } else { $list = \Stripe\Charge::all($option); } @@ -177,19 +175,16 @@ if (!$rowid) if (!empty($tmparray['CUS']) && $tmparray['CUS'] > 0) { $societestatic->fetch($tmparray['CUS']); - } - elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) + } elseif (!empty($charge->metadata->dol_thirdparty_id) && $charge->metadata->dol_thirdparty_id > 0) { $societestatic->fetch($charge->metadata->dol_thirdparty_id); - } - else { + } else { $societestatic->id = 0; } if (!empty($tmparray['MEM']) && $tmparray['MEM'] > 0) { $memberstatic->fetch($tmparray['MEM']); - } - else { + } else { $memberstatic->id = 0; } @@ -227,8 +222,7 @@ if (!$rowid) if ($societestatic->id > 0) { print $societestatic->getNomUrl(1); - } - elseif ($memberstatic->id > 0) + } elseif ($memberstatic->id > 0) { print $memberstatic->getNomUrl(1); } diff --git a/htdocs/stripe/class/actions_stripe.class.php b/htdocs/stripe/class/actions_stripe.class.php index 4b68ad72b09..2fafe09a693 100644 --- a/htdocs/stripe/class/actions_stripe.class.php +++ b/htdocs/stripe/class/actions_stripe.class.php @@ -75,8 +75,7 @@ class ActionsStripeconnect { $service = 'StripeTest'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); - } - else { + } else { $service = 'StripeLive'; } @@ -103,13 +102,11 @@ class ActionsStripeconnect if ($stripe->getStripeAccount($service) && $object->client != 0) { $customer = $stripe->customerStripe($object, $stripe->getStripeAccount($service)); $this->resprints .= $customer->id; - } - else { + } else { $this->resprints .= $langs->trans("NoStripe"); } $this->resprints .= ''; - } - elseif (is_object($object) && $object->element == 'member') { + } elseif (is_object($object) && $object->element == 'member') { $this->resprints .= ''; $this->resprints .= ''; print "
'; $this->resprints .= $langs->trans('StripeCustomer'); @@ -207,24 +204,19 @@ class ActionsStripeconnect { $langs->load("withdrawals"); print ''.$langs->trans("StripeConnectPay").''; - } - else { + } else { print ''.$langs->trans("StripeConnectPay").''; } - } - elseif ($resteapayer == 0) + } elseif ($resteapayer == 0) { print ''.$langs->trans("StripeConnectPay").''; } - } - else { + } else { print ''.$langs->trans("StripeConnectPay").''; } - } - elseif (is_object($object) && $object->element == 'invoice_supplier') { + } elseif (is_object($object) && $object->element == 'invoice_supplier') { print ''.$langs->trans("StripeConnectPay").''; - } - elseif (is_object($object) && $object->element == 'member') { + } elseif (is_object($object) && $object->element == 'member') { print ''.$langs->trans("StripeAutoSubscription").''; } return 0; diff --git a/htdocs/stripe/class/stripe.class.php b/htdocs/stripe/class/stripe.class.php index 4a56a2a1542..f3bb30d7efb 100644 --- a/htdocs/stripe/class/stripe.class.php +++ b/htdocs/stripe/class/stripe.class.php @@ -95,8 +95,7 @@ class Stripe extends CommonObject $sql .= " AND service = '".$mode."'"; if ($fk_soc > 0) { $sql .= " AND fk_soc = ".$fk_soc; - } - else { + } else { $sql .= " AND fk_soc IS NULL"; } $sql .= " AND fk_user IS NULL AND fk_adherent IS NULL"; @@ -113,8 +112,7 @@ class Stripe extends CommonObject } else { $tokenstring = ''; } - } - else { + } else { dol_print_error($this->db); } @@ -189,14 +187,12 @@ class Stripe extends CommonObject } else { $customer = \Stripe\Customer::retrieve("$tiers", array("stripe_account" => $key)); } - } - catch (Exception $e) + } catch (Exception $e) { // For exemple, we may have error: 'No such customer: cus_XXXXX; a similar object exists in live mode, but a test mode key was used to make this request.' $this->error = $e->getMessage(); } - } - elseif ($createifnotlinkedtostripe) + } elseif ($createifnotlinkedtostripe) { $ipaddress = getUserRemoteIP(); @@ -254,14 +250,12 @@ class Stripe extends CommonObject { $this->error = $this->db->lasterror(); } - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); } } - } - else { + } else { dol_print_error($this->db); } @@ -289,8 +283,7 @@ class Stripe extends CommonObject } else { $stripepaymentmethod = \Stripe\PaymentMethod::retrieve(''.$paymentmethod->id.'', array("stripe_account" => $key)); } - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); } @@ -480,8 +473,7 @@ class Stripe extends CommonObject $obj = $this->db->fetch_object($resql); if ($obj) $paymentintentalreadyexists++; } - } - else dol_print_error($this->db); + } else dol_print_error($this->db); // If not, we create it. if (!$paymentintentalreadyexists) @@ -497,19 +489,16 @@ class Stripe extends CommonObject dol_syslog(get_class($this)."::PaymentIntent failed to insert paymentintent with id=".$paymentintent->id." into database."); } } - } - else { + } else { $_SESSION["stripe_payment_intent"] = $paymentintent; } - } - catch (Stripe\Error\Card $e) + } catch (Stripe\Error\Card $e) { $error++; $this->error = $e->getMessage(); $this->code = $e->getStripeCode(); $this->declinecode = $e->getDeclineCode(); - } - catch (Exception $e) + } catch (Exception $e) { /*var_dump($dataforintent); var_dump($description); @@ -529,8 +518,7 @@ class Stripe extends CommonObject if (!$error) { return $paymentintent; - } - else { + } else { return null; } } @@ -654,8 +642,7 @@ class Stripe extends CommonObject { $_SESSION["stripe_setup_intent"] = $setupintent; }*/ - } - catch (Exception $e) + } catch (Exception $e) { /*var_dump($dataforintent); var_dump($description); @@ -671,8 +658,7 @@ class Stripe extends CommonObject { dol_syslog("getSetupIntent ".(is_object($setupintent) ? $setupintent->id : ''), LOG_INFO, -1); return $setupintent; - } - else { + } else { dol_syslog("getSetupIntent return error=".$error, LOG_INFO, -1); return null; } @@ -716,8 +702,7 @@ class Stripe extends CommonObject if (!preg_match('/^pm_/', $cardref)) { $card = $cu->sources->retrieve($cardref); - } - else { + } else { $card = \Stripe\PaymentMethod::retrieve($cardref); } } else { @@ -725,20 +710,17 @@ class Stripe extends CommonObject { //$card = $cu->sources->retrieve($cardref, array("stripe_account" => $stripeacc)); // this API fails when array stripe_account is provided $card = $cu->sources->retrieve($cardref); - } - else { + } else { //$card = \Stripe\PaymentMethod::retrieve($cardref, array("stripe_account" => $stripeacc)); // Don't know if this works $card = \Stripe\PaymentMethod::retrieve($cardref); } } - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); } - } - elseif ($createifnotlinkedtostripe) + } elseif ($createifnotlinkedtostripe) { $exp_date_month = $obj->exp_date_month; $exp_date_year = $obj->exp_date_year; @@ -763,8 +745,7 @@ class Stripe extends CommonObject { $this->error = 'Creation of card on Stripe has failed'; } - } - else { + } else { $connect = ''; if (!empty($stripeacc)) $connect = $stripeacc.'/'; $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$cu->id; @@ -786,8 +767,7 @@ class Stripe extends CommonObject { $this->error = 'Creation of card on Stripe has failed'; } - } - else { + } else { $connect = ''; if (!empty($stripeacc)) $connect = $stripeacc.'/'; $url = 'https://dashboard.stripe.com/'.$connect.'test/customers/'.$cu->id; @@ -816,16 +796,14 @@ class Stripe extends CommonObject $this->error = $this->db->lasterror(); } } - } - catch (Exception $e) + } catch (Exception $e) { $this->error = $e->getMessage(); dol_syslog($this->error, LOG_WARNING); } } } - } - else { + } else { dol_print_error($this->db); } @@ -935,8 +913,7 @@ class Stripe extends CommonObject if ($paymentintent->status == 'succeeded') { $charge->status = 'ok'; - } - else { + } else { $charge->status = 'failed'; $charge->failure_code = $stripe->code; $charge->failure_message = $stripe->error; @@ -945,8 +922,7 @@ class Stripe extends CommonObject $stripefailuremessage = $stripe->error; $stripefailuredeclinecode = $stripe->declinecode; } - } - elseif (preg_match('/acct_/i', $source)) + } elseif (preg_match('/acct_/i', $source)) { $charge = \Stripe\Charge::create(array( "amount" => "$stripeamount", @@ -1029,15 +1005,13 @@ class Stripe extends CommonObject { $charge->status = 'ok'; $charge->id = $paymentintent->id; - } - else { + } else { $charge->status = 'failed'; $charge->failure_code = $stripe->code; $charge->failure_message = $stripe->error; $charge->failure_declinecode = $stripe->declinecode; } - } - else { + } else { $charge = \Stripe\Charge::create($paymentarray, array("idempotency_key" => "$description", "stripe_account" => "$account")); } } @@ -1049,8 +1023,7 @@ class Stripe extends CommonObject if (preg_match('/pm_/i', $source)) { $return->message = 'Payment retreived by card status = '.$charge->status; - } - else { + } else { if ($charge->source->type == 'card') { $return->message = $charge->source->card->brand." ....".$charge->source->card->last4; } elseif ($charge->source->type == 'three_d_secure') { diff --git a/htdocs/stripe/config.php b/htdocs/stripe/config.php index 1efe9a7f386..e6dc75c04ec 100644 --- a/htdocs/stripe/config.php +++ b/htdocs/stripe/config.php @@ -47,8 +47,7 @@ $stripearrayofkeys = array(); if (empty($conf->global->STRIPE_LIVE) || GETPOST('forcesandbox', 'alpha')) { $stripearrayofkeys = $stripearrayofkeysbyenv[0]; // Test -} -else { +} else { $stripearrayofkeys = $stripearrayofkeysbyenv[1]; // Live } diff --git a/htdocs/stripe/payout.php b/htdocs/stripe/payout.php index 741921ac63c..6823c32c0b7 100644 --- a/htdocs/stripe/payout.php +++ b/htdocs/stripe/payout.php @@ -64,8 +64,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $service = 'StripeTest'; $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} -else { +} else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -113,8 +112,7 @@ if (!$rowid) { if ($stripeacc) { $payout = \Stripe\Payout::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); - } - else { + } else { $payout = \Stripe\Payout::all(array("limit" => $limit)); } diff --git a/htdocs/stripe/transaction.php b/htdocs/stripe/transaction.php index eb0ce7df09e..6f74d1a48c0 100644 --- a/htdocs/stripe/transaction.php +++ b/htdocs/stripe/transaction.php @@ -65,8 +65,7 @@ if (!empty($conf->stripe->enabled) && (empty($conf->global->STRIPE_LIVE) || GETP $service = 'StripeTest'; $servicestatus = '0'; dol_htmloutput_mesg($langs->trans('YouAreCurrentlyInSandboxMode', 'Stripe'), '', 'warning'); -} -else { +} else { $service = 'StripeLive'; $servicestatus = '1'; } @@ -112,8 +111,7 @@ if (!$rowid) { if ($stripeacc) { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit), array("stripe_account" => $stripeacc)); - } - else { + } else { $txn = \Stripe\BalanceTransaction::all(array("limit" => $limit)); } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index d911e310d90..dc696dcea90 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -133,15 +133,13 @@ if (empty($reshook)) if (1 == 0 && !GETPOST('clone_content') && !GETPOST('clone_receivers')) { setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors'); - } - else { + } else { if ($object->id > 0) { $result = $object->createFromClone($user, $socid); if ($result > 0) { header("Location: ".$_SERVER['PHP_SELF'].'?id='.$result); exit(); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $action = ''; } @@ -219,9 +217,7 @@ if (empty($reshook)) if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors'); else setEventMessages($langs->trans($object->error), null, 'errors'); } - } - - elseif ($action == 'setdate_livraison' && $user->rights->supplier_proposal->creer) + } elseif ($action == 'setdate_livraison' && $user->rights->supplier_proposal->creer) { $result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['liv_month'], $_POST['liv_day'], $_POST['liv_year'])); if ($result < 0) @@ -439,13 +435,11 @@ if (empty($reshook)) header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id); exit(); - } - else { + } else { $db->rollback(); $action = 'create'; } - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); $db->rollback(); $action = 'create'; @@ -515,9 +509,7 @@ if (empty($reshook)) $ret = $object->fetch($id); // Reload to get new records $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); } - } - - elseif ($action == "setabsolutediscount" && $user->rights->supplier_proposal->creer) { + } elseif ($action == "setabsolutediscount" && $user->rights->supplier_proposal->creer) { if ($_POST["remise_id"]) { if ($object->id > 0) { $result = $object->insert_discount($_POST["remise_id"]); @@ -546,8 +538,7 @@ if (empty($reshook)) $idprod = 0; $price_ht = GETPOST('price_ht'); $tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0); - } - else { + } else { $idprod = GETPOST('idprod', 'int'); $price_ht = ''; $tva_tx = ''; @@ -615,13 +606,11 @@ if (empty($reshook)) { $productsupplier->ref_supplier = ''; } - } - else { + } else { $fksoctosearch = $object->thirdparty->id; $productsupplier->get_buyprice(0, -1, $idprod, 'none', $fksoctosearch); // We force qty to -1 to be sure to find if a supplier price exist } - } - elseif (GETPOST('idprodfournprice', 'alpha') > 0) + } elseif (GETPOST('idprodfournprice', 'alpha') > 0) { //$qtytosearch=$qty; // Just to see if a price exists for the quantity. Not used to found vat. $qtytosearch = -1; // We force qty to -1 to be sure to find if the supplier price that exists @@ -708,8 +697,7 @@ if (empty($reshook)) $langs->load("errors"); setEventMessages($langs->trans("ErrorQtyTooLowForThisSupplier"), null, 'errors'); } - } - elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) // Free product. // $price_ht is already set + } elseif ((GETPOST('price_ht') !== '' || GETPOST('price_ttc') !== '' || GETPOST('multicurrency_price_ht') != '') && empty($error)) // Free product. // $price_ht is already set { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); @@ -730,8 +718,7 @@ if (empty($reshook)) if ($price_ht !== '') { $pu_ht = price2num($price_ht, 'MU'); // $pu_ht must be rounded according to settings - } - else { + } else { $pu_ttc = price2num(GETPOST('price_ttc'), 'MU'); $pu_ht = price2num($pu_ttc / (1 + ($tva_tx / 100)), 'MU'); // $pu_ht must be rounded according to settings } @@ -826,8 +813,7 @@ if (empty($reshook)) unset($_POST['date_endday']); unset($_POST['date_endmonth']); unset($_POST['date_endyear']); - } - else { + } else { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); @@ -1002,9 +988,7 @@ if (empty($reshook)) setEventMessages($object->error, $object->errors, 'errors'); } } - } - - elseif ($action == 'updateline' && $user->rights->supplier_proposal->creer && GETPOST('cancel', 'alpha') == $langs->trans('Cancel')) { + } elseif ($action == 'updateline' && $user->rights->supplier_proposal->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(); } @@ -1022,13 +1006,9 @@ if (empty($reshook)) // Terms of payments elseif ($action == 'setconditions' && $user->rights->supplier_proposal->creer) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - } - - elseif ($action == 'setremisepercent' && $user->rights->supplier_proposal->creer) { + } elseif ($action == 'setremisepercent' && $user->rights->supplier_proposal->creer) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); - } - - elseif ($action == 'setremiseabsolue' && $user->rights->supplier_proposal->creer) { + } elseif ($action == 'setremiseabsolue' && $user->rights->supplier_proposal->creer) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); } @@ -1045,9 +1025,7 @@ if (empty($reshook)) // Multicurrency rate elseif ($action == 'setmulticurrencyrate' && $user->rights->supplier_proposal->creer) { $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); - } - - elseif ($action == 'update_extras') { + } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); // Fill array 'array_options' with data from update form @@ -1129,8 +1107,7 @@ if ($action == 'create') if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code; if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx; } - } - else { + } else { $cond_reglement_id = $soc->cond_reglement_supplier_id; $mode_reglement_id = $soc->mode_reglement_supplier_id; if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code; diff --git a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php index 3fbe3afa021..3eea10bdf13 100644 --- a/htdocs/supplier_proposal/class/api_supplier_proposals.class.php +++ b/htdocs/supplier_proposal/class/api_supplier_proposals.class.php @@ -160,8 +160,7 @@ class Supplierproposals extends DolibarrApi } $i++; } - } - else { + } else { throw new RestException(503, 'Error when retrieving supplier proposal list : '.$db->lasterror()); } if (!count($obj_ret)) { diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 42c30c333d6..907a741c288 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -273,8 +273,7 @@ class SupplierProposal extends CommonObject if ($conf->global->PRODUIT_MULTIPRICES && $this->thirdparty->price_level) { $price = $prod->multiprices[$this->thirdparty->price_level]; - } - else { + } else { $price = $prod->price; } @@ -345,19 +344,16 @@ class SupplierProposal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $supplier_proposalligne->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -2; } @@ -426,8 +422,7 @@ class SupplierProposal extends CommonObject if ($price_base_type == 'HT') { $pu = $pu_ht; - } - else { + } else { $pu = $pu_ttc; } @@ -487,15 +482,13 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::addline result=".$result." - ".$this->error, LOG_ERR); return -1; } - } - else { + } else { $this->error = $prod->error; $this->db->rollback(); return -1; } } - } - else { + } else { $product_type = $type; } @@ -615,20 +608,17 @@ class SupplierProposal extends CommonObject { $this->db->commit(); return $this->line->id; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->line->error; $this->db->rollback(); return -2; } - } - else { + } else { $this->error = 'BadStatusOfObjectToAddLine'; return -5; } @@ -798,14 +788,12 @@ class SupplierProposal extends CommonObject $this->db->commit(); return $result; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -1; } - } - else { + } else { dol_syslog(get_class($this)."::updateline Erreur -2 SupplierProposal en mode incompatible pour cette action"); return -2; } @@ -832,12 +820,10 @@ class SupplierProposal extends CommonObject $this->update_price(1); return 1; - } - else { + } else { return -1; } - } - else { + } else { return -2; } } @@ -1065,14 +1051,12 @@ class SupplierProposal extends CommonObject if ($result < 0) { $error++; } // End call triggers } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } } - } - else { + } else { $this->error = $this->db->lasterror(); $error++; } @@ -1082,13 +1066,11 @@ class SupplierProposal extends CommonObject $this->db->commit(); dol_syslog(get_class($this)."::create done id=".$this->id); return $this->id; - } - else { + } else { $this->db->rollback(); return -2; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -1; @@ -1149,8 +1131,7 @@ class SupplierProposal extends CommonObject } // TODO Change product price if multi-prices - } - else { + } else { $objsoc->fetch($this->socid); } @@ -1198,8 +1179,7 @@ class SupplierProposal extends CommonObject { $this->db->commit(); return $this->id; - } - else { + } else { $this->db->rollback(); return -1; } @@ -1390,8 +1370,7 @@ class SupplierProposal extends CommonObject $i++; } $this->db->free($result); - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1405,8 +1384,7 @@ class SupplierProposal extends CommonObject $this->error = "Record Not Found"; return 0; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1441,8 +1419,7 @@ class SupplierProposal extends CommonObject if (!$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($soc); - } - else { + } else { $num = $this->ref; } $this->newref = dol_sanitizeFileName($num); @@ -1515,13 +1492,11 @@ class SupplierProposal extends CommonObject $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { dol_syslog("You don't have permission to validate supplier proposal", LOG_WARNING); return -2; } @@ -1548,8 +1523,7 @@ class SupplierProposal extends CommonObject { $this->date_livraison = $date_livraison; return 1; - } - else { + } else { $this->error = $this->db->error(); dol_syslog(get_class($this)."::set_date_livraison Erreur SQL"); return -1; @@ -1582,8 +1556,7 @@ class SupplierProposal extends CommonObject $this->remise_percent = $remise; $this->update_price(1); return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1617,8 +1590,7 @@ class SupplierProposal extends CommonObject $this->remise_absolue = $remise; $this->update_price(1); return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -1680,8 +1652,7 @@ class SupplierProposal extends CommonObject } $this->db->rollback(); return -1 * $error; - } - else { + } else { $this->db->commit(); return 1; } @@ -1753,13 +1724,11 @@ class SupplierProposal extends CommonObject { $this->db->commit(); return 1; - } - else { + } else { $this->db->rollback(); return -1; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->errors[] = $this->db->lasterror(); $this->db->rollback(); @@ -1861,8 +1830,7 @@ class SupplierProposal extends CommonObject $values[] = $product->multicurrency_subprice; $values[] = $product->multicurrency_total_ht; $values[] = $multicurrency->rate->rate; - } - else { + } else { for ($i = 0; $i < 5; $i++) $values[] = 'NULL'; } } @@ -1926,8 +1894,7 @@ class SupplierProposal extends CommonObject $this->db->rollback(); return -1; } - } - else { + } else { return -1; } } @@ -1987,12 +1954,10 @@ class SupplierProposal extends CommonObject if ($shortlist == 1) { $ga[$obj->supplier_proposalid] = $obj->ref; - } - elseif ($shortlist == 2) + } elseif ($shortlist == 2) { $ga[$obj->supplier_proposalid] = $obj->ref.' ('.$obj->name.')'; - } - else { + } else { $ga[$i]['id'] = $obj->supplier_proposalid; $ga[$i]['ref'] = $obj->ref; $ga[$i]['name'] = $obj->name; @@ -2002,8 +1967,7 @@ class SupplierProposal extends CommonObject } } return $ga; - } - else { + } else { dol_print_error($this->db); return -1; } @@ -2099,26 +2063,22 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::delete ".$this->id." by ".$user->id, LOG_DEBUG); $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return 0; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -3; } - } - else { + } else { $this->error = $this->db->lasterror(); $this->db->rollback(); return -2; } - } - else { + } else { $this->db->rollback(); return -1; } @@ -2171,8 +2131,7 @@ class SupplierProposal extends CommonObject } } $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2301,8 +2260,7 @@ class SupplierProposal extends CommonObject // if ($mode == 'signed' && ! count($this->FactureListeArray($obj->rowid))) $this->nbtodolate++; } return $response; - } - else { + } else { $this->error = $this->db->lasterror(); return -1; } @@ -2369,8 +2327,7 @@ class SupplierProposal extends CommonObject $line->total_ttc = 59.8; $line->total_tva = 9.8; $line->remise_percent = 50; - } - else { + } else { $line->total_ht = 100; $line->total_ttc = 119.6; $line->total_tva = 19.6; @@ -2428,8 +2385,7 @@ class SupplierProposal extends CommonObject } $this->db->free($resql); return 1; - } - else { + } else { dol_print_error($this->db); $this->error = $this->db->lasterror(); return -1; @@ -2478,13 +2434,11 @@ class SupplierProposal extends CommonObject if ($numref != "") { return $numref; - } - else { + } else { $this->error = $obj->error; return ""; } - } - else { + } else { $langs->load("errors"); print $langs->trans("Error")." ".$langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("SupplierProposal")); return ""; @@ -2654,8 +2608,7 @@ class SupplierProposal extends CommonObject $this->db->free($resql); return 1; - } - else { + } else { $this->error = $this->db->error(); return -1; } @@ -2949,8 +2902,7 @@ class SupplierProposalLine extends CommonObjectLine $this->fk_unit = $objp->fk_unit; $this->db->free($result); - } - else { + } else { dol_print_error($this->db); } } @@ -2995,8 +2947,7 @@ class SupplierProposalLine extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -3082,8 +3033,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -3129,8 +3079,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error()." sql=".$sql; $this->db->rollback(); return -1; @@ -3175,8 +3124,7 @@ class SupplierProposalLine extends CommonObjectLine if (($result = $this->defineBuyPrice($this->subprice, $this->remise_percent, $this->fk_product)) < 0) { return $result; - } - else { + } else { $this->pa_ht = $result; } } @@ -3250,8 +3198,7 @@ class SupplierProposalLine extends CommonObjectLine $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; @@ -3284,8 +3231,7 @@ class SupplierProposalLine extends CommonObjectLine { $this->db->commit(); return 1; - } - else { + } else { $this->error = $this->db->error(); $this->db->rollback(); return -2; diff --git a/htdocs/supplier_proposal/contact.php b/htdocs/supplier_proposal/contact.php index 8f606ad4f67..4bd027299fa 100644 --- a/htdocs/supplier_proposal/contact.php +++ b/htdocs/supplier_proposal/contact.php @@ -65,14 +65,12 @@ if ($action == 'addcontact' && $permissiontoedit) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') { $langs->load("errors"); setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors'); - } - else { + } else { setEventMessages($object->error, $object->errors, 'errors'); } } @@ -84,8 +82,7 @@ elseif ($action == 'swapstatut' && $permissiontoedit) if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); - } - else { + } else { dol_print_error($db); } } @@ -100,8 +97,7 @@ elseif ($action == 'deletecontact' && $permissiontoedit) { header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id); exit; - } - else { + } else { dol_print_error($db); } } @@ -191,8 +187,7 @@ if ($id > 0 || !empty($ref)) // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; - } - else { + } else { // Contact not found print "ErrorRecordNotFound"; } diff --git a/htdocs/supplier_proposal/document.php b/htdocs/supplier_proposal/document.php index 3096e6fbbdb..5b58c7de461 100644 --- a/htdocs/supplier_proposal/document.php +++ b/htdocs/supplier_proposal/document.php @@ -166,8 +166,7 @@ if ($object->id > 0) $permtoedit = $user->rights->supplier_proposal->creer; $param = '&id='.$object->id; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; -} -else { +} else { print $langs->trans("ErrorUnknown"); } diff --git a/htdocs/supplier_proposal/index.php b/htdocs/supplier_proposal/index.php index 7a575007be2..6ba425f323a 100644 --- a/htdocs/supplier_proposal/index.php +++ b/htdocs/supplier_proposal/index.php @@ -162,8 +162,7 @@ if ($resql) print '
'.$langs->trans("Total").''.$total.'

"; -} -else { +} else { dol_print_error($db); } @@ -293,8 +292,7 @@ if ($resql) } } print "

"; -} -else dol_print_error($db); +} else dol_print_error($db); /* @@ -375,15 +373,13 @@ if (!empty($conf->supplier_proposal->enabled) && $user->rights->supplier_proposa if ($num > $nbofloop) { print ''.$langs->trans("XMoreLines", ($num - $nbofloop)).""; - } - elseif ($total > 0) + } elseif ($total > 0) { print ''.$langs->trans("Total").''.price($total)." "; } print "
"; } - } - else { + } else { dol_print_error($db); } } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index eba1db92a94..d0ea3a2b625 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -358,8 +358,7 @@ if ($resql) $soc = new Societe($db); $soc->fetch($socid); $title = $langs->trans('ListOfSupplierProposals').' - '.$soc->name; - } - else { + } else { $title = $langs->trans('ListOfSupplierProposals'); } @@ -949,8 +948,7 @@ if ($resql) $delallowed = $user->rights->supplier_proposal->creer; print $formfile->showdocuments('massfilesarea_supplier_proposal', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); -} -else { +} else { dol_print_error($db); } diff --git a/htdocs/support/inc.php b/htdocs/support/inc.php index 3f09ac541d3..43077495238 100644 --- a/htdocs/support/inc.php +++ b/htdocs/support/inc.php @@ -110,12 +110,10 @@ if (!defined('DONOTLOADCONF') && file_exists($conffile) && filesize($conffile) > $includeconferror = 'ErrorBadValueForDolibarrMainDBType'; } } - } - else { + } else { $includeconferror = 'ErrorBadValueForDolibarrMainDocumentRoot'; } - } - else { + } else { $includeconferror = 'ErrorBadFormatForConfFile'; } } diff --git a/htdocs/takepos/admin/bar.php b/htdocs/takepos/admin/bar.php index a33f337cc96..81eaf319295 100644 --- a/htdocs/takepos/admin/bar.php +++ b/htdocs/takepos/admin/bar.php @@ -52,8 +52,7 @@ if (GETPOST('action', 'alpha') == 'set') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } diff --git a/htdocs/takepos/admin/orderprinters.php b/htdocs/takepos/admin/orderprinters.php index f0410f812d9..a9a4b945d0d 100644 --- a/htdocs/takepos/admin/orderprinters.php +++ b/htdocs/takepos/admin/orderprinters.php @@ -72,15 +72,7 @@ if ($action == "SavePrinter2") { $categstatic = new Categorie($db); $form = new Form($db); -if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; } -elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; } -elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; } -elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; } -elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; } -elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; } -elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; } -elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; } -else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; } +if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; } elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; } elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; } elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; } elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; } elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; } elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; } elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; } else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; } $arrayofjs = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.js', '/includes/jquery/plugins/jquerytreeview/lib/jquery.cookie.js'); $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css'); @@ -146,8 +138,7 @@ if ($nbofentries > 0) if ($row["fk_menu"] == 0) print ''.$row["label"].'
'; } print ''; -} -else { +} else { print ''; print ''; print ''; -} -else { +} else { print ''; print '
'.img_picto_common('', 'treemenu/branchbottom.gif').''; @@ -175,8 +166,7 @@ if ($nbofentries > 0) if ($row["fk_menu"] == 0) print ''.$row["label"].'
'; } print '
'; print '\n"; @@ -119,8 +116,7 @@ if ($conf->receiptprinter->enabled) { if ($conf->global->TAKEPOS_PRINT_METHOD == "receiptprinter") { print img_picto($langs->trans("Activated"), 'switch_on'); - } - else { + } else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "\n"; @@ -135,8 +131,7 @@ print '\n"; @@ -171,8 +166,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; - } - else { + } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); @@ -186,8 +180,7 @@ if ($conf->global->TAKEPOS_PRINT_METHOD == "browser" || $conf->global->TAKEPOS_P if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { print ''; - } - else { + } else { include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $doleditor = new DolEditor($variablename, $conf->global->$variablename, '', 80, 'dolibarr_notes'); print $doleditor->Create(); diff --git a/htdocs/takepos/admin/setup.php b/htdocs/takepos/admin/setup.php index f4e86677a1b..b03ae939fad 100644 --- a/htdocs/takepos/admin/setup.php +++ b/htdocs/takepos/admin/setup.php @@ -96,8 +96,7 @@ if ($action == 'set') if (!$error) { $db->commit(); - } - else { + } else { $db->rollback(); } } elseif ($action == 'updateMask') { @@ -194,8 +193,7 @@ foreach ($dirmodels as $reldir) if ($conf->global->TAKEPOS_REF_ADDON == "$file") { print img_picto($langs->trans("Activated"), 'switch_on'); - } - else { + } else { print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); print ''; diff --git a/htdocs/takepos/admin/terminal.php b/htdocs/takepos/admin/terminal.php index e2996ad763d..db85e96fa01 100644 --- a/htdocs/takepos/admin/terminal.php +++ b/htdocs/takepos/admin/terminal.php @@ -102,8 +102,7 @@ if (GETPOST('action', 'alpha') == 'set') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } @@ -186,8 +185,7 @@ if (!empty($conf->stock->enabled)) print ''; diff --git a/htdocs/takepos/ajax/ajax.php b/htdocs/takepos/ajax/ajax.php index 75c40e6607e..7c4471b0ec8 100644 --- a/htdocs/takepos/ajax/ajax.php +++ b/htdocs/takepos/ajax/ajax.php @@ -64,12 +64,10 @@ if ($action == 'getProducts') { } } echo json_encode($prods); - } - else { + } else { echo 'Failed to load category with id='.$category; } -} -elseif ($action == 'search' && $term != '') { +} elseif ($action == 'search' && $term != '') { // Define $filteroncategids, the filter on category ID if there is a Root category defined. $filteroncategids = ''; if ($conf->global->TAKEPOS_ROOT_CATEGORY_ID > 0) { // A root category is defined, we must filter on products inside this category tree @@ -108,8 +106,7 @@ elseif ($action == 'search' && $term != '') { ); } echo json_encode($rows); - } - else { + } else { echo 'Failed to search product : '.$db->lasterror(); } } elseif ($action == "opendrawer" && $term != '') { diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php index 8a752a5d3a5..f549c0ec7bd 100644 --- a/htdocs/takepos/genimg/index.php +++ b/htdocs/takepos/genimg/index.php @@ -55,8 +55,7 @@ if ($query == "cat") if ($obj['photo_vignette']) { $filename = $obj['photo_vignette']; - } - else { + } else { $filename = $obj['photo']; } $file = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=category&entity='.$object->entity.'&file='.urlencode($pdir.$filename); @@ -64,8 +63,7 @@ if ($query == "cat") exit; } header('Location: ../../public/theme/common/nophoto.png'); -} -elseif ($query == "pro") +} elseif ($query == "pro") { require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; @@ -77,8 +75,7 @@ elseif ($query == "pro") $file = array_pop($match); if ($file == "") header('Location: ../../public/theme/common/nophoto.png'); else header('Location: '.$file.'&cache=1&publictakepos=1&modulepart=product'); -} -else { +} else { // TODO We don't need this. Size of image must be defined on HTML page, image must NOT be resize when downloaded. // The file diff --git a/htdocs/takepos/index.php b/htdocs/takepos/index.php index 94cc526434e..4091e5fff90 100644 --- a/htdocs/takepos/index.php +++ b/htdocs/takepos/index.php @@ -134,8 +134,7 @@ foreach ($categories as $key => $categorycursor) if ($categorycursor['level'] == $levelofmaincategories) { $maincategories[$key] = $categorycursor; - } - else { + } else { $subcategories[$key] = $categorycursor; } } @@ -856,8 +855,7 @@ $r = 0; if (empty($conf->global->TAKEPOS_BAR_RESTAURANT)) { $menus[$r++] = array('title'=>'
'.$langs->trans("New").'
', 'action'=>'New();'); -} -else { +} else { // BAR RESTAURANT specific menu $menus[$r++] = array('title'=>'
'.$langs->trans("Place").'
', 'action'=>'Floors();'); } @@ -951,8 +949,7 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { { echo ''; echo ''; - } - elseif ($i > 12) echo ''; + } elseif ($i > 12) echo ''; else echo ''; } @@ -981,12 +978,10 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { if ($count == ($MAXCATEG - 2)) { //echo ''; echo ''; - } - elseif ($count == ($MAXCATEG - 1)) { + } elseif ($count == ($MAXCATEG - 1)) { //echo ''; echo ''; - } - else { + } else { echo ''; } ?> @@ -1015,12 +1010,10 @@ if (!empty($conf->global->TAKEPOS_HIDE_HEAD_BAR)) { if ($count == ($MAXPRODUCT - 2)) { //echo ''; print ''; - } - elseif ($count == ($MAXPRODUCT - 1)) { + } elseif ($count == ($MAXPRODUCT - 1)) { //echo ''; print ''; - } - else { + } else { print '
'; print ''; } diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php index 274e47a1185..904f2ac7e4c 100644 --- a/htdocs/takepos/invoice.php +++ b/htdocs/takepos/invoice.php @@ -116,8 +116,7 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $ret = $invoice->fetch($invoiceid); -} -else { +} else { $ret = $invoice->fetch('', '(PROV-POS'.$_SESSION["takeposterminal"].'-'.$place.')'); } if ($ret > 0) @@ -186,13 +185,11 @@ if ($action == 'valid' && $user->rights->facture->creer) dol_syslog("Sale already validated"); dol_htmloutput_errors($langs->trans("InvoiceIsAlreadyValidated", "TakePos"), null, 1); } - } - elseif (count($invoice->lines) == 0) + } elseif (count($invoice->lines) == 0) { dol_syslog("Sale without lines"); dol_htmloutput_errors($langs->trans("NoLinesToBill", "TakePos"), null, 1); - } - elseif (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") + } elseif (!empty($conf->stock->enabled) && $conf->global->$constantforkey != "1") { $savconst = $conf->global->STOCK_CALCULATE_ON_BILL; $conf->global->STOCK_CALCULATE_ON_BILL = 1; @@ -207,8 +204,7 @@ if ($action == 'valid' && $user->rights->facture->creer) $res = $invoice->validate($user, '', $conf->global->$constantforkey, 0, $batch_rule); $conf->global->STOCK_CALCULATE_ON_BILL = $savconst; - } - else { + } else { $res = $invoice->validate($user); } @@ -270,8 +266,7 @@ if (($action == "addline" || $action == "freezone") && $placeid == 0) { $langs->load('errors'); dol_htmloutput_errors($langs->trans("ErrorModuleSetupNotComplete", "TakePos"), null, 1); - } - else { + } else { $placeid = $invoice->create($user); if ($placeid < 0) { @@ -375,8 +370,7 @@ if ($action == "deleteline") { if ($idline > 0 and $placeid > 0) { // If invoice exists and line selected. To avoid errors if deleted from another device or no line selected. $invoice->deleteline($idline); $invoice->fetch($placeid); - } - elseif ($placeid > 0) { // If invoice exists but no line selected, proceed to delete last line. + } elseif ($placeid > 0) { // If invoice exists but no line selected, proceed to delete last line. $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet where fk_facture='".$placeid."' order by rowid DESC"; $resql = $db->query($sql); $row = $db->fetch_array($resql); @@ -415,8 +409,7 @@ if ($action == "delete") { if ($resql1 && $resql2 && $resql3) { $db->commit(); - } - else { + } else { $db->rollback(); } @@ -456,8 +449,7 @@ if ($action == "updateprice") if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($pu_ht) * (1 - price2num($line->remise_percent) / 100) < price2num($price_min)))) { echo $langs->trans("CantBeLessThanMinPrice"); - } - else $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + } else $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'TTC', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } } $invoice->fetch($placeid); @@ -481,8 +473,7 @@ if ($action == "updatereduction") if ($usercanproductignorepricemin && (!empty($price_min) && (price2num($line->multicurrency_subprice) * (1 - price2num($number) / 100) < price2num($price_min)))) { echo $langs->trans("CantBeLessThanMinPrice"); - } - else $result = $invoice->updateline($line->id, $line->desc, $line->multicurrency_subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); + } else $result = $invoice->updateline($line->id, $line->desc, $line->multicurrency_subprice, $line->qty, $number, $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, $line->fk_unit); } } $invoice->fetch($placeid); @@ -574,8 +565,7 @@ if ($action == "valid" || $action == "history") if ($remaintopay > 0) { $sectionwithinvoicelink .= $langs->trans('RemainToPay').': '.price($remaintopay, 1, $langs, 1, -1, -1, $conf->currency).''; - } - else { + } else { if ($invoice->paye) $sectionwithinvoicelink .= ''.$langs->trans("Paid").''; else $sectionwithinvoicelink .= $langs->trans('BillShortStatusValidated'); } @@ -806,13 +796,11 @@ $( document ).ready(function() { if ($adh->hasDelay()) { $s .= " ".img_warning($langs->trans("Late")); } - } - else { + } else { $s .= '
'.$langs->trans("SubscriptionNotReceived"); if ($adh->statut > 0) $s .= " ".img_warning($langs->trans("Late")); // displays delay Pictogram only if not a draft and not terminated } - } - else { + } else { $s .= '
'.$langs->trans("ThirdpartyNotLinkedToMember"); } $s .= ''; @@ -958,8 +946,7 @@ if ($placeid > 0) if ($firstline != $line->desc) { $htmlsupplements[$line->fk_parent_line] .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); - } - else { + } else { $htmlsupplements[$line->fk_parent_line] .= $line->desc; } } @@ -1008,8 +995,7 @@ if ($placeid > 0) if ($firstline != $line->desc) { $htmlforlines .= $form->textwithpicto(dolGetFirstLineOfText($line->desc), $line->desc); - } - else { + } else { $htmlforlines .= $line->desc; } } @@ -1036,12 +1022,10 @@ if ($placeid > 0) print $htmlforlines; } - } - else { + } else { print ''; } -} -else { // No invoice generated yet +} else { // No invoice generated yet print ''; } diff --git a/htdocs/takepos/pay.php b/htdocs/takepos/pay.php index f370387d72e..95bb9118b48 100644 --- a/htdocs/takepos/pay.php +++ b/htdocs/takepos/pay.php @@ -51,8 +51,7 @@ $invoice = new Facture($db); if ($invoiceid > 0) { $invoice->fetch($invoiceid); -} -else { +} else { $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS".$_SESSION["takeposterminal"]."-".$place.")'"; $resql = $db->query($sql); $obj = $db->fetch_object($resql); @@ -63,8 +62,7 @@ else { if (!$invoiceid) { $invoiceid = 0; // Invoice does not exist yet - } - else { + } else { $invoice->fetch($invoiceid); } } diff --git a/htdocs/takepos/phone.php b/htdocs/takepos/phone.php index 1cad9a9ede4..427f2e92ab1 100644 --- a/htdocs/takepos/phone.php +++ b/htdocs/takepos/phone.php @@ -41,8 +41,7 @@ if (defined('INCLUDE_PHONEPAGE_FROM_PUBLIC_PAGE')) { // Decode place if it is an order from customer phone $key = GETPOST('key'); $place = dol_decode($key); -} -else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant +} else $place = (GETPOST('place', 'aZ09') ? GETPOST('place', 'aZ09') : 0); // $place is id of table for Ba or Restaurant $action = GETPOST('action', 'alpha'); $setterminal = GETPOST('setterminal', 'int'); $idproduct = GETPOST('idproduct', 'int'); @@ -82,8 +81,7 @@ if ($action == "productinfo") { print "
".price($prod->price_ttc, 1, $langs, 1, -1, -1, $conf->currency).""; print '
'; print ''; -} -elseif ($action == "editline") { +} elseif ($action == "editline") { $placeid = GETPOST('placeid', 'int'); $selectedline = GETPOST('selectedline', 'int'); $invoice = new Facture($db); @@ -104,8 +102,7 @@ elseif ($action == "editline") { print ''; } } -} -else { +} else { ?>
'.img_picto_common('', 'treemenu/branchbottom.gif').''; diff --git a/htdocs/takepos/admin/receipt.php b/htdocs/takepos/admin/receipt.php index 7ed4f2786b2..44fdf5c89f7 100644 --- a/htdocs/takepos/admin/receipt.php +++ b/htdocs/takepos/admin/receipt.php @@ -57,13 +57,11 @@ if (GETPOST('action', 'alpha') == 'set') { $db->commit(); setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); - } - else { + } else { $db->rollback(); setEventMessages($langs->trans("Error"), null, 'errors'); } -} -elseif (GETPOST('action', 'alpha') == 'setmethod') +} elseif (GETPOST('action', 'alpha') == 'setmethod') { dolibarr_set_const($db, "TAKEPOS_PRINT_METHOD", GETPOST('value', 'alpha'), 'chaine', 0, '', $conf->entity); } @@ -103,8 +101,7 @@ print ''; if ($conf->global->TAKEPOS_PRINT_METHOD == "browser") { print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'; if ($conf->global->TAKEPOS_PRINT_METHOD == "takeposconnector") { print img_picto($langs->trans("Activated"), 'switch_on'); -} -else { +} else { print ''.img_picto($langs->trans("Disabled"), 'switch_off').''; } print "
'; if (empty($conf->productbatch->enabled) || !empty($conf->global->CASHDESK_FORCE_DECREASE_STOCK)) { print $form->selectyesno('CASHDESK_NO_DECREASE_STOCK'.$terminal, $conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}, 1); - } - else { + } else { if (!$conf->global->{'CASHDESK_NO_DECREASE_STOCK'.$terminal}) { $res = dolibarr_set_const($db, "CASHDESK_NO_DECREASE_STOCK".$terminal, 1, 'chaine', 0, '', $conf->entity); } @@ -205,8 +203,7 @@ if (!empty($conf->stock->enabled)) { print $formproduct->selectWarehouses($conf->global->{'CASHDESK_ID_WAREHOUSE'.$terminal}, 'CASHDESK_ID_WAREHOUSE'.$terminal, '', 1, $disabled); print ' '; - } - else { + } else { print ''.$langs->trans("StockDecreaseForPointOfSaleDisabled").''; } print '
'.$langs->trans("Empty").'
'.$langs->trans("Empty").'