diff --git a/htdocs/intracommreport/card.php b/htdocs/intracommreport/card.php index a5b17803f65..554be07eb97 100644 --- a/htdocs/intracommreport/card.php +++ b/htdocs/intracommreport/card.php @@ -84,8 +84,12 @@ $permissiontodelete = $user->rights->intracommreport->delete; //if ($user->socid > 0) $socid = $user->socid; //$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0); //restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft); -if (empty($conf->intracommreport->enabled)) accessforbidden(); -if (!$permissiontoread) accessforbidden(); +if (empty($conf->intracommreport->enabled)) { + accessforbidden(); +} +if (!$permissiontoread) { + accessforbidden(); +} diff --git a/htdocs/intracommreport/class/intracommreport.class.php b/htdocs/intracommreport/class/intracommreport.class.php index e477621dbb3..28efdbf08fd 100644 --- a/htdocs/intracommreport/class/intracommreport.class.php +++ b/htdocs/intracommreport/class/intracommreport.class.php @@ -401,7 +401,6 @@ class IntracommReport extends CommonObject */ public function addItemFraisDePort(&$declaration, &$TLinesFraisDePort, $type, &$categ_fraisdeport, $i) { - global $conf; if ($type == 'expedition') { diff --git a/htdocs/intracommreport/list.php b/htdocs/intracommreport/list.php index 84fbf128162..ecf2ed66019 100644 --- a/htdocs/intracommreport/list.php +++ b/htdocs/intracommreport/list.php @@ -38,7 +38,7 @@ $show_files = GETPOST('show_files', 'int'); $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_ref = GETPOST("search_ref", 'alpha'); $search_type = GETPOST("search_type", 'int'); $optioncss = GETPOST('optioncss', 'alpha'); @@ -46,7 +46,7 @@ $type = GETPOST("type", "int"); $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id; -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -65,14 +65,16 @@ if (!$sortorder) { } // Initialize context for list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'intracommreportlist'; +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'intracommreportlist'; if ((string) $type == '1') { - $contextpage = 'DESlist'; if ($search_type == '') { + $contextpage = 'DESlist'; + if ($search_type == '') { $search_type = '1'; } } if ((string) $type == '0') { - $contextpage = 'DEBlist'; if ($search_type == '') { + $contextpage = 'DEBlist'; + if ($search_type == '') { $search_type = '0'; } } diff --git a/htdocs/knowledgemanagement/class/knowledgerecord.class.php b/htdocs/knowledgemanagement/class/knowledgerecord.class.php index e7f50ec2036..b140916d559 100644 --- a/htdocs/knowledgemanagement/class/knowledgerecord.class.php +++ b/htdocs/knowledgemanagement/class/knowledgerecord.class.php @@ -599,13 +599,15 @@ class KnowledgeRecord extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'knowledgerecord/".$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(); } $sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filepath = 'knowledgerecord/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filepath = 'knowledgerecord/".$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 @@ -809,7 +811,7 @@ class KnowledgeRecord extends CommonObject $label = $langs->trans("ShowKnowledgeRecord"); $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"'; } - $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); + $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"'); $linkclose .= $dataparams.' class="'.$classfortooltip.($morecss ? ' '.$morecss : '').'"'; } else { $linkclose = ($morecss ? ' class="'.$morecss.'"' : ''); @@ -912,7 +914,9 @@ class KnowledgeRecord extends CommonObject } $statusType = 'status'.$status; - if ($status == self::STATUS_VALIDATED) $statusType = 'status4'; + if ($status == self::STATUS_VALIDATED) { + $statusType = 'status4'; + } if ($status == self::STATUS_CANCELED) { $statusType = 'status6'; } diff --git a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php index 1e5f69aaa93..a94ab504be1 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/mod_knowledgerecord_standard.php @@ -83,7 +83,8 @@ class mod_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord { 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_knowledgerecord_standard extends ModeleNumRefKnowledgeRecord 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/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php index 85bc2e22062..56bc9968779 100644 --- a/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php +++ b/htdocs/knowledgemanagement/core/modules/knowledgemanagement/modules_knowledgerecord.php @@ -37,7 +37,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFKnowledgeRecord extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules diff --git a/htdocs/knowledgemanagement/knowledgerecord_agenda.php b/htdocs/knowledgemanagement/knowledgerecord_agenda.php index faf118bd0a2..fadb2ccde95 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_agenda.php +++ b/htdocs/knowledgemanagement/knowledgerecord_agenda.php @@ -54,7 +54,7 @@ if (GETPOST('actioncode', 'array')) { $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); diff --git a/htdocs/knowledgemanagement/knowledgerecord_contact.php b/htdocs/knowledgemanagement/knowledgerecord_contact.php index 751cdff5c9e..ced6e806c6f 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_contact.php +++ b/htdocs/knowledgemanagement/knowledgerecord_contact.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/knowledgemanagement/lib/knowledgemanagement_kno // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "companies", "other", "mails")); -$id = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility +$id = (GETPOST('id') ? GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility $ref = GETPOST('ref', 'alpha'); $lineid = GETPOST('lineid', 'int'); $socid = GETPOST('socid', 'int'); diff --git a/htdocs/knowledgemanagement/knowledgerecord_document.php b/htdocs/knowledgemanagement/knowledgerecord_document.php index 8d8fe6ac769..f83bcd883e0 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_document.php +++ b/htdocs/knowledgemanagement/knowledgerecord_document.php @@ -113,7 +113,7 @@ if ($object->id) { // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/knowledgemanagement/knowledgerecord_list.php b/htdocs/knowledgemanagement/knowledgerecord_list.php index c59554b26fa..33c134a6ddd 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_list.php +++ b/htdocs/knowledgemanagement/knowledgerecord_list.php @@ -43,7 +43,7 @@ if (isModEnabled('categorie')) { // Load translation files required by the page $langs->loadLangs(array("knowledgemanagement", "other")); -$action = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation diff --git a/htdocs/knowledgemanagement/knowledgerecord_note.php b/htdocs/knowledgemanagement/knowledgerecord_note.php index ea1052ccc98..053b0264a02 100644 --- a/htdocs/knowledgemanagement/knowledgerecord_note.php +++ b/htdocs/knowledgemanagement/knowledgerecord_note.php @@ -134,7 +134,7 @@ if ($id > 0 || !empty($ref)) { } } }*/ - $morehtmlref .= ''; + $morehtmlref .= ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/loan/card.php b/htdocs/loan/card.php index 327514a1ffd..1f167bab403 100644 --- a/htdocs/loan/card.php +++ b/htdocs/loan/card.php @@ -110,19 +110,23 @@ if (empty($reshook)) { $rate = price2num(GETPOST('rate')); if (!$capital) { - $error++; $action = 'create'; + $error++; + $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("LoanCapital")), null, 'errors'); } if (!$datestart) { - $error++; $action = 'create'; + $error++; + $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateStart")), null, 'errors'); } if (!$dateend) { - $error++; $action = 'create'; + $error++; + $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("DateEnd")), null, 'errors'); } if ($rate == '') { - $error++; $action = 'create'; + $error++; + $action = 'create'; setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentities("Rate")), null, 'errors'); } @@ -357,19 +361,19 @@ if ($action == 'create') { // Accountancy_account_capital print ''.$langs->trans("LoanAccountancyCapitalCode").''; print ''; - print $formaccounting->select_account(GETPOST('accountancy_account_capital') ?GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_capital') ? GETPOST('accountancy_account_capital') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_CAPITAL'), 'accountancy_account_capital', 1, '', 1, 1); print ''; // Accountancy_account_insurance print ''.$langs->trans("LoanAccountancyInsuranceCode").''; print ''; - print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ?GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_insurance') ? GETPOST('accountancy_account_insurance') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INSURANCE'), 'accountancy_account_insurance', 1, '', 1, 1); print ''; // Accountancy_account_interest print ''.$langs->trans("LoanAccountancyInterestCode").''; print ''; - print $formaccounting->select_account(GETPOST('accountancy_account_interest') ?GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1); + print $formaccounting->select_account(GETPOST('accountancy_account_interest') ? GETPOST('accountancy_account_interest') : getDolGlobalString('LOAN_ACCOUNTING_ACCOUNT_INTEREST'), 'accountancy_account_interest', 1, '', 1, 1); print ''; } else { // For external software diff --git a/htdocs/loan/class/loan.class.php b/htdocs/loan/class/loan.class.php index d2f66a54d33..a799f20185d 100644 --- a/htdocs/loan/class/loan.class.php +++ b/htdocs/loan/class/loan.class.php @@ -588,7 +588,7 @@ class Loan extends CommonObject $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); } if ($withpicto != 2) { - $result .= ($maxlen ?dol_trunc($this->ref, $maxlen) : $this->ref); + $result .= ($maxlen ? dol_trunc($this->ref, $maxlen) : $this->ref); } $result .= $linkend; diff --git a/htdocs/loan/class/loanschedule.class.php b/htdocs/loan/class/loanschedule.class.php index 6a3064bdc75..069a798bdd6 100644 --- a/htdocs/loan/class/loanschedule.class.php +++ b/htdocs/loan/class/loanschedule.class.php @@ -352,7 +352,8 @@ class LoanSchedule 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 @@ -387,7 +388,8 @@ class LoanSchedule 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(); } } @@ -565,7 +567,6 @@ class LoanSchedule extends CommonObject */ public function paimenttorecord($loanid, $datemax) { - $result = array(); $sql = "SELECT p.rowid"; diff --git a/htdocs/loan/class/paymentloan.class.php b/htdocs/loan/class/paymentloan.class.php index b735773bec9..6125e67afa2 100644 --- a/htdocs/loan/class/paymentloan.class.php +++ b/htdocs/loan/class/paymentloan.class.php @@ -350,7 +350,7 @@ class PaymentLoan extends CommonObject $sql .= " note_public=".(isset($this->note_public) ? "'".$this->db->escape($this->note_public)."'" : "null").","; $sql .= " fk_bank=".(isset($this->fk_bank) ? ((int) $this->fk_bank) : "null").","; $sql .= " fk_user_creat=".(isset($this->fk_user_creat) ? ((int) $this->fk_user_creat) : "null").","; - $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ?((int) $this->fk_user_modif) : "null"); + $sql .= " fk_user_modif=".(isset($this->fk_user_modif) ? ((int) $this->fk_user_modif) : "null"); $sql .= " WHERE rowid=".((int) $this->id); $this->db->begin(); @@ -358,7 +358,8 @@ class PaymentLoan 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 @@ -397,7 +398,8 @@ class PaymentLoan 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(); } } @@ -408,7 +410,8 @@ class PaymentLoan 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(); } } @@ -431,15 +434,15 @@ class PaymentLoan extends CommonObject //{ // if (! $notrigger) // { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers + //// Call triggers + //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + //$interface=new Interfaces($this->db); + //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); + //if ($result < 0) { $error++; $this->errors=$interface->errors; } + //// End call triggers // } //} diff --git a/htdocs/loan/document.php b/htdocs/loan/document.php index fe4ce6a9a0e..6aa24247afe 100644 --- a/htdocs/loan/document.php +++ b/htdocs/loan/document.php @@ -147,7 +147,7 @@ if ($object->id) { // Build file list - $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1); + $filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ? SORT_DESC : SORT_ASC), 1); $totalsize = 0; foreach ($filearray as $key => $file) { $totalsize += $file['size']; diff --git a/htdocs/loan/payment/payment.php b/htdocs/loan/payment/payment.php index 3ddc66ed305..885440a6812 100644 --- a/htdocs/loan/payment/payment.php +++ b/htdocs/loan/payment/payment.php @@ -196,8 +196,7 @@ if ($action == 'add_payment') { break; } } - } else // Only add fk_bank bank to schedule line (mark as paid) - { + } else { // Only add fk_bank bank to schedule line (mark as paid) $line->fk_bank = $payment->fk_bank; $line->fk_payment_loan = $payment->id; $result = $line->update($user, 0); @@ -282,62 +281,62 @@ if ($action == 'create') { print ''.$langs->trans("Date").''; if (empty($datepaid)) { if (empty($ts_temppaid)) { - $datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ?-1 : dol_now(); + $datepayment = !getDolGlobalString('MAIN_AUTOFILL_DATE') ? -1 : dol_now(); } else { $datepayment = $ts_temppaid; } } else { $datepayment = $datepaid; } - print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); - print ""; - print ''; + print $form->selectDate($datepayment, '', '', '', '', "add_payment", 1, 1); + print ""; + print ''; - print ''.$langs->trans("PaymentMode").''; - print img_picto('', 'money-bill-alt', 'class="pictofixedwidth"'); - $form->select_types_paiements(GETPOSTISSET("paymenttype") ? GETPOST("paymenttype", 'alphanohtml') : $loan->fk_typepayment, "paymenttype"); - print "\n"; - print ''; + print ''.$langs->trans("PaymentMode").''; + print img_picto('', 'money-bill-alt', 'class="pictofixedwidth"'); + $form->select_types_paiements(GETPOSTISSET("paymenttype") ? GETPOST("paymenttype", 'alphanohtml') : $loan->fk_typepayment, "paymenttype"); + print "\n"; + print ''; - print ''; - print ''.$langs->trans('AccountToDebit').''; - print ''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"'); - $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list - print ''; + print ''; + print ''.$langs->trans('AccountToDebit').''; + print ''; + print img_picto('', 'bank_account', 'class="pictofixedwidth"'); + $form->select_comptes(GETPOSTISSET("accountid") ? GETPOST("accountid", 'int') : $loan->accountid, "accountid", 0, 'courant = '.Account::TYPE_CURRENT, 1); // Show opend bank account list + print ''; - // Number - print ''.$langs->trans('Numero'); - print ' ('.$langs->trans("ChequeOrTransferNumber").')'; - print ''; - print ''."\n"; - print ""; + // Number + print ''.$langs->trans('Numero'); + print ' ('.$langs->trans("ChequeOrTransferNumber").')'; + print ''; + print ''."\n"; + print ""; - print ''; - print ''.$langs->trans("NotePrivate").''; - print ''; - print ''; + print ''; + print ''.$langs->trans("NotePrivate").''; + print ''; + print ''; - print ''; - print ''.$langs->trans("NotePublic").''; - print ''; - print ''; + print ''; + print ''.$langs->trans("NotePublic").''; + print ''; + print ''; - print ''; + print ''; - print dol_get_fiche_end(); + print dol_get_fiche_end(); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print "\n"; + print '
'.$langs->trans("DateDue").''.$langs->trans("LoanCapital").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").'
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; - print ''; + print ''; if ($loan->datestart > 0) { print ''; @@ -345,39 +344,39 @@ if ($action == 'create') { print ''; } - print '"; + print '"; - print '"; + print '"; - print '"; + print '"; - print '"; + print ""; - print "\n"; + print "\n"; - print '
'.$langs->trans("DateDue").''.$langs->trans("LoanCapital").''.$langs->trans("AlreadyPaid").''.$langs->trans("RemainderToPay").''.$langs->trans("Amount").'
'.dol_print_date($loan->datestart, 'day').'!!!'.price($loan->capital)."'.price($loan->capital)."'.price($sumpaid)."'.price($sumpaid)."'.price($loan->capital - $sumpaid)."'.price($loan->capital - $sumpaid)."'; + print ''; if ($sumpaid < $loan->capital) { - print $langs->trans("LoanCapital").': '; + print $langs->trans("LoanCapital").': '; } else { print '-'; } - print '
'; + print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Insurance").': '; + print $langs->trans("Insurance").': '; } else { print '-'; } - print '
'; + print '
'; if ($sumpaid < $loan->capital) { - print $langs->trans("Interest").': '; + print $langs->trans("Interest").': '; } else { print '-'; } - print "
'; + print ''; - print $form->buttonsSaveCancel(); + print $form->buttonsSaveCancel(); - print "\n"; + print "\n"; } llxFooter(); diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 794cf5bd5bc..db3236ddc30 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -65,7 +65,7 @@ if (preg_match('/del_([a-z0-9_\-]+)/i', $action, $reg)) { if ($action == 'remises') { if (dolibarr_set_const($db, 'MARGIN_METHODE_FOR_DISCOUNT', GETPOST('MARGIN_METHODE_FOR_DISCOUNT'), 'chaine', 0, '', $conf->entity) > 0) { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); } @@ -73,7 +73,7 @@ if ($action == 'remises') { if ($action == 'typemarges') { if (dolibarr_set_const($db, 'MARGIN_TYPE', GETPOST('MARGIN_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); } @@ -81,7 +81,7 @@ if ($action == 'typemarges') { if ($action == 'contact') { if (dolibarr_set_const($db, 'AGENT_CONTACT_TYPE', GETPOST('AGENT_CONTACT_TYPE'), 'chaine', 0, '', $conf->entity) > 0) { - setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); + setEventMessages($langs->trans("RecordModifiedSuccessfully"), null, 'mesgs'); } else { dol_print_error($db); } diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index baf70fbc3ba..b316708f3ed 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -36,7 +36,7 @@ $langs->loadLangs(array('companies', 'bills', 'products', 'margins')); $mesg = ''; // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -157,7 +157,7 @@ $sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))' $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; -$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(!getDolGlobalString('AGENT_CONTACT_TYPE') ?-1 : $conf->global->AGENT_CONTACT_TYPE); +$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(!getDolGlobalString('AGENT_CONTACT_TYPE') ? -1 : $conf->global->AGENT_CONTACT_TYPE); $sql .= ", ".MAIN_DB_PREFIX."facturedet as d"; $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."user as u"; diff --git a/htdocs/margin/checkMargins.php b/htdocs/margin/checkMargins.php index f642e785b96..257d56cb318 100644 --- a/htdocs/margin/checkMargins.php +++ b/htdocs/margin/checkMargins.php @@ -35,12 +35,12 @@ $langs->loadLangs(array('companies', 'bills', 'products', 'margins')); $action = GETPOST('action', 'alpha'); $massaction = GETPOST('massaction', 'alpha'); $toselect = GETPOST('toselect', 'array'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'margindetail'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'margindetail'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $optioncss = GETPOST('optioncss', 'alpha'); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -80,7 +80,8 @@ if (GETPOST("button_search_x") || GETPOST("button_search")) { */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 1bf4d3a01ed..4b407e30a42 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -33,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/margin/lib/margins.lib.php'; $langs->loadLangs(array('companies', 'bills', 'products', 'margins')); // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -52,7 +52,7 @@ if (!$sortorder) { $startdate = $enddate = ''; if (GETPOST('startdatemonth')) { - $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } if (GETPOST('enddatemonth')) { $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); @@ -347,8 +347,8 @@ if ($result) { $marge = $objp->marge; if ($marge < 0) { - $marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : ''; - $markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : ''; + $marginRate = ($pa != 0) ? -1 * (100 * $marge / $pa) : ''; + $markRate = ($pv != 0) ? -1 * (100 * $marge / $pv) : ''; } else { $marginRate = ($pa != 0) ? (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ? (100 * $marge / $pv) : ''; @@ -401,8 +401,8 @@ if ($result) { } else {*/ - $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; - $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; + $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; + $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; //} print ''; diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index 519ffebd5ff..d782ad10a01 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -43,7 +43,7 @@ $socid = 0; $mesg = ''; // Load variable for pagination -$limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST('sortfield', 'aZ09comma'); $sortorder = GETPOST('sortorder', 'aZ09comma'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); @@ -65,7 +65,7 @@ if (!$sortfield) { $startdate = $enddate = ''; if (GETPOST('startdatemonth')) { - $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); + $startdate = dol_mktime(0, 0, 0, GETPOST('startdatemonth', 'int'), GETPOST('startdateday', 'int'), GETPOST('startdateyear', 'int')); } if (GETPOST('enddatemonth')) { $enddate = dol_mktime(23, 59, 59, GETPOST('enddatemonth', 'int'), GETPOST('enddateday', 'int'), GETPOST('enddateyear')); @@ -300,8 +300,8 @@ if ($result) { $marge = $objp->marge; if ($marge < 0) { - $marginRate = ($pa != 0) ?-1 * (100 * $marge / $pa) : ''; - $markRate = ($pv != 0) ?-1 * (100 * $marge / $pv) : ''; + $marginRate = ($pa != 0) ? -1 * (100 * $marge / $pa) : ''; + $markRate = ($pv != 0) ? -1 * (100 * $marge / $pv) : ''; } else { $marginRate = ($pa != 0) ? (100 * $marge / $pa) : ''; $markRate = ($pv != 0) ? (100 * $marge / $pv) : ''; diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index 473178af942..aaa25015c34 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -253,8 +253,8 @@ if ($id > 0 || !empty($ref)) { $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { - $marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : ''; - $markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : ''; + $marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : ''; + $markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : ''; } else { $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 0d79f57f5d1..69cfa8e54aa 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -264,8 +264,8 @@ if ($socid > 0) { $totalMargin = $cumul_vente - $cumul_achat; if ($totalMargin < 0) { - $marginRate = ($cumul_achat != 0) ?-1 * (100 * $totalMargin / $cumul_achat) : ''; - $markRate = ($cumul_vente != 0) ?-1 * (100 * $totalMargin / $cumul_vente) : ''; + $marginRate = ($cumul_achat != 0) ? -1 * (100 * $totalMargin / $cumul_achat) : ''; + $markRate = ($cumul_vente != 0) ? -1 * (100 * $totalMargin / $cumul_vente) : ''; } else { $marginRate = ($cumul_achat != 0) ? (100 * $totalMargin / $cumul_achat) : ''; $markRate = ($cumul_vente != 0) ? (100 * $totalMargin / $cumul_vente) : ''; diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index 1268d4dbd59..03171f5be86 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -1455,13 +1455,13 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { $moduledescriptorfile = $destdir.'/core/modules/mod'.$module.'.class.php'; } - // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 - // TODO Avoid duplicate addition + // TODO Allow a replace with regex using dolReplaceInFile with param arryreplacementisregex to 1 + // TODO Avoid duplicate addition - // load class and check if menu exist with same object name - $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; - dol_include_once($pathtofile); - $class = 'mod'.$module; + // load class and check if menu exist with same object name + $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; + dol_include_once($pathtofile); + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -1470,8 +1470,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { dol_print_error($db, $e->getMessage()); } } - $menus = $moduleobj->menu; - $counter = 0 ; + $menus = $moduleobj->menu; + $counter = 0 ; foreach ($menus as $menu) { if ($menu['leftmenu'] == strtolower($objectname)) { $counter++; @@ -1486,8 +1486,8 @@ if ($dirins && $action == 'initobject' && $module && $objectname) { dolReplaceInFile($moduledescriptorfile, array('/* END MODULEBUILDER LEFTMENU MYOBJECT */' => '/*LEFTMENU '.strtoupper($objectname).'*/'.$stringtoadd."\n\t\t".'/*END LEFTMENU '.strtoupper($objectname).'*/'."\n\t\t".'/* END MODULEBUILDER LEFTMENU MYOBJECT */')); } } - // Add module descriptor to list of files to replace "MyObject' string with real name of object. - $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; + // Add module descriptor to list of files to replace "MyObject' string with real name of object. + $filetogenerate[] = 'core/modules/mod'.$module.'.class.php'; } if (!$error) { @@ -1917,7 +1917,7 @@ if ($dirins && $action == 'confirm_deleteobject' && $objectname) { // load class and check if menu,permission,documentation exist for this object $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2091,7 +2091,7 @@ if ($dirins && $action == 'updatedictionary' && GETPOST('dictionnarykey')) { $destdir = $dirins.'/'.strtolower($module); $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { @@ -2212,7 +2212,7 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { // load class and check if right exist $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2283,9 +2283,9 @@ if ($dirins && $action == 'addright' && !empty($module) && empty($cancel)) { setEventMessages($langs->trans('WarningModuleNeedRefresh', $langs->transnoentities($module)), null, 'warnings'); } } - $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - //rewriting all permissions after add a right - $rewrite = checkExistComment($moduledescriptorfile, 1); + $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; + //rewriting all permissions after add a right + $rewrite = checkExistComment($moduledescriptorfile, 1); if ($rewrite < 0) { setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Permissions"), "mod".$module."class.php"), null, 'warnings'); } else { @@ -2308,7 +2308,7 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e // load class and check if right exist $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2351,15 +2351,15 @@ if ($dirins && GETPOST('action') == 'update_right' && GETPOST('modifyright')&& e $x1 = $permissions[$key][1]; $x2 = $permissions[$key][4]; $x3 = $permissions[$key][5]; - //check existing object permission - $counter = 0; - $permsForObject =array(); - $permissions = $moduleobj->rights; - $firstRight = 0; - $existRight = 0; - $allObject = array(); + //check existing object permission + $counter = 0; + $permsForObject =array(); + $permissions = $moduleobj->rights; + $firstRight = 0; + $existRight = 0; + $allObject = array(); - $countPerms = count($permissions); + $countPerms = count($permissions); for ($i =0; $i<$countPerms; $i++) { if ($permissions[$i][4] == $objectForPerms) { $counter++; @@ -2585,7 +2585,7 @@ if ($dirins && $action == 'confirm_deletemenu' && GETPOST('menukey', 'int')) { // load class and check if menu exist $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2647,7 +2647,7 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) { // load class and check if right exist $pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -2706,9 +2706,9 @@ if ($dirins && $action == 'addmenu' && empty($cancel)) { setEventMessages($langs->trans("WarningFieldsMustContains", $langs->transnoentities("leftmenu")), null, 'errors'); } } - $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; - $destdir = $dirins.'/'.strtolower($module); - $objects = dolGetListOfObjectClasses($destdir); + $dirins = $listofmodules[strtolower($module)]['moduledescriptorrootpath']; + $destdir = $dirins.'/'.strtolower($module); + $objects = dolGetListOfObjectClasses($destdir); if (GETPOST('type', 'alpha') == 'left') { if (empty(GETPOST('leftmenu')) && count($objects) >0) { @@ -2816,8 +2816,8 @@ if ($dirins && $action == "update_menu" && GETPOST('menukey', 'int') && GETPOST( $key = (int) GETPOST('menukey', 'int') - 1; $moduledescriptorfile = $dirins.'/'.strtolower($module).'/core/modules/mod'.$module.'.class.php'; - //stock forms in array - $menuModify = array( + //stock forms in array + $menuModify = array( 'fk_menu' => GETPOST('fk_menu', 'alpha'), 'type' => GETPOST('type', 'alpha'), 'titre' => ucfirst(GETPOST('titre', 'alpha')), @@ -2831,52 +2831,52 @@ if ($dirins && $action == "update_menu" && GETPOST('menukey', 'int') && GETPOST( 'target' => GETPOST('target', 'alpha'), 'user' => GETPOST('user', 'alpha'), ); - if (!empty(GETPOST('fk_menu')) && GETPOST('fk_menu') != $menus[$key]['fk_menu']) { - $menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu').',fk_leftmenu='.GETPOST('fk_menu'); - } elseif (GETPOST('fk_menu') == $menus[$key]['fk_menu']) { - $menuModify['fk_menu'] = $menus[$key]['fk_menu']; + if (!empty(GETPOST('fk_menu')) && GETPOST('fk_menu') != $menus[$key]['fk_menu']) { + $menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu').',fk_leftmenu='.GETPOST('fk_menu'); + } elseif (GETPOST('fk_menu') == $menus[$key]['fk_menu']) { + $menuModify['fk_menu'] = $menus[$key]['fk_menu']; + } else { + $menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu'); + } + if ($menuModify['enabled'] === '') { + $menuModify['enabled'] = '1'; + } + if ($menuModify['perms'] === '') { + $menuModify['perms'] = '1'; + } + + if (GETPOST('type', 'alpha') == 'top') { + $error++; + setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors'); + } + + if (!$error) { + //update menu + $checkComment = checkExistComment($moduledescriptorfile, 0); + + if ($checkComment < 0) { + setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); } else { - $menuModify['fk_menu'] = 'fk_mainmenu='.GETPOST('mainmenu'); - } - if ($menuModify['enabled'] === '') { - $menuModify['enabled'] = '1'; - } - if ($menuModify['perms'] === '') { - $menuModify['perms'] = '1'; - } + // Write all menus + $result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2); - if (GETPOST('type', 'alpha') == 'top') { - $error++; - setEventMessages($langs->trans("ErrorTypeMenu", $langs->transnoentities("type")), null, 'errors'); - } + clearstatcache(true); + if (function_exists('opcache_invalidate')) { + opcache_reset(); + } - if (!$error) { - //update menu - $checkComment = checkExistComment($moduledescriptorfile, 0); - - if ($checkComment < 0) { - setEventMessages($langs->trans("WarningCommentNotFound", $langs->trans("Menus"), "mod".$module."class.php"), null, 'warnings'); - } else { - // Write all menus - $result = reWriteAllMenus($moduledescriptorfile, $menus, $menuModify, $key, 2); - - clearstatcache(true); - if (function_exists('opcache_invalidate')) { - opcache_reset(); - } - - if ($result < 0) { - setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); - //var_dump($_SESSION);exit; - header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1)); - exit; - } - - setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); - header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + if ($result < 0) { + setEventMessages($langs->trans('ErrorMenuExistValue'), null, 'errors'); + //var_dump($_SESSION);exit; + header("Location: ".$_SERVER["PHP_SELF"].'?action=editmenu&token='.newToken().'&menukey='.urlencode($key+1).'&tab='.urlencode($tab).'&module='.urlencode($module).'&tabobj='.($key+1)); exit; } + + setEventMessages($langs->trans('MenuUpdatedSuccessfuly'), null); + header("Location: ".DOL_URL_ROOT.'/modulebuilder/index.php?tab=menus&module='.$module); + exit; } + } } else { $_POST['type'] = ''; $_POST['titre'] = ''; @@ -2904,7 +2904,7 @@ if ($dirins && $action == "update_props_module" && !empty(GETPOST('keydescriptio dol_include_once($pathtofile); - $class = 'mod'.$module; + $class = 'mod'.$module; if (class_exists($class)) { try { $moduleobj = new $class($db); @@ -3322,7 +3322,7 @@ if ($module == 'initmodule') { $h++; $head2[$h][0] = $_SERVER["PHP_SELF"].'?tab=dictionaries&module='.$module.($forceddirread ? '@'.$dirread : ''); - $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').''.$countDictionaries.""); + $head2[$h][1] = ($countDictionaries == 0 ? $langs->trans("Dictionaries") : $langs->trans('Dictionaries').''.$countDictionaries.""); $head2[$h][2] = 'dictionaries'; $h++; @@ -3633,7 +3633,7 @@ if ($module == 'initmodule') { print dol_get_fiche_head($head2, $tab, '', -1, '', 0, '', '', 0, 'formodulesuffix'); $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%', ''); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html')); print dol_get_fiche_end(); @@ -3713,7 +3713,7 @@ if ($module == 'initmodule') { print ''; $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'text')); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'text')); print '
'; print '
'; print ''; @@ -3845,7 +3845,7 @@ if ($module == 'initmodule') { print ''; } elseif ($tabobj == 'createproperty') { - $attributesUnique = array ( + $attributesUnique = array( 'proplabel' => $form->textwithpicto($langs->trans("Label"), $langs->trans("YouCanUseTranslationKey")), 'propname' => $form->textwithpicto($langs->trans("Code"), $langs->trans("PropertyDesc"), 1, 'help', 'extracss', 0, 3, 'propertyhelp'), 'proptype' => $form->textwithpicto($langs->trans("Type"), $langs->trans("TypeOfFieldsHelpIntro").'

'.$langs->trans("TypeOfFieldsHelp"), 1, 'help', 'extracss', 0, 3, 'typehelp'), @@ -4006,7 +4006,7 @@ if ($module == 'initmodule') { // Print form confirm print $formconfirm; } - if ($action != 'editfile' || empty($file) ) { + if ($action != 'editfile' || empty($file)) { try { //$pathtofile = $listofmodules[strtolower($module)]['moduledescriptorrelpath']; @@ -4133,7 +4133,7 @@ if ($module == 'initmodule') { // API file print '
'; - print ' '.$langs->trans("ApiClassFile").' : '.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi)?'':'').''; + print ' '.$langs->trans("ApiClassFile").' : '.(dol_is_file($realpathtoapi) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtoapi).(dol_is_file($realpathtoapi) ? '' : '').''; if (dol_is_file($realpathtoapi)) { $file = file_get_contents($realpathtoapi); if (preg_match('/var '.$tabobj.'\s+([^\s]*)\s/ims', $file, $objs)) { @@ -4155,7 +4155,7 @@ if ($module == 'initmodule') { } // PHPUnit print '
'; - print ' '.$langs->trans("TestClassFile").' : '.(dol_is_file($realpathtophpunit) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit)?'':'').''; + print ' '.$langs->trans("TestClassFile").' : '.(dol_is_file($realpathtophpunit) ? '' : '').preg_replace('/^'.strtolower($module).'\//', '', $pathtophpunit).(dol_is_file($realpathtophpunit) ? '' : '').''; if (dol_is_file($realpathtophpunit)) { print ' '.img_picto($langs->trans("Edit"), 'edit').''; print ' '; @@ -4344,26 +4344,26 @@ if ($module == 'initmodule') { $propname = $propkey; $proplabel = $propval['label']; $proptype = $propval['type']; - $proparrayofkeyval = !empty($propval['arrayofkeyval'])?$propval['arrayofkeyval']:''; + $proparrayofkeyval = !empty($propval['arrayofkeyval']) ? $propval['arrayofkeyval'] : ''; $propnotnull = !empty($propval['notnull']) ? $propval['notnull'] : '0'; - $propdefault = !empty($propval['default'])?$propval['default']:''; - $propindex = !empty($propval['index'])?$propval['index']:''; - $propforeignkey = !empty($propval['foreignkey'])?$propval['foreignkey']:''; + $propdefault = !empty($propval['default']) ? $propval['default'] : ''; + $propindex = !empty($propval['index']) ? $propval['index'] : ''; + $propforeignkey = !empty($propval['foreignkey']) ? $propval['foreignkey'] : ''; $propposition = $propval['position']; $propenabled = $propval['enabled']; $propvisible = $propval['visible']; - $propnoteditable = !empty($propval['noteditable'])?$propval['noteditable']:0; + $propnoteditable = !empty($propval['noteditable']) ? $propval['noteditable'] : 0; //$propalwayseditable = !empty($propval['alwayseditable'])?$propval['alwayseditable']:0; - $propsearchall = !empty($propval['searchall'])?$propval['searchall']:0; - $propisameasure = !empty($propval['isameasure'])?$propval['isameasure']:0; - $propcss = !empty($propval['css'])?$propval['css']:''; - $propcssview = !empty($propval['cssview'])?$propval['cssview']:''; - $propcsslist = !empty($propval['csslist'])?$propval['csslist']:''; - $prophelp = !empty($propval['help'])?$propval['help']:''; - $propshowoncombobox = !empty($propval['showoncombobox'])?$propval['showoncombobox']:0; + $propsearchall = !empty($propval['searchall']) ? $propval['searchall'] : 0; + $propisameasure = !empty($propval['isameasure']) ? $propval['isameasure'] : 0; + $propcss = !empty($propval['css']) ? $propval['css'] : ''; + $propcssview = !empty($propval['cssview']) ? $propval['cssview'] : ''; + $propcsslist = !empty($propval['csslist']) ? $propval['csslist'] : ''; + $prophelp = !empty($propval['help']) ? $propval['help'] : ''; + $propshowoncombobox = !empty($propval['showoncombobox']) ? $propval['showoncombobox'] : 0; //$propdisabled=$propval['disabled']; - $propvalidate = !empty($propval['validate'])?$propval['validate']:0; - $propcomment = !empty($propval['comment'])?$propval['comment']:''; + $propvalidate = !empty($propval['validate']) ? $propval['validate'] : 0; + $propcomment = !empty($propval['comment']) ? $propval['comment'] : ''; print ''."\n"; print ''; @@ -4464,7 +4464,7 @@ if ($module == 'initmodule') { } elseif (strpos($proptype, 'real') === 0) { $pictoType = 'double'; } - print (!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).''.dol_escape_htmltag($proptype).''; + print(!empty($pictoType) ? getPictoForType($pictoType) : getPictoForType($proptype)).''.dol_escape_htmltag($proptype).''; print ''; print ''; if ($proparrayofkeyval) { @@ -4580,7 +4580,7 @@ if ($module == 'initmodule') { print ''; $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -4622,7 +4622,7 @@ if ($module == 'initmodule') { print ''; $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -4766,7 +4766,7 @@ if ($module == 'initmodule') { print ''; print ''; - print ($i + 1); + print($i + 1); print ''; print ''; @@ -4819,7 +4819,7 @@ if ($module == 'initmodule') { print ''; print ''; - print ($i + 1); + print($i + 1); print ''; print ''; @@ -4975,7 +4975,7 @@ if ($module == 'initmodule') { print ''; $doleditor = new DolEditor('editfilecontent', $content, '', '300', 'Full', 'In', true, false, 'ace', 0, '99%'); - print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ?GETPOST('format', 'aZ09') : 'html')); + print $doleditor->Create(1, '', false, $langs->trans("File").' : '.$file, (GETPOST('format', 'aZ09') ? GETPOST('format', 'aZ09') : 'html')); print '
'; print '
'; print ''; @@ -5011,18 +5011,18 @@ if ($module == 'initmodule') { } $groupedRights[$key][] = $right; } - $groupedRights_json = json_encode($groupedRights); + $groupedRights_json = json_encode($groupedRights); if ($action == 'deletemenu') { - $formconfirms = $form->formconfirm( - $_SERVER["PHP_SELF"].'?menukey='.urlencode(GETPOST('menukey', 'int')).'&tab='.urlencode($tab).'&module='.urlencode($module), - $langs->trans('Delete'), - ($menus[GETPOST('menukey')]['fk_menu'] === 'fk_mainmenu='.strtolower($module) ? $langs->trans('Warning: you will delete all menus linked to this one.', GETPOST('menukey', 'int')) : $langs->trans('Confirm Delete Menu', GETPOST('menukey', 'int'))), - 'confirm_deletemenu', - '', - 0, - 1 - ); + $formconfirms = $form->formconfirm( + $_SERVER["PHP_SELF"].'?menukey='.urlencode(GETPOST('menukey', 'int')).'&tab='.urlencode($tab).'&module='.urlencode($module), + $langs->trans('Delete'), + ($menus[GETPOST('menukey')]['fk_menu'] === 'fk_mainmenu='.strtolower($module) ? $langs->trans('Warning: you will delete all menus linked to this one.', GETPOST('menukey', 'int')) : $langs->trans('Confirm Delete Menu', GETPOST('menukey', 'int'))), + 'confirm_deletemenu', + '', + 0, + 1 + ); print $formconfirms; } if ($action != 'editfile' || empty($file)) { @@ -5149,7 +5149,7 @@ if ($module == 'initmodule') { $propMainmenu = !empty($menu['mainmenu']) ? $menu['mainmenu'] : GETPOST('mainmenu'); $propLeftmenu = !empty($menu['leftmenu']) ? $menu['leftmenu'] : GETPOST('leftmenu'); $propUrl = !empty($menu['url']) ? $menu['url'] : GETPOST('url', 'alpha'); - $propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms'); + $propPerms = !empty($menu['perms']) ? $menu['perms'] : GETPOST('perms'); $propUser = !empty($menu['user']) ? $menu['user'] : GETPOST('user'); $propTarget = !empty($menu['target']) ? $menu['target'] : GETPOST('target'); $propEnabled = !empty($menu['enabled']) ? $menu['enabled'] : GETPOST('enabled'); @@ -5178,7 +5178,7 @@ if ($module == 'initmodule') { '; - print '