diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 21186cfbe5c..e99b8673981 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -215,7 +215,7 @@ - + diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 754d01e3b78..bf0ad592e8e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -215,8 +215,8 @@ if (empty($reshook)) { } } } - } // Delete proposal - elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { + } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { + // Delete proposal $result = $object->delete($user); if ($result > 0) { header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'); @@ -225,8 +225,8 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); } - } // Remove line - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + // Remove line $result = $object->deleteline($lineid); // reorder lines if ($result) { @@ -250,8 +250,8 @@ if (empty($reshook)) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); - } // Validation - elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { + } elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { + // Validation $idwarehouse = GETPOST('idwarehouse', 'int'); $result = $object->valid($user); if ($result >= 0) { @@ -308,17 +308,17 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } - } // Positionne ref client - elseif ($action == 'setref_client' && $usercancreate) { + } elseif ($action == 'setref_client' && $usercancreate) { + // Positionne ref client $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } // Set incoterm - elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) { + } elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) { + // Set incoterm $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); - } // Create proposal - elseif ($action == 'add' && $usercancreate) { + } elseif ($action == 'add' && $usercancreate) { + // Create proposal $object->socid = $socid; $object->fetch_thirdparty(); @@ -554,8 +554,8 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } // Standard creation - else { + } else { + // Standard creation $id = $object->create($user); } @@ -616,8 +616,8 @@ if (empty($reshook)) { } } } - } // Classify billed - elseif ($action == 'classifybilled' && $usercanclose) { + } elseif ($action == 'classifybilled' && $usercanclose) { + // Classify billed $db->begin(); $result = $object->cloture($user, $object::STATUS_BILLED, ''); @@ -631,8 +631,8 @@ if (empty($reshook)) { } else { $db->rollback(); } - } // Close proposal - elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) { + // Close proposal if (!(GETPOST('statut', 'int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors'); $action = 'closeas'; @@ -654,8 +654,8 @@ if (empty($reshook)) { } } } - } // Reopen proposal - elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { + // Reopen proposal // prevent browser refresh from reopening proposal several times if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); @@ -672,11 +672,11 @@ if (empty($reshook)) { $db->rollback(); } } - } // add lines from objectlinked - elseif ($action == 'import_lines_from_object' + } elseif ($action == 'import_lines_from_object' && $user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT ) { + // add lines from objectlinked $fromElement = GETPOST('fromelement'); $fromElementid = GETPOST('fromelementid'); $importLines = GETPOST('line_checkbox'); @@ -898,8 +898,8 @@ if (empty($reshook)) { $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } } - } // If price per customer - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + // If price per customer require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); @@ -924,8 +924,8 @@ if (empty($reshook)) { } } } - } // If price per quantity - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + // If price per quantity if ($prod->prices_by_qty[0]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = GETPOST('pbq', 'int'); @@ -945,8 +945,8 @@ if (empty($reshook)) { break; } } - } // If price per quantity and customer - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + // If price per quantity and customer if ($prod->prices_by_qty[$object->thirdparty->price_level]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = GETPOST('pbq', 'int'); @@ -975,9 +975,9 @@ if (empty($reshook)) { if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tmpvat != $tmpprodvat) { + } elseif ($tmpvat != $tmpprodvat) { + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { @@ -1167,8 +1167,8 @@ if (empty($reshook)) { } } } - } // Update a line within proposal - elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { + } elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { + // Update a line within proposal // Define info_bits $info_bits = 0; if (preg_match('/\*/', GETPOST('tva_tx'))) { @@ -1313,36 +1313,36 @@ if (empty($reshook)) { } elseif ($action == 'classin' && $usercancreate) { // Set project $object->setProject(GETPOST('projectid', 'int')); - } // Delivery time - elseif ($action == 'setavailability' && $usercancreate) { + } elseif ($action == 'setavailability' && $usercancreate) { + // Delivery time $result = $object->set_availability($user, GETPOST('availability_id', 'int')); - } // Origin of the commercial proposal - elseif ($action == 'setdemandreason' && $usercancreate) { + } elseif ($action == 'setdemandreason' && $usercancreate) { + // Origin of the commercial proposal $result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int')); - } // Terms of payment - elseif ($action == 'setconditions' && $usercancreate) { + } elseif ($action == 'setconditions' && $usercancreate) { + // Terms of payment $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); - } // Payment choice - elseif ($action == 'setmode' && $usercancreate) { + } elseif ($action == 'setmode' && $usercancreate) { + // Payment choice $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); - } // Multicurrency Code - elseif ($action == 'setmulticurrencycode' && $usercancreate) { + } elseif ($action == 'setmulticurrencycode' && $usercancreate) { + // Multicurrency Code $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); - } // Multicurrency rate - elseif ($action == 'setmulticurrencyrate' && $usercancreate) { + } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { + // Multicurrency rate $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); - } // bank account - elseif ($action == 'setbankaccount' && $usercancreate) { + } elseif ($action == 'setbankaccount' && $usercancreate) { + // bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } // shipping method - elseif ($action == 'setshippingmethod' && $usercancreate) { + } elseif ($action == 'setshippingmethod' && $usercancreate) { + // shipping method $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); - }// warehouse - elseif ($action == 'setwarehouse' && $usercancreate) { + } elseif ($action == 'setwarehouse' && $usercancreate) { + // warehouse $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -1383,15 +1383,15 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } // Toggle the status of a contact - elseif ($action == 'swapstatut') { + } elseif ($action == 'swapstatut') { + // Toggle the status of a contact if ($object->fetch($id) > 0) { $result = $object->swapContactStatus(GETPOST('ligne')); } else { dol_print_error($db); } - } // Delete a contact - elseif ($action == 'deletecontact') { + } elseif ($action == 'deletecontact') { + // Delete a contact $object->fetch($id); $result = $object->delete_contact($lineid); @@ -1907,17 +1907,17 @@ if ($action == 'create') { } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); - } // Confirm delete - elseif ($action == 'delete') { + } elseif ($action == 'delete') { + // Confirm delete $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); - } // Confirm reopen - elseif ($action == 'reopen') { + } elseif ($action == 'reopen') { + // Confirm reopen $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1); - } // Confirmation delete product/service line - elseif ($action == 'ask_deleteline') { + } elseif ($action == 'ask_deleteline') { + // Confirmation delete product/service line $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); - } // Confirm validate proposal - elseif ($action == 'validate') { + } elseif ($action == 'validate') { + // Confirm validate proposal $error = 0; // We verify whether the object is provisionally numbering diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 553362687b6..af77b56bc15 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1651,7 +1651,8 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -1891,7 +1892,8 @@ class Propal extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->error = $this->db->lasterror(); + $error++; + $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments @@ -2457,7 +2459,8 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::reopen", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { if (!$notrigger) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index c75589c1aa0..950d7438f07 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -222,7 +222,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 326299448f7..e18891f3c60 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -123,7 +123,8 @@ $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { $px1->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -158,7 +159,8 @@ $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); if (!$mesg) { $px2->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -202,7 +204,8 @@ $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { $px3->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 929a7a483bb..4f433a28ac4 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -186,7 +186,8 @@ if ($id > 0 || !empty($ref)) { $permission = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id.'&num='.urlencode($numref); - $moreparam = '&num='.urlencode($numref); ; + $moreparam = '&num='.urlencode($numref); + ; $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/"; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 390972912c1..6ec8fed517f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -182,7 +182,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -1188,8 +1189,8 @@ if ($resql) { // If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') { $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 { + // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show $balance = $objforbalance->previoustotal; } } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index dda8f13437d..d3ffbb37916 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -72,7 +72,9 @@ $sql .= " ORDER BY c.label"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; $total = 0; $totalnb = 0; + $i = 0; + $total = 0; + $totalnb = 0; while ($i < $num) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 48976f8ba25..fb9fead3089 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -126,7 +126,8 @@ $sql .= " ORDER BY rowid"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; $total = 0; + $i = 0; + $total = 0; while ($i < $num) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index c2dd1c316a6..6dd588f51e1 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -795,13 +795,17 @@ print ''; // Graphs if ($mode == 'standard') { - $prevyear = $year; $nextyear = $year; - $prevmonth = $month - 1; $nextmonth = $month + 1; + $prevyear = $year; + $nextyear = $year; + $prevmonth = $month - 1; + $nextmonth = $month + 1; if ($prevmonth < 1) { - $prevmonth = 12; $prevyear--; + $prevmonth = 12; + $prevyear--; } if ($nextmonth > 12) { - $nextmonth = 1; $nextyear++; + $nextmonth = 1; + $nextyear++; } // For month @@ -818,7 +822,8 @@ if ($mode == 'standard') { print ''; // For year - $prevyear = $year - 1; $nextyear = $year + 1; + $prevyear = $year - 1; + $nextyear = $year + 1; $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"').""; print '
'.$link.'
'; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 1f22b67ac7c..caca78033d6 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -272,7 +272,8 @@ $sql .= " WHERE rowid=".$rowid; $sql .= " ORDER BY dateo ASC"; $result = $db->query($sql); if ($result) { - $i = 0; $total = 0; + $i = 0; + $total = 0; if ($db->num_rows($result)) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 6c2e595e3d1..2882a4635fd 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -134,7 +134,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -490,7 +491,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; -$totalarray = array(); $found = 0; $i = 0; $lastcurrencycode = ''; +$totalarray = array(); +$found = 0; +$i = 0; +$lastcurrencycode = ''; foreach ($accounts as $key => $type) { if ($i >= $limit) { diff --git a/htdocs/compta/cashcontrol/cashcontrol_card.php b/htdocs/compta/cashcontrol/cashcontrol_card.php index d4bec1929ee..da018dd1f06 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_card.php +++ b/htdocs/compta/cashcontrol/cashcontrol_card.php @@ -413,9 +413,11 @@ if ($action == "create" || $action == "start" || $action == 'close') { for ($i = 1; $i <= $numterminals; $i++) { $array[$i] = $i; } - $selectedposnumber = 0; $showempty = 1; + $selectedposnumber = 0; + $showempty = 1; if ($conf->global->TAKEPOS_NUM_TERMINALS == '1') { - $selectedposnumber = 1; $showempty = 0; + $selectedposnumber = 1; + $showempty = 0; } print $form->selectarray('posnumber', $array, GETPOSTISSET('posnumber') ?GETPOST('posnumber', 'int') : $selectedposnumber, $showempty); //print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index a301caff80f..6c4141e4b6a 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -140,7 +140,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; diff --git a/htdocs/compta/cashcontrol/report.php b/htdocs/compta/cashcontrol/report.php index 8f85f5779a0..f6c58aa858c 100644 --- a/htdocs/compta/cashcontrol/report.php +++ b/htdocs/compta/cashcontrol/report.php @@ -233,10 +233,9 @@ if ($resql) { } else { if ($conf->global->$var1 == $bankaccount->id) { $cash += $objp->amount; - } - //elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount; - //elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount; - else { + // } elseif ($conf->global->$var2 == $bankaccount->id) $bank+=$objp->amount; + //elseif ($conf->global->$var3 == $bankaccount->id) $cheque+=$objp->amount; + } else { $other += $objp->amount; } } diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index 7ca8a2d591e..1d294df8cff 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -134,8 +134,8 @@ if ($action == 'validate' && $user->rights->deplacement->creer) { header("Location: index.php"); exit; } -} // Update record -elseif ($action == 'update' && $user->rights->deplacement->creer) { +} elseif ($action == 'update' && $user->rights->deplacement->creer) { + // Update record if (!GETPOST('cancel', 'alpha')) { $result = $object->fetch($id); @@ -159,15 +159,15 @@ elseif ($action == 'update' && $user->rights->deplacement->creer) { header("Location: ".$_SERVER["PHP_SELF"]."?id=".$id); exit; } -} // Set into a project -elseif ($action == 'classin' && $user->rights->deplacement->creer) { +} elseif ($action == 'classin' && $user->rights->deplacement->creer) { + // Set into a project $object->fetch($id); $result = $object->setProject(GETPOST('projectid', 'int')); if ($result < 0) { dol_print_error($db, $object->error); } -} // Set fields -elseif ($action == 'setdated' && $user->rights->deplacement->creer) { +} elseif ($action == 'setdated' && $user->rights->deplacement->creer) { + // Set fields $dated = dol_mktime(GETPOST('datedhour', 'int'), GETPOST('datedmin', 'int'), GETPOST('datedsec', 'int'), GETPOST('datedmonth', 'int'), GETPOST('datedday', 'int'), GETPOST('datedyear', 'int')); $object->fetch($id); $result = $object->setValueFrom('dated', $dated, '', '', 'date', '', $user, 'DEPLACEMENT_MODIFY'); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 4786e2ea1b5..892b2b86dff 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -110,7 +110,8 @@ $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { $px1->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -140,7 +141,8 @@ $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); if (!$mesg) { $px2->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -184,7 +186,8 @@ $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { $px3->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php index 988dea7e45e..ee5cd3e00f9 100644 --- a/htdocs/compta/facture/card-rec.php +++ b/htdocs/compta/facture/card-rec.php @@ -133,7 +133,8 @@ $error = 0; */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -279,14 +280,14 @@ if (empty($reshook)) { // Set condition if ($action == 'setconditions' && $user->rights->facture->creer) { $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); - } // Set mode - elseif ($action == 'setmode' && $user->rights->facture->creer) { + } elseif ($action == 'setmode' && $user->rights->facture->creer) { + // Set mode $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); - } // Set project - elseif ($action == 'classin' && $user->rights->facture->creer) { + } elseif ($action == 'classin' && $user->rights->facture->creer) { + // Set project $object->setProject(GETPOST('projectid', 'int')); - } // Set bank account - elseif ($action == 'setref' && $user->rights->facture->creer) { + } elseif ($action == 'setref' && $user->rights->facture->creer) { + // Set bank account //var_dump(GETPOST('ref', 'alpha'));exit; $result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY'); if ($result > 0) { @@ -302,32 +303,32 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } // Set bank account - elseif ($action == 'setbankaccount' && $user->rights->facture->creer) { + } elseif ($action == 'setbankaccount' && $user->rights->facture->creer) { + // Set bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } // Set frequency and unit frequency - elseif ($action == 'setfrequency' && $user->rights->facture->creer) { + } elseif ($action == 'setfrequency' && $user->rights->facture->creer) { + // Set frequency and unit frequency $object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha')); - } // Set next date of execution - elseif ($action == 'setdate_when' && $user->rights->facture->creer) { + } elseif ($action == 'setdate_when' && $user->rights->facture->creer) { + // Set next date of execution $date = dol_mktime(GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0, GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')); if (!empty($date)) { $object->setNextDate($date); } - } // Set max period - elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) { + } elseif ($action == 'setnb_gen_max' && $user->rights->facture->creer) { + // Set max period $object->setMaxPeriod(GETPOST('nb_gen_max', 'int')); - } // Set auto validate - elseif ($action == 'setauto_validate' && $user->rights->facture->creer) { + } elseif ($action == 'setauto_validate' && $user->rights->facture->creer) { + // Set auto validate $object->setAutoValidate(GETPOST('auto_validate', 'int')); - } // Set generate pdf - elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) { + } elseif ($action == 'setgenerate_pdf' && $user->rights->facture->creer) { + // Set generate pdf $object->setGeneratepdf(GETPOST('generate_pdf', 'int')); - } // Set model pdf - elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) { + } elseif ($action == 'setmodelpdf' && $user->rights->facture->creer) { + // Set model pdf $object->setModelpdf(GETPOST('modelpdf', 'alpha')); - } // Set status disabled - elseif ($action == 'disable' && $user->rights->facture->creer) { + } elseif ($action == 'disable' && $user->rights->facture->creer) { + // Set status disabled $db->begin(); $object->fetch($id); @@ -343,8 +344,8 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } // Set status enabled - elseif ($action == 'enable' && $user->rights->facture->creer) { + } elseif ($action == 'enable' && $user->rights->facture->creer) { + // Set status enabled $db->begin(); $object->fetch($id); @@ -360,11 +361,11 @@ if (empty($reshook)) { $db->rollback(); setEventMessages($object->error, $object->errors, 'errors'); } - } // Multicurrency Code - elseif ($action == 'setmulticurrencycode' && $usercancreate) { + } elseif ($action == 'setmulticurrencycode' && $usercancreate) { + // Multicurrency Code $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); - } // Multicurrency rate - elseif ($action == 'setmulticurrencyrate' && $usercancreate) { + } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { + // Multicurrency rate $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } @@ -525,9 +526,9 @@ if (empty($reshook)) { if (!empty($price_ht)) { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tmpvat != $tmpprodvat) { + } elseif ($tmpvat != $tmpprodvat) { + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index ba4e4e8e8d1..3598b678711 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -233,8 +233,8 @@ if (empty($reshook)) { $action = ''; } } - } // Delete line - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + // Delete line $object->fetch($id); $object->fetch_thirdparty(); @@ -563,8 +563,8 @@ if (empty($reshook)) { } elseif ($action == 'setref_client' && $usercancreate) { $object->fetch($id); $object->set_ref_client(GETPOST('ref_client')); - } // Classify to validated - elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) { + } elseif ($action == 'confirm_valid' && $confirm == 'yes' && $usercanvalidate) { + // Classify to validated $idwarehouse = GETPOST('idwarehouse', 'int'); $object->fetch($id); @@ -2770,15 +2770,15 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } // bascule du statut d'un contact - elseif ($action == 'swapstatut') { + } elseif ($action == 'swapstatut') { + // bascule du statut d'un contact if ($object->fetch($id)) { $result = $object->swapContactStatus(GETPOST('ligne')); } else { dol_print_error($db); } - } // Efface un contact - elseif ($action == 'deletecontact') { + } elseif ($action == 'deletecontact') { + // Efface un contact $object->fetch($id); $result = $object->delete_contact($lineid); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 983e42f5ff5..4a6d767f6c6 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1972,7 +1972,8 @@ class Facture extends CommonInvoice dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -2807,7 +2808,8 @@ class Facture extends CommonInvoice $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'facture/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->error = $this->db->lasterror(); + $error++; + $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 4795a9b2062..d9c0fa36c9a 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -145,7 +145,8 @@ class PaymentTerm // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -317,7 +318,8 @@ class PaymentTerm // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -355,7 +357,8 @@ class PaymentTerm // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index d45439286fb..e419ed9260b 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -170,7 +170,8 @@ if ($socid > 0) { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 9f5281dc20b..8f3a54fe4ba 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -248,7 +248,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php index b6cf7ec5c06..719c92ca6f0 100644 --- a/htdocs/compta/facture/prelevement.php +++ b/htdocs/compta/facture/prelevement.php @@ -576,7 +576,9 @@ if ($object->id > 0) { print dol_get_fiche_end(); - $numopen = 0; $pending = 0; $numclosed = 0; + $numopen = 0; + $pending = 0; + $numclosed = 0; // How many Direct debit opened requests ? diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 536beff168d..2818fa5f3b9 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -133,7 +133,8 @@ $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { $px1->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -168,7 +169,8 @@ $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); if (!$mesg) { $px2->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -212,7 +214,8 @@ $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { $px3->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; diff --git a/htdocs/compta/journal/sellsjournal.php b/htdocs/compta/journal/sellsjournal.php index 39faf295c45..46c56f3dca5 100644 --- a/htdocs/compta/journal/sellsjournal.php +++ b/htdocs/compta/journal/sellsjournal.php @@ -88,7 +88,8 @@ $date_start = dol_mktime(0, 0, 0, $date_startmonth, $date_startday, $date_starty $date_end = dol_mktime(23, 59, 59, $date_endmonth, $date_endday, $date_endyear); if (empty($date_start) || empty($date_end)) { // We define date_start and date_end - $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); + $date_start = dol_get_first_day($pastmonthyear, $pastmonth, false); + $date_end = dol_get_last_day($pastmonthyear, $pastmonth, false); } $name = $langs->trans("SellsJournal"); diff --git a/htdocs/compta/localtax/clients.php b/htdocs/compta/localtax/clients.php index 603e8564927..72155845b0c 100644 --- a/htdocs/compta/localtax/clients.php +++ b/htdocs/compta/localtax/clients.php @@ -51,7 +51,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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) { @@ -64,16 +65,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } @@ -206,7 +211,8 @@ if ($calc == 0 || $calc == 2) { $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (is_array($coll_list)) { - $total = 0; $totalamount = 0; + $total = 0; + $totalamount = 0; $i = 1; foreach ($coll_list as $coll) { if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) { @@ -270,7 +276,8 @@ if ($calc == 0 || $calc == 1) { $reshook = $hookmanager->executeHooks('addVatLine', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if (is_array($coll_list)) { - $total = 0; $totalamount = 0; + $total = 0; + $totalamount = 0; $i = 1; foreach ($coll_list as $coll) { if (($min == 0 || ($min > 0 && $coll->amount > $min)) && ($local == 1 ? $coll->localtax1 : $coll->localtax2) != 0) { diff --git a/htdocs/compta/localtax/index.php b/htdocs/compta/localtax/index.php index 051a98a4b3b..86fa3fe52f0 100644 --- a/htdocs/compta/localtax/index.php +++ b/htdocs/compta/localtax/index.php @@ -50,23 +50,28 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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 { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } @@ -286,8 +291,12 @@ $tmp = dol_getdate($date_end); $yend = $tmp['year']; $mend = $tmp['mon']; -$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0; -$i = 0; $mcursor = 0; +$total = 0; +$subtotalcoll = 0; +$subtotalpaye = 0; +$subtotal = 0; +$i = 0; +$mcursor = 0; while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop //$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12); if ($m == 13) { @@ -537,7 +546,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ print " \n"; print "\n"; - $i++; $m++; + $i++; + $m++; if ($i > 2) { print ''; print ''.$langs->trans("SubTotal").':'; @@ -546,7 +556,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ print ''.price(price2num($subtotal, 'MT')).''; print ' '; $i = 0; - $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0; + $subtotalcoll = 0; + $subtotalpaye = 0; + $subtotal = 0; } } print ''.$langs->trans("TotalToPay").':'.price(price2num($total, 'MT')).''; diff --git a/htdocs/compta/localtax/quadri_detail.php b/htdocs/compta/localtax/quadri_detail.php index aec90544e09..a2904c861f4 100644 --- a/htdocs/compta/localtax/quadri_detail.php +++ b/htdocs/compta/localtax/quadri_detail.php @@ -61,7 +61,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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) { @@ -74,16 +75,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 0fcbf6a914a..7f03f4a569c 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -559,12 +559,14 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie $alreadypayedlabel = $langs->trans('Received'); $multicurrencyalreadypayedlabel = $langs->trans('MulticurrencyReceived'); if ($facture->type == 2) { - $alreadypayedlabel = $langs->trans("PaidBack"); $multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack"); + $alreadypayedlabel = $langs->trans("PaidBack"); + $multicurrencyalreadypayedlabel = $langs->trans("MulticurrencyPaidBack"); } $remaindertopay = $langs->trans('RemainderToTake'); $multicurrencyremaindertopay = $langs->trans('MulticurrencyRemainderToTake'); if ($facture->type == 2) { - $remaindertopay = $langs->trans("RemainderToPayBack"); $multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack"); + $remaindertopay = $langs->trans("RemainderToPayBack"); + $multicurrencyremaindertopay = $langs->trans("MulticurrencyRemainderToPayBack"); } $i = 0; diff --git a/htdocs/compta/paiement/cheque/card.php b/htdocs/compta/paiement/cheque/card.php index c8e6691afc6..e941f532efa 100644 --- a/htdocs/compta/paiement/cheque/card.php +++ b/htdocs/compta/paiement/cheque/card.php @@ -235,8 +235,8 @@ if ($action == 'builddoc' && $user->rights->banque->cheque) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG) ? '' : '#builddoc')); exit; } -} // Remove file in doc form -elseif ($action == 'remove_file' && $user->rights->banque->cheque) { +} elseif ($action == 'remove_file' && $user->rights->banque->cheque) { + // Remove file in doc form if ($object->fetch($id) > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index 7db9ff922d9..06d13e78023 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -335,9 +335,8 @@ class Paiement extends CommonObject 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 ($mustwait) dol_syslog("There is ".$mustwait." differed payment to process, we do nothing more."); + } else { // If invoice is a down payment, we also convert down payment to discount if ($invoice->type == Facture::TYPE_DEPOSIT) { $amount_ht = $amount_tva = $amount_ttc = array(); diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index d9073488567..9c700f509f9 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -111,19 +111,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } 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); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 3c1d6d3fb0d..228269d135e 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -79,19 +79,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } 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); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } diff --git a/htdocs/compta/resultat/result.php b/htdocs/compta/resultat/result.php index 75d73eeca31..df3a82a4b7f 100644 --- a/htdocs/compta/resultat/result.php +++ b/htdocs/compta/resultat/result.php @@ -91,19 +91,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } 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); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 3c2b26a83d8..18c8e9aa59d 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -612,7 +612,8 @@ if ($id > 0) { $totalpaye = 0; $num = $db->num_rows($resql); - $i = 0; $total = 0; + $i = 0; + $total = 0; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index f718a9a48b7..91a0708c361 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -356,7 +356,8 @@ class ChargeSociales extends CommonObject $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { diff --git a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php index 4fda644e1c0..bb9a48b4c4c 100644 --- a/htdocs/compta/sociales/class/paymentsocialcontribution.class.php +++ b/htdocs/compta/sociales/class/paymentsocialcontribution.class.php @@ -369,7 +369,8 @@ class PaymentSocialContribution extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -420,7 +421,8 @@ class PaymentSocialContribution extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } } diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php index 1f4de217bac..e2047d00738 100644 --- a/htdocs/compta/stats/byratecountry.php +++ b/htdocs/compta/stats/byratecountry.php @@ -74,19 +74,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $date_start = dol_get_first_day($year_start, $month_start, false); + $date_end = dol_get_last_day($year_end, $month_end, false); } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } @@ -175,17 +180,21 @@ if ($modetax == 2) { $calcmode .= '
('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); -$prevyear = $year_start; $prevquarter = $q; +$prevyear = $year_start; +$prevquarter = $q; if ($prevquarter > 1) { $prevquarter--; } else { - $prevquarter = 4; $prevyear--; + $prevquarter = 4; + $prevyear--; } -$nextyear = $year_start; $nextquarter = $q; +$nextyear = $year_start; +$nextquarter = $q; if ($nextquarter < 4) { $nextquarter++; } else { - $nextquarter = 1; $nextyear++; + $nextquarter = 1; + $nextyear++; } $description .= $fsearch; $builddate = dol_now(); diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index eb678900112..c6c0e8e0816 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -119,19 +119,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $date_start = dol_get_first_day($year_start, $month_start, false); + $date_end = dol_get_last_day($year_end, $month_end, false); } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } else { diff --git a/htdocs/compta/stats/cabyuser.php b/htdocs/compta/stats/cabyuser.php index 494786bd8a2..62e6fb3135d 100644 --- a/htdocs/compta/stats/cabyuser.php +++ b/htdocs/compta/stats/cabyuser.php @@ -100,19 +100,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } else { // TODO We define q diff --git a/htdocs/compta/stats/casoc.php b/htdocs/compta/stats/casoc.php index 829e196a82e..c8c13ca8b27 100644 --- a/htdocs/compta/stats/casoc.php +++ b/htdocs/compta/stats/casoc.php @@ -120,19 +120,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } else { // TODO We define q diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php index eb039a63f92..083230da668 100644 --- a/htdocs/compta/stats/index.php +++ b/htdocs/compta/stats/index.php @@ -73,19 +73,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } 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); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } diff --git a/htdocs/compta/stats/supplier_turnover.php b/htdocs/compta/stats/supplier_turnover.php index a6adf2a2440..b199dcbeb9c 100644 --- a/htdocs/compta/stats/supplier_turnover.php +++ b/htdocs/compta/stats/supplier_turnover.php @@ -69,19 +69,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } 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); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } diff --git a/htdocs/compta/stats/supplier_turnover_by_prodserv.php b/htdocs/compta/stats/supplier_turnover_by_prodserv.php index 553bd62899e..bdf4e5e0f85 100644 --- a/htdocs/compta/stats/supplier_turnover_by_prodserv.php +++ b/htdocs/compta/stats/supplier_turnover_by_prodserv.php @@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $date_start = dol_get_first_day($year_start, $month_start, false); + $date_end = dol_get_last_day($year_end, $month_end, false); } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } else { diff --git a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php index 0e653d542f6..fbfb0994e4a 100644 --- a/htdocs/compta/stats/supplier_turnover_by_thirdparty.php +++ b/htdocs/compta/stats/supplier_turnover_by_thirdparty.php @@ -114,19 +114,24 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $year_end++; } } - $date_start = dol_get_first_day($year_start, $month_start, false); $date_end = dol_get_last_day($year_end, $month_end, false); + $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); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } else { // TODO We define q diff --git a/htdocs/compta/tva/card.php b/htdocs/compta/tva/card.php index 87805ebf947..4421178a507 100644 --- a/htdocs/compta/tva/card.php +++ b/htdocs/compta/tva/card.php @@ -630,7 +630,8 @@ if ($id) { $totalpaye = 0; $num = $db->num_rows($resql); - $i = 0; $total = 0; + $i = 0; + $total = 0; print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print '
'; diff --git a/htdocs/compta/tva/class/paymentvat.class.php b/htdocs/compta/tva/class/paymentvat.class.php index ff1c8b46040..4f816164db0 100644 --- a/htdocs/compta/tva/class/paymentvat.class.php +++ b/htdocs/compta/tva/class/paymentvat.class.php @@ -372,7 +372,8 @@ class PaymentVAT extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -423,7 +424,8 @@ class PaymentVAT extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } } diff --git a/htdocs/compta/tva/clients.php b/htdocs/compta/tva/clients.php index e0801ba1db2..7ec5ad5b4f1 100644 --- a/htdocs/compta/tva/clients.php +++ b/htdocs/compta/tva/clients.php @@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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'); @@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index c831d5fe61c..2602d00a216 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -59,7 +59,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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'); @@ -83,16 +84,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } @@ -301,8 +306,12 @@ $tmp = dol_getdate($date_end); $yend = $tmp['year']; $mend = $tmp['mon']; //var_dump($m); -$total = 0; $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0; -$i = 0; $mcursor = 0; +$total = 0; +$subtotalcoll = 0; +$subtotalpaye = 0; +$subtotal = 0; +$i = 0; +$mcursor = 0; while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $mcursor is to avoid too large loop //$m = $conf->global->SOCIETE_FISCAL_MONTH_START + ($mcursor % 12); @@ -535,7 +544,8 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ print "\n"; print "\n"; - $i++; $m++; + $i++; + $m++; if ($i > 2) { print ''; print ''; @@ -544,7 +554,9 @@ while ((($y < $yend) || ($y == $yend && $m <= $mend)) && $mcursor < 1000) { // $ print ''; print ''; $i = 0; - $subtotalcoll = 0; $subtotalpaye = 0; $subtotal = 0; + $subtotalcoll = 0; + $subtotalpaye = 0; + $subtotal = 0; } } print ''; diff --git a/htdocs/compta/tva/quadri_detail.php b/htdocs/compta/tva/quadri_detail.php index 04f90ba02f9..788067ec696 100644 --- a/htdocs/compta/tva/quadri_detail.php +++ b/htdocs/compta/tva/quadri_detail.php @@ -66,7 +66,8 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e $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); + $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'); @@ -90,16 +91,20 @@ if (empty($date_start) || empty($date_end)) { // We define date_start and date_e } } else { if ($q == 1) { - $date_start = dol_get_first_day($year_start, 1, false); $date_end = dol_get_last_day($year_start, 3, false); + $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); + $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); + $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); + $date_start = dol_get_first_day($year_start, 10, false); + $date_end = dol_get_last_day($year_start, 12, false); } } } @@ -179,7 +184,8 @@ if ($modetax == 2) { $calcmode .= ' ('.$langs->trans("TaxModuleSetupToModifyRules", DOL_URL_ROOT.'/admin/taxes.php').')'; // Set period $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); -$prevyear = $year_start; $prevquarter = $q; +$prevyear = $year_start; +$prevquarter = $q; if ($prevquarter > 1) { $prevquarter--; } else { diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 1bea255bda2..d05985b1aa3 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -108,7 +108,9 @@ if (($action == 'send' || $action == 'relance') && !$_POST['addfile'] && !$_POST $trackid = GETPOST('trackid', 'aZ09'); } - $subject = ''; $actionmsg = ''; $actionmsg2 = ''; + $subject = ''; + $actionmsg = ''; + $actionmsg2 = ''; $langs->load('mails'); diff --git a/htdocs/core/actions_setmoduleoptions.inc.php b/htdocs/core/actions_setmoduleoptions.inc.php index e56c4a95dcd..5f0d6823978 100644 --- a/htdocs/core/actions_setmoduleoptions.inc.php +++ b/htdocs/core/actions_setmoduleoptions.inc.php @@ -84,7 +84,8 @@ if ($action == 'setModuleOptions') { $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { if (empty($nomessageinsetmoduleoptions)) { diff --git a/htdocs/core/ajax/ajaxdirpreview.php b/htdocs/core/ajax/ajaxdirpreview.php index 43438c66dc4..cf619f70de6 100644 --- a/htdocs/core/ajax/ajaxdirpreview.php +++ b/htdocs/core/ajax/ajaxdirpreview.php @@ -284,9 +284,8 @@ if ($type == 'directory') { $perm = $user->rights->ecm->upload; $formfile->list_of_autoecmfiles($upload_dir, $filearray, $module, $param, 1, '', $perm, 1, $textifempty, $maxlengthname, $url, 1); - } - // Manual list - else { + } else { + // Manual list if ($module == 'medias') { /* $_POST is array like diff --git a/htdocs/core/ajax/ajaxdirtree.php b/htdocs/core/ajax/ajaxdirtree.php index 52182e2205d..432a0e628db 100644 --- a/htdocs/core/ajax/ajaxdirtree.php +++ b/htdocs/core/ajax/ajaxdirtree.php @@ -237,17 +237,14 @@ if (empty($conf->use_javascript_ajax) || !empty($conf->global->MAIN_ECM_DISABLE_ // If directory is son of expanded directory, we show line if (in_array($val['id_mere'], $expandedsectionarray)) { $showline = 4; - } - // If directory is brother of selected directory, we show line - elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) { + } elseif ($val['id'] != $section && $val['id_mere'] == $ecmdirstatic->motherof[$section]) { + // If directory is brother of selected directory, we show line $showline = 3; - } - // If directory is parent of selected directory or is selected directory, we show line - elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) { + } elseif (preg_match('/'.$val['fullpath'].'_/i', $fullpathselected.'_')) { + // If directory is parent of selected directory or is selected directory, we show line $showline = 2; - } - // If we are level one we show line - elseif ($val['level'] < 2) { + } elseif ($val['level'] < 2) { + // If we are level one we show line $showline = 1; } diff --git a/htdocs/core/ajax/pingresult.php b/htdocs/core/ajax/pingresult.php index 990c3f6f858..4398a3e8d4c 100644 --- a/htdocs/core/ajax/pingresult.php +++ b/htdocs/core/ajax/pingresult.php @@ -71,9 +71,8 @@ if ($action == 'firstpingok') { dolibarr_set_const($db, 'MAIN_FIRST_PING_OK_ID', $hash_unique_id); print 'First ping OK saved for entity '.$conf->entity; -} -// If ko -elseif ($action == 'firstpingko') { +} elseif ($action == 'firstpingko') { + // If ko // Note: pings are by installation, done on entity 1. dolibarr_set_const($db, 'MAIN_LAST_PING_KO_DATE', dol_print_date($now, 'dayhourlog'), 'gmt'); // erase last value print 'First ping KO saved for entity '.$conf->entity; diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ab39a14e2cd..ca77fec51e4 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -122,7 +122,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { - $shownb = 1; $showtot = 1; + $shownb = 1; + $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); if (empty($endyear)) { @@ -154,7 +155,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $px1->SetData($data1); unset($data1); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); @@ -197,7 +199,8 @@ class box_graph_invoices_permonth extends ModeleBoxes $px2->SetData($data2); unset($data2); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 75b58a28de1..21931b1a071 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -119,7 +119,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { - $shownb = 1; $showtot = 1; + $shownb = 1; + $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); if (empty($year)) { @@ -197,7 +198,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px2->SetData($data2); unset($data2); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index 3fafa464993..ec11d07a28f 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -122,7 +122,8 @@ class box_graph_orders_permonth extends ModeleBoxes $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { - $shownb = 1; $showtot = 1; + $shownb = 1; + $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); if (empty($endyear)) { @@ -193,7 +194,8 @@ class box_graph_orders_permonth extends ModeleBoxes if (!$mesg) { $px2->SetData($data2); unset($data2); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 419e3afba83..a6dfead80f0 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -121,7 +121,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { - $shownb = 1; $showtot = 1; + $shownb = 1; + $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); if (empty($endyear)) { @@ -192,7 +193,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes if (!$mesg) { $px2->SetData($data2); unset($data2); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 91a5f598347..5c3e55fcc2f 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -101,7 +101,9 @@ class box_graph_product_distribution extends ModeleBoxes $showordernb = (!empty($tmparray['showordernb']) ? $tmparray['showordernb'] : ''); } if (empty($showinvoicenb) && empty($showpropalnb) && empty($showordernb)) { - $showpropalnb = 1; $showinvoicenb = 1; $showordernb = 1; + $showpropalnb = 1; + $showinvoicenb = 1; + $showordernb = 1; } if (empty($conf->facture->enabled) || empty($user->rights->facture->lire)) { $showinvoicenb = 0; @@ -154,7 +156,8 @@ class box_graph_product_distribution extends ModeleBoxes $langs->load("propal"); include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propalestats.class.php'; - $showpointvalue = 1; $nocolor = 0; + $showpointvalue = 1; + $nocolor = 0; $stats_proposal = new PropaleStats($this->db, $socid, ($userid > 0 ? $userid : 0)); $data2 = $stats_proposal->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5); if (empty($data2)) { @@ -169,7 +172,8 @@ class box_graph_product_distribution extends ModeleBoxes $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); if (!$mesg) { - $i = 0; $legend = array(); + $i = 0; + $legend = array(); foreach ($data2 as $key => $val) { $data2[$key][0] = dol_trunc($data2[$key][0], 32); @@ -210,7 +214,8 @@ class box_graph_product_distribution extends ModeleBoxes $langs->load("orders"); include_once DOL_DOCUMENT_ROOT.'/commande/class/commandestats.class.php'; - $showpointvalue = 1; $nocolor = 0; + $showpointvalue = 1; + $nocolor = 0; $mode = 'customer'; $stats_order = new CommandeStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0)); $data3 = $stats_order->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5); @@ -226,7 +231,8 @@ class box_graph_product_distribution extends ModeleBoxes $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { - $i = 0; $legend = array(); + $i = 0; + $legend = array(); foreach ($data3 as $key => $val) { $data3[$key][0] = dol_trunc($data3[$key][0], 32); @@ -268,7 +274,8 @@ class box_graph_product_distribution extends ModeleBoxes $langs->load("bills"); include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facturestats.class.php'; - $showpointvalue = 1; $nocolor = 0; + $showpointvalue = 1; + $nocolor = 0; $mode = 'customer'; $stats_invoice = new FactureStats($this->db, $socid, $mode, ($userid > 0 ? $userid : 0)); $data1 = $stats_invoice->getAllByProductEntry($year, (GETPOST('action', 'aZ09') == $refreshaction ?-1 : (3600 * 24)), 5); @@ -284,7 +291,8 @@ class box_graph_product_distribution extends ModeleBoxes $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { - $i = 0; $legend = array(); + $i = 0; + $legend = array(); foreach ($data1 as $key => $val) { $data1[$key][0] = dol_trunc($data1[$key][0], 32); diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index 8193e81d060..f8028e3bdb8 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -122,7 +122,8 @@ class box_graph_propales_permonth extends ModeleBoxes $showtot = (!empty($tmparray['showtot']) ? $tmparray['showtot'] : ''); } if (empty($shownb) && empty($showtot)) { - $shownb = 1; $showtot = 1; + $shownb = 1; + $showtot = 1; } $nowarray = dol_getdate(dol_now(), true); if (empty($endyear)) { @@ -149,7 +150,8 @@ class box_graph_propales_permonth extends ModeleBoxes $px1->SetType($datatype1); $px1->SetData($data1); unset($data1); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); @@ -195,7 +197,8 @@ class box_graph_propales_permonth extends ModeleBoxes $px2->SetType($datatype2); $px2->SetData($data2); unset($data2); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { if ($startmonth != 1) { $legend[] = sprintf("%d/%d", $i - 2001, $i - 2000); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 0d235a21798..863bb9a6794 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -578,7 +578,8 @@ class CMailFile $hookmanager = new HookManager($db); $hookmanager->initHooks(array('mail')); - $parameters = array(); $action = ''; + $parameters = array(); + $action = ''; $reshook = $hookmanager->executeHooks('sendMail', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = "Error in hook maildao sendMail ".$reshook; @@ -815,7 +816,8 @@ class CMailFile $this->smtps->setHost($server); $this->smtps->setPort($port); // 25, 465...; - $loginid = ''; $loginpass = ''; + $loginid = ''; + $loginpass = ''; if (!empty($conf->global->$keyforsmtpid)) { $loginid = $conf->global->$keyforsmtpid; $this->smtps->setID($loginid); @@ -946,7 +948,8 @@ class CMailFile return 'Bad value for sendmode'; } - $parameters = array(); $action = ''; + $parameters = array(); + $action = ''; $reshook = $hookmanager->executeHooks('sendMailAfter', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) { $this->error = "Error in hook maildao sendMailAfter ".$reshook; diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index 65cf7091d39..ca221a366ed 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -151,7 +151,8 @@ class CSMSFile } } elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) { // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' $tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE); - $classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); + $classfile = $tmp[0]; + $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); dol_include_once('/'.$module.'/class/'.$classfile.'.class.php'); try { $classname = ucfirst($classfile); diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 1c886a526ed..ad088002caf 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -130,7 +130,8 @@ class Ccountry // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -246,7 +247,8 @@ class Ccountry // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -284,7 +286,8 @@ class Ccountry // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/comment.class.php b/htdocs/core/class/comment.class.php index 3f9ca42e136..a8da44b0d79 100644 --- a/htdocs/core/class/comment.class.php +++ b/htdocs/core/class/comment.class.php @@ -141,7 +141,8 @@ class Comment extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -268,7 +269,8 @@ class Comment extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -318,7 +320,8 @@ class Comment extends CommonObject $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index fc4e2058273..d951807976f 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -632,9 +632,8 @@ abstract class CommonInvoice extends CommonObject $datelim = $this->date + ($cdr_nbjour * 3600 * 24); $datelim += ($cdr_decalage * 3600 * 24); - } - // 1 : application of the "end of the month" rule - elseif ($cdr_type == 1) { + } elseif ($cdr_type == 1) { + // 1 : application of the "end of the month" rule $datelim = $this->date + ($cdr_nbjour * 3600 * 24); $mois = date('m', $datelim); @@ -650,9 +649,8 @@ abstract class CommonInvoice extends CommonObject $datelim -= (3600 * 24); $datelim += ($cdr_decalage * 3600 * 24); - } - // 2 : application of the rule, the N of the current or next month - elseif ($cdr_type == 2 && !empty($cdr_decalage)) { + } elseif ($cdr_type == 2 && !empty($cdr_decalage)) { + // 2 : application of the rule, the N of the current or next month include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $datelim = $this->date + ($cdr_nbjour * 3600 * 24); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 1500595d74e..3140b06b23b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -762,7 +762,8 @@ abstract class CommonObject $out .= img_picto($langs->trans("Address"), 'map-marker-alt'); $out .= ' '; } - $out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); $outdone++; + $out .= dol_print_address($coords, 'address_'.$htmlkey.'_'.$this->id, $this->element, $this->id, 1, ', '); + $outdone++; $outdone++; // List of extra languages @@ -1181,7 +1182,8 @@ abstract class CommonObject if (!$notrigger) { $result = $this->call_trigger(strtoupper($this->element).'_DELETE_CONTACT', $user); if ($result < 0) { - $this->db->rollback(); return -1; + $this->db->rollback(); + return -1; } } @@ -3154,9 +3156,8 @@ abstract class CommonObject return $this->getRangOfLine($fk_parent_line); } } - } - // If not, search the last rang of element - else { + } else { + // If not, search the last rang of element $sql = 'SELECT max('.$positionfield.') FROM '.MAIN_DB_PREFIX.$this->table_element_line; $sql .= ' WHERE '.$this->fk_element.' = '.$this->id; @@ -3745,42 +3746,60 @@ abstract class CommonObject if ($objecttype == 'facture') { $classpath = 'compta/facture/class'; } elseif ($objecttype == 'facturerec') { - $classpath = 'compta/facture/class'; $module = 'facture'; + $classpath = 'compta/facture/class'; + $module = 'facture'; } elseif ($objecttype == 'propal') { $classpath = 'comm/propal/class'; } elseif ($objecttype == 'supplier_proposal') { $classpath = 'supplier_proposal/class'; } elseif ($objecttype == 'shipping') { - $classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon'; + $classpath = 'expedition/class'; + $subelement = 'expedition'; + $module = 'expedition_bon'; } elseif ($objecttype == 'delivery') { - $classpath = 'delivery/class'; $subelement = 'delivery'; $module = 'delivery_note'; + $classpath = 'delivery/class'; + $subelement = 'delivery'; + $module = 'delivery_note'; } elseif ($objecttype == 'invoice_supplier' || $objecttype == 'order_supplier') { - $classpath = 'fourn/class'; $module = 'fournisseur'; + $classpath = 'fourn/class'; + $module = 'fournisseur'; } elseif ($objecttype == 'fichinter') { - $classpath = 'fichinter/class'; $subelement = 'fichinter'; $module = 'ficheinter'; + $classpath = 'fichinter/class'; + $subelement = 'fichinter'; + $module = 'ficheinter'; } elseif ($objecttype == 'subscription') { - $classpath = 'adherents/class'; $module = 'adherent'; + $classpath = 'adherents/class'; + $module = 'adherent'; } elseif ($objecttype == 'contact') { $module = 'societe'; } // Set classfile - $classfile = strtolower($subelement); $classname = ucfirst($subelement); + $classfile = strtolower($subelement); + $classname = ucfirst($subelement); if ($objecttype == 'order') { - $classfile = 'commande'; $classname = 'Commande'; + $classfile = 'commande'; + $classname = 'Commande'; } elseif ($objecttype == 'invoice_supplier') { - $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; + $classfile = 'fournisseur.facture'; + $classname = 'FactureFournisseur'; } elseif ($objecttype == 'order_supplier') { - $classfile = 'fournisseur.commande'; $classname = 'CommandeFournisseur'; + $classfile = 'fournisseur.commande'; + $classname = 'CommandeFournisseur'; } elseif ($objecttype == 'supplier_proposal') { - $classfile = 'supplier_proposal'; $classname = 'SupplierProposal'; + $classfile = 'supplier_proposal'; + $classname = 'SupplierProposal'; } elseif ($objecttype == 'facturerec') { - $classfile = 'facture-rec'; $classname = 'FactureRec'; + $classfile = 'facture-rec'; + $classname = 'FactureRec'; } elseif ($objecttype == 'subscription') { - $classfile = 'subscription'; $classname = 'Subscription'; + $classfile = 'subscription'; + $classname = 'Subscription'; } elseif ($objecttype == 'project' || $objecttype == 'projet') { - $classpath = 'projet/class'; $classfile = 'project'; $classname = 'Project'; + $classpath = 'projet/class'; + $classfile = 'project'; + $classname = 'Project'; } // Here $module, $classfile and $classname are set @@ -4618,7 +4637,8 @@ abstract class CommonObject $element = $this->element; - $text = ''; $description = ''; + $text = ''; + $description = ''; // Line in view mode if ($action != 'editline' || $selected != $line->id) { @@ -4985,7 +5005,8 @@ abstract class CommonObject if (!$notrigger) { $result = $this->call_trigger(strtoupper($element).'_DELETE_RESOURCE', $user); if ($result < 0) { - $this->db->rollback(); return -1; + $this->db->rollback(); + return -1; } } $this->db->commit(); @@ -5106,7 +5127,8 @@ abstract class CommonObject $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (is_dir($tmpdir)) { $tmpfiles = dol_dir_list($tmpdir, 'files', 0, '\.od(s|t)$', '', 'name', SORT_ASC, 0); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 19555adf3fb..b73f7ae3257 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -196,13 +196,13 @@ class Conf $this->modules_parts[$partname] = array(); } $this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array - } - // If this is constant for all generic part activated by a module. It initializes - // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'], - // modules_parts['models'], modules_parts['theme'] - // modules_parts['sms'], - // modules_parts['css'], ... - elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) { + // If this is constant for all generic part activated by a module. It initializes + // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'], + // modules_parts['models'], modules_parts['theme'] + // modules_parts['sms'], + // modules_parts['css'], ... + $modulename = strtolower($reg[1]); $partname = strtolower($reg[2]); if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) { @@ -221,9 +221,8 @@ class Conf $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe } $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array - } - // If this is a module constant (must be at end) - elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) { + } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) { + // If this is a module constant (must be at end) $modulename = strtolower($reg[1]); if ($modulename == 'propale') { $modulename = 'propal'; diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index acddb09d547..66ee803d41a 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -123,7 +123,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -229,7 +230,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -266,7 +268,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index ff2bcc58f40..01a6eb5e697 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -130,7 +130,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -244,7 +245,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -282,7 +284,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 757e3fb0e66..e55d227de0e 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -133,7 +133,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -351,7 +352,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -389,7 +391,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 0eecbbf6d36..2427b2da1e4 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -61,7 +61,8 @@ class DolGeoIP require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } } else { - print 'ErrorBadParameterInConstructor'; return 0; + print 'ErrorBadParameterInConstructor'; + return 0; } // Here, function exists (embedded into PHP or exists because we made include) diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 607993dc325..3672f7faa07 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -908,9 +908,8 @@ class DolGraph $this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' } }); }' . "\n"; - } - // Other cases, graph of type 'bars', 'lines' - else { + } else { + // Other cases, graph of type 'bars', 'lines' // Add code to support tooltips // TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes $this->stringtoshow .= ' @@ -1262,9 +1261,8 @@ class DolGraph $this->stringtoshow .= ']' . "\n"; $this->stringtoshow .= '}' . "\n"; $this->stringtoshow .= '});' . "\n"; - } - // Other cases, graph of type 'bars', 'lines', 'linesnopoint' - else { + } else { + // Other cases, graph of type 'bars', 'lines', 'linesnopoint' $type = 'bar'; if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') { diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 6f674c0b600..980c8c53dde 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -147,7 +147,8 @@ class Events // extends CommonObject // Check parameters if (empty($this->description)) { - $this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1; + $this->error = 'ErrorBadValueForParameterCreateEventDesc'; + return -1; } // Insert request diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 35747920ec5..5a5b06054ff 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -251,7 +251,8 @@ class ExtraFields } if ($type == 'separate') { - $unique = 0; $required = 0; + $unique = 0; + $required = 0; } // Force unique and not required if this is a separator field to avoid troubles. if ($elementtype == 'thirdparty') { $elementtype = 'societe'; diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 21d948b2160..45bc622b9db 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -70,7 +70,8 @@ class FileUpload $element = $pathname = 'projet'; $dir_output = $conf->$element->dir_output; } elseif ($element == 'project_task') { - $pathname = 'projet'; $filename = 'task'; + $pathname = 'projet'; + $filename = 'task'; $dir_output = $conf->projet->dir_output; $parentForeignKey = 'fk_project'; $parentClass = 'Project'; @@ -80,20 +81,24 @@ class FileUpload $element = 'ficheinter'; $dir_output = $conf->$element->dir_output; } elseif ($element == 'order_supplier') { - $pathname = 'fourn'; $filename = 'fournisseur.commande'; + $pathname = 'fourn'; + $filename = 'fournisseur.commande'; $dir_output = $conf->fournisseur->commande->dir_output; } elseif ($element == 'invoice_supplier') { - $pathname = 'fourn'; $filename = 'fournisseur.facture'; + $pathname = 'fourn'; + $filename = 'fournisseur.facture'; $dir_output = $conf->fournisseur->facture->dir_output; } elseif ($element == 'product') { $dir_output = $conf->product->multidir_output[$conf->entity]; } elseif ($element == 'productbatch') { $dir_output = $conf->productbatch->multidir_output[$conf->entity]; } elseif ($element == 'action') { - $pathname = 'comm/action'; $filename = 'actioncomm'; + $pathname = 'comm/action'; + $filename = 'actioncomm'; $dir_output = $conf->agenda->dir_output; } elseif ($element == 'chargesociales') { - $pathname = 'compta/sociales'; $filename = 'chargesociales'; + $pathname = 'compta/sociales'; + $filename = 'chargesociales'; $dir_output = $conf->tax->dir_output; } else { $dir_output = $conf->$element->dir_output; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8b211a34864..9d3ea8f39d6 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -228,11 +228,14 @@ class HookManager } // Init return properties - $this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0; + $this->resPrint = ''; + $this->resArray = array(); + $this->resNbOfHooks = 0; // Loop on each hook to qualify modules that have declared context $modulealreadyexecuted = array(); - $resaction = 0; $error = 0; + $resaction = 0; + $error = 0; foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context if (!empty($modules)) { foreach ($modules as $module => $actionclassinstance) { @@ -265,7 +268,8 @@ class HookManager $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) { $error++; - $this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); + $this->error = $actionclassinstance->error; + $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR); } @@ -275,9 +279,8 @@ class HookManager if (!empty($actionclassinstance->resprints)) { $this->resPrint .= $actionclassinstance->resprints; } - } - // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) - else { + } else { + // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) // TODO. this test should be done into the method of hook by returning nothing if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) { continue; @@ -294,14 +297,16 @@ class HookManager } if (is_numeric($resaction) && $resaction < 0) { $error++; - $this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); + $this->error = $actionclassinstance->error; + $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR); } // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string if (!is_array($resaction) && !is_numeric($resaction)) { dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); if (empty($actionclassinstance->resprints)) { - $this->resPrint .= $resaction; $resaction = 0; + $this->resPrint .= $resaction; + $resaction = 0; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 5f2497a5827..42be90ac4e9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -488,7 +488,8 @@ class Form $out .= ''."\n"; // Use for timestamp format } elseif (preg_match('/^(select|autocomplete)/', $inputType)) { $tmp = explode(':', $inputType); - $inputType = $tmp[0]; $loadmethod = $tmp[1]; + $inputType = $tmp[0]; + $loadmethod = $tmp[1]; if (!empty($tmp[2])) { $savemethod = $tmp[2]; } @@ -502,7 +503,8 @@ class Form $cols = (empty($tmp[2]) ? '80' : $tmp[2]); } elseif (preg_match('/^ckeditor/', $inputType)) { $tmp = explode(':', $inputType); - $inputType = $tmp[0]; $toolbar = $tmp[1]; + $inputType = $tmp[0]; + $toolbar = $tmp[1]; if (!empty($tmp[2])) { $width = $tmp[2]; } @@ -594,15 +596,18 @@ class Form $extrastyle = ''; if ($direction < 0) { - $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-left: 3px !important;'; + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); + $extrastyle = 'padding: 0px; padding-left: 3px !important;'; } if ($direction > 0) { - $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-right: 3px !important;'; + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); + $extrastyle = 'padding: 0px; padding-right: 3px !important;'; } $classfortooltip = 'classfortooltip'; - $s = ''; $textfordialog = ''; + $s = ''; + $textfordialog = ''; if ($tooltiptrigger == '') { $htmltext = str_replace('"', '"', $htmltext); @@ -2084,7 +2089,8 @@ class Form if ($nbassignetouser) { $out .= '
    '; } - $i = 0; $ownerid = 0; + $i = 0; + $ownerid = 0; foreach ($assignedtouser as $key => $value) { if ($value['id'] == $ownerid) { continue; @@ -2094,7 +2100,8 @@ class Form $userstatic->fetch($value['id']); $out .= $userstatic->getNomUrl(-1); if ($i == 0) { - $ownerid = $value['id']; $out .= ' ('.$langs->trans("Owner").')'; + $ownerid = $value['id']; + $out .= ' ('.$langs->trans("Owner").')'; } if ($nbassignetouser > 1 && $action != 'view') { $out .= ' '; @@ -5811,7 +5818,8 @@ class Form } // Disabled if seller is not subject to VAT - $disabled = false; $title = ''; + $disabled = false; + $title = ''; if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") { // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead // of using supplier invoices (this is a very bad idea !) @@ -5991,10 +5999,12 @@ class Form $stepminutes = 1; } if ($empty == 1) { - $emptydate = 1; $emptyhours = 1; + $emptydate = 1; + $emptyhours = 1; } if ($empty == 2) { - $emptydate = 0; $emptyhours = 1; + $emptydate = 0; + $emptyhours = 1; } $orig_set_time = $set_time; @@ -6149,9 +6159,8 @@ class Form } else { $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; } - } - // Show date with combo selects - else { + } else { + // Show date with combo selects // Day $retstring .= ''; @@ -6448,7 +6457,8 @@ class Form $retstring = ''; - $hourSelected = 0; $minSelected = 0; + $hourSelected = 0; + $minSelected = 0; // Hours if ($iSecond != '') { @@ -6914,7 +6924,8 @@ class Form $style = empty($tmpvalue['css']) ? ' class="'.$tmpvalue['css'].'"' : ''; } else { $value = $tmpvalue; - $disabled = ''; $style = ''; + $disabled = ''; + $style = ''; } if (!empty($disablebademail)) { if (($disablebademail == 1 && !preg_match('/<.+@.+>/', $value)) @@ -7720,9 +7731,8 @@ class Form //$linktoelem.=($linktoelem?'   ':''); if ($num > 0) { $linktoelemlist .= '
  • '.$langs->trans($possiblelink['label']).' ('.$num.')
  • '; - } - //else $linktoelem.=$langs->trans($possiblelink['label']); - else { + // } else $linktoelem.=$langs->trans($possiblelink['label']); + } else { $linktoelemlist .= '
  • '.$langs->trans($possiblelink['label']).' (0)
  • '; } } @@ -7777,7 +7787,8 @@ class Form { global $langs; - $yes = "yes"; $no = "no"; + $yes = "yes"; + $no = "no"; if ($option) { $yes = "1"; $no = "0"; @@ -8093,7 +8104,13 @@ class Form $entity = (!empty($object->entity) ? $object->entity : $conf->entity); $id = (!empty($object->id) ? $object->id : $object->rowid); - $ret = ''; $dir = ''; $file = ''; $originalfile = ''; $altfile = ''; $email = ''; $capture = ''; + $ret = ''; + $dir = ''; + $file = ''; + $originalfile = ''; + $altfile = ''; + $email = ''; + $capture = ''; if ($modulepart == 'societe') { $dir = $conf->societe->multidir_output[$entity]; if (!empty($object->logo)) { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 7d909440ecc..f1b80843488 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -227,7 +227,8 @@ class FormActions print ''."\n"; print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter); - $page = 0; $param = ''; + $page = 0; + $param = ''; print '
    '; print '
 
'.$langs->trans("SubTotal").':'.price(price2num($subtotal, 'MT')).' 
'.$langs->trans("TotalToPay").':'.price(price2num($total, 'MT')).'
'; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index e7d8d94b6d2..34c522745d9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -547,7 +547,8 @@ class FormCompany extends Form $num = $this->db->num_rows($resql); if ($num) { $i = 0; - $country = ''; $arraydata = array(); + $country = ''; + $arraydata = array(); while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -622,7 +623,8 @@ class FormCompany extends Form // Use Ajax search $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2); - $socid = 0; $name = ''; + $socid = 0; + $name = ''; if ($selected > 0) { $tmpthirdparty = new Societe($this->db); $result = $tmpthirdparty->fetch($selected); @@ -937,7 +939,8 @@ class FormCompany extends Form $maxlength = $formlength; if (empty($formlength)) { - $formlength = 24; $maxlength = 128; + $formlength = 24; + $maxlength = 128; } $out = ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d5586a2c9d2..21327a9a37e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -659,9 +659,8 @@ class FormFile $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); if (file_exists($file)) { $res = include_once $file; - } - // For normalized external modules. - else { + } else { + // For normalized external modules. $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); $res = include_once $file; } @@ -699,7 +698,8 @@ class FormFile $out .= ''; $addcolumforpicto = ($delallowed || $printer || $morepicto); - $colspan = (3 + ($addcolumforpicto ? 1 : 0)); $colspanmore = 0; + $colspan = (3 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; $out .= '
'; @@ -1221,7 +1221,9 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; } - $i = 0; $nboflines = 0; $lastrowid = 0; + $i = 0; + $nboflines = 0; + $lastrowid = 0; foreach ($filearray as $key => $file) { // filearray must be only files here if ($file['name'] != '.' && $file['name'] != '..' @@ -1639,19 +1641,24 @@ class FormFile // Define relative path used to store the file $relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']); - $id = 0; $ref = ''; + $id = 0; + $ref = ''; // To show ref or specific information according to view to show (defined by $module) $reg = array(); if ($modulepart == 'company' || $modulepart == 'tax') { - preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); + preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); + $id = (isset($reg[1]) ? $reg[1] : ''); } elseif ($modulepart == 'invoice_supplier') { - preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { - $id = $ref; $ref = ''; + preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); + $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { + $id = $ref; + $ref = ''; } - } // $ref may be also id with old supplier invoices - elseif ($modulepart == 'user' || $modulepart == 'holiday') { - preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); + } elseif ($modulepart == 'user' || $modulepart == 'holiday') { + // $ref may be also id with old supplier invoices + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); + $id = (isset($reg[1]) ? $reg[1] : ''); } elseif (in_array($modulepart, array( 'invoice', 'propal', @@ -1666,7 +1673,8 @@ class FormFile 'recruitment-recruitmentcandidature', 'mrp-mo', 'banque'))) { - preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); + $ref = (isset($reg[1]) ? $reg[1] : ''); } else { $parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); @@ -1703,10 +1711,13 @@ class FormFile } if ($result > 0) { // Save object loaded into a cache - $found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance; + $found = 1; + $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance; } if ($result == 0) { - $found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; unset($filearray[$key]); + $found = 1; + $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; + unset($filearray[$key]); } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index e0c31336f8c..b265700419b 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -911,7 +911,8 @@ class FormMail extends Form } // Complete substitution array with the url to make online payment - $paymenturl = ''; $validpaymentmethod = array(); + $paymenturl = ''; + $validpaymentmethod = array(); if (empty($this->substit['__REF__'])) { $paymenturl = ''; } else { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 6fee9eb1000..127bfd2fd50 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1211,7 +1211,8 @@ class FormOther } // Define boxlista and boxlistb - $boxlista = ''; $boxlistb = ''; + $boxlista = ''; + $boxlistb = ''; $nbboxactivated = count($boxidactivatedforuser); if ($nbboxactivated) { @@ -1357,7 +1358,8 @@ class FormOther { global $langs; - $automatic = "automatic"; $manual = "manual"; + $automatic = "automatic"; + $manual = "manual"; if ($option) { $automatic = "1"; $manual = "0"; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 21f8b2684fe..422a193030a 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -393,7 +393,8 @@ class FormProjets continue; } - $labeltoshow = ''; $titletoshow = ''; + $labeltoshow = ''; + $titletoshow = ''; $disabled = 0; if ($obj->fk_statut == Project::STATUS_DRAFT) { diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index ac69ca5ce26..57d8876c3ea 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -200,7 +200,8 @@ function limitChars(textarea, limit, infodiv) } } elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) { // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' $tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE); - $classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); + $classfile = $tmp[0]; + $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); dol_include_once('/'.$module.'/class/'.$classfile.'.class.php'); try { $classname = ucfirst($classfile); diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 9f1afab13f7..4210113f990 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -246,7 +246,8 @@ class FormWebsite if ($atleastonepage) { if (empty($pageid) && $action != 'createcontainer') { // Page id is not defined, we try to take one - $firstpageid = 0; $homepageid = 0; + $firstpageid = 0; + $homepageid = 0; foreach ($website->lines as $key => $valpage) { if (empty($firstpageid)) { $firstpageid = $valpage->id; diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 73007db9363..bd2d6d020cd 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -8,7 +8,7 @@ * Copyright 2013, Leaf Corcoran * Licensed under MIT or GPLv3, see LICENSE */ - +// phpcs:disable /** * The LESS compiler and parser. * @@ -3385,7 +3385,7 @@ class lessc_parser return false; } - // a # color + // a # color protected function color(&$out) { if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) { @@ -3400,11 +3400,11 @@ class lessc_parser return false; } - // consume an argument definition list surrounded by () - // each argument is a variable name with optional value - // or at the end a ... or a variable named followed by ... - // arguments are separated by , unless a ; is in the list, then ; is the - // delimiter. + // consume an argument definition list surrounded by () + // each argument is a variable name with optional value + // or at the end a ... or a variable named followed by ... + // arguments are separated by , unless a ; is in the list, then ; is the + // delimiter. protected function argumentDef(&$args, &$isVararg) { $s = $this->seek(); @@ -3726,7 +3726,7 @@ class lessc_parser return false; } - // consume a less variable + // consume a less variable protected function variable(&$name) { $s = $this->seek(); @@ -3746,10 +3746,10 @@ class lessc_parser return false; } - /** - * Consume an assignment operator - * Can optionally take a name that will be set to the current property name - */ + /** + * Consume an assignment operator + * Can optionally take a name that will be set to the current property name + */ protected function assign($name = null) { if ($name) { @@ -3758,7 +3758,7 @@ class lessc_parser return $this->literal(':') || $this->literal('='); } - // consume a keyword + // consume a keyword protected function keyword(&$word) { if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) { @@ -3768,7 +3768,7 @@ class lessc_parser return false; } - // consume an end of statement delimiter + // consume an end of statement delimiter protected function end() { if ($this->literal(';', false)) { @@ -3807,8 +3807,8 @@ class lessc_parser return true; } - // a bunch of guards that are and'd together - // TODO rename to guardGroup + // a bunch of guards that are and'd together + // TODO rename to guardGroup protected function guardGroup(&$guardGroup) { $s = $this->seek(); @@ -3846,7 +3846,7 @@ class lessc_parser return false; } - /* raw parsing functions */ + /* raw parsing functions */ protected function literal($what, $eatWhitespace = null) { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index a9fb8b01c16..97c63e62d67 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -578,7 +578,10 @@ class Menubase //var_dump($this->newmenu->liste); } else { // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu) - $searchlastsub = 0; $lastid = 0; $nextid = 0; $found = 0; + $searchlastsub = 0; + $lastid = 0; + $nextid = 0; + $found = 0; foreach ($this->newmenu->liste as $keyparent => $valparent) { //var_dump($valparent); if ($searchlastsub) { // If we started to search for last submenu diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index aae4acd7bc0..0f09d232712 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -410,9 +410,10 @@ class RssParser } } if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - $tmprss = xml2php($rss); $items = $tmprss['entry']; - } // With simplexml - else { + $tmprss = xml2php($rss); + $items = $tmprss['entry']; + } else { + // With simplexml $items = $rss->items; // With xmlparse } //var_dump($items);exit; @@ -552,45 +553,36 @@ class RssParser if (isset($attrs['rdf:about'])) { $this->current_item['about'] = $attrs['rdf:about']; } - } - - // if we're in the default namespace of an RSS feed, - // record textinput or image fields - elseif ($this->_format == 'rss' and + } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') { + // if we're in the default namespace of an RSS feed, + // record textinput or image fields $this->intextinput = true; } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') { $this->inimage = true; - } - - // handle atom content constructs - elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + // handle atom content constructs // avoid clashing w/ RSS mod_content if ($el == 'content') { $el = 'atom_content'; } $this->incontent = $el; - } - - // if inside an Atom content construct (e.g. content or summary) field treat tags as text - elseif ($this->_format == 'atom' and $this->incontent) { + } elseif ($this->_format == 'atom' and $this->incontent) { + // if inside an Atom content construct (e.g. content or summary) field treat tags as text // if tags are inlined, then flatten $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); $this->append_content("<$element $attrs_str>"); array_unshift($this->stack, $el); - } - - // Atom support many links per containging element. - // Magpie treats link elements of type rel='alternate' - // as being equivalent to RSS's simple link element. - // - elseif ($this->_format == 'atom' and $el == 'link') { + } elseif ($this->_format == 'atom' and $el == 'link') { + // Atom support many links per containging element. + // Magpie treats link elements of type rel='alternate' + // as being equivalent to RSS's simple link element. if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') { $link_el = 'link'; } elseif (!isset($attrs['rel'])) { @@ -600,9 +592,8 @@ class RssParser } $this->append($link_el, $attrs['href']); - } - // set stack[0] to current element - else { + } else { + // set stack[0] to current element array_unshift($this->stack, $el); } } diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 3618cfc2413..ef26dc4ac65 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -426,9 +426,8 @@ class SMTPs if ($_retVal = $this->server_parse($this->socket, "220")) { $_retVal = $this->socket; } - } - // This connection attempt failed. - else { + } else { + // This connection attempt failed. // @CHANGE LDR if (empty($this->errstr)) { $this->errstr = 'Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort(); @@ -580,10 +579,8 @@ class SMTPs if (!empty($this->_smtpsID) && !empty($this->_smtpsPW)) { // Send the RFC2554 specified EHLO. $_retVal = $this->_server_authenticate(); - } - - // This is a "normal" SMTP Server "handshack" - else { + } else { + // This is a "normal" SMTP Server "handshack" // Send the RFC821 specified HELO. $host = $this->getHost(); $usetls = preg_match('@tls://@i', $host); @@ -705,10 +702,8 @@ class SMTPs $this->_setErr(110, '"'.$_strConfigPath.'" is not a valid path.'); $_retVal = false; } - } - - // Read the Systems php.ini file - else { + } else { + // Read the Systems php.ini file // Set these properties ONLY if they are set in the php.ini file. // Otherwise the default values will be used. if ($_host = ini_get('SMTPs')) { @@ -1048,10 +1043,8 @@ class SMTPs if (strstr($_addrList, ',')) { // "explode "list" into an array $_addrList = explode(',', $_addrList); - } - - // Stick it in an array - else { + } else { + // Stick it in an array $_addrList = array($_addrList); } } @@ -1070,9 +1063,8 @@ class SMTPs $_tmpHost = explode('@', $_tmpaddr[1]); $_tmpaddr[0] = trim($_tmpaddr[0], ' ">'); $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0]; - } - // We only have an eMail address - else { + } else { + // We only have an eMail address // Strip off the beggining '<' $_strAddr = str_replace('<', '', $_strAddr); @@ -1449,10 +1441,8 @@ class SMTPs // If we have ZERO, we have a problem if ($keyCount === 0) { die("Sorry, no content"); - } - - // If we have ONE, we can use the simple format - elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + } elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // If we have ONE, we can use the simple format $_msgData = $this->_msgContent; $_msgData = $_msgData[$_types[0]]; @@ -1467,10 +1457,8 @@ class SMTPs $content .= "\r\n" . $_msgData['data']."\r\n"; - } - - // If we have more than ONE, we use the multi-part format - elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + } elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // If we have more than ONE, we use the multi-part format // Since this is an actual multi-part message // We need to define a content message Boundary // NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this. @@ -1512,9 +1500,8 @@ class SMTPs $content .= "\r\n".$_data['data']."\r\n\r\n"; } - } - // @CHANGE LDR - elseif ($type == 'image') { + } elseif ($type == 'image') { + // @CHANGE LDR // loop through all images foreach ($_content as $_image => $_data) { $content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image @@ -1546,7 +1533,8 @@ class SMTPs $content .= "--".$this->_getBoundary('related')."\r\n"; } - if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part before html part + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // Add plain text message part before html part $content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n"; $content .= "\r\n"; $content .= "--".$this->_getBoundary('alternative')."\r\n"; @@ -1566,7 +1554,8 @@ class SMTPs $content .= "\r\n".$_content['data']."\r\n"; - if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part after html part + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // Add plain text message part after html part $content .= "--".$this->_getBoundary('alternative')."--\r\n"; } @@ -1599,7 +1588,7 @@ class SMTPs $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; if ($this->getMD5flag()) { - $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); + $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); } } } diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index b2c9b069095..4ac164b1d3a 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -424,7 +424,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $j = 0; + $i = 0; + $j = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); $j = $row[0] * 1; @@ -539,7 +540,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $j = 0; + $i = 0; + $j = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); $j = $row[0] * 1; @@ -594,7 +596,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $other = 0; + $i = 0; + $other = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); if ($i < $limit || $num == $limit) { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 0aa00153f5b..007b812cfa4 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -81,7 +81,8 @@ class Translate foreach ($conf->file->dol_document_root as $dir) { $newdir = $dir.$conf->global->MAIN_FORCELANGDIR; // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' if (!in_array($newdir, $this->dir)) { - $more['module_'.$i] = $newdir; $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. + $more['module_'.$i] = $newdir; + $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. } } $this->dir = array_merge($more, $this->dir); // Forced dir ($more) are before standard dirs ($this->dir) @@ -267,9 +268,8 @@ class Translate // Using a memcached server if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) { $usecachekey = $newdomain.'_'.$langofdir.'_'.md5($file_lang); // Should not contains special chars - } - // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) - elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) $usecachekey = $newdomain; } @@ -458,9 +458,8 @@ class Translate // Using a memcached server if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) { $usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars - } - // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) - elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) $usecachekey = $newdomain; } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3806e5bda4d..7be7e8f28cc 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -222,11 +222,13 @@ class Utils $prefix = 'dump'; $ext = 'sql'; if (in_array($type, array('mysql', 'mysqli'))) { - $prefix = 'mysqldump'; $ext = 'sql'; + $prefix = 'mysqldump'; + $ext = 'sql'; } //if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } if (in_array($type, array('pgsql'))) { - $prefix = 'pg_dump'; $ext = 'sql'; + $prefix = 'pg_dump'; + $ext = 'sql'; } $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; } @@ -350,7 +352,8 @@ class Utils // TODO Replace with executeCLI function if ($execmethod == 1) { - $output_arr = array(); $retval = null; + $output_arr = array(); + $retval = null; exec($fullcommandclear, $output_arr, $retval); if ($retval != 0) { diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 229966468c1..d513262b871 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -63,7 +63,8 @@ function dol_quoted_printable_encode($input, $line_max = 76) if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only $c = "=20"; } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required - $h2 = floor($dec / 16); $h1 = floor($dec % 16); + $h2 = floor($dec / 16); + $h1 = floor($dec % 16); $c = $escape.$hex["$h2"].$hex["$h1"]; } if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 2d3210cad66..c5e0137b98d 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -615,7 +615,9 @@ if ($sql) { dol_print_error($db); } - $ifetch = 0; $xi = 0; $oldlabeltouse = ''; + $ifetch = 0; + $xi = 0; + $oldlabeltouse = ''; while ($obj = $db->fetch_object($resql)) { $ifetch++; if ($useagroupby) { @@ -681,9 +683,8 @@ if ($sql) { if ($objfieldforg == '0') { // The record we fetch is for this group $data[$xi][$fieldforybis] = $obj->$fieldfory; - } - // The record we fetch is not for this group - elseif (!isset($data[$xi][$fieldforybis])) { + } elseif (!isset($data[$xi][$fieldforybis])) { + // The record we fetch is not for this group $data[$xi][$fieldforybis] = '0'; } } else { @@ -691,9 +692,8 @@ if ($sql) { if ((string) $objfieldforg === (string) $gvaluepossiblekey) { // The record we fetch is for this group $data[$xi][$fieldforybis] = $obj->$fieldfory; - } - // The record we fetch is not for this group - elseif (!isset($data[$xi][$fieldforybis])) { + } elseif (!isset($data[$xi][$fieldforybis])) { + // The record we fetch is not for this group $data[$xi][$fieldforybis] = '0'; } } diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index c6aaef77f9c..7842457db0f 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -228,7 +228,9 @@ function displayBox($selectedDate, $month, $year) $mydate = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date // Loop on each day of month - $stoploop = 0; $day = 1; $cols = 0; + $stoploop = 0; + $day = 1; + $cols = 0; while (!$stoploop) { //print_r($mydate); if ($mydate < $firstdate) { // At first run diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 0c47e97aef9..0d29c0d1323 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -58,9 +58,8 @@ if ($resql) { // This can fail when class is used on old database (during mig $this->export_fields_array[$r][$fieldname] = $fieldlabel; $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; $this->export_entities_array[$r][$fieldname] = $keyforelement; - } - // If this is a computed field - else { + } else { + // If this is a computed field $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/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 15b8e8bb188..759b97aaedb 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -106,10 +106,12 @@ function versioncompare($versionarray1, $versionarray2) $level++; //print 'level '.$level.' '.$operande1.'-'.$operande2.'
'; if ($operande1 < $operande2) { - $ret = -$level; break; + $ret = -$level; + break; } if ($operande1 > $operande2) { - $ret = $level; break; + $ret = $level; + break; } } //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'
'."\n"; @@ -1240,40 +1242,52 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab //var_dump($objMod->dictionaries['tabname']); $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0; foreach ($objMod->dictionaries['tabname'] as $val) { - $nbtabname++; $taborder[] = max($taborder) + 1; $tabname[] = $val; + $nbtabname++; + $taborder[] = max($taborder) + 1; + $tabname[] = $val; } // Position foreach ($objMod->dictionaries['tablib'] as $val) { - $nbtablib++; $tablib[] = $val; + $nbtablib++; + $tablib[] = $val; } foreach ($objMod->dictionaries['tabsql'] as $val) { - $nbtabsql++; $tabsql[] = $val; + $nbtabsql++; + $tabsql[] = $val; } foreach ($objMod->dictionaries['tabsqlsort'] as $val) { - $nbtabsqlsort++; $tabsqlsort[] = $val; + $nbtabsqlsort++; + $tabsqlsort[] = $val; } foreach ($objMod->dictionaries['tabfield'] as $val) { - $nbtabfield++; $tabfield[] = $val; + $nbtabfield++; + $tabfield[] = $val; } foreach ($objMod->dictionaries['tabfieldvalue'] as $val) { - $nbtabfieldvalue++; $tabfieldvalue[] = $val; + $nbtabfieldvalue++; + $tabfieldvalue[] = $val; } foreach ($objMod->dictionaries['tabfieldinsert'] as $val) { - $nbtabfieldinsert++; $tabfieldinsert[] = $val; + $nbtabfieldinsert++; + $tabfieldinsert[] = $val; } foreach ($objMod->dictionaries['tabrowid'] as $val) { - $nbtabrowid++; $tabrowid[] = $val; + $nbtabrowid++; + $tabrowid[] = $val; } foreach ($objMod->dictionaries['tabcond'] as $val) { - $nbtabcond++; $tabcond[] = $val; + $nbtabcond++; + $tabcond[] = $val; } if (!empty($objMod->dictionaries['tabhelp'])) { foreach ($objMod->dictionaries['tabhelp'] as $val) { - $nbtabhelp++; $tabhelp[] = $val; + $nbtabhelp++; + $tabhelp[] = $val; } } if (!empty($objMod->dictionaries['tabfieldcheck'])) { foreach ($objMod->dictionaries['tabfieldcheck'] as $val) { - $nbtabfieldcheck++; $tabfieldcheck[] = $val; + $nbtabfieldcheck++; + $tabfieldcheck[] = $val; } } diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index cbf56136978..cd8764a8a87 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -167,7 +167,9 @@ function barcode_encode($code, $encoding) */ function barcode_gen_ean_sum($ean) { - $even = true; $esum = 0; $osum = 0; + $even = true; + $esum = 0; + $osum = 0; $ln = strlen($ean) - 1; for ($i = $ln; $i >= 0; $i--) { if ($even) { @@ -300,7 +302,8 @@ function barcode_encode_genbarcode($code, $encoding) ); //var_dump($ret); if (preg_match('/permission denied/i', $ret['bars'])) { - $ret['error'] = $ret['bars']; $ret['bars'] = ''; + $ret['error'] = $ret['bars']; + $ret['bars'] = ''; return $ret; } if (!$ret['bars']) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 87653786b9f..426b486a8cf 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -84,7 +84,10 @@ function getServerTimeZoneInt($refgmtdate = 'now') { if (method_exists('DateTimeZone', 'getOffset')) { // Method 1 (include daylight) - $gmtnow = dol_now('gmt'); $yearref = dol_print_date($gmtnow, '%Y'); $monthref = dol_print_date($gmtnow, '%m'); $dayref = dol_print_date($gmtnow, '%d'); + $gmtnow = dol_now('gmt'); + $yearref = dol_print_date($gmtnow, '%Y'); + $monthref = dol_print_date($gmtnow, '%m'); + $dayref = dol_print_date($gmtnow, '%d'); if ($refgmtdate == 'now') { $newrefgmtdate = $yearref.'-'.$monthref.'-'.$dayref; } elseif ($refgmtdate == 'summer') { @@ -134,10 +137,12 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) $deltastring = 'P'; if ($duration_value > 0) { - $deltastring .= abs($duration_value); $sub = false; + $deltastring .= abs($duration_value); + $sub = false; } if ($duration_value < 0) { - $deltastring .= abs($duration_value); $sub = true; + $deltastring .= abs($duration_value); + $sub = true; } if ($duration_unit == 'd') { $deltastring .= "D"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bde5408eb65..b7e7ffd5e7e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -123,7 +123,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl // Check if file is qualified foreach ($excludefilterarray as $filt) { if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) { - $qualified = 0; break; + $qualified = 0; + break; } } //print $fullpathfile.' '.$file.' '.$qualified.'
'; @@ -400,9 +401,11 @@ function dol_compare_file($a, $b) $sortorder = strtoupper($sortorder); if ($sortorder == 'ASC') { - $retup = -1; $retdown = 1; + $retup = -1; + $retdown = 1; } else { - $retup = 1; $retdown = -1; + $retup = 1; + $retdown = -1; } if ($sortfield == 'name') { @@ -1916,9 +1919,11 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring $data = implode("", file(dol_osencode($inputfile))); if ($mode == 'gz') { - $foundhandler = 1; $compressdata = gzencode($data, 9); + $foundhandler = 1; + $compressdata = gzencode($data, 9); } elseif ($mode == 'bz') { - $foundhandler = 1; $compressdata = bzcompress($data, 9); + $foundhandler = 1; + $compressdata = bzcompress($data, 9); } elseif ($mode == 'zip') { if (class_exists('ZipArchive') && !empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS)) { $foundhandler = 1; @@ -2037,7 +2042,8 @@ function dol_uncompress($inputfile, $outputdir) if (!is_array($result) && $result <= 0) { return array('error'=>$archive->errorInfo(true)); } else { - $ok = 1; $errmsg = ''; + $ok = 1; + $errmsg = ''; // Loop on each file to check result for unzipping file foreach ($result as $key => $val) { if ($val['status'] == 'path_creation_fail') { @@ -2250,9 +2256,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Define possible keys to use for permission check - $lire = 'lire'; $read = 'read'; $download = 'download'; + $lire = 'lire'; + $read = 'read'; + $download = 'download'; if ($mode == 'write') { - $lire = 'creer'; $read = 'write'; $download = 'upload'; + $lire = 'creer'; + $read = 'write'; + $download = 'upload'; } // Wrapping for miscellaneous medias files @@ -2262,100 +2272,100 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $accessallowed = 1; $original_file = $conf->medias->multidir_output[$entity].'/'.$original_file; - } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log - elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file))); $original_file = $dolibarr_main_data_root.'/'.$original_file; - } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log - elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = $user->admin; $original_file = $dolibarr_main_data_root.'/doctemplates/'.$original_file; - } // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip - elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip $accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file))); $original_file = $dolibarr_main_data_root.'/doctemplates/websites/'.$original_file; - } // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip - elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip // Dir for custom dirs $tmp = explode(',', $dolibarr_main_document_root_alt); $dirins = $tmp[0]; $accessallowed = ($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file))); $original_file = $dirins.'/'.$original_file; - } // Wrapping for some images - elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output)) { + } elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output)) { + // Wrapping for some images $accessallowed = 1; $original_file = $conf->mycompany->dir_output.'/'.$original_file; - } // Wrapping for users photos - elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { + } elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { + // Wrapping for users photos $accessallowed = 1; $original_file = $conf->user->dir_output.'/'.$original_file; - } // Wrapping for members photos - elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { + } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { + // Wrapping for members photos $accessallowed = 1; $original_file = $conf->adherent->dir_output.'/'.$original_file; - } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { + } elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { + // Wrapping pour les apercu factures if ($fuser->rights->facture->{$lire}) { $accessallowed = 1; } $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { + } elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping pour les apercu propal if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { + } elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { + // Wrapping pour les apercu commande if ($fuser->rights->commande->{$lire}) { $accessallowed = 1; } $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu intervention - elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { + } elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { + // Wrapping pour les apercu intervention if ($fuser->rights->ficheinter->{$lire}) { $accessallowed = 1; } $original_file = $conf->ficheinter->dir_output.'/'.$original_file; - } // Wrapping pour les apercu conat - elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) { + } elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) { + // Wrapping pour les apercu contrat if ($fuser->rights->contrat->{$lire}) { $accessallowed = 1; } $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu supplier proposal - elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { + } elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { + // Wrapping pour les apercu supplier proposal if ($fuser->rights->supplier_proposal->{$lire}) { $accessallowed = 1; } $original_file = $conf->supplier_proposal->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier order - elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) { + } elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) { + // Wrapping pour les apercu supplier order if ($fuser->rights->fournisseur->commande->{$lire}) { $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier invoice - elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) { + } elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) { + // Wrapping pour les apercu supplier invoice if ($fuser->rights->fournisseur->facture->{$lire}) { $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier invoice - elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { + } elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { + // Wrapping pour les apercu supplier invoice if ($fuser->rights->expensereport->{$lire}) { $accessallowed = 1; } $original_file = $conf->expensereport->dir_output.'/'.$original_file; - } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { + } elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { + // Wrapping pour les images des stats propales if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file; - } // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { + } elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { + // Wrapping pour les images des stats commandes if ($fuser->rights->commande->{$lire}) { $accessallowed = 1; } @@ -2365,8 +2375,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { + } elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { + // Wrapping pour les images des stats factures if ($fuser->rights->facture->{$lire}) { $accessallowed = 1; } @@ -2376,45 +2386,45 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { + } elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->expedition->{$lire}) { $accessallowed = 1; } $original_file = $conf->expedition->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { + } elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->deplacement->{$lire}) { $accessallowed = 1; } $original_file = $conf->deplacement->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { + } elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->adherent->{$lire}) { $accessallowed = 1; } $original_file = $conf->adherent->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) { + } elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) { + // Wrapping pour les images des stats produits if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) { $accessallowed = 1; } $original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file; - } // Wrapping for taxes - elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { + } elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { + // Wrapping for taxes if ($fuser->rights->tax->charges->{$lire}) { $accessallowed = 1; } $modulepartsuffix = str_replace('tax-', '', $modulepart); $original_file = $conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file; - } // Wrapping for events - elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + // Wrapping for events if ($fuser->rights->agenda->myactions->{$read}) { $accessallowed = 1; } $original_file = $conf->agenda->dir_output.'/'.$original_file; - } // Wrapping for categories - elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity])) { + } elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity])) { + // Wrapping for categories if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2422,44 +2432,44 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->categorie->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { + } elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { + // Wrapping pour les prelevements if ($fuser->rights->prelevement->bons->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->prelevement->dir_output.'/'.$original_file; - } // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { + } elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { + // Wrapping pour les graph energie $accessallowed = 1; $original_file = $conf->stock->dir_temp.'/'.$original_file; - } // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { + } elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { + // Wrapping pour les graph fournisseurs $accessallowed = 1; $original_file = $conf->fournisseur->dir_temp.'/'.$original_file; - } // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { + } elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { + // Wrapping pour les graph des produits $accessallowed = 1; $original_file = $conf->product->multidir_temp[$entity].'/'.$original_file; - } // Wrapping pour les code barre - elseif ($modulepart == 'barcode') { + } elseif ($modulepart == 'barcode') { + // Wrapping pour les code barre $accessallowed = 1; // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file = ''; - } // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { + } elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { + // Wrapping pour les icones de background des mailings $accessallowed = 1; $original_file = $conf->mailing->dir_temp.'/'.$original_file; - } // Wrapping pour le scanner - elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + // Wrapping pour le scanner $accessallowed = 1; $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { + } elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { + // Wrapping pour les images fckeditor $accessallowed = 1; $original_file = $conf->fckeditor->dir_output.'/'.$original_file; - } // Wrapping for users - elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { + } elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { + // Wrapping for users $canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire}); if ($fuser->id == (int) $refname) { $canreaduser = 1; @@ -2468,8 +2478,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->user->dir_output.'/'.$original_file; - } // Wrapping for third parties - elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity])) { + } elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity])) { + // Wrapping for third parties if (empty($entity) || empty($conf->societe->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2478,8 +2488,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->societe->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe').")"; - } // Wrapping for contact - elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { + } elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { + // Wrapping for contact if (empty($entity) || empty($conf->societe->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2487,15 +2497,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->societe->multidir_output[$entity].'/contact/'.$original_file; - } // Wrapping for invoices - elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) { + } elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) { + // Wrapping for invoices if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('invoice').")"; - } // Wrapping for mass actions - elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) { + } elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping for mass actions if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2545,36 +2555,36 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; - } // Wrapping for interventions - elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { + } elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { + // Wrapping for interventions if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->ficheinter->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les deplacements et notes de frais - elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { + } elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { + // Wrapping pour les deplacements et notes de frais if ($fuser->rights->deplacement->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->deplacement->dir_output.'/'.$original_file; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les propales - elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { + } elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping pour les propales if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('propal').")"; - } // Wrapping pour les commandes - elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity])) { + } elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity])) { + // Wrapping pour les commandes if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")"; - } // Wrapping pour les projets - elseif ($modulepart == 'project' && !empty($conf->projet->dir_output)) { + } elseif ($modulepart == 'project' && !empty($conf->projet->dir_output)) { + // Wrapping pour les projets if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2586,29 +2596,29 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")"; - } // Wrapping pour les commandes fournisseurs - elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { + } elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { + // Wrapping pour les commandes fournisseurs if ($fuser->rights->fournisseur->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les factures fournisseurs - elseif (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { + } elseif (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { + // Wrapping pour les factures fournisseurs if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les rapport de paiements - elseif ($modulepart == 'supplier_payment') { + } elseif ($modulepart == 'supplier_payment') { + // Wrapping pour les rapport de paiements if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les rapport de paiements - elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { + } elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { + // Wrapping pour les rapport de paiements if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2617,38 +2627,38 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } else { $original_file = $conf->facture->dir_output.'/payments/'.$original_file; } - } // Wrapping for accounting exports - elseif ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { + } elseif ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { + // Wrapping for accounting exports if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->accounting->dir_output.'/'.$original_file; - } // Wrapping pour les expedition - elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { + } elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { + // Wrapping pour les expedition if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/sending/".$original_file; - } // Delivery Note Wrapping - elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { + } elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { + // Delivery Note Wrapping if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/receipt/".$original_file; - } // Wrapping pour les actions - elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + // Wrapping pour les actions if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->agenda->dir_output.'/'.$original_file; - } // Wrapping pour les actions - elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { + } elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { + // Wrapping pour les actions if ($fuser->rights->agenda->allactions->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->agenda->dir_temp."/".$original_file; - } // Wrapping pour les produits et services - elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') { + } elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') { + // Wrapping pour les produits et services if (empty($entity) || (empty($conf->product->multidir_output[$entity]) && empty($conf->service->multidir_output[$entity]))) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2660,8 +2670,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } elseif (!empty($conf->service->enabled)) { $original_file = $conf->service->multidir_output[$entity].'/'.$original_file; } - } // Wrapping pour les lots produits - elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot') { + } elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot') { + // Wrapping pour les lots produits if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2671,8 +2681,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (!empty($conf->productbatch->enabled)) { $original_file = $conf->productbatch->multidir_output[$entity].'/'.$original_file; } - } // Wrapping for stock movements - elseif ($modulepart == 'movement' || $modulepart == 'mouvement') { + } elseif ($modulepart == 'movement' || $modulepart == 'mouvement') { + // Wrapping for stock movements if (empty($entity) || empty($conf->stock->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2682,89 +2692,89 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (!empty($conf->stock->enabled)) { $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } - } // Wrapping pour les contrats - elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { + } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { + // Wrapping pour les contrats if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")"; - } // Wrapping pour les dons - elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) { + } elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) { + // Wrapping pour les dons if ($fuser->rights->don->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->don->dir_output.'/'.$original_file; - } // Wrapping pour les dons - elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output)) { + } elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output)) { + // Wrapping pour les dons if ($fuser->rights->resource->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->resource->dir_output.'/'.$original_file; - } // Wrapping pour les remises de cheques - elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { + } elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { + // Wrapping pour les remises de cheques if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result - } // Wrapping for bank - elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { + } elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { + // Wrapping for bank if ($fuser->rights->banque->{$lire}) { $accessallowed = 1; } $original_file = $conf->bank->dir_output.'/'.$original_file; - } // Wrapping for export module - elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) { + } elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) { + // Wrapping for export module // Aucun test necessaire car on force le rep de download sur // le rep export qui est propre a l'utilisateur $accessallowed = 1; $original_file = $conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // Wrapping for import module - elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) { + } elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) { + // Wrapping for import module $accessallowed = 1; $original_file = $conf->import->dir_temp.'/'.$original_file; - } // Wrapping pour l'editeur wysiwyg - elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { + } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { + // Wrapping pour l'editeur wysiwyg $accessallowed = 1; $original_file = $conf->fckeditor->dir_output.'/'.$original_file; - } // Wrapping for backups - elseif ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { + } elseif ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { + // Wrapping for backups if ($fuser->admin) { $accessallowed = 1; } $original_file = $conf->admin->dir_output.'/'.$original_file; - } // Wrapping for upload file test - elseif ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { + } elseif ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { + // Wrapping for upload file test if ($fuser->admin) { $accessallowed = 1; } $original_file = $conf->admin->dir_temp.'/'.$original_file; - } // Wrapping pour BitTorrent - elseif ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { + } elseif ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { + // Wrapping pour BitTorrent $accessallowed = 1; $dir = 'files'; if (dol_mimetype($original_file) == 'application/x-bittorrent') { $dir = 'torrents'; } $original_file = $conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file; - } // Wrapping pour Foundation module - elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { + } elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { + // Wrapping pour Foundation module if ($fuser->rights->adherent->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->adherent->dir_output.'/'.$original_file; - } // Wrapping for Scanner - elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + // Wrapping for Scanner $accessallowed = 1; $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // GENERIC Wrapping - // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser - // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp - // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser - // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart - // If modulepart=module-abc Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart - else { + // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser + // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp + // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser + // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart + // If modulepart=module-abc Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart + } else { + // GENERIC Wrapping //var_dump($modulepart); //var_dump($original_file); if (preg_match('/^specimen/i', $original_file)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e296fa5874e..801750beef8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -200,31 +200,39 @@ function getBrowserInfo($user_agent) // Name $reg = array(); if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'firefox'; $version = $reg[2]; + $name = 'firefox'; + $version = $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'edge'; $version = $reg[2]; + $name = 'edge'; + $version = $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { - $name = 'chrome'; $version = $reg[2]; - } // we can have 'chrome (Mozilla...) chrome x.y' in one string - elseif (preg_match('/chrome/i', $user_agent, $reg)) { + $name = 'chrome'; + $version = $reg[2]; + } elseif (preg_match('/chrome/i', $user_agent, $reg)) { + // we can have 'chrome (Mozilla...) chrome x.y' in one string $name = 'chrome'; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name = 'iceweasel'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'safari'; $version = $reg[2]; - } // Safari is often present in string for mobile but its not. - elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'opera'; $version = $reg[2]; + $name = 'safari'; + $version = $reg[2]; + } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { + // Safari is often present in string for mobile but its not. + $name = 'opera'; + $version = $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { - $name = 'ie'; $version = end($reg); - } // MS products at end - elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { - $name = 'ie'; $version = end($reg); - } // MS products at end - elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { - $name = 'lynxlinks'; $version = $reg[4]; + $name = 'ie'; + $version = end($reg); + } elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { + // MS products at end + $name = 'ie'; + $version = end($reg); + } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { + // MS products at end + $name = 'lynxlinks'; + $version = $reg[4]; } if ($tablet) { @@ -253,9 +261,11 @@ function getBrowserInfo($user_agent) function dol_shutdown() { global $conf, $user, $langs, $db; - $disconnectdone = false; $depth = 0; + $disconnectdone = false; + $depth = 0; if (is_object($db) && !empty($db->connected)) { - $depth = $db->transaction_opened; $disconnectdone = $db->close(); + $depth = $db->transaction_opened; + $disconnectdone = $db->close(); } dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO)); } @@ -393,8 +403,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; } - } // Else, retrieve default values if we are not doing a sort - elseif (!isset($_GET['sortfield'])) { // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set + } elseif (!isset($_GET['sortfield'])) { + // Else, retrieve default values if we are not doing a sort + // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set if (!empty($_GET['action']) && $_GET['action'] == 'create' && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { // Search default value from $object->field global $object; @@ -435,12 +446,15 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } } } - } // Management of default search_filters and sort order - elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { - if (!empty($user->default_values)) { // $user->default_values defined from menu 'Setup - Default values' + } elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { + // Management of default search_filters and sort order + if (!empty($user->default_values)) { + // $user->default_values defined from menu 'Setup - Default values' //var_dump($user->default_values[$relativepathstring]); - if ($paramname == 'sortfield' || $paramname == 'sortorder') { // Sorted on which fields ? ASC or DESC ? - if (isset($user->default_values[$relativepathstring]['sortorder'])) { // Even if paramname is sortfield, data are stored into ['sortorder...'] + if ($paramname == 'sortfield' || $paramname == 'sortorder') { + // Sorted on which fields ? ASC or DESC ? + if (isset($user->default_values[$relativepathstring]['sortorder'])) { + // Even if paramname is sortfield, data are stored into ['sortorder...'] foreach ($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval) { $qualified = 0; if ($defkey != '_noquery_') { @@ -524,9 +538,11 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { $reg = array(); - $maxloop = 20; $loopnb = 0; // Protection against infinite loop + $maxloop = 20; + $loopnb = 0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. - $loopnb++; $newout = ''; + $loopnb++; + $newout = ''; if ($reg[1] == 'DAY') { $tmp = dol_getdate(dol_now(), true); @@ -837,13 +853,14 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } } } - if ($returnemptyifnotfound) { // Not found into alternate dir + if ($returnemptyifnotfound) { + // Not found into alternate dir if ($returnemptyifnotfound == 1 || !file_exists($res)) { return ''; } } - } else // For an url path - { + } else { + // For an url path // We try to get local path of file on filesystem from url // Note that trying to know if a file on disk exist by forging path on disk from url // works only for some web server and some setup. This is bugged when @@ -1095,16 +1112,19 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) $substitjs = array("'"=>"\\'", "\r"=>'\\r'); //$substitjs[' '.$data['ip']; } - } // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) - elseif (!empty($_SERVER['SERVER_ADDR'])) { + } elseif (!empty($_SERVER['SERVER_ADDR'])) { + // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) $data['ip'] = $_SERVER['SERVER_ADDR']; - } - // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). - elseif (!empty($_SERVER['COMPUTERNAME'])) { + } elseif (!empty($_SERVER['COMPUTERNAME'])) { + // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']); - } - // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). - elseif (!empty($_SERVER['LOGNAME'])) { + } elseif (!empty($_SERVER['LOGNAME'])) { + // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). $data['ip'] = '???@'.$_SERVER['LOGNAME']; } // Loop on each log handler and send output @@ -1694,7 +1712,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if ($object->element == 'product') { - $width = 80; $cssclass = 'photoref'; + $width = 80; + $cssclass = 'photoref'; $showimage = $object->is_photo_available($conf->product->multidir_output[$entity]); $maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : 5); if ($conf->browser->layout == 'phone') { @@ -1712,7 +1731,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } } } elseif ($object->element == 'ticket') { - $width = 80; $cssclass = 'photoref'; + $width = 80; + $cssclass = 'photoref'; $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->ref); $maxvisiblephotos = (isset($conf->global->TICKET_MAX_VISIBLE_PHOTO) ? $conf->global->TICKET_MAX_VISIBLE_PHOTO : 2); if ($conf->browser->layout == 'phone') { @@ -1812,7 +1832,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $cssclass = 'photorefcenter'; $nophoto = img_picto('No photo', 'title_agenda'); } else { - $width = 14; $cssclass = 'photorefcenter'; + $width = 14; + $cssclass = 'photorefcenter'; $picto = $object->picto; if ($object->element == 'project' && !$object->public) { $picto = 'project'; // instead of projectpub @@ -2000,7 +2021,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address); } // Zip/Town/State - if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country + if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { + // US: title firstname name \n address lines \n town, state, zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($ret ? $sep : '').$town; if (!empty($object->state)) { @@ -2009,7 +2031,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if ($object->zip) { $ret .= ($ret ? ", " : '').$object->zip; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { + // UK: title firstname name \n address lines \n town state \n zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($ret ? $sep : '').$town; if (!empty($object->state)) { @@ -2018,14 +2041,16 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if ($object->zip) { $ret .= ($ret ? $sep : '').$object->zip; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { + // ES: title firstname name \n address lines \n zip town \n state \n country $ret .= ($ret ? $sep : '').$object->zip; $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); if (!empty($object->state)) { $ret .= "\n".$object->state; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { + // IT: tile firstname name\n address lines \n zip (Code Departement) \n country $ret .= ($ret ? $sep : '').$object->zip; $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); @@ -2129,7 +2154,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); if ($formatwithoutreduce != $format) { - $format = $formatwithoutreduce; $reduceformat = 1; + $format = $formatwithoutreduce; + $reduceformat = 1; } // so format 'dayreduceformat' is processed like day // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. @@ -2152,9 +2178,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); } elseif ($format == 'dayhourtextshort') { $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); - } - // Format not sensitive to language - elseif ($format == 'dayhourlog') { + } elseif ($format == 'dayhourlog') { + // Format not sensitive to language $format = '%Y%m%d%H%M%S'; } elseif ($format == 'dayhourldap') { $format = '%Y%m%d%H%M%SZ'; @@ -2440,13 +2465,13 @@ function dol_now($mode = 'auto') require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time $ret = (int) (dol_now('gmt') + ($tzsecond * 3600)); - } /*elseif ($mode == 'tzref') // Time for now with parent company timezone is added - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time - $ret=dol_now('gmt')+($tzsecond*3600); - }*/ - elseif ($mode == 'tzuser' || $mode == 'tzuserrel') { // Time for now with user timezone added + //} elseif ($mode == 'tzref') {// Time for now with parent company timezone is added + // require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + // $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time + // $ret=dol_now('gmt')+($tzsecond*3600); + //} + } elseif ($mode == 'tzuser' || $mode == 'tzuserrel') { + // Time for now with user timezone added //print 'time: '.time(); $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; @@ -2570,7 +2595,8 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, } if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - $type = 'AC_EMAIL'; $link = ''; + $type = 'AC_EMAIL'; + $link = ''; if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) { $link = ''.img_object($langs->trans("AddAction"), "calendar").''; } @@ -2938,7 +2964,8 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - $type = 'AC_TEL'; $link = ''; + $type = 'AC_TEL'; + $link = ''; if ($addlink == 'AC_FAX') { $type = 'AC_FAX'; } @@ -3453,7 +3480,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithouttext = str_replace('object_', '', $pictowithouttext); $fakey = $pictowithouttext; - $facolor = ''; $fasize = ''; + $facolor = ''; + $fasize = ''; $fa = 'fas'; if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { $fa = 'far'; @@ -5011,7 +5039,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ $nbdecimal = $rounding; // Output separators by default (french) - $dec = ','; $thousand = ' '; + $dec = ','; + $thousand = ' '; // If $outlangs not forced, we use use language if (!is_object($outlangs)) { @@ -5113,7 +5142,8 @@ function price2num($amount, $rounding = '', $option = 0) // Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56' // Numbers must be '1234.56' // Decimal delimiter for PHP and database SQL requests must be '.' - $dec = ','; $thousand = ' '; + $dec = ','; + $thousand = ' '; if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); } @@ -5904,7 +5934,8 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id function yn($yesno, $case = 1, $color = 0) { global $langs; - $result = 'unknown'; $classname = ''; + $result = 'unknown'; + $classname = ''; if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0 $result = $langs->trans('yes'); if ($case == 1 || $case == 3) { @@ -6254,8 +6285,8 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') $text = strtr($text, $repTable); if ($charset == 'UTF-8') { $pattern = '/(]*>)/Uu'; - } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support - else { + } else { + // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. } $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); @@ -6421,9 +6452,11 @@ function dol_string_is_good_iso($s, $clean = 0) $ordchar = ord($s[$scursor]); //print $scursor.'-'.$ordchar.'
'; if ($ordchar < 32 && $ordchar != 13 && $ordchar != 10) { - $ok = 0; break; + $ok = 0; + break; } elseif ($ordchar > 126 && $ordchar < 160) { - $ok = 0; break; + $ok = 0; + break; } elseif ($clean) { $out .= $s[$scursor]; } @@ -6473,8 +6506,8 @@ function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8') $text = strtr($text, $repTable); if ($charset == 'UTF-8') { $pattern = '/(]*>)/Uu'; - } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support - else { + } else { + // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. } $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); @@ -7413,7 +7446,8 @@ function get_htmloutput_mesg($mesgstring = '', $mesgarray = '', $style = 'ok', $ { global $conf, $langs; - $ret = 0; $return = ''; + $ret = 0; + $return = ''; $out = ''; $divstart = $divend = ''; @@ -7507,10 +7541,12 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o if (is_array($mesgarray)) { foreach ($mesgarray as $val) { if ($val && preg_match('/class="error"/i', $val)) { - $iserror++; break; + $iserror++; + break; } if ($val && preg_match('/class="warning"/i', $val)) { - $iswarning++; break; + $iswarning++; + break; } } } elseif ($mesgstring && preg_match('/class="error"/i', $mesgstring)) { @@ -8515,7 +8551,8 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $j = 0; foreach ($crits as $crit) { $crit = trim($crit); - $i = 0; $i2 = 0; + $i = 0; + $i2 = 0; $newres = ''; foreach ($fields as $field) { if ($mode == 1) { @@ -8595,7 +8632,8 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $tmpcrit = trim($tmpcrit); $tmpcrit2 = $tmpcrit; - $tmpbefore = '%'; $tmpafter = '%'; + $tmpbefore = '%'; + $tmpafter = '%'; if (preg_match('/^[\^\$]/', $tmpcrit)) { $tmpbefore = ''; $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2); @@ -8810,209 +8848,357 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) // Plain text files if (preg_match('/\.txt$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.rtx$/i', $tmpfile)) { - $mime = 'text/richtext'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/richtext'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.csv$/i', $tmpfile)) { - $mime = 'text/csv'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/csv'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.tsv$/i', $tmpfile)) { - $mime = 'text/tab-separated-values'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/tab-separated-values'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.ini$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'ini'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'ini'; + $famime = 'file-text-o'; } if (preg_match('/\.md$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'md'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'md'; + $famime = 'file-text-o'; } if (preg_match('/\.css$/i', $tmpfile)) { - $mime = 'text/css'; $imgmime = 'css.png'; $srclang = 'css'; $famime = 'file-text-o'; + $mime = 'text/css'; + $imgmime = 'css.png'; + $srclang = 'css'; + $famime = 'file-text-o'; } if (preg_match('/\.lang$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'lang'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'lang'; + $famime = 'file-text-o'; } // Certificate files if (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } // XML based (HTML/XML/XAML) if (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { - $mime = 'text/html'; $imgmime = 'html.png'; $srclang = 'html'; $famime = 'file-text-o'; + $mime = 'text/html'; + $imgmime = 'html.png'; + $srclang = 'html'; + $famime = 'file-text-o'; } if (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { - $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xml'; $famime = 'file-text-o'; + $mime = 'text/xml'; + $imgmime = 'other.png'; + $srclang = 'xml'; + $famime = 'file-text-o'; } if (preg_match('/\.xaml$/i', $tmpfile)) { - $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xaml'; $famime = 'file-text-o'; + $mime = 'text/xml'; + $imgmime = 'other.png'; + $srclang = 'xaml'; + $famime = 'file-text-o'; } // Languages if (preg_match('/\.bas$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'bas'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'bas'; + $famime = 'file-code-o'; } if (preg_match('/\.(c)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'c'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'c'; + $famime = 'file-code-o'; } if (preg_match('/\.(cpp)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cpp'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'cpp'; + $famime = 'file-code-o'; } if (preg_match('/\.cs$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'cs'; + $famime = 'file-code-o'; } if (preg_match('/\.(h)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'h'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'h'; + $famime = 'file-code-o'; } if (preg_match('/\.(java|jsp)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'java'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'java'; + $famime = 'file-code-o'; } if (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'php.png'; + $srclang = 'php'; + $famime = 'file-code-o'; } if (preg_match('/\.phtml$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'php.png'; + $srclang = 'php'; + $famime = 'file-code-o'; } if (preg_match('/\.(pl|pm)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'pl.png'; $srclang = 'perl'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'pl.png'; + $srclang = 'perl'; + $famime = 'file-code-o'; } if (preg_match('/\.sql$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'sql'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'sql'; + $famime = 'file-code-o'; } if (preg_match('/\.js$/i', $tmpfile)) { - $mime = 'text/x-javascript'; $imgmime = 'jscript.png'; $srclang = 'js'; $famime = 'file-code-o'; + $mime = 'text/x-javascript'; + $imgmime = 'jscript.png'; + $srclang = 'js'; + $famime = 'file-code-o'; } // Open office if (preg_match('/\.odp$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.presentation'; $imgmime = 'ooffice.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/vnd.oasis.opendocument.presentation'; + $imgmime = 'ooffice.png'; + $famime = 'file-powerpoint-o'; } if (preg_match('/\.ods$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.spreadsheet'; $imgmime = 'ooffice.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.oasis.opendocument.spreadsheet'; + $imgmime = 'ooffice.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.odt$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.text'; $imgmime = 'ooffice.png'; $famime = 'file-word-o'; + $mime = 'application/vnd.oasis.opendocument.text'; + $imgmime = 'ooffice.png'; + $famime = 'file-word-o'; } // MS Office if (preg_match('/\.mdb$/i', $tmpfile)) { - $mime = 'application/msaccess'; $imgmime = 'mdb.png'; $famime = 'file-o'; + $mime = 'application/msaccess'; + $imgmime = 'mdb.png'; + $famime = 'file-o'; } if (preg_match('/\.doc(x|m)?$/i', $tmpfile)) { - $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; + $mime = 'application/msword'; + $imgmime = 'doc.png'; + $famime = 'file-word-o'; } if (preg_match('/\.dot(x|m)?$/i', $tmpfile)) { - $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; + $mime = 'application/msword'; + $imgmime = 'doc.png'; + $famime = 'file-word-o'; } if (preg_match('/\.xlt(x)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xla(m)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xls$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xls(b|m|x)$/i', $tmpfile)) { - $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.pps(m|x)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-powerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/vnd.ms-powerpoint'; + $imgmime = 'ppt.png'; + $famime = 'file-powerpoint-o'; } if (preg_match('/\.ppt(m|x)?$/i', $tmpfile)) { - $mime = 'application/x-mspowerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/x-mspowerpoint'; + $imgmime = 'ppt.png'; + $famime = 'file-powerpoint-o'; } // Other if (preg_match('/\.pdf$/i', $tmpfile)) { - $mime = 'application/pdf'; $imgmime = 'pdf.png'; $famime = 'file-pdf-o'; + $mime = 'application/pdf'; + $imgmime = 'pdf.png'; + $famime = 'file-pdf-o'; } // Scripts if (preg_match('/\.bat$/i', $tmpfile)) { - $mime = 'text/x-bat'; $imgmime = 'script.png'; $srclang = 'dos'; $famime = 'file-code-o'; + $mime = 'text/x-bat'; + $imgmime = 'script.png'; + $srclang = 'dos'; + $famime = 'file-code-o'; } if (preg_match('/\.sh$/i', $tmpfile)) { - $mime = 'text/x-sh'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-sh'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } if (preg_match('/\.ksh$/i', $tmpfile)) { - $mime = 'text/x-ksh'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-ksh'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } if (preg_match('/\.bash$/i', $tmpfile)) { - $mime = 'text/x-bash'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-bash'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } // Images if (preg_match('/\.ico$/i', $tmpfile)) { - $mime = 'image/x-icon'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/x-icon'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) { - $mime = 'image/jpeg'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/jpeg'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.png$/i', $tmpfile)) { - $mime = 'image/png'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/png'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.gif$/i', $tmpfile)) { - $mime = 'image/gif'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/gif'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.bmp$/i', $tmpfile)) { - $mime = 'image/bmp'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/bmp'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.(tif|tiff)$/i', $tmpfile)) { - $mime = 'image/tiff'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/tiff'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.svg$/i', $tmpfile)) { - $mime = 'image/svg+xml'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/svg+xml'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.webp$/i', $tmpfile)) { - $mime = 'image/webp'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/webp'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } // Calendar if (preg_match('/\.vcs$/i', $tmpfile)) { - $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; + $mime = 'text/calendar'; + $imgmime = 'other.png'; + $famime = 'file-text-o'; } if (preg_match('/\.ics$/i', $tmpfile)) { - $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; + $mime = 'text/calendar'; + $imgmime = 'other.png'; + $famime = 'file-text-o'; } // Other if (preg_match('/\.torrent$/i', $tmpfile)) { - $mime = 'application/x-bittorrent'; $imgmime = 'other.png'; $famime = 'file-o'; + $mime = 'application/x-bittorrent'; + $imgmime = 'other.png'; + $famime = 'file-o'; } // Audio if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { - $mime = 'audio'; $imgmime = 'audio.png'; $famime = 'file-audio-o'; + $mime = 'audio'; + $imgmime = 'audio.png'; + $famime = 'file-audio-o'; } // Video if (preg_match('/\.ogv$/i', $tmpfile)) { - $mime = 'video/ogg'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/ogg'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.webm$/i', $tmpfile)) { - $mime = 'video/webm'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/webm'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.avi$/i', $tmpfile)) { - $mime = 'video/x-msvideo'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/x-msvideo'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.divx$/i', $tmpfile)) { - $mime = 'video/divx'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/divx'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.xvid$/i', $tmpfile)) { - $mime = 'video/xvid'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/xvid'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) { - $mime = 'video'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } // Archive if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i', $tmpfile)) { - $mime = 'archive'; $imgmime = 'archive.png'; $famime = 'file-archive-o'; + $mime = 'archive'; + $imgmime = 'archive.png'; + $famime = 'file-archive-o'; } // application/xxx where zzz is zip, ... // Exe if (preg_match('/\.(exe|com)$/i', $tmpfile)) { - $mime = 'application/octet-stream'; $imgmime = 'other.png'; $famime = 'file-o'; + $mime = 'application/octet-stream'; + $imgmime = 'other.png'; + $famime = 'file-o'; } // Lib if (preg_match('/\.(dll|lib|o|so|a)$/i', $tmpfile)) { - $mime = 'library'; $imgmime = 'library.png'; $famime = 'file-o'; + $mime = 'library'; + $imgmime = 'library.png'; + $famime = 'file-o'; } // Err if (preg_match('/\.err$/i', $tmpfile)) { - $mime = 'error'; $imgmime = 'error.png'; $famime = 'file-text-o'; + $mime = 'error'; + $imgmime = 'error.png'; + $famime = 'file-text-o'; } // Return string @@ -9129,7 +9315,8 @@ function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal $found = 0; foreach ($tmploops as $tmploop) { if (in_array($tmploop, $listofmodulesforexternal)) { - $found++; break; + $found++; + break; } } if (!$found) { @@ -9251,8 +9438,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = !empty($html) ? $html : (empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)); } elseif ($displayMode == 1) { $return = !empty($html) ? $html : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); - } // Use status with images (for backward compatibility) - elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) { + } elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) { + // Use status with images (for backward compatibility) $return = ''; $htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : $statusLabel).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); $htmlLabelShort = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel)).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); @@ -9299,8 +9486,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st } else { // $displayMode >= 6 $return = $htmlLabel.' '.$htmlImg; } - } // Use new badge - elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { + } elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { + // Use new badge $statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); $dolGetBadgeParams['attr']['class'] = 'badge-status'; @@ -9857,17 +10044,15 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) // Solution 0 if ($method == 0) { readfile($fullpath_original_file_osencoded); - } - // Solution 1 - elseif ($method == 1) { + } elseif ($method == 1) { + // Solution 1 $handle = fopen($fullpath_original_file_osencoded, "rb"); while (!feof($handle)) { print fread($handle, 8192); } fclose($handle); - } - // Solution 2 - elseif ($method == 2) { + } elseif ($method == 2) { + // Solution 2 $handle1 = fopen($fullpath_original_file_osencoded, "rb"); $handle2 = fopen("php://output", "wb"); stream_copy_to_stream($handle1, $handle2); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2e81af654cf..9fd7f5e7e8a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1090,9 +1090,11 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ // Define posy, posm and reg if ($maskraz > 1) { // if reset is not first month, we need month and year into mask if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 3; + $posy = 2; + $posm = 3; } elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 3; $posm = 2; + $posy = 3; + $posm = 2; } else { return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; } @@ -1103,11 +1105,14 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } else // if reset is for a specific month in year, we need year { if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 3; $posm = 2; + $posy = 3; + $posm = 2; } elseif (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 3; + $posy = 2; + $posm = 3; } elseif (preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 0; + $posy = 2; + $posm = 0; } else { return 'ErrorCantUseRazIfNoYearInMask'; } @@ -1892,7 +1897,8 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (is_dir($tmpdir)) { // all type of template is allowed @@ -2128,7 +2134,8 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') } // Generic case for $classfile and $classname - $classfile = strtolower($myobject); $classname = ucfirst($myobject); + $classfile = strtolower($myobject); + $classname = ucfirst($myobject); //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath; if ($objecttype == 'invoice_supplier') { @@ -2227,7 +2234,8 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) // Check depth //print 'Analyse record id='.$id.' with parent '.$pid.'
'; - $cursor = $id; $arrayidparsed = array(); // We start from child $id + $cursor = $id; + $arrayidparsed = array(); // We start from child $id while ($cursor > 0) { $arrayidparsed[$cursor] = 1; if ($arrayidparsed[$listofparentid[$cursor]]) { // We detect a loop. A record with a parent that was already into child @@ -2627,7 +2635,8 @@ if (!function_exists('dolEscapeXML')) { function autoOrManual($automaticmanual, $case = 1, $color = 0) { global $langs; - $result = 'unknown'; $classname = ''; + $result = 'unknown'; + $classname = ''; if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') { // A mettre avant test sur no a cause du == 0 $result = $langs->trans('automatic'); if ($case == 1 || $case == 3) { diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index ed7d5b1efcc..7041eabfc5e 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,8 +23,10 @@ */ // Define size of logo small and mini -$maxwidthsmall = 480; $maxheightsmall = 270; // Near 16/9eme -$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme +$maxwidthsmall = 480; +$maxheightsmall = 270; // Near 16/9eme +$maxwidthmini = 128; +$maxheightmini = 72; // 16/9eme $quality = 80; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 9e7d4f8d55a..2bd8707f86b 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -62,7 +62,8 @@ function commande_prepare_head(Commande $object) if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire)) { - $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; + $nbShipments = $object->getNbOfShipments(); + $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; if ($conf->expedition_bon->enabled) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 08559c3ebd6..6e2ad1c2f05 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -49,7 +49,9 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') dol_syslog("pdf_getFormat Get paper format with mode=".$mode." MAIN_PDF_FORMAT=".(empty($conf->global->MAIN_PDF_FORMAT) ? 'null' : $conf->global->MAIN_PDF_FORMAT)." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')." and langs->defaultlang=".(is_object($langs) ? $langs->defaultlang : 'null')); // Default value if setup was not done and/or entry into c_paper_format not defined - $width = 210; $height = 297; $unit = 'mm'; + $width = 210; + $height = 297; + $unit = 'mm'; if ($mode == 'auto' || empty($conf->global->MAIN_PDF_FORMAT) || $conf->global->MAIN_PDF_FORMAT == 'auto') { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -725,7 +727,8 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) $text = make_substitutions($text, $substitutionarray, $outputlangs); $text = $outputlangs->convToOutputCharset($text); - $savx = $pdf->getX(); $savy = $pdf->getY(); + $savx = $pdf->getX(); + $savy = $pdf->getY(); $watermark_angle = atan($h / $w) / 2; $watermark_x_pos = 0; @@ -961,7 +964,10 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } // First line of company infos - $line1 = ""; $line2 = ""; $line3 = ""; $line4 = ""; + $line1 = ""; + $line2 = ""; + $line3 = ""; + $line4 = ""; if ($showdetails == 1 || $showdetails == 3) { // Company name @@ -1086,9 +1092,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ if ($line) { // Free text //$line="sample text
\nfdsfsdf
\nghfghg
"; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { - $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. + $width = 20000; + $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { - $width = 200; $align = 'C'; + $width = 200; + $align = 'C'; } $freetextheight = $pdf->getStringHeight($width, $line); } else { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 5702240e94c..2b35c2c7779 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1125,7 +1125,8 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec print dol_print_date($lines[$i]->timespent_datehour, 'day'); print ''; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1480,7 +1481,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1870,7 +1872,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1887,7 +1890,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ //var_dump($projectstatic->weekWorkLoadPerTask); // Fields to show current time - $tableCell = ''; $modeinput = 'hours'; + $tableCell = ''; + $modeinput = 'hours'; for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); @@ -2148,7 +2152,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -2165,7 +2170,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //var_dump($projectstatic->weekWorkLoadPerTask); //TODO // Fields to show current time - $tableCell = ''; $modeinput = 'hours'; + $tableCell = ''; + $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; foreach ($TFirstDay as &$fday) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6b95187e5df..a4299e925df 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -207,10 +207,13 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f $features = 'adherent'; } if ($features == 'subscription') { - $features = 'adherent'; $feature2 = 'cotisation'; + $features = 'adherent'; + $feature2 = 'cotisation'; }; if ($features == 'websitepage') { - $features = 'website'; $tableandshare = 'website_page'; $parentfortableentity = 'fk_website@website'; + $features = 'website'; + $tableandshare = 'website_page'; + $parentfortableentity = 'fk_website@website'; } if ($features == 'project') { $features = 'projet'; @@ -252,48 +255,58 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); // Check read permission from module - $readok = 1; $nbko = 0; + $readok = 1; + $nbko = 0; foreach ($featuresarray as $feature) { // first we check nb of test ko $featureforlistofmodule = $feature; if ($featureforlistofmodule == 'produit') { $featureforlistofmodule = 'product'; } if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users - $readok = 0; $nbko++; + $readok = 0; + $nbko++; continue; } if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'payment') { if (!$user->rights->facture->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'payment_supplier') { if (!$user->rights->fournisseur->facture->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif (!empty($feature2)) { // This is for permissions on 2 levels $tmpreadok = 1; @@ -306,7 +319,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok = 0; } else { - $tmpreadok = 1; break; + $tmpreadok = 1; + break; } // Break is to bypass second test if the first is ok } if (!$tmpreadok) { // We found a test on feature that is ko @@ -317,7 +331,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (empty($user->rights->$feature->lire) && empty($user->rights->$feature->read) && empty($user->rights->$feature->run)) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } } @@ -333,7 +348,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f //print "Read access is ok"; // Check write permission from module (we need to know write permission to create but also to delete drafts record or to upload files) - $createok = 1; $nbko = 0; + $createok = 1; + $nbko = 0; $wemustcheckpermissionforcreate = (GETPOST('sendit', 'alpha') || GETPOST('linkit', 'alpha') || GETPOST('action', 'aZ09') == 'create' || GETPOST('action', 'aZ09') == 'update'); $wemustcheckpermissionfordeletedraft = ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete'); @@ -341,35 +357,43 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f foreach ($featuresarray as $feature) { if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'import') { if (!$user->rights->import->run) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif (!empty($feature2)) { // This is for permissions on one level foreach ($feature2 as $subfeature) { @@ -427,7 +451,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f } // Check delete permission from module - $deleteok = 1; $nbko = 0; + $deleteok = 1; + $nbko = 0; if ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete') { foreach ($featuresarray as $feature) { if ($feature == 'contact') { @@ -471,7 +496,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) { $deleteok = 0; } else { - $deleteok = 1; break; + $deleteok = 1; + break; } // For bypass the second test if the first is ok } } elseif (!empty($feature)) { // This is used for permissions on 1 level @@ -622,22 +648,23 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.fk_soc = ".$user->socid; - } // If internal user: Check permission for internal users that are restricted on their objects - elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { + } elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { + // If internal user: Check permission for internal users that are restricted on their objects $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON dbt.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; - } // If multicompany and internal users with all permissions, check user is in correct entity - elseif (!empty($conf->multicompany->enabled)) { + } elseif (!empty($conf->multicompany->enabled)) { + // If multicompany and internal users with all permissions, check user is in correct entity $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } - if ($feature == 'agenda') {// Also check owner or attendee for users without allactions->read + if ($feature == 'agenda') { + // Also check owner or attendee for users without allactions->read if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $action = new ActionComm($db); @@ -712,8 +739,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND (sc.fk_user = ".$user->id." OR sc.fk_user IS NULL)"; } - } // If multicompany and internal users with all permissions, check user is in correct entity - elseif (!empty($conf->multicompany->enabled)) { + } elseif (!empty($conf->multicompany->enabled)) { + // If multicompany and internal users with all permissions, check user is in correct entity $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 9181b3dd07d..523b8ccf2cb 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -179,7 +179,8 @@ if (!function_exists('dol_loginfunction')) { foreach ($dirtpls as $reldir) { $tmp = dol_buildpath($reldir.'login.tpl.php'); if (file_exists($tmp)) { - $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; + $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); + break; } } } else { @@ -322,14 +323,20 @@ function makesalt($type = CRYPT_SALT_LENGTH) dol_syslog("makesalt type=".$type); switch ($type) { case 12: // 8 + 4 - $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; + $saltlen = 8; + $saltprefix = '$1$'; + $saltsuffix = '$'; break; case 8: // 8 (Pour compatibilite, ne devrait pas etre utilise) - $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; + $saltlen = 8; + $saltprefix = '$1$'; + $saltsuffix = '$'; break; case 2: // 2 default: // by default, fall back on Standard DES (should work everywhere) - $saltlen = 2; $saltprefix = ''; $saltsuffix = ''; + $saltlen = 2; + $saltprefix = ''; + $saltsuffix = ''; break; } $salt = ''; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index a20170e3a95..255bc47d9a9 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -156,7 +156,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset continue; } - print ''; $ulprinted++; + print ''; + $ulprinted++; } print "\n".'
  • '; if ($showfk) { @@ -184,7 +185,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset continue; } - print ''; $ulprinted++; + print ''; + $ulprinted++; } print "\n".'
  • '; if ($showfk) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index a01aa02b468..2efeec151a3 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -102,9 +102,8 @@ function dolSavePageAlias($filealias, $object, $objectpage) if (!empty($conf->global->MAIN_UMASK)) { @chmod($filealiassub, octdec($conf->global->MAIN_UMASK)); } - } - // Save also alias into all language subdirectories if it is a main language - elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + } elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + // Save also alias into all language subdirectories if it is a main language if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) { $dirname = dirname($filealias); $filename = basename($filealias); diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index 14d7162358b..ad4688f9134 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -41,27 +41,32 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe if (!$error && ($authentication['dolibarrkey'] != $conf->global->WEBSERVICES_KEY)) { $error++; - $errorcode = 'BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel = 'Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; + $errorcode = 'BAD_VALUE_FOR_SECURITY_KEY'; + $errorlabel = 'Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; } if (!$error && !empty($authentication['entity']) && !is_numeric($authentication['entity'])) { $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; + $errorcode = 'BAD_PARAMETERS'; + $errorlabel = "The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; } if (!$error) { $result = $fuser->fetch('', $authentication['login'], '', 0); if ($result < 0) { $error++; - $errorcode = 'ERROR_FETCH_USER'; $errorlabel = 'A technical error occurred during fetch of user'; + $errorcode = 'ERROR_FETCH_USER'; + $errorlabel = 'A technical error occurred during fetch of user'; } elseif ($result == 0) { $error++; - $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; + $errorcode = 'BAD_CREDENTIALS'; + $errorlabel = 'Bad value for login or password'; } if (!$error && $fuser->statut == 0) { $error++; - $errorcode = 'ERROR_USER_DISABLED'; $errorlabel = 'This user has been locked or disabled'; + $errorcode = 'ERROR_USER_DISABLED'; + $errorlabel = 'This user has been locked or disabled'; } // Validation of login @@ -83,7 +88,8 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe $login = checkLoginPassEntity($authentication['login'], $authentication['password'], $authentication['entity'], $authmode, 'ws'); if (empty($login)) { $error++; - $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; + $errorcode = 'BAD_CREDENTIALS'; + $errorlabel = 'Bad value for login or password'; } } } diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index c06b10f109d..3f77eca1326 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -43,7 +43,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $login = ''; // Get identity from user and redirect browser to OpenID Server - if (GETPOSISSET('username')) { + if (GETPOSTISSET('username')) { $openid = new SimpleOpenID(); $openid->SetIdentity($_POST['username']); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); @@ -59,9 +59,8 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) return false; } return false; - } - // Perform HTTP Request to OpenID server to validate key - elseif ($_GET['openid_mode'] == 'id_res') { + } elseif ($_GET['openid_mode'] == 'id_res') { + // Perform HTTP Request to OpenID server to validate key $openid = new SimpleOpenID(); $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 155a5f55ce0..11dc0a6ce7d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -147,12 +147,11 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ - else { + /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ + } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; } @@ -467,7 +466,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; if (empty($noout)) { - $altok = 0; $blockvmenuopened = false; $lastlevel0 = ''; + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { // Loop on each menu entry $showmenu = true; @@ -591,7 +592,8 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print ''."\n"; } if ($blockvmenuopened) { - print ''."\n"; $blockvmenuopened = false; + print ''."\n"; + $blockvmenuopened = false; } } } @@ -627,7 +629,8 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna $found = 0; foreach ($tmploops as $tmploop) { if (in_array($tmploop, $listofmodulesforexternal)) { - $found++; break; + $found++; + break; } } if (!$found) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fecc57a74e7..e150d07e063 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -516,12 +516,11 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ - else { + /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ + } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; } @@ -1931,7 +1930,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; if (empty($noout)) { - $altok = 0; $blockvmenuopened = false; $lastlevel0 = ''; + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { // Loop on each menu entry $showmenu = true; @@ -2055,7 +2056,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print ''."\n"; } if ($blockvmenuopened) { - print ''."\n"; $blockvmenuopened = false; + print ''."\n"; + $blockvmenuopened = false; } } } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 5ab8ff24f9f..f51aacdd90e 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -370,7 +370,9 @@ class MenuManager } if (empty($noout)) { - $alt = 0; $altok = 0; $blockvmenuopened = false; + $alt = 0; + $altok = 0; + $blockvmenuopened = false; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { $alt++; diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index ea51eea4745..b496e32f5e1 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -96,7 +96,9 @@ function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $h } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 944a285b341..a1cba7f8399 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -199,7 +199,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode return ''; } - $field = 'barcode'; $where = ''; + $field = 'barcode'; + $where = ''; $now = dol_now(); 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 af9207eb1c5..20ce1373b66 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 @@ -128,7 +128,8 @@ class doc_generic_bom_odt extends ModelePDFBom $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index dad731758f7..f5a9fb75976 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -81,7 +81,8 @@ class mod_bom_standard extends ModeleNumRefboms { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_bom_standard extends ModeleNumRefboms if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 5855ec24e55..21c131ad2a6 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -360,7 +360,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Add page break if we do not have space to add current line if ($lineinpage >= ($this->line_per_page - 1)) { - $lineinpage = 0; $yp = 0; + $lineinpage = 0; + $yp = 0; // New page $pdf->AddPage(); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 6e9f03ad927..a882c1e0068 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -78,7 +78,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -90,7 +91,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { 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 1138801a078..33b31135caf 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 @@ -135,7 +135,8 @@ class doc_generic_order_odt extends ModelePDFCommandes $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f8f196a9fa3..ebae616c45b 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -472,7 +472,8 @@ class pdf_einstein extends ModelePDFCommandes // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -896,7 +897,8 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index b64a0066390..17837529354 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -658,7 +658,8 @@ class pdf_eratosthene extends ModelePDFCommandes // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1109,7 +1110,8 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 315a1f27302..0cc9324ef16 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -81,7 +81,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 25cf13f57d9..7b451287ae1 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 @@ -134,7 +134,8 @@ class doc_generic_contract_odt extends ModelePDFContract $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 439ae2ef338..c440cbf1cba 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -415,7 +415,8 @@ class pdf_strato extends ModelePDFContract // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 2506b77e540..6bc09464dba 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -91,7 +91,8 @@ class mod_contract_serpis extends ModelNumRefContracts { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -103,7 +104,8 @@ class mod_contract_serpis extends ModelNumRefContracts if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index ad197f442dd..057310a9976 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -513,7 +513,8 @@ class pdf_storm extends ModelePDFDeliveryOrder // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 3f86dc1ac67..66f232653ac 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -426,7 +426,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/delivery/mod_delivery_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php index c18b1c98e62..605265fde00 100644 --- a/htdocs/core/modules/delivery/mod_delivery_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -94,7 +94,8 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL @@ -106,7 +107,8 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { 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 16161e97a65..82d61a41943 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 @@ -136,7 +136,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c11fb8e60c9..42a777a196f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -523,12 +523,14 @@ class pdf_espadon extends ModelePdfExpedition // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -695,7 +697,8 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', 'B', $default_font_size - 1); // Total table - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index af73123b2d5..f2434c93d26 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -333,7 +333,8 @@ class pdf_merou extends ModelePdfExpedition // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 3); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 4cf93a31b55..c41fd92f524 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -533,12 +533,14 @@ class pdf_rouget extends ModelePdfExpedition // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -700,7 +702,8 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetFont('', 'B', $default_font_size - 1); // Tableau total - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 04cc09c2313..aa1628e7482 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -86,7 +86,8 @@ class mod_expedition_safor extends ModelNumRefExpedition { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -98,7 +99,8 @@ class mod_expedition_safor extends ModelNumRefExpedition if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 9984a9ccc24..d1f959f5460 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -849,7 +849,8 @@ class pdf_standard extends ModeleExpenseReport if ($object->fk_statut == 99) { if ($object->fk_user_refuse > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_refuse); $posy += 6; + $userfee->fetch($object->fk_user_refuse); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -862,7 +863,8 @@ class pdf_standard extends ModeleExpenseReport } elseif ($object->fk_statut == 4) { if ($object->fk_user_cancel > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_cancel); $posy += 6; + $userfee->fetch($object->fk_user_cancel); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -875,7 +877,8 @@ class pdf_standard extends ModeleExpenseReport } else { if ($object->fk_user_approve > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_approve); $posy += 6; + $userfee->fetch($object->fk_user_approve); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -887,7 +890,8 @@ class pdf_standard extends ModeleExpenseReport if ($object->fk_statut == 6) { if ($object->fk_user_paid > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_paid); $posy += 6; + $userfee->fetch($object->fk_user_paid); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index c80bd693620..bbe2245a97d 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -87,7 +87,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -99,7 +100,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 762b9fb89e9..eb48373a443 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 @@ -135,7 +135,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 67e61cb7815..847901c0147 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -584,7 +584,8 @@ class pdf_crabe extends ModelePDFFactures // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1191,7 +1192,8 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index b1072a50008..d7d69fc4a18 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -695,7 +695,8 @@ class pdf_sponge extends ModelePDFFactures // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1284,7 +1285,8 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 5a6df69babd..cd36b4d322a 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -95,7 +95,8 @@ class mod_facture_mars extends ModeleNumRefFactures $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL @@ -107,7 +108,8 @@ class mod_facture_mars extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -129,7 +131,8 @@ class mod_facture_mars extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 9d844953306..2f142a1adc7 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -105,7 +105,8 @@ class mod_facture_terre extends ModeleNumRefFactures $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL @@ -117,7 +118,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -139,7 +141,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -160,7 +163,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixdeposit.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 25a30d3ac84..ac0cb1fac80 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -392,7 +392,8 @@ class pdf_soleil extends ModelePDFFicheinter // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index b4d492e31ce..b2ffe3a7e98 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -89,7 +89,8 @@ class mod_pacific extends ModeleNumRefFicheinter $langs->load("bills"); - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -101,7 +102,8 @@ class mod_pacific extends ModeleNumRefFicheinter if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index ae9ba58726e..8cf79227d4f 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -195,7 +195,9 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index ddec553216d..fd2271198bc 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -92,7 +92,8 @@ class mod_holiday_madonna extends ModelNumRefHolidays { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -104,7 +105,8 @@ class mod_holiday_madonna extends ModelNumRefHolidays if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index f324f268ba3..63a28fbe3d2 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -397,9 +397,8 @@ class ImportCsv extends ModeleImports $this->errors[$error]['type'] = 'NOTNULL'; $errorforthistable++; $error++; - } - // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else { + } else { + // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { //print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. '; @@ -677,9 +676,8 @@ class ImportCsv extends ModeleImports $errorforthistable++; $error++; } - } - // If test is just a static regex - elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { + } elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { + // If test is just a static regex //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."
    "; $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['type'] = 'REGEX'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1f5764c810d..257e8f5253e 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -440,9 +440,8 @@ class ImportXlsx extends ModeleImports $this->errors[$error]['type'] = 'NOTNULL'; $errorforthistable++; $error++; - } - // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else { + } else { + // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { //print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. '; @@ -718,9 +717,8 @@ class ImportXlsx extends ModeleImports $errorforthistable++; $error++; } - } - // If test is just a static regex - elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) { + } elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) { + // If test is just a static regex //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."
    "; $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['type'] = 'REGEX'; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 8e1737b3e9f..5f2ad86c7b5 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -131,7 +131,8 @@ class doc_generic_member_odt extends ModelePDFMember $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index d3fd804a662..1d1a892cc56 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -123,7 +123,8 @@ class pdf_standard extends CommonStickerGenerator $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height); } - $xleft = 2; $ytop = 2; + $xleft = 2; + $ytop = 2; // Top if ($header != '') { @@ -140,16 +141,20 @@ class pdf_standard extends CommonStickerGenerator $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height)); // Define widthtouse and heighttouse - $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); + $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); + $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); $defaultratio = ($maxwidthtouse / $maxheighttouse); - $widthtouse = $maxwidthtouse; $heighttouse = 0; // old value for image + $widthtouse = $maxwidthtouse; + $heighttouse = 0; // old value for image $tmp = dol_getImageSize($photo, false); if ($tmp['height']) { $imgratio = $tmp['width'] / $tmp['height']; if ($imgratio >= $defaultratio) { - $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); + $widthtouse = $maxwidthtouse; + $heighttouse = round($widthtouse / $imgratio); } else { - $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); + $heightouse = $maxheighttouse; + $widthtouse = round($heightouse * $imgratio); } } //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; @@ -312,7 +317,8 @@ class pdf_standard extends CommonStickerGenerator $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index e879bdb3562..0e041a17559 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -114,7 +114,9 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 1f9c75b66b4..63ca0c6ad49 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -305,7 +305,9 @@ class modAdherent extends DolibarrModules 'c.rowid'=>'subscription', 'c.dateadh'=>'subscription', 'c.datef'=>'subscription', 'c.subscription'=>'subscription' ); // Add extra fields - $keyforselect = 'adherent'; $keyforelement = 'member'; $keyforaliasextra = 'extra'; + $keyforselect = 'adherent'; + $keyforelement = 'member'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add axtra fields $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 889bcbb8d0e..b040e4cec99 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -287,14 +287,23 @@ class modBom extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'bom'; - $keyforclass = 'BOM'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bom'; + $keyforclass = 'BOM'; + $keyforclassfile = '/bom/class/bom.class.php'; + $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforclass = 'BOMLine'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bomline'; $keyforalias = 'tl'; + $keyforclass = 'BOMLine'; + $keyforclassfile = '/bom/class/bom.class.php'; + $keyforelement = 'bomline'; + $keyforalias = 'tl'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; unset($this->export_fields_array[$r]['tl.fk_bom']); - $keyforselect = 'bom_bom'; $keyforaliasextra = 'extra'; $keyforelement = 'bom'; + $keyforselect = 'bom_bom'; + $keyforaliasextra = 'extra'; + $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'bom_bomline'; $keyforaliasextra = 'extraline'; $keyforelement = 'bomline'; + $keyforselect = 'bom_bomline'; + $keyforaliasextra = 'extraline'; + $keyforelement = 'bomline'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index d5c2e699da2..d1f58dd7451 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -185,7 +185,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -227,7 +229,9 @@ class modCategorie extends DolibarrModules 't.libelle'=>'company' ); // We define here only fields that use another picto - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -271,7 +275,9 @@ class modCategorie extends DolibarrModules 't.libelle'=>'company', 'pl.code'=>'company', 'st.code'=>'company' ); // We define here only fields that use another picto - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -297,7 +303,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto - $keyforselect = 'adherent'; $keyforelement = 'member'; $keyforaliasextra = 'extra'; + $keyforselect = 'adherent'; + $keyforelement = 'member'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -348,7 +356,9 @@ class modCategorie extends DolibarrModules 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company" ); // We define here only fields that use another picto - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -375,7 +385,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); $this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto - $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; + $keyforselect = 'projet'; + $keyforelement = 'project'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -398,7 +410,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 36a35894636..6fa8b730c24 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -236,13 +236,21 @@ class modCommande extends DolibarrModules 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); $this->export_dependencies_array[$r] = array('order_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'commande'; $keyforelement = 'order'; $keyforaliasextra = 'extra'; + $keyforselect = 'commande'; + $keyforelement = 'order'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commandedet'; $keyforelement = 'order_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'commandedet'; + $keyforelement = 'order_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra4'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra4'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index d9d8558e35a..1b927346f1e 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -193,9 +193,13 @@ class modContrat extends DolibarrModules 'p.rowid'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text'); - $keyforselect = 'contrat'; $keyforelement = 'contract'; $keyforaliasextra = 'coextra'; + $keyforselect = 'contrat'; + $keyforelement = 'contract'; + $keyforaliasextra = 'coextra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'contratdet'; $keyforelement = 'contract_line'; $keyforaliasextra = 'codextra'; + $keyforselect = 'contratdet'; + $keyforelement = 'contract_line'; + $keyforaliasextra = 'codextra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 6cc31b05c22..b4bac22fd1a 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -280,14 +280,22 @@ class modExpedition extends DolibarrModules } $this->export_dependencies_array[$r] = array('shipment_line'=>'ed.rowid', 'product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra3'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } - $keyforselect = 'expedition'; $keyforelement = 'shipment'; $keyforaliasextra = 'extra'; + $keyforselect = 'expedition'; + $keyforelement = 'shipment'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'expeditiondet'; $keyforelement = 'shipment_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'expeditiondet'; + $keyforelement = 'shipment_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extraprod'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extraprod'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 2d0036faef9..dca32b4fad7 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -211,7 +211,9 @@ class modExpenseReport extends DolibarrModules $this->export_alias_array[$r] = array('d.rowid'=>"idtrip", 'd.type'=>"type", 'd.note_private'=>'note_private', 'd.note_public'=>'note_public', 'u.lastname'=>'name', 'u.firstname'=>'firstname', 'u.login'=>'login'); $this->export_dependencies_array[$r] = array('expensereport_line'=>'ed.rowid', 'type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'expensereport'; $keyforelement = 'expensereport'; $keyforaliasextra = 'extra'; + $keyforselect = 'expensereport'; + $keyforelement = 'expensereport'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 51d3377a965..eed92413c8a 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -266,11 +266,17 @@ class modFacture extends DolibarrModules ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; + $keyforselect = 'facture'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'facturedet'; $keyforelement = 'invoice_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'facturedet'; + $keyforelement = 'invoice_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -350,7 +356,9 @@ class modFacture extends DolibarrModules ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need - $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; + $keyforselect = 'facture'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 422ca6b22d5..9364b75d9f7 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -165,7 +165,9 @@ class modFicheinter extends DolibarrModules 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 'f.rowid'=>"InterId", 'f.ref'=>"InterRef", 'f.datec'=>"InterDateCreation", 'f.duree'=>"InterDuration", 'f.fk_statut'=>'InterStatus', 'f.description'=>"InterNote"); - $keyforselect = 'fichinter'; $keyforelement = 'intervention'; $keyforaliasextra = 'extra'; + $keyforselect = 'fichinter'; + $keyforelement = 'intervention'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] += array( 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', @@ -195,7 +197,9 @@ class modFicheinter extends DolibarrModules 'fd.duree'=>'inter_line', 'fd.description'=>'inter_line' ); $this->export_dependencies_array[$r] = array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'fichinterdet'; $keyforelement = 'inter_line'; $keyforaliasextra = 'extradet'; + $keyforselect = 'fichinterdet'; + $keyforelement = 'inter_line'; + $keyforaliasextra = 'extradet'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index c3bbf2c3faf..3fa92d8a7c5 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -221,7 +221,9 @@ class modHoliday extends DolibarrModules $this->export_special_array[$r] = array('none.num_open_days'=>'getNumOpenDays'); $this->export_dependencies_array[$r] = array(); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'holiday'; $keyforelement = 'holiday'; $keyforaliasextra = 'extra'; + $keyforselect = 'holiday'; + $keyforelement = 'holiday'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 4335913be6f..f972c235802 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -210,7 +210,9 @@ class modProduct extends DolibarrModules if (!empty($conf->barcode->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); } - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (!empty($conf->fournisseur->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); @@ -431,7 +433,9 @@ class modProduct extends DolibarrModules $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); } $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 69a359d6fb9..ff135a74d1d 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -253,13 +253,17 @@ class modProjet extends DolibarrModules // Add fields for project $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array()); // Add extra fields for project - $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; + $keyforselect = 'projet'; + $keyforelement = 'project'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task - $keyforselect = 'projet_task'; $keyforelement = 'projecttask'; $keyforaliasextra = 'extra2'; + $keyforselect = 'projet_task'; + $keyforelement = 'projecttask'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote")); diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 1003bc5e09c..a1f52bbd906 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -227,13 +227,21 @@ class modPropale extends DolibarrModules 'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); $this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'propal'; $keyforelement = 'propal'; $keyforaliasextra = 'extra'; + $keyforselect = 'propal'; + $keyforelement = 'propal'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'propaldet'; $keyforelement = 'propal_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'propaldet'; + $keyforelement = 'propal_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'societe'; $keyforaliasextra = 'extra4'; + $keyforselect = 'societe'; + $keyforelement = 'societe'; + $keyforaliasextra = 'extra4'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index 54334cdc285..17f765d2caf 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -208,12 +208,18 @@ class modReception extends DolibarrModules } $this->export_dependencies_array[$r] = array('reception_line'=>'ed.rowid', 'product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) { - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra3'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } - $keyforselect = 'reception'; $keyforelement = 'reception'; $keyforaliasextra = 'extra'; + $keyforselect = 'reception'; + $keyforelement = 'reception'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commande_fournisseur_dispatch'; $keyforelement = 'reception_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'commande_fournisseur_dispatch'; + $keyforelement = 'reception_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 46be038a21c..ee3836cde26 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -242,7 +242,9 @@ class modResource extends DolibarrModules $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); - $keyforselect = 'resource'; $keyforelement = 'resource'; $keyforaliasextra = 'extra'; + $keyforselect = 'resource'; + $keyforelement = 'resource'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 75af0f103f5..6009af638fb 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -175,7 +175,9 @@ class modService extends DolibarrModules if (!empty($conf->barcode->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); } - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (!empty($conf->fournisseur->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); @@ -392,7 +394,9 @@ class modService extends DolibarrModules $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); } $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 42456c4ae80..9151673f996 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -288,7 +288,9 @@ class modSociete extends DolibarrModules $this->export_fields_array[$r] += array('s.entity'=>'Entity'); } } - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] += array('u.login'=>'SaleRepresentativeLogin', 'u.firstname'=>'SaleRepresentativeFirstname', 'u.lastname'=>'SaleRepresentativeLastname'); @@ -386,9 +388,13 @@ class modSociete extends DolibarrModules unset($this->export_fields_array[$r]['s.code_fournisseur']); unset($this->export_entities_array[$r]['s.code_fournisseur']); } - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extrasoc'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'socpeople as c'; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 76f5a1910ba..ffa80d9a748 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -205,7 +205,9 @@ class modStock extends DolibarrModules ); $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array(); - $keyforselect = 'warehouse'; $keyforelement = 'warehouse'; $keyforaliasextra = 'extra'; + $keyforselect = 'warehouse'; + $keyforelement = 'warehouse'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -243,7 +245,9 @@ class modStock extends DolibarrModules ); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ps.reel'=>'Stock')); @@ -288,7 +292,9 @@ class modStock extends DolibarrModules ); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. - $keyforselect = 'product_lot'; $keyforelement = 'batch'; $keyforaliasextra = 'extra'; + $keyforselect = 'product_lot'; + $keyforelement = 'batch'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index af4443be5d1..4c1a6bcfded 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -256,7 +256,9 @@ class modUser extends DolibarrModules 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" ); - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (empty($conf->adherent->enabled)) { unset($this->export_fields_array[$r]['u.fk_member']); diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index a7dfa2fdd82..efb5a38f297 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -130,7 +130,9 @@ class modWebsite extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'globe'; - $keyforclass = 'WebsitePage'; $keyforclassfile = '/website/class/websitepage.class.php'; $keyforelement = 'Website'; + $keyforclass = 'WebsitePage'; + $keyforclassfile = '/website/class/websitepage.class.php'; + $keyforelement = 'Website'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index b84976dd212..c8a0c50862b 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -602,7 +602,8 @@ class pdf_stdandard extends ModelePDFMovement // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut 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 8053d4f4f45..374ae5b4337 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 @@ -135,7 +135,8 @@ class doc_generic_mo_odt extends ModelePDFMo $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index ba7cdccdafa..d47b4eb708e 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -81,7 +81,8 @@ class mod_mo_standard extends ModeleNumRefMos { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_mo_standard extends ModeleNumRefMos if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 535fdab38bc..d3259db513c 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -88,7 +88,8 @@ class mod_payment_cicada extends ModeleNumRefPayments { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,8 @@ class mod_payment_cicada extends ModeleNumRefPayments if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index c09ce7bcbd8..079b46003c4 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -111,7 +111,8 @@ class pdf_standardlabel extends CommonStickerGenerator $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height); } - $xleft = 2; $ytop = 2; + $xleft = 2; + $ytop = 2; // Top if ($header != '') { @@ -128,16 +129,20 @@ class pdf_standardlabel extends CommonStickerGenerator $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height)); // Define widthtouse and heighttouse - $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); + $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); + $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); $defaultratio = ($maxwidthtouse / $maxheighttouse); - $widthtouse = $maxwidthtouse; $heighttouse = 0; // old value for image + $widthtouse = $maxwidthtouse; + $heighttouse = 0; // old value for image $tmp = dol_getImageSize($photo, false); if ($tmp['height']) { $imgratio = $tmp['width'] / $tmp['height']; if ($imgratio >= $defaultratio) { - $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); + $widthtouse = $maxwidthtouse; + $heighttouse = round($widthtouse / $imgratio); } else { - $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); + $heightouse = $maxheighttouse; + $widthtouse = round($heightouse * $imgratio); } } //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; @@ -239,7 +244,8 @@ class pdf_standardlabel extends CommonStickerGenerator $this->code = $srctemplatepath; $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 1be4e6d8432..907b18daef3 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -267,7 +267,8 @@ class pdf_tcpdflabel extends CommonStickerGenerator $this->code = $srctemplatepath; $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 9365f19f783..ae4c6888a6c 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -117,7 +117,9 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); 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 8970cbeea79..19a752d5be7 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 @@ -138,7 +138,8 @@ class doc_generic_product_odt extends ModelePDFProduct $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 24d9c0690c8..0a302c0fb6b 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -200,7 +200,8 @@ class mod_codeproduct_elephant extends ModeleProductCode return ''; } - $field = ''; $where = ''; + $field = ''; + $where = ''; if ($type == 0) { $field = 'ref'; //$where = ' AND client in (1,2)'; 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 960bf21ef69..091f26a0872 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 @@ -426,7 +426,8 @@ class doc_generic_project_odt extends ModelePDFProjects $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 446de761418..373d41abc31 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -421,7 +421,8 @@ class pdf_baleine extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index dbb4e28d03a..21af4b94ade 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -640,7 +640,8 @@ class pdf_beluga extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index b2d90af0da2..ef2ec4fcaf8 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -425,7 +425,8 @@ class pdf_timespent extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 1fb88f5454c..b1dbe4bae48 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -90,7 +90,8 @@ class mod_project_simple extends ModeleNumRefProjects { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -101,7 +102,8 @@ class mod_project_simple extends ModeleNumRefProjects if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 3f321c6f022..fc444babe0d 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 @@ -393,7 +393,8 @@ class doc_generic_task_odt extends ModelePDFTask $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 654da5fff23..f0cdddfbc88 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -90,7 +90,8 @@ class mod_task_simple extends ModeleNumRefTask { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_task_simple extends ModeleNumRefTask if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 0ac3bc5e35d..4a292d4a97b 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 @@ -137,7 +137,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1f36c874c2b..9575577ecbd 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -565,7 +565,8 @@ class pdf_azur extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -1047,7 +1048,8 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 6a550018f7a..550339a8afc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -673,7 +673,8 @@ class pdf_cyan extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1194,7 +1195,8 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index 77b1a97e17b..28d66dfc40a 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -90,7 +90,8 @@ class mod_propale_marbre extends ModeleNumRefPropales { global $conf, $langs, $db; - $pryymm = ''; $max = ''; + $pryymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_propale_marbre extends ModeleNumRefPropales if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $pryymm = substr($row[0], 0, 6); $max = $row[0]; + $pryymm = substr($row[0], 0, 6); + $max = $row[0]; } } 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 0b19633b40e..13a05b3378d 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 @@ -130,7 +130,8 @@ class doc_generic_reception_odt extends ModelePdfReception $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index ad1a702a622..4aa6db074f6 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -439,12 +439,14 @@ class pdf_squille extends ModelePdfReception // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -599,7 +601,8 @@ class pdf_squille extends ModelePdfReception $pdf->SetFont('', 'B', $default_font_size - 1); // Tableau total - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index d75e82070df..bbfc0daee45 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -66,7 +66,8 @@ class mod_reception_beryl extends ModelNumRefReception { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -78,7 +79,8 @@ class mod_reception_beryl extends ModelNumRefReception if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 588ecaf747f..ff9e4da5f0c 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -117,7 +117,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 49e4ffbe80a..5586ad82fda 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -223,7 +223,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode return ''; } - $field = ''; $where = ''; + $field = ''; + $where = ''; if ($type == 0) { $field = 'code_client'; //$where = ' AND client in (1,2)'; 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 ad6f51e342b..2819adea021 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 @@ -132,7 +132,8 @@ class doc_generic_stock_odt extends ModelePDFStock $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 6297921dbcc..a57b996086b 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -409,7 +409,8 @@ class pdf_standard extends ModelePDFStock // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut 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 8fec70458c0..167e4a79bde 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -454,7 +454,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -665,7 +666,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } 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 1b76b805efc..3d8f62ce3ca 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -99,7 +99,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices $langs->load("bills"); // Check invoice num - $siyymm = ''; $max = ''; + $siyymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -110,7 +111,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { @@ -132,7 +134,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { @@ -153,7 +156,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixdeposit.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { 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 f75641f2b9d..9e9799f44c6 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 @@ -136,7 +136,8 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); 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 5bf915fb764..e256ad8f4aa 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -611,7 +611,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -941,7 +942,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } 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 bccf6c75195..879cbba7578 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -519,7 +519,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -819,7 +820,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } 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 ae33e2875f5..5aa92995c4c 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -102,7 +102,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -113,7 +114,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { 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 18d597eb8ba..25dde592779 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -388,7 +388,8 @@ class pdf_standard extends ModelePDFSuppliersPayments // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut 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 7dae12ee64e..f86950c24d6 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -88,7 +88,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { 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 e9280b346e1..4b761f8099b 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 @@ -139,7 +139,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); 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 e8a3861541b..356c3550100 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -509,7 +509,8 @@ class pdf_aurore extends ModelePDFSupplierProposal // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -912,7 +913,8 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } 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 d61f6db2a36..b225899cef2 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -90,7 +90,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal { global $conf, $langs, $db; - $pryymm = ''; $max = ''; + $pryymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $pryymm = substr($row[0], 0, 6); $max = $row[0]; + $pryymm = substr($row[0], 0, 6); + $max = $row[0]; } } diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 176cdd1191c..eb90baef7e5 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -127,7 +127,8 @@ class doc_generic_ticket_odt extends ModelePDFTicket $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index 2badaf4a33f..523da47191d 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -151,8 +151,8 @@ class mod_ticket_simple extends ModeleNumRefTicket if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; - } // If counter > 9999, we do not format on 4 chars, we take number as it is - else { + } else { + // If counter > 9999, we do not format on 4 chars, we take number as it is $num = sprintf("%04s", $max + 1); } 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 cf39a523605..fb24e2782c9 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 @@ -136,7 +136,8 @@ class doc_generic_user_odt extends ModelePDFUser $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); 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 2538f83dfa8..45a9469753e 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 @@ -139,7 +139,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index d504f9191f5..34e727dd272 100755 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -83,7 +83,8 @@ class mod_workstation_standard extends ModeleNumRefWorkstation { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -99,7 +100,8 @@ class mod_workstation_standard extends ModeleNumRefWorkstation if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index a8196f60056..008e524f299 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -102,8 +102,8 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv 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(); @@ -320,9 +320,8 @@ if (empty($backtourl)) { $section_dir .= '/'; } $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'§ion_dir='.urlencode($section_dir); - } - // Generic case that should work for everybody else - else { + } else { + // Generic case that should work for everybody else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file); } } @@ -532,7 +531,9 @@ if (!empty($conf->use_javascript_ajax)) { $infoarray = dol_getImageSize($dir."/".GETPOST("file")); $height = $infoarray['height']; $width = $infoarray['width']; - $widthforcrop = $width; $refsizeforcrop = 'orig'; $ratioforcrop = 1; + $widthforcrop = $width; + $refsizeforcrop = 'orig'; + $ratioforcrop = 1; // If image is too large, we use another scale. if (!empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth'] / 2))) { $ratioforcrop = 2; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ee3a1ab71a4..dc181f891b1 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -352,7 +352,8 @@ if ($nolinesbefore) { echo ''; } if (is_object($objectline)) { - $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line');; + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + ; if (!empty($temps)) { print '
    '; print $temps; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 410918b99ed..afdfd904299 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -79,7 +79,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers $ret = $newobject->createFromProposal($object, $user); if ($ret < 0) { - $this->error = $newobject->error; $this->errors[] = $newobject->error; + $this->error = $newobject->error; + $this->errors[] = $newobject->error; } return $ret; } @@ -98,7 +99,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers $ret = $newobject->createFromOrder($object, $user); if ($ret < 0) { - $this->error = $newobject->error; $this->errors[] = $newobject->error; + $this->error = $newobject->error; + $this->errors[] = $newobject->error; } return $ret; } @@ -266,12 +268,14 @@ class InterfaceWorkflowManager extends DolibarrTriggers $order = new Commande($this->db); $ret = $order->fetch($object->origin_id); if ($ret < 0) { - $this->error = $order->error; $this->errors = $order->errors; + $this->error = $order->error; + $this->errors = $order->errors; return $ret; } $ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping'); if ($ret < 0) { - $this->error = $order->error; $this->errors = $order->errors; + $this->error = $order->error; + $this->errors = $order->errors; return $ret; } //Build array of quantity shipped by product for an order @@ -307,7 +311,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers //No diff => mean everythings is shipped $ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); if ($ret < 0) { - $this->error = $object->error; $this->errors = $object->errors; + $this->error = $object->error; + $this->errors = $object->errors; return $ret; } } diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index f9988e770bf..6d69c2d8a31 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -628,10 +628,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); $object->sendtoid = 0; - } - - // Members - elseif ($action == 'MEMBER_VALIDATE') { + } elseif ($action == 'MEMBER_VALIDATE') { + // Members // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -745,10 +743,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->sendtoid = 0; - } - - // Projects - elseif ($action == 'PROJECT_CREATE') { + } elseif ($action == 'PROJECT_CREATE') { + // Projects // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -784,10 +780,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = 0; - } - - // Project tasks - elseif ($action == 'TASK_CREATE') { + } elseif ($action == 'TASK_CREATE') { + // Project tasks // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -843,10 +837,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $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, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... - { + } else { + // TODO Merge all previous cases into this generic one + // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... // 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 // Load translation files required by the page @@ -1026,7 +1019,9 @@ class InterfaceActionsAuto extends DolibarrTriggers } } - unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. + unset($object->actionmsg); + unset($object->actionmsg2); + unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. if ($ret > 0) { $_SESSION['LAST_ACTION_CREATED'] = $ret; diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 19f23b0bfe4..c3d91fefc33 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -251,10 +251,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Groupes - elseif ($action == 'USERGROUP_CREATE') { + } elseif ($action == 'USERGROUP_CREATE') { + // Groupes dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); @@ -326,10 +324,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Contacts - elseif ($action == 'CONTACT_CREATE') { + } elseif ($action == 'CONTACT_CREATE') { + // Contacts dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) { $ldap = new Ldap(); @@ -396,10 +392,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Members - elseif ($action == 'MEMBER_CREATE') { + } elseif ($action == 'MEMBER_CREATE') { + // Members dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { $ldap = new Ldap(); @@ -665,10 +659,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->errors[] = "ErrorLDAP ".$ldap->error; } } - } - - // Members types - elseif ($action == 'MEMBER_TYPE_CREATE') { + } elseif ($action == 'MEMBER_TYPE_CREATE') { + // Members types dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { $ldap = new Ldap(); diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index ca1a33279bd..3233fb8eaaf 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -92,10 +92,8 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } return $return; - } - - // Members - elseif ($action == 'MEMBER_VALIDATE') { + } elseif ($action == 'MEMBER_VALIDATE') { + // Members dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $return = 0; diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 8c13c377bd6..f5140cf296a 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -186,10 +186,8 @@ if ($action == 'add' && $permtoadd) { exit; } } -} - -// Deleting file -elseif ($action == 'confirm_deletesection' && $confirm == 'yes') { +} elseif ($action == 'confirm_deletesection' && $confirm == 'yes') { + // Deleting file $result = $ecmdir->delete($user); setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs'); } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8712bcc4615..cf117611500 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -2503,9 +2503,8 @@ class User extends CommonObject // Only picto if ($withpictoimg > 0) { $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1).''; - } - // Picto must be a photo - else { + } else { + // Picto must be a photo $picto = ''.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).''; } $result .= $picto; @@ -2740,9 +2739,9 @@ class User extends CommonObject if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) { $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) } - } - // Set LDAP password if possible - elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password + } elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { + // Set LDAP password if possible + // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { // Just for the default MD5 ! if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) { @@ -2750,9 +2749,8 @@ class User extends CommonObject $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase_crypted, 5); // Create OpenLDAP MD5 password from Dolibarr MD5 password } } - } - // Use $this->pass_indatabase value if exists - elseif (!empty($this->pass_indatabase)) { + } elseif (!empty($this->pass_indatabase)) { + // Use $this->pass_indatabase value if exists if (!empty($conf->global->LDAP_FIELD_PASSWORD)) { $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte }