From 0b406172fd718cc59bdd2d872f3aa1e2431ba2bd Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 7 Nov 2019 11:59:59 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- htdocs/admin/emailcollector_card.php | 136 +++++++++---------- htdocs/admin/system/xcache.php | 2 +- htdocs/asset/card.php | 88 ++++++------- htdocs/core/modules/modBom.class.php | 62 ++++----- htdocs/mrp/mo_card.php | 174 ++++++++++++------------- htdocs/mrp/mo_production.php | 122 ++++++++--------- htdocs/user/group/card.php | 104 +++++++-------- htdocs/website/websiteaccount_card.php | 90 ++++++------- 8 files changed, 389 insertions(+), 389 deletions(-) diff --git a/htdocs/admin/emailcollector_card.php b/htdocs/admin/emailcollector_card.php index f3985bc70a4..43d0731c434 100644 --- a/htdocs/admin/emailcollector_card.php +++ b/htdocs/admin/emailcollector_card.php @@ -40,12 +40,12 @@ if (empty($conf->emailcollector->enabled)) accessforbidden(); $langs->loadLangs(array("admin", "mails", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'myobjectcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'myobjectcard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); $operationid = GETPOST('operationid', 'int'); @@ -53,7 +53,7 @@ $operationid = GETPOST('operationid', 'int'); // Initialize technical objects $object = new EmailCollector($db); $extrafields = new ExtraFields($db); -$diroutputmassaction = $conf->emailcollector->dir_output . '/temp/massgeneration/' . $user->id; +$diroutputmassaction = $conf->emailcollector->dir_output.'/temp/massgeneration/'.$user->id; $hookmanager->initHooks(array('emailcollectorcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels @@ -65,14 +65,14 @@ $search_array_options = $extrafields->getOptionalsFromPost($object->table_elemen $search_all = trim(GETPOST("search_all", 'alpha')); $search = array(); foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } if (GETPOST('saveoperation2')) $action = 'updateoperation'; -if (empty($action) && empty($id) && empty($ref)) $action='view'; +if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); @@ -80,11 +80,11 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu //$isdraft = (($object->statut == MyObject::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mymodule', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->emailcollector->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->emailcollector->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->emailcollector->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php -$debuginfo=''; +$debuginfo = ''; /* @@ -99,8 +99,8 @@ if (empty($reshook)) { $error = 0; - $permissiontoadd=1; - $permissiontodelete=1; + $permissiontoadd = 1; + $permissiontodelete = 1; if (empty($backtopage)) $backtopage = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.($id > 0 ? $id : '__ID__'); $backurlforlist = DOL_URL_ROOT.'/admin/emailcollector_list.php'; @@ -252,10 +252,10 @@ jQuery(document).ready(function() { if ($action == 'create') { print load_fiche_titre($langs->trans("NewEmailCollector", $langs->transnoentitiesnoconv("EmailCollector"))); - print '
'; - print ''; + print ''; + print ''; print ''; - print ''; + print ''; dol_fiche_head(array(), ''); @@ -264,19 +264,19 @@ if ($action == 'create') { //unset($fields[]); // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print ''."\n"; dol_fiche_end(); print '
'; - print ''; + print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print '
'; @@ -287,28 +287,28 @@ if (($id || $ref) && $action == 'edit') { print load_fiche_titre($langs->trans("EmailCollector")); - print '
'; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; dol_fiche_head(); - print '' . "\n"; + print '
'."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'; dol_fiche_end(); - print '
'; - print '   '; + print '
'; + print '   '; print '
'; print ''; @@ -330,14 +330,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation to delete if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteEmailCollector'), $langs->trans('ConfirmDeleteEmailCollector'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteEmailCollector'), $langs->trans('ConfirmDeleteEmailCollector'), 'confirm_delete', '', 0, 1); } // Clone confirmation if ($action == 'clone') { // Create an array for form $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEmailCollector', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneEmailCollector', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } // Confirmation of action process @@ -345,21 +345,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $formquestion = array( 'text' => $langs->trans("EmailCollectorConfirmCollect"), ); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('EmailCollectorConfirmCollectTitle'), $text, 'confirm_collect', $formquestion, 0, 1, 220); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('EmailCollectorConfirmCollectTitle'), $text, 'confirm_collect', $formquestion, 0, 1, 220); } // Call Hook formConfirm $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; // Print form confirm print $formconfirm; // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlref = '
'; /* @@ -408,7 +408,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml = $langs->trans("NbOfEmailsInInbox").' : '; $sourcedir = $object->source_directory; - $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' + $targetdir = ($object->target_directory ? $object->target_directory : ''); // Can be '[Gmail]/Trash' or 'mytag' $connection = null; $connectstringserver = ''; @@ -428,7 +428,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $morehtml .= 'IMAP functions not available on your PHP'; } - if (! $connection) + if (!$connection) { $morehtml .= 'Failed to open IMAP connection '.$connectstringsource; } @@ -451,19 +451,19 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes //$keyforbreak='fieldkeytoswithonsecondcolumn'; - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; - print '
'; - print ''; + print ''; + print ''; print ''; - print ''; - print ''; + print ''; + print ''; // Filters print ''; @@ -473,7 +473,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add filter print ''; print ''; print ''; // List filters - foreach($object->filters as $rulefilter) + foreach ($object->filters as $rulefilter) { - $rulefilterobj=new EmailCollectorFilter($db); + $rulefilterobj = new EmailCollectorFilter($db); $rulefilterobj->fetch($rulefilter['id']); print ''; @@ -552,16 +552,16 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Add operation print ''; print ''; @@ -571,11 +571,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // List operations $nboflines = count($object->actions); $table_element_line = 'emailcollector_emailcollectoraction'; - $fk_element='position'; - $i=0; - foreach($object->actions as $ruleaction) + $fk_element = 'position'; + $i = 0; + foreach ($object->actions as $ruleaction) { - $ruleactionobj=new EmailcollectorAction($db); + $ruleactionobj = new EmailcollectorAction($db); $ruleactionobj->fetch($ruleaction['id']); print ''; @@ -604,7 +604,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { print ''.img_up('default', 0, 'imgupforline').''; } - if ($i < count($object->actions)-1) { + if ($i < count($object->actions) - 1) { print ''.img_down('default', 0, 'imgdownforline').''; } print ''; @@ -620,15 +620,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print '
'; - $arrayoftypes=array( + $arrayoftypes = array( 'from'=>array('label'=>'MailFrom', 'data-placeholder'=>$langs->trans('SearchString')), 'to'=>array('label'=>'MailTo', 'data-placeholder'=>$langs->trans('SearchString')), 'cc'=>array('label'=>'Cc', 'data-placeholder'=>$langs->trans('SearchString')), @@ -509,10 +509,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea else { jQuery("#rulevalue").prop("disabled", false); } jQuery("#rulevalue").attr("placeholder", (jQuery("#filtertype option:selected").attr("data-placeholder"))); '; - $noparam=array(); - foreach($arrayoftypes as $key => $value) + $noparam = array(); + foreach ($arrayoftypes as $key => $value) { - if ($value['noparam']) $noparam[]=$key; + if ($value['noparam']) $noparam[] = $key; } print '})'; print ''."\n"; @@ -523,9 +523,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print '
'; - $arrayoftypes=array( + $arrayoftypes = array( 'loadthirdparty'=>$langs->trans('LoadThirdPartyFromName', $langs->transnoentities("ThirdPartyName")), 'loadandcreatethirdparty'=>$langs->trans('LoadThirdPartyFromNameOrCreate', $langs->transnoentities("ThirdPartyName")), 'recordevent'=>'RecordEvent'); - if ($conf->projet->enabled) $arrayoftypes['project']='CreateLeadAndThirdParty'; - if ($conf->ticket->enabled) $arrayoftypes['ticket']='CreateTicketAndThirdParty'; + if ($conf->projet->enabled) $arrayoftypes['project'] = 'CreateLeadAndThirdParty'; + if ($conf->ticket->enabled) $arrayoftypes['ticket'] = 'CreateTicketAndThirdParty'; print $form->selectarray('operationtype', $arrayoftypes, '', 1, 0, 0, '', 1, 0, 0, '', 'maxwidth300'); print ''; print ''; - $htmltext=$langs->transnoentitiesnoconv("OperationParamDesc"); + $htmltext = $langs->transnoentitiesnoconv("OperationParamDesc"); //var_dump($htmltext); print $form->textwithpicto('', $htmltext); print '
'; - if (! empty($conf->use_javascript_ajax)) { + if (!empty($conf->use_javascript_ajax)) { $urltorefreshaftermove = DOL_URL_ROOT.'/admin/emailcollector_card.php?id='.$id; - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; print '
'; - print '
'; // End
+ print '
'; // End
print '

'; @@ -637,26 +637,26 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons for actions if ($action != 'presend' && $action != 'editline') { - print '
' . "\n"; + print '
'."\n"; $parameters = array(); $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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)) { - print ''; + print ''; // Clone - print ''; + print ''; - print ''; + print ''; - print ''; + print ''; } - print '
' . "\n"; + print '
'."\n"; } - if (! empty($debuginfo)) + if (!empty($debuginfo)) { print info_admin($debuginfo); } diff --git a/htdocs/admin/system/xcache.php b/htdocs/admin/system/xcache.php index 0cca1b94fc4..5061305f2e2 100644 --- a/htdocs/admin/system/xcache.php +++ b/htdocs/admin/system/xcache.php @@ -41,7 +41,7 @@ print "
\n"; if (!function_exists('xcache_info')) { - print 'XCache seems to be not installed. Function xcache_info not found.'; + print 'XCache seems to be not installed. Function xcache_info not found.'; llxFooter(); exit; } diff --git a/htdocs/asset/card.php b/htdocs/asset/card.php index ddde75ee463..1f6966fcd15 100644 --- a/htdocs/asset/card.php +++ b/htdocs/asset/card.php @@ -39,25 +39,25 @@ $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects -$object=new Asset($db); +$object = new Asset($db); $extrafields = new ExtraFields($db); -$diroutputmassaction=$conf->asset->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('assetcard')); // Note that conf->hooks_modules contains array +$diroutputmassaction = $conf->asset->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('assetcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all", 'alpha')); -$search=array(); -foreach($object->fields as $key => $val) +$search_all = trim(GETPOST("search_all", 'alpha')); +$search = array(); +foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } -if (empty($action) && empty($id) && empty($ref)) $action='view'; +if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); @@ -65,11 +65,11 @@ if (empty($action) && empty($id) && empty($ref)) $action='view'; //$result = restrictedArea($user, 'asset', $id); // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. -$permissionnote=$user->rights->asset->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->asset->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->asset->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->asset->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->asset->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php /* @@ -78,13 +78,13 @@ $permissiontoadd=$user->rights->asset->write; // Used by the include of actions * Put here all code to do according to value of "action" parameter */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - $error=0; + $error = 0; $permissiontoadd = $user->rights->asset->create; $permissiontodelete = $user->rights->asset->delete; @@ -97,9 +97,9 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to send emails - $trigger_name='ASSET_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_ASSET_TO'; - $trackid='asset'.$object->id; + $trigger_name = 'ASSET_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_ASSET_TO'; + $trackid = 'asset'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -112,11 +112,11 @@ if (empty($reshook)) * Put here all code to build page */ -$form=new Form($db); -$formfile=new FormFile($db); +$form = new Form($db); +$formfile = new FormFile($db); -$title=$langs->trans("Assets").' - '.$langs->trans("Card"); -$help_url=''; +$title = $langs->trans("Assets").' - '.$langs->trans("Card"); +$help_url = ''; llxHeader('', $title, $help_url); // Example : Adding jquery code @@ -150,10 +150,10 @@ if ($action == 'create') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print '
'."\n"; @@ -162,7 +162,7 @@ if ($action == 'create') print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print ''; @@ -184,10 +184,10 @@ if (($id || $ref) && $action == 'edit') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'; @@ -213,21 +213,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation to delete if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAssets'), $langs->trans('ConfirmDeleteAssets'), 'confirm_delete', '', 0, 1); } // Confirmation of action xxxx if ($action == 'xxx') { - $formquestion=array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + $formquestion = array(); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } // Call Hook formConfirm $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; // Print form confirm print $formconfirm; @@ -235,9 +235,9 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref='
'; + $morehtmlref = '
'; /* // Ref bis $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->asset->creer, 'string', '', 0, 1); @@ -245,7 +245,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); */ - $morehtmlref.='
'; + $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -256,10 +256,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Common attributes //$keyforbreak='fieldkeytoswithonsecondcolumn'; - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print ''; print '
'; @@ -274,14 +274,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons for actions if ($action != 'presend' && $action != 'editline') { print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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)) { // Send - print '' . $langs->trans('SendMail') . ''."\n"; + print ''.$langs->trans('SendMail').''."\n"; if ($user->rights->asset->write) { @@ -335,11 +335,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $MAXEVENT = 10; $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; + $morehtmlright .= $langs->trans("SeeAll"); + $morehtmlright .= ''; // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'asset', $socid, 1, '', $MAXEVENT, '', $morehtmlright); diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 1df8d8ad48f..714e15f0ee9 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -40,9 +40,9 @@ class modBom extends DolibarrModules */ public function __construct($db) { - global $langs,$conf; + global $langs,$conf; - $this->db = $db; + $this->db = $db; // Id for module (must be unique). // Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id). @@ -68,8 +68,8 @@ class modBom extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = 'dolibarr'; - //Url to the file with your last numberversion of this module - //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; + //Url to the file with your last numberversion of this module + //$this->url_last_version = 'http://www.example.com/versionmodule.txt'; // Key used in llx_const table to save module status enabled/disabled (where BILLOFMATERIALS is value of property name of module in uppercase) $this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // Name of image file used for this module. @@ -79,7 +79,7 @@ class modBom extends DolibarrModules // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( - /* + /* 'triggers' => 1, // Set this to 1 if module has its own trigger directory (core/triggers) 'login' => 0, // Set this to 1 if module has its own login method file (core/login) 'substitutions' => 1, // Set this to 1 if module has its own substitution function file (core/substitutions) @@ -122,8 +122,8 @@ class modBom extends DolibarrModules // ); $this->const = array( 1=>array('BOM_ADDON_PDF', 'chaine', 'alpha', 'Name of PDF model of BOM', 0), - 2=>array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), - 3=>array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) + 2=>array('BOM_ADDON', 'chaine', 'mod_bom_standard', 'Name of numbering rules of BOM', 0), + 3=>array('BOM_ADDON_PDF_ODT_PATH', 'chaine', 'DOL_DATA_ROOT/doctemplates/boms', '', 0) ); // Some keys to add into the overwriting translation tables @@ -140,13 +140,13 @@ class modBom extends DolibarrModules // Array to add new pages in new tabs - $this->tabs = array(); + $this->tabs = array(); // Example: // $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@bom:$user->rights->bom->read:/bom/mynewtab1.php?id=__ID__'); // To add a new tab identified by code tabname1 - // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@bom:$user->rights->othermodule->read:/bom/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. - // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname - // - // Where objecttype can be + // $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@bom:$user->rights->othermodule->read:/bom/mynewtab2.php?id=__ID__', // To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key. + // $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove'); // To remove an existing tab identified by code tabname + // + // Where objecttype can be // 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member) // 'contact' to add a tab in contact view // 'contract' to add a tab in contract view @@ -168,9 +168,9 @@ class modBom extends DolibarrModules // 'user' to add a tab in user view - // Dictionaries + // Dictionaries $this->dictionaries=array(); - /* Example: + /* Example: $this->dictionaries=array( 'langs'=>'mylangfile@bom', 'tabname'=>array(MAIN_DB_PREFIX."table1",MAIN_DB_PREFIX."table2",MAIN_DB_PREFIX."table3"), // List of tables we want to see into dictonnary editor @@ -186,11 +186,11 @@ class modBom extends DolibarrModules */ - // Boxes/Widgets + // Boxes/Widgets // Add here list of php file(s) stored in bom/core/boxes that contains class to show a widget. - $this->boxes = array( - 0=>array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home') - ); + $this->boxes = array( + 0=>array('file' => 'box_boms.php', 'note' => '', 'enabledbydefaulton' => 'Home') + ); // Cronjobs (List of cron jobs entries to add when module is enabled) @@ -312,12 +312,12 @@ class modBom extends DolibarrModules * The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database. * It also creates data directories * - * @param string $options Options when enabling module ('', 'noboxes') + * @param string $options Options when enabling module ('', 'noboxes') * @return int 1 if OK, 0 if KO */ public function init($options = '') { - global $conf, $langs; + global $conf, $langs; $result=$this->_load_tables('/bom/sql/'); if ($result < 0) return -1; // Do not activate module if not allowed errors found on module SQL queries (the _load_table run sql with run_sql with error allowed parameter to 'default') @@ -344,20 +344,20 @@ class modBom extends DolibarrModules if (file_exists($src) && ! file_exists($dest)) { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - dol_mkdir($dirodt); - $result=dol_copy($src, $dest, 0, 0); - if ($result < 0) - { - $langs->load("errors"); - $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); - return 0; - } + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + dol_mkdir($dirodt); + $result=dol_copy($src, $dest, 0, 0); + if ($result < 0) + { + $langs->load("errors"); + $this->error=$langs->trans('ErrorFailToCopyFile', $src, $dest); + return 0; + } } $sql = array( - //"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".$conf->entity, - //"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".$conf->entity.")" + //"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->db->escape('standard')."' AND type = 'bom' AND entity = ".$conf->entity, + //"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->db->escape('standard')."', 'bom', ".$conf->entity.")" ); return $this->_init($sql, $options); diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index bbf4340196b..3b2e42b06b6 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -54,38 +54,38 @@ dol_include_once('/mrp/lib/mrp_mo.lib.php'); $langs->loadLangs(array("mrp", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'mocard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); //$lineid = GETPOST('lineid', 'int'); // Initialize technical objects -$object=new Mo($db); +$object = new Mo($db); $extrafields = new ExtraFields($db); -$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('mocard','globalcard')); // Note that conf->hooks_modules contains array +$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('mocard', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all", 'alpha')); -$search=array(); -foreach($object->fields as $key => $val) +$search_all = trim(GETPOST("search_all", 'alpha')); +$search = array(); +foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } -if (empty($action) && empty($id) && empty($ref)) $action='view'; +if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); @@ -93,9 +93,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu //$isdraft = (($object->statut == $object::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT); @@ -105,13 +105,13 @@ $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && isset($ * Put here all code to do according to value of "action" parameter */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - $error=0; + $error = 0; $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1); @@ -120,7 +120,7 @@ if (empty($reshook)) if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } - $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -132,9 +132,9 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to send emails - $trigger_name='MO_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_MO_TO'; - $trackid='mo'.$object->id; + $trigger_name = 'MO_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_MO_TO'; + $trackid = 'mo'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; // Action to move up and down lines of object @@ -157,9 +157,9 @@ if (empty($reshook)) * View */ -$form=new Form($db); -$formfile=new FormFile($db); -$formproject=new FormProjets($db); +$form = new Form($db); +$formfile = new FormFile($db); +$formproject = new FormProjets($db); llxHeader('', $langs->trans('Mo'), ''); @@ -194,10 +194,10 @@ if ($action == 'create') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print '
'."\n"; @@ -238,7 +238,7 @@ if ($action == 'create') print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print ''; @@ -262,10 +262,10 @@ if (($id || $ref) && $action == 'edit') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'; @@ -292,7 +292,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation to delete if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1); } // Confirmation to delete line if ($action == 'deleteline') @@ -321,14 +321,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $text .= $notify->confirmMessage('BOM_VALIDATE', $object->socid, $object); }*/ - $formquestion=array(); - if (! empty($conf->bom->enabled)) + $formquestion = array(); + if (!empty($conf->bom->enabled)) { $langs->load("mrp"); - require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php'; + require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php'; $formproduct = new FormProduct($db); - $forcecombo=0; - if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy + $forcecombo = 0; + if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy $formquestion = array( // 'text' => $langs->trans("ConfirmClone"), // array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1), @@ -336,21 +336,21 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea ); } - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('Validate'), $text, 'confirm_validate', $formquestion, 0, 1, 220); } // Clone confirmation if ($action == 'clone') { // Create an array for form $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } // Call Hook formConfirm $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; // Print form confirm print $formconfirm; @@ -358,46 +358,46 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref='
'; + $morehtmlref = '
'; /* // Ref bis $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', null, null, '', 1);*/ // Thirdparty - $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); + $morehtmlref .= $langs->trans('ThirdParty').' : '.(is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : ''); // Project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; + $morehtmlref .= '
'.$langs->trans('Project').' '; if ($permissiontoadd) { if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.='
'; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.='
'; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_soc, $object->fk_project, 'none', 0, 0, 0, 1); } } else { - if (! empty($object->fk_project)) { + if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=$proj->getNomUrl(); + $morehtmlref .= $proj->getNomUrl(); } else { - $morehtmlref.=''; + $morehtmlref .= ''; } } } - $morehtmlref.='
'; + $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -409,13 +409,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - $keyforbreak='fk_warehouse'; + $keyforbreak = 'fk_warehouse'; unset($object->fields['fk_project']); unset($object->fields['fk_soc']); - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print '
'; @@ -430,29 +430,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (! empty($object->table_element_line)) + if (!empty($object->table_element_line)) { // Show object lines $result = $object->getLinesArray(); - print '
- - + print ' + + - + '; - if (! empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print ''; } - if (! empty($object->lines)) + if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/mrp/tpl'); } @@ -470,7 +470,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if (! empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) + if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) { print '
'; } @@ -484,8 +484,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'presend' && $action != 'editline') { print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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)) @@ -495,7 +495,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($user->rights->bom->write && $object->status == MO::STATUS_VALIDATED) { - print '' . $langs->trans("SetToDraft") . ''; + print ''.$langs->trans("SetToDraft").''; } // Modify @@ -513,18 +513,18 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea { if (is_array($object->lines) && count($object->lines) > 0) { - print '' . $langs->trans("Validate") . ''; + print ''.$langs->trans("Validate").''; } else { - print '' . $langs->trans("Validate") . ''; + print ''.$langs->trans("Validate").''; } } // Clone if ($permissiontoadd) { - print '' . $langs->trans("ToClone") . ''; + print ''.$langs->trans("ToClone").''; } // Delete (need delete permission, or if draft, just need create/modify permission) @@ -553,11 +553,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Documents $objref = dol_sanitizeFileName($object->ref); - $relativepath = $objref . '/' . $objref . '.pdf'; - $filedir = $conf->mrp->dir_output . '/' . $objref; - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; - $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content - $delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card + $relativepath = $objref.'/'.$objref.'.pdf'; + $filedir = $conf->mrp->dir_output.'/'.$objref; + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; + $genallowed = $user->rights->mrp->read; // If you can read, you can build the PDF to read content + $delallowed = $user->rights->mrp->create; // If you can create/edit, you can remove a file on card print $formfile->showdocuments('mrp:mo', $objref, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', '', '', $mysoc->default_lang); // Show links to link elements @@ -570,11 +570,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea $MAXEVENT = 10; $morehtmlright = ''; - $morehtmlright.= $langs->trans("SeeAll"); - $morehtmlright.= ''; + $morehtmlright .= $langs->trans("SeeAll"); + $morehtmlright .= ''; // List of actions on element - include_once DOL_DOCUMENT_ROOT . '/core/class/html.formactions.class.php'; + include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); $somethingshown = $formactions->showactions($object, 'mo', $socid, 1, '', $MAXEVENT, '', $morehtmlright); @@ -585,8 +585,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (GETPOST('modelselected')) $action = 'presend'; // Presend form - $modelmail='mo'; - $defaulttopic='InformationMessage'; + $modelmail = 'mo'; + $defaulttopic = 'InformationMessage'; $diroutput = $conf->mrp->dir_output; $trackid = 'mo'.$object->id; diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 8dc7ee4c625..c376cc80cae 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -54,38 +54,38 @@ dol_include_once('/mrp/lib/mrp_mo.lib.php'); $langs->loadLangs(array("mrp", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'aZ09'); +$action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); -$contextpage= GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'mocard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'mocard'; // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); //$lineid = GETPOST('lineid', 'int'); // Initialize technical objects -$object=new Mo($db); +$object = new Mo($db); $extrafields = new ExtraFields($db); -$diroutputmassaction=$conf->mrp->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('mocard','globalcard')); // Note that conf->hooks_modules contains array +$diroutputmassaction = $conf->mrp->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('mocard', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all", 'alpha')); -$search=array(); -foreach($object->fields as $key => $val) +$search_all = trim(GETPOST("search_all", 'alpha')); +$search = array(); +foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } -if (empty($action) && empty($id) && empty($ref)) $action='view'; +if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); @@ -93,9 +93,9 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu //$isdraft = (($object->statut == Mo::STATUS_DRAFT) ? 1 : 0); //$result = restrictedArea($user, 'mrp', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); -$permissionnote=$user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->mrp->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->mrp->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->mrp->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->mrp->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object->status == 0); @@ -105,13 +105,13 @@ $permissiontodelete = $user->rights->mrp->delete || ($permissiontoadd && $object * Put here all code to do according to value of "action" parameter */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - $error=0; + $error = 0; $backurlforlist = dol_buildpath('/mrp/mo_list.php', 1); @@ -120,7 +120,7 @@ if (empty($reshook)) if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) $backtopage = $backurlforlist; else $backtopage = DOL_URL_ROOT.'/mrp/mo_card.php?id='.($id > 0 ? $id : '__ID__'); } - $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record + $triggermodname = 'MRP_MO_MODIFY'; // Name of trigger action code to execute when we modify record // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; @@ -144,9 +144,9 @@ if (empty($reshook)) } // Actions to send emails - $trigger_name='MO_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_MO_TO'; - $trackid='mo'.$object->id; + $trigger_name = 'MO_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_MO_TO'; + $trackid = 'mo'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -157,8 +157,8 @@ if (empty($reshook)) * View */ -$form=new Form($db); -$formproject=new FormProjets($db); +$form = new Form($db); +$formproject = new FormProjets($db); llxHeader('', $langs->trans('Mo'), ''); @@ -192,7 +192,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation to delete if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteMo'), $langs->trans('ConfirmDeleteMo'), 'confirm_delete', '', 0, 1); } // Confirmation to delete line if ($action == 'deleteline') @@ -203,13 +203,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action == 'clone') { // Create an array for form $formquestion = array(); - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneMo', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); } // Confirmation of action xxxx if ($action == 'xxx') { - $formquestion=array(); + $formquestion = array(); /* $forcecombo=0; if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy @@ -220,14 +220,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo)) ); */ - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220); } // Call Hook formConfirm $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; // Print form confirm print $formconfirm; @@ -235,46 +235,46 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref='
'; + $morehtmlref = '
'; /* // Ref bis $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', 0, 1); $morehtmlref.=$form->editfieldval("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->mrp->creer, 'string', '', null, null, '', 1);*/ // Thirdparty - $morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + $morehtmlref .= $langs->trans('ThirdParty').' : '.$object->thirdparty->getNomUrl(1); // Project - if (! empty($conf->projet->enabled)) + if (!empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; + $morehtmlref .= '
'.$langs->trans('Project').' '; if ($user->rights->mrp->write) { if ($action != 'classify') - $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' : '; if ($action == 'classify') { //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); } } else { - if (! empty($object->fk_project)) { + if (!empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=$proj->getNomUrl(); + $morehtmlref .= $proj->getNomUrl(); } else { - $morehtmlref.=''; + $morehtmlref .= ''; } } } - $morehtmlref.='
'; + $morehtmlref .= '
'; dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); @@ -286,13 +286,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - $keyforbreak='qty'; + $keyforbreak = 'qty'; unset($object->fields['fk_project']); unset($object->fields['fk_soc']); - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print '
'; @@ -307,29 +307,29 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea * Lines */ - if (! empty($object->table_element_line)) + if (!empty($object->table_element_line)) { // Show object lines $result = $object->getLinesArray(); - print '
- - + print ' + + - + '; - if (! empty($conf->use_javascript_ajax) && $object->status == 0) { - include DOL_DOCUMENT_ROOT . '/core/tpl/ajaxrow.tpl.php'; + if (!empty($conf->use_javascript_ajax) && $object->status == 0) { + include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php'; } print '
'; - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (!empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') { print ''; } - if (! empty($object->lines)) + if (!empty($object->lines)) { $object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1); } @@ -347,7 +347,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } - if (! empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') + if (!empty($object->lines) && $object->status == 0 && $permissiontoadd && $action != 'selectlines' && $action != 'editline') { print '
'; } diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 17ce50ca8bb..54a1b7dce88 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -32,17 +32,17 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; // Defini si peux lire/modifier utilisateurs et permisssions -$canreadperms=($user->admin || $user->rights->user->user->lire); -$caneditperms=($user->admin || $user->rights->user->user->creer); -$candisableperms=($user->admin || $user->rights->user->user->supprimer); +$canreadperms = ($user->admin || $user->rights->user->user->lire); +$caneditperms = ($user->admin || $user->rights->user->user->creer); +$candisableperms = ($user->admin || $user->rights->user->user->supprimer); $feature2 = 'user'; // Advanced permissions -if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS)) +if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { - $canreadperms=($user->admin || $user->rights->user->group_advance->read); - $caneditperms=($user->admin || $user->rights->user->group_advance->write); - $candisableperms=($user->admin || $user->rights->user->group_advance->delete); + $canreadperms = ($user->admin || $user->rights->user->group_advance->read); + $caneditperms = ($user->admin || $user->rights->user->group_advance->write); + $candisableperms = ($user->admin || $user->rights->user->group_advance->delete); $feature2 = 'group_advance'; } @@ -53,7 +53,7 @@ $id = GETPOST('id', 'int'); $action = GETPOST('action', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); -$contextpage = GETPOST('contextpage', 'aZ')?GETPOST('contextpage', 'aZ'):'groupcard'; // To manage different context of search +$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'groupcard'; // To manage different context of search $userid = GETPOST('user', 'int'); @@ -61,7 +61,7 @@ $userid = GETPOST('user', 'int'); $result = restrictedArea($user, 'user', $id, 'usergroup&usergroup', $feature2); // Users/Groups management only in master entity if transverse mode -if (! empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) +if (!empty($conf->multicompany->enabled) && $conf->entity > 1 && $conf->global->MULTICOMPANY_TRANSVERSE_MODE) { accessforbidden(); } @@ -78,7 +78,7 @@ $extrafields = new ExtraFields($db); $extrafields->fetch_name_optionals_label($object->table_element); // Initialize technical object to manage hooks. Note that conf->hooks_modules contains array -$hookmanager->initHooks(array('groupcard','globalcard')); +$hookmanager->initHooks(array('groupcard', 'globalcard')); @@ -86,14 +86,14 @@ $hookmanager->initHooks(array('groupcard','globalcard')); * Actions */ -$parameters=array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array('id' => $id, 'userid' => $userid, 'caneditperms' => $caneditperms); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { if ($cancel) { - if (! empty($backtopage)) + if (!empty($backtopage)) { header("Location: ".$backtopage); exit; @@ -103,7 +103,7 @@ if (empty($reshook)) { header("Location: ".DOL_URL_ROOT.'/user/group/list.php'); exit; } - $action=''; + $action = ''; } // Action remove group @@ -128,19 +128,19 @@ if (empty($reshook)) { { if ($caneditperms) { - if (! $_POST["nom"]) { + if (!$_POST["nom"]) { setEventMessages($langs->trans("NameNotDefined"), null, 'errors'); - $action="create"; // Go back to create page + $action = "create"; // Go back to create page } else { $object->name = trim(GETPOST("nom", 'nohtml')); - $object->nom = $object->name; // For backward compatibility + $object->nom = $object->name; // For backward compatibility $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none'))); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; + if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; else $object->entity = $_POST["entity"]; $db->begin(); @@ -160,7 +160,7 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($langs->trans("ErrorGroupAlreadyExists", $object->name), null, 'errors'); - $action="create"; // Go back to create page + $action = "create"; // Go back to create page } } } @@ -172,7 +172,7 @@ if (empty($reshook)) { } // Add/Remove user into group - if ($action == 'adduser' || $action =='removeuser') + if ($action == 'adduser' || $action == 'removeuser') { if ($caneditperms) { @@ -183,8 +183,8 @@ if (empty($reshook)) { $edituser = new User($db); $edituser->fetch($userid); - if ($action == 'adduser') $result=$edituser->SetInGroup($object->id, $object->entity); - if ($action == 'removeuser') $result=$edituser->RemoveFromGroup($object->id, $object->entity); + if ($action == 'adduser') $result = $edituser->SetInGroup($object->id, $object->entity); + if ($action == 'removeuser') $result = $edituser->RemoveFromGroup($object->id, $object->entity); if ($result > 0) { @@ -216,19 +216,19 @@ if (empty($reshook)) { $object->oldcopy = clone $object; $object->name = trim(GETPOST("group", 'nohtml')); - $object->nom = $object->name; // For backward compatibility + $object->nom = $object->name; // For backward compatibility $object->note = dol_htmlcleanlastbr(trim(GETPOST("note", 'none'))); // Fill array 'array_options' with data from add form $ret = $extrafields->setOptionalsFromPost(null, $object); if ($ret < 0) $error++; - if (! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; + if (!empty($conf->multicompany->enabled) && !empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) $object->entity = 0; else $object->entity = $_POST["entity"]; - $ret=$object->update(); + $ret = $object->update(); - if ($ret >= 0 && ! count($object->errors)) + if ($ret >= 0 && !count($object->errors)) { setEventMessages($langs->trans("GroupModified"), null, 'mesgs'); $db->commit(); @@ -248,7 +248,7 @@ if (empty($reshook)) { // Actions to build doc $upload_dir = $conf->usergroup->dir_output; - $permissiontoadd=$user->rights->user->user->creer; + $permissiontoadd = $user->rights->user->user->creer; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; } @@ -283,9 +283,9 @@ if ($action == 'create') print ''; // Multicompany - if (! empty($conf->multicompany->enabled) && is_object($mc)) + if (!empty($conf->multicompany->enabled) && is_object($mc)) { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { print "".''.$langs->trans("Entity").''; print "".$mc->select_entities($conf->entity); @@ -299,13 +299,13 @@ if ($action == 'create') print "".''.$langs->trans("Description").''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note', '', '', 240, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); + $doleditor = new DolEditor('note', '', '', 240, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); $doleditor->Create(); print "\n"; // Other attributes - $parameters=array('object' => $object, 'colspan' => ' colspan="2"'); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array('object' => $object, 'colspan' => ' colspan="2"'); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { @@ -364,7 +364,7 @@ else print ''; // Name (already in dol_banner, we keep it to have the GlobalGroup picto, but we should move it in dol_banner) - if (! empty($conf->mutlicompany->enabled)) + if (!empty($conf->mutlicompany->enabled)) { print ''; print '".''; @@ -390,8 +390,8 @@ else print "\n"; // Other attributes - $parameters=array('colspan' => ' colspan="2"'); - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + $parameters = array('colspan' => ' colspan="2"'); + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print "
'.$langs->trans("Name").''.dol_escape_htmltag($object->name); @@ -376,7 +376,7 @@ else } // Multicompany - if (! empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) + if (!empty($conf->multicompany->enabled) && is_object($mc) && empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { $mc->getInfo($object->entity); print "
'.$langs->trans("Entity").'
\n"; print '
'; @@ -423,17 +423,17 @@ else // On selectionne les users qui ne sont pas deja dans le groupe $exclude = array(); - if (! empty($object->members)) + if (!empty($object->members)) { - foreach($object->members as $useringroup) + foreach ($object->members as $useringroup) { - $exclude[]=$useringroup->id; + $exclude[] = $useringroup->id; } } // Other form for add user to group - $parameters=array('caneditperms' => $caneditperms, 'exclude' => $exclude); - $reshook=$hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array('caneditperms' => $caneditperms, 'exclude' => $exclude); + $reshook = $hookmanager->executeHooks('formAddUserToGroup', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) @@ -467,14 +467,14 @@ else print ' '; print "\n"; - if (! empty($object->members)) + if (!empty($object->members)) { - foreach($object->members as $useringroup) + foreach ($object->members as $useringroup) { print ''; print ''; print $useringroup->getNomUrl(-1, '', 0, 0, 24, 0, 'login'); - if ($useringroup->admin && ! $useringroup->entity) { + if ($useringroup->admin && !$useringroup->entity) { print img_picto($langs->trans("SuperAdministrator"), 'redstar'); } elseif ($useringroup->admin) { print img_picto($langs->trans("Administrator"), 'star'); @@ -484,7 +484,7 @@ else print ''.$useringroup->firstname.''; print ''.$useringroup->getLibStatut(3).''; print ''; - if (! empty($user->admin)) { + if (!empty($user->admin)) { print ''; print img_picto($langs->trans("RemoveFromGroup"), 'unlink'); print ''; @@ -511,8 +511,8 @@ else * Documents generes */ $filename = dol_sanitizeFileName($object->ref); - $filedir = $conf->usergroup->dir_output . "/" . dol_sanitizeFileName($object->ref); - $urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id; + $filedir = $conf->usergroup->dir_output."/".dol_sanitizeFileName($object->ref); + $urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed = $user->rights->user->user->creer; $delallowed = $user->rights->user->user->supprimer; @@ -550,9 +550,9 @@ else print "\n"; // Multicompany - if (! empty($conf->multicompany->enabled) && is_object($mc)) + if (!empty($conf->multicompany->enabled) && is_object($mc)) { - if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && ! $user->entity) + if (empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE) && $conf->entity == 1 && $user->admin && !$user->entity) { print "".''.$langs->trans("Entity").''; print "".$mc->select_entities($object->entity); @@ -567,13 +567,13 @@ else print ''.$langs->trans("Description").''; print ''; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('note', $object->note, '', 240, 'dolibarr_notes', '', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); + $doleditor = new DolEditor('note', $object->note, '', 240, 'dolibarr_notes', '', true, false, $conf->global->FCKEDITOR_ENABLE_SOCIETE, ROWS_8, '90%'); $doleditor->Create(); print ''; print "\n"; // Other attributes - $parameters=array(); - $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { diff --git a/htdocs/website/websiteaccount_card.php b/htdocs/website/websiteaccount_card.php index be7c773ed25..e6c5b0f7c3d 100644 --- a/htdocs/website/websiteaccount_card.php +++ b/htdocs/website/websiteaccount_card.php @@ -29,48 +29,48 @@ require_once DOL_DOCUMENT_ROOT.'/societe/class/societeaccount.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/lib/websiteaccount.lib.php'; // Load translation files required by the page -$langs->loadLangs(array("website","other")); +$langs->loadLangs(array("website", "other")); // Get parameters -$id = GETPOST('id', 'int'); +$id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); -$action = GETPOST('action', 'alpha'); +$action = GETPOST('action', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $cancel = GETPOST('cancel', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); // Initialize technical objects -$object=new SocieteAccount($db); +$object = new SocieteAccount($db); $extrafields = new ExtraFields($db); -$diroutputmassaction=$conf->website->dir_output . '/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array +$diroutputmassaction = $conf->website->dir_output.'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('websiteaccountcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); -$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); +$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_'); // Initialize array of search criterias -$search_all=trim(GETPOST("search_all", 'alpha')); -$search=array(); -foreach($object->fields as $key => $val) +$search_all = trim(GETPOST("search_all", 'alpha')); +$search = array(); +foreach ($object->fields as $key => $val) { - if (GETPOST('search_'.$key, 'alpha')) $search[$key]=GETPOST('search_'.$key, 'alpha'); + if (GETPOST('search_'.$key, 'alpha')) $search[$key] = GETPOST('search_'.$key, 'alpha'); } -if (empty($action) && empty($id) && empty($ref)) $action='view'; +if (empty($action) && empty($id) && empty($ref)) $action = 'view'; // Security check - Protection if external user //if ($user->socid > 0) access_forbidden(); //if ($user->socid > 0) $socid = $user->socid; //$result = restrictedArea($user, 'website', $id); -$permissionnote=$user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php -$permissiondellink=$user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php -$permissiontoadd=$user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php +$permissionnote = $user->rights->websiteaccount->write; // Used by the include of actions_setnotes.inc.php +$permissiondellink = $user->rights->websiteaccount->write; // Used by the include of actions_dellink.inc.php +$permissiontoadd = $user->rights->websiteaccount->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php // Load object -include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once. @@ -78,13 +78,13 @@ include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be inclu * Actions */ -$parameters=array(); -$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +$parameters = array(); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) { - $error=0; + $error = 0; $permissiontoadd = $user->rights->website->write; $permissiontodelete = $user->rights->website->delete; @@ -97,9 +97,9 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; // Actions to send emails - $trigger_name='WEBSITEACCOUNT_SENTBYMAIL'; - $autocopy='MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO'; - $trackid='websiteaccount'.$object->id; + $trigger_name = 'WEBSITEACCOUNT_SENTBYMAIL'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_WEBSITEACCOUNT_TO'; + $trackid = 'websiteaccount'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } @@ -108,8 +108,8 @@ if (empty($reshook)) * View */ -$form=new Form($db); -$formfile=new FormFile($db); +$form = new Form($db); +$formfile = new FormFile($db); llxHeader('', 'WebsiteAccount', ''); @@ -144,10 +144,10 @@ if ($action == 'create') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_add.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; print '
'."\n"; @@ -156,7 +156,7 @@ if ($action == 'create') print '
'; print ''; print '  '; - print ''; // Cancel for create does not post form if we don't know the backtopage + print ''; // Cancel for create does not post form if we don't know the backtopage print '
'; print '
'; @@ -177,10 +177,10 @@ if (($id || $ref) && $action == 'edit') print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_edit.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php'; print '
'; @@ -196,7 +196,7 @@ if (($id || $ref) && $action == 'edit') // Part to show record if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) { - if ($object->fk_soc >0 && empty($socid)) $socid = $object->fk_soc; + if ($object->fk_soc > 0 && empty($socid)) $socid = $object->fk_soc; $res = $object->fetch_optionals(); @@ -207,14 +207,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Confirmation to delete if ($action == 'delete') { - $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteWebsiteAccount'), $langs->trans('ConfirmDeleteWebsiteAccount'), 'confirm_delete', '', 0, 1); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteWebsiteAccount'), $langs->trans('ConfirmDeleteWebsiteAccount'), 'confirm_delete', '', 0, 1); } // Call Hook formConfirm $parameters = array('lineid' => $lineid); $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook - if (empty($reshook)) $formconfirm.=$hookmanager->resPrint; - elseif ($reshook > 0) $formconfirm=$hookmanager->resPrint; + if (empty($reshook)) $formconfirm .= $hookmanager->resPrint; + elseif ($reshook > 0) $formconfirm = $hookmanager->resPrint; // Print form confirm print $formconfirm; @@ -222,11 +222,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Object card // ------------------------------------------------------------ - $linkback=''; - if ($socid) $linkback = '' . $langs->trans("BackToListOfThirdParty") . ''; - if ($fk_website) $linkback = '' . $langs->trans("BackToList") . ''; + $linkback = ''; + if ($socid) $linkback = ''.$langs->trans("BackToListOfThirdParty").''; + if ($fk_website) $linkback = ''.$langs->trans("BackToList").''; - $morehtmlref='
'; + $morehtmlref = '
'; /* // Ref bis $morehtmlref.=$form->editfieldkey("RefBis", 'ref_client', $object->ref_client, $object, $user->rights->website->creer, 'string', '', 0, 1); @@ -268,7 +268,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } } */ - $morehtmlref.='
'; + $morehtmlref .= '
'; if ($socid > 0) $object->next_prev_filter = 'te.fk_soc = '.$socid; @@ -281,10 +281,10 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''."\n"; // Common attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/commonfields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php'; // Other attributes - include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php'; print '
'; print '
'; @@ -299,14 +299,14 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Buttons for actions if ($action != 'presend' && $action != 'editline') { print '
'."\n"; - $parameters=array(); - $reshook=$hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreActionsButtons', $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)) { // Send - print ''."\n"; + print ''."\n"; if ($user->rights->website->write) { @@ -376,8 +376,8 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea } // Presend form - $modelmail='websiteaccount'; - $defaulttopic='Information'; + $modelmail = 'websiteaccount'; + $defaulttopic = 'Information'; $diroutput = $conf->website->dir_output; $trackid = 'websiteaccount'.$object->id;