diff --git a/htdocs/partnership/class/partnership.class.php b/htdocs/partnership/class/partnership.class.php index 24ca9732ed3..05be2893076 100644 --- a/htdocs/partnership/class/partnership.class.php +++ b/htdocs/partnership/class/partnership.class.php @@ -632,13 +632,15 @@ class Partnership extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$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 = 'partnership/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filepath = 'partnership/".$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 @@ -762,13 +764,15 @@ class Partnership extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'partnership/".$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 = 'partnership/".$this->db->escape($this->newref)."'"; $sql .= " WHERE filepath = 'partnership/".$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 @@ -987,7 +991,7 @@ class Partnership extends CommonObject $label = $langs->trans("ShowPartnership"); $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.'"' : ''); diff --git a/htdocs/partnership/class/partnershiputils.class.php b/htdocs/partnership/class/partnershiputils.class.php index 8ebc4555362..14608039100 100644 --- a/htdocs/partnership/class/partnershiputils.class.php +++ b/htdocs/partnership/class/partnershiputils.class.php @@ -117,7 +117,9 @@ class PartnershipUtils $obj = $this->db->fetch_object($resql); if ($obj) { - if (!empty($partnershipsprocessed[$obj->rowid])) continue; + if (!empty($partnershipsprocessed[$obj->rowid])) { + continue; + } if ($somethingdoneonpartnership >= $MAXPERCALL) { dol_syslog("We reach the limit of ".$MAXPERCALL." partnership processed, so we quit loop for this batch doCancelStatusOfMemberPartnership to avoid to reach email quota.", LOG_WARNING); @@ -139,8 +141,11 @@ class PartnershipUtils $error++; $this->error = $object->error; if (is_array($object->errors) && count($object->errors)) { - if (is_array($this->errors)) $this->errors = array_merge($this->errors, $object->errors); - else $this->errors = $object->errors; + if (is_array($this->errors)) { + $this->errors = array_merge($this->errors, $object->errors); + } else { + $this->errors = $object->errors; + } } } else { $partnershipsprocessed[$object->id] = $object->ref; @@ -158,7 +163,9 @@ class PartnershipUtils // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -191,7 +198,9 @@ class PartnershipUtils if (!$result || !empty($cmail->error) || !empty($cmail->errors)) { $erroremail .= ($erroremail ? ', ' : '').$cmail->error; $this->errors[] = $cmail->error; - if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; + if (is_array($cmail->errors) && count($cmail->errors) > 0) { + $this->errors += $cmail->errors; + } } else { // Initialisation of datas of object to call trigger if (is_object($object)) { @@ -200,7 +209,8 @@ class PartnershipUtils $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text - $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...); + $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref); + ; // Short text ($langs->transnoentities('MailSentBy')...); if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $object->actionmsg2 = $subject; // Short text } @@ -240,12 +250,16 @@ class PartnershipUtils if (!$error) { $this->db->commit(); $this->output = $numofexpiredmembers.' expired partnership members found'."\n"; - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; + if ($erroremail) { + $this->output .= '. Got errors when sending some email : '.$erroremail; + } } else { $this->db->rollback(); $this->output = "Rollback after error\n"; $this->output .= $numofexpiredmembers.' expired partnership members found'."\n"; - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail; + if ($erroremail) { + $this->output .= '. Got errors when sending some email : '.$erroremail; + } } return ($error ? 1 : 0); @@ -374,7 +388,9 @@ class PartnershipUtils // Define output language $outputlangs = $langs; $newlang = ''; - if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang = GETPOST('lang_id', 'aZ09'); + if (getDolGlobalInt('MAIN_MULTILANGS') && empty($newlang) && GETPOST('lang_id', 'aZ09')) { + $newlang = GETPOST('lang_id', 'aZ09'); + } if (!empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); @@ -402,7 +418,9 @@ class PartnershipUtils if (!$result || !empty($cmail->error) || !empty($cmail->errors)) { $erroremail .= ($erroremail ? ', ' : '').$cmail->error; $this->errors[] = $cmail->error; - if (is_array($cmail->errors) && count($cmail->errors) > 0) $this->errors += $cmail->errors; + if (is_array($cmail->errors) && count($cmail->errors) > 0) { + $this->errors += $cmail->errors; + } } else { // Initialisation of datas of object to call trigger if (is_object($object)) { @@ -414,7 +432,8 @@ class PartnershipUtils } $object->actiontypecode = $actiontypecode; // Type of event ('AC_OTH', 'AC_OTH_AUTO', 'AC_XXX'...) $object->actionmsg = $arraydefaultmessage->topic."\n".$arraydefaultmessage->content; // Long text - $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref);; // Short text ($langs->transnoentities('MailSentBy')...); + $object->actionmsg2 = $langs->transnoentities("PartnershipSentByEMail", $object->ref); + ; // Short text ($langs->transnoentities('MailSentBy')...); if (getDolGlobalString('MAIN_MAIL_REPLACE_EVENT_TITLE_BY_EMAIL_SUBJECT')) { $object->actionmsg2 = $subject; // Short text } @@ -475,9 +494,15 @@ class PartnershipUtils $this->output = "Rollback after error\n"; } $this->output .= $numofexpiredmembers.' partnership checked'."\n"; - if ($erroremail) $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; - if ($emailnotfound) $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; - if ($websitenotfound) $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; + if ($erroremail) { + $this->output .= '. Got errors when sending some email : '.$erroremail."\n"; + } + if ($emailnotfound) { + $this->output .= '. Email not found for some partner : '.$emailnotfound."\n"; + } + if ($websitenotfound) { + $this->output .= '. Website not found for some partner : '.$websitenotfound."\n"; + } $this->output .= "\nSQL used to find partnerships to scan: ".$sql; return ($error ? 1 : 0); diff --git a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php index c7409aba85e..895f28ab753 100644 --- a/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php +++ b/htdocs/partnership/core/modules/partnership/mod_partnership_standard.php @@ -83,7 +83,8 @@ class mod_partnership_standard extends ModeleNumRefPartnership { 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_partnership_standard extends ModeleNumRefPartnership 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/partnership/core/modules/partnership/modules_partnership.php b/htdocs/partnership/core/modules/partnership/modules_partnership.php index dafab0cc8ed..0f8fde60cfa 100644 --- a/htdocs/partnership/core/modules/partnership/modules_partnership.php +++ b/htdocs/partnership/core/modules/partnership/modules_partnership.php @@ -38,7 +38,6 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir */ abstract class ModelePDFPartnership extends CommonDocGenerator { - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** * Return list of active generation modules diff --git a/htdocs/partnership/partnership_agenda.php b/htdocs/partnership/partnership_agenda.php index 3a2af03c5e1..a48b03f8c46 100644 --- a/htdocs/partnership/partnership_agenda.php +++ b/htdocs/partnership/partnership_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'); @@ -93,10 +93,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} diff --git a/htdocs/partnership/partnership_card.php b/htdocs/partnership/partnership_card.php index 7bc83306115..2072c9182c9 100644 --- a/htdocs/partnership/partnership_card.php +++ b/htdocs/partnership/partnership_card.php @@ -93,8 +93,12 @@ if (!isModEnabled('partnership')) { if (!$permissiontoread) { accessforbidden(); } -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} /* @@ -252,7 +256,9 @@ if (empty($reshook)) { } } -if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) $object->fields['reason_decline_or_cancel']['visible'] = 3; +if ($object->id > 0 && $object->status == $object::STATUS_REFUSED) { + $object->fields['reason_decline_or_cancel']['visible'] = 3; +} @@ -539,9 +545,12 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $parameters = array(); $reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - if (empty($reshook)) + if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + } + if (empty($reshook)) { $object->formAddObjectLine(1, $mysoc, $soc); + } } } diff --git a/htdocs/partnership/partnership_contact.php b/htdocs/partnership/partnership_contact.php index 415b24c3fdf..410a39dcb0a 100644 --- a/htdocs/partnership/partnership_contact.php +++ b/htdocs/partnership/partnership_contact.php @@ -34,7 +34,7 @@ require_once DOL_DOCUMENT_ROOT.'/partnership/lib/partnership.lib.php'; // Load translation files required by the page $langs->loadLangs(array("partnership", "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'); @@ -59,10 +59,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} diff --git a/htdocs/partnership/partnership_document.php b/htdocs/partnership/partnership_document.php index 481bf2793de..83e226a780b 100644 --- a/htdocs/partnership/partnership_document.php +++ b/htdocs/partnership/partnership_document.php @@ -83,10 +83,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} @@ -118,7 +126,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/partnership/partnership_list.php b/htdocs/partnership/partnership_list.php index 250d5adca31..13f6ddc438e 100644 --- a/htdocs/partnership/partnership_list.php +++ b/htdocs/partnership/partnership_list.php @@ -90,7 +90,9 @@ $error = 0; $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); -if ($managedfor != 'member' && $sortfield == 'd.datefin') $sortfield = ''; +if ($managedfor != 'member' && $sortfield == 'd.datefin') { + $sortfield = ''; +} // Default sort order (if not yet defined by previous GETPOST) if (!$sortfield) { @@ -156,10 +158,18 @@ $permissiontodelete = $user->rights->partnership->delete; //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} /* diff --git a/htdocs/partnership/partnership_note.php b/htdocs/partnership/partnership_note.php index e75e28e273e..dec2b76ccb1 100644 --- a/htdocs/partnership/partnership_note.php +++ b/htdocs/partnership/partnership_note.php @@ -66,10 +66,18 @@ $managedfor = getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR', 'thirdparty'); //if ($user->socid > 0) accessforbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'partnership', $object->id); -if (empty($conf->partnership->enabled)) accessforbidden(); -if (empty($permissiontoread)) accessforbidden(); -if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') accessforbidden(); -if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') accessforbidden(); +if (empty($conf->partnership->enabled)) { + accessforbidden(); +} +if (empty($permissiontoread)) { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_member > 0) && $managedfor == 'member') { + accessforbidden(); +} +if ($object->id > 0 && !($object->fk_soc > 0) && $managedfor == 'thirdparty') { + accessforbidden(); +} /* @@ -145,7 +153,7 @@ if ($id > 0 || !empty($ref)) { } } }*/ - $morehtmlref .= ''; + $morehtmlref .= ''; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php index d07ef173071..d8a5422c6a1 100644 --- a/htdocs/paybox/admin/paybox.php +++ b/htdocs/paybox/admin/paybox.php @@ -100,7 +100,7 @@ if ($action == 'setvalue' && $user->admin) { if (!($result > 0)) { $error++; } - $result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity); + $result = dolibarr_set_const($db, "PAYBOX_HMAC_KEY", dol_encode(GETPOST('PAYBOX_HMAC_KEY', 'alpha')), 'chaine', 0, '', $conf->entity); if (!($result > 0)) { $error++; } diff --git a/htdocs/paybox/lib/paybox.lib.php b/htdocs/paybox/lib/paybox.lib.php index 767a4864981..16d574d71eb 100644 --- a/htdocs/paybox/lib/paybox.lib.php +++ b/htdocs/paybox/lib/paybox.lib.php @@ -146,8 +146,8 @@ function print_paybox_redirect($PRICE, $CURRENCY, $EMAIL, $urlok, $urlko, $TAG) "&PBX_OUTPUT=".$IBS_OUTPUT. "&PBX_SOURCE=".$PBX_SOURCE. "&PBX_TYPEPAIEMENT=".$PBX_TYPEPAIEMENT; - "&PBX_HASH=".$PBX_HASH; - "&PBX_TIME=".$PBX_TIME; + "&PBX_HASH=".$PBX_HASH; + "&PBX_TIME=".$PBX_TIME; $binKey = pack("H*", dol_decode($conf->global->PAYBOX_HMAC_KEY)); diff --git a/htdocs/paypal/lib/paypalfunctions.lib.php b/htdocs/paypal/lib/paypalfunctions.lib.php index dce0b0908b5..0403f2c2735 100644 --- a/htdocs/paypal/lib/paypalfunctions.lib.php +++ b/htdocs/paypal/lib/paypalfunctions.lib.php @@ -78,4 +78,4 @@ $PROXY_HOST = $conf->global->MAIN_PROXY_HOST; $PROXY_PORT = $conf->global->MAIN_PROXY_PORT; $PROXY_USER = $conf->global->MAIN_PROXY_USER; $PROXY_PASS = $conf->global->MAIN_PROXY_PASS; -$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ?false:true; +$USE_PROXY = !getDolGlobalString('MAIN_PROXY_USE') ? false : true; diff --git a/htdocs/product/admin/dynamic_prices.php b/htdocs/product/admin/dynamic_prices.php index 7cab3da0d11..de81a0b0aab 100644 --- a/htdocs/product/admin/dynamic_prices.php +++ b/htdocs/product/admin/dynamic_prices.php @@ -67,9 +67,9 @@ if ($action == 'edit_updater') { if (!empty($action) && empty($cancel)) { //Global variable actions if ($action == 'create_variable' || $action == 'edit_variable') { - $price_globals->code = GETPOSTISSET('code') ?GETPOST('code', 'alpha') : $price_globals->code; - $price_globals->description = GETPOSTISSET('description') ?GETPOST('description', 'restricthtml') : $price_globals->description; - $price_globals->value = GETPOSTISSET('value') ?GETPOST('value', 'int') : $price_globals->value; + $price_globals->code = GETPOSTISSET('code') ? GETPOST('code', 'alpha') : $price_globals->code; + $price_globals->description = GETPOSTISSET('description') ? GETPOST('description', 'restricthtml') : $price_globals->description; + $price_globals->value = GETPOSTISSET('value') ? GETPOST('value', 'int') : $price_globals->value; //Check if record already exists only when saving if (!empty($save)) { foreach ($price_globals->listGlobalVariables() as $entry) { diff --git a/htdocs/product/admin/inventory_extrafields.php b/htdocs/product/admin/inventory_extrafields.php index 74267ee1c8e..45c17e805d0 100644 --- a/htdocs/product/admin/inventory_extrafields.php +++ b/htdocs/product/admin/inventory_extrafields.php @@ -29,16 +29,31 @@ // Load Dolibarr environment $res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +} // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { + $i--; + $j--; +} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +} +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +} // Try main.inc.php using relative path -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if (!$res) die("Include of main fails"); +if (!$res && file_exists("../../main.inc.php")) { + $res = @include "../../main.inc.php"; +} +if (!$res && file_exists("../../../main.inc.php")) { + $res = @include "../../../main.inc.php"; +} +if (!$res) { + die("Include of main fails"); +} require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; @@ -52,13 +67,17 @@ $form = new Form($db); // List of supported format $tmptype2label = ExtraFields::$type2label; $type2label = array(''); -foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); $elementtype = 'inventory'; //Must be the $table_element of the class that manage extrafield -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} /* diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index ace7a095e95..87fd2ce60ae 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -166,7 +166,9 @@ if ($action == 'specimen') { // For products $product->initAsSpecimen(); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']); foreach ($dirmodels as $reldir) { $file = dol_buildpath($reldir."core/modules/product/doc/pdf_".$modele.".modules.php", 0); @@ -321,7 +323,7 @@ foreach ($dirproduct as $dirroot) { dol_syslog($e->getMessage(), LOG_ERR); } - $modCodeProduct = new $file; + $modCodeProduct = new $file(); // Show modules according to features level if ($modCodeProduct->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { @@ -436,7 +438,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print ''; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/product/admin/product_lot.php b/htdocs/product/admin/product_lot.php index 8520f471196..4526636d8b1 100644 --- a/htdocs/product/admin/product_lot.php +++ b/htdocs/product/admin/product_lot.php @@ -31,8 +31,9 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $langs->loadLangs(array("admin", "products", "productbatch")); // Security check -if (!$user->admin || (empty($conf->productbatch->enabled))) +if (!$user->admin || (empty($conf->productbatch->enabled))) { accessforbidden(); +} $action = GETPOST('action', 'alpha'); $value = GETPOST('value', 'alpha'); @@ -55,7 +56,9 @@ if ($action == 'updateMaskLot') { if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) { $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity); - if ($res <= 0) $error++; + if ($res <= 0) { + $error++; + } } if (!$error) { @@ -69,7 +72,9 @@ if ($action == 'updateMaskLot') { if ($maskconstbatch && preg_match('/_MASK$/', $maskconstbatch)) { $res = dolibarr_set_const($db, $maskconstbatch, $maskbatch, 'chaine', 0, '', $conf->entity); - if ($res <= 0) $error++; + if ($res <= 0) { + $error++; + } } if (!$error) { @@ -209,8 +214,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue; - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { + continue; + } + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { + continue; + } if ($module->isEnabled()) { print ''.$module->name."\n"; @@ -220,9 +229,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { // Show example of numbering model print ''; $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; - elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); - else print $tmp; + if (preg_match('/^Error/', $tmp)) { + print '
'.$langs->trans($tmp).'
'; + } elseif ($tmp == 'NotConfigured') { + print $langs->trans($tmp); + } else { + print $tmp; + } print ''."\n"; print ''; @@ -245,8 +258,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { $nextval = $langs->trans($nextval); + } $htmltooltip .= $nextval.'
'; } else { $htmltooltip .= $langs->trans($module->error).'
'; @@ -301,8 +315,12 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { $module = new $file($db); // Show modules according to features level - if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) continue; - if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) continue; + if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { + continue; + } + if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) { + continue; + } if ($module->isEnabled()) { print ''.$module->name."\n"; @@ -312,9 +330,13 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { // Show example of numbering model print ''; $tmp = $module->getExample(); - if (preg_match('/^Error/', $tmp)) print '
'.$langs->trans($tmp).'
'; - elseif ($tmp == 'NotConfigured') print $langs->trans($tmp); - else print $tmp; + if (preg_match('/^Error/', $tmp)) { + print '
'.$langs->trans($tmp).'
'; + } elseif ($tmp == 'NotConfigured') { + print $langs->trans($tmp); + } else { + print $tmp; + } print ''."\n"; print ''; @@ -337,8 +359,9 @@ if (getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) { if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $htmltooltip .= ''.$langs->trans("NextValue").': '; if ($nextval) { - if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') + if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { $nextval = $langs->trans($nextval); + } $htmltooltip .= $nextval.'
'; } else { $htmltooltip .= $langs->trans($module->error).'
'; @@ -428,7 +451,7 @@ foreach ($dirmodels as $reldir) { if ($modulequalified) { print ''; - print (empty($module->name) ? $name : $module->name); + print(empty($module->name) ? $name : $module->name); print "\n"; if (method_exists($module, 'info')) { print $module->info($langs); diff --git a/htdocs/product/admin/product_tools.php b/htdocs/product/admin/product_tools.php index 02e0f52e0fc..3faa9d44643 100644 --- a/htdocs/product/admin/product_tools.php +++ b/htdocs/product/admin/product_tools.php @@ -108,7 +108,9 @@ if ($action == 'convert') { $objectstatic = new Product($db); // Object init must be into loop to avoid to get value of previous step $ret = $objectstatic->fetch($obj->rowid); if ($ret > 0) { - $ret = 0; $retm = 0; $updatelevel1 = false; + $ret = 0; + $retm = 0; + $updatelevel1 = false; // Update multiprice $listofmulti = array_reverse($objectstatic->multiprices, true); // To finish with level 1 @@ -209,7 +211,9 @@ if ($action == 'convert') { $objectstatic2 = new ProductFournisseur($db); // Object init must be into loop to avoid to get value of previous step $ret = $objectstatic2->fetch_product_fournisseur_price($obj->rowid); if ($ret > 0) { - $ret = 0; $retm = 0; $updatelevel1 = false; + $ret = 0; + $retm = 0; + $updatelevel1 = false; $price_base_type = 'HT'; //$price_base_type = $objectstatic2->price_base_type; // Get price_base_type of product/service to keep the same for update diff --git a/htdocs/product/admin/stock_mouvement_extrafields.php b/htdocs/product/admin/stock_mouvement_extrafields.php index 33aee41072e..b4c3542331d 100644 --- a/htdocs/product/admin/stock_mouvement_extrafields.php +++ b/htdocs/product/admin/stock_mouvement_extrafields.php @@ -29,16 +29,31 @@ // Load Dolibarr environment $res = 0; // Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) -if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { + $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"; +} // Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME $tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1; -while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { $i--; $j--; } -if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; -if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) { + $i--; + $j--; +} +if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) { + $res = @include substr($tmp, 0, ($i + 1))."/main.inc.php"; +} +if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) { + $res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php"; +} // Try main.inc.php using relative path -if (!$res && file_exists("../../main.inc.php")) $res = @include "../../main.inc.php"; -if (!$res && file_exists("../../../main.inc.php")) $res = @include "../../../main.inc.php"; -if (!$res) die("Include of main fails"); +if (!$res && file_exists("../../main.inc.php")) { + $res = @include "../../main.inc.php"; +} +if (!$res && file_exists("../../../main.inc.php")) { + $res = @include "../../../main.inc.php"; +} +if (!$res) { + die("Include of main fails"); +} require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; @@ -52,13 +67,17 @@ $form = new Form($db); // List of supported format $tmptype2label = ExtraFields::$type2label; $type2label = array(''); -foreach ($tmptype2label as $key => $val) $type2label[$key] = $langs->transnoentitiesnoconv($val); +foreach ($tmptype2label as $key => $val) { + $type2label[$key] = $langs->transnoentitiesnoconv($val); +} $action = GETPOST('action', 'aZ09'); $attrname = GETPOST('attrname', 'alpha'); $elementtype = 'stock_mouvement'; //Must be the $table_element of the class that manage extrafield -if (!$user->admin) accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} /* diff --git a/htdocs/product/agenda.php b/htdocs/product/agenda.php index b7b5470a35c..3f1a225b0b1 100644 --- a/htdocs/product/agenda.php +++ b/htdocs/product/agenda.php @@ -44,7 +44,7 @@ if (GETPOST('actioncode', 'array')) { $actioncode = '0'; } } else { - $actioncode = GETPOST("actioncode", "alpha", 3) ?GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); } $search_rowid = GETPOST('search_rowid'); $search_agenda_label = GETPOST('search_agenda_label'); @@ -56,7 +56,7 @@ if ($user->socid) { $id = $user->socid; } -$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/product/card.php b/htdocs/product/card.php index dd3bd624543..3a5cf31cc85 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -493,9 +493,9 @@ if (empty($reshook)) { } if (empty($ref)) { if (!getDolGlobalString('PRODUCT_GENERATE_REF_AFTER_FORM')) { - setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors'); - $action = "create"; - $error++; + setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('ProductRef')), null, 'errors'); + $action = "create"; + $error++; } } if (!empty($duration_value) && empty($duration_unit)) { @@ -529,7 +529,10 @@ if (empty($reshook)) { $vatratecode = ''; $tva_tx = preg_replace('/[^0-9\.].*$/', '', $tva_tx_txt); // keep remove all after the numbers and dot $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; - $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + $localtax1 = 0; + $localtax2 = 0; + $localtax1_type = '0'; + $localtax2_type = '0'; // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes $reg = array(); if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { @@ -596,8 +599,8 @@ if (empty($reshook)) { $object->duration_unit = $duration_unit; $object->fk_default_warehouse = GETPOST('fk_default_warehouse', 'int'); $object->fk_default_workstation = GETPOST('fk_default_workstation', 'int'); - $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ?GETPOST('seuil_stock_alerte') : 0; - $object->desiredstock = GETPOST('desiredstock') ?GETPOST('desiredstock') : 0; + $object->seuil_stock_alerte = GETPOST('seuil_stock_alerte') ? GETPOST('seuil_stock_alerte') : 0; + $object->desiredstock = GETPOST('desiredstock') ? GETPOST('desiredstock') : 0; $object->canvas = GETPOST('canvas'); $object->net_measure = GETPOST('net_measure'); $object->net_measure_units = GETPOST('net_measure_units'); // This is not the fk_unit but the power of unit @@ -1283,7 +1286,7 @@ if (isModEnabled('barcode') && getDolGlobalString('BARCODE_PRODUCT_ADDON_NUM')) } } if ($res > 0) { - $modBarCodeProduct = new $module(); + $modBarCodeProduct = new $module(); } } @@ -1460,7 +1463,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio if ($showbarcode) { print ''.$langs->trans('BarcodeType').''; if (GETPOSTISSET('fk_barcode_type')) { - $fk_barcode_type = GETPOST('fk_barcode_type')?GETPOST('fk_barcode_type'):0; + $fk_barcode_type = GETPOST('fk_barcode_type') ? GETPOST('fk_barcode_type') : 0; } else { if (empty($fk_barcode_type) && getDolGlobalString('PRODUIT_DEFAULT_BARCODE_TYPE')) { $fk_barcode_type = getDolGlobalInt("PRODUIT_DEFAULT_BARCODE_TYPE"); @@ -1528,11 +1531,11 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } if ($type == $object::TYPE_SERVICE && isModEnabled("workstation")) { - // Default workstation - print ''.$langs->trans("DefaultWorkstation").''; - print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); - print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); - print ''; + // Default workstation + print ''.$langs->trans("DefaultWorkstation").''; + print img_picto($langs->trans("DefaultWorkstation"), 'workstation', 'class="pictofixedwidth"'); + print $formproduct->selectWorkstations($object->fk_default_workstation, 'fk_default_workstation', 1); + print ''; } // Duration @@ -1568,7 +1571,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ''.$langs->trans("Weight").''; print img_picto('', 'fa-balance-scale', 'class="pictofixedwidth"'); print ''; - print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ?GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); + print $formproduct->selectMeasuringUnits("weight_units", "weight", GETPOSTISSET('weight_units') ? GETPOST('weight_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 2); print ''; } @@ -1579,21 +1582,21 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio print ' x '; print ' x '; print ''; - print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ?GETPOST('size_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("size_units", "size", GETPOSTISSET('size_units') ? GETPOST('size_units', 'alpha') : '0', 0, 2); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_SURFACE')) { // Brut Surface print ''.$langs->trans("Surface").''; print ''; - print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ?GETPOST('surface_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("surface_units", "surface", GETPOSTISSET('surface_units') ? GETPOST('surface_units', 'alpha') : '0', 0, 2); print ''; } if (!getDolGlobalString('PRODUCT_DISABLE_VOLUME')) { // Brut Volume print ''.$langs->trans("Volume").''; print ''; - print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ?GETPOST('volume_units', 'alpha') : '0', 0, 2); + print $formproduct->selectMeasuringUnits("volume_units", "volume", GETPOSTISSET('volume_units') ? GETPOST('volume_units', 'alpha') : '0', 0, 2); print ''; } @@ -1601,7 +1604,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Net Measure print ''.$langs->trans("NetMeasure").''; print ''; - print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ?GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); + print $formproduct->selectMeasuringUnits("net_measure_units", '', GETPOSTISSET('net_measure_units') ? GETPOST('net_measure_units', 'alpha') : (!getDolGlobalString('MAIN_WEIGHT_DEFAULT_UNIT') ? 0 : $conf->global->MAIN_WEIGHT_DEFAULT_UNIT), 0, 0); print ''; } } @@ -1660,13 +1663,13 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio // Note (private, no output on invoices, propales...) //if (!empty($conf->global->MAIN_DISABLE_NOTES_TAB)) available in create mode //{ - print ''.$langs->trans("NoteNotVisibleOnBill").''; + print ''.$langs->trans("NoteNotVisibleOnBill").''; - // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. - $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%'); - $doleditor->Create(); + // We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF. + $doleditor = new DolEditor('note_private', GETPOST('note_private', 'restricthtml'), '', 140, 'dolibarr_details', '', false, true, getDolGlobalString('FCKEDITOR_ENABLE_NOTE_PRIVATE'), ROWS_8, '90%'); + $doleditor->Create(); - print ""; + print ""; //} if (isModEnabled('categorie')) { @@ -2622,7 +2625,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $warehouse->fetch($object->fk_default_warehouse); print ''.$langs->trans("DefaultWarehouse").''; - print (!empty($warehouse->id) ? $warehouse->getNomUrl(1) : ''); + print(!empty($warehouse->id) ? $warehouse->getNomUrl(1) : ''); print ''; } @@ -2631,7 +2634,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio $res = $workstation->fetch($object->fk_default_workstation); print ''.$langs->trans("DefaultWorkstation").''; - print (!empty($workstation->id) ? $workstation->getNomUrl(1) : ''); + print(!empty($workstation->id) ? $workstation->getNomUrl(1) : ''); print ''; } @@ -2666,7 +2669,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($canvasdisplayactio } elseif ($object->duration_value > 0) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } - print (!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); + print(!empty($object->duration_unit) && isset($dur[$object->duration_unit]) ? " ".$langs->trans($dur[$object->duration_unit])." " : ''); // Mandatory period if ($object->duration_value > 0) { diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 79f54094138..b6ec2cb629f 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -319,7 +319,7 @@ class FormProduct } $out .= ''; print ''; @@ -697,7 +697,7 @@ if ($id > 0 || $ref) { $pricesupplierincurrencytouse = (GETPOST('multicurrency_price') ? GETPOST('multicurrency_price') : (isset($object->fourn_multicurrency_price) ? $object->fourn_multicurrency_price : '')); print ''; print ' '; - print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ?GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices + print $form->selectPriceBaseType((GETPOST('multicurrency_price_base_type') ? GETPOST('multicurrency_price_base_type') : 'HT'), "multicurrency_price_base_type"); // We keep 'HT' here, multicurrency_price_base_type is not yet supported for supplier prices print ''; // Price qty min @@ -786,7 +786,7 @@ END; // Discount qty min print ''.$langs->trans("DiscountQtyMin").''; - print ' %'; + print ' %'; print ''; print ''; @@ -1103,7 +1103,7 @@ END; } if (is_object($hookmanager)) { - $parameters = array('id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields); + $parameters = array('id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id, 'nbfields'=>$nbfields); $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); } print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'center maxwidthsearch '); @@ -1286,7 +1286,7 @@ END; } if (is_object($hookmanager)) { - $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn)?$id_fourn:''), 'prod_id'=>$object->id); + $parameters = array('id_pfp'=>$productfourn->product_fourn_price_id, 'id_fourn'=>(!empty($id_fourn) ? $id_fourn : ''), 'prod_id'=>$object->id); $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); } diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 2d1553c198e..5de07fc509c 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -341,9 +341,9 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr $product_static->status_buy = $objp->tobuy; $product_static->status_batch = $objp->tobatch; - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'read'); if ($product_static->isService()) { - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'read'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'read'); } // Multilangs diff --git a/htdocs/product/inventory/card.php b/htdocs/product/inventory/card.php index 63c1f537df5..6760d4c2841 100644 --- a/htdocs/product/inventory/card.php +++ b/htdocs/product/inventory/card.php @@ -38,7 +38,7 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $include_sub_warehouse = !empty(GETPOST('include_sub_warehouse')) ? GETPOST('include_sub_warehouse') : 0; diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php index 9a85b3f3dc4..99e01a02e48 100644 --- a/htdocs/product/inventory/inventory.php +++ b/htdocs/product/inventory/inventory.php @@ -40,10 +40,10 @@ $ref = GETPOST('ref', 'alpha'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'inventorycard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $listoffset = GETPOST('listoffset', 'alpha'); -$limit = GETPOST('limit', 'int') > 0 ?GETPOST('limit', 'int') : $conf->liste_limit; +$limit = GETPOST('limit', 'int') > 0 ? GETPOST('limit', 'int') : $conf->liste_limit; $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1) { $page = 0; @@ -197,7 +197,9 @@ if (empty($reshook)) { //$inventorycode = 'INV'.$object->id; $inventorycode = 'INV-'.$object->ref; $price = 0; - if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) $price = $line->pmp_real; + if (!empty($line->pmp_real) && getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { + $price = $line->pmp_real; + } $idstockmove = $stockmovment->_create($user, $line->fk_product, $line->fk_warehouse, $stock_movement_qty, $movement_type, $price, $langs->trans('LabelOfInventoryMovemement', $object->ref), $inventorycode, $datemovement, '', '', $line->batch); if ($idstockmove < 0) { @@ -825,7 +827,7 @@ if ($action == 'updatebyscaning') { result=false; tabproduct.forEach(product => { $.ajax({ url: \''.DOL_URL_ROOT.'/product/inventory/ajax/searchfrombarcode.php\', - data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse)?'"fk_entrepot":'.$object->fk_warehouse.', ':'').(!empty($object->fk_product)?'"fk_product":'.$object->fk_product.', ':'').'"barcode":element, "product":product, "mode":mode}, + data: { "token":"'.newToken().'", "action":"existbarcode", '.(!empty($object->fk_warehouse) ? '"fk_entrepot":'.$object->fk_warehouse.', ' : '').(!empty($object->fk_product) ? '"fk_product":'.$object->fk_product.', ' : '').'"barcode":element, "product":product, "mode":mode}, type: \'POST\', async: false, success: function(response) { @@ -1083,8 +1085,11 @@ if ($resql) { if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { //PMP Expected - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; - else $pmp_expected = $product_static->pmp; + if (!empty($obj->pmp_expected)) { + $pmp_expected = $obj->pmp_expected; + } else { + $pmp_expected = $product_static->pmp; + } $pmp_valuation = $pmp_expected * $valuetoshow; print ''; print price($pmp_expected); @@ -1105,8 +1110,11 @@ if ($resql) { print ''; - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; - else $pmp_real = $product_static->pmp; + if (!empty($obj->pmp_real)) { + $pmp_real = $obj->pmp_real; + } else { + $pmp_real = $product_static->pmp; + } $pmp_valuation_real = $pmp_real * $qty_view; print ''; print ''; @@ -1134,8 +1142,11 @@ if ($resql) { } else { if (getDolGlobalString('INVENTORY_MANAGE_REAL_PMP')) { //PMP Expected - if (!empty($obj->pmp_expected)) $pmp_expected = $obj->pmp_expected; - else $pmp_expected = $product_static->pmp; + if (!empty($obj->pmp_expected)) { + $pmp_expected = $obj->pmp_expected; + } else { + $pmp_expected = $product_static->pmp; + } $pmp_valuation = $pmp_expected * $valuetoshow; print ''; print price($pmp_expected); @@ -1150,8 +1161,11 @@ if ($resql) { //PMP Real print ''; - if (!empty($obj->pmp_real)) $pmp_real = $obj->pmp_real; - else $pmp_real = $product_static->pmp; + if (!empty($obj->pmp_real)) { + $pmp_real = $obj->pmp_real; + } else { + $pmp_real = $product_static->pmp; + } $pmp_valuation_real = $pmp_real * $obj->qty_view; print price($pmp_real); print ''; diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index aae765cfeb0..6ee9885c76e 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -34,7 +34,7 @@ if (isModEnabled('categorie')) { // Load translation files required by the page $langs->loadLangs(array("stocks", "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 @@ -48,7 +48,7 @@ $mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hier $id = GETPOST('id', 'int'); // 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'); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index f2d90aff492..d31602a2552 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -70,7 +70,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); // Search Criterias -$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); +$sall = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_id = GETPOST("search_id", 'alpha'); $search_ref = GETPOST("search_ref", 'alpha'); $search_ref_supplier = GETPOST("search_ref_supplier", 'alpha'); @@ -117,7 +117,7 @@ if (isModEnabled('variants')) { $diroutputmassaction = $conf->product->dir_output.'/temp/massgeneration/'.$user->id; // 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'); @@ -136,14 +136,16 @@ if (!$sortorder) { } // Initialize context for list -$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'productservicelist'; +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'productservicelist'; if ((string) $type == '1') { - $contextpage = 'servicelist'; if ($search_type == '') { + $contextpage = 'servicelist'; + if ($search_type == '') { $search_type = '1'; } } if ((string) $type == '0') { - $contextpage = 'productlist'; if ($search_type == '') { + $contextpage = 'productlist'; + if ($search_type == '') { $search_type = '0'; } } @@ -1557,9 +1559,9 @@ while ($i < $imaxinloop) { $object = $product_static; - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('product', 'product_advance', 'read_prices'):$user->hasRight('product', 'lire'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('product', 'product_advance', 'read_prices') : $user->hasRight('product', 'lire'); if ($product_static->isService()) { - $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS')?$user->hasRight('service', 'service_advance', 'read_prices'):$user->hasRight('service', 'lire'); + $usercancreadprice = getDolGlobalString('MAIN_USE_ADVANCED_PERMS') ? $user->hasRight('service', 'service_advance', 'read_prices') : $user->hasRight('service', 'lire'); } if ($mode == 'kanban') { @@ -1705,7 +1707,7 @@ while ($i < $imaxinloop) { $dur = array("i"=>$langs->trans("Minute"), "h"=>$langs->trans("Hour"), "d"=>$langs->trans("Day"), "w"=>$langs->trans("Week"), "m"=>$langs->trans("Month"), "y"=>$langs->trans("Year")); } print $duration_value; - print ((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : ''); + print((!empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : ''); } elseif (!preg_match('/^[a-z]$/i', $obj->duration)) { // If duration is a simple char (like 's' of 'm'), we do not show value print $obj->duration; } @@ -2053,9 +2055,13 @@ while ($i < $imaxinloop) { print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; } if ($usercancreadprice) { - if ($product_static->stock_reel < 0) { print ''; } + if ($product_static->stock_reel < 0) { + print ''; + } print price(price2num($product_static->stock_reel, 'MS'), 0, $langs, 1, 0); - if ($product_static->stock_reel < 0) { print ''; } + if ($product_static->stock_reel < 0) { + print ''; + } } } print ''; @@ -2071,9 +2077,13 @@ while ($i < $imaxinloop) { print img_warning($langs->trans("StockLowerThanLimit", $obj->seuil_stock_alerte)).' '; } if ($usercancreadprice) { - if ($product_static->stock_theorique < 0) { print ''; } + if ($product_static->stock_theorique < 0) { + print ''; + } print price(price2num($product_static->stock_theorique, 'MS'), 0, $langs, 1, 0); - if ($product_static->stock_theorique < 0) { print ''; } + if ($product_static->stock_theorique < 0) { + print ''; + } } } print ''; diff --git a/htdocs/product/popuprop.php b/htdocs/product/popuprop.php index 8c8271738ba..0c54b88c7d0 100644 --- a/htdocs/product/popuprop.php +++ b/htdocs/product/popuprop.php @@ -44,7 +44,7 @@ if (!empty($user->socid)) { $socid = $user->socid; } -$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/product/price.php b/htdocs/product/price.php index f1d3e7efefb..030fe94a3c0 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -134,7 +134,10 @@ if (empty($reshook)) { $tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; - $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + $localtax1 = 0; + $localtax2 = 0; + $localtax1_type = '0'; + $localtax2_type = '0'; // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { @@ -389,7 +392,10 @@ if (empty($reshook)) { $tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; - $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + $localtax1 = 0; + $localtax2 = 0; + $localtax1_type = '0'; + $localtax2_type = '0'; // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { // We look into database using code @@ -643,7 +649,10 @@ if (empty($reshook)) { $tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; - $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + $localtax1 = 0; + $localtax2 = 0; + $localtax1_type = '0'; + $localtax2_type = '0'; // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { // We look into database using code @@ -763,7 +772,10 @@ if (empty($reshook)) { $tva_tx = price2num(preg_replace('/\*/', '', $tva_tx)); // keep remove all after the numbers and dot $npr = preg_match('/\*/', $tva_tx_txt) ? 1 : 0; - $localtax1 = 0; $localtax2 = 0; $localtax1_type = '0'; $localtax2_type = '0'; + $localtax1 = 0; + $localtax2 = 0; + $localtax1_type = '0'; + $localtax2_type = '0'; // If value contains the unique code of vat line (new recommanded method), we use it to find npr and local taxes if (preg_match('/\((.*)\)/', $tva_tx_txt, $reg)) { // We look into database using code @@ -1520,8 +1532,7 @@ if ($action == 'edit_price' && $object->getRights()->creer) { print ''; } else { - print ''."\n"; - ?> + print ''."\n"; ?>