diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index a799ec750cd..63562f1f4f3 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -52,6 +52,7 @@ if (empty($argv[1])) { print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n"; exit -1; } + parse_str($argv[1]); $i=0; @@ -60,9 +61,9 @@ while ($i < $argc) { parse_str($argv[$i]); } if (preg_match('/includeconstant=/', $argv[$i])) { - $tmp=explode(':', $includeconstant, 3); + $tmp=explode(':', $includeconstant, 3); // $includeconstant has been set with previous parse_str() if (count($tmp) != 3) { - print "Error: Bad parameter includeconstant ".$includeconstant."\n"; + print "Error: Bad parameter includeconstant=".$includeconstant."\n"; exit -1; } $includeconstants[$tmp[0]][$tmp[1]] = $tmp[2]; @@ -157,7 +158,7 @@ $iterator1 = new RecursiveIteratorIterator($dir_iterator1); $files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i'); */ $regextoinclude='\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$'; -$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs +$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$'; // Exclude dirs $files = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude, 'fullname'); $dir=''; diff --git a/build/makepack-dolibarr.pl b/build/makepack-dolibarr.pl index 0fe73fd9fb8..906601d94d4 100755 --- a/build/makepack-dolibarr.pl +++ b/build/makepack-dolibarr.pl @@ -390,6 +390,9 @@ if ($nboftargetok) { $olddir=getcwd(); chdir("$SOURCE"); + print "Clean $SOURCE/htdocs\n"; + $ret=`rm -f $SOURCE/htdocs/includes/autoload.php`; + $ret=`git ls-files . --exclude-standard --others`; if ($ret) { @@ -613,7 +616,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nnnick/chartjs/test`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/lib/Mail`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/nusoap/samples`; - $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/parsedown/LICENSE.txt`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/php-iban/docs`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/sabre/sabre/*/tests`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/stripe/tests`; @@ -623,7 +625,6 @@ if ($nboftargetok) { $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/freefont-*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/ae_fonts_*`; $ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/fonts/utils`; - $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/LICENSE.TXT`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/tecnickcom/tcpdf/tools`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/vendor`; $ret=`rm -f $BUILDROOT/$PROJECT/htdocs/includes/webmozart`; diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index d798d3f5fdc..4dd98451823 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -88,7 +88,8 @@ $tables=array( 'commande_fournisseur'=>array(0=>'date_commande', 1=>'date_valid', 3=>'date_creation', 4=>'date_approve', 5=>'date_approve2', 6=>'date_livraison'), 'supplier_proposal'=>array(0=>'datec', 1=>'date_valid', 2=>'date_cloture'), 'expensereport'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 4=>'date_approve', 5=>'date_refuse', 6=>'date_cancel'), - 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel') + 'holiday'=>array(0=>'date_debut', 1=>'date_fin', 2=>'date_create', 3=>'date_valid', 5=>'date_refuse', 6=>'date_cancel'), + 'ticket'=>array(0=>'datec', 1=>'date_read', 2=>'date_close') ); $year=2010; diff --git a/dev/setup/codesniffer/ruleset.xml b/dev/setup/codesniffer/ruleset.xml index 21186cfbe5c..e99b8673981 100644 --- a/dev/setup/codesniffer/ruleset.xml +++ b/dev/setup/codesniffer/ruleset.xml @@ -215,7 +215,7 @@ - + diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 961fa959e07..f9d6edfd4e5 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -1670,7 +1670,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { $linkeduser->fetch($object->user_id); print $linkeduser->getNomUrl(-1); } else { - print $langs->trans("NoDolibarrAccess"); + print ''.$langs->trans("NoDolibarrAccess").''; } } print ''; diff --git a/htdocs/admin/agenda_other.php b/htdocs/admin/agenda_other.php index 2b3eaf9be94..d23bd42848a 100644 --- a/htdocs/admin/agenda_other.php +++ b/htdocs/admin/agenda_other.php @@ -30,6 +30,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php'; if (!$user->admin) { accessforbidden(); @@ -80,6 +81,30 @@ if ($action == 'set') { dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_TYPE', $defaultfilter, 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_FILTER_STATUS', GETPOST('AGENDA_DEFAULT_FILTER_STATUS'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, 'AGENDA_DEFAULT_VIEW', GETPOST('AGENDA_DEFAULT_VIEW'), 'chaine', 0, '', $conf->entity); + + $defaultValues = new DefaultValues($db); + $result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); + if (!is_array($result) && $result<0) { + setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); + } elseif (count($result)>0) { + foreach ($result as $defval) { + $defaultValues->id=$defval->id; + $resultDel = $defaultValues->delete($user); + if ($resultDel<0) { + setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); + } + } + } + $defaultValues->type='createform'; + $defaultValues->entity=$conf->entity; + $defaultValues->user_id=0; + $defaultValues->page='comm/action/card.php'; + $defaultValues->param='complete'; + $defaultValues->value=GETPOST('AGENDA_EVENT_DEFAULT_STATUS'); + $resultCreat=$defaultValues->create($user); + if ($resultCreat<0) { + setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); + } } elseif ($action == 'specimen') { // For orders $modele = GETPOST('module', 'alpha'); @@ -325,6 +350,22 @@ if (!empty($conf->global->AGENDA_USE_EVENT_TYPE)) { print ''."\n"; } +// AGENDA_EVENT_DEFAULT_STATUS +print ''."\n"; +print ''.$langs->trans("AGENDA_EVENT_DEFAULT_STATUS").''."\n"; +print ' '."\n"; +print ''."\n"; +$defval='na'; +$defaultValues = new DefaultValues($db); +$result = $defaultValues->fetchAll('', '', 0, 0, array('t.page'=>'comm/action/card.php', 't.param'=>'complete','t.user_id'=>'0', 't.type'=>'createform', 't.entity'=>$conf->entity)); +if (!is_array($result) && $result<0) { + setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); +} elseif (count($result)>0) { + $defval=reset($result)->value; +} +$formactions->form_select_status_action('agenda', $defval, 1, "AGENDA_EVENT_DEFAULT_STATUS", 0, 1, 'maxwidth200'); +print ''."\n"; + // AGENDA_DEFAULT_FILTER_TYPE print ''."\n"; print ''.$langs->trans("AGENDA_DEFAULT_FILTER_TYPE").''."\n"; diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 4a480349bb3..dc801059e41 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -30,6 +30,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php'; // Load translation files required by the page $langs->loadLangs(array('companies', 'products', 'admin', 'sms', 'other', 'errors')); @@ -42,7 +43,7 @@ $id = GETPOST('rowid', 'int'); $action = GETPOST('action', 'aZ09'); $optioncss = GETPOST('optionscss', 'alphanohtml'); -$mode = GETPOST('mode', 'aZ09') ?GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus' +$mode = GETPOST('mode', 'aZ09') ? GETPOST('mode', 'aZ09') : 'createform'; // 'createform', 'filters', 'sortorder', 'focus' $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -75,6 +76,7 @@ $value = GETPOST('value', 'restricthtml'); $hookmanager->initHooks(array('admindefaultvalues', 'globaladmin')); +$object = new DefaultValues($db); /* * Actions */ @@ -136,41 +138,54 @@ if (($action == 'add' || (GETPOST('add') && $action != 'update')) || GETPOST('ac } if (!$error) { - $db->begin(); - if ($action == 'add' || (GETPOST('add') && $action != 'update')) { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."default_values(type, user_id, page, param, value, entity) VALUES ('".$db->escape($mode)."', 0, '".$db->escape($defaulturl)."','".$db->escape($defaultkey)."','".$db->escape($defaultvalue)."', ".$db->escape($conf->entity).")"; + $object->type=$mode; + $object->user_id=0; + $object->page=$defaulturl; + $object->param=$defaultkey; + $object->value=$defaultvalue; + $object->entity=$conf->entity; + $result=$object->create($user); + if ($result<0) { + $action = ''; + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action = ""; + $defaulturl = ''; + $defaultkey = ''; + $defaultvalue = ''; + } } if (GETPOST('actionmodify')) { - $sql = "UPDATE ".MAIN_DB_PREFIX."default_values SET page = '".$db->escape($urlpage)."', param = '".$db->escape($key)."', value = '".$db->escape($value)."'"; - $sql .= " WHERE rowid = ".$id; - } - - $result = $db->query($sql); - if ($result > 0) { - $db->commit(); - setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); - $action = ""; - $defaulturl = ''; - $defaultkey = ''; - $defaultvalue = ''; - } else { - $db->rollback(); - setEventMessages($db->lasterror(), null, 'errors'); - $action = ''; + $object->id=$id; + $object->type=$mode; + $object->page=$urlpage; + $object->param=$key; + $object->value=$value; + $object->entity=$conf->entity; + $result=$object->update($user); + if ($result<0) { + $action = ''; + setEventMessages($object->error, $object->errors, 'errors'); + } else { + setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); + $action = ""; + $defaulturl = ''; + $defaultkey = ''; + $defaultvalue = ''; + } } } } // Delete line from delete picto if ($action == 'delete') { - $sql = "DELETE FROM ".MAIN_DB_PREFIX."default_values WHERE rowid = ".$db->escape($id); - // Delete const - $result = $db->query($sql); - if ($result >= 0) { - setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); - } else { - dol_print_error($db); + $object->id=$id; + $result=$object->delete($user); + if ($result<0) { + $action = ''; + setEventMessages($object->error, $object->errors, 'errors'); } } @@ -338,43 +353,26 @@ print '\n"; print ''; +$result=$object->fetchAll($sortorder, $sortfield, 0, 0, array('t.type'=>$mode,'t.entity'=>array($user->entity,$conf->entity))); -// Show constants -$sql = "SELECT rowid, entity, type, page, param, value"; -$sql .= " FROM ".MAIN_DB_PREFIX."default_values"; -$sql .= " WHERE type = '".$db->escape($mode)."'"; -$sql .= " AND entity IN (".$user->entity.",".$conf->entity.")"; -$sql .= $db->order($sortfield, $sortorder); - -dol_syslog("translation::select from table", LOG_DEBUG); -$result = $db->query($sql); -if ($result) { - $num = $db->num_rows($result); - $i = 0; - - while ($i < $num) { - $obj = $db->fetch_object($result); - +if (!is_array($result) && $result<0) { + setEventMessages($object->error, $object->errors, 'errors'); +} elseif (count($result)>0) { + foreach ($result as $key=>$defaultvalue) { print "\n"; print ''; // Page print ''; - if ($action != 'edit' || GETPOST('rowid', 'int') != $obj->rowid) { - print $obj->page; - } else { - print ''; - } + if ($action != 'edit' || GETPOST('rowid', 'int') != $defaultvalue->id) print $defaultvalue->page; + else print ''; print ''."\n"; // Field print ''; - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print $obj->param; - } else { - print ''; - } + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print $defaultvalue->param; + else print ''; print ''."\n"; // Value @@ -385,11 +383,8 @@ if ($result) { print ''; print ''; */ - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print dol_escape_htmltag($obj->value); - } else { - print ''; - } + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) print dol_escape_htmltag($defaultvalue->value); + else print ''; print ''; } @@ -397,13 +392,13 @@ if ($result) { // Actions print ''; - if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) { - print ''.img_edit().''; - print ''.img_delete().''; + if ($action != 'edit' || GETPOST('rowid') != $defaultvalue->id) { + print ''.img_edit().''; + print ''.img_delete().''; } else { print ''; print ''; - print '
'; + print '
'; print ''; print ''; } @@ -413,8 +408,6 @@ if ($result) { print "\n"; $i++; } -} else { - dol_print_error($db); } print ''; diff --git a/htdocs/admin/eventorganization.php b/htdocs/admin/eventorganization.php index feb200744d2..8625f182f47 100644 --- a/htdocs/admin/eventorganization.php +++ b/htdocs/admin/eventorganization.php @@ -248,7 +248,7 @@ if ($action == 'edit') { $tmp = explode(':', $val['type']); print img_picto('', 'category', 'class="pictofixedwidth"'); - print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); + print $formother->select_categories($tmp[1], $conf->global->{$constname}, $constname, 0, $langs->trans('CustomersProspectsCategoriesShort')); } else { print ''; } diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php index c515fe27a58..a0d590579ca 100644 --- a/htdocs/admin/propal.php +++ b/htdocs/admin/propal.php @@ -402,13 +402,13 @@ foreach ($dirmodels as $reldir) { // Active if (in_array($name, $def)) { print ''."\n"; - print ''; + print ''; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; print ''; } else { print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } @@ -417,7 +417,7 @@ foreach ($dirmodels as $reldir) { if ($conf->global->PROPALE_ADDON_PDF == "$name") { print img_picto($langs->trans("Default"), 'on'); } else { - print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; + print 'scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').''; } print ''; diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 3b539895348..f572379d42e 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -1072,7 +1072,7 @@ if ($action == 'create') { // Status print ''.$langs->trans("Status").' / '.$langs->trans("Percentage").''; print ''; - $percent = -1; + $percent = GETPOST('complete')!=='' ? GETPOST('complete') : -1; if (GETPOSTISSET('status')) { $percent = GETPOST('status'); } elseif (GETPOSTISSET('percentage')) { diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index d9fce1551e3..87345bb905e 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -720,17 +720,17 @@ if ((!empty($conf->fournisseur->enabled) && empty($conf->global->MAIN_USE_NEW_SU /* * Last actions */ -if ($user->rights->agenda->myactions->read) { +/*if ($user->rights->agenda->myactions->read) { show_array_last_actions_done($max); -} +}*/ /* * Actions to do */ -if ($user->rights->agenda->myactions->read) { +/*if ($user->rights->agenda->myactions->read) { show_array_actions_to_do($max); -} +}*/ /* diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 754d01e3b78..30d436df9e4 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -215,8 +215,8 @@ if (empty($reshook)) { } } } - } // Delete proposal - elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { + } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete) { + // Delete proposal $result = $object->delete($user); if ($result > 0) { header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php?restore_lastsearch_values=1'); @@ -225,8 +225,8 @@ if (empty($reshook)) { $langs->load("errors"); setEventMessages($object->error, $object->errors, 'errors'); } - } // Remove line - elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + } elseif ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate) { + // Remove line $result = $object->deleteline($lineid); // reorder lines if ($result) { @@ -250,8 +250,8 @@ if (empty($reshook)) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit(); - } // Validation - elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { + } elseif ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate) { + // Validation $idwarehouse = GETPOST('idwarehouse', 'int'); $result = $object->valid($user); if ($result >= 0) { @@ -308,17 +308,17 @@ if (empty($reshook)) { if ($result < 0) { dol_print_error($db, $object->error); } - } // Positionne ref client - elseif ($action == 'setref_client' && $usercancreate) { + } elseif ($action == 'setref_client' && $usercancreate) { + // Positionne ref client $result = $object->set_ref_client($user, GETPOST('ref_client')); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } - } // Set incoterm - elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) { + } elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate) { + // Set incoterm $result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha')); - } // Create proposal - elseif ($action == 'add' && $usercancreate) { + } elseif ($action == 'add' && $usercancreate) { + // Create proposal $object->socid = $socid; $object->fetch_thirdparty(); @@ -554,8 +554,8 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); $error++; } - } // Standard creation - else { + } else { + // Standard creation $id = $object->create($user); } @@ -616,8 +616,8 @@ if (empty($reshook)) { } } } - } // Classify billed - elseif ($action == 'classifybilled' && $usercanclose) { + } elseif ($action == 'classifybilled' && $usercanclose) { + // Classify billed $db->begin(); $result = $object->cloture($user, $object::STATUS_BILLED, ''); @@ -631,8 +631,8 @@ if (empty($reshook)) { } else { $db->rollback(); } - } // Close proposal - elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'confirm_closeas' && $usercanclose && !GETPOST('cancel', 'alpha')) { + // Close proposal if (!(GETPOST('statut', 'int') > 0)) { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors'); $action = 'closeas'; @@ -654,8 +654,8 @@ if (empty($reshook)) { } } } - } // Reopen proposal - elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { + } elseif ($action == 'confirm_reopen' && $usercanclose && !GETPOST('cancel', 'alpha')) { + // Reopen proposal // prevent browser refresh from reopening proposal several times if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) { $db->begin(); @@ -672,11 +672,11 @@ if (empty($reshook)) { $db->rollback(); } } - } // add lines from objectlinked - elseif ($action == 'import_lines_from_object' + } elseif ($action == 'import_lines_from_object' && $user->rights->propal->creer && $object->statut == Propal::STATUS_DRAFT ) { + // add lines from objectlinked $fromElement = GETPOST('fromelement'); $fromElementid = GETPOST('fromelementid'); $importLines = GETPOST('line_checkbox'); @@ -898,8 +898,8 @@ if (empty($reshook)) { $tva_npr = $prod->multiprices_recuperableonly[$object->thirdparty->price_level]; } } - } // If price per customer - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES)) { + // If price per customer require_once DOL_DOCUMENT_ROOT.'/product/class/productcustomerprice.class.php'; $prodcustprice = new Productcustomerprice($db); @@ -924,8 +924,8 @@ if (empty($reshook)) { } } } - } // If price per quantity - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY)) { + // If price per quantity if ($prod->prices_by_qty[0]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = GETPOST('pbq', 'int'); @@ -945,8 +945,8 @@ if (empty($reshook)) { break; } } - } // If price per quantity and customer - elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + } elseif (!empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) { + // If price per quantity and customer if ($prod->prices_by_qty[$object->thirdparty->price_level]) { // yes, this product has some prices per quantity // Search the correct price into loaded array product_price_by_qty using id of array retrieved into POST['pqp']. $pqp = GETPOST('pbq', 'int'); @@ -975,9 +975,9 @@ if (empty($reshook)) { if (!empty($price_ht) || $price_ht === '0') { $pu_ht = price2num($price_ht, 'MU'); $pu_ttc = price2num($pu_ht * (1 + ($tmpvat / 100)), 'MU'); - } // On reevalue prix selon taux tva car taux tva transaction peut etre different - // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). - elseif ($tmpvat != $tmpprodvat) { + } elseif ($tmpvat != $tmpprodvat) { + // On reevalue prix selon taux tva car taux tva transaction peut etre different + // de ceux du produit par defaut (par exemple si pays different entre vendeur et acheteur). if ($price_base_type != 'HT') { $pu_ht = price2num($pu_ttc / (1 + ($tmpvat / 100)), 'MU'); } else { @@ -1167,8 +1167,8 @@ if (empty($reshook)) { } } } - } // Update a line within proposal - elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { + } elseif ($action == 'updateline' && $usercancreate && GETPOST('save')) { + // Update a line within proposal // Define info_bits $info_bits = 0; if (preg_match('/\*/', GETPOST('tva_tx'))) { @@ -1313,36 +1313,36 @@ if (empty($reshook)) { } elseif ($action == 'classin' && $usercancreate) { // Set project $object->setProject(GETPOST('projectid', 'int')); - } // Delivery time - elseif ($action == 'setavailability' && $usercancreate) { + } elseif ($action == 'setavailability' && $usercancreate) { + // Delivery time $result = $object->set_availability($user, GETPOST('availability_id', 'int')); - } // Origin of the commercial proposal - elseif ($action == 'setdemandreason' && $usercancreate) { + } elseif ($action == 'setdemandreason' && $usercancreate) { + // Origin of the commercial proposal $result = $object->set_demand_reason($user, GETPOST('demand_reason_id', 'int')); - } // Terms of payment - elseif ($action == 'setconditions' && $usercancreate) { + } elseif ($action == 'setconditions' && $usercancreate) { + // Terms of payment $result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int')); } elseif ($action == 'setremisepercent' && $usercancreate) { $result = $object->set_remise_percent($user, $_POST['remise_percent']); } elseif ($action == 'setremiseabsolue' && $usercancreate) { $result = $object->set_remise_absolue($user, $_POST['remise_absolue']); - } // Payment choice - elseif ($action == 'setmode' && $usercancreate) { + } elseif ($action == 'setmode' && $usercancreate) { + // Payment choice $result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int')); - } // Multicurrency Code - elseif ($action == 'setmulticurrencycode' && $usercancreate) { + } elseif ($action == 'setmulticurrencycode' && $usercancreate) { + // Multicurrency Code $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); - } // Multicurrency rate - elseif ($action == 'setmulticurrencyrate' && $usercancreate) { - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); - } // bank account - elseif ($action == 'setbankaccount' && $usercancreate) { + } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { + // Multicurrency rate + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); + } elseif ($action == 'setbankaccount' && $usercancreate) { + // bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); - } // shipping method - elseif ($action == 'setshippingmethod' && $usercancreate) { + } elseif ($action == 'setshippingmethod' && $usercancreate) { + // shipping method $result = $object->setShippingMethod(GETPOST('shipping_method_id', 'int')); - }// warehouse - elseif ($action == 'setwarehouse' && $usercancreate) { + } elseif ($action == 'setwarehouse' && $usercancreate) { + // warehouse $result = $object->setWarehouse(GETPOST('warehouse_id', 'int')); } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); @@ -1383,15 +1383,15 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } - } // Toggle the status of a contact - elseif ($action == 'swapstatut') { + } elseif ($action == 'swapstatut') { + // Toggle the status of a contact if ($object->fetch($id) > 0) { $result = $object->swapContactStatus(GETPOST('ligne')); } else { dol_print_error($db); } - } // Delete a contact - elseif ($action == 'deletecontact') { + } elseif ($action == 'deletecontact') { + // Delete a contact $object->fetch($id); $result = $object->delete_contact($lineid); @@ -1570,7 +1570,8 @@ if ($action == 'create') { console.log("We have changed the company - Reload page"); var socid = $(this).val(); // reload page - window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val(); + $("input[name=action]").val("create"); + $("form[name=addprop]").submit(); }); }); '; @@ -1907,17 +1908,17 @@ if ($action == 'create') { } $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('SetAcceptedRefused'), $text, 'confirm_closeas', $formquestion, '', 1, 250); - } // Confirm delete - elseif ($action == 'delete') { + } elseif ($action == 'delete') { + // Confirm delete $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteProp'), $langs->trans('ConfirmDeleteProp', $object->ref), 'confirm_delete', '', 0, 1); - } // Confirm reopen - elseif ($action == 'reopen') { + } elseif ($action == 'reopen') { + // Confirm reopen $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ReOpen'), $langs->trans('ConfirmReOpenProp', $object->ref), 'confirm_reopen', '', 0, 1); - } // Confirmation delete product/service line - elseif ($action == 'ask_deleteline') { + } elseif ($action == 'ask_deleteline') { + // Confirmation delete product/service line $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1); - } // Confirm validate proposal - elseif ($action == 'validate') { + } elseif ($action == 'validate') { + // Confirm validate proposal $error = 0; // We verify whether the object is provisionally numbering @@ -2113,6 +2114,24 @@ if ($action == 'create') { print ''; print ''; + // Payment mode + print ''; + print ''; + print ''; + if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { + print ''; + } + print '
'; + print $langs->trans('PaymentMode'); + print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; + print ''; + if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); + } else { + $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); + } + print ''; + // Delivery date $langs->load('deliveries'); print ''; @@ -2200,24 +2219,6 @@ if ($action == 'create') { print ''; print ''; - // Payment mode - print ''; - print ''; - print ''; - if ($action != 'editmode' && $object->statut == Propal::STATUS_DRAFT && $usercancreate) { - print ''; - } - print '
'; - print $langs->trans('PaymentMode'); - print 'id.'">'.img_edit($langs->transnoentitiesnoconv('SetMode'), 1).'
'; - print ''; - if ($object->statut == Propal::STATUS_DRAFT && $action == 'editmode' && $usercancreate) { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'mode_reglement_id', 'CRDT', 1, 1); - } else { - $form->form_modes_reglement($_SERVER['PHP_SELF'].'?id='.$object->id, $object->mode_reglement_id, 'none'); - } - print ''; - // Multicurrency if (!empty($conf->multicurrency->enabled)) { // Multicurrency code @@ -2350,7 +2351,7 @@ if ($action == 'create') { print ''; - if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code != $conf->currency)) { + if (!empty($conf->multicurrency->enabled) && ($object->multicurrency_code && $object->multicurrency_code != $conf->currency)) { // Multicurrency Amount HT print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 553362687b6..af77b56bc15 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1651,7 +1651,8 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -1891,7 +1892,8 @@ class Propal extends CommonObject $sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'propale/".$this->db->escape($this->ref)."' and entity = ".$conf->entity; $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->error = $this->db->lasterror(); + $error++; + $this->error = $this->db->lasterror(); } // We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments @@ -2457,7 +2459,8 @@ class Propal extends CommonObject dol_syslog(get_class($this)."::reopen", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { if (!$notrigger) { diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index c75589c1aa0..4c8ee0894f5 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -95,6 +95,7 @@ $search_availability = GETPOST('search_availability', 'int'); $search_categ_cus = GETPOST("search_categ_cus", 'int'); $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); $search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); +$search_fk_input_reason = GETPOST("search_fk_input_reason", 'int'); $search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); $search_btn = GETPOST('button_search', 'alpha'); $search_remove_btn = GETPOST('button_removefilter', 'alpha'); @@ -189,6 +190,7 @@ $arrayfields = array( 'p.date_livraison'=>array('label'=>"DeliveryDate", 'checked'=>0), 'ava.rowid'=>array('label'=>"AvailabilityPeriod", 'checked'=>0), 'p.fk_shipping_method'=>array('label'=>"SendingMethod", 'checked'=>0, 'enabled'=>!empty($conf->expedition->enabled)), + 'p.fk_input_reason'=>array('label'=>"Origin", 'checked'=>0, 'enabled'=>1), 'p.fk_cond_reglement'=>array('label'=>"PaymentConditionsShort", 'checked'=>0), 'p.fk_mode_reglement'=>array('label'=>"PaymentMode", 'checked'=>0), 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), @@ -222,7 +224,8 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -277,6 +280,7 @@ if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x' $search_categ_cus = 0; $search_fk_cond_reglement = ''; $search_fk_shipping_method = ''; + $search_fk_input_reason = ''; $search_fk_mode_reglement = ''; } if ($object_statut != '') { @@ -414,7 +418,7 @@ $sql .= ' p.rowid, p.entity, p.note_private, p.total_ht, p.total_tva, p.total_tt $sql .= ' p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc,'; $sql .= ' p.datec as date_creation, p.tms as date_update, p.date_cloture as date_cloture,'; $sql .= ' p.note_public, p.note_private,'; -$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,'; +$sql .= ' p.fk_cond_reglement,p.fk_mode_reglement,p.fk_shipping_method,p.fk_input_reason,'; $sql .= " pr.rowid as project_id, pr.ref as project_ref, pr.title as project_label,"; $sql .= ' u.login'; if (!$user->rights->societe->client->voir && !$socid) { @@ -547,6 +551,9 @@ if ($search_fk_cond_reglement > 0) { if ($search_fk_shipping_method > 0) { $sql .= " AND p.fk_shipping_method = ".$db->escape($search_fk_shipping_method); } +if ($search_fk_input_reason > 0) { + $sql .= " AND p.fk_input_reason = ".$db->escape($search_fk_input_reason); +} if ($search_fk_mode_reglement > 0) { $sql .= " AND p.fk_mode_reglement = ".$db->escape($search_fk_mode_reglement); } @@ -735,6 +742,9 @@ if ($resql) { if ($search_fk_shipping_method > 0) { $param .= '&search_fk_shipping_method='.$search_fk_shipping_method; } + if ($search_fk_input_reason > 0) { + $param .= '&search_fk_input_reason='.$search_fk_input_reason; + } if ($search_fk_mode_reglement > 0) { $param .= '&search_fk_mode_reglement='.$search_fk_mode_reglement; } @@ -983,6 +993,12 @@ if ($resql) { $form->selectShippingMethod($search_fk_shipping_method, 'search_fk_shipping_method', '', 1, '', 1); print ''; } + // Source - Input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + } // Payment term if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } // Payment terms if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print '
'.$form->editfieldkey('MulticurrencyAmountHT', 'multicurrency_total_ht', '', $object, 0).''.price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)).''; + $form->selectInputReason($search_fk_input_reason, 'search_fk_input_reason', '', 1, 'maxwidth125', 1); + print ''; @@ -1169,6 +1185,9 @@ if ($resql) { if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { print_liste_field_titre($arrayfields['p.fk_shipping_method']['label'], $_SERVER["PHP_SELF"], "p.fk_shipping_method", "", $param, '', $sortfield, $sortorder); } + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print_liste_field_titre($arrayfields['p.fk_input_reason']['label'], $_SERVER["PHP_SELF"], "p.fk_input_reason", "", $param, '', $sortfield, $sortorder); + } if (!empty($arrayfields['p.fk_cond_reglement']['checked'])) { print_liste_field_titre($arrayfields['p.fk_cond_reglement']['label'], $_SERVER["PHP_SELF"], "p.fk_cond_reglement", "", $param, '', $sortfield, $sortorder); } @@ -1473,7 +1492,7 @@ if ($resql) { $totalarray['nbfield']++; } } - //Shipping Method + // Shipping Method if (!empty($arrayfields['p.fk_shipping_method']['checked'])) { print ''; $form->formSelectShippingMethod('', $obj->fk_shipping_method, 'none', 1); @@ -1482,6 +1501,17 @@ if ($resql) { $totalarray['nbfield']++; } } + // Source - input reason + if (!empty($arrayfields['p.fk_input_reason']['checked'])) { + print ''; + if ($obj->fk_input_reason > 0) { + print $form->cache_demand_reason[$obj->fk_input_reason]['label']; + } + print ''; diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 326299448f7..e18891f3c60 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -123,7 +123,8 @@ $px1 = new DolGraph(); $mesg = $px1->isGraphKo(); if (!$mesg) { $px1->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -158,7 +159,8 @@ $px2 = new DolGraph(); $mesg = $px2->isGraphKo(); if (!$mesg) { $px2->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; @@ -202,7 +204,8 @@ $px3 = new DolGraph(); $mesg = $px3->isGraphKo(); if (!$mesg) { $px3->SetData($data); - $i = $startyear; $legend = array(); + $i = $startyear; + $legend = array(); while ($i <= $endyear) { $legend[] = $i; $i++; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 375ba4a53ff..29d6d46a9f9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -490,7 +490,7 @@ if (empty($reshook)) { setEventMessages($object->error, $object->errors, 'errors'); } } elseif ($action == 'classifyunbilled' && $usercancreate) { - $ret = $object->classifyUnBilled(); + $ret = $object->classifyUnBilled($user); if ($ret < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -540,7 +540,7 @@ if (empty($reshook)) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { // Multicurrency rate - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'setavailability' && $usercancreate) { $result = $object->availability(GETPOST('availability_id')); if ($result < 0) { @@ -1580,7 +1580,8 @@ if ($action == 'create' && $usercancreate) { console.log("We have changed the company - Reload page"); var socid = $(this).val(); // reload page - window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&ref_client="+$("input[name=ref_client]").val(); + $("input[name=action]").val("create"); + $("form[name=crea_commande]").submit(); }); }); '; diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index aac06dc4775..4d5f75c7c24 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -2962,11 +2962,12 @@ class Commande extends CommonOrder /** * Classify the order as not invoiced * - * @return int <0 if ko, >0 if ok + * @param User $user Object user making the change + * @param int $notrigger 1=Does not execute triggers, 0=execute triggers + * @return int <0 if ko, >0 if ok */ - public function classifyUnBilled() + public function classifyUnBilled(User $user, $notrigger = 0) { - global $conf, $user, $langs; $error = 0; $this->db->begin(); @@ -2981,12 +2982,14 @@ class Commande extends CommonOrder $this->billed = 1; } - // Call trigger - $result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user); - if ($result < 0) { - $error++; + if (!$notrigger && empty($error)) { + // Call trigger + $result = $this->call_trigger('ORDER_CLASSIFY_UNBILLED', $user); + if ($result < 0) { + $error++; + } + // End call triggers } - // End call triggers if (!$error) { $this->billed = 0; diff --git a/htdocs/compta/bank/account_statement_document.php b/htdocs/compta/bank/account_statement_document.php index 929a7a483bb..ea4911e7050 100644 --- a/htdocs/compta/bank/account_statement_document.php +++ b/htdocs/compta/bank/account_statement_document.php @@ -186,14 +186,14 @@ if ($id > 0 || !empty($ref)) { $permission = $user->rights->banque->modifier; $permtoedit = $user->rights->banque->modifier; $param = '&id='.$object->id.'&num='.urlencode($numref); - $moreparam = '&num='.urlencode($numref); ; + $moreparam = '&num='.urlencode($numref); $relativepathwithnofile = $id."/statement/".dol_sanitizeFileName($numref)."/"; include_once DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); } } else { - Header('Location: index.php'); + header('Location: index.php'); exit; } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 390972912c1..6ec8fed517f 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -182,7 +182,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -1188,8 +1189,8 @@ if ($resql) { // If sort is desc,desc,desc then total of previous date + amount is the balancebefore of the previous line before the line to show if ($sortfield == 'b.datev,b.dateo,b.rowid' && $sortorder == 'desc,desc,desc') { $balancebefore = $objforbalance->previoustotal + ($sign * $objp->amount); - } // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show - else { + } else { + // If sort is asc,asc,asc then total of previous date is balance of line before the next line to show $balance = $objforbalance->previoustotal; } } diff --git a/htdocs/compta/bank/budget.php b/htdocs/compta/bank/budget.php index dda8f13437d..d3ffbb37916 100644 --- a/htdocs/compta/bank/budget.php +++ b/htdocs/compta/bank/budget.php @@ -72,7 +72,9 @@ $sql .= " ORDER BY c.label"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; $total = 0; $totalnb = 0; + $i = 0; + $total = 0; + $totalnb = 0; while ($i < $num) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/categ.php b/htdocs/compta/bank/categ.php index 48976f8ba25..fb9fead3089 100644 --- a/htdocs/compta/bank/categ.php +++ b/htdocs/compta/bank/categ.php @@ -126,7 +126,8 @@ $sql .= " ORDER BY rowid"; $result = $db->query($sql); if ($result) { $num = $db->num_rows($result); - $i = 0; $total = 0; + $i = 0; + $total = 0; while ($i < $num) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index c2dd1c316a6..6dd588f51e1 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -795,13 +795,17 @@ print '
'; // Graphs if ($mode == 'standard') { - $prevyear = $year; $nextyear = $year; - $prevmonth = $month - 1; $nextmonth = $month + 1; + $prevyear = $year; + $nextyear = $year; + $prevmonth = $month - 1; + $nextmonth = $month + 1; if ($prevmonth < 1) { - $prevmonth = 12; $prevyear--; + $prevmonth = 12; + $prevyear--; } if ($nextmonth > 12) { - $nextmonth = 1; $nextyear++; + $nextmonth = 1; + $nextyear++; } // For month @@ -818,7 +822,8 @@ if ($mode == 'standard') { print ''; // For year - $prevyear = $year - 1; $nextyear = $year + 1; + $prevyear = $year - 1; + $nextyear = $year + 1; $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"').""; print '
'.$link.'
'; diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 1f22b67ac7c..caca78033d6 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -272,7 +272,8 @@ $sql .= " WHERE rowid=".$rowid; $sql .= " ORDER BY dateo ASC"; $result = $db->query($sql); if ($result) { - $i = 0; $total = 0; + $i = 0; + $total = 0; if ($db->num_rows($result)) { $objp = $db->fetch_object($result); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 6c2e595e3d1..2882a4635fd 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -134,7 +134,8 @@ $arrayfields = dol_sort_array($arrayfields, 'position'); */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -490,7 +491,10 @@ print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $ print "\n"; -$totalarray = array(); $found = 0; $i = 0; $lastcurrencycode = ''; +$totalarray = array(); +$found = 0; +$i = 0; +$lastcurrencycode = ''; foreach ($accounts as $key => $type) { if ($i >= $limit) { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 27dfe941f88..d19ccbed908 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -341,8 +341,7 @@ foreach ($bankcateg->fetchAll() as $bankcategory) { /* ************************************************************************** */ if ($action == 'create') { // Update fields properties in realtime - if (!empty($conf->use_javascript_ajax)) - { + if (!empty($conf->use_javascript_ajax)) { print "\n".''."\n"; - } - - $out .= ' '."\n"; - } - } - - $out .= $hookmanager->resPrint; - return $out; } - /** * Returns the rights used for this class * @return stdClass diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 19555adf3fb..6b50c73da8e 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -80,6 +80,9 @@ class Conf 'syslog' => array(), ); + // An array to store cache results ->cache['nameofcache']=... + public $cache = array(); + public $logbuffer = array(); /** @@ -196,13 +199,13 @@ class Conf $this->modules_parts[$partname] = array(); } $this->modules_parts[$partname][$params[0]][] = $value; // $value may be a string or an array - } - // If this is constant for all generic part activated by a module. It initializes - // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'], - // modules_parts['models'], modules_parts['theme'] - // modules_parts['sms'], - // modules_parts['css'], ... - elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) { + } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)_([A-Z]+)$/i', $key, $reg)) { + // If this is constant for all generic part activated by a module. It initializes + // modules_parts['login'], modules_parts['menus'], modules_parts['substitutions'], modules_parts['triggers'], modules_parts['tpl'], + // modules_parts['models'], modules_parts['theme'] + // modules_parts['sms'], + // modules_parts['css'], ... + $modulename = strtolower($reg[1]); $partname = strtolower($reg[2]); if (!isset($this->modules_parts[$partname]) || !is_array($this->modules_parts[$partname])) { @@ -221,9 +224,8 @@ class Conf $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe } $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array - } - // If this is a module constant (must be at end) - elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) { + } elseif (preg_match('/^MAIN_MODULE_([0-9A-Z_]+)$/i', $key, $reg)) { + // If this is a module constant (must be at end) $modulename = strtolower($reg[1]); if ($modulename == 'propale') { $modulename = 'propal'; diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index acddb09d547..66ee803d41a 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -123,7 +123,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -229,7 +230,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -266,7 +268,8 @@ class Cstate // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index ff2bcc58f40..01a6eb5e697 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -130,7 +130,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -244,7 +245,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -282,7 +284,8 @@ class Ctypent // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/cunits.class.php b/htdocs/core/class/cunits.class.php index 757e3fb0e66..e55d227de0e 100644 --- a/htdocs/core/class/cunits.class.php +++ b/htdocs/core/class/cunits.class.php @@ -133,7 +133,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::create", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } if (!$error) { @@ -351,7 +352,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::update", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback @@ -389,7 +391,8 @@ class CUnits // extends CommonObject dol_syslog(get_class($this)."::delete", LOG_DEBUG); $resql = $this->db->query($sql); if (!$resql) { - $error++; $this->errors[] = "Error ".$this->db->lasterror(); + $error++; + $this->errors[] = "Error ".$this->db->lasterror(); } // Commit or rollback diff --git a/htdocs/core/class/defaultvalues.class.php b/htdocs/core/class/defaultvalues.class.php new file mode 100644 index 00000000000..4244d0f63af --- /dev/null +++ b/htdocs/core/class/defaultvalues.class.php @@ -0,0 +1,352 @@ + + * Copyright (C) 2021 Florian HENRY + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/code/class/defaultvalues.class.php + * \brief This file is a CRUD class file for DefaultValues (Create/Read/Update/Delete) + */ + +// Put here all includes required by your class file +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + +/** + * Class for MyObject + */ +class DefaultValues extends CommonObject +{ + /** + * @var string ID to identify managed object. + */ + public $element = 'defaultvalues'; + + /** + * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management. + */ + public $table_element = 'default_values'; + + /** + * @var int Does this object support multicompany module ? + * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table + */ + public $ismultientitymanaged = 1; + + /** + * @var int Does object support extrafields ? 0=No, 1=Yes + */ + public $isextrafieldmanaged = 0; + + /** + * @var string String with name of icon for myobject. Must be the part after the 'object_' into object_myobject.png + */ + public $picto = ''; + + /** + * 'type' field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter]]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', 'text:none', 'html', 'date', 'datetime', 'timestamp', 'duration', 'mail', 'phone', 'url', 'password') + * Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)" + * 'label' the translation key. + * 'picto' is code of a picto to show before value in forms + * 'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM) + * 'position' is the sort order of field. + * 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0). + * 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing) + * 'noteditable' says if field is not editable (1 or 0) + * 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created. + * 'index' if we want an index in database. + * 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...). + * 'searchall' is 1 if we want to search in this field when making a search from the quick search button. + * 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8). + * 'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'maxwidth200', 'wordbreak', 'tdoverflowmax200' + * 'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click. + * 'showoncombobox' if value of the field must be visible into the label of the combobox that list record + * 'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code. + * 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel") + * 'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1. + * 'comment' is not used. You can store here any text of your choice. It is not used by application. + * + * Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor. + */ + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>15, 'index'=>1), + 'type' =>array('type'=>'varchar(10)', 'label'=>'Type', 'enabled'=>1, 'visible'=>-1, 'position'=>20), + 'user_id' =>array('type'=>'integer', 'label'=>'Userid', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), + 'page' =>array('type'=>'varchar(255)', 'label'=>'RelativeURL', 'enabled'=>1, 'visible'=>-1, 'position'=>30), + 'param' =>array('type'=>'varchar(255)', 'label'=>'Field', 'enabled'=>1, 'visible'=>-1, 'position'=>35), + 'value' =>array('type'=>'varchar(128)', 'label'=>'Value', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + ); + + /** + * @var int ID + */ + public $rowid; + + /** + * @var int Entity + */ + public $entity; + + /** + * @var string Type + */ + public $type; + + /** + * @var int User Id + */ + public $user_id; + + /** + * @var string Page + */ + public $page; + + /** + * @var string Param + */ + public $param; + + /** + * @var string Value + */ + public $value; + // END MODULEBUILDER PROPERTIES + + /** + * Constructor + * + * @param DoliDb $db Database handler + */ + public function __construct(DoliDB $db) + { + global $conf, $langs; + + $this->db = $db; + + if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid'])) $this->fields['rowid']['visible'] = 0; + if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) $this->fields['entity']['enabled'] = 0; + + // Unset fields that are disabled + foreach ($this->fields as $key => $val) { + if (isset($val['enabled']) && empty($val['enabled'])) { + unset($this->fields[$key]); + } + } + + // Translate some data of arrayofkeyval + if (is_object($langs)) { + foreach ($this->fields as $key => $val) { + if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) { + foreach ($val['arrayofkeyval'] as $key2 => $val2) { + $this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2); + } + } + } + } + } + + /** + * Create object into database + * + * @param User $user User that creates + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, Id of created object if OK + */ + public function create(User $user, $notrigger = false) + { + return $this->createCommon($user, $notrigger); + } + + /** + * Clone an object into another one + * + * @param User $user User that creates + * @param int $fromid Id of object to clone + * @return mixed New object created, <0 if KO + */ + public function createFromClone(User $user, $fromid) + { + global $langs, $extrafields; + $error = 0; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $object = new self($this->db); + + $this->db->begin(); + + // Load source object + $result = $object->fetchCommon($fromid); + if ($result > 0 && !empty($object->table_element_line)) $object->fetchLines(); + + + // Reset some properties + unset($object->id); + + // Create clone + $object->context['createfromclone'] = 'createfromclone'; + $result = $object->createCommon($user); + if ($result < 0) { + $error++; + $this->error = $object->error; + $this->errors = $object->errors; + } + + unset($object->context['createfromclone']); + + // End + if (!$error) { + $this->db->commit(); + return $object; + } else { + $this->db->rollback(); + return -1; + } + } + + /** + * Load object in memory from the database + * + * @param int $id Id object + * @return int <0 if KO, 0 if not found, >0 if OK + */ + public function fetch($id) + { + $result = $this->fetchCommon($id, null); + return $result; + } + + /** + * Load list of objects in memory from the database. + * + * @param string $sortorder Sort Order + * @param string $sortfield Sort field + * @param int $limit limit + * @param int $offset Offset + * @param array $filter Filter array. Example array('field'=>'valueforlike', 'customurl'=>...) + * @param string $filtermode Filter mode (AND or OR) + * @return array|int int <0 if KO, array of pages if OK + */ + public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND') + { + global $conf; + + dol_syslog(__METHOD__, LOG_DEBUG); + + $records = array(); + + $sql = 'SELECT '; + $sql .= $this->getFieldList(); + $sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element.' as t'; + $sql .= ' WHERE 1 = 1'; + // Manage filter + $sqlwhere = array(); + if (count($filter) > 0) { + foreach ($filter as $key => $value) { + if ($key == 't.rowid' || ($key == 't.entity' && !is_array($value)) || ($key == 't.user_id' && !is_array($value))) { + $sqlwhere[] = $key.'='.$value; + } elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) { + $sqlwhere[] = $key.' = \''.$this->db->idate($value).'\''; + } elseif ($key == 't.page' || $key == 't.param' || $key == 't.type') { + $sqlwhere[] = $key.' = \''.$this->db->escape($value).'\''; + } elseif ($key == 'customsql') { + $sqlwhere[] = $value; + } elseif (is_array($value)) { + $sqlwhere[] = $key.' IN ('.implode(',', $value).')'; + } else { + $sqlwhere[] = $key.' LIKE \'%'.$this->db->escape($value).'%\''; + } + } + } + if (count($sqlwhere) > 0) { + $sql .= ' AND ('.implode(' '.$filtermode.' ', $sqlwhere).')'; + } + + if (!empty($sortfield)) { + $sql .= $this->db->order($sortfield, $sortorder); + } + if (!empty($limit)) { + $sql .= ' '.$this->db->plimit($limit, $offset); + } + + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < ($limit ? min($limit, $num) : $num)) { + $obj = $this->db->fetch_object($resql); + + $record = new self($this->db); + $record->setVarsFromFetchObj($obj); + + $records[$record->id] = $record; + + $i++; + } + $this->db->free($resql); + + return $records; + } else { + $this->errors[] = 'Error '.$this->db->lasterror(); + dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR); + + return -1; + } + } + + /** + * Update object into database + * + * @param User $user User that modifies + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function update(User $user, $notrigger = false) + { + return $this->updateCommon($user, $notrigger); + } + + /** + * Delete object in database + * + * @param User $user User that deletes + * @param bool $notrigger false=launch triggers after, true=disable triggers + * @return int <0 if KO, >0 if OK + */ + public function delete(User $user, $notrigger = false) + { + return $this->deleteCommon($user, $notrigger); + } + + /** + * Initialise object with example values + * Id must be 0 if object instance is a specimen + * + * @return void + */ + public function initAsSpecimen() + { + $this->initAsSpecimenCommon(); + } +} diff --git a/htdocs/core/class/dolgeoip.class.php b/htdocs/core/class/dolgeoip.class.php index 0eecbbf6d36..b4218bbfd40 100644 --- a/htdocs/core/class/dolgeoip.class.php +++ b/htdocs/core/class/dolgeoip.class.php @@ -61,7 +61,8 @@ class DolGeoIP require_once DOL_DOCUMENT_ROOT.'/includes/geoip2/geoip2.phar'; } } else { - print 'ErrorBadParameterInConstructor'; return 0; + print 'ErrorBadParameterInConstructor'; + return 0; } // Here, function exists (embedded into PHP or exists because we made include) @@ -129,7 +130,7 @@ class DolGeoIP } } else { if (!function_exists('geoip_country_code_by_addr')) { - return strtolower(geoip_country_code_by_name($this->gi, $ip)); + return strtolower(geoip_country_code_by_name($ip)); } return strtolower(geoip_country_code_by_addr($this->gi, $ip)); } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 607993dc325..3672f7faa07 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -908,9 +908,8 @@ class DolGraph $this->stringtoshow .= 'legend: {show: ' . ($showlegend ? 'true' : 'false') . ', position: \'ne\' } }); }' . "\n"; - } - // Other cases, graph of type 'bars', 'lines' - else { + } else { + // Other cases, graph of type 'bars', 'lines' // Add code to support tooltips // TODO: remove js css and use graph-tooltip-inner class instead by adding css in each themes $this->stringtoshow .= ' @@ -1262,9 +1261,8 @@ class DolGraph $this->stringtoshow .= ']' . "\n"; $this->stringtoshow .= '}' . "\n"; $this->stringtoshow .= '});' . "\n"; - } - // Other cases, graph of type 'bars', 'lines', 'linesnopoint' - else { + } else { + // Other cases, graph of type 'bars', 'lines', 'linesnopoint' $type = 'bar'; if (!isset($this->type[$firstlot]) || $this->type[$firstlot] == 'bars') { diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 6f674c0b600..980c8c53dde 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -147,7 +147,8 @@ class Events // extends CommonObject // Check parameters if (empty($this->description)) { - $this->error = 'ErrorBadValueForParameterCreateEventDesc'; return -1; + $this->error = 'ErrorBadValueForParameterCreateEventDesc'; + return -1; } // Insert request diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 35747920ec5..5a5b06054ff 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -251,7 +251,8 @@ class ExtraFields } if ($type == 'separate') { - $unique = 0; $required = 0; + $unique = 0; + $required = 0; } // Force unique and not required if this is a separator field to avoid troubles. if ($elementtype == 'thirdparty') { $elementtype = 'societe'; diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index 21d948b2160..45bc622b9db 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -70,7 +70,8 @@ class FileUpload $element = $pathname = 'projet'; $dir_output = $conf->$element->dir_output; } elseif ($element == 'project_task') { - $pathname = 'projet'; $filename = 'task'; + $pathname = 'projet'; + $filename = 'task'; $dir_output = $conf->projet->dir_output; $parentForeignKey = 'fk_project'; $parentClass = 'Project'; @@ -80,20 +81,24 @@ class FileUpload $element = 'ficheinter'; $dir_output = $conf->$element->dir_output; } elseif ($element == 'order_supplier') { - $pathname = 'fourn'; $filename = 'fournisseur.commande'; + $pathname = 'fourn'; + $filename = 'fournisseur.commande'; $dir_output = $conf->fournisseur->commande->dir_output; } elseif ($element == 'invoice_supplier') { - $pathname = 'fourn'; $filename = 'fournisseur.facture'; + $pathname = 'fourn'; + $filename = 'fournisseur.facture'; $dir_output = $conf->fournisseur->facture->dir_output; } elseif ($element == 'product') { $dir_output = $conf->product->multidir_output[$conf->entity]; } elseif ($element == 'productbatch') { $dir_output = $conf->productbatch->multidir_output[$conf->entity]; } elseif ($element == 'action') { - $pathname = 'comm/action'; $filename = 'actioncomm'; + $pathname = 'comm/action'; + $filename = 'actioncomm'; $dir_output = $conf->agenda->dir_output; } elseif ($element == 'chargesociales') { - $pathname = 'compta/sociales'; $filename = 'chargesociales'; + $pathname = 'compta/sociales'; + $filename = 'chargesociales'; $dir_output = $conf->tax->dir_output; } else { $dir_output = $conf->$element->dir_output; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index 8b211a34864..9d3ea8f39d6 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -228,11 +228,14 @@ class HookManager } // Init return properties - $this->resPrint = ''; $this->resArray = array(); $this->resNbOfHooks = 0; + $this->resPrint = ''; + $this->resArray = array(); + $this->resNbOfHooks = 0; // Loop on each hook to qualify modules that have declared context $modulealreadyexecuted = array(); - $resaction = 0; $error = 0; + $resaction = 0; + $error = 0; foreach ($this->hooks as $context => $modules) { // $this->hooks is an array with context as key and value is an array of modules that handle this context if (!empty($modules)) { foreach ($modules as $module => $actionclassinstance) { @@ -265,7 +268,8 @@ class HookManager $resaction += $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example) if ($resaction < 0 || !empty($actionclassinstance->error) || (!empty($actionclassinstance->errors) && count($actionclassinstance->errors) > 0)) { $error++; - $this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); + $this->error = $actionclassinstance->error; + $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR); } @@ -275,9 +279,8 @@ class HookManager if (!empty($actionclassinstance->resprints)) { $this->resPrint .= $actionclassinstance->resprints; } - } - // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) - else { + } else { + // Generic hooks that return a string or array (printLeftBlock, formAddObjectLine, formBuilddocOptions, ...) // TODO. this test should be done into the method of hook by returning nothing if (is_array($parameters) && !empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) { continue; @@ -294,14 +297,16 @@ class HookManager } if (is_numeric($resaction) && $resaction < 0) { $error++; - $this->error = $actionclassinstance->error; $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); + $this->error = $actionclassinstance->error; + $this->errors = array_merge($this->errors, (array) $actionclassinstance->errors); dol_syslog("Error on hook module=".$module.", method ".$method.", class ".get_class($actionclassinstance).", hooktype=".$hooktype.(empty($this->error) ? '' : " ".$this->error).(empty($this->errors) ? '' : " ".join(",", $this->errors)), LOG_ERR); } // TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string but an int. you must use $actionclassinstance->resprints to return a string if (!is_array($resaction) && !is_numeric($resaction)) { dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR); if (empty($actionclassinstance->resprints)) { - $this->resPrint .= $resaction; $resaction = 0; + $this->resPrint .= $resaction; + $resaction = 0; } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 08a83d5ad0a..dd93dd268b7 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -488,7 +488,8 @@ class Form $out .= ''."\n"; // Use for timestamp format } elseif (preg_match('/^(select|autocomplete)/', $inputType)) { $tmp = explode(':', $inputType); - $inputType = $tmp[0]; $loadmethod = $tmp[1]; + $inputType = $tmp[0]; + $loadmethod = $tmp[1]; if (!empty($tmp[2])) { $savemethod = $tmp[2]; } @@ -502,7 +503,8 @@ class Form $cols = (empty($tmp[2]) ? '80' : $tmp[2]); } elseif (preg_match('/^ckeditor/', $inputType)) { $tmp = explode(':', $inputType); - $inputType = $tmp[0]; $toolbar = $tmp[1]; + $inputType = $tmp[0]; + $toolbar = $tmp[1]; if (!empty($tmp[2])) { $width = $tmp[2]; } @@ -594,15 +596,18 @@ class Form $extrastyle = ''; if ($direction < 0) { - $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-left: 3px !important;'; + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); + $extrastyle = 'padding: 0px; padding-left: 3px !important;'; } if ($direction > 0) { - $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); $extrastyle = 'padding: 0px; padding-right: 3px !important;'; + $extracss = ($extracss ? $extracss.' ' : '').($notabs != 3 ? 'inline-block' : ''); + $extrastyle = 'padding: 0px; padding-right: 3px !important;'; } $classfortooltip = 'classfortooltip'; - $s = ''; $textfordialog = ''; + $s = ''; + $textfordialog = ''; if ($tooltiptrigger == '') { $htmltext = str_replace('"', '"', $htmltext); @@ -2084,7 +2089,8 @@ class Form if ($nbassignetouser) { $out .= '
    '; } - $i = 0; $ownerid = 0; + $i = 0; + $ownerid = 0; foreach ($assignedtouser as $key => $value) { if ($value['id'] == $ownerid) { continue; @@ -2094,7 +2100,8 @@ class Form $userstatic->fetch($value['id']); $out .= $userstatic->getNomUrl(-1); if ($i == 0) { - $ownerid = $value['id']; $out .= ' ('.$langs->trans("Owner").')'; + $ownerid = $value['id']; + $out .= ' ('.$langs->trans("Owner").')'; } if ($nbassignetouser > 1 && $action != 'view') { $out .= ' '; @@ -3729,15 +3736,17 @@ class Form * @param string $htmlname Nom de la zone select * @param string $exclude To exclude a code value (Example: SRC_PROP) * @param int $addempty Add an empty entry + * @param string $morecss Add more css to the HTML select component + * @param int $notooltip Do not show the tooltip for admin * @return void */ - public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0) + public function selectInputReason($selected = '', $htmlname = 'demandreasonid', $exclude = '', $addempty = 0, $morecss = '', $notooltip = 0) { global $langs, $user; $this->loadCacheInputReason(); - print ''; if ($addempty) { print ''; } @@ -3756,7 +3765,7 @@ class Form print ''; } print ''; - if ($user->admin) { + if ($user->admin && empty($notooltip)) { print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"), 1); } print ajax_combobox('select_'.$htmlname); @@ -5296,8 +5305,8 @@ class Form print ''; print ' '; print ' '; print ''; print ''; @@ -5811,7 +5820,8 @@ class Form } // Disabled if seller is not subject to VAT - $disabled = false; $title = ''; + $disabled = false; + $title = ''; if (is_object($societe_vendeuse) && $societe_vendeuse->id == $mysoc->id && $societe_vendeuse->tva_assuj == "0") { // Override/enable VAT for expense report regardless of global setting - needed if expense report used for business expenses instead // of using supplier invoices (this is a very bad idea !) @@ -5991,10 +6001,12 @@ class Form $stepminutes = 1; } if ($empty == 1) { - $emptydate = 1; $emptyhours = 1; + $emptydate = 1; + $emptyhours = 1; } if ($empty == 2) { - $emptydate = 0; $emptyhours = 1; + $emptydate = 0; + $emptyhours = 1; } $orig_set_time = $set_time; @@ -6149,9 +6161,8 @@ class Form } else { $retstring .= "Bad value of MAIN_POPUP_CALENDAR"; } - } - // Show date with combo selects - else { + } else { + // Show date with combo selects // Day $retstring .= ''; @@ -6448,7 +6459,8 @@ class Form $retstring = ''; - $hourSelected = 0; $minSelected = 0; + $hourSelected = 0; + $minSelected = 0; // Hours if ($iSecond != '') { @@ -6914,7 +6926,8 @@ class Form $style = empty($tmpvalue['css']) ? ' class="'.$tmpvalue['css'].'"' : ''; } else { $value = $tmpvalue; - $disabled = ''; $style = ''; + $disabled = ''; + $style = ''; } if (!empty($disablebademail)) { if (($disablebademail == 1 && !preg_match('/<.+@.+>/', $value)) @@ -7725,9 +7738,8 @@ class Form //$linktoelem.=($linktoelem?'   ':''); if ($num > 0) { $linktoelemlist .= '
  • '.$langs->trans($possiblelink['label']).' ('.$num.')
  • '; - } - //else $linktoelem.=$langs->trans($possiblelink['label']); - else { + // } else $linktoelem.=$langs->trans($possiblelink['label']); + } else { $linktoelemlist .= '
  • '.$langs->trans($possiblelink['label']).' (0)
  • '; } } @@ -7782,7 +7794,8 @@ class Form { global $langs; - $yes = "yes"; $no = "no"; + $yes = "yes"; + $no = "no"; if ($option) { $yes = "1"; $no = "0"; @@ -8098,7 +8111,13 @@ class Form $entity = (!empty($object->entity) ? $object->entity : $conf->entity); $id = (!empty($object->id) ? $object->id : $object->rowid); - $ret = ''; $dir = ''; $file = ''; $originalfile = ''; $altfile = ''; $email = ''; $capture = ''; + $ret = ''; + $dir = ''; + $file = ''; + $originalfile = ''; + $altfile = ''; + $email = ''; + $capture = ''; if ($modulepart == 'societe') { $dir = $conf->societe->multidir_output[$entity]; if (!empty($object->logo)) { diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index 7d909440ecc..f1b80843488 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -227,7 +227,8 @@ class FormActions print ''."\n"; print load_fiche_titre($title, $newcardbutton, '', 0, 0, '', $morehtmlcenter); - $page = 0; $param = ''; + $page = 0; + $param = ''; print '
    '; print ''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index e7d8d94b6d2..34c522745d9 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -547,7 +547,8 @@ class FormCompany extends Form $num = $this->db->num_rows($resql); if ($num) { $i = 0; - $country = ''; $arraydata = array(); + $country = ''; + $arraydata = array(); while ($i < $num) { $obj = $this->db->fetch_object($resql); @@ -622,7 +623,8 @@ class FormCompany extends Form // Use Ajax search $minLength = (is_numeric($conf->global->COMPANY_USE_SEARCH_TO_SELECT) ? $conf->global->COMPANY_USE_SEARCH_TO_SELECT : 2); - $socid = 0; $name = ''; + $socid = 0; + $name = ''; if ($selected > 0) { $tmpthirdparty = new Societe($this->db); $result = $tmpthirdparty->fetch($selected); @@ -937,7 +939,8 @@ class FormCompany extends Form $maxlength = $formlength; if (empty($formlength)) { - $formlength = 24; $maxlength = 128; + $formlength = 24; + $maxlength = 128; } $out = ''; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index d5586a2c9d2..21327a9a37e 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -659,9 +659,8 @@ class FormFile $file = dol_buildpath('/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); if (file_exists($file)) { $res = include_once $file; - } - // For normalized external modules. - else { + } else { + // For normalized external modules. $file = dol_buildpath('/'.$modulepart.'/core/modules/'.$modulepart.'/modules_'.strtolower($submodulepart).'.php', 0); $res = include_once $file; } @@ -699,7 +698,8 @@ class FormFile $out .= ''; $addcolumforpicto = ($delallowed || $printer || $morepicto); - $colspan = (3 + ($addcolumforpicto ? 1 : 0)); $colspanmore = 0; + $colspan = (3 + ($addcolumforpicto ? 1 : 0)); + $colspanmore = 0; $out .= ''; print ' - - + diff --git a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php index a4c21ddcc2d..0010b87ff90 100644 --- a/htdocs/societe/canvas/individual/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/individual/tpl/card_create.tpl.php @@ -94,14 +94,14 @@ if (empty($conf) || !is_object($conf)) { - - + diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 9601a49f397..e0131a420fb 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -247,6 +247,7 @@ if (empty($reshook)) { // TODO Mutualise the list into object societe.class.php $objects = array( 'Adherent' => '/adherents/class/adherent.class.php', + 'Don' => '/don/class/don.class.php', 'Societe' => '/societe/class/societe.class.php', //'Categorie' => '/categories/class/categorie.class.php', 'ActionComm' => '/comm/action/class/actioncomm.class.php', @@ -278,6 +279,7 @@ if (empty($reshook)) { if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) { $error++; setEventMessages($db->lasterror(), null, 'errors'); + break; } } } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5da84355dbb..1d737bf1ef5 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1007,7 +1007,7 @@ if (empty($reshook)) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { // Multicurrency rate - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'update_extras') { $object->oldcopy = dol_clone($object); diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index fa06b94825e..bf31bcfe877 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -254,7 +254,7 @@ class Ticket extends CommonObject 'entity' => array('type'=>'integer', 'label'=>'Entity', 'visible'=>0, 'enabled'=>1, 'position'=>5, 'notnull'=>1, 'index'=>1), 'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'visible'=>1, 'enabled'=>1, 'position'=>10, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>''), 'track_id' => array('type'=>'varchar(255)', 'label'=>'TicketTrackId', 'visible'=>-2, 'enabled'=>1, 'position'=>11, 'notnull'=>-1, 'searchall'=>1, 'help'=>"Help text"), - 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax150 maxwidth150onsmartphone'), + 'fk_user_create' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Author', 'visible'=>1, 'enabled'=>1, 'position'=>15, 'notnull'=>1, 'css'=>'tdoverflowmax125 maxwidth150onsmartphone'), 'origin_email' => array('type'=>'mail', 'label'=>'OriginEmail', 'visible'=>-2, 'enabled'=>1, 'position'=>16, 'notnull'=>1, 'index'=>1, 'searchall'=>1, 'comment'=>"Reference of object", 'css'=>'tdoverflowmax150'), 'subject' => array('type'=>'varchar(255)', 'label'=>'Subject', 'visible'=>1, 'enabled'=>1, 'position'=>18, 'notnull'=>-1, 'searchall'=>1, 'help'=>"", 'css'=>'maxwidth200 tdoverflowmax200', 'autofocusoncreate'=>1), 'type_code' => array('type'=>'varchar(32)', 'label'=>'Type', 'visible'=>1, 'enabled'=>1, 'position'=>20, 'notnull'=>-1, 'help'=>"", 'css'=>'maxwidth125 tdoverflowmax50'), @@ -266,7 +266,7 @@ class Ticket extends CommonObject 'timing' => array('type'=>'varchar(20)', 'label'=>'Timing', 'visible'=>-1, 'enabled'=>1, 'position'=>42, 'notnull'=>-1, 'help'=>""), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'visible'=>1, 'enabled'=>1, 'position'=>500, 'notnull'=>1), 'date_read' => array('type'=>'datetime', 'label'=>'TicketReadOn', 'visible'=>-1, 'enabled'=>1, 'position'=>501, 'notnull'=>1), - 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax150'), + 'fk_user_assign' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'AssignedTo', 'visible'=>1, 'enabled'=>1, 'position'=>505, 'notnull'=>1, 'css'=>'tdoverflowmax125'), 'date_close' => array('type'=>'datetime', 'label'=>'TicketCloseOn', 'visible'=>-1, 'enabled'=>1, 'position'=>510, 'notnull'=>1), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'visible'=>-1, 'enabled'=>1, 'position'=>520, 'notnull'=>1), 'message' => array('type'=>'text', 'label'=>'Message', 'visible'=>-2, 'enabled'=>1, 'position'=>540, 'notnull'=>-1,), diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index 7a1cf699c3e..53bc1281d5b 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -392,7 +392,9 @@ if ($search_all) { if ($search_societe) { $sql .= natural_search('s.nom', $search_societe); } -//if ($search_fk_project) $sql .= natural_search('fk_project', $search_fk_project, 2); +if ($search_fk_project > 0) { + $sql .= natural_search('fk_project', $search_fk_project, 2); +} if ($search_date_start) { $sql .= " AND t.datec >= '".$db->idate($search_date_start)."'"; } @@ -755,7 +757,7 @@ foreach ($object->fields as $key => $val) { print ''; } elseif ($key == 'fk_user_assign' || $key == 'fk_user_create') { print ''; } elseif ($key == 'fk_statut') { $arrayofstatus = array(); @@ -772,7 +774,7 @@ foreach ($object->fields as $key => $val) { if ($search[$key]) { $selectedarray = array_values($search[$key]); } - print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth150', 1, 0, '', '', ''); + print Form::multiselectarray('search_fk_statut', $arrayofstatus, $selectedarray, 0, 0, 'minwidth100 maxwidth150', 1, 0, '', '', ''); print ''; } elseif ($key == "fk_soc") { print ''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 8712bcc4615..bcf42ffe43e 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -611,31 +611,31 @@ class User extends CommonObject public function loadDefaultValues() { global $conf; + if (!empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) { + // Load user->default_values for user. TODO Save this in memcached ? + require_once DOL_DOCUMENT_ROOT.'/core/class/defaultvalues.class.php'; - // Load user->default_values for user. TODO Save this in memcached ? - $sql = "SELECT rowid, entity, type, page, param, value"; - $sql .= " FROM ".MAIN_DB_PREFIX."default_values"; - $sql .= " WHERE entity IN (".($this->entity > 0 ? $this->entity.", " : "").$conf->entity.")"; // Entity of user (if defined) + current entity - $sql .= " AND user_id IN (0".($this->id > 0 ? ", ".$this->id : "").")"; // User 0 (all) + me (if defined) - $resql = $this->db->query($sql); - if ($resql) { - while ($obj = $this->db->fetch_object($resql)) { - if (!empty($obj->page) && !empty($obj->type) && !empty($obj->param)) { - // $obj->page is relative URL with or without params - // $obj->type can be 'filters', 'sortorder', 'createform', ... - // $obj->param is key or param - $pagewithoutquerystring = $obj->page; - $pagequeries = ''; - $reg = array(); - if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) { // There is query param - $pagewithoutquerystring = $reg[1]; - $pagequeries = $reg[2]; + $defaultValues = new DefaultValues($this->db); + $result = $defaultValues->fetchAll('', '', 0, 0, array('t.user_id'=>array(0, $this->id), 'entity'=>array($this->entity, $conf->entity))); // User 0 (all) + me (if defined) + + if (!is_array($result) && $result < 0) { + setEventMessages($defaultValues->error, $defaultValues->errors, 'errors'); + dol_print_error($this->db); + return -1; + } elseif (count($result) > 0) { + foreach ($result as $defval) { + if (!empty($defval->page) && !empty($defval->type) && !empty($defval->param)) { + $pagewithoutquerystring = $defval->page; + $pagequeries = ''; + $reg = array(); + if (preg_match('/^([^\?]+)\?(.*)$/', $pagewithoutquerystring, $reg)) { // There is query param + $pagewithoutquerystring = $reg[1]; + $pagequeries = $reg[2]; + } + $this->default_values[$pagewithoutquerystring][$defval->type][$pagequeries ? $pagequeries : '_noquery_'][$defval->param] = $defval->value; } - $this->default_values[$pagewithoutquerystring][$obj->type][$pagequeries ? $pagequeries : '_noquery_'][$obj->param] = $obj->value; - //if ($pagequeries) $this->default_values[$pagewithoutquerystring][$obj->type.'_queries']=$pagequeries; } } - // Sort by key, so _noquery_ is last if (!empty($this->default_values)) { foreach ($this->default_values as $a => $b) { foreach ($b as $c => $d) { @@ -643,13 +643,8 @@ class User extends CommonObject } } } - $this->db->free($resql); - - return 1; - } else { - dol_print_error($this->db); - return -1; } + return 1; } /** @@ -2503,9 +2498,8 @@ class User extends CommonObject // Only picto if ($withpictoimg > 0) { $picto = ''.img_object('', 'user', $paddafterimage.' '.($notooltip ? '' : 'class="paddingright classfortooltip"'), 0, 0, $notooltip ? 0 : 1).''; - } - // Picto must be a photo - else { + } else { + // Picto must be a photo $picto = ''.Form::showphoto('userphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg == -3 ? 'small' : ''), 'mini', 0, 1).''; } $result .= $picto; @@ -2740,9 +2734,9 @@ class User extends CommonObject if (!empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) { $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) } - } - // Set LDAP password if possible - elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password + } elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') { + // Set LDAP password if possible + // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password if (!empty($conf->global->DATABASE_PWD_ENCRYPTED)) { // Just for the default MD5 ! if (empty($conf->global->MAIN_SECURITY_HASH_ALGO)) { @@ -2750,9 +2744,8 @@ class User extends CommonObject $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase_crypted, 5); // Create OpenLDAP MD5 password from Dolibarr MD5 password } } - } - // Use $this->pass_indatabase value if exists - elseif (!empty($this->pass_indatabase)) { + } elseif (!empty($this->pass_indatabase)) { + // Use $this->pass_indatabase value if exists if (!empty($conf->global->LDAP_FIELD_PASSWORD)) { $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 651ff8edbb3..508a871de68 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -38,6 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formwebsite.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/website.class.php'; require_once DOL_DOCUMENT_ROOT.'/website/class/websitepage.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; @@ -2143,18 +2144,93 @@ if ($action == 'importsiteconfirm') { } } +$domainname = '0.0.0.0:8080'; +$tempdir = $conf->website->dir_output.'/'.$websitekey.'/'; +// Generate web site sitemaps +if ($action == 'generatesitemaps') { + $domtree = new DOMDocument('1.0', 'UTF-8'); + $root = $domtree->createElementNS('http://www.sitemaps.org/schemas/sitemap/0.9', 'urlset'); + $domtree->formatOutput = true; + $xmlname = 'sitemap.'.$websitekey.'.xml'; + $sql = "SELECT wp.type_container , wp.pageurl, wp.lang, wp.tms as tms, w.virtualhost"; + $sql .= " FROM ".MAIN_DB_PREFIX."website_page as wp, ".MAIN_DB_PREFIX."website as w"; + $sql .= " WHERE wp.type_container IN ('page', 'blogpost')"; + $sql .= " AND wp.fk_website = w.rowid"; + $sql .= " AND w.ref = '".dol_escape_json($websitekey)."'"; + $resql = $db->query($sql); + if ($resql) { + $num_rows = $db->num_rows($resql); + if ($num_rows > 0) { + $i = 0; + while ($i < $num_rows) { + $objp = $db->fetch_object($resql); + $url = $domtree->createElement('url'); + $pageurl = $objp->pageurl; + if ($objp->lang) { + $pageurl = $objp->lang.'/'.$pageurl; + } + if ($objp->virtualhost) { + $domainname = $objp->virtualhost; + } + $loc = $domtree->createElement('loc', 'http://'.$domainname.'/'.$pageurl); + $lastmod = $domtree->createElement('lastmod', $db->jdate($objp->tms)); + + $url->appendChild($loc); + $url->appendChild($lastmod); + $root->appendChild($url); + $i++; + } + $domtree->appendChild($root); + if ($domtree->save($tempdir.$xmlname)) { + if (!empty($conf->global->MAIN_UMASK)) { + @chmod($tempdir.$xmlname, octdec($conf->global->MAIN_UMASK)); + } + setEventMessages($langs->trans("SitemapGenerated"), null, 'mesgs'); + } else { + setEventMessages($object->error, $object->errors, 'errors'); + } + } + } else { + dol_print_error($db); + } + $robotcontent = @file_get_contents($filerobot); + $result = preg_replace('/\n/ims', '', $robotcontent); + if ($result) { + $robotcontent = $result; + } + $robotsitemap = "Sitemap: ".$domainname."/".$xmlname; + $result = strpos($robotcontent, 'Sitemap: '); + if ($result) { + $result = preg_replace("/Sitemap.*\n/", $robotsitemap, $robotcontent); + $robotcontent = $result ? $result : $robotcontent; + } else { + $robotcontent .= $robotsitemap."\n"; + } + $result = dolSaveRobotFile($filerobot, $robotcontent); + if (!$result) { + $error++; + setEventMessages('Failed to write file '.$filerobot, null, 'errors'); + } + $action = 'preview'; +} /* - * View - */ +* View +*/ $form = new Form($db); $formadmin = new FormAdmin($db); $formwebsite = new FormWebsite($db); $formother = new FormOther($db); +// Confirm generation of website sitemaps +if ($action == 'confirmgeneratesitemaps') { + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?website='.$website->ref, $langs->trans('ConfirmSitemapsCreation'), $langs->trans('ConfirmGenerateSitemaps', $object->ref), 'generatesitemaps', '', "yes", 1); + $action = 'preview'; +} + $helpurl = 'EN:Module_Website|FR:Module_Website_FR|ES:Módulo_Website'; $arrayofjs = array( @@ -2365,6 +2441,11 @@ if (!GETPOST('hide_websitemenu')) { print '   '; + // Generate site map + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("GenerateSitemaps")).'">'; + + print '   '; + print 'ref.'" class="button bordertransp"'.$disabled.' title="'.dol_escape_htmltag($langs->trans("ReplaceWebsiteContent")).'">'; } @@ -3686,6 +3767,12 @@ if ($action == 'editmeta' || $action == 'createcontainer') { // Edit properties print '
    '; } + +// Print formconfirm +if ($action == 'preview') { + print $formconfirm; +} + if ($action == 'editfile' || $action == 'file_manager') { print ''."\n"; print '

    '; diff --git a/test/phpunit/DateLibTzFranceTest.php b/test/phpunit/DateLibTzFranceTest.php index 7b1e4caa440..63eadc1a98f 100644 --- a/test/phpunit/DateLibTzFranceTest.php +++ b/test/phpunit/DateLibTzFranceTest.php @@ -82,9 +82,9 @@ class DateLibTzFranceTest extends PHPUnit\Framework\TestCase { global $conf,$user,$langs,$db; - if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') { - print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); - } + if (getServerTimeZoneString() != 'Europe/Paris' && getServerTimeZoneString() != 'Europe/Berlin') { + print "\n".__METHOD__." This PHPUnit test can be launched manually only onto a server with PHP timezone set to TZ=Europe/Paris, not a TZ=".getServerTimeZoneString().".\n"; die(); + } $db->begin(); // This is to have all actions inside a transaction even if test launched without suite.
    '; @@ -1221,7 +1221,9 @@ class FormFile include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; } - $i = 0; $nboflines = 0; $lastrowid = 0; + $i = 0; + $nboflines = 0; + $lastrowid = 0; foreach ($filearray as $key => $file) { // filearray must be only files here if ($file['name'] != '.' && $file['name'] != '..' @@ -1639,19 +1641,24 @@ class FormFile // Define relative path used to store the file $relativefile = preg_replace('/'.preg_quote($upload_dir.'/', '/').'/', '', $file['fullname']); - $id = 0; $ref = ''; + $id = 0; + $ref = ''; // To show ref or specific information according to view to show (defined by $module) $reg = array(); if ($modulepart == 'company' || $modulepart == 'tax') { - preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); + preg_match('/(\d+)\/[^\/]+$/', $relativefile, $reg); + $id = (isset($reg[1]) ? $reg[1] : ''); } elseif ($modulepart == 'invoice_supplier') { - preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { - $id = $ref; $ref = ''; + preg_match('/([^\/]+)\/[^\/]+$/', $relativefile, $reg); + $ref = (isset($reg[1]) ? $reg[1] : ''); if (is_numeric($ref)) { + $id = $ref; + $ref = ''; } - } // $ref may be also id with old supplier invoices - elseif ($modulepart == 'user' || $modulepart == 'holiday') { - preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $id = (isset($reg[1]) ? $reg[1] : ''); + } elseif ($modulepart == 'user' || $modulepart == 'holiday') { + // $ref may be also id with old supplier invoices + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); + $id = (isset($reg[1]) ? $reg[1] : ''); } elseif (in_array($modulepart, array( 'invoice', 'propal', @@ -1666,7 +1673,8 @@ class FormFile 'recruitment-recruitmentcandidature', 'mrp-mo', 'banque'))) { - preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); $ref = (isset($reg[1]) ? $reg[1] : ''); + preg_match('/(.*)\/[^\/]+$/', $relativefile, $reg); + $ref = (isset($reg[1]) ? $reg[1] : ''); } else { $parameters = array('modulepart'=>$modulepart,'fileinfo'=>$file); $reshook = $hookmanager->executeHooks('addSectionECMAuto', $parameters); @@ -1703,10 +1711,13 @@ class FormFile } if ($result > 0) { // Save object loaded into a cache - $found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance; + $found = 1; + $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = clone $object_instance; } if ($result == 0) { - $found = 1; $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; unset($filearray[$key]); + $found = 1; + $this->cache_objects[$modulepart.'_'.$id.'_'.$ref] = 'notfound'; + unset($filearray[$key]); } } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index e0c31336f8c..536ea152e47 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -441,7 +441,7 @@ class FormMail extends Form $out .= '
    '."\n"; $out .= ''; - $out .= ''; + $out .= ''; $out .= ''; $out .= ''; } @@ -911,7 +911,8 @@ class FormMail extends Form } // Complete substitution array with the url to make online payment - $paymenturl = ''; $validpaymentmethod = array(); + $paymenturl = ''; + $validpaymentmethod = array(); if (empty($this->substit['__REF__'])) { $paymenturl = ''; } else { diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 6fee9eb1000..127bfd2fd50 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1211,7 +1211,8 @@ class FormOther } // Define boxlista and boxlistb - $boxlista = ''; $boxlistb = ''; + $boxlista = ''; + $boxlistb = ''; $nbboxactivated = count($boxidactivatedforuser); if ($nbboxactivated) { @@ -1357,7 +1358,8 @@ class FormOther { global $langs; - $automatic = "automatic"; $manual = "manual"; + $automatic = "automatic"; + $manual = "manual"; if ($option) { $automatic = "1"; $manual = "0"; diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 21f8b2684fe..422a193030a 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -393,7 +393,8 @@ class FormProjets continue; } - $labeltoshow = ''; $titletoshow = ''; + $labeltoshow = ''; + $titletoshow = ''; $disabled = 0; if ($obj->fk_statut == Project::STATUS_DRAFT) { diff --git a/htdocs/core/class/html.formsms.class.php b/htdocs/core/class/html.formsms.class.php index ac69ca5ce26..57d8876c3ea 100644 --- a/htdocs/core/class/html.formsms.class.php +++ b/htdocs/core/class/html.formsms.class.php @@ -200,7 +200,8 @@ function limitChars(textarea, limit, infodiv) } } elseif (!empty($conf->global->MAIN_SMS_SENDMODE)) { // $conf->global->MAIN_SMS_SENDMODE looks like a value 'class@module' $tmp = explode('@', $conf->global->MAIN_SMS_SENDMODE); - $classfile = $tmp[0]; $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); + $classfile = $tmp[0]; + $module = (empty($tmp[1]) ? $tmp[0] : $tmp[1]); dol_include_once('/'.$module.'/class/'.$classfile.'.class.php'); try { $classname = ucfirst($classfile); diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 9f1afab13f7..4210113f990 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -246,7 +246,8 @@ class FormWebsite if ($atleastonepage) { if (empty($pageid) && $action != 'createcontainer') { // Page id is not defined, we try to take one - $firstpageid = 0; $homepageid = 0; + $firstpageid = 0; + $homepageid = 0; foreach ($website->lines as $key => $valpage) { if (empty($firstpageid)) { $firstpageid = $valpage->id; diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 73007db9363..bd2d6d020cd 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -8,7 +8,7 @@ * Copyright 2013, Leaf Corcoran * Licensed under MIT or GPLv3, see LICENSE */ - +// phpcs:disable /** * The LESS compiler and parser. * @@ -3385,7 +3385,7 @@ class lessc_parser return false; } - // a # color + // a # color protected function color(&$out) { if ($this->match('(#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3}))', $m)) { @@ -3400,11 +3400,11 @@ class lessc_parser return false; } - // consume an argument definition list surrounded by () - // each argument is a variable name with optional value - // or at the end a ... or a variable named followed by ... - // arguments are separated by , unless a ; is in the list, then ; is the - // delimiter. + // consume an argument definition list surrounded by () + // each argument is a variable name with optional value + // or at the end a ... or a variable named followed by ... + // arguments are separated by , unless a ; is in the list, then ; is the + // delimiter. protected function argumentDef(&$args, &$isVararg) { $s = $this->seek(); @@ -3726,7 +3726,7 @@ class lessc_parser return false; } - // consume a less variable + // consume a less variable protected function variable(&$name) { $s = $this->seek(); @@ -3746,10 +3746,10 @@ class lessc_parser return false; } - /** - * Consume an assignment operator - * Can optionally take a name that will be set to the current property name - */ + /** + * Consume an assignment operator + * Can optionally take a name that will be set to the current property name + */ protected function assign($name = null) { if ($name) { @@ -3758,7 +3758,7 @@ class lessc_parser return $this->literal(':') || $this->literal('='); } - // consume a keyword + // consume a keyword protected function keyword(&$word) { if ($this->match('([\w_\-\*!"][\w\-_"]*)', $m)) { @@ -3768,7 +3768,7 @@ class lessc_parser return false; } - // consume an end of statement delimiter + // consume an end of statement delimiter protected function end() { if ($this->literal(';', false)) { @@ -3807,8 +3807,8 @@ class lessc_parser return true; } - // a bunch of guards that are and'd together - // TODO rename to guardGroup + // a bunch of guards that are and'd together + // TODO rename to guardGroup protected function guardGroup(&$guardGroup) { $s = $this->seek(); @@ -3846,7 +3846,7 @@ class lessc_parser return false; } - /* raw parsing functions */ + /* raw parsing functions */ protected function literal($what, $eatWhitespace = null) { diff --git a/htdocs/core/class/menubase.class.php b/htdocs/core/class/menubase.class.php index a9fb8b01c16..97c63e62d67 100644 --- a/htdocs/core/class/menubase.class.php +++ b/htdocs/core/class/menubase.class.php @@ -578,7 +578,10 @@ class Menubase //var_dump($this->newmenu->liste); } else { // Search first menu with this couple (mainmenu,leftmenu)=(fk_mainmenu,fk_leftmenu) - $searchlastsub = 0; $lastid = 0; $nextid = 0; $found = 0; + $searchlastsub = 0; + $lastid = 0; + $nextid = 0; + $found = 0; foreach ($this->newmenu->liste as $keyparent => $valparent) { //var_dump($valparent); if ($searchlastsub) { // If we started to search for last submenu diff --git a/htdocs/core/class/rssparser.class.php b/htdocs/core/class/rssparser.class.php index aae4acd7bc0..0f09d232712 100644 --- a/htdocs/core/class/rssparser.class.php +++ b/htdocs/core/class/rssparser.class.php @@ -410,9 +410,10 @@ class RssParser } } if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) { - $tmprss = xml2php($rss); $items = $tmprss['entry']; - } // With simplexml - else { + $tmprss = xml2php($rss); + $items = $tmprss['entry']; + } else { + // With simplexml $items = $rss->items; // With xmlparse } //var_dump($items);exit; @@ -552,45 +553,36 @@ class RssParser if (isset($attrs['rdf:about'])) { $this->current_item['about'] = $attrs['rdf:about']; } - } - - // if we're in the default namespace of an RSS feed, - // record textinput or image fields - elseif ($this->_format == 'rss' and + } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'textinput') { + // if we're in the default namespace of an RSS feed, + // record textinput or image fields $this->intextinput = true; } elseif ($this->_format == 'rss' and $this->current_namespace == '' and $el == 'image') { $this->inimage = true; - } - - // handle atom content constructs - elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + } elseif ($this->_format == 'atom' and in_array($el, $this->_CONTENT_CONSTRUCTS)) { + // handle atom content constructs // avoid clashing w/ RSS mod_content if ($el == 'content') { $el = 'atom_content'; } $this->incontent = $el; - } - - // if inside an Atom content construct (e.g. content or summary) field treat tags as text - elseif ($this->_format == 'atom' and $this->incontent) { + } elseif ($this->_format == 'atom' and $this->incontent) { + // if inside an Atom content construct (e.g. content or summary) field treat tags as text // if tags are inlined, then flatten $attrs_str = join(' ', array_map('map_attrs', array_keys($attrs), array_values($attrs))); $this->append_content("<$element $attrs_str>"); array_unshift($this->stack, $el); - } - - // Atom support many links per containging element. - // Magpie treats link elements of type rel='alternate' - // as being equivalent to RSS's simple link element. - // - elseif ($this->_format == 'atom' and $el == 'link') { + } elseif ($this->_format == 'atom' and $el == 'link') { + // Atom support many links per containging element. + // Magpie treats link elements of type rel='alternate' + // as being equivalent to RSS's simple link element. if (isset($attrs['rel']) && $attrs['rel'] == 'alternate') { $link_el = 'link'; } elseif (!isset($attrs['rel'])) { @@ -600,9 +592,8 @@ class RssParser } $this->append($link_el, $attrs['href']); - } - // set stack[0] to current element - else { + } else { + // set stack[0] to current element array_unshift($this->stack, $el); } } diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 3618cfc2413..ef26dc4ac65 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -426,9 +426,8 @@ class SMTPs if ($_retVal = $this->server_parse($this->socket, "220")) { $_retVal = $this->socket; } - } - // This connection attempt failed. - else { + } else { + // This connection attempt failed. // @CHANGE LDR if (empty($this->errstr)) { $this->errstr = 'Failed to connect with fsockopen host='.$this->getHost().' port='.$this->getPort(); @@ -580,10 +579,8 @@ class SMTPs if (!empty($this->_smtpsID) && !empty($this->_smtpsPW)) { // Send the RFC2554 specified EHLO. $_retVal = $this->_server_authenticate(); - } - - // This is a "normal" SMTP Server "handshack" - else { + } else { + // This is a "normal" SMTP Server "handshack" // Send the RFC821 specified HELO. $host = $this->getHost(); $usetls = preg_match('@tls://@i', $host); @@ -705,10 +702,8 @@ class SMTPs $this->_setErr(110, '"'.$_strConfigPath.'" is not a valid path.'); $_retVal = false; } - } - - // Read the Systems php.ini file - else { + } else { + // Read the Systems php.ini file // Set these properties ONLY if they are set in the php.ini file. // Otherwise the default values will be used. if ($_host = ini_get('SMTPs')) { @@ -1048,10 +1043,8 @@ class SMTPs if (strstr($_addrList, ',')) { // "explode "list" into an array $_addrList = explode(',', $_addrList); - } - - // Stick it in an array - else { + } else { + // Stick it in an array $_addrList = array($_addrList); } } @@ -1070,9 +1063,8 @@ class SMTPs $_tmpHost = explode('@', $_tmpaddr[1]); $_tmpaddr[0] = trim($_tmpaddr[0], ' ">'); $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0]; - } - // We only have an eMail address - else { + } else { + // We only have an eMail address // Strip off the beggining '<' $_strAddr = str_replace('<', '', $_strAddr); @@ -1449,10 +1441,8 @@ class SMTPs // If we have ZERO, we have a problem if ($keyCount === 0) { die("Sorry, no content"); - } - - // If we have ONE, we can use the simple format - elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + } elseif ($keyCount === 1 && empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // If we have ONE, we can use the simple format $_msgData = $this->_msgContent; $_msgData = $_msgData[$_types[0]]; @@ -1467,10 +1457,8 @@ class SMTPs $content .= "\r\n" . $_msgData['data']."\r\n"; - } - - // If we have more than ONE, we use the multi-part format - elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + } elseif ($keyCount >= 1 || !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // If we have more than ONE, we use the multi-part format // Since this is an actual multi-part message // We need to define a content message Boundary // NOTE: This was 'multipart/alternative', but Windows based mail servers have issues with this. @@ -1512,9 +1500,8 @@ class SMTPs $content .= "\r\n".$_data['data']."\r\n\r\n"; } - } - // @CHANGE LDR - elseif ($type == 'image') { + } elseif ($type == 'image') { + // @CHANGE LDR // loop through all images foreach ($_content as $_image => $_data) { $content .= "--".$this->_getBoundary('related')."\r\n"; // always related for an inline image @@ -1546,7 +1533,8 @@ class SMTPs $content .= "--".$this->_getBoundary('related')."\r\n"; } - if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part before html part + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // Add plain text message part before html part $content .= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"'."\r\n"; $content .= "\r\n"; $content .= "--".$this->_getBoundary('alternative')."\r\n"; @@ -1566,7 +1554,8 @@ class SMTPs $content .= "\r\n".$_content['data']."\r\n"; - if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { // Add plain text message part after html part + if (!key_exists('image', $this->_msgContent) && $_content['dataText'] && !empty($conf->global->MAIN_MAIL_USE_MULTI_PART)) { + // Add plain text message part after html part $content .= "--".$this->_getBoundary('alternative')."--\r\n"; } @@ -1599,7 +1588,7 @@ class SMTPs $this->_msgContent['attachment'][$strFileName]['data'] = $strContent; if ($this->getMD5flag()) { - $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); + $this->_msgContent['attachment'][$strFileName]['md5'] = dol_hash($strContent, 3); } } } diff --git a/htdocs/core/class/stats.class.php b/htdocs/core/class/stats.class.php index b2c9b069095..4ac164b1d3a 100644 --- a/htdocs/core/class/stats.class.php +++ b/htdocs/core/class/stats.class.php @@ -424,7 +424,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $j = 0; + $i = 0; + $j = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); $j = $row[0] * 1; @@ -539,7 +540,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $j = 0; + $i = 0; + $j = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); $j = $row[0] * 1; @@ -594,7 +596,8 @@ abstract class Stats $resql = $this->db->query($sql); if ($resql) { $num = $this->db->num_rows($resql); - $i = 0; $other = 0; + $i = 0; + $other = 0; while ($i < $num) { $row = $this->db->fetch_row($resql); if ($i < $limit || $num == $limit) { diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index 0aa00153f5b..007b812cfa4 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -81,7 +81,8 @@ class Translate foreach ($conf->file->dol_document_root as $dir) { $newdir = $dir.$conf->global->MAIN_FORCELANGDIR; // For example $conf->global->MAIN_FORCELANGDIR is '/mymodule' meaning we search files into '/mymodule/langs/xx_XX' if (!in_array($newdir, $this->dir)) { - $more['module_'.$i] = $newdir; $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. + $more['module_'.$i] = $newdir; + $i++; // We add the forced dir into the array $more. Just after, we add entries into $more to list of lang dir $this->dir. } } $this->dir = array_merge($more, $this->dir); // Forced dir ($more) are before standard dirs ($this->dir) @@ -267,9 +268,8 @@ class Translate // Using a memcached server if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) { $usecachekey = $newdomain.'_'.$langofdir.'_'.md5($file_lang); // Should not contains special chars - } - // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) - elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) $usecachekey = $newdomain; } @@ -458,9 +458,8 @@ class Translate // Using a memcached server if (!empty($conf->memcached->enabled) && !empty($conf->global->MEMCACHED_SERVER)) { $usecachekey = $newdomain.'_'.$langofdir; // Should not contains special chars - } - // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) - elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + } elseif (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02)) { + // Using cache with shmop. Speed gain: 40ms - Memory overusage: 200ko (Size of session cache file) $usecachekey = $newdomain; } diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 3806e5bda4d..7be7e8f28cc 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -222,11 +222,13 @@ class Utils $prefix = 'dump'; $ext = 'sql'; if (in_array($type, array('mysql', 'mysqli'))) { - $prefix = 'mysqldump'; $ext = 'sql'; + $prefix = 'mysqldump'; + $ext = 'sql'; } //if ($label == 'PostgreSQL') { $prefix='pg_dump'; $ext='dump'; } if (in_array($type, array('pgsql'))) { - $prefix = 'pg_dump'; $ext = 'sql'; + $prefix = 'pg_dump'; + $ext = 'sql'; } $file = $prefix.'_'.$dolibarr_main_db_name.'_'.dol_sanitizeFileName(DOL_VERSION).'_'.strftime("%Y%m%d%H%M").'.'.$ext; } @@ -350,7 +352,8 @@ class Utils // TODO Replace with executeCLI function if ($execmethod == 1) { - $output_arr = array(); $retval = null; + $output_arr = array(); + $retval = null; exec($fullcommandclear, $output_arr, $retval); if ($retval != 0) { diff --git a/htdocs/core/class/vcard.class.php b/htdocs/core/class/vcard.class.php index 229966468c1..d513262b871 100644 --- a/htdocs/core/class/vcard.class.php +++ b/htdocs/core/class/vcard.class.php @@ -63,7 +63,8 @@ function dol_quoted_printable_encode($input, $line_max = 76) if (($dec == 32) && ($i == ($linlen - 1))) { // convert space at eol only $c = "=20"; } elseif (($dec == 61) || ($dec < 32) || ($dec > 126)) { // always encode "\t", which is *not* required - $h2 = floor($dec / 16); $h1 = floor($dec % 16); + $h2 = floor($dec / 16); + $h1 = floor($dec % 16); $c = $escape.$hex["$h2"].$hex["$h1"]; } if ((strlen($newline) + strlen($c)) >= $line_max) { // CRLF is not counted diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index 2d3210cad66..c5e0137b98d 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -615,7 +615,9 @@ if ($sql) { dol_print_error($db); } - $ifetch = 0; $xi = 0; $oldlabeltouse = ''; + $ifetch = 0; + $xi = 0; + $oldlabeltouse = ''; while ($obj = $db->fetch_object($resql)) { $ifetch++; if ($useagroupby) { @@ -681,9 +683,8 @@ if ($sql) { if ($objfieldforg == '0') { // The record we fetch is for this group $data[$xi][$fieldforybis] = $obj->$fieldfory; - } - // The record we fetch is not for this group - elseif (!isset($data[$xi][$fieldforybis])) { + } elseif (!isset($data[$xi][$fieldforybis])) { + // The record we fetch is not for this group $data[$xi][$fieldforybis] = '0'; } } else { @@ -691,9 +692,8 @@ if ($sql) { if ((string) $objfieldforg === (string) $gvaluepossiblekey) { // The record we fetch is for this group $data[$xi][$fieldforybis] = $obj->$fieldfory; - } - // The record we fetch is not for this group - elseif (!isset($data[$xi][$fieldforybis])) { + } elseif (!isset($data[$xi][$fieldforybis])) { + // The record we fetch is not for this group $data[$xi][$fieldforybis] = '0'; } } diff --git a/htdocs/core/datepicker.php b/htdocs/core/datepicker.php index c6aaef77f9c..7842457db0f 100644 --- a/htdocs/core/datepicker.php +++ b/htdocs/core/datepicker.php @@ -228,7 +228,9 @@ function displayBox($selectedDate, $month, $year) $mydate = dol_get_first_day_week(1, $month, $year, true); // mydate = cursor date // Loop on each day of month - $stoploop = 0; $day = 1; $cols = 0; + $stoploop = 0; + $day = 1; + $cols = 0; while (!$stoploop) { //print_r($mydate); if ($mydate < $firstdate) { // At first run diff --git a/htdocs/core/extrafieldsinexport.inc.php b/htdocs/core/extrafieldsinexport.inc.php index 0c47e97aef9..0d29c0d1323 100644 --- a/htdocs/core/extrafieldsinexport.inc.php +++ b/htdocs/core/extrafieldsinexport.inc.php @@ -58,9 +58,8 @@ if ($resql) { // This can fail when class is used on old database (during mig $this->export_fields_array[$r][$fieldname] = $fieldlabel; $this->export_TypeFields_array[$r][$fieldname] = $typeFilter; $this->export_entities_array[$r][$fieldname] = $keyforelement; - } - // If this is a computed field - else { + } else { + // If this is a computed field $this->export_fields_array[$r][$fieldname] = $fieldlabel; $this->export_TypeFields_array[$r][$fieldname] = $typeFilter.'Compute'; $this->export_special_array[$r][$fieldname] = $obj->fieldcomputed; diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 15b8e8bb188..759b97aaedb 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -106,10 +106,12 @@ function versioncompare($versionarray1, $versionarray2) $level++; //print 'level '.$level.' '.$operande1.'-'.$operande2.'
    '; if ($operande1 < $operande2) { - $ret = -$level; break; + $ret = -$level; + break; } if ($operande1 > $operande2) { - $ret = $level; break; + $ret = $level; + break; } } //print join('.',$versionarray1).'('.count($versionarray1).') / '.join('.',$versionarray2).'('.count($versionarray2).') => '.$ret.'
    '."\n"; @@ -1240,40 +1242,52 @@ function complete_dictionary_with_modules(&$taborder, &$tabname, &$tablib, &$tab //var_dump($objMod->dictionaries['tabname']); $nbtabname = $nbtablib = $nbtabsql = $nbtabsqlsort = $nbtabfield = $nbtabfieldvalue = $nbtabfieldinsert = $nbtabrowid = $nbtabcond = $nbtabfieldcheck = $nbtabhelp = 0; foreach ($objMod->dictionaries['tabname'] as $val) { - $nbtabname++; $taborder[] = max($taborder) + 1; $tabname[] = $val; + $nbtabname++; + $taborder[] = max($taborder) + 1; + $tabname[] = $val; } // Position foreach ($objMod->dictionaries['tablib'] as $val) { - $nbtablib++; $tablib[] = $val; + $nbtablib++; + $tablib[] = $val; } foreach ($objMod->dictionaries['tabsql'] as $val) { - $nbtabsql++; $tabsql[] = $val; + $nbtabsql++; + $tabsql[] = $val; } foreach ($objMod->dictionaries['tabsqlsort'] as $val) { - $nbtabsqlsort++; $tabsqlsort[] = $val; + $nbtabsqlsort++; + $tabsqlsort[] = $val; } foreach ($objMod->dictionaries['tabfield'] as $val) { - $nbtabfield++; $tabfield[] = $val; + $nbtabfield++; + $tabfield[] = $val; } foreach ($objMod->dictionaries['tabfieldvalue'] as $val) { - $nbtabfieldvalue++; $tabfieldvalue[] = $val; + $nbtabfieldvalue++; + $tabfieldvalue[] = $val; } foreach ($objMod->dictionaries['tabfieldinsert'] as $val) { - $nbtabfieldinsert++; $tabfieldinsert[] = $val; + $nbtabfieldinsert++; + $tabfieldinsert[] = $val; } foreach ($objMod->dictionaries['tabrowid'] as $val) { - $nbtabrowid++; $tabrowid[] = $val; + $nbtabrowid++; + $tabrowid[] = $val; } foreach ($objMod->dictionaries['tabcond'] as $val) { - $nbtabcond++; $tabcond[] = $val; + $nbtabcond++; + $tabcond[] = $val; } if (!empty($objMod->dictionaries['tabhelp'])) { foreach ($objMod->dictionaries['tabhelp'] as $val) { - $nbtabhelp++; $tabhelp[] = $val; + $nbtabhelp++; + $tabhelp[] = $val; } } if (!empty($objMod->dictionaries['tabfieldcheck'])) { foreach ($objMod->dictionaries['tabfieldcheck'] as $val) { - $nbtabfieldcheck++; $tabfieldcheck[] = $val; + $nbtabfieldcheck++; + $tabfieldcheck[] = $val; } } diff --git a/htdocs/core/lib/barcode.lib.php b/htdocs/core/lib/barcode.lib.php index cbf56136978..cd8764a8a87 100644 --- a/htdocs/core/lib/barcode.lib.php +++ b/htdocs/core/lib/barcode.lib.php @@ -167,7 +167,9 @@ function barcode_encode($code, $encoding) */ function barcode_gen_ean_sum($ean) { - $even = true; $esum = 0; $osum = 0; + $even = true; + $esum = 0; + $osum = 0; $ln = strlen($ean) - 1; for ($i = $ln; $i >= 0; $i--) { if ($even) { @@ -300,7 +302,8 @@ function barcode_encode_genbarcode($code, $encoding) ); //var_dump($ret); if (preg_match('/permission denied/i', $ret['bars'])) { - $ret['error'] = $ret['bars']; $ret['bars'] = ''; + $ret['error'] = $ret['bars']; + $ret['bars'] = ''; return $ret; } if (!$ret['bars']) { diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 87653786b9f..426b486a8cf 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -84,7 +84,10 @@ function getServerTimeZoneInt($refgmtdate = 'now') { if (method_exists('DateTimeZone', 'getOffset')) { // Method 1 (include daylight) - $gmtnow = dol_now('gmt'); $yearref = dol_print_date($gmtnow, '%Y'); $monthref = dol_print_date($gmtnow, '%m'); $dayref = dol_print_date($gmtnow, '%d'); + $gmtnow = dol_now('gmt'); + $yearref = dol_print_date($gmtnow, '%Y'); + $monthref = dol_print_date($gmtnow, '%m'); + $dayref = dol_print_date($gmtnow, '%d'); if ($refgmtdate == 'now') { $newrefgmtdate = $yearref.'-'.$monthref.'-'.$dayref; } elseif ($refgmtdate == 'summer') { @@ -134,10 +137,12 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) $deltastring = 'P'; if ($duration_value > 0) { - $deltastring .= abs($duration_value); $sub = false; + $deltastring .= abs($duration_value); + $sub = false; } if ($duration_value < 0) { - $deltastring .= abs($duration_value); $sub = true; + $deltastring .= abs($duration_value); + $sub = true; } if ($duration_unit == 'd') { $deltastring .= "D"; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index bde5408eb65..b7e7ffd5e7e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -123,7 +123,8 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl // Check if file is qualified foreach ($excludefilterarray as $filt) { if (preg_match('/'.$filt.'/i', $file) || preg_match('/'.$filt.'/i', $fullpathfile)) { - $qualified = 0; break; + $qualified = 0; + break; } } //print $fullpathfile.' '.$file.' '.$qualified.'
    '; @@ -400,9 +401,11 @@ function dol_compare_file($a, $b) $sortorder = strtoupper($sortorder); if ($sortorder == 'ASC') { - $retup = -1; $retdown = 1; + $retup = -1; + $retdown = 1; } else { - $retup = 1; $retdown = -1; + $retup = 1; + $retdown = -1; } if ($sortfield == 'name') { @@ -1916,9 +1919,11 @@ function dol_compress_file($inputfile, $outputfile, $mode = "gz", &$errorstring $data = implode("", file(dol_osencode($inputfile))); if ($mode == 'gz') { - $foundhandler = 1; $compressdata = gzencode($data, 9); + $foundhandler = 1; + $compressdata = gzencode($data, 9); } elseif ($mode == 'bz') { - $foundhandler = 1; $compressdata = bzcompress($data, 9); + $foundhandler = 1; + $compressdata = bzcompress($data, 9); } elseif ($mode == 'zip') { if (class_exists('ZipArchive') && !empty($conf->global->MAIN_USE_ZIPARCHIVE_FOR_ZIP_COMPRESS)) { $foundhandler = 1; @@ -2037,7 +2042,8 @@ function dol_uncompress($inputfile, $outputdir) if (!is_array($result) && $result <= 0) { return array('error'=>$archive->errorInfo(true)); } else { - $ok = 1; $errmsg = ''; + $ok = 1; + $errmsg = ''; // Loop on each file to check result for unzipping file foreach ($result as $key => $val) { if ($val['status'] == 'path_creation_fail') { @@ -2250,9 +2256,13 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } // Define possible keys to use for permission check - $lire = 'lire'; $read = 'read'; $download = 'download'; + $lire = 'lire'; + $read = 'read'; + $download = 'download'; if ($mode == 'write') { - $lire = 'creer'; $read = 'write'; $download = 'upload'; + $lire = 'creer'; + $read = 'write'; + $download = 'upload'; } // Wrapping for miscellaneous medias files @@ -2262,100 +2272,100 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $accessallowed = 1; $original_file = $conf->medias->multidir_output[$entity].'/'.$original_file; - } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log - elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'logs' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = ($user->admin && basename($original_file) == $original_file && preg_match('/^dolibarr.*\.log$/', basename($original_file))); $original_file = $dolibarr_main_data_root.'/'.$original_file; - } // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log - elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'doctemplates' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.log files, like when used with url http://.../document.php?modulepart=logs&file=dolibarr.log $accessallowed = $user->admin; $original_file = $dolibarr_main_data_root.'/doctemplates/'.$original_file; - } // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip - elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'doctemplateswebsite' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip $accessallowed = ($fuser->rights->website->write && preg_match('/\.jpg$/i', basename($original_file))); $original_file = $dolibarr_main_data_root.'/doctemplates/websites/'.$original_file; - } // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip - elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { + } elseif ($modulepart == 'packages' && !empty($dolibarr_main_data_root)) { + // Wrapping for *.zip files, like when used with url http://.../document.php?modulepart=packages&file=module_myfile.zip // Dir for custom dirs $tmp = explode(',', $dolibarr_main_document_root_alt); $dirins = $tmp[0]; $accessallowed = ($user->admin && preg_match('/^module_.*\.zip$/', basename($original_file))); $original_file = $dirins.'/'.$original_file; - } // Wrapping for some images - elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output)) { + } elseif ($modulepart == 'mycompany' && !empty($conf->mycompany->dir_output)) { + // Wrapping for some images $accessallowed = 1; $original_file = $conf->mycompany->dir_output.'/'.$original_file; - } // Wrapping for users photos - elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { + } elseif ($modulepart == 'userphoto' && !empty($conf->user->dir_output)) { + // Wrapping for users photos $accessallowed = 1; $original_file = $conf->user->dir_output.'/'.$original_file; - } // Wrapping for members photos - elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { + } elseif ($modulepart == 'memberphoto' && !empty($conf->adherent->dir_output)) { + // Wrapping for members photos $accessallowed = 1; $original_file = $conf->adherent->dir_output.'/'.$original_file; - } // Wrapping pour les apercu factures - elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { + } elseif ($modulepart == 'apercufacture' && !empty($conf->facture->multidir_output[$entity])) { + // Wrapping pour les apercu factures if ($fuser->rights->facture->{$lire}) { $accessallowed = 1; } $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu propal - elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { + } elseif ($modulepart == 'apercupropal' && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping pour les apercu propal if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu commande - elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { + } elseif ($modulepart == 'apercucommande' && !empty($conf->commande->multidir_output[$entity])) { + // Wrapping pour les apercu commande if ($fuser->rights->commande->{$lire}) { $accessallowed = 1; } $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu intervention - elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { + } elseif (($modulepart == 'apercufichinter' || $modulepart == 'apercuficheinter') && !empty($conf->ficheinter->dir_output)) { + // Wrapping pour les apercu intervention if ($fuser->rights->ficheinter->{$lire}) { $accessallowed = 1; } $original_file = $conf->ficheinter->dir_output.'/'.$original_file; - } // Wrapping pour les apercu conat - elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) { + } elseif (($modulepart == 'apercucontract') && !empty($conf->contrat->multidir_output[$entity])) { + // Wrapping pour les apercu contrat if ($fuser->rights->contrat->{$lire}) { $accessallowed = 1; } $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les apercu supplier proposal - elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { + } elseif (($modulepart == 'apercusupplier_proposal' || $modulepart == 'apercusupplier_proposal') && !empty($conf->supplier_proposal->dir_output)) { + // Wrapping pour les apercu supplier proposal if ($fuser->rights->supplier_proposal->{$lire}) { $accessallowed = 1; } $original_file = $conf->supplier_proposal->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier order - elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) { + } elseif (($modulepart == 'apercusupplier_order' || $modulepart == 'apercusupplier_order') && !empty($conf->fournisseur->commande->dir_output)) { + // Wrapping pour les apercu supplier order if ($fuser->rights->fournisseur->commande->{$lire}) { $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier invoice - elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) { + } elseif (($modulepart == 'apercusupplier_invoice' || $modulepart == 'apercusupplier_invoice') && !empty($conf->fournisseur->facture->dir_output)) { + // Wrapping pour les apercu supplier invoice if ($fuser->rights->fournisseur->facture->{$lire}) { $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; - } // Wrapping pour les apercu supplier invoice - elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { + } elseif (($modulepart == 'apercuexpensereport') && !empty($conf->expensereport->dir_output)) { + // Wrapping pour les apercu supplier invoice if ($fuser->rights->expensereport->{$lire}) { $accessallowed = 1; } $original_file = $conf->expensereport->dir_output.'/'.$original_file; - } // Wrapping pour les images des stats propales - elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { + } elseif ($modulepart == 'propalstats' && !empty($conf->propal->multidir_temp[$entity])) { + // Wrapping pour les images des stats propales if ($fuser->rights->propale->{$lire}) { $accessallowed = 1; } $original_file = $conf->propal->multidir_temp[$entity].'/'.$original_file; - } // Wrapping pour les images des stats commandes - elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { + } elseif ($modulepart == 'orderstats' && !empty($conf->commande->dir_temp)) { + // Wrapping pour les images des stats commandes if ($fuser->rights->commande->{$lire}) { $accessallowed = 1; } @@ -2365,8 +2375,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats factures - elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { + } elseif ($modulepart == 'billstats' && !empty($conf->facture->dir_temp)) { + // Wrapping pour les images des stats factures if ($fuser->rights->facture->{$lire}) { $accessallowed = 1; } @@ -2376,45 +2386,45 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { + } elseif ($modulepart == 'expeditionstats' && !empty($conf->expedition->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->expedition->{$lire}) { $accessallowed = 1; } $original_file = $conf->expedition->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { + } elseif ($modulepart == 'tripsexpensesstats' && !empty($conf->deplacement->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->deplacement->{$lire}) { $accessallowed = 1; } $original_file = $conf->deplacement->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats expeditions - elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { + } elseif ($modulepart == 'memberstats' && !empty($conf->adherent->dir_temp)) { + // Wrapping pour les images des stats expeditions if ($fuser->rights->adherent->{$lire}) { $accessallowed = 1; } $original_file = $conf->adherent->dir_temp.'/'.$original_file; - } // Wrapping pour les images des stats produits - elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) { + } elseif (preg_match('/^productstats_/i', $modulepart) && !empty($conf->product->dir_temp)) { + // Wrapping pour les images des stats produits if ($fuser->rights->produit->{$lire} || $fuser->rights->service->{$lire}) { $accessallowed = 1; } $original_file = (!empty($conf->product->multidir_temp[$entity]) ? $conf->product->multidir_temp[$entity] : $conf->service->multidir_temp[$entity]).'/'.$original_file; - } // Wrapping for taxes - elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { + } elseif (in_array($modulepart, array('tax', 'tax-vat')) && !empty($conf->tax->dir_output)) { + // Wrapping for taxes if ($fuser->rights->tax->charges->{$lire}) { $accessallowed = 1; } $modulepartsuffix = str_replace('tax-', '', $modulepart); $original_file = $conf->tax->dir_output.'/'.($modulepartsuffix != 'tax' ? $modulepartsuffix.'/' : '').$original_file; - } // Wrapping for events - elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + // Wrapping for events if ($fuser->rights->agenda->myactions->{$read}) { $accessallowed = 1; } $original_file = $conf->agenda->dir_output.'/'.$original_file; - } // Wrapping for categories - elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity])) { + } elseif ($modulepart == 'category' && !empty($conf->categorie->multidir_output[$entity])) { + // Wrapping for categories if (empty($entity) || empty($conf->categorie->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2422,44 +2432,44 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->categorie->multidir_output[$entity].'/'.$original_file; - } // Wrapping pour les prelevements - elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { + } elseif ($modulepart == 'prelevement' && !empty($conf->prelevement->dir_output)) { + // Wrapping pour les prelevements if ($fuser->rights->prelevement->bons->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->prelevement->dir_output.'/'.$original_file; - } // Wrapping pour les graph energie - elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { + } elseif ($modulepart == 'graph_stock' && !empty($conf->stock->dir_temp)) { + // Wrapping pour les graph energie $accessallowed = 1; $original_file = $conf->stock->dir_temp.'/'.$original_file; - } // Wrapping pour les graph fournisseurs - elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { + } elseif ($modulepart == 'graph_fourn' && !empty($conf->fournisseur->dir_temp)) { + // Wrapping pour les graph fournisseurs $accessallowed = 1; $original_file = $conf->fournisseur->dir_temp.'/'.$original_file; - } // Wrapping pour les graph des produits - elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { + } elseif ($modulepart == 'graph_product' && !empty($conf->product->dir_temp)) { + // Wrapping pour les graph des produits $accessallowed = 1; $original_file = $conf->product->multidir_temp[$entity].'/'.$original_file; - } // Wrapping pour les code barre - elseif ($modulepart == 'barcode') { + } elseif ($modulepart == 'barcode') { + // Wrapping pour les code barre $accessallowed = 1; // If viewimage is called for barcode, we try to output an image on the fly, with no build of file on disk. //$original_file=$conf->barcode->dir_temp.'/'.$original_file; $original_file = ''; - } // Wrapping pour les icones de background des mailings - elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { + } elseif ($modulepart == 'iconmailing' && !empty($conf->mailing->dir_temp)) { + // Wrapping pour les icones de background des mailings $accessallowed = 1; $original_file = $conf->mailing->dir_temp.'/'.$original_file; - } // Wrapping pour le scanner - elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + // Wrapping pour le scanner $accessallowed = 1; $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // Wrapping pour les images fckeditor - elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { + } elseif ($modulepart == 'fckeditor' && !empty($conf->fckeditor->dir_output)) { + // Wrapping pour les images fckeditor $accessallowed = 1; $original_file = $conf->fckeditor->dir_output.'/'.$original_file; - } // Wrapping for users - elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { + } elseif ($modulepart == 'user' && !empty($conf->user->dir_output)) { + // Wrapping for users $canreaduser = (!empty($fuser->admin) || $fuser->rights->user->user->{$lire}); if ($fuser->id == (int) $refname) { $canreaduser = 1; @@ -2468,8 +2478,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->user->dir_output.'/'.$original_file; - } // Wrapping for third parties - elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity])) { + } elseif (($modulepart == 'company' || $modulepart == 'societe' || $modulepart == 'thirdparty') && !empty($conf->societe->multidir_output[$entity])) { + // Wrapping for third parties if (empty($entity) || empty($conf->societe->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2478,8 +2488,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->societe->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe').")"; - } // Wrapping for contact - elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { + } elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { + // Wrapping for contact if (empty($entity) || empty($conf->societe->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2487,15 +2497,15 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->societe->multidir_output[$entity].'/contact/'.$original_file; - } // Wrapping for invoices - elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) { + } elseif (($modulepart == 'facture' || $modulepart == 'invoice') && !empty($conf->facture->multidir_output[$entity])) { + // Wrapping for invoices if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->facture->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('invoice').")"; - } // Wrapping for mass actions - elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) { + } elseif ($modulepart == 'massfilesarea_proposals' && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping for mass actions if ($fuser->rights->propal->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2545,36 +2555,36 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, $accessallowed = 1; } $original_file = $conf->contrat->dir_output.'/temp/massgeneration/'.$user->id.'/'.$original_file; - } // Wrapping for interventions - elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { + } elseif (($modulepart == 'fichinter' || $modulepart == 'ficheinter') && !empty($conf->ficheinter->dir_output)) { + // Wrapping for interventions if ($fuser->rights->ficheinter->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->ficheinter->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les deplacements et notes de frais - elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { + } elseif ($modulepart == 'deplacement' && !empty($conf->deplacement->dir_output)) { + // Wrapping pour les deplacements et notes de frais if ($fuser->rights->deplacement->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->deplacement->dir_output.'/'.$original_file; //$sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."fichinter WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les propales - elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { + } elseif (($modulepart == 'propal' || $modulepart == 'propale') && !empty($conf->propal->multidir_output[$entity])) { + // Wrapping pour les propales if ($fuser->rights->propale->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->propal->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."propal WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('propal').")"; - } // Wrapping pour les commandes - elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity])) { + } elseif (($modulepart == 'commande' || $modulepart == 'order') && !empty($conf->commande->multidir_output[$entity])) { + // Wrapping pour les commandes if ($fuser->rights->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->commande->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('order').")"; - } // Wrapping pour les projets - elseif ($modulepart == 'project' && !empty($conf->projet->dir_output)) { + } elseif ($modulepart == 'project' && !empty($conf->projet->dir_output)) { + // Wrapping pour les projets if ($fuser->rights->projet->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2586,29 +2596,29 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->projet->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."projet WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('project').")"; - } // Wrapping pour les commandes fournisseurs - elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { + } elseif (($modulepart == 'commande_fournisseur' || $modulepart == 'order_supplier') && !empty($conf->fournisseur->commande->dir_output)) { + // Wrapping pour les commandes fournisseurs if ($fuser->rights->fournisseur->commande->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->commande->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."commande_fournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les factures fournisseurs - elseif (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { + } elseif (($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') && !empty($conf->fournisseur->facture->dir_output)) { + // Wrapping pour les factures fournisseurs if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->facture->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."facture_fourn WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les rapport de paiements - elseif ($modulepart == 'supplier_payment') { + } elseif ($modulepart == 'supplier_payment') { + // Wrapping pour les rapport de paiements if ($fuser->rights->fournisseur->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->fournisseur->payment->dir_output.'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."paiementfournisseur WHERE ref='".$db->escape($refname)."' AND entity=".$conf->entity; - } // Wrapping pour les rapport de paiements - elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { + } elseif ($modulepart == 'facture_paiement' && !empty($conf->facture->dir_output)) { + // Wrapping pour les rapport de paiements if ($fuser->rights->facture->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } @@ -2617,38 +2627,38 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } else { $original_file = $conf->facture->dir_output.'/payments/'.$original_file; } - } // Wrapping for accounting exports - elseif ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { + } elseif ($modulepart == 'export_compta' && !empty($conf->accounting->dir_output)) { + // Wrapping for accounting exports if ($fuser->rights->accounting->bind->write || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->accounting->dir_output.'/'.$original_file; - } // Wrapping pour les expedition - elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { + } elseif (($modulepart == 'expedition' || $modulepart == 'shipment') && !empty($conf->expedition->dir_output)) { + // Wrapping pour les expedition if ($fuser->rights->expedition->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/sending/".$original_file; - } // Delivery Note Wrapping - elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { + } elseif (($modulepart == 'livraison' || $modulepart == 'delivery') && !empty($conf->expedition->dir_output)) { + // Delivery Note Wrapping if ($fuser->rights->expedition->delivery->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->expedition->dir_output."/receipt/".$original_file; - } // Wrapping pour les actions - elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + } elseif ($modulepart == 'actions' && !empty($conf->agenda->dir_output)) { + // Wrapping pour les actions if ($fuser->rights->agenda->myactions->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->agenda->dir_output.'/'.$original_file; - } // Wrapping pour les actions - elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { + } elseif ($modulepart == 'actionsreport' && !empty($conf->agenda->dir_temp)) { + // Wrapping pour les actions if ($fuser->rights->agenda->allactions->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->agenda->dir_temp."/".$original_file; - } // Wrapping pour les produits et services - elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') { + } elseif ($modulepart == 'product' || $modulepart == 'produit' || $modulepart == 'service' || $modulepart == 'produit|service') { + // Wrapping pour les produits et services if (empty($entity) || (empty($conf->product->multidir_output[$entity]) && empty($conf->service->multidir_output[$entity]))) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2660,8 +2670,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } elseif (!empty($conf->service->enabled)) { $original_file = $conf->service->multidir_output[$entity].'/'.$original_file; } - } // Wrapping pour les lots produits - elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot') { + } elseif ($modulepart == 'product_batch' || $modulepart == 'produitlot') { + // Wrapping pour les lots produits if (empty($entity) || (empty($conf->productbatch->multidir_output[$entity]))) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2671,8 +2681,8 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (!empty($conf->productbatch->enabled)) { $original_file = $conf->productbatch->multidir_output[$entity].'/'.$original_file; } - } // Wrapping for stock movements - elseif ($modulepart == 'movement' || $modulepart == 'mouvement') { + } elseif ($modulepart == 'movement' || $modulepart == 'mouvement') { + // Wrapping for stock movements if (empty($entity) || empty($conf->stock->multidir_output[$entity])) { return array('accessallowed'=>0, 'error'=>'Value entity must be provided'); } @@ -2682,89 +2692,89 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (!empty($conf->stock->enabled)) { $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } - } // Wrapping pour les contrats - elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { + } elseif ($modulepart == 'contract' && !empty($conf->contrat->multidir_output[$entity])) { + // Wrapping pour les contrats if ($fuser->rights->contrat->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->contrat->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT fk_soc as fk_soc FROM ".MAIN_DB_PREFIX."contrat WHERE ref='".$db->escape($refname)."' AND entity IN (".getEntity('contract').")"; - } // Wrapping pour les dons - elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) { + } elseif ($modulepart == 'donation' && !empty($conf->don->dir_output)) { + // Wrapping pour les dons if ($fuser->rights->don->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->don->dir_output.'/'.$original_file; - } // Wrapping pour les dons - elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output)) { + } elseif ($modulepart == 'dolresource' && !empty($conf->resource->dir_output)) { + // Wrapping pour les dons if ($fuser->rights->resource->{$read} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->resource->dir_output.'/'.$original_file; - } // Wrapping pour les remises de cheques - elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { + } elseif ($modulepart == 'remisecheque' && !empty($conf->bank->dir_output)) { + // Wrapping pour les remises de cheques if ($fuser->rights->banque->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->bank->dir_output.'/checkdeposits/'.$original_file; // original_file should contains relative path so include the get_exdir result - } // Wrapping for bank - elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { + } elseif (($modulepart == 'banque' || $modulepart == 'bank') && !empty($conf->bank->dir_output)) { + // Wrapping for bank if ($fuser->rights->banque->{$lire}) { $accessallowed = 1; } $original_file = $conf->bank->dir_output.'/'.$original_file; - } // Wrapping for export module - elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) { + } elseif ($modulepart == 'export' && !empty($conf->export->dir_temp)) { + // Wrapping for export module // Aucun test necessaire car on force le rep de download sur // le rep export qui est propre a l'utilisateur $accessallowed = 1; $original_file = $conf->export->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // Wrapping for import module - elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) { + } elseif ($modulepart == 'import' && !empty($conf->import->dir_temp)) { + // Wrapping for import module $accessallowed = 1; $original_file = $conf->import->dir_temp.'/'.$original_file; - } // Wrapping pour l'editeur wysiwyg - elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { + } elseif ($modulepart == 'editor' && !empty($conf->fckeditor->dir_output)) { + // Wrapping pour l'editeur wysiwyg $accessallowed = 1; $original_file = $conf->fckeditor->dir_output.'/'.$original_file; - } // Wrapping for backups - elseif ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { + } elseif ($modulepart == 'systemtools' && !empty($conf->admin->dir_output)) { + // Wrapping for backups if ($fuser->admin) { $accessallowed = 1; } $original_file = $conf->admin->dir_output.'/'.$original_file; - } // Wrapping for upload file test - elseif ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { + } elseif ($modulepart == 'admin_temp' && !empty($conf->admin->dir_temp)) { + // Wrapping for upload file test if ($fuser->admin) { $accessallowed = 1; } $original_file = $conf->admin->dir_temp.'/'.$original_file; - } // Wrapping pour BitTorrent - elseif ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { + } elseif ($modulepart == 'bittorrent' && !empty($conf->bittorrent->dir_output)) { + // Wrapping pour BitTorrent $accessallowed = 1; $dir = 'files'; if (dol_mimetype($original_file) == 'application/x-bittorrent') { $dir = 'torrents'; } $original_file = $conf->bittorrent->dir_output.'/'.$dir.'/'.$original_file; - } // Wrapping pour Foundation module - elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { + } elseif ($modulepart == 'member' && !empty($conf->adherent->dir_output)) { + // Wrapping pour Foundation module if ($fuser->rights->adherent->{$lire} || preg_match('/^specimen/i', $original_file)) { $accessallowed = 1; } $original_file = $conf->adherent->dir_output.'/'.$original_file; - } // Wrapping for Scanner - elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + } elseif ($modulepart == 'scanner_user_temp' && !empty($conf->scanner->dir_temp)) { + // Wrapping for Scanner $accessallowed = 1; $original_file = $conf->scanner->dir_temp.'/'.$fuser->id.'/'.$original_file; - } // GENERIC Wrapping - // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser - // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp - // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser - // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart - // If modulepart=module-abc Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart - else { + // If modulepart=module_user_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp/iduser + // If modulepart=module_temp Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/temp + // If modulepart=module_user Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart/iduser + // If modulepart=module Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart + // If modulepart=module-abc Allows any module to open a file if file is in directory called DOL_DATA_ROOT/modulepart + } else { + // GENERIC Wrapping //var_dump($modulepart); //var_dump($original_file); if (preg_match('/^specimen/i', $original_file)) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index e296fa5874e..bace4411184 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -200,31 +200,39 @@ function getBrowserInfo($user_agent) // Name $reg = array(); if (preg_match('/firefox(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'firefox'; $version = $reg[2]; + $name = 'firefox'; + $version = $reg[2]; } elseif (preg_match('/edge(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'edge'; $version = $reg[2]; + $name = 'edge'; + $version = $reg[2]; } elseif (preg_match('/chrome(\/|\s)([\d\.]+)/i', $user_agent, $reg)) { - $name = 'chrome'; $version = $reg[2]; - } // we can have 'chrome (Mozilla...) chrome x.y' in one string - elseif (preg_match('/chrome/i', $user_agent, $reg)) { + $name = 'chrome'; + $version = $reg[2]; + } elseif (preg_match('/chrome/i', $user_agent, $reg)) { + // we can have 'chrome (Mozilla...) chrome x.y' in one string $name = 'chrome'; } elseif (preg_match('/iceweasel/i', $user_agent)) { $name = 'iceweasel'; } elseif (preg_match('/epiphany/i', $user_agent)) { $name = 'epiphany'; } elseif (preg_match('/safari(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'safari'; $version = $reg[2]; - } // Safari is often present in string for mobile but its not. - elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { - $name = 'opera'; $version = $reg[2]; + $name = 'safari'; + $version = $reg[2]; + } elseif (preg_match('/opera(\/|\s)([\d\.]*)/i', $user_agent, $reg)) { + // Safari is often present in string for mobile but its not. + $name = 'opera'; + $version = $reg[2]; } elseif (preg_match('/(MSIE\s([0-9]+\.[0-9]))|.*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { - $name = 'ie'; $version = end($reg); - } // MS products at end - elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { - $name = 'ie'; $version = end($reg); - } // MS products at end - elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { - $name = 'lynxlinks'; $version = $reg[4]; + $name = 'ie'; + $version = end($reg); + } elseif (preg_match('/(Windows NT\s([0-9]+\.[0-9])).*(Trident\/[0-9]+.[0-9];.*rv:([0-9]+\.[0-9]+))/i', $user_agent, $reg)) { + // MS products at end + $name = 'ie'; + $version = end($reg); + } elseif (preg_match('/l(i|y)n(x|ks)(\(|\/|\s)*([\d\.]+)/i', $user_agent, $reg)) { + // MS products at end + $name = 'lynxlinks'; + $version = $reg[4]; } if ($tablet) { @@ -253,9 +261,11 @@ function getBrowserInfo($user_agent) function dol_shutdown() { global $conf, $user, $langs, $db; - $disconnectdone = false; $depth = 0; + $disconnectdone = false; + $depth = 0; if (is_object($db) && !empty($db->connected)) { - $depth = $db->transaction_opened; $disconnectdone = $db->close(); + $depth = $db->transaction_opened; + $disconnectdone = $db->close(); } dol_syslog("--- End access to ".$_SERVER["PHP_SELF"].(($disconnectdone && $depth) ? ' (Warn: db disconnection forced, transaction depth was '.$depth.')' : ''), (($disconnectdone && $depth) ?LOG_WARNING:LOG_INFO)); } @@ -311,7 +321,7 @@ function GETPOSTISSET($paramname) /** * Return value of a param into GET or POST supervariable. - * Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] + * Use the property $user->default_values[path]['createform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] * Note: The property $user->default_values is loaded by main.php when loading the user. * * @param string $paramname Name of parameter to found @@ -393,8 +403,9 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } elseif ($paramname == 'limit' && !empty($_SESSION['lastsearch_limit_'.$relativepathstring])) { $out = $_SESSION['lastsearch_limit_'.$relativepathstring]; } - } // Else, retrieve default values if we are not doing a sort - elseif (!isset($_GET['sortfield'])) { // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set + } elseif (!isset($_GET['sortfield'])) { + // Else, retrieve default values if we are not doing a sort + // If we did a click on a field to sort, we do no apply default values. Same if option MAIN_ENABLE_DEFAULT_VALUES is not set if (!empty($_GET['action']) && $_GET['action'] == 'create' && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { // Search default value from $object->field global $object; @@ -435,12 +446,15 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null } } } - } // Management of default search_filters and sort order - elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { - if (!empty($user->default_values)) { // $user->default_values defined from menu 'Setup - Default values' + } elseif (!empty($paramname) && !isset($_GET[$paramname]) && !isset($_POST[$paramname])) { + // Management of default search_filters and sort order + if (!empty($user->default_values)) { + // $user->default_values defined from menu 'Setup - Default values' //var_dump($user->default_values[$relativepathstring]); - if ($paramname == 'sortfield' || $paramname == 'sortorder') { // Sorted on which fields ? ASC or DESC ? - if (isset($user->default_values[$relativepathstring]['sortorder'])) { // Even if paramname is sortfield, data are stored into ['sortorder...'] + if ($paramname == 'sortfield' || $paramname == 'sortorder') { + // Sorted on which fields ? ASC or DESC ? + if (isset($user->default_values[$relativepathstring]['sortorder'])) { + // Even if paramname is sortfield, data are stored into ['sortorder...'] foreach ($user->default_values[$relativepathstring]['sortorder'] as $defkey => $defval) { $qualified = 0; if ($defkey != '_noquery_') { @@ -524,9 +538,11 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null // We do this only if var is a GET. If it is a POST, may be we want to post the text with vars as the setup text. if (!is_array($out) && empty($_POST[$paramname]) && empty($noreplace)) { $reg = array(); - $maxloop = 20; $loopnb = 0; // Protection against infinite loop + $maxloop = 20; + $loopnb = 0; // Protection against infinite loop while (preg_match('/__([A-Z0-9]+_?[A-Z0-9]+)__/i', $out, $reg) && ($loopnb < $maxloop)) { // Detect '__ABCDEF__' as key 'ABCDEF' and '__ABC_DEF__' as key 'ABC_DEF'. Detection is also correct when 2 vars are side by side. - $loopnb++; $newout = ''; + $loopnb++; + $newout = ''; if ($reg[1] == 'DAY') { $tmp = dol_getdate(dol_now(), true); @@ -837,13 +853,14 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } } } - if ($returnemptyifnotfound) { // Not found into alternate dir + if ($returnemptyifnotfound) { + // Not found into alternate dir if ($returnemptyifnotfound == 1 || !file_exists($res)) { return ''; } } - } else // For an url path - { + } else { + // For an url path // We try to get local path of file on filesystem from url // Note that trying to know if a file on disk exist by forging path on disk from url // works only for some web server and some setup. This is bugged when @@ -1095,16 +1112,19 @@ function dol_escape_js($stringtoescape, $mode = 0, $noescapebackslashn = 0) $substitjs = array("'"=>"\\'", "\r"=>'\\r'); //$substitjs[' '.$data['ip']; } - } // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) - elseif (!empty($_SERVER['SERVER_ADDR'])) { + } elseif (!empty($_SERVER['SERVER_ADDR'])) { + // This is when PHP session is ran inside a web server but not inside a client request (example: init code of apache) $data['ip'] = $_SERVER['SERVER_ADDR']; - } - // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). - elseif (!empty($_SERVER['COMPUTERNAME'])) { + } elseif (!empty($_SERVER['COMPUTERNAME'])) { + // This is when PHP session is ran outside a web server, like from Windows command line (Not always defined, but useful if OS defined it). $data['ip'] = $_SERVER['COMPUTERNAME'].(empty($_SERVER['USERNAME']) ? '' : '@'.$_SERVER['USERNAME']); - } - // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). - elseif (!empty($_SERVER['LOGNAME'])) { + } elseif (!empty($_SERVER['LOGNAME'])) { + // This is when PHP session is ran outside a web server, like from Linux command line (Not always defined, but usefull if OS defined it). $data['ip'] = '???@'.$_SERVER['LOGNAME']; } // Loop on each log handler and send output @@ -1694,7 +1712,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } if ($object->element == 'product') { - $width = 80; $cssclass = 'photoref'; + $width = 80; + $cssclass = 'photoref'; $showimage = $object->is_photo_available($conf->product->multidir_output[$entity]); $maxvisiblephotos = (isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO) ? $conf->global->PRODUCT_MAX_VISIBLE_PHOTO : 5); if ($conf->browser->layout == 'phone') { @@ -1712,7 +1731,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi } } } elseif ($object->element == 'ticket') { - $width = 80; $cssclass = 'photoref'; + $width = 80; + $cssclass = 'photoref'; $showimage = $object->is_photo_available($conf->ticket->multidir_output[$entity].'/'.$object->ref); $maxvisiblephotos = (isset($conf->global->TICKET_MAX_VISIBLE_PHOTO) ? $conf->global->TICKET_MAX_VISIBLE_PHOTO : 2); if ($conf->browser->layout == 'phone') { @@ -1812,7 +1832,8 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi $cssclass = 'photorefcenter'; $nophoto = img_picto('No photo', 'title_agenda'); } else { - $width = 14; $cssclass = 'photorefcenter'; + $width = 14; + $cssclass = 'photorefcenter'; $picto = $object->picto; if ($object->element == 'project' && !$object->public) { $picto = 'project'; // instead of projectpub @@ -2000,7 +2021,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs $ret .= ($extralangcode ? $object->array_languages['address'][$extralangcode] : $object->address); } // Zip/Town/State - if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { // US: title firstname name \n address lines \n town, state, zip \n country + if (isset($object->country_code) && in_array($object->country_code, array('AU', 'CA', 'US')) || !empty($conf->global->MAIN_FORCE_STATE_INTO_ADDRESS)) { + // US: title firstname name \n address lines \n town, state, zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($ret ? $sep : '').$town; if (!empty($object->state)) { @@ -2009,7 +2031,8 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if ($object->zip) { $ret .= ($ret ? ", " : '').$object->zip; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { // UK: title firstname name \n address lines \n town state \n zip \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('GB', 'UK'))) { + // UK: title firstname name \n address lines \n town state \n zip \n country $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($ret ? $sep : '').$town; if (!empty($object->state)) { @@ -2018,14 +2041,16 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs if ($object->zip) { $ret .= ($ret ? $sep : '').$object->zip; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { // ES: title firstname name \n address lines \n zip town \n state \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('ES', 'TR'))) { + // ES: title firstname name \n address lines \n zip town \n state \n country $ret .= ($ret ? $sep : '').$object->zip; $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); if (!empty($object->state)) { $ret .= "\n".$object->state; } - } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { // IT: tile firstname name\n address lines \n zip (Code Departement) \n country + } elseif (isset($object->country_code) && in_array($object->country_code, array('IT'))) { + // IT: tile firstname name\n address lines \n zip (Code Departement) \n country $ret .= ($ret ? $sep : '').$object->zip; $town = ($extralangcode ? $object->array_languages['town'][$extralangcode] : $object->town); $ret .= ($town ? (($object->zip ? ' ' : '').$town) : ''); @@ -2129,7 +2154,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = preg_replace('/inputnoreduce/', '', $format); // so format 'dayinputnoreduce' is processed like day $formatwithoutreduce = preg_replace('/reduceformat/', '', $format); if ($formatwithoutreduce != $format) { - $format = $formatwithoutreduce; $reduceformat = 1; + $format = $formatwithoutreduce; + $reduceformat = 1; } // so format 'dayreduceformat' is processed like day // Change predefined format into computer format. If found translation in lang file we use it, otherwise we use default. @@ -2152,9 +2178,8 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs = $format = ($outputlangs->trans("FormatDateHourText") != "FormatDateHourText" ? $outputlangs->trans("FormatDateHourText") : $conf->format_date_hour_text); } elseif ($format == 'dayhourtextshort') { $format = ($outputlangs->trans("FormatDateHourTextShort") != "FormatDateHourTextShort" ? $outputlangs->trans("FormatDateHourTextShort") : $conf->format_date_hour_text_short); - } - // Format not sensitive to language - elseif ($format == 'dayhourlog') { + } elseif ($format == 'dayhourlog') { + // Format not sensitive to language $format = '%Y%m%d%H%M%S'; } elseif ($format == 'dayhourldap') { $format = '%Y%m%d%H%M%SZ'; @@ -2440,13 +2465,13 @@ function dol_now($mode = 'auto') require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; $tzsecond = getServerTimeZoneInt('now'); // Contains tz+dayling saving time $ret = (int) (dol_now('gmt') + ($tzsecond * 3600)); - } /*elseif ($mode == 'tzref') // Time for now with parent company timezone is added - { - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time - $ret=dol_now('gmt')+($tzsecond*3600); - }*/ - elseif ($mode == 'tzuser' || $mode == 'tzuserrel') { // Time for now with user timezone added + //} elseif ($mode == 'tzref') {// Time for now with parent company timezone is added + // require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + // $tzsecond=getParentCompanyTimeZoneInt(); // Contains tz+dayling saving time + // $ret=dol_now('gmt')+($tzsecond*3600); + //} + } elseif ($mode == 'tzuser' || $mode == 'tzuserrel') { + // Time for now with user timezone added //print 'time: '.time(); $offsettz = (empty($_SESSION['dol_tz']) ? 0 : $_SESSION['dol_tz']) * 60 * 60; $offsetdst = (empty($_SESSION['dol_dst']) ? 0 : $_SESSION['dol_dst']) * 60 * 60; @@ -2570,7 +2595,8 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64, } if (($cid || $socid) && !empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - $type = 'AC_EMAIL'; $link = ''; + $type = 'AC_EMAIL'; + $link = ''; if (!empty($conf->global->AGENDA_ADDACTIONFOREMAIL)) { $link = ''.img_object($langs->trans("AddAction"), "calendar").''; } @@ -2938,7 +2964,8 @@ function dol_print_phone($phone, $countrycode = '', $cid = 0, $socid = 0, $addli //if (($cid || $socid) && ! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) if (!empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - $type = 'AC_TEL'; $link = ''; + $type = 'AC_TEL'; + $link = ''; if ($addlink == 'AC_FAX') { $type = 'AC_FAX'; } @@ -3453,7 +3480,8 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ $pictowithouttext = str_replace('object_', '', $pictowithouttext); $fakey = $pictowithouttext; - $facolor = ''; $fasize = ''; + $facolor = ''; + $fasize = ''; $fa = 'fas'; if (in_array($pictowithouttext, array('clock', 'generic', 'minus-square', 'object_generic', 'pdf', 'plus-square', 'timespent', 'note', 'off', 'on', 'object_bookmark', 'bookmark', 'vcard'))) { $fa = 'far'; @@ -5011,7 +5039,8 @@ function price($amount, $form = 0, $outlangs = '', $trunc = 1, $rounding = -1, $ $nbdecimal = $rounding; // Output separators by default (french) - $dec = ','; $thousand = ' '; + $dec = ','; + $thousand = ' '; // If $outlangs not forced, we use use language if (!is_object($outlangs)) { @@ -5113,7 +5142,8 @@ function price2num($amount, $rounding = '', $option = 0) // Round PHP function does not allow number like '1,234.56' nor '1.234,56' nor '1 234,56' // Numbers must be '1234.56' // Decimal delimiter for PHP and database SQL requests must be '.' - $dec = ','; $thousand = ' '; + $dec = ','; + $thousand = ' '; if ($langs->transnoentitiesnoconv("SeparatorDecimal") != "SeparatorDecimal") { $dec = $langs->transnoentitiesnoconv("SeparatorDecimal"); } @@ -5904,7 +5934,8 @@ function get_default_localtax($thirdparty_seller, $thirdparty_buyer, $local, $id function yn($yesno, $case = 1, $color = 0) { global $langs; - $result = 'unknown'; $classname = ''; + $result = 'unknown'; + $classname = ''; if ($yesno == 1 || strtolower($yesno) == 'yes' || strtolower($yesno) == 'true') { // A mettre avant test sur no a cause du == 0 $result = $langs->trans('yes'); if ($case == 1 || $case == 3) { @@ -6254,8 +6285,8 @@ function dolGetFirstLineOfText($text, $nboflines = 1, $charset = 'UTF-8') $text = strtr($text, $repTable); if ($charset == 'UTF-8') { $pattern = '/(]*>)/Uu'; - } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support - else { + } else { + // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. } $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); @@ -6421,9 +6452,11 @@ function dol_string_is_good_iso($s, $clean = 0) $ordchar = ord($s[$scursor]); //print $scursor.'-'.$ordchar.'
    '; if ($ordchar < 32 && $ordchar != 13 && $ordchar != 10) { - $ok = 0; break; + $ok = 0; + break; } elseif ($ordchar > 126 && $ordchar < 160) { - $ok = 0; break; + $ok = 0; + break; } elseif ($clean) { $out .= $s[$scursor]; } @@ -6473,8 +6506,8 @@ function dol_nboflines_bis($text, $maxlinesize = 0, $charset = 'UTF-8') $text = strtr($text, $repTable); if ($charset == 'UTF-8') { $pattern = '/(]*>)/Uu'; - } // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support - else { + } else { + // /U is to have UNGREEDY regex to limit to one html tag. /u is for UTF8 support $pattern = '/(]*>)/U'; // /U is to have UNGREEDY regex to limit to one html tag. } $a = preg_split($pattern, $text, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); @@ -7413,7 +7446,8 @@ function get_htmloutput_mesg($mesgstring = '', $mesgarray = '', $style = 'ok', $ { global $conf, $langs; - $ret = 0; $return = ''; + $ret = 0; + $return = ''; $out = ''; $divstart = $divend = ''; @@ -7507,10 +7541,12 @@ function dol_htmloutput_mesg($mesgstring = '', $mesgarray = array(), $style = 'o if (is_array($mesgarray)) { foreach ($mesgarray as $val) { if ($val && preg_match('/class="error"/i', $val)) { - $iserror++; break; + $iserror++; + break; } if ($val && preg_match('/class="warning"/i', $val)) { - $iswarning++; break; + $iswarning++; + break; } } } elseif ($mesgstring && preg_match('/class="error"/i', $mesgstring)) { @@ -8515,7 +8551,8 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $j = 0; foreach ($crits as $crit) { $crit = trim($crit); - $i = 0; $i2 = 0; + $i = 0; + $i2 = 0; $newres = ''; foreach ($fields as $field) { if ($mode == 1) { @@ -8595,7 +8632,8 @@ function natural_search($fields, $value, $mode = 0, $nofirstand = 0) $tmpcrit = trim($tmpcrit); $tmpcrit2 = $tmpcrit; - $tmpbefore = '%'; $tmpafter = '%'; + $tmpbefore = '%'; + $tmpafter = '%'; if (preg_match('/^[\^\$]/', $tmpcrit)) { $tmpbefore = ''; $tmpcrit2 = preg_replace('/^[\^\$]/', '', $tmpcrit2); @@ -8810,209 +8848,357 @@ function dol_mimetype($file, $default = 'application/octet-stream', $mode = 0) // Plain text files if (preg_match('/\.txt$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.rtx$/i', $tmpfile)) { - $mime = 'text/richtext'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/richtext'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.csv$/i', $tmpfile)) { - $mime = 'text/csv'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/csv'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.tsv$/i', $tmpfile)) { - $mime = 'text/tab-separated-values'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/tab-separated-values'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.(cf|conf|log)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } if (preg_match('/\.ini$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'ini'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'ini'; + $famime = 'file-text-o'; } if (preg_match('/\.md$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'md'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'md'; + $famime = 'file-text-o'; } if (preg_match('/\.css$/i', $tmpfile)) { - $mime = 'text/css'; $imgmime = 'css.png'; $srclang = 'css'; $famime = 'file-text-o'; + $mime = 'text/css'; + $imgmime = 'css.png'; + $srclang = 'css'; + $famime = 'file-text-o'; } if (preg_match('/\.lang$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'lang'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'lang'; + $famime = 'file-text-o'; } // Certificate files if (preg_match('/\.(crt|cer|key|pub)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $famime = 'file-text-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $famime = 'file-text-o'; } // XML based (HTML/XML/XAML) if (preg_match('/\.(html|htm|shtml)$/i', $tmpfile)) { - $mime = 'text/html'; $imgmime = 'html.png'; $srclang = 'html'; $famime = 'file-text-o'; + $mime = 'text/html'; + $imgmime = 'html.png'; + $srclang = 'html'; + $famime = 'file-text-o'; } if (preg_match('/\.(xml|xhtml)$/i', $tmpfile)) { - $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xml'; $famime = 'file-text-o'; + $mime = 'text/xml'; + $imgmime = 'other.png'; + $srclang = 'xml'; + $famime = 'file-text-o'; } if (preg_match('/\.xaml$/i', $tmpfile)) { - $mime = 'text/xml'; $imgmime = 'other.png'; $srclang = 'xaml'; $famime = 'file-text-o'; + $mime = 'text/xml'; + $imgmime = 'other.png'; + $srclang = 'xaml'; + $famime = 'file-text-o'; } // Languages if (preg_match('/\.bas$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'bas'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'bas'; + $famime = 'file-code-o'; } if (preg_match('/\.(c)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'c'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'c'; + $famime = 'file-code-o'; } if (preg_match('/\.(cpp)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cpp'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'cpp'; + $famime = 'file-code-o'; } if (preg_match('/\.cs$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'cs'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'cs'; + $famime = 'file-code-o'; } if (preg_match('/\.(h)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'h'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'h'; + $famime = 'file-code-o'; } if (preg_match('/\.(java|jsp)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'java'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'java'; + $famime = 'file-code-o'; } if (preg_match('/\.php([0-9]{1})?$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'php.png'; + $srclang = 'php'; + $famime = 'file-code-o'; } if (preg_match('/\.phtml$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'php.png'; $srclang = 'php'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'php.png'; + $srclang = 'php'; + $famime = 'file-code-o'; } if (preg_match('/\.(pl|pm)$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'pl.png'; $srclang = 'perl'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'pl.png'; + $srclang = 'perl'; + $famime = 'file-code-o'; } if (preg_match('/\.sql$/i', $tmpfile)) { - $mime = 'text/plain'; $imgmime = 'text.png'; $srclang = 'sql'; $famime = 'file-code-o'; + $mime = 'text/plain'; + $imgmime = 'text.png'; + $srclang = 'sql'; + $famime = 'file-code-o'; } if (preg_match('/\.js$/i', $tmpfile)) { - $mime = 'text/x-javascript'; $imgmime = 'jscript.png'; $srclang = 'js'; $famime = 'file-code-o'; + $mime = 'text/x-javascript'; + $imgmime = 'jscript.png'; + $srclang = 'js'; + $famime = 'file-code-o'; } // Open office if (preg_match('/\.odp$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.presentation'; $imgmime = 'ooffice.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/vnd.oasis.opendocument.presentation'; + $imgmime = 'ooffice.png'; + $famime = 'file-powerpoint-o'; } if (preg_match('/\.ods$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.spreadsheet'; $imgmime = 'ooffice.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.oasis.opendocument.spreadsheet'; + $imgmime = 'ooffice.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.odt$/i', $tmpfile)) { - $mime = 'application/vnd.oasis.opendocument.text'; $imgmime = 'ooffice.png'; $famime = 'file-word-o'; + $mime = 'application/vnd.oasis.opendocument.text'; + $imgmime = 'ooffice.png'; + $famime = 'file-word-o'; } // MS Office if (preg_match('/\.mdb$/i', $tmpfile)) { - $mime = 'application/msaccess'; $imgmime = 'mdb.png'; $famime = 'file-o'; + $mime = 'application/msaccess'; + $imgmime = 'mdb.png'; + $famime = 'file-o'; } if (preg_match('/\.doc(x|m)?$/i', $tmpfile)) { - $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; + $mime = 'application/msword'; + $imgmime = 'doc.png'; + $famime = 'file-word-o'; } if (preg_match('/\.dot(x|m)?$/i', $tmpfile)) { - $mime = 'application/msword'; $imgmime = 'doc.png'; $famime = 'file-word-o'; + $mime = 'application/msword'; + $imgmime = 'doc.png'; + $famime = 'file-word-o'; } if (preg_match('/\.xlt(x)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xla(m)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xls$/i', $tmpfile)) { - $mime = 'application/vnd.ms-excel'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.ms-excel'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.xls(b|m|x)$/i', $tmpfile)) { - $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; $imgmime = 'xls.png'; $famime = 'file-excel-o'; + $mime = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'; + $imgmime = 'xls.png'; + $famime = 'file-excel-o'; } if (preg_match('/\.pps(m|x)?$/i', $tmpfile)) { - $mime = 'application/vnd.ms-powerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/vnd.ms-powerpoint'; + $imgmime = 'ppt.png'; + $famime = 'file-powerpoint-o'; } if (preg_match('/\.ppt(m|x)?$/i', $tmpfile)) { - $mime = 'application/x-mspowerpoint'; $imgmime = 'ppt.png'; $famime = 'file-powerpoint-o'; + $mime = 'application/x-mspowerpoint'; + $imgmime = 'ppt.png'; + $famime = 'file-powerpoint-o'; } // Other if (preg_match('/\.pdf$/i', $tmpfile)) { - $mime = 'application/pdf'; $imgmime = 'pdf.png'; $famime = 'file-pdf-o'; + $mime = 'application/pdf'; + $imgmime = 'pdf.png'; + $famime = 'file-pdf-o'; } // Scripts if (preg_match('/\.bat$/i', $tmpfile)) { - $mime = 'text/x-bat'; $imgmime = 'script.png'; $srclang = 'dos'; $famime = 'file-code-o'; + $mime = 'text/x-bat'; + $imgmime = 'script.png'; + $srclang = 'dos'; + $famime = 'file-code-o'; } if (preg_match('/\.sh$/i', $tmpfile)) { - $mime = 'text/x-sh'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-sh'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } if (preg_match('/\.ksh$/i', $tmpfile)) { - $mime = 'text/x-ksh'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-ksh'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } if (preg_match('/\.bash$/i', $tmpfile)) { - $mime = 'text/x-bash'; $imgmime = 'script.png'; $srclang = 'bash'; $famime = 'file-code-o'; + $mime = 'text/x-bash'; + $imgmime = 'script.png'; + $srclang = 'bash'; + $famime = 'file-code-o'; } // Images if (preg_match('/\.ico$/i', $tmpfile)) { - $mime = 'image/x-icon'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/x-icon'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.(jpg|jpeg)$/i', $tmpfile)) { - $mime = 'image/jpeg'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/jpeg'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.png$/i', $tmpfile)) { - $mime = 'image/png'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/png'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.gif$/i', $tmpfile)) { - $mime = 'image/gif'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/gif'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.bmp$/i', $tmpfile)) { - $mime = 'image/bmp'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/bmp'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.(tif|tiff)$/i', $tmpfile)) { - $mime = 'image/tiff'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/tiff'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.svg$/i', $tmpfile)) { - $mime = 'image/svg+xml'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/svg+xml'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } if (preg_match('/\.webp$/i', $tmpfile)) { - $mime = 'image/webp'; $imgmime = 'image.png'; $famime = 'file-image-o'; + $mime = 'image/webp'; + $imgmime = 'image.png'; + $famime = 'file-image-o'; } // Calendar if (preg_match('/\.vcs$/i', $tmpfile)) { - $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; + $mime = 'text/calendar'; + $imgmime = 'other.png'; + $famime = 'file-text-o'; } if (preg_match('/\.ics$/i', $tmpfile)) { - $mime = 'text/calendar'; $imgmime = 'other.png'; $famime = 'file-text-o'; + $mime = 'text/calendar'; + $imgmime = 'other.png'; + $famime = 'file-text-o'; } // Other if (preg_match('/\.torrent$/i', $tmpfile)) { - $mime = 'application/x-bittorrent'; $imgmime = 'other.png'; $famime = 'file-o'; + $mime = 'application/x-bittorrent'; + $imgmime = 'other.png'; + $famime = 'file-o'; } // Audio if (preg_match('/\.(mp3|ogg|au|wav|wma|mid)$/i', $tmpfile)) { - $mime = 'audio'; $imgmime = 'audio.png'; $famime = 'file-audio-o'; + $mime = 'audio'; + $imgmime = 'audio.png'; + $famime = 'file-audio-o'; } // Video if (preg_match('/\.ogv$/i', $tmpfile)) { - $mime = 'video/ogg'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/ogg'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.webm$/i', $tmpfile)) { - $mime = 'video/webm'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/webm'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.avi$/i', $tmpfile)) { - $mime = 'video/x-msvideo'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/x-msvideo'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.divx$/i', $tmpfile)) { - $mime = 'video/divx'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/divx'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.xvid$/i', $tmpfile)) { - $mime = 'video/xvid'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video/xvid'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } if (preg_match('/\.(wmv|mpg|mpeg)$/i', $tmpfile)) { - $mime = 'video'; $imgmime = 'video.png'; $famime = 'file-video-o'; + $mime = 'video'; + $imgmime = 'video.png'; + $famime = 'file-video-o'; } // Archive if (preg_match('/\.(zip|rar|gz|tgz|z|cab|bz2|7z|tar|lzh)$/i', $tmpfile)) { - $mime = 'archive'; $imgmime = 'archive.png'; $famime = 'file-archive-o'; + $mime = 'archive'; + $imgmime = 'archive.png'; + $famime = 'file-archive-o'; } // application/xxx where zzz is zip, ... // Exe if (preg_match('/\.(exe|com)$/i', $tmpfile)) { - $mime = 'application/octet-stream'; $imgmime = 'other.png'; $famime = 'file-o'; + $mime = 'application/octet-stream'; + $imgmime = 'other.png'; + $famime = 'file-o'; } // Lib if (preg_match('/\.(dll|lib|o|so|a)$/i', $tmpfile)) { - $mime = 'library'; $imgmime = 'library.png'; $famime = 'file-o'; + $mime = 'library'; + $imgmime = 'library.png'; + $famime = 'file-o'; } // Err if (preg_match('/\.err$/i', $tmpfile)) { - $mime = 'error'; $imgmime = 'error.png'; $famime = 'file-text-o'; + $mime = 'error'; + $imgmime = 'error.png'; + $famime = 'file-text-o'; } // Return string @@ -9129,7 +9315,8 @@ function isVisibleToUserType($type_user, &$menuentry, &$listofmodulesforexternal $found = 0; foreach ($tmploops as $tmploop) { if (in_array($tmploop, $listofmodulesforexternal)) { - $found++; break; + $found++; + break; } } if (!$found) { @@ -9251,8 +9438,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st $return = !empty($html) ? $html : (empty($conf->dol_optimize_smallscreen) ? $statusLabel : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort)); } elseif ($displayMode == 1) { $return = !empty($html) ? $html : (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); - } // Use status with images (for backward compatibility) - elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) { + } elseif (!empty($conf->global->MAIN_STATUS_USES_IMAGES)) { + // Use status with images (for backward compatibility) $return = ''; $htmlLabel = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : $statusLabel).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); $htmlLabelShort = (in_array($displayMode, array(1, 2, 5)) ? '' : '').(!empty($html) ? $html : (!empty($statusLabelShort) ? $statusLabelShort : $statusLabel)).(in_array($displayMode, array(1, 2, 5)) ? '' : ''); @@ -9299,8 +9486,8 @@ function dolGetStatus($statusLabel = '', $statusLabelShort = '', $html = '', $st } else { // $displayMode >= 6 $return = $htmlLabel.' '.$htmlImg; } - } // Use new badge - elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { + } elseif (empty($conf->global->MAIN_STATUS_USES_IMAGES) && !empty($displayMode)) { + // Use new badge $statusLabelShort = (empty($statusLabelShort) ? $statusLabel : $statusLabelShort); $dolGetBadgeParams['attr']['class'] = 'badge-status'; @@ -9857,17 +10044,15 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1) // Solution 0 if ($method == 0) { readfile($fullpath_original_file_osencoded); - } - // Solution 1 - elseif ($method == 1) { + } elseif ($method == 1) { + // Solution 1 $handle = fopen($fullpath_original_file_osencoded, "rb"); while (!feof($handle)) { print fread($handle, 8192); } fclose($handle); - } - // Solution 2 - elseif ($method == 2) { + } elseif ($method == 2) { + // Solution 2 $handle1 = fopen($fullpath_original_file_osencoded, "rb"); $handle2 = fopen("php://output", "wb"); stream_copy_to_stream($handle1, $handle2); diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 2e81af654cf..9fd7f5e7e8a 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -1090,9 +1090,11 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ // Define posy, posm and reg if ($maskraz > 1) { // if reset is not first month, we need month and year into mask if (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 3; + $posy = 2; + $posm = 3; } elseif (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 3; $posm = 2; + $posy = 3; + $posm = 2; } else { return 'ErrorCantUseRazInStartedYearIfNoYearMonthInMask'; } @@ -1103,11 +1105,14 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $ } else // if reset is for a specific month in year, we need year { if (preg_match('/^(.*)\{(m+)\}\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 3; $posm = 2; + $posy = 3; + $posm = 2; } elseif (preg_match('/^(.*)\{(y+)\}\{(m+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 3; + $posy = 2; + $posm = 3; } elseif (preg_match('/^(.*)\{(y+)\}/i', $maskwithonlyymcode, $reg)) { - $posy = 2; $posm = 0; + $posy = 2; + $posm = 0; } else { return 'ErrorCantUseRazIfNoYearInMask'; } @@ -1892,7 +1897,8 @@ function getListOfModels($db, $type, $maxfilenamelength = 0) $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (is_dir($tmpdir)) { // all type of template is allowed @@ -2128,7 +2134,8 @@ function dolGetElementUrl($objectid, $objecttype, $withpicto = 0, $option = '') } // Generic case for $classfile and $classname - $classfile = strtolower($myobject); $classname = ucfirst($myobject); + $classfile = strtolower($myobject); + $classname = ucfirst($myobject); //print "objecttype=".$objecttype." module=".$module." subelement=".$subelement." classfile=".$classfile." classname=".$classname." classpath=".$classpath; if ($objecttype == 'invoice_supplier') { @@ -2227,7 +2234,8 @@ function cleanCorruptedTree($db, $tabletocleantree, $fieldfkparent) // Check depth //print 'Analyse record id='.$id.' with parent '.$pid.'
    '; - $cursor = $id; $arrayidparsed = array(); // We start from child $id + $cursor = $id; + $arrayidparsed = array(); // We start from child $id while ($cursor > 0) { $arrayidparsed[$cursor] = 1; if ($arrayidparsed[$listofparentid[$cursor]]) { // We detect a loop. A record with a parent that was already into child @@ -2627,7 +2635,8 @@ if (!function_exists('dolEscapeXML')) { function autoOrManual($automaticmanual, $case = 1, $color = 0) { global $langs; - $result = 'unknown'; $classname = ''; + $result = 'unknown'; + $classname = ''; if ($automaticmanual == 1 || strtolower($automaticmanual) == 'automatic' || strtolower($automaticmanual) == 'true') { // A mettre avant test sur no a cause du == 0 $result = $langs->trans('automatic'); if ($case == 1 || $case == 3) { diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index ed7d5b1efcc..7041eabfc5e 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -23,8 +23,10 @@ */ // Define size of logo small and mini -$maxwidthsmall = 480; $maxheightsmall = 270; // Near 16/9eme -$maxwidthmini = 128; $maxheightmini = 72; // 16/9eme +$maxwidthsmall = 480; +$maxheightsmall = 270; // Near 16/9eme +$maxwidthmini = 128; +$maxheightmini = 72; // 16/9eme $quality = 80; diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index 0c6029ebb00..85a16ac47cf 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -22,8 +22,6 @@ */ - - /** * Regenerate files .class.php * @@ -54,7 +52,7 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir = } // Check parameters - if (count($addfieldentry) > 0) { + if (is_array($addfieldentry) && count($addfieldentry) > 0) { if (empty($addfieldentry['name'])) { setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Name")), null, 'errors'); return -2; diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index 9e7d4f8d55a..2bd8707f86b 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -62,7 +62,8 @@ function commande_prepare_head(Commande $object) if (($conf->expedition_bon->enabled && $user->rights->expedition->lire) || ($conf->delivery_note->enabled && $user->rights->expedition->delivery->lire)) { - $nbShipments = $object->getNbOfShipments(); $nbReceiption = 0; + $nbShipments = $object->getNbOfShipments(); + $nbReceiption = 0; $head[$h][0] = DOL_URL_ROOT.'/expedition/shipment.php?id='.$object->id; $text = ''; if ($conf->expedition_bon->enabled) { diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 08559c3ebd6..6e2ad1c2f05 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -49,7 +49,9 @@ function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') dol_syslog("pdf_getFormat Get paper format with mode=".$mode." MAIN_PDF_FORMAT=".(empty($conf->global->MAIN_PDF_FORMAT) ? 'null' : $conf->global->MAIN_PDF_FORMAT)." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')." and langs->defaultlang=".(is_object($langs) ? $langs->defaultlang : 'null')); // Default value if setup was not done and/or entry into c_paper_format not defined - $width = 210; $height = 297; $unit = 'mm'; + $width = 210; + $height = 297; + $unit = 'mm'; if ($mode == 'auto' || empty($conf->global->MAIN_PDF_FORMAT) || $conf->global->MAIN_PDF_FORMAT == 'auto') { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -725,7 +727,8 @@ function pdf_watermark(&$pdf, $outputlangs, $h, $w, $unit, $text) $text = make_substitutions($text, $substitutionarray, $outputlangs); $text = $outputlangs->convToOutputCharset($text); - $savx = $pdf->getX(); $savy = $pdf->getY(); + $savx = $pdf->getX(); + $savy = $pdf->getY(); $watermark_angle = atan($h / $w) / 2; $watermark_x_pos = 0; @@ -961,7 +964,10 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ } // First line of company infos - $line1 = ""; $line2 = ""; $line3 = ""; $line4 = ""; + $line1 = ""; + $line2 = ""; + $line3 = ""; + $line4 = ""; if ($showdetails == 1 || $showdetails == 3) { // Company name @@ -1086,9 +1092,11 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ if ($line) { // Free text //$line="sample text
    \nfdsfsdf
    \nghfghg
    "; if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) { - $width = 20000; $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. + $width = 20000; + $align = 'L'; // By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text. if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) { - $width = 200; $align = 'C'; + $width = 200; + $align = 'C'; } $freetextheight = $pdf->getStringHeight($width, $line); } else { diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index 5702240e94c..2b35c2c7779 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -1125,7 +1125,8 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec print dol_print_date($lines[$i]->timespent_datehour, 'day'); print ''; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1480,7 +1481,8 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1870,7 +1872,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -1887,7 +1890,8 @@ function projectLinesPerWeek(&$inc, $firstdaytoshow, $fuser, $parent, $lines, &$ //var_dump($projectstatic->weekWorkLoadPerTask); // Fields to show current time - $tableCell = ''; $modeinput = 'hours'; + $tableCell = ''; + $modeinput = 'hours'; for ($idw = 0; $idw < 7; $idw++) { $tmpday = dol_time_plus_duree($firstdaytoshow, $idw, 'd'); @@ -2148,7 +2152,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & } print "\n"; - $disabledproject = 1; $disabledtask = 1; + $disabledproject = 1; + $disabledtask = 1; //print "x".$lines[$i]->fk_project; //var_dump($lines[$i]); //var_dump($projectsrole[$lines[$i]->fk_project]); @@ -2165,7 +2170,8 @@ function projectLinesPerMonth(&$inc, $firstdaytoshow, $fuser, $parent, $lines, & //var_dump($projectstatic->weekWorkLoadPerTask); //TODO // Fields to show current time - $tableCell = ''; $modeinput = 'hours'; + $tableCell = ''; + $modeinput = 'hours'; $TFirstDay = getFirstDayOfEachWeek($TWeek, date('Y', $firstdaytoshow)); $TFirstDay[reset($TWeek)] = 1; foreach ($TFirstDay as &$fday) { diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 6b95187e5df..a4299e925df 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -207,10 +207,13 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f $features = 'adherent'; } if ($features == 'subscription') { - $features = 'adherent'; $feature2 = 'cotisation'; + $features = 'adherent'; + $feature2 = 'cotisation'; }; if ($features == 'websitepage') { - $features = 'website'; $tableandshare = 'website_page'; $parentfortableentity = 'fk_website@website'; + $features = 'website'; + $tableandshare = 'website_page'; + $parentfortableentity = 'fk_website@website'; } if ($features == 'project') { $features = 'projet'; @@ -252,48 +255,58 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f $listofmodules = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); // Check read permission from module - $readok = 1; $nbko = 0; + $readok = 1; + $nbko = 0; foreach ($featuresarray as $feature) { // first we check nb of test ko $featureforlistofmodule = $feature; if ($featureforlistofmodule == 'produit') { $featureforlistofmodule = 'product'; } if (!empty($user->socid) && !empty($conf->global->MAIN_MODULES_FOR_EXTERNAL) && !in_array($featureforlistofmodule, $listofmodules)) { // If limits on modules for external users, module must be into list of modules for external users - $readok = 0; $nbko++; + $readok = 0; + $nbko++; continue; } if ($feature == 'societe') { if (!$user->rights->societe->lire && !$user->rights->fournisseur->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'contact') { if (!$user->rights->societe->contact->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'produit|service') { if (!$user->rights->produit->lire && !$user->rights->service->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'projet') { if (!$user->rights->projet->lire && !$user->rights->projet->all->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'payment') { if (!$user->rights->facture->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif ($feature == 'payment_supplier') { if (!$user->rights->fournisseur->facture->lire) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } elseif (!empty($feature2)) { // This is for permissions on 2 levels $tmpreadok = 1; @@ -306,7 +319,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f } elseif (empty($subfeature) && empty($user->rights->$feature->lire) && empty($user->rights->$feature->read)) { $tmpreadok = 0; } else { - $tmpreadok = 1; break; + $tmpreadok = 1; + break; } // Break is to bypass second test if the first is ok } if (!$tmpreadok) { // We found a test on feature that is ko @@ -317,7 +331,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (empty($user->rights->$feature->lire) && empty($user->rights->$feature->read) && empty($user->rights->$feature->run)) { - $readok = 0; $nbko++; + $readok = 0; + $nbko++; } } } @@ -333,7 +348,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f //print "Read access is ok"; // Check write permission from module (we need to know write permission to create but also to delete drafts record or to upload files) - $createok = 1; $nbko = 0; + $createok = 1; + $nbko = 0; $wemustcheckpermissionforcreate = (GETPOST('sendit', 'alpha') || GETPOST('linkit', 'alpha') || GETPOST('action', 'aZ09') == 'create' || GETPOST('action', 'aZ09') == 'update'); $wemustcheckpermissionfordeletedraft = ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete'); @@ -341,35 +357,43 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f foreach ($featuresarray as $feature) { if ($feature == 'contact') { if (!$user->rights->societe->contact->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'produit|service') { if (!$user->rights->produit->creer && !$user->rights->service->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'prelevement') { if (!$user->rights->prelevement->bons->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'commande_fournisseur') { if (!$user->rights->fournisseur->commande->creer) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'banque') { if (!$user->rights->banque->modifier) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'cheque') { if (!$user->rights->banque->cheque) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'import') { if (!$user->rights->import->run) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif ($feature == 'ecm') { if (!$user->rights->ecm->upload) { - $createok = 0; $nbko++; + $createok = 0; + $nbko++; } } elseif (!empty($feature2)) { // This is for permissions on one level foreach ($feature2 as $subfeature) { @@ -427,7 +451,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f } // Check delete permission from module - $deleteok = 1; $nbko = 0; + $deleteok = 1; + $nbko = 0; if ((GETPOST("action", "aZ09") == 'confirm_delete' && GETPOST("confirm", "aZ09") == 'yes') || GETPOST("action", "aZ09") == 'delete') { foreach ($featuresarray as $feature) { if ($feature == 'contact') { @@ -471,7 +496,8 @@ function restrictedArea($user, $features, $objectid = 0, $tableandshare = '', $f if (empty($user->rights->$feature->$subfeature->supprimer) && empty($user->rights->$feature->$subfeature->delete)) { $deleteok = 0; } else { - $deleteok = 1; break; + $deleteok = 1; + break; } // For bypass the second test if the first is ok } } elseif (!empty($feature)) { // This is used for permissions on 1 level @@ -622,22 +648,23 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.fk_soc = ".$user->socid; - } // If internal user: Check permission for internal users that are restricted on their objects - elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { + } elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { + // If internal user: Check permission for internal users that are restricted on their objects $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON dbt.fk_soc = sc.fk_soc AND sc.fk_user = ".((int) $user->id); $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND (dbt.fk_soc IS NULL OR sc.fk_soc IS NOT NULL)"; // Contact not linked to a company or to a company of user $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; - } // If multicompany and internal users with all permissions, check user is in correct entity - elseif (!empty($conf->multicompany->enabled)) { + } elseif (!empty($conf->multicompany->enabled)) { + // If multicompany and internal users with all permissions, check user is in correct entity $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; } - if ($feature == 'agenda') {// Also check owner or attendee for users without allactions->read + if ($feature == 'agenda') { + // Also check owner or attendee for users without allactions->read if ($objectid > 0 && empty($user->rights->agenda->allactions->read)) { require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php'; $action = new ActionComm($db); @@ -712,8 +739,8 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand $sql .= " AND dbt.entity IN (".getEntity($sharedelement, 1).")"; $sql .= " AND (sc.fk_user = ".$user->id." OR sc.fk_user IS NULL)"; } - } // If multicompany and internal users with all permissions, check user is in correct entity - elseif (!empty($conf->multicompany->enabled)) { + } elseif (!empty($conf->multicompany->enabled)) { + // If multicompany and internal users with all permissions, check user is in correct entity $sql = "SELECT COUNT(dbt.".$dbt_select.") as nb"; $sql .= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt"; $sql .= " WHERE dbt.".$dbt_select." IN (".$objectid.")"; diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index 9181b3dd07d..523b8ccf2cb 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -179,7 +179,8 @@ if (!function_exists('dol_loginfunction')) { foreach ($dirtpls as $reldir) { $tmp = dol_buildpath($reldir.'login.tpl.php'); if (file_exists($tmp)) { - $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); break; + $template_dir = preg_replace('/login\.tpl\.php$/', '', $tmp); + break; } } } else { @@ -322,14 +323,20 @@ function makesalt($type = CRYPT_SALT_LENGTH) dol_syslog("makesalt type=".$type); switch ($type) { case 12: // 8 + 4 - $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; + $saltlen = 8; + $saltprefix = '$1$'; + $saltsuffix = '$'; break; case 8: // 8 (Pour compatibilite, ne devrait pas etre utilise) - $saltlen = 8; $saltprefix = '$1$'; $saltsuffix = '$'; + $saltlen = 8; + $saltprefix = '$1$'; + $saltsuffix = '$'; break; case 2: // 2 default: // by default, fall back on Standard DES (should work everywhere) - $saltlen = 2; $saltprefix = ''; $saltsuffix = ''; + $saltlen = 2; + $saltprefix = ''; + $saltsuffix = ''; break; } $salt = ''; diff --git a/htdocs/core/lib/treeview.lib.php b/htdocs/core/lib/treeview.lib.php index a20170e3a95..255bc47d9a9 100644 --- a/htdocs/core/lib/treeview.lib.php +++ b/htdocs/core/lib/treeview.lib.php @@ -156,7 +156,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset continue; } - print ''; $ulprinted++; + print ''; + $ulprinted++; } print "\n".'
  • '; if ($showfk) { @@ -184,7 +185,8 @@ function tree_recur($tab, $pere, $rang, $iddivjstree = 'iddivjstree', $donoreset continue; } - print ''; $ulprinted++; + print ''; + $ulprinted++; } print "\n".'
  • '; if ($showfk) { diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index a01aa02b468..2efeec151a3 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -102,9 +102,8 @@ function dolSavePageAlias($filealias, $object, $objectpage) if (!empty($conf->global->MAIN_UMASK)) { @chmod($filealiassub, octdec($conf->global->MAIN_UMASK)); } - } - // Save also alias into all language subdirectories if it is a main language - elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + } elseif (empty($objectpage->lang) || !in_array($objectpage->lang, explode(',', $object->otherlang))) { + // Save also alias into all language subdirectories if it is a main language if (empty($conf->global->WEBSITE_DISABLE_MAIN_LANGUAGE_INTO_LANGSUBDIR)) { $dirname = dirname($filealias); $filename = basename($filealias); diff --git a/htdocs/core/lib/ws.lib.php b/htdocs/core/lib/ws.lib.php index 14d7162358b..ad4688f9134 100644 --- a/htdocs/core/lib/ws.lib.php +++ b/htdocs/core/lib/ws.lib.php @@ -41,27 +41,32 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe if (!$error && ($authentication['dolibarrkey'] != $conf->global->WEBSERVICES_KEY)) { $error++; - $errorcode = 'BAD_VALUE_FOR_SECURITY_KEY'; $errorlabel = 'Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; + $errorcode = 'BAD_VALUE_FOR_SECURITY_KEY'; + $errorlabel = 'Value provided into dolibarrkey entry field does not match security key defined in Webservice module setup'; } if (!$error && !empty($authentication['entity']) && !is_numeric($authentication['entity'])) { $error++; - $errorcode = 'BAD_PARAMETERS'; $errorlabel = "The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; + $errorcode = 'BAD_PARAMETERS'; + $errorlabel = "The entity parameter must be empty (or filled with numeric id of instance if multicompany module is used)."; } if (!$error) { $result = $fuser->fetch('', $authentication['login'], '', 0); if ($result < 0) { $error++; - $errorcode = 'ERROR_FETCH_USER'; $errorlabel = 'A technical error occurred during fetch of user'; + $errorcode = 'ERROR_FETCH_USER'; + $errorlabel = 'A technical error occurred during fetch of user'; } elseif ($result == 0) { $error++; - $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; + $errorcode = 'BAD_CREDENTIALS'; + $errorlabel = 'Bad value for login or password'; } if (!$error && $fuser->statut == 0) { $error++; - $errorcode = 'ERROR_USER_DISABLED'; $errorlabel = 'This user has been locked or disabled'; + $errorcode = 'ERROR_USER_DISABLED'; + $errorlabel = 'This user has been locked or disabled'; } // Validation of login @@ -83,7 +88,8 @@ function check_authentication($authentication, &$error, &$errorcode, &$errorlabe $login = checkLoginPassEntity($authentication['login'], $authentication['password'], $authentication['entity'], $authmode, 'ws'); if (empty($login)) { $error++; - $errorcode = 'BAD_CREDENTIALS'; $errorlabel = 'Bad value for login or password'; + $errorcode = 'BAD_CREDENTIALS'; + $errorlabel = 'Bad value for login or password'; } } } diff --git a/htdocs/core/login/functions_openid.php b/htdocs/core/login/functions_openid.php index c06b10f109d..3f77eca1326 100644 --- a/htdocs/core/login/functions_openid.php +++ b/htdocs/core/login/functions_openid.php @@ -43,7 +43,7 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) $login = ''; // Get identity from user and redirect browser to OpenID Server - if (GETPOSISSET('username')) { + if (GETPOSTISSET('username')) { $openid = new SimpleOpenID(); $openid->SetIdentity($_POST['username']); $protocol = ($conf->file->main_force_https ? 'https://' : 'http://'); @@ -59,9 +59,8 @@ function check_user_password_openid($usertotest, $passwordtotest, $entitytotest) return false; } return false; - } - // Perform HTTP Request to OpenID server to validate key - elseif ($_GET['openid_mode'] == 'id_res') { + } elseif ($_GET['openid_mode'] == 'id_res') { + // Perform HTTP Request to OpenID server to validate key $openid = new SimpleOpenID(); $openid->SetIdentity($_GET['openid_identity']); $openid_validation_result = $openid->ValidateWithServer(); diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 155a5f55ce0..11dc0a6ce7d 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -147,12 +147,11 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ - else { + /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ + } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; } @@ -467,7 +466,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; if (empty($noout)) { - $altok = 0; $blockvmenuopened = false; $lastlevel0 = ''; + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { // Loop on each menu entry $showmenu = true; @@ -591,7 +592,8 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t print ''."\n"; } if ($blockvmenuopened) { - print ''."\n"; $blockvmenuopened = false; + print ''."\n"; + $blockvmenuopened = false; } } } @@ -627,7 +629,8 @@ function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexterna $found = 0; foreach ($tmploops as $tmploop) { if (in_array($tmploop, $listofmodulesforexternal)) { - $found++; break; + $found++; + break; } } if (!$found) { diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index fecc57a74e7..e150d07e063 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -516,12 +516,11 @@ function print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { $urllogo = DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - /*elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - }*/ - else { + /*} elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); + }*/ + } else { $urllogo = DOL_URL_ROOT.'/theme/dolibarr_512x512_white.png'; $logoContainerAdditionalClass = ''; } @@ -1931,7 +1930,9 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM // Show menu $invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert"; if (empty($noout)) { - $altok = 0; $blockvmenuopened = false; $lastlevel0 = ''; + $altok = 0; + $blockvmenuopened = false; + $lastlevel0 = ''; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { // Loop on each menu entry $showmenu = true; @@ -2055,7 +2056,8 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM print ''."\n"; } if ($blockvmenuopened) { - print ''."\n"; $blockvmenuopened = false; + print ''."\n"; + $blockvmenuopened = false; } } } diff --git a/htdocs/core/menus/standard/empty.php b/htdocs/core/menus/standard/empty.php index 5ab8ff24f9f..f51aacdd90e 100644 --- a/htdocs/core/menus/standard/empty.php +++ b/htdocs/core/menus/standard/empty.php @@ -370,7 +370,9 @@ class MenuManager } if (empty($noout)) { - $alt = 0; $altok = 0; $blockvmenuopened = false; + $alt = 0; + $altok = 0; + $blockvmenuopened = false; $num = count($menu_array); for ($i = 0; $i < $num; $i++) { $alt++; diff --git a/htdocs/core/modules/action/modules_action.php b/htdocs/core/modules/action/modules_action.php index ea51eea4745..b496e32f5e1 100644 --- a/htdocs/core/modules/action/modules_action.php +++ b/htdocs/core/modules/action/modules_action.php @@ -96,7 +96,9 @@ function action_create($db, $object, $modele, $outputlangs, $hidedetails = 0, $h } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/barcode/mod_barcode_product_standard.php b/htdocs/core/modules/barcode/mod_barcode_product_standard.php index 944a285b341..a1cba7f8399 100644 --- a/htdocs/core/modules/barcode/mod_barcode_product_standard.php +++ b/htdocs/core/modules/barcode/mod_barcode_product_standard.php @@ -199,7 +199,8 @@ class mod_barcode_product_standard extends ModeleNumRefBarCode return ''; } - $field = 'barcode'; $where = ''; + $field = 'barcode'; + $where = ''; $now = dol_now(); diff --git a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php index af9207eb1c5..20ce1373b66 100644 --- a/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php +++ b/htdocs/core/modules/bom/doc/doc_generic_bom_odt.modules.php @@ -128,7 +128,8 @@ class doc_generic_bom_odt extends ModelePDFBom $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/bom/mod_bom_standard.php b/htdocs/core/modules/bom/mod_bom_standard.php index dad731758f7..f5a9fb75976 100644 --- a/htdocs/core/modules/bom/mod_bom_standard.php +++ b/htdocs/core/modules/bom/mod_bom_standard.php @@ -81,7 +81,8 @@ class mod_bom_standard extends ModeleNumRefboms { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_bom_standard extends ModeleNumRefboms if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php index 5855ec24e55..21c131ad2a6 100644 --- a/htdocs/core/modules/cheque/doc/pdf_blochet.class.php +++ b/htdocs/core/modules/cheque/doc/pdf_blochet.class.php @@ -360,7 +360,8 @@ class BordereauChequeBlochet extends ModeleChequeReceipts // Add page break if we do not have space to add current line if ($lineinpage >= ($this->line_per_page - 1)) { - $lineinpage = 0; $yp = 0; + $lineinpage = 0; + $yp = 0; // New page $pdf->AddPage(); diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php index 6e9f03ad927..a882c1e0068 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_mint.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_mint.php @@ -78,7 +78,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -90,7 +91,8 @@ class mod_chequereceipt_mint extends ModeleNumRefChequeReceipts if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { diff --git a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php index 1138801a078..33b31135caf 100644 --- a/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php +++ b/htdocs/core/modules/commande/doc/doc_generic_order_odt.modules.php @@ -135,7 +135,8 @@ class doc_generic_order_odt extends ModelePDFCommandes $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index f8f196a9fa3..ebae616c45b 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -472,7 +472,8 @@ class pdf_einstein extends ModelePDFCommandes // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -896,7 +897,8 @@ class pdf_einstein extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index b64a0066390..17837529354 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -658,7 +658,8 @@ class pdf_eratosthene extends ModelePDFCommandes // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1109,7 +1110,8 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/commande/mod_commande_marbre.php b/htdocs/core/modules/commande/mod_commande_marbre.php index 315a1f27302..0cc9324ef16 100644 --- a/htdocs/core/modules/commande/mod_commande_marbre.php +++ b/htdocs/core/modules/commande/mod_commande_marbre.php @@ -81,7 +81,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_commande_marbre extends ModeleNumRefCommandes if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php index 25cf13f57d9..7b451287ae1 100644 --- a/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php +++ b/htdocs/core/modules/contract/doc/doc_generic_contract_odt.modules.php @@ -134,7 +134,8 @@ class doc_generic_contract_odt extends ModelePDFContract $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/contract/doc/pdf_strato.modules.php b/htdocs/core/modules/contract/doc/pdf_strato.modules.php index 439ae2ef338..c440cbf1cba 100644 --- a/htdocs/core/modules/contract/doc/pdf_strato.modules.php +++ b/htdocs/core/modules/contract/doc/pdf_strato.modules.php @@ -415,7 +415,8 @@ class pdf_strato extends ModelePDFContract // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/contract/mod_contract_serpis.php b/htdocs/core/modules/contract/mod_contract_serpis.php index 2506b77e540..6bc09464dba 100644 --- a/htdocs/core/modules/contract/mod_contract_serpis.php +++ b/htdocs/core/modules/contract/mod_contract_serpis.php @@ -91,7 +91,8 @@ class mod_contract_serpis extends ModelNumRefContracts { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -103,7 +104,8 @@ class mod_contract_serpis extends ModelNumRefContracts if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php index ad197f442dd..057310a9976 100644 --- a/htdocs/core/modules/delivery/doc/pdf_storm.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_storm.modules.php @@ -513,7 +513,8 @@ class pdf_storm extends ModelePDFDeliveryOrder // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php index 3f86dc1ac67..66f232653ac 100644 --- a/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php +++ b/htdocs/core/modules/delivery/doc/pdf_typhon.modules.php @@ -426,7 +426,8 @@ class pdf_typhon extends ModelePDFDeliveryOrder // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/delivery/mod_delivery_jade.php b/htdocs/core/modules/delivery/mod_delivery_jade.php index c18b1c98e62..605265fde00 100644 --- a/htdocs/core/modules/delivery/mod_delivery_jade.php +++ b/htdocs/core/modules/delivery/mod_delivery_jade.php @@ -94,7 +94,8 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL @@ -106,7 +107,8 @@ class mod_delivery_jade extends ModeleNumRefDeliveryOrder if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php index 16161e97a65..82d61a41943 100644 --- a/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php +++ b/htdocs/core/modules/expedition/doc/doc_generic_shipment_odt.modules.php @@ -136,7 +136,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php index c11fb8e60c9..42a777a196f 100644 --- a/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_espadon.modules.php @@ -523,12 +523,14 @@ class pdf_espadon extends ModelePdfExpedition // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -695,7 +697,8 @@ class pdf_espadon extends ModelePdfExpedition $pdf->SetFont('', 'B', $default_font_size - 1); // Total table - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php index af73123b2d5..f2434c93d26 100644 --- a/htdocs/core/modules/expedition/doc/pdf_merou.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_merou.modules.php @@ -333,7 +333,8 @@ class pdf_merou extends ModelePdfExpedition // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 3); diff --git a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php index 4cf93a31b55..c41fd92f524 100644 --- a/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php +++ b/htdocs/core/modules/expedition/doc/pdf_rouget.modules.php @@ -533,12 +533,14 @@ class pdf_rouget extends ModelePdfExpedition // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -700,7 +702,8 @@ class pdf_rouget extends ModelePdfExpedition $pdf->SetFont('', 'B', $default_font_size - 1); // Tableau total - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/expedition/mod_expedition_safor.php b/htdocs/core/modules/expedition/mod_expedition_safor.php index 04cc09c2313..aa1628e7482 100644 --- a/htdocs/core/modules/expedition/mod_expedition_safor.php +++ b/htdocs/core/modules/expedition/mod_expedition_safor.php @@ -86,7 +86,8 @@ class mod_expedition_safor extends ModelNumRefExpedition { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -98,7 +99,8 @@ class mod_expedition_safor extends ModelNumRefExpedition if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php index 9984a9ccc24..d1f959f5460 100644 --- a/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/expensereport/doc/pdf_standard.modules.php @@ -849,7 +849,8 @@ class pdf_standard extends ModeleExpenseReport if ($object->fk_statut == 99) { if ($object->fk_user_refuse > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_refuse); $posy += 6; + $userfee->fetch($object->fk_user_refuse); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("REFUSEUR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -862,7 +863,8 @@ class pdf_standard extends ModeleExpenseReport } elseif ($object->fk_statut == 4) { if ($object->fk_user_cancel > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_cancel); $posy += 6; + $userfee->fetch($object->fk_user_cancel); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("CANCEL_USER")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -875,7 +877,8 @@ class pdf_standard extends ModeleExpenseReport } else { if ($object->fk_user_approve > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_approve); $posy += 6; + $userfee->fetch($object->fk_user_approve); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("VALIDOR")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; @@ -887,7 +890,8 @@ class pdf_standard extends ModeleExpenseReport if ($object->fk_statut == 6) { if ($object->fk_user_paid > 0) { $userfee = new User($this->db); - $userfee->fetch($object->fk_user_paid); $posy += 6; + $userfee->fetch($object->fk_user_paid); + $posy += 6; $pdf->SetXY($posx + 2, $posy); $pdf->MultiCell(96, 4, $outputlangs->transnoentities("AUTHORPAIEMENT")." : ".dolGetFirstLastname($userfee->firstname, $userfee->lastname), 0, 'L'); $posy += 5; diff --git a/htdocs/core/modules/expensereport/mod_expensereport_jade.php b/htdocs/core/modules/expensereport/mod_expensereport_jade.php index c80bd693620..bbe2245a97d 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_jade.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_jade.php @@ -87,7 +87,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -99,7 +100,8 @@ class mod_expensereport_jade extends ModeleNumRefExpenseReport if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php index 762b9fb89e9..eb48373a443 100644 --- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php +++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php @@ -135,7 +135,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 67e61cb7815..847901c0147 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -584,7 +584,8 @@ class pdf_crabe extends ModelePDFFactures // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1191,7 +1192,8 @@ class pdf_crabe extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php index b1072a50008..d7d69fc4a18 100644 --- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php @@ -695,7 +695,8 @@ class pdf_sponge extends ModelePDFFactures // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1284,7 +1285,8 @@ class pdf_sponge extends ModelePDFFactures $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 5a6df69babd..cd36b4d322a 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -95,7 +95,8 @@ class mod_facture_mars extends ModeleNumRefFactures $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL @@ -107,7 +108,8 @@ class mod_facture_mars extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -129,7 +131,8 @@ class mod_facture_mars extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index 9d844953306..2f142a1adc7 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -105,7 +105,8 @@ class mod_facture_terre extends ModeleNumRefFactures $langs->load("bills"); // Check invoice num - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL @@ -117,7 +118,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -139,7 +141,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { @@ -160,7 +163,8 @@ class mod_facture_terre extends ModeleNumRefFactures if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($fayymm && !preg_match('/'.$this->prefixdeposit.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php index 25a30d3ac84..ac0cb1fac80 100644 --- a/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php +++ b/htdocs/core/modules/fichinter/doc/pdf_soleil.modules.php @@ -392,7 +392,8 @@ class pdf_soleil extends ModelePDFFicheinter // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/fichinter/mod_pacific.php b/htdocs/core/modules/fichinter/mod_pacific.php index b4d492e31ce..b2ffe3a7e98 100644 --- a/htdocs/core/modules/fichinter/mod_pacific.php +++ b/htdocs/core/modules/fichinter/mod_pacific.php @@ -89,7 +89,8 @@ class mod_pacific extends ModeleNumRefFicheinter $langs->load("bills"); - $fayymm = ''; $max = ''; + $fayymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -101,7 +102,8 @@ class mod_pacific extends ModeleNumRefFicheinter if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $fayymm = substr($row[0], 0, 6); $max = $row[0]; + $fayymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$fayymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $fayymm)) { diff --git a/htdocs/core/modules/fichinter/modules_fichinter.php b/htdocs/core/modules/fichinter/modules_fichinter.php index ae9ba58726e..8cf79227d4f 100644 --- a/htdocs/core/modules/fichinter/modules_fichinter.php +++ b/htdocs/core/modules/fichinter/modules_fichinter.php @@ -195,7 +195,9 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails = 0, } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/holiday/mod_holiday_madonna.php b/htdocs/core/modules/holiday/mod_holiday_madonna.php index ddec553216d..fd2271198bc 100644 --- a/htdocs/core/modules/holiday/mod_holiday_madonna.php +++ b/htdocs/core/modules/holiday/mod_holiday_madonna.php @@ -92,7 +92,8 @@ class mod_holiday_madonna extends ModelNumRefHolidays { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -104,7 +105,8 @@ class mod_holiday_madonna extends ModelNumRefHolidays if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index f324f268ba3..63a28fbe3d2 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -397,9 +397,8 @@ class ImportCsv extends ModeleImports $this->errors[$error]['type'] = 'NOTNULL'; $errorforthistable++; $error++; - } - // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else { + } else { + // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { //print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. '; @@ -677,9 +676,8 @@ class ImportCsv extends ModeleImports $errorforthistable++; $error++; } - } - // If test is just a static regex - elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { + } elseif (!preg_match('/'.$objimport->array_import_regex[0][$val].'/i', $newval)) { + // If test is just a static regex //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."
    "; $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['type'] = 'REGEX'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index 1f5764c810d..257e8f5253e 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -440,9 +440,8 @@ class ImportXlsx extends ModeleImports $this->errors[$error]['type'] = 'NOTNULL'; $errorforthistable++; $error++; - } - // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) - else { + } else { + // Test format only if field is not a missing mandatory field (field may be a value or empty but not mandatory) // We convert field if required if (!empty($objimport->array_import_convertvalue[0][$val])) { //print 'Must convert '.$newval.' with rule '.join(',',$objimport->array_import_convertvalue[0][$val]).'. '; @@ -718,9 +717,8 @@ class ImportXlsx extends ModeleImports $errorforthistable++; $error++; } - } - // If test is just a static regex - elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) { + } elseif (!preg_match('/' . $objimport->array_import_regex[0][$val] . '/i', $newval)) { + // If test is just a static regex //if ($key == 19) print "xxx".$newval."zzz".$objimport->array_import_regex[0][$val]."
    "; $this->errors[$error]['lib'] = $langs->transnoentitiesnoconv('ErrorWrongValueForField', $key, $newval, $objimport->array_import_regex[0][$val]); $this->errors[$error]['type'] = 'REGEX'; diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index 8e1737b3e9f..5f2ad86c7b5 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -131,7 +131,8 @@ class doc_generic_member_odt extends ModelePDFMember $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/member/doc/pdf_standard.class.php b/htdocs/core/modules/member/doc/pdf_standard.class.php index d3fd804a662..1d1a892cc56 100644 --- a/htdocs/core/modules/member/doc/pdf_standard.class.php +++ b/htdocs/core/modules/member/doc/pdf_standard.class.php @@ -123,7 +123,8 @@ class pdf_standard extends CommonStickerGenerator $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height); } - $xleft = 2; $ytop = 2; + $xleft = 2; + $ytop = 2; // Top if ($header != '') { @@ -140,16 +141,20 @@ class pdf_standard extends CommonStickerGenerator $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height)); // Define widthtouse and heighttouse - $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); + $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); + $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); $defaultratio = ($maxwidthtouse / $maxheighttouse); - $widthtouse = $maxwidthtouse; $heighttouse = 0; // old value for image + $widthtouse = $maxwidthtouse; + $heighttouse = 0; // old value for image $tmp = dol_getImageSize($photo, false); if ($tmp['height']) { $imgratio = $tmp['width'] / $tmp['height']; if ($imgratio >= $defaultratio) { - $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); + $widthtouse = $maxwidthtouse; + $heighttouse = round($widthtouse / $imgratio); } else { - $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); + $heightouse = $maxheighttouse; + $widthtouse = round($heightouse * $imgratio); } } //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; @@ -312,7 +317,8 @@ class pdf_standard extends CommonStickerGenerator $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/member/modules_cards.php b/htdocs/core/modules/member/modules_cards.php index e879bdb3562..0e041a17559 100644 --- a/htdocs/core/modules/member/modules_cards.php +++ b/htdocs/core/modules/member/modules_cards.php @@ -114,7 +114,9 @@ function members_card_pdf_create($db, $arrayofmembers, $modele, $outputlangs, $o } // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/modAdherent.class.php b/htdocs/core/modules/modAdherent.class.php index 0556d8b6f21..9e402ab3b72 100644 --- a/htdocs/core/modules/modAdherent.class.php +++ b/htdocs/core/modules/modAdherent.class.php @@ -307,7 +307,9 @@ class modAdherent extends DolibarrModules 'c.rowid'=>'subscription', 'c.dateadh'=>'subscription', 'c.datef'=>'subscription', 'c.subscription'=>'subscription' ); // Add extra fields - $keyforselect = 'adherent'; $keyforelement = 'member'; $keyforaliasextra = 'extra'; + $keyforselect = 'adherent'; + $keyforelement = 'member'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add axtra fields $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modBom.class.php b/htdocs/core/modules/modBom.class.php index 889bcbb8d0e..b040e4cec99 100644 --- a/htdocs/core/modules/modBom.class.php +++ b/htdocs/core/modules/modBom.class.php @@ -287,14 +287,23 @@ class modBom extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'BomAndBomLines'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'bom'; - $keyforclass = 'BOM'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bom'; + $keyforclass = 'BOM'; + $keyforclassfile = '/bom/class/bom.class.php'; + $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; - $keyforclass = 'BOMLine'; $keyforclassfile = '/bom/class/bom.class.php'; $keyforelement = 'bomline'; $keyforalias = 'tl'; + $keyforclass = 'BOMLine'; + $keyforclassfile = '/bom/class/bom.class.php'; + $keyforelement = 'bomline'; + $keyforalias = 'tl'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; unset($this->export_fields_array[$r]['tl.fk_bom']); - $keyforselect = 'bom_bom'; $keyforaliasextra = 'extra'; $keyforelement = 'bom'; + $keyforselect = 'bom_bom'; + $keyforaliasextra = 'extra'; + $keyforelement = 'bom'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'bom_bomline'; $keyforaliasextra = 'extraline'; $keyforelement = 'bomline'; + $keyforselect = 'bom_bomline'; + $keyforaliasextra = 'extraline'; + $keyforelement = 'bomline'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('bomline'=>'tl.rowid'); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index d5c2e699da2..d1f58dd7451 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -185,7 +185,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 'p.label'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product'); // We define here only fields that use another picto - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -227,7 +229,9 @@ class modCategorie extends DolibarrModules 't.libelle'=>'company' ); // We define here only fields that use another picto - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -271,7 +275,9 @@ class modCategorie extends DolibarrModules 't.libelle'=>'company', 'pl.code'=>'company', 'st.code'=>'company' ); // We define here only fields that use another picto - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -297,7 +303,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'member', 'p.lastname'=>'member', 'p.firstname'=>'member'); // We define here only fields that use another picto - $keyforselect = 'adherent'; $keyforelement = 'member'; $keyforaliasextra = 'extra'; + $keyforselect = 'adherent'; + $keyforelement = 'member'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -348,7 +356,9 @@ class modCategorie extends DolibarrModules 's.phone'=>"company", 's.fax'=>"company", 's.url'=>"company", 's.email'=>"company" ); // We define here only fields that use another picto - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -375,7 +385,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.ref'=>'Text', 's.rowid'=>"List:societe:nom:rowid", 's.nom'=>"Text"); $this->export_entities_array[$r] = array('p.rowid'=>'project', 'p.ref'=>'project', 's.rowid'=>"company", 's.nom'=>"company"); // We define here only fields that use another picto - $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; + $keyforselect = 'projet'; + $keyforelement = 'project'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -398,7 +410,9 @@ class modCategorie extends DolibarrModules $this->export_TypeFields_array[$r] = array('cat.label'=>"Text", 'cat.description'=>"Text", 'cat.fk_parent'=>'List:categorie:label:rowid', 'p.login'=>'Text', 'p.lastname'=>'Text', 'p.firstname'=>'Text'); $this->export_entities_array[$r] = array('p.rowid'=>'user', 'p.login'=>'user', 'p.lastname'=>'user', 'p.firstname'=>'user'); // We define here only fields that use another picto - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modCommande.class.php b/htdocs/core/modules/modCommande.class.php index 36a35894636..6fa8b730c24 100644 --- a/htdocs/core/modules/modCommande.class.php +++ b/htdocs/core/modules/modCommande.class.php @@ -236,13 +236,21 @@ class modCommande extends DolibarrModules 'cd.total_ttc'=>"order_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); $this->export_dependencies_array[$r] = array('order_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'commande'; $keyforelement = 'order'; $keyforaliasextra = 'extra'; + $keyforselect = 'commande'; + $keyforelement = 'order'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commandedet'; $keyforelement = 'order_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'commandedet'; + $keyforelement = 'order_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra4'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra4'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/core/modules/modContrat.class.php b/htdocs/core/modules/modContrat.class.php index d9d8558e35a..1b927346f1e 100644 --- a/htdocs/core/modules/modContrat.class.php +++ b/htdocs/core/modules/modContrat.class.php @@ -193,9 +193,13 @@ class modContrat extends DolibarrModules 'p.rowid'=>'List:product:label', 'p.ref'=>'Text', 'p.label'=>'Text'); - $keyforselect = 'contrat'; $keyforelement = 'contract'; $keyforaliasextra = 'coextra'; + $keyforselect = 'contrat'; + $keyforelement = 'contract'; + $keyforaliasextra = 'coextra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'contratdet'; $keyforelement = 'contract_line'; $keyforaliasextra = 'codextra'; + $keyforselect = 'contratdet'; + $keyforelement = 'contract_line'; + $keyforaliasextra = 'codextra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modExpedition.class.php b/htdocs/core/modules/modExpedition.class.php index 6cc31b05c22..b4bac22fd1a 100644 --- a/htdocs/core/modules/modExpedition.class.php +++ b/htdocs/core/modules/modExpedition.class.php @@ -280,14 +280,22 @@ class modExpedition extends DolibarrModules } $this->export_dependencies_array[$r] = array('shipment_line'=>'ed.rowid', 'product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them if ($idcontacts && !empty($conf->global->SHIPMENT_ADD_CONTACTS_IN_EXPORT)) { - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra3'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } - $keyforselect = 'expedition'; $keyforelement = 'shipment'; $keyforaliasextra = 'extra'; + $keyforselect = 'expedition'; + $keyforelement = 'shipment'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'expeditiondet'; $keyforelement = 'shipment_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'expeditiondet'; + $keyforelement = 'shipment_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extraprod'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extraprod'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modExpenseReport.class.php b/htdocs/core/modules/modExpenseReport.class.php index 2d0036faef9..dca32b4fad7 100644 --- a/htdocs/core/modules/modExpenseReport.class.php +++ b/htdocs/core/modules/modExpenseReport.class.php @@ -211,7 +211,9 @@ class modExpenseReport extends DolibarrModules $this->export_alias_array[$r] = array('d.rowid'=>"idtrip", 'd.type'=>"type", 'd.note_private'=>'note_private', 'd.note_public'=>'note_public', 'u.lastname'=>'name', 'u.firstname'=>'firstname', 'u.login'=>'login'); $this->export_dependencies_array[$r] = array('expensereport_line'=>'ed.rowid', 'type_fees'=>'tf.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'expensereport'; $keyforelement = 'expensereport'; $keyforaliasextra = 'extra'; + $keyforselect = 'expensereport'; + $keyforelement = 'expensereport'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modFacture.class.php b/htdocs/core/modules/modFacture.class.php index 51d3377a965..eed92413c8a 100644 --- a/htdocs/core/modules/modFacture.class.php +++ b/htdocs/core/modules/modFacture.class.php @@ -266,11 +266,17 @@ class modFacture extends DolibarrModules ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r] = array('invoice_line'=>'fd.rowid', 'product'=>'fd.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; + $keyforselect = 'facture'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'facturedet'; $keyforelement = 'invoice_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'facturedet'; + $keyforelement = 'invoice_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; @@ -350,7 +356,9 @@ class modFacture extends DolibarrModules ); $this->export_special_array[$r] = array('none.rest'=>'getRemainToPay'); $this->export_dependencies_array[$r] = array('payment'=>'p.rowid', 'none.rest'=>array('f.rowid', 'f.total_ttc', 'f.close_code')); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them, or just to have field we need - $keyforselect = 'facture'; $keyforelement = 'invoice'; $keyforaliasextra = 'extra'; + $keyforselect = 'facture'; + $keyforelement = 'invoice'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'societe as s'; diff --git a/htdocs/core/modules/modFicheinter.class.php b/htdocs/core/modules/modFicheinter.class.php index 422ca6b22d5..9364b75d9f7 100644 --- a/htdocs/core/modules/modFicheinter.class.php +++ b/htdocs/core/modules/modFicheinter.class.php @@ -165,7 +165,9 @@ class modFicheinter extends DolibarrModules 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 'f.rowid'=>"InterId", 'f.ref'=>"InterRef", 'f.datec'=>"InterDateCreation", 'f.duree'=>"InterDuration", 'f.fk_statut'=>'InterStatus', 'f.description'=>"InterNote"); - $keyforselect = 'fichinter'; $keyforelement = 'intervention'; $keyforaliasextra = 'extra'; + $keyforselect = 'fichinter'; + $keyforelement = 'intervention'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] += array( 'pj.ref'=>'ProjectRef', 'pj.title'=>'ProjectLabel', @@ -195,7 +197,9 @@ class modFicheinter extends DolibarrModules 'fd.duree'=>'inter_line', 'fd.description'=>'inter_line' ); $this->export_dependencies_array[$r] = array('inter_line'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'fichinterdet'; $keyforelement = 'inter_line'; $keyforaliasextra = 'extradet'; + $keyforselect = 'fichinterdet'; + $keyforelement = 'inter_line'; + $keyforaliasextra = 'extradet'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modHoliday.class.php b/htdocs/core/modules/modHoliday.class.php index c3bbf2c3faf..3fa92d8a7c5 100644 --- a/htdocs/core/modules/modHoliday.class.php +++ b/htdocs/core/modules/modHoliday.class.php @@ -221,7 +221,9 @@ class modHoliday extends DolibarrModules $this->export_special_array[$r] = array('none.num_open_days'=>'getNumOpenDays'); $this->export_dependencies_array[$r] = array(); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'holiday'; $keyforelement = 'holiday'; $keyforaliasextra = 'extra'; + $keyforselect = 'holiday'; + $keyforelement = 'holiday'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modProduct.class.php b/htdocs/core/modules/modProduct.class.php index 4335913be6f..f972c235802 100644 --- a/htdocs/core/modules/modProduct.class.php +++ b/htdocs/core/modules/modProduct.class.php @@ -210,7 +210,9 @@ class modProduct extends DolibarrModules if (!empty($conf->barcode->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); } - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (!empty($conf->fournisseur->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); @@ -431,7 +433,9 @@ class modProduct extends DolibarrModules $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); } $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); diff --git a/htdocs/core/modules/modProjet.class.php b/htdocs/core/modules/modProjet.class.php index 69a359d6fb9..ff135a74d1d 100644 --- a/htdocs/core/modules/modProjet.class.php +++ b/htdocs/core/modules/modProjet.class.php @@ -253,13 +253,17 @@ class modProjet extends DolibarrModules // Add fields for project $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array()); // Add extra fields for project - $keyforselect = 'projet'; $keyforelement = 'project'; $keyforaliasextra = 'extra'; + $keyforselect = 'projet'; + $keyforelement = 'project'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // Add fields for tasks $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('pt.rowid'=>'TaskId', 'pt.ref'=>'RefTask', 'pt.label'=>'LabelTask', 'pt.dateo'=>"TaskDateStart", 'pt.datee'=>"TaskDateEnd", 'pt.duration_effective'=>"DurationEffective", 'pt.planned_workload'=>"PlannedWorkload", 'pt.progress'=>"Progress", 'pt.description'=>"TaskDescription")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pt.rowid'=>'projecttask', 'pt.ref'=>'projecttask', 'pt.label'=>'projecttask', 'pt.dateo'=>"projecttask", 'pt.datee'=>"projecttask", 'pt.duration_effective'=>"projecttask", 'pt.planned_workload'=>"projecttask", 'pt.progress'=>"projecttask", 'pt.description'=>"projecttask")); // Add extra fields for task - $keyforselect = 'projet_task'; $keyforelement = 'projecttask'; $keyforaliasextra = 'extra2'; + $keyforselect = 'projet_task'; + $keyforelement = 'projecttask'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; // End add extra fields $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ptt.rowid'=>'IdTaskTime', 'ptt.task_date'=>'TaskTimeDate', 'ptt.task_duration'=>"TimesSpent", 'ptt.fk_user'=>"TaskTimeUser", 'ptt.note'=>"TaskTimeNote")); diff --git a/htdocs/core/modules/modPropale.class.php b/htdocs/core/modules/modPropale.class.php index 1003bc5e09c..a1f52bbd906 100644 --- a/htdocs/core/modules/modPropale.class.php +++ b/htdocs/core/modules/modPropale.class.php @@ -227,13 +227,21 @@ class modPropale extends DolibarrModules 'cd.total_ht'=>"propal_line", 'cd.total_tva'=>"propal_line", 'cd.total_ttc'=>"propal_line", 'p.rowid'=>'product', 'p.ref'=>'product', 'p.label'=>'product' ); $this->export_dependencies_array[$r] = array('propal_line'=>'cd.rowid', 'product'=>'cd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them - $keyforselect = 'propal'; $keyforelement = 'propal'; $keyforaliasextra = 'extra'; + $keyforselect = 'propal'; + $keyforelement = 'propal'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'propaldet'; $keyforelement = 'propal_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'propaldet'; + $keyforelement = 'propal_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra3'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'societe'; $keyforaliasextra = 'extra4'; + $keyforselect = 'societe'; + $keyforelement = 'societe'; + $keyforaliasextra = 'extra4'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modReception.class.php b/htdocs/core/modules/modReception.class.php index 54334cdc285..17f765d2caf 100644 --- a/htdocs/core/modules/modReception.class.php +++ b/htdocs/core/modules/modReception.class.php @@ -208,12 +208,18 @@ class modReception extends DolibarrModules } $this->export_dependencies_array[$r] = array('reception_line'=>'ed.rowid', 'product'=>'ed.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them if ($idcontacts && !empty($conf->global->RECEPTION_ADD_CONTACTS_IN_EXPORT)) { - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra3'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra3'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; } - $keyforselect = 'reception'; $keyforelement = 'reception'; $keyforaliasextra = 'extra'; + $keyforselect = 'reception'; + $keyforelement = 'reception'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'commande_fournisseur_dispatch'; $keyforelement = 'reception_line'; $keyforaliasextra = 'extra2'; + $keyforselect = 'commande_fournisseur_dispatch'; + $keyforelement = 'reception_line'; + $keyforaliasextra = 'extra2'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 46be038a21c..ee3836cde26 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -242,7 +242,9 @@ class modResource extends DolibarrModules $this->export_fields_array[$r] = array('r.rowid'=>'IdResource', 'r.ref'=>'ResourceFormLabel_ref', 'c.code'=>'ResourceTypeCode', 'c.label'=>'ResourceType', 'r.description'=>'ResourceFormLabel_description', 'r.note_private'=>"NotePrivate", 'r.note_public'=>"NotePublic", 'r.asset_number'=>'AssetNumber', 'r.datec'=>"DateCreation", 'r.tms'=>"DateLastModification"); $this->export_TypeFields_array[$r] = array('r.rowid'=>'List:resource:ref', 'r.ref'=>'Text', 'r.asset_number'=>'Text', 'r.description'=>'Text', 'c.code'=>'Text', 'c.label'=>'List:c_type_resource:label', 'r.datec'=>'Date', 'r.tms'=>'Date', 'r.note_private'=>'Text', 'r.note_public'=>'Text'); $this->export_entities_array[$r] = array('r.rowid'=>'resource', 'r.ref'=>'resource', 'c.code'=>'resource', 'c.label'=>'resource', 'r.description'=>'resource', 'r.note_private'=>"resource", 'r.resource'=>"resource", 'r.asset_number'=>'resource', 'r.datec'=>"resource", 'r.tms'=>"resource"); - $keyforselect = 'resource'; $keyforelement = 'resource'; $keyforaliasextra = 'extra'; + $keyforselect = 'resource'; + $keyforelement = 'resource'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_dependencies_array[$r] = array('resource'=>array('r.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. diff --git a/htdocs/core/modules/modService.class.php b/htdocs/core/modules/modService.class.php index 75af0f103f5..6009af638fb 100644 --- a/htdocs/core/modules/modService.class.php +++ b/htdocs/core/modules/modService.class.php @@ -175,7 +175,9 @@ class modService extends DolibarrModules if (!empty($conf->barcode->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p.barcode'=>'BarCode')); } - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (!empty($conf->fournisseur->enabled)) { $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('s.nom'=>'Supplier', 'pf.ref_fourn'=>'SupplierRef', 'pf.quantity'=>'QtyMin', 'pf.remise_percent'=>'DiscountQtyMin', 'pf.unitprice'=>'BuyingPrice', 'pf.delivery_time_days'=>'NbDaysToDelivery')); @@ -392,7 +394,9 @@ class modService extends DolibarrModules $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p.barcode'=>'virtualproduct')); } $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('pa.qty'=>"subproduct", 'pa.incdec'=>'subproduct')); - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('p2.rowid'=>"Id", 'p2.ref'=>"Ref", 'p2.label'=>"Label", 'p2.description'=>"Description")); $this->export_entities_array[$r] = array_merge($this->export_entities_array[$r], array('p2.rowid'=>"subproduct", 'p2.ref'=>"subproduct", 'p2.label'=>"subproduct", 'p2.description'=>"subproduct")); diff --git a/htdocs/core/modules/modSociete.class.php b/htdocs/core/modules/modSociete.class.php index 42456c4ae80..9151673f996 100644 --- a/htdocs/core/modules/modSociete.class.php +++ b/htdocs/core/modules/modSociete.class.php @@ -288,7 +288,9 @@ class modSociete extends DolibarrModules $this->export_fields_array[$r] += array('s.entity'=>'Entity'); } } - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extra'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] += array('u.login'=>'SaleRepresentativeLogin', 'u.firstname'=>'SaleRepresentativeFirstname', 'u.lastname'=>'SaleRepresentativeLastname'); @@ -386,9 +388,13 @@ class modSociete extends DolibarrModules unset($this->export_fields_array[$r]['s.code_fournisseur']); unset($this->export_entities_array[$r]['s.code_fournisseur']); } - $keyforselect = 'socpeople'; $keyforelement = 'contact'; $keyforaliasextra = 'extra'; + $keyforselect = 'socpeople'; + $keyforelement = 'contact'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; - $keyforselect = 'societe'; $keyforelement = 'company'; $keyforaliasextra = 'extrasoc'; + $keyforselect = 'societe'; + $keyforelement = 'company'; + $keyforaliasextra = 'extrasoc'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'socpeople as c'; diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 76f5a1910ba..ffa80d9a748 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -205,7 +205,9 @@ class modStock extends DolibarrModules ); $this->export_entities_array[$r] = array(); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array(); - $keyforselect = 'warehouse'; $keyforelement = 'warehouse'; $keyforaliasextra = 'extra'; + $keyforselect = 'warehouse'; + $keyforelement = 'warehouse'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; @@ -243,7 +245,9 @@ class modStock extends DolibarrModules ); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_dependencies_array[$r] = array('stock'=>array('p.rowid', 'e.rowid')); // We must keep this until the aggregate_array is used. To have a unique key, if we ask a field of a child, to avoid the DISTINCT to discard them. - $keyforselect = 'product'; $keyforelement = 'product'; $keyforaliasextra = 'extra'; + $keyforselect = 'product'; + $keyforelement = 'product'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_fields_array[$r] = array_merge($this->export_fields_array[$r], array('ps.reel'=>'Stock')); @@ -288,7 +292,9 @@ class modStock extends DolibarrModules ); // We define here only fields that use another icon that the one defined into export_icon $this->export_aggregate_array[$r] = array('ps.reel'=>'SUM'); // TODO Not used yet $this->export_dependencies_array[$r] = array('stockbatch'=>array('pb.rowid'), 'batch'=>array('pb.rowid')); // We must keep this until the aggregate_array is used. To add unique key if we ask a field of a child to avoid the DISTINCT to discard them. - $keyforselect = 'product_lot'; $keyforelement = 'batch'; $keyforaliasextra = 'extra'; + $keyforselect = 'product_lot'; + $keyforelement = 'batch'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; $this->export_sql_start[$r] = 'SELECT DISTINCT '; diff --git a/htdocs/core/modules/modUser.class.php b/htdocs/core/modules/modUser.class.php index af4443be5d1..4c1a6bcfded 100644 --- a/htdocs/core/modules/modUser.class.php +++ b/htdocs/core/modules/modUser.class.php @@ -256,7 +256,9 @@ class modUser extends DolibarrModules 'u.admin'=>"user", 'u.statut'=>'user', 'u.datelastlogin'=>'user', 'u.datepreviouslogin'=>'user', 'u.fk_socpeople'=>"contact", 'u.fk_soc'=>"company", 'u.fk_member'=>"member" ); - $keyforselect = 'user'; $keyforelement = 'user'; $keyforaliasextra = 'extra'; + $keyforselect = 'user'; + $keyforelement = 'user'; + $keyforaliasextra = 'extra'; include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; if (empty($conf->adherent->enabled)) { unset($this->export_fields_array[$r]['u.fk_member']); diff --git a/htdocs/core/modules/modWebsite.class.php b/htdocs/core/modules/modWebsite.class.php index a7dfa2fdd82..efb5a38f297 100644 --- a/htdocs/core/modules/modWebsite.class.php +++ b/htdocs/core/modules/modWebsite.class.php @@ -130,7 +130,9 @@ class modWebsite extends DolibarrModules $this->export_code[$r] = $this->rights_class.'_'.$r; $this->export_label[$r] = 'MyWebsitePages'; // Translation key (used only if key ExportDataset_xxx_z not found) $this->export_icon[$r] = 'globe'; - $keyforclass = 'WebsitePage'; $keyforclassfile = '/website/class/websitepage.class.php'; $keyforelement = 'Website'; + $keyforclass = 'WebsitePage'; + $keyforclassfile = '/website/class/websitepage.class.php'; + $keyforelement = 'Website'; include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; //$keyforselect='myobject'; $keyforelement='myobject'; $keyforaliasextra='extra'; //include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; diff --git a/htdocs/core/modules/movement/doc/pdf_standard.modules.php b/htdocs/core/modules/movement/doc/pdf_standard.modules.php index b84976dd212..c8a0c50862b 100644 --- a/htdocs/core/modules/movement/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/movement/doc/pdf_standard.modules.php @@ -602,7 +602,8 @@ class pdf_stdandard extends ModelePDFMovement // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php index 8053d4f4f45..374ae5b4337 100644 --- a/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php +++ b/htdocs/core/modules/mrp/doc/doc_generic_mo_odt.modules.php @@ -135,7 +135,8 @@ class doc_generic_mo_odt extends ModelePDFMo $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/mrp/mod_mo_standard.php b/htdocs/core/modules/mrp/mod_mo_standard.php index ba7cdccdafa..d47b4eb708e 100644 --- a/htdocs/core/modules/mrp/mod_mo_standard.php +++ b/htdocs/core/modules/mrp/mod_mo_standard.php @@ -81,7 +81,8 @@ class mod_mo_standard extends ModeleNumRefMos { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -93,7 +94,8 @@ class mod_mo_standard extends ModeleNumRefMos if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/payment/mod_payment_cicada.php b/htdocs/core/modules/payment/mod_payment_cicada.php index 535fdab38bc..d3259db513c 100644 --- a/htdocs/core/modules/payment/mod_payment_cicada.php +++ b/htdocs/core/modules/payment/mod_payment_cicada.php @@ -88,7 +88,8 @@ class mod_payment_cicada extends ModeleNumRefPayments { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,8 @@ class mod_payment_cicada extends ModeleNumRefPayments if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { diff --git a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php index c09ce7bcbd8..079b46003c4 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_standardlabel.class.php @@ -111,7 +111,8 @@ class pdf_standardlabel extends CommonStickerGenerator $pdf->image($backgroundimage, $_PosX, $_PosY, $this->_Width, $this->_Height); } - $xleft = 2; $ytop = 2; + $xleft = 2; + $ytop = 2; // Top if ($header != '') { @@ -128,16 +129,20 @@ class pdf_standardlabel extends CommonStickerGenerator $ytop += (empty($header) ? 0 : (1 + $this->_Line_Height)); // Define widthtouse and heighttouse - $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); + $maxwidthtouse = round(($this->_Width - 2 * $xleft) * $imgscalewidth); + $maxheighttouse = round(($this->_Height - 2 * $ytop) * $imgscaleheight); $defaultratio = ($maxwidthtouse / $maxheighttouse); - $widthtouse = $maxwidthtouse; $heighttouse = 0; // old value for image + $widthtouse = $maxwidthtouse; + $heighttouse = 0; // old value for image $tmp = dol_getImageSize($photo, false); if ($tmp['height']) { $imgratio = $tmp['width'] / $tmp['height']; if ($imgratio >= $defaultratio) { - $widthtouse = $maxwidthtouse; $heighttouse = round($widthtouse / $imgratio); + $widthtouse = $maxwidthtouse; + $heighttouse = round($widthtouse / $imgratio); } else { - $heightouse = $maxheighttouse; $widthtouse = round($heightouse * $imgratio); + $heightouse = $maxheighttouse; + $widthtouse = round($heightouse * $imgratio); } } //var_dump($this->_Width.'x'.$this->_Height.' with border and scale '.$imgscale.' => max '.$maxwidthtouse.'x'.$maxheighttouse.' => We use '.$widthtouse.'x'.$heighttouse);exit; @@ -239,7 +244,8 @@ class pdf_standardlabel extends CommonStickerGenerator $this->code = $srctemplatepath; $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php index 1be4e6d8432..907b18daef3 100644 --- a/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php +++ b/htdocs/core/modules/printsheet/doc/pdf_tcpdflabel.class.php @@ -267,7 +267,8 @@ class pdf_tcpdflabel extends CommonStickerGenerator $this->code = $srctemplatepath; $this->Tformat = $_Avery_Labels[$this->code]; if (empty($this->Tformat)) { - dol_print_error('', 'ErrorBadTypeForCard'.$this->code); exit; + dol_print_error('', 'ErrorBadTypeForCard'.$this->code); + exit; } $this->type = 'pdf'; // standard format or custom diff --git a/htdocs/core/modules/printsheet/modules_labels.php b/htdocs/core/modules/printsheet/modules_labels.php index 9365f19f783..ae4c6888a6c 100644 --- a/htdocs/core/modules/printsheet/modules_labels.php +++ b/htdocs/core/modules/printsheet/modules_labels.php @@ -117,7 +117,9 @@ function doc_label_pdf_create($db, $arrayofrecords, $modele, $outputlangs, $outp dol_syslog("modele=".$modele." outputdir=".$outputdir." template=".$template." code=".$code." srctemplatepath=".$srctemplatepath." filename=".$filename, LOG_DEBUG); // Search template files - $file = ''; $classname = ''; $filefound = 0; + $file = ''; + $classname = ''; + $filefound = 0; $dirmodels = array('/'); if (is_array($conf->modules_parts['models'])) { $dirmodels = array_merge($dirmodels, $conf->modules_parts['models']); diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 8970cbeea79..19a752d5be7 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -138,7 +138,8 @@ class doc_generic_product_odt extends ModelePDFProduct $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/product/mod_codeproduct_elephant.php b/htdocs/core/modules/product/mod_codeproduct_elephant.php index 24d9c0690c8..0a302c0fb6b 100644 --- a/htdocs/core/modules/product/mod_codeproduct_elephant.php +++ b/htdocs/core/modules/product/mod_codeproduct_elephant.php @@ -200,7 +200,8 @@ class mod_codeproduct_elephant extends ModeleProductCode return ''; } - $field = ''; $where = ''; + $field = ''; + $where = ''; if ($type == 0) { $field = 'ref'; //$where = ' AND client in (1,2)'; diff --git a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php index 960bf21ef69..091f26a0872 100644 --- a/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php +++ b/htdocs/core/modules/project/doc/doc_generic_project_odt.modules.php @@ -426,7 +426,8 @@ class doc_generic_project_odt extends ModelePDFProjects $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/project/doc/pdf_baleine.modules.php b/htdocs/core/modules/project/doc/pdf_baleine.modules.php index 446de761418..373d41abc31 100644 --- a/htdocs/core/modules/project/doc/pdf_baleine.modules.php +++ b/htdocs/core/modules/project/doc/pdf_baleine.modules.php @@ -421,7 +421,8 @@ class pdf_baleine extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/project/doc/pdf_beluga.modules.php b/htdocs/core/modules/project/doc/pdf_beluga.modules.php index dbb4e28d03a..21af4b94ade 100644 --- a/htdocs/core/modules/project/doc/pdf_beluga.modules.php +++ b/htdocs/core/modules/project/doc/pdf_beluga.modules.php @@ -640,7 +640,8 @@ class pdf_beluga extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/project/doc/pdf_timespent.modules.php b/htdocs/core/modules/project/doc/pdf_timespent.modules.php index b2d90af0da2..ef2ec4fcaf8 100644 --- a/htdocs/core/modules/project/doc/pdf_timespent.modules.php +++ b/htdocs/core/modules/project/doc/pdf_timespent.modules.php @@ -425,7 +425,8 @@ class pdf_timespent extends ModelePDFProjects // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { //var_dump($pageposbefore.'-'.$pageposafter.'-'.$showpricebeforepagebreak); - $pdf->setPage($pageposafter); $curY = $tab_top_newpage + $heightoftitleline + 1; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage + $heightoftitleline + 1; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font diff --git a/htdocs/core/modules/project/mod_project_simple.php b/htdocs/core/modules/project/mod_project_simple.php index 1fb88f5454c..b1dbe4bae48 100644 --- a/htdocs/core/modules/project/mod_project_simple.php +++ b/htdocs/core/modules/project/mod_project_simple.php @@ -90,7 +90,8 @@ class mod_project_simple extends ModeleNumRefProjects { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -101,7 +102,8 @@ class mod_project_simple extends ModeleNumRefProjects if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php index 3f321c6f022..fc444babe0d 100644 --- a/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php +++ b/htdocs/core/modules/project/task/doc/doc_generic_task_odt.modules.php @@ -393,7 +393,8 @@ class doc_generic_task_odt extends ModelePDFTask $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/project/task/mod_task_simple.php b/htdocs/core/modules/project/task/mod_task_simple.php index 654da5fff23..f0cdddfbc88 100644 --- a/htdocs/core/modules/project/task/mod_task_simple.php +++ b/htdocs/core/modules/project/task/mod_task_simple.php @@ -90,7 +90,8 @@ class mod_task_simple extends ModeleNumRefTask { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(task.ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_task_simple extends ModeleNumRefTask if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php index 0ac3bc5e35d..4a292d4a97b 100644 --- a/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php +++ b/htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php @@ -137,7 +137,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index 1f36c874c2b..9575577ecbd 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -565,7 +565,8 @@ class pdf_azur extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -1047,7 +1048,8 @@ class pdf_azur extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 6a550018f7a..550339a8afc 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -673,7 +673,8 @@ class pdf_cyan extends ModelePDFPropales // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -1194,7 +1195,8 @@ class pdf_cyan extends ModelePDFPropales $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/propale/mod_propale_marbre.php b/htdocs/core/modules/propale/mod_propale_marbre.php index 77b1a97e17b..28d66dfc40a 100644 --- a/htdocs/core/modules/propale/mod_propale_marbre.php +++ b/htdocs/core/modules/propale/mod_propale_marbre.php @@ -90,7 +90,8 @@ class mod_propale_marbre extends ModeleNumRefPropales { global $conf, $langs, $db; - $pryymm = ''; $max = ''; + $pryymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_propale_marbre extends ModeleNumRefPropales if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $pryymm = substr($row[0], 0, 6); $max = $row[0]; + $pryymm = substr($row[0], 0, 6); + $max = $row[0]; } } diff --git a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php index 0b19633b40e..13a05b3378d 100644 --- a/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php +++ b/htdocs/core/modules/reception/doc/doc_generic_reception_odt.modules.php @@ -130,7 +130,8 @@ class doc_generic_reception_odt extends ModelePdfReception $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/reception/doc/pdf_squille.modules.php b/htdocs/core/modules/reception/doc/pdf_squille.modules.php index ad1a702a622..4aa6db074f6 100644 --- a/htdocs/core/modules/reception/doc/pdf_squille.modules.php +++ b/htdocs/core/modules/reception/doc/pdf_squille.modules.php @@ -439,12 +439,14 @@ class pdf_squille extends ModelePdfReception // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -599,7 +601,8 @@ class pdf_squille extends ModelePdfReception $pdf->SetFont('', 'B', $default_font_size - 1); // Tableau total - $col1x = $this->posxweightvol - 50; $col2x = $this->posxweightvol; + $col1x = $this->posxweightvol - 50; + $col2x = $this->posxweightvol; /*if ($this->page_largeur < 210) // To work with US executive format { $col2x-=20; diff --git a/htdocs/core/modules/reception/mod_reception_beryl.php b/htdocs/core/modules/reception/mod_reception_beryl.php index d75e82070df..bbfc0daee45 100644 --- a/htdocs/core/modules/reception/mod_reception_beryl.php +++ b/htdocs/core/modules/reception/mod_reception_beryl.php @@ -66,7 +66,8 @@ class mod_reception_beryl extends ModelNumRefReception { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -78,7 +79,8 @@ class mod_reception_beryl extends ModelNumRefReception if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php index 588ecaf747f..ff9e4da5f0c 100644 --- a/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php +++ b/htdocs/core/modules/societe/doc/doc_generic_odt.modules.php @@ -117,7 +117,8 @@ class doc_generic_odt extends ModeleThirdPartyDoc $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/societe/mod_codeclient_elephant.php b/htdocs/core/modules/societe/mod_codeclient_elephant.php index 49e4ffbe80a..5586ad82fda 100644 --- a/htdocs/core/modules/societe/mod_codeclient_elephant.php +++ b/htdocs/core/modules/societe/mod_codeclient_elephant.php @@ -223,7 +223,8 @@ class mod_codeclient_elephant extends ModeleThirdPartyCode return ''; } - $field = ''; $where = ''; + $field = ''; + $where = ''; if ($type == 0) { $field = 'code_client'; //$where = ' AND client in (1,2)'; diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index ad6f51e342b..2819adea021 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -132,7 +132,8 @@ class doc_generic_stock_odt extends ModelePDFStock $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/stock/doc/pdf_standard.modules.php b/htdocs/core/modules/stock/doc/pdf_standard.modules.php index 6297921dbcc..a57b996086b 100644 --- a/htdocs/core/modules/stock/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/stock/doc/pdf_standard.modules.php @@ -409,7 +409,8 @@ class pdf_standard extends ModelePDFStock // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php index 8fec70458c0..e5fa94135ad 100644 --- a/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php +++ b/htdocs/core/modules/supplier_invoice/doc/pdf_canelle.modules.php @@ -279,6 +279,9 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetAutoPageBreak(1, 0); $heightforinfotot = 50 + (4 * $nbpayments); // Height reserved to output the info and total part and payment part + if ($heightforinfotot > 220) { + $heightforinfotot = 220; + } $heightforfreetext = (isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5); // Height reserved to output the free text on last page $heightforfooter = $this->marge_basse + 8; // Height reserved to output the footer (value include bottom margin) if (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS)) { @@ -454,7 +457,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // We reposition the default font @@ -665,7 +669,8 @@ class pdf_canelle extends ModelePDFSuppliersInvoices $pdf->SetFont('', '', $default_font_size - 1); // Total table - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php index 1b76b805efc..3d8f62ce3ca 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_cactus.php @@ -99,7 +99,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices $langs->load("bills"); // Check invoice num - $siyymm = ''; $max = ''; + $siyymm = ''; + $max = ''; $posindice = strlen($this->prefixinvoice) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -110,7 +111,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixinvoice.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { @@ -132,7 +134,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixcreditnote.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { @@ -153,7 +156,8 @@ class mod_facture_fournisseur_cactus extends ModeleNumRefSuppliersInvoices if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $siyymm = substr($row[0], 0, 6); $max = $row[0]; + $siyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($siyymm && !preg_match('/'.$this->prefixdeposit.'[0-9][0-9][0-9][0-9]/i', $siyymm)) { diff --git a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php index f75641f2b9d..9e9799f44c6 100644 --- a/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php +++ b/htdocs/core/modules/supplier_order/doc/doc_generic_supplier_order_odt.modules.php @@ -136,7 +136,8 @@ class doc_generic_supplier_order_odt extends ModelePDFSuppliersOrders $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 5bf915fb764..e256ad8f4aa 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -611,7 +611,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -941,7 +942,8 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index bccf6c75195..879cbba7578 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -519,7 +519,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -819,7 +820,8 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php index ae33e2875f5..5aa92995c4c 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_muguet.php @@ -102,7 +102,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -113,7 +114,8 @@ class mod_commande_fournisseur_muguet extends ModeleNumRefSuppliersOrders if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if (!$coyymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php index 18d597eb8ba..25dde592779 100644 --- a/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/supplier_payment/doc/pdf_standard.modules.php @@ -388,7 +388,8 @@ class pdf_standard extends ModelePDFSuppliersPayments // We suppose that a too long description is moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php index 7dae12ee64e..f86950c24d6 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_bronan.php @@ -88,7 +88,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments { global $conf, $langs, $db; - $payyymm = ''; $max = ''; + $payyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -100,7 +101,8 @@ class mod_supplier_payment_bronan extends ModeleNumRefSupplierPayments if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $payyymm = substr($row[0], 0, 6); $max = $row[0]; + $payyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($payyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $payyymm)) { diff --git a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php index e9280b346e1..4b761f8099b 100644 --- a/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/doc_generic_supplier_proposal_odt.modules.php @@ -139,7 +139,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index e8a3861541b..356c3550100 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -509,7 +509,8 @@ class pdf_aurore extends ModelePDFSupplierProposal // We suppose that a too long description or photo were moved completely on next page if ($pageposafter > $pageposbefore && empty($showpricebeforepagebreak)) { - $pdf->setPage($pageposafter); $curY = $tab_top_newpage; + $pdf->setPage($pageposafter); + $curY = $tab_top_newpage; } $pdf->SetFont('', '', $default_font_size - 1); // On repositionne la police par defaut @@ -912,7 +913,8 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->SetFont('', '', $default_font_size - 1); // Tableau total - $col1x = 120; $col2x = 170; + $col1x = 120; + $col2x = 170; if ($this->page_largeur < 210) { // To work with US executive format $col2x -= 20; } diff --git a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php index d61f6db2a36..b225899cef2 100644 --- a/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php +++ b/htdocs/core/modules/supplier_proposal/mod_supplier_proposal_marbre.php @@ -90,7 +90,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal { global $conf, $langs, $db; - $pryymm = ''; $max = ''; + $pryymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -102,7 +103,8 @@ class mod_supplier_proposal_marbre extends ModeleNumRefSupplierProposal if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $pryymm = substr($row[0], 0, 6); $max = $row[0]; + $pryymm = substr($row[0], 0, 6); + $max = $row[0]; } } diff --git a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php index 176cdd1191c..eb90baef7e5 100644 --- a/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php +++ b/htdocs/core/modules/ticket/doc/doc_generic_ticket_odt.modules.php @@ -127,7 +127,8 @@ class doc_generic_ticket_odt extends ModelePDFTicket $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/ticket/mod_ticket_simple.php b/htdocs/core/modules/ticket/mod_ticket_simple.php index 2badaf4a33f..523da47191d 100644 --- a/htdocs/core/modules/ticket/mod_ticket_simple.php +++ b/htdocs/core/modules/ticket/mod_ticket_simple.php @@ -151,8 +151,8 @@ class mod_ticket_simple extends ModeleNumRefTicket if ($max >= (pow(10, 4) - 1)) { $num = $max + 1; - } // If counter > 9999, we do not format on 4 chars, we take number as it is - else { + } else { + // If counter > 9999, we do not format on 4 chars, we take number as it is $num = sprintf("%04s", $max + 1); } diff --git a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php index cf39a523605..fb24e2782c9 100644 --- a/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php +++ b/htdocs/core/modules/user/doc/doc_generic_user_odt.modules.php @@ -136,7 +136,8 @@ class doc_generic_user_odt extends ModelePDFUser $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php index 2538f83dfa8..45a9469753e 100644 --- a/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php +++ b/htdocs/core/modules/usergroup/doc/doc_generic_usergroup_odt.modules.php @@ -139,7 +139,8 @@ class doc_generic_usergroup_odt extends ModelePDFUserGroup $tmpdir = trim($tmpdir); $tmpdir = preg_replace('/DOL_DATA_ROOT/', DOL_DATA_ROOT, $tmpdir); if (!$tmpdir) { - unset($listofdir[$key]); continue; + unset($listofdir[$key]); + continue; } if (!is_dir($tmpdir)) { $texttitle .= img_warning($langs->trans("ErrorDirNotFound", $tmpdir), 0); diff --git a/htdocs/core/modules/workstation/mod_workstation_standard.php b/htdocs/core/modules/workstation/mod_workstation_standard.php index d504f9191f5..34e727dd272 100755 --- a/htdocs/core/modules/workstation/mod_workstation_standard.php +++ b/htdocs/core/modules/workstation/mod_workstation_standard.php @@ -83,7 +83,8 @@ class mod_workstation_standard extends ModeleNumRefWorkstation { global $conf, $langs, $db; - $coyymm = ''; $max = ''; + $coyymm = ''; + $max = ''; $posindice = strlen($this->prefix) + 6; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; @@ -99,7 +100,8 @@ class mod_workstation_standard extends ModeleNumRefWorkstation if ($resql) { $row = $db->fetch_row($resql); if ($row) { - $coyymm = substr($row[0], 0, 6); $max = $row[0]; + $coyymm = substr($row[0], 0, 6); + $max = $row[0]; } } if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) { diff --git a/htdocs/core/photos_resize.php b/htdocs/core/photos_resize.php index a8196f60056..008e524f299 100644 --- a/htdocs/core/photos_resize.php +++ b/htdocs/core/photos_resize.php @@ -102,8 +102,8 @@ if ($modulepart == 'produit' || $modulepart == 'product' || $modulepart == 'serv accessforbidden(); } $accessallowed = 1; -} else // ticket, holiday, expensereport, societe... -{ +} else { + // ticket, holiday, expensereport, societe... $result = restrictedArea($user, $modulepart, $id, $modulepart); if (empty($user->rights->$modulepart->read) && empty($user->rights->$modulepart->lire)) { accessforbidden(); @@ -320,9 +320,8 @@ if (empty($backtourl)) { $section_dir .= '/'; } $backtourl = DOL_URL_ROOT."/website/index.php?action=file_manager&website=".$website.'§ion_dir='.urlencode($section_dir); - } - // Generic case that should work for everybody else - else { + } else { + // Generic case that should work for everybody else $backtourl = DOL_URL_ROOT."/".$modulepart."/".$modulepart."_document.php?id=".$id.'&file='.urldecode($file); } } @@ -532,7 +531,9 @@ if (!empty($conf->use_javascript_ajax)) { $infoarray = dol_getImageSize($dir."/".GETPOST("file")); $height = $infoarray['height']; $width = $infoarray['width']; - $widthforcrop = $width; $refsizeforcrop = 'orig'; $ratioforcrop = 1; + $widthforcrop = $width; + $refsizeforcrop = 'orig'; + $ratioforcrop = 1; // If image is too large, we use another scale. if (!empty($_SESSION['dol_screenwidth']) && ($widthforcrop > round($_SESSION['dol_screenwidth'] / 2))) { $ratioforcrop = 2; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index ee3a1ab71a4..dc181f891b1 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -352,7 +352,8 @@ if ($nolinesbefore) { echo ''; } if (is_object($objectline)) { - $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line');; + $temps = $objectline->showOptionals($extrafields, 'create', array(), '', '', 1, 'line'); + ; if (!empty($temps)) { print '
    '; print $temps; diff --git a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php index 410918b99ed..afdfd904299 100644 --- a/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php +++ b/htdocs/core/triggers/interface_20_modWorkflow_WorkflowManager.class.php @@ -79,7 +79,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers $ret = $newobject->createFromProposal($object, $user); if ($ret < 0) { - $this->error = $newobject->error; $this->errors[] = $newobject->error; + $this->error = $newobject->error; + $this->errors[] = $newobject->error; } return $ret; } @@ -98,7 +99,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers $ret = $newobject->createFromOrder($object, $user); if ($ret < 0) { - $this->error = $newobject->error; $this->errors[] = $newobject->error; + $this->error = $newobject->error; + $this->errors[] = $newobject->error; } return $ret; } @@ -266,12 +268,14 @@ class InterfaceWorkflowManager extends DolibarrTriggers $order = new Commande($this->db); $ret = $order->fetch($object->origin_id); if ($ret < 0) { - $this->error = $order->error; $this->errors = $order->errors; + $this->error = $order->error; + $this->errors = $order->errors; return $ret; } $ret = $order->fetchObjectLinked($order->id, 'commande', null, 'shipping'); if ($ret < 0) { - $this->error = $order->error; $this->errors = $order->errors; + $this->error = $order->error; + $this->errors = $order->errors; return $ret; } //Build array of quantity shipped by product for an order @@ -307,7 +311,8 @@ class InterfaceWorkflowManager extends DolibarrTriggers //No diff => mean everythings is shipped $ret = $object->setStatut(Commande::STATUS_CLOSED, $object->origin_id, $object->origin, 'ORDER_CLOSE'); if ($ret < 0) { - $this->error = $object->error; $this->errors = $object->errors; + $this->error = $object->error; + $this->errors = $object->errors; return $ret; } } diff --git a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php index f9988e770bf..6d69c2d8a31 100644 --- a/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php +++ b/htdocs/core/triggers/interface_50_modAgenda_ActionsAuto.class.php @@ -628,10 +628,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg = $langs->transnoentities("InvoiceCanceledInDolibarr", $object->ref); $object->sendtoid = 0; - } - - // Members - elseif ($action == 'MEMBER_VALIDATE') { + } elseif ($action == 'MEMBER_VALIDATE') { + // Members // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "members")); @@ -745,10 +743,8 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("Type").': '.$object->type; $object->sendtoid = 0; - } - - // Projects - elseif ($action == 'PROJECT_CREATE') { + } elseif ($action == 'PROJECT_CREATE') { + // Projects // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -784,10 +780,8 @@ class InterfaceActionsAuto extends DolibarrTriggers } $object->sendtoid = 0; - } - - // Project tasks - elseif ($action == 'TASK_CREATE') { + } elseif ($action == 'TASK_CREATE') { + // Project tasks // Load translation files required by the page $langs->loadLangs(array("agenda", "other", "projects")); @@ -843,10 +837,9 @@ class InterfaceActionsAuto extends DolibarrTriggers $object->actionmsg .= "\n".$langs->transnoentities("NewUser").': '.$langs->trans("None"); } $object->sendtoid = 0; - } - // TODO Merge all previous cases into this generic one - else // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... - { + } else { + // TODO Merge all previous cases into this generic one + // $action = BILL_DELETE, TICKET_CREATE, TICKET_MODIFY, TICKET_DELETE, CONTACT_SENTBYMAIL, RECRUITMENTCANDIDATURE_MODIFY, ... // Note: We are here only if $conf->global->MAIN_AGENDA_ACTIONAUTO_action is on (tested at begining of this function). // Note that these key can be set in agenda setup, only if defined into c_action_trigger // Load translation files required by the page @@ -1026,7 +1019,9 @@ class InterfaceActionsAuto extends DolibarrTriggers } } - unset($object->actionmsg); unset($object->actionmsg2); unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. + unset($object->actionmsg); + unset($object->actionmsg2); + unset($object->actiontypecode); // When several action are called on same object, we must be sure to not reuse value of first action. if ($ret > 0) { $_SESSION['LAST_ACTION_CREATED'] = $ret; diff --git a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php index 19f23b0bfe4..c3d91fefc33 100644 --- a/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modLdap_Ldapsynchro.class.php @@ -251,10 +251,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Groupes - elseif ($action == 'USERGROUP_CREATE') { + } elseif ($action == 'USERGROUP_CREATE') { + // Groupes dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_SYNCHRO_ACTIVE) && $conf->global->LDAP_SYNCHRO_ACTIVE === 'dolibarr2ldap') { $ldap = new Ldap(); @@ -326,10 +324,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Contacts - elseif ($action == 'CONTACT_CREATE') { + } elseif ($action == 'CONTACT_CREATE') { + // Contacts dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_CONTACT_ACTIVE)) { $ldap = new Ldap(); @@ -396,10 +392,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->error = "ErrorLDAP ".$ldap->error; } } - } - - // Members - elseif ($action == 'MEMBER_CREATE') { + } elseif ($action == 'MEMBER_CREATE') { + // Members dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_MEMBER_ACTIVE) && (string) $conf->global->LDAP_MEMBER_ACTIVE == '1') { $ldap = new Ldap(); @@ -665,10 +659,8 @@ class InterfaceLdapsynchro extends DolibarrTriggers $this->errors[] = "ErrorLDAP ".$ldap->error; } } - } - - // Members types - elseif ($action == 'MEMBER_TYPE_CREATE') { + } elseif ($action == 'MEMBER_TYPE_CREATE') { + // Members types dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); if (!empty($conf->global->LDAP_MEMBER_TYPE_ACTIVE) && (string) $conf->global->LDAP_MEMBER_TYPE_ACTIVE == '1') { $ldap = new Ldap(); diff --git a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php index ca1a33279bd..3233fb8eaaf 100644 --- a/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php +++ b/htdocs/core/triggers/interface_50_modMailmanspip_Mailmanspipsynchro.class.php @@ -92,10 +92,8 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers } return $return; - } - - // Members - elseif ($action == 'MEMBER_VALIDATE') { + } elseif ($action == 'MEMBER_VALIDATE') { + // Members dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); $return = 0; diff --git a/htdocs/don/card.php b/htdocs/don/card.php index 0fcd4d98230..6fe0be1b995 100644 --- a/htdocs/don/card.php +++ b/htdocs/don/card.php @@ -356,8 +356,7 @@ if ($action == 'create') { // Company if (!empty($conf->societe->enabled) && !empty($conf->global->DONATION_USE_THIRDPARTIES)) { // Thirdparty - if ($soc->id > 0) - { + if ($soc->id > 0) { print '
  • '.$langs->trans('ThirdParty').''; print $soc->getNomUrl(1); @@ -388,7 +387,8 @@ if ($action == 'create') { var socid = $(this).val(); var fac_rec = $(\'#fac_rec\').val(); // reload page - window.location.href = "'.$_SERVER["PHP_SELF"].'?action=create&socid="+socid+"&fac_rec="+fac_rec; + $("input[name=action]").val("create"); + $("form[name=add]").submit(); }); }); '; diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 5cf550258ab..fdd5393d64c 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -1081,4 +1081,21 @@ class Don extends CommonObject return 0; } } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old third-party id + * @param int $dest_id New third-party id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'don' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/ecm/dir_add_card.php b/htdocs/ecm/dir_add_card.php index 8c13c377bd6..f5140cf296a 100644 --- a/htdocs/ecm/dir_add_card.php +++ b/htdocs/ecm/dir_add_card.php @@ -186,10 +186,8 @@ if ($action == 'add' && $permtoadd) { exit; } } -} - -// Deleting file -elseif ($action == 'confirm_deletesection' && $confirm == 'yes') { +} elseif ($action == 'confirm_deletesection' && $confirm == 'yes') { + // Deleting file $result = $ecmdir->delete($user); setEventMessages($langs->trans("ECMSectionWasRemoved", $ecmdir->label), null, 'mesgs'); } diff --git a/htdocs/fourn/class/fournisseur.class.php b/htdocs/fourn/class/fournisseur.class.php index 57f6fa52d26..1ab1095a191 100644 --- a/htdocs/fourn/class/fournisseur.class.php +++ b/htdocs/fourn/class/fournisseur.class.php @@ -199,4 +199,21 @@ class Fournisseur extends Societe } return $arr; } + + /** + * Function used to replace a thirdparty id with another one. + * + * @param DoliDB $db Database handler + * @param int $origin_id Old third-party id + * @param int $dest_id New third-party id + * @return bool + */ + public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) + { + $tables = array( + 'facture_fourn' + ); + + return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); + } } diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 1bde5a1f816..f4b85a1b0c8 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -1250,7 +1250,7 @@ class FactureFournisseur extends CommonInvoice include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $ref = dol_sanitizeFileName($this->ref); - $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoive_supplier').$ref; + $dir = $conf->fournisseur->facture->dir_output.'/'.get_exdir($this->id, 2, 0, 0, $this, 'invoice_supplier').$ref; $file = $dir."/".$ref.".pdf"; if (file_exists($file)) { if (!dol_delete_file($file, 0, 0, 0, $this)) { // For triggers diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index 76ef5de8af0..a110bcd7e2c 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -201,7 +201,7 @@ if (empty($reshook)) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { // Multicurrency rate - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')), GETPOST('calculation_mode', 'int')); } // bank account diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index d1e7a2c668c..1565f0b313d 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -362,7 +362,7 @@ if (empty($reshook)) { $result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha')); } elseif ($action == 'setmulticurrencyrate' && $usercancreate) { // Multicurrency rate - $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha'))); + $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx', 'alpha')), GETPOST('calculation_mode', 'int')); } elseif ($action == 'setbankaccount' && $usercancreate) { // bank account $result = $object->setBankAccount(GETPOST('fk_account', 'int')); diff --git a/htdocs/includes/odtphp/odf.php b/htdocs/includes/odtphp/odf.php index 800b29a918d..91fec8d998e 100644 --- a/htdocs/includes/odtphp/odf.php +++ b/htdocs/includes/odtphp/odf.php @@ -913,16 +913,20 @@ IMG; { dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); $filename=''; $linenum=0; - if (headers_sent($filename, $linenum)) { - throw new OdfException("headers already sent ($filename at $linenum)"); + + if (php_sapi_name() != 'cli') { // If we are in a web context (not into CLI context) + if (headers_sent($filename, $linenum)) { + throw new OdfException("headers already sent ($filename at $linenum)"); + } + + if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { + $name=preg_replace('/\.od(x|t)/i', '', $name); + header('Content-type: application/pdf'); + header('Content-Disposition: attachment; filename="'.$name.'.pdf"'); + readfile($name.".pdf"); + } } - if (!empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) { - $name=preg_replace('/\.od(x|t)/i', '', $name); - header('Content-type: application/pdf'); - header('Content-Disposition: attachment; filename="'.$name.'.pdf"'); - readfile($name.".pdf"); - } if (!empty($conf->global->MAIN_ODT_AS_PDF_DEL_SOURCE)) { unlink($name); @@ -931,7 +935,7 @@ IMG; dol_syslog(get_class($this).'::exportAsAttachedPDF $ret_val='.$retval, LOG_DEBUG); dol_syslog(get_class($this).'::exportAsAttachedPDF $output_arr='.var_export($output_arr, true), LOG_DEBUG); - if ($retval==126) { + if ($retval == 126) { throw new OdfException('Permission execute convert script : ' . $command); } else { diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index acb2c956fda..b0d578829b9 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -278,4 +278,5 @@ INSERT INTO llx_c_country (rowid,code,code_iso,label,active,favorite) VALUES (24 -- Set field eec -UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GB','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI','UK'); +UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); + diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql index b3c27f96850..68566139dec 100644 --- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql +++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql @@ -43,6 +43,9 @@ insert into llx_c_actioncomm (id, code, type, libelle, module, active, position) -- VMYSQL4.3 ALTER TABLE llx_accounting_bookkeeping MODIFY COLUMN montant double(24,8) NULL; -- VPGSQL8.2 ALTER TABLE llx_accounting_bookkeeping ALTER COLUMN montant DROP NOT NULL; +UPDATE llx_c_country SET eec = 1 WHERE code IN ('AT','BE','BG','CY','CZ','DE','DK','EE','ES','FI','FR','GR','HR','NL','HU','IE','IM','IT','LT','LU','LV','MC','MT','PL','PT','RO','SE','SK','SI'); + + -- For v14 ALTER TABLE llx_c_availability ADD COLUMN position integer NOT NULL DEFAULT 0; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index f3ae7df6ed3..d613e4a18b0 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -4169,7 +4169,7 @@ function migrate_reload_modules($db, $langs, $conf, $listofmodule = array(), $fo $mod = new modBlockedLog($db); // For this module we only reload menus. $mod->delete_menus(); - $mod->insert_menus($reloadmode); + $mod->insert_menus(); } } elseif ($moduletoreload == 'MAIN_MODULE_CRON') { dolibarr_install_syslog("upgrade2::migrate_reload_modules Reactivate Cron module"); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index b7948532773..4f10f9a4dfd 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -2105,3 +2105,4 @@ AskThisIDToYourBank=Contact your bank to get this ID AdvancedModeOnly=Permision available in Advanced permission mode only ConfFileIsReadableOrWritableByAnyUsers=The conf file is reabable or writable by any users. Give permission to web server user and group only. MailToSendEventOrganization=Event Organization +AGENDA_EVENT_DEFAULT_STATUS=Default event status when creating a event from the form diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 58f5307255a..79f3fb3518e 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -361,7 +361,7 @@ UnitPriceHTCurrency=Unit price (excl.) (currency) UnitPriceTTC=Unit price PriceU=U.P. PriceUHT=U.P. (net) -PriceUHTCurrency=U.P (currency) +PriceUHTCurrency=U.P (net) (currency) PriceUTTC=U.P. (inc. tax) Amount=Amount AmountInvoice=Invoice amount diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index b7babd403a1..c23f4425dca 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -136,4 +136,8 @@ RSSFeedDesc=You can get a RSS feed of latest articles with type 'blogpost' using PagesRegenerated=%s page(s)/container(s) regenerated RegenerateWebsiteContent=Regenerate web site cache files AllowedInFrames=Allowed in Frames -DefineListOfAltLanguagesInWebsiteProperties=Define list of all available languages into web site properties. \ No newline at end of file +DefineListOfAltLanguagesInWebsiteProperties=Define list of all available languages into web site properties. +GenerateSitemaps=Generate website sitemap file +ConfirmGenerateSitemaps=If you confirm, you will erase the existing sitemap file... +ConfirmSitemapsCreation=Confirm sitemap generation +SitemapGenerated=Sitemap Generated diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index a862a1ecb9d..70f50c7eea3 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -361,7 +361,7 @@ UnitPriceHTCurrency=Prix ​​unitaire (HT) (devise) UnitPriceTTC=Prix unitaire TTC PriceU=P.U. PriceUHT=P.U. HT -PriceUHTCurrency=P.U. (devise) +PriceUHTCurrency=P.U. HT (devise) PriceUTTC=P.U TTC Amount=Montant AmountInvoice=Montant facture diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index b8ddb6c8672..99e571fb8b7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4427,6 +4427,10 @@ class Product extends CommonObject { global $alreadyfound; + if (empty($id)) { + return array(); + } + $sql = "SELECT p.rowid, p.ref, p.label as label, p.fk_product_type,"; $sql .= " pa.qty as qty, pa.fk_product_fils as id, pa.incdec"; $sql .= " FROM ".MAIN_DB_PREFIX."product as p,"; diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index 16cea8746c3..dc5d99a43eb 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -2133,11 +2133,11 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } else { - /* Disable button to pay and show hourglass cursor */ - jQuery('#hourglasstopay').show(); - jQuery('#buttontopay').hide(); + /* Disable button to pay and show hourglass cursor */ + jQuery('#hourglasstopay').show(); + jQuery('#buttontopay').hide(); - stripe.handleCardPayment( + stripe.handleCardPayment( clientSecret, cardElement, { payment_method_data: { billing_details: { @@ -2159,38 +2159,38 @@ if (preg_match('/^dopayment/', $action)) { // If we choosed/click on the payme } } - }, - save_payment_method: /* true when a customer was provided when creating payment intent. true ask to save the card */ + }, + save_payment_method: /* true when a customer was provided when creating payment intent. true ask to save the card */ } - ).then(function(result) { + ).then(function(result) { console.log(result); - if (result.error) { - console.log("Error on result of handleCardPayment"); - jQuery('#buttontopay').show(); - jQuery('#hourglasstopay').hide(); - // Inform the user if there was an error - var errorElement = document.getElementById('card-errors'); - errorElement.textContent = result.error.message; - } else { + if (result.error) { + console.log("Error on result of handleCardPayment"); + jQuery('#buttontopay').show(); + jQuery('#hourglasstopay').hide(); + // Inform the user if there was an error + var errorElement = document.getElementById('card-errors'); + errorElement.textContent = result.error.message; + } else { // The payment has succeeded. Display a success message. - console.log("No error on result of handleCardPayment, so we submit the form"); - // Submit the form - jQuery('#buttontopay').hide(); - jQuery('#hourglasstopay').show(); - // Send form (action=charge that will do nothing) - jQuery('#payment-form').submit(); - } - }); + console.log("No error on result of handleCardPayment, so we submit the form"); + // Submit the form + jQuery('#buttontopay').hide(); + jQuery('#hourglasstopay').show(); + // Send form (action=charge that will do nothing) + jQuery('#payment-form').submit(); + } + }); } }); // Old code for payment with option STRIPE_USE_INTENT_WITH_AUTOMATIC_CONFIRMATION off and STRIPE_USE_NEW_CHECKOUT off diff --git a/htdocs/societe/canvas/company/tpl/card_create.tpl.php b/htdocs/societe/canvas/company/tpl/card_create.tpl.php index 8e1eda02c33..2deb1dba8b1 100644 --- a/htdocs/societe/canvas/company/tpl/card_create.tpl.php +++ b/htdocs/societe/canvas/company/tpl/card_create.tpl.php @@ -86,14 +86,14 @@ if (empty($conf) || !is_object($conf)) {
    trans('Supplier'); ?> control->tpl['yn_supplier']; ?>trans('SupplierCode'); ?> - - - - - -
    control->tpl['help_suppliercode']; ?>
    +
    trans('SupplierCode'); ?> + + + + + +
    control->tpl['help_suppliercode']; ?>
    trans('Supplier'); ?> control->tpl['yn_supplier']; ?>trans('SupplierCode'); ?> - - - - - -
    control->tpl['help_suppliercode']; ?>
    +
    trans('SupplierCode'); ?> + + + + + +
    control->tpl['help_suppliercode']; ?>
    '; - print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth150')); + print $form->select_dolusers($search[$key], 'search_'.$key, 1, null, 0, '', '', '0', 0, 0, '', 0, '', ($val['css'] ? $val['css'] : 'maxwidth125')); print '