diff --git a/.travis.yml b/.travis.yml index 1a6cae1e792..4f32a1dea43 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,7 @@ env: matrix: fast_finish: true allow_failures: + - php: 7.1 - php: nightly # FIXME #- env: DB=postgresql diff --git a/ChangeLog b/ChangeLog index 798f3ef91f4..87e7f4ba18b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -151,6 +151,9 @@ Dolibarr better: no more required, were also removed. Use this new one if you were using one of them. - The trigger that activate or close a contract line is run on a contract line, not on contract. +Dolibarr 5.0 was frozen before PHP 7.1 was released. Unit tests are successful on PHP 7.1 but we don't have enough +feedback to confirm all application is compatible. Current officiel supported PHP versions are PHP 5.3 to 7.0. + ***** ChangeLog for 4.0.3 to 4.0.2 ***** FIX: #5853 $conf->global->$calc==0 || $conf->global->$calc==1 diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index 0ca4d6f8589..77485c6d638 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -247,7 +247,7 @@ $sql.=$db->order($sortfield,$sortorder); //$sql.= $db->plimit($conf->liste_limit+1, $offset); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/dev/translation/erp_comparison_translation.txt b/dev/translation/erp_comparison_translation.txt new file mode 100644 index 00000000000..daa1bc79e92 --- /dev/null +++ b/dev/translation/erp_comparison_translation.txt @@ -0,0 +1,14 @@ + + +Term Dolibarr SAP Odoo ... +---------------------------------------------------------------------------- +Thirdparty Contact partner Partner/Contact (company) +Contact/address Contact person Partner/Contact (individual) + +Financial ?? Invoicing + +Income / Expense ?? Profit / Loss +Balance Net profit + + + diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index 47dcce5031b..e82522df26f 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -172,7 +172,7 @@ if (strlen(trim($search_pcgsubtype))) { $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/accountancy/admin/fiscalyear.php b/htdocs/accountancy/admin/fiscalyear.php index c5a1bffc694..817905f7b56 100644 --- a/htdocs/accountancy/admin/fiscalyear.php +++ b/htdocs/accountancy/admin/fiscalyear.php @@ -90,7 +90,7 @@ $sql .= " WHERE f.entity = " . $conf->entity; $sql.=$db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/admin/productaccount.php b/htdocs/accountancy/admin/productaccount.php index 69d0fdc7f94..cae9295229b 100644 --- a/htdocs/accountancy/admin/productaccount.php +++ b/htdocs/accountancy/admin/productaccount.php @@ -248,7 +248,7 @@ if (strlen(trim($search_desc))) { } $sql .= $db->order($sortfield, $sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 5e2894eb11f..15345a99b72 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -143,7 +143,7 @@ else { // List - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllBalance($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index c884c0ae3a8..56cae24cf76 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -293,7 +293,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyaccount.php b/htdocs/accountancy/bookkeeping/listbyaccount.php index ca6a3657774..61753d1c39d 100644 --- a/htdocs/accountancy/bookkeeping/listbyaccount.php +++ b/htdocs/accountancy/bookkeeping/listbyaccount.php @@ -162,7 +162,7 @@ llxHeader('', $title_page); // List -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAllByAccount($sortorder, $sortfield, 0, 0, $filter); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/bookkeeping/listbyyear.php b/htdocs/accountancy/bookkeeping/listbyyear.php index b607d055a7a..f716339bdc8 100644 --- a/htdocs/accountancy/bookkeeping/listbyyear.php +++ b/htdocs/accountancy/bookkeeping/listbyyear.php @@ -158,7 +158,7 @@ if (! empty($search_code_journal)) { * Mode List */ -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $nbtotalofrecords = $object->fetchAll($sortorder, $sortfield, 0, 0); if ($nbtotalofrecords < 0) { diff --git a/htdocs/accountancy/customer/lines.php b/htdocs/accountancy/customer/lines.php index 7882c3b9320..0e3f96a7457 100644 --- a/htdocs/accountancy/customer/lines.php +++ b/htdocs/accountancy/customer/lines.php @@ -200,7 +200,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index dbb34299104..45dac88f62d 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -220,7 +220,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture", 0) . ")"; // We don't sha $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/lines.php b/htdocs/accountancy/expensereport/lines.php index 8c47627f2f7..049e1d44687 100644 --- a/htdocs/accountancy/expensereport/lines.php +++ b/htdocs/accountancy/expensereport/lines.php @@ -178,7 +178,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/expensereport/list.php b/htdocs/accountancy/expensereport/list.php index 396095eee5a..693984432ae 100644 --- a/htdocs/accountancy/expensereport/list.php +++ b/htdocs/accountancy/expensereport/list.php @@ -208,7 +208,7 @@ $sql .= " AND er.entity IN (" . getEntity("expensereport", 0) . ")"; // We don' $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/lines.php b/htdocs/accountancy/supplier/lines.php index d4428dbcb1a..f289e0f71f9 100644 --- a/htdocs/accountancy/supplier/lines.php +++ b/htdocs/accountancy/supplier/lines.php @@ -182,7 +182,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/accountancy/supplier/list.php b/htdocs/accountancy/supplier/list.php index 2f19ff0bc75..93cdd4d48ac 100644 --- a/htdocs/accountancy/supplier/list.php +++ b/htdocs/accountancy/supplier/list.php @@ -217,7 +217,7 @@ $sql .= " AND f.entity IN (" . getEntity("facture_fourn", 0) . ")"; // We don't $sql .= $db->order($sortfield, $sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 945ed849f57..22510aed411 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -1818,18 +1818,16 @@ class Adherent extends CommonObject $langs->load("orders"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->ADHERENT_ADDON_PDF)) - { - $modele = $conf->global->ADHERENT_ADDON_PDF; - } - else - { - $modele = 'standard'; - } - } + if (! dol_strlen($modele)) { + + $modele = 'standard'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) { + $modele = $conf->global->ADHERENT_ADDON_PDF; + } + } $modelpath = "core/modules/member/doc/"; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 579c6cdf344..28968a849fc 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -250,7 +250,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records with no order and no limits -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); @@ -375,7 +375,7 @@ if (! empty($moreforfilter)) $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields -print '
'; +print '
'; print ''."\n"; print ''; if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index 078eb1e0e6f..d8116c79e94 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -110,7 +110,7 @@ if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; if ($search_amount) $sql.= natural_search('c.subscription', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 85b591f0fca..de5c0a65ca4 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -407,7 +407,7 @@ if ($rowid > 0) $sql.=" AND datefin < '".$db->idate($now)."'"; } // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $resql = $db->query($sql); diff --git a/htdocs/admin/boxes.php b/htdocs/admin/boxes.php index 9e09bf87b1d..9785e945a6a 100644 --- a/htdocs/admin/boxes.php +++ b/htdocs/admin/boxes.php @@ -329,7 +329,10 @@ print load_fiche_titre($langs->trans("BoxesAvailable")); print ''."\n"; print ''."\n"; print ''."\n"; -print '
'."\n"; + +print '
'; +print '
'."\n"; + print ''; print ''; print ''; @@ -375,6 +378,8 @@ foreach($boxtoadd as $box) } print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").'
'."\n"; +print '
'; + print '
'; print ''; print '
'."\n"; @@ -388,7 +393,9 @@ $boxactivated=InfoBox::listBoxes($db,'activated',-1,null); print "
\n\n"; print load_fiche_titre($langs->trans("BoxesActivated")); -print ''; +print '
'; +print '
'."\n"; + print ''; print ''; print ''; @@ -441,7 +448,9 @@ foreach($boxactivated as $key => $box) print ''."\n"; } -print '
'.$langs->trans("Box").''.$langs->trans("Note").'/'.$langs->trans("Parameters").'

'; +print ''; +print '
'; +print '
'; // Other parameters diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index 5749fbbb4fb..7fa47724c3d 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -182,6 +182,7 @@ print 'entity) && $debug)?'? print ''; print ''; +print '
'; print ''; print ''; print ''; @@ -297,6 +298,7 @@ if ($result) print '
'.$langs->trans("Name").'
'; +print '
'; if ($conf->use_javascript_ajax) { @@ -311,6 +313,7 @@ if ($conf->use_javascript_ajax) print "\n"; + llxFooter(); $db->close(); diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 2ca1337736e..6d8787b1677 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -557,6 +557,7 @@ if ($id == 25) if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder'); if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice'); if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty'); + if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract'); $parameters=array('elementList'=>$elementList); $reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index c9f2c57b8f2..cc8cc9b3597 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -203,7 +203,7 @@ foreach ($modulesdir as $dir) } ksort($arrayofnatures); } - + // Define array $categ with categ with at least one qualified module if ($modulequalified > 0) { @@ -319,7 +319,7 @@ if ($mode != 'marketplace') $moreforfilter.= $langs->trans('Keyword') . ': '; $moreforfilter.= ''; $moreforfilter.='
'; - $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, $search_nature, 1); + $moreforfilter.= $langs->trans('Origin') . ': '.$form->selectarray('search_nature', $arrayofnatures, dol_escape_htmltag($search_nature), 1); $moreforfilter.= '
'; if (! empty($conf->global->MAIN_FEATURES_LEVEL)) { @@ -398,7 +398,7 @@ if ($mode != 'marketplace') if ($search_keyword) { $qualified=0; - if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) + if (preg_match('/'.preg_quote($search_keyword).'/i', $modulename) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesc) || preg_match('/'.preg_quote($search_keyword).'/i', $moduledesclong) || preg_match('/'.preg_quote($search_keyword).'/i', $moduleauthor) @@ -417,7 +417,7 @@ if ($mode != 'marketplace') { //print $reg[1].'-'.dol_escape_htmltag($objMod->getPublisher()); $publisher=dol_escape_htmltag($objMod->getPublisher()); - if ($reg[1] && $reg[1] != $publisher) continue; + if ($reg[1] && dol_escape_htmltag($reg[1]) != $publisher) continue; if (! $reg[1] && ! empty($publisher)) continue; } if ($search_nature == 'core' && $objMod->isCoreOrExternalModule() == 'external') continue; @@ -496,11 +496,12 @@ if ($mode != 'marketplace') // Help print ''; $text=''; + if ($objMod->getDescLong()) $text.='
'.$objMod->getDesc().'

'.$objMod->getDescLong().'
'; else $text.='
'.$objMod->getDesc().'

'; $textexternal=''; - $imginfo="info"; + $imginfo="info"; if ($objMod->isCoreOrExternalModule() == 'external') { $imginfo="info_black"; @@ -647,6 +648,7 @@ if ($mode != 'marketplace') $text.='
'.$langs->trans("AddOtherPagesOrServices").': '; $text.=$langs->trans("DetectionNotPossible"); + print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20'); print ''; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index e023af90067..4302222630c 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -124,7 +124,7 @@ dol_fiche_head($head, 'default', $langs->trans("Security")); // Show warning about external users print info_admin(showModulesExludedForExternal($modules)).'
'."\n"; - +print '
'; print ''; // Affiche lignes des permissions @@ -215,8 +215,9 @@ if ($result) } print '
'; - print '
'; +dol_fiche_end(); + llxFooter(); $db->close(); diff --git a/htdocs/admin/system/about.php b/htdocs/admin/system/about.php index a558a473957..32532f61f50 100644 --- a/htdocs/admin/system/about.php +++ b/htdocs/admin/system/about.php @@ -86,12 +86,12 @@ if ($sfurl) } print ')'; } - print ' / GNU-GPL v3+'; } else { - print $langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").'
'; + print ' ('.$langs->trans("LastStableVersion").' : ' .$langs->trans("UpdateServerOffline").')
'; } +print ' / GNU-GPL v3+'; print ''; diff --git a/htdocs/admin/system/browser.php b/htdocs/admin/system/browser.php index 30ecc448e4d..b2b5499d298 100644 --- a/htdocs/admin/system/browser.php +++ b/htdocs/admin/system/browser.php @@ -48,6 +48,7 @@ $tmp=getBrowserInfo($_SERVER["HTTP_USER_AGENT"]); // Browser $var=true; +print '
'; print ''; print ''."\n"; $var=!$var; @@ -71,10 +72,10 @@ print ''."\n"; print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Screen").'
'; +print '
'; print '
'; - llxFooter(); $db->close(); diff --git a/htdocs/admin/system/database-tables.php b/htdocs/admin/system/database-tables.php index 31d35d3f01d..6e528c73094 100644 --- a/htdocs/admin/system/database-tables.php +++ b/htdocs/admin/system/database-tables.php @@ -81,7 +81,8 @@ else { if ($base == 1) { - print ''; + print '
'; + print '
'; print ''; print ''; print ''; @@ -134,11 +135,13 @@ else } } print '
'.$langs->trans("TableName").''.$langs->trans("Type").'
'; + print ''; } if ($base == 2) { - print ''; + print '
'; + print '
'; print ''; print ''; print ''; @@ -173,12 +176,14 @@ else } } print '
'.$langs->trans("TableName").'Nb of tuples
'; + print ''; } if ($base == 4) { // Sqlite by PDO or by Sqlite3 - print ''; + print '
'; + print '
'; print ''; print ''; print ''; @@ -207,6 +212,8 @@ else } } + print '
'.$langs->trans("TableName").''.$langs->trans("NbOfRecord").'
'; + print ''; } } diff --git a/htdocs/admin/system/database.php b/htdocs/admin/system/database.php index ff7a16d1893..c50e6ca9e4c 100644 --- a/htdocs/admin/system/database.php +++ b/htdocs/admin/system/database.php @@ -42,6 +42,7 @@ llxHeader(); print load_fiche_titre($langs->trans("InfoDatabase"),'','title_setup'); // Database +print '
'; print ''; print ''."\n"; print ''."\n"; @@ -54,14 +55,16 @@ print ''."\n"; print ''."\n"; print '
'.$langs->trans("Database").'
'.$langs->trans("Version").''.$db::LABEL.' '.$db->getVersion().'
'.$langs->trans("Password").''.pr print '
'.$langs->trans("DBStoringCharset").''.$db->getDefaultCharacterSetDatabase().'
'.$langs->trans("DBSortingCharset").''.$db->getDefaultCollationDatabase().'
'; +print '
'; // Tables print '
'; +print '
'; print ''; print ''."\n"; print ''."\n"; print '
'.$langs->trans("Tables").'
'.$langs->trans("List").'
'; - +print '
'; $listofvars=$db->getServerParametersValues(); $listofstatus=$db->getServerStatusValues(); @@ -76,6 +79,7 @@ else foreach($arraylist as $listname) { print '
'; + print '
'; print ''; print ''; print ''; @@ -120,6 +124,7 @@ else print ''."\n"; } print '
'.$langs->trans("Parameters").'
'."\n"; + print '
'; } } diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 21b79bcd7a1..3117256e3d6 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -48,6 +48,7 @@ print load_fiche_titre($title,'','title_setup'); // Version $var=true; +print '
'; print ''; print ''."\n"; $var=!$var; @@ -69,10 +70,12 @@ else } print ''."\n"; print '
'.$langs->trans("Version").''.$langs->trans("Value").'
'; +print '
'; print '
'; // Session $var=true; +print '
'; print ''; print ''."\n"; $var=!$var; @@ -107,6 +110,7 @@ foreach($_SESSION as $key => $val) } print ''."\n"; print '
'.$langs->trans("Session").''.$langs->trans("Value").'
'; +print '
'; print '
'; @@ -116,6 +120,7 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S $shmoparray=dol_listshmop(); $var=true; + print '
'; print ''; print ''; print ''; @@ -133,12 +138,14 @@ if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_S } print '
'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'
'; + print '
'; print '
'; } // Localisation $var=true; +print '
'; print ''; print ''."\n"; $var=!$var; @@ -234,6 +241,7 @@ if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_F print ''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php print '
'.$langs->trans("LocalisationDolibarrParameters").''.$langs->trans("Value").'
  => '.$langs->trans("File encoding").''.$tmp.'
'; +print '
'; print '
'; @@ -292,6 +300,7 @@ $configfileparameters=array( ); $var=true; +print '
'; print ''; print ''; print '
'.$langs->trans("Parameters").' '; @@ -353,11 +362,13 @@ foreach($configfileparameters as $key => $value) } } print '
'; +print '
'; print '
'; // Parameters in database +print '
'; print ''; print ''; print ''; @@ -407,7 +418,7 @@ if ($resql) } print '
'.$langs->trans("Parameters").' '.$langs->trans("Database").'
'; - +print '
'; llxFooter(); diff --git a/htdocs/admin/system/modules.php b/htdocs/admin/system/modules.php index d812f6c29ed..706e0215059 100644 --- a/htdocs/admin/system/modules.php +++ b/htdocs/admin/system/modules.php @@ -102,6 +102,8 @@ foreach($modulesdir as $dir) closedir($handle); } } + +print '
'; print ''; print ''; print ''; @@ -148,6 +150,7 @@ foreach($sortorder as $numero=>$name) print "\n"; } print '
'.$langs->trans("Modules").'
'; +print '
'; print '
'; sort($rights_ids); $old=''; diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index ffba92fd4fa..3e9ccbc895f 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -68,8 +68,8 @@ print '
'; $phparray=phpinfo_array(); foreach($phparray as $key => $value) { - //print load_fiche_titre($key); - print ''; + print '
'; + print '
'; print ''; //print ''; print ''; @@ -114,7 +114,9 @@ foreach($phparray as $key => $value) print ''; } } - print '
'.$langs->trans("Parameter").''.$key.'

'; + print ''; + print ''; + print '
'; } diff --git a/htdocs/admin/tools/listevents.php b/htdocs/admin/tools/listevents.php index d3691e85df9..4e0651597ee 100644 --- a/htdocs/admin/tools/listevents.php +++ b/htdocs/admin/tools/listevents.php @@ -174,6 +174,15 @@ if ($search_user) { $usefilter++; $sql.=natural_search("u.login", $search_user, if ($search_desc) { $usefilter++; $sql.=natural_search("e.description", $search_desc, 0); } if ($search_ua) { $usefilter++; $sql.=natural_search("e.user_agent", $search_ua, 0); } $sql.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +/*if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +}*/ + $sql.= $db->plimit($conf->liste_limit+1, $offset); //print $sql; $result = $db->query($sql); @@ -195,7 +204,7 @@ if ($result) $center=''.$langs->trans("Purge").''; } - print_barre_liste($langs->trans("ListOfSecurityEvents").' ('.$num.')', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, 0, 'setup'); + print_barre_liste($langs->trans("ListOfSecurityEvents"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $center, $num, $nbtotalofrecords, 'setup'); if ($action == 'purge') { @@ -204,6 +213,8 @@ if ($result) } print '
'; + + print '
'; print ''; print ''; print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"e.dateevent","","",'align="left"',$sortfield,$sortorder); @@ -303,7 +314,10 @@ if ($result) if ($usefilter) print ''; else print ''; } - print "
'.$langs->trans("NoEventFoundWithCriteria").'
'.$langs->trans("NoEventOrNoAuditSetup").'
"; + print ""; + print "
"; + + print ""; $db->free($result); } else diff --git a/htdocs/admin/triggers.php b/htdocs/admin/triggers.php index de59c9136b2..d0d3c117be6 100644 --- a/htdocs/admin/triggers.php +++ b/htdocs/admin/triggers.php @@ -52,6 +52,7 @@ $template_dir = DOL_DOCUMENT_ROOT.'/core/tpl/'; $interfaces = new Interfaces($db); $triggers = $interfaces->getTriggersList(); +print '
'; print ' @@ -78,6 +79,7 @@ foreach ($triggers as $trigger) } print '
'.$langs->trans("File").'
'; +print '
'; llxFooter(); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 305bc7cafe6..439308fcaea 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -34,7 +34,7 @@ class Login /** * Login * - * Log user with username and password + * Log user with username and password. Using method POST is recommanded for security reasons (method GET is often logged by default by web servers with parameters so with login and pass) * * @param string $login Username * @param string $password User password diff --git a/htdocs/cashdesk/affIndex.php b/htdocs/cashdesk/affIndex.php index 9235748e37c..6b1d13f719f 100644 --- a/htdocs/cashdesk/affIndex.php +++ b/htdocs/cashdesk/affIndex.php @@ -34,6 +34,8 @@ if ( $_SESSION['uid'] <= 0 ) exit; } +$langs->load("companies"); +$langs->load("compta"); $langs->load("cashdesk"); @@ -41,6 +43,8 @@ $langs->load("cashdesk"); * View */ +$form = new Form($db); + //header("Content-type: text/html; charset=UTF-8"); //header("Content-type: text/html; charset=".$conf->file->character_set_client); diff --git a/htdocs/cashdesk/affPied.php b/htdocs/cashdesk/affPied.php index b97b9108de1..efe56ac2762 100644 --- a/htdocs/cashdesk/affPied.php +++ b/htdocs/cashdesk/affPied.php @@ -22,8 +22,21 @@ */ ?> +
-use_javascript_ajax) && empty($conf->dol_no_mouse_hover)) +{ + print "\n\n"; + print '' . "\n"; +} + printCommonFooter('private'); ?>
diff --git a/htdocs/cashdesk/css/style.css b/htdocs/cashdesk/css/style.css index 2931ad7638e..ab8d660fcf1 100644 --- a/htdocs/cashdesk/css/style.css +++ b/htdocs/cashdesk/css/style.css @@ -19,7 +19,6 @@ body { color: #333; margin: 0; padding: 0; - text-align: center; } p { @@ -214,6 +213,7 @@ p.titre { .blocksellfinished { min-width: 215px; + margin-top: 8px; } .titre1 { font-weight: bold; diff --git a/htdocs/cashdesk/facturation_verif.php b/htdocs/cashdesk/facturation_verif.php index 95a129e88a5..d4bf53e01c5 100644 --- a/htdocs/cashdesk/facturation_verif.php +++ b/htdocs/cashdesk/facturation_verif.php @@ -28,11 +28,13 @@ require_once DOL_DOCUMENT_ROOT.'/cashdesk/class/Facturation.class.php'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; +$action = GETPOST('action','alpha'); + $obj_facturation = unserialize($_SESSION['serObjFacturation']); unset ($_SESSION['serObjFacturation']); -switch ( $_GET['action'] ) +switch($action) { default: if ( $_POST['hdnSource'] != 'NULL' ) @@ -162,6 +164,16 @@ switch ( $_GET['action'] ) break; + case 'change_thirdparty': // We have clicked on button "Modify" a thirdparty + $newthirdpartyid = GETPOST('CASHDESK_ID_THIRDPARTY','int'); + if ($newthirdpartyid > 0) + { + $_SESSION["CASHDESK_ID_THIRDPARTY"] = $newthirdpartyid; + } + + $redirection = DOL_URL_ROOT.'/cashdesk/affIndex.php?menutpl=facturation'; + break; + case 'ajout_article': // We have clicked on button "Add product" if (! empty($obj_facturation->id)) // A product was previously selected and stored in session, so we can add it diff --git a/htdocs/cashdesk/tpl/menu.tpl.php b/htdocs/cashdesk/tpl/menu.tpl.php index 75347427bda..85de5ad9ab5 100644 --- a/htdocs/cashdesk/tpl/menu.tpl.php +++ b/htdocs/cashdesk/tpl/menu.tpl.php @@ -23,12 +23,12 @@ include_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; include_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; -if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) +/*if (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) { $company=new Societe($db); $company->fetch($_SESSION["CASHDESK_ID_THIRDPARTY"]); $companyLink = $company->getNomUrl(1); -} +}*/ if (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) { $bankcash=new Account($db); @@ -59,6 +59,7 @@ if (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"]) && ! empty($conf->stock->enabled) $langs->load("cashdesk"); $langs->load("main"); +print "\n".''."\n"; print ''; +print "\n".''."\n"; diff --git a/htdocs/cashdesk/tpl/validation1.tpl.php b/htdocs/cashdesk/tpl/validation1.tpl.php index bb6bd92c8bd..bb3d63a9e58 100644 --- a/htdocs/cashdesk/tpl/validation1.tpl.php +++ b/htdocs/cashdesk/tpl/validation1.tpl.php @@ -18,6 +18,7 @@ $langs->load("main"); $langs->load("bills"); +$langs->load("banks"); // Object $form must de defined diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index 4904bbea3b7..1f37623544b 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -209,7 +209,7 @@ class Categories extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/categories/class/api_deprecated_category.class.php b/htdocs/categories/class/api_deprecated_category.class.php index 62f92b71bea..6f2f16bb222 100644 --- a/htdocs/categories/class/api_deprecated_category.class.php +++ b/htdocs/categories/class/api_deprecated_category.class.php @@ -124,7 +124,7 @@ class CategoryApi extends DolibarrApi $sql.= ' WHERE s.entity IN ('.getEntity('category', 1).')'; $sql.= ' AND s.type='.array_search($type,CategoryApi::$TYPES); - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); @@ -205,7 +205,7 @@ class CategoryApi extends DolibarrApi $sql.= ' AND s.rowid = sub.fk_categorie'; $sql.= ' AND sub.'.$subcol_name.' = '.$item; - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index c01e62ae3b5..0a08b6e55f1 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -245,7 +245,7 @@ if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AN if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index fdc94005cdb..97f255abe14 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -85,7 +85,7 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; $sql.= " GROUP BY year, month, df"; $sql.= " ORDER BY year DESC, month DESC, df DESC"; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 6f6a5516aab..bd559fb96a3 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -366,6 +366,21 @@ if ($id > 0) print ''; print ''; + // Max outstanding bill + if ($object->client) + { + print ''; + print ''; + print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer); + print ''; + $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; + print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); + //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); + + print ''; + print ''; + } + // Multiprice level if (! empty($conf->global->PRODUIT_MULTIPRICES)) { @@ -493,48 +508,92 @@ if ($id > 0) print '
'; + $boxstat = ''; + // Nbre max d'elements des petites listes $MAXLIST=$conf->global->MAIN_SIZE_SHORTLIST_LIMIT; // Lien recap - $outstandingBills = $object->get_OutstandingBill(); - $warn = ''; - if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingBills) + $boxstat.='
'; + $boxstat.=''; + $boxstat.='
'; + + if ($conf->propal->enabled) { - $warn = img_warning($langs->trans("OutstandingBillReached")); + // Box proposals + $tmp = $object->getOutstandingProposals(); + $outstandingOpened=$tmp['opened']; + $outstandingTotal=$tmp['total_ht']; + $outstandingTotalIncTax=$tmp['total_ttc']; + $text=$langs->trans("OverAllProposals"); + $link=''; + $icon='bill'; + if ($link) $boxstat.=''; + $boxstat.='
'; + $boxstat.=''.img_object("",$icon).' '.$text.'
'; + $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat.='
'; + if ($link) $boxstat.='
'; + } + + if ($conf->commande->enabled) + { + // Box proposals + $tmp = $object->getOutstandingOrders(); + $outstandingOpened=$tmp['opened']; + $outstandingTotal=$tmp['total_ht']; + $outstandingTotalIncTax=$tmp['total_ttc']; + $text=$langs->trans("OverAllOrders"); + $link=''; + $icon='bill'; + if ($link) $boxstat.=''; + $boxstat.='
'; + $boxstat.=''.img_object("",$icon).' '.$text.'
'; + $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat.='
'; + if ($link) $boxstat.='
'; } - print ''; - - print ''; - print ''; - print ''; - print ''; - - // Max outstanding bill - if ($object->client) + if ($conf->facture->enabled) { - print ''; - print ''; - print ''; + $tmp = $object->getOutstandingBills(); + $outstandingOpened=$tmp['opened']; + $outstandingTotal=$tmp['total_ht']; + $outstandingTotalIncTax=$tmp['total_ttc']; + + $text=$langs->trans("OverAllInvoices"); + $link=''; + $icon='bill'; + if ($link) $boxstat.=''; + $boxstat.='
'; + $boxstat.=''.img_object("",$icon).' '.$text.'
'; + $boxstat.=''.price($outstandingTotal, 1, $langs, 1, -1, -1, $conf->currency).''; + $boxstat.='
'; + if ($link) $boxstat.='
'; + + // Box outstanding bill + $warn = ''; + if ($object->outstanding_limit != '' && $object->outstanding_limit < $outstandingOpened) + { + $warn = img_warning($langs->trans("OutstandingBillReached")); + } + $text=$langs->trans("CurrentOutstandingBill"); + $link=DOL_URL_ROOT.'/compta/recap-compta.php?socid='.$object->id; + $icon='bill'; + if ($link) $boxstat.=''; + $boxstat.='
'; + $boxstat.=''.img_object("",$icon).' '.$text.'
'; + $boxstat.=''.price($outstandingOpened).$warn.''; + $boxstat.='
'; + if ($link) $boxstat.='
'; } - // Outstanding bill - print ''; - print ''; - print ''; - print ''; + $boxstat.=''; + $boxstat.='
'.$langs->trans("Summary").''.$langs->trans("ShowCustomerPreview").'
'; - print $form->editfieldkey("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer); - print ''; - $limit_field_type = (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) ? 'numeric' : 'amount'; - print $form->editfieldval("OutstandingBill",'outstanding_limit',$object->outstanding_limit,$object,$user->rights->societe->creer,$limit_field_type,($object->outstanding_limit != '' ? price($object->outstanding_limit) : '')); - //if (empty($object->outstanding_limit)) print $langs->trans("NoLimit"); - - print '
'.$langs->trans("CurrentOutstandingBill").''.price($outstandingBills).$warn.'
'; + $boxstat.=''; - print '
'; - print '
'; - + print $boxstat; + $now=dol_now(); /* @@ -776,7 +835,9 @@ if ($id > 0) print ''; print ''; - print '
'.$langs->trans("LastContracts",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllContracts").' '.$num.'
'; + print ''.$langs->trans("AllContracts").' '.$num.''; + //print ''.img_picto($langs->trans("Statistics"),'stats').''; + print ''; print ''; } $i = 0; @@ -837,7 +898,9 @@ if ($id > 0) print ''; print ''; - print ''; + print ''; print ''; $var=!$var; } @@ -1007,7 +1070,15 @@ if ($id > 0) if (! empty($conf->facture->enabled)) { - if ($user->rights->facture->creer && $object->status==1) + if (empty($user->rights->facture->creer)) + { + print ''; + } + else if ($object->status != 1) + { + print ''; + } + else { $langs->load("bills"); $langs->load("orders"); @@ -1022,10 +1093,6 @@ if ($id > 0) else print ''; } - else - { - print ''; - } } } diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index c37c61ca88c..aeaf19f8471 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -758,7 +758,7 @@ else // MAILING_NO_USING_PHPMAIL may be defined or not. // MAILING_LIMIT_SENDBYWEB is always defined to something != 0 (-1=forbidden). - // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0=no limit). + // MAILING_LIMIT_SENDBYCLI may be defined ot not (-1=forbidden, 0 or undefined=no limit). if (! empty($conf->global->MAILING_NO_USING_PHPMAIL) && $sendingmode == 'mail') { // EMailing feature may be a spam problem, so when you host several users/instance, having this option may force each user to use their own SMTP agent. @@ -772,8 +772,8 @@ else } else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); // The feature is forbidden from GUI, we show just message to use from command line. setEventMessages($langs->trans("MailingNeedCommand"), null, 'warnings'); @@ -786,8 +786,8 @@ else } else { - if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_PHPMAIL, null, 'warnings'); - if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL, null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); + if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); $text=''; if ($conf->global->MAILING_LIMIT_SENDBYCLI >= 0) diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index ab7ee3c7c8a..e104db4dcda 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -412,7 +412,7 @@ if ($object->fetch($id) >= 0) $sql .= $db->order($sortfield,$sortorder); // Count total nb of records - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index f10d82fdbfa..cf42fe3c33f 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -3434,17 +3434,15 @@ class Propal extends CommonObject $langs->load("propale"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->PROPALE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'azur'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->PROPALE_ADDON_PDF)) { $modele = $conf->global->PROPALE_ADDON_PDF; } - else - { - $modele = 'azur'; - } } $modelpath = "core/modules/propale/doc/"; diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 647ed8a7b4b..040e78b7f1a 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -333,7 +333,7 @@ $sql.= $db->order($sortfield,$sortorder); $sql.=', p.ref DESC'; // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/class/api_deprecated_commande.class.php b/htdocs/commande/class/api_deprecated_commande.class.php index 4595bdbb287..aa1584c4fed 100644 --- a/htdocs/commande/class/api_deprecated_commande.class.php +++ b/htdocs/commande/class/api_deprecated_commande.class.php @@ -139,7 +139,7 @@ class CommandeApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 1f75e6caf74..1cd706c1863 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3641,17 +3641,15 @@ class Commande extends CommonOrder $langs->load("orders"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->COMMANDE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'einstein'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->COMMANDE_ADDON_PDF)) { $modele = $conf->global->COMMANDE_ADDON_PDF; } - else - { - $modele = 'einstein'; - } } $modelpath = "core/modules/commande/doc/"; diff --git a/htdocs/commande/customer.php b/htdocs/commande/customer.php index 8190367a06a..5f9a5a570ff 100644 --- a/htdocs/commande/customer.php +++ b/htdocs/commande/customer.php @@ -97,7 +97,7 @@ $sql.= " GROUP BY s.nom"; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/commande/document.php b/htdocs/commande/document.php index 5175c4c85c5..5ce456fe8e0 100644 --- a/htdocs/commande/document.php +++ b/htdocs/commande/document.php @@ -182,6 +182,7 @@ if ($id > 0 || ! empty($ref)) else { header('Location: index.php'); + exit; } diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 6e304a019d0..662a727c88b 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -560,7 +560,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index f82177e0b21..95a5323252c 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -188,7 +188,7 @@ print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.'
'; + print ''; + print '
'.$langs->trans("LastInterventions",($num<=$MAXLIST?"":$MAXLIST)).''.$langs->trans("AllInterventions").' '.$num.''.img_picto($langs->trans("Statistics"),'stats').'
'; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print ''; @@ -196,7 +196,7 @@ print ''; print ''; for ($annee = $year_start ; $annee <= $year_end ; $annee++) { - print ''; + print ''; } print ''; @@ -218,7 +218,7 @@ for ($mois = 1 ; $mois < 13 ; $mois++) } print ""; - print '"; + print ""; + print "\n"; + print "
'.$langs->trans("Month").''.$annee.''.$annee.'
 '.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Debit").''.$langs->trans("Credit").'
 '; + print ' '; if ($encaiss[$case]>0) { print price($encaiss[$case]); diff --git a/htdocs/compta/bank/bankentries.php b/htdocs/compta/bank/bankentries.php index 5cae7aff723..54c77ed6e73 100644 --- a/htdocs/compta/bank/bankentries.php +++ b/htdocs/compta/bank/bankentries.php @@ -502,7 +502,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; $nbtotalofpages = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { @@ -621,7 +621,7 @@ if ($resql) $last_ok=1; } $i++; - $liste=''.$objr->num_releve.'   '.$liste; + $liste=''.$objr->num_releve.'   '.$liste; } if ($numr >= $nbmax) $liste="...   ".$liste; print $liste; @@ -1208,7 +1208,7 @@ if ($resql) { if ($objp->rappro) // If line not conciliated and account can be conciliated { - print ''.$objp->num_releve.''; + print ''.$objp->num_releve.''; } else if ($action == 'reconcile') { @@ -1224,7 +1224,7 @@ if ($resql) // Transaction reconciliated or edit link if ($objp->rappro && $bankaccount->canBeConciliated() > 0) // If line not conciliated and account can be conciliated { - print ''; + print ''; print img_edit(); print ''; } @@ -1232,13 +1232,13 @@ if ($resql) { if ($user->rights->banque->modifier || $user->rights->banque->consolidate) { - print ''; + print ''; print img_edit(); print ''; } else { - print ''; + print ''; print img_view(); print ''; } @@ -1252,7 +1252,7 @@ if ($resql) print ' '; if ($user->rights->banque->modifier) { - print 'rowid.'&id='.$object->id.'&page='.$page.'">'; + print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">'; print img_delete(); print ''; } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 73dd2d4f199..0e9b25c39a8 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -662,7 +662,7 @@ class Account extends CommonObject * * @param User $user Object user making action * @param int $notrigger 1=Disable triggers - * @return int <0 si ko, >0 si ok + * @return int <0 if KO, >0 if OK */ function update(User $user = null, $notrigger = 0) { diff --git a/htdocs/compta/bank/document.php b/htdocs/compta/bank/document.php index 0878474dcb5..db70acc7373 100644 --- a/htdocs/compta/bank/document.php +++ b/htdocs/compta/bank/document.php @@ -81,59 +81,13 @@ if ($id) * Actions */ -// Envoi fichier -if ($_POST["sendit"] && !empty($conf->global->MAIN_UPLOAD_DOC)) { - if ($object->fetch($id)) { - - $upload_dir = $conf->bank->dir_output . "/" . $object->ref; - - if (dol_mkdir($upload_dir) >= 0) { - $resupload = dol_move_uploaded_file($_FILES['userfile']['tmp_name'], - $upload_dir . "/" . dol_unescapefile($_FILES['userfile']['name']), - 0, 0, $_FILES['userfile']['error']); - if (is_numeric($resupload) && $resupload > 0) { - if (image_format_supported($upload_dir . "/" . $_FILES['userfile']['name']) == 1) - { - // Create thumbs - $object->addThumbs($upload_dir . "/" . $_FILES['userfile']['name']); - } - $mesg = '
' . $langs->trans("FileTransferComplete") . '
'; - } - else { - $langs->load("errors"); - if ($resupload < 0) { // Unknown error - $mesg = '
' . $langs->trans("ErrorFileNotUploaded") . '
'; - } - else if (preg_match('/ErrorFileIsInfectedWithAVirus/', - $resupload)) { // Files infected by a virus - $mesg = '
' . $langs->trans("ErrorFileIsInfectedWithAVirus") . '
'; - } - else { // Known error - $mesg = '
' . $langs->trans($resupload) . '
'; - } - } - } - } +if ($object->id > 0) +{ + $object->fetch_thirdparty(); + $upload_dir = $conf->bank->dir_output . "/" . dol_sanitizeFileName($object->ref); } -// Delete -else if ($action == 'confirm_deletefile' && $confirm == 'yes') { - if ($object->fetch($id)) { - - $upload_dir = $conf->bank->dir_output; - $file = $upload_dir . '/' . GETPOST('urlfile'); // Do not use urldecode here ($_GET and $_REQUEST are already decoded by PHP). - - $ret = dol_delete_file($file, 0, 0, 0, $object); - if ($ret) { - setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs'); - } else { - setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors'); - } - - Header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); - exit; - } -} +include_once DOL_DOCUMENT_ROOT . '/core/actions_linkedfiles.inc.php'; /* @@ -182,30 +136,12 @@ if ($id > 0 || !empty($ref)) { dol_fiche_end(); - dol_htmloutput_mesg($mesg, $mesgs); - - /* - * Confirmation suppression fichier - */ - if ($action == 'delete') { - $ret = $form->form_confirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&urlfile=' . urlencode($_GET["urlfile"]), - $langs->trans('DeleteFile'), - $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', - '', 0, 1); - if ($ret == 'html') - print '
'; - } - - // Affiche formulaire upload - $formfile = new FormFile($db); - $formfile->form_attach_new_file(DOL_URL_ROOT . '/compta/bank/document.php?id=' . $object->id, - '', 0, 0, $user->rights->banque, 50, $object); - - - // List of document + $modulepart = 'bank'; + $permission = $user->rights->banque->modifier; + $permtoedit = $user->rights->banque->modifier; $param = '&id=' . $object->id; - $formfile->list_of_documents($filearray, $object, 'bank', $param); + include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; } else { dol_print_error($db); diff --git a/htdocs/compta/bank/index.php b/htdocs/compta/bank/index.php index 82283547d99..29877302104 100644 --- a/htdocs/compta/bank/index.php +++ b/htdocs/compta/bank/index.php @@ -175,7 +175,7 @@ $sql.=$hookmanager->resPrint; $sql.= $db->order($sortfield,$sortorder); // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/bank/releve.php b/htdocs/compta/bank/releve.php index ddd86e414fa..ffadceafb2e 100644 --- a/htdocs/compta/bank/releve.php +++ b/htdocs/compta/bank/releve.php @@ -299,6 +299,7 @@ else print ''; print ""; + print '
'; print ''; print ''; print ''; @@ -348,8 +349,10 @@ else $i = 0; // Ligne Solde debut releve - print ""; - print "\n"; + print ""; + print ""; + print ''; + print "\n"; while ($i < $numrows) { @@ -552,8 +555,13 @@ else print "\n".'"; // Line Balance - print "\n\n"; - print "
'.$langs->trans("DateOperationShort").'
id."\"> ".$langs->trans("InitialBankBalance")." :".price($total)." 
".$langs->trans("InitialBankBalance")." :'.price($total).' 
'.$langs->trans("Total")." :".price($totald)."".price($totalc)."  
 ".$langs->trans("EndBankBalance")." :".price($total)." 
\n"; + print "\n
 ".$langs->trans("EndBankBalance")." :".price($total)." 
"; + print "
"; + + print "\n"; } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 7cc31e576f6..e889b4dff19 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -93,15 +93,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $head=bank_prepare_head($object); dol_fiche_head($head,'cash',$langs->trans("FinancialAccount"),0,'account'); - print ''; - $linkback = ''.$langs->trans("BackToList").''; - dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1); dol_fiche_end(); - + print '
'; + $solde = $object->solde(0); // Show next coming entries diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 91267578197..16fdc406db9 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3736,6 +3736,8 @@ else if ($id > 0 || ! empty($ref)) } else // Credit note { + $cssforamountpaymentcomplete=''; + // Total already paid back print ''; - print ''; + print ''; print ''; // Sold credit note diff --git a/htdocs/compta/facture/class/api_deprecated_invoice.class.php b/htdocs/compta/facture/class/api_deprecated_invoice.class.php index 7dd8a7ee6bc..b638a46b920 100644 --- a/htdocs/compta/facture/class/api_deprecated_invoice.class.php +++ b/htdocs/compta/facture/class/api_deprecated_invoice.class.php @@ -138,7 +138,7 @@ class InvoiceApi extends DolibarrApi $sql .= " AND sc.fk_user = ".$search_sale; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 67f58ac9875..aef95d1b0a9 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -3967,24 +3967,20 @@ class Facture extends CommonInvoice $langs->load("bills"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->FACTURE_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'crabe'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->FACTURE_ADDON_PDF)) { $modele = $conf->global->FACTURE_ADDON_PDF; } - else - { - $modele = 'crabe'; - } } $modelpath = "core/modules/facture/doc/"; - $result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); - - return $result; + return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); } /** diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 17627964362..584d3915430 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1575,7 +1575,7 @@ else $sql.= " AND f.date_when BETWEEN '".$db->idate(dol_get_first_day($year_date_when,1,false))."' AND '".$db->idate(dol_get_last_day($year_date_when,12,false))."'"; } - $nbtotalofrecords = -1; + $nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d2c20099edc..8807023784d 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -402,7 +402,7 @@ $listfield=explode(',',$sortfield); foreach ($listfield as $key => $value) $sql.= $listfield[$key].' '.$sortorder.','; $sql.= ' f.rowid DESC '; -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index 9980ea396de..aec64683e3a 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -396,7 +396,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie var form = $("#payment_form"); json["invoice_type"] = $("#invoice_type").val(); - json["amountPayment"] = $("#amountpayment").attr("value"); + json["amountPayment"] = $("#amountpayment").attr("value"); json["amounts"] = _elemToJson(form.find("input.amount")); json["remains"] = _elemToJson(form.find("input.remain")); diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index e7cd70c1e30..ae9bc315877 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -112,7 +112,7 @@ else if ($year > 0) } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 46c54d32a47..4cb63b7d905 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -186,7 +186,7 @@ else } $sql.= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php index 5bc09419666..9373527e20c 100644 --- a/htdocs/compta/prelevement/class/bonprelevement.class.php +++ b/htdocs/compta/prelevement/class/bonprelevement.class.php @@ -813,7 +813,7 @@ class BonPrelevement extends CommonObject dol_syslog(__METHOD__."::Read invoices error ".$this->db->error(), LOG_ERR); } } - + if (! $error) { require_once DOL_DOCUMENT_ROOT . '/societe/class/companybankaccount.class.php'; @@ -834,7 +834,7 @@ class BonPrelevement extends CommonObject { $bac = new CompanyBankAccount($this->db); $bac->fetch(0,$soc->id); - + if ($bac->verif() >= 1) //if (true) { @@ -867,7 +867,7 @@ class BonPrelevement extends CommonObject } $ok=0; - + // Withdraw invoices in factures_prev array $out=count($factures_prev)." invoices will be withdrawn."; //print $out."\n"; @@ -1272,7 +1272,7 @@ class BonPrelevement extends CommonObject * section Debiteur (sepa Debiteurs bloc lines) */ - $tmp_invoices = array(); + /*$tmp_invoices = array(); $sql = "SELECT f.facnumber as fac FROM ".MAIN_DB_PREFIX."prelevement_lignes as pl, ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."prelevement_facture as pf, ".MAIN_DB_PREFIX."societe as soc, ".MAIN_DB_PREFIX."c_country as p, ".MAIN_DB_PREFIX."societe_rib as rib WHERE pl.fk_prelevement_bons = ".$this->id." AND pl.rowid = pf.fk_prelevement_lignes AND pf.fk_facture = f.rowid AND soc.fk_pays = p.rowid AND soc.rowid = f.fk_soc AND rib.fk_soc = f.fk_soc AND rib.default_rib = 1"; $resql=$this->db->query($sql); @@ -1280,9 +1280,7 @@ class BonPrelevement extends CommonObject while ($objfac = $this->db->fetch_object($resql)) { $tmp_invoices[] = $objfac->fac; } - } - - $ListOfFactures = implode($tmp_invoices); + }*/ $sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,"; $sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,"; @@ -1310,7 +1308,7 @@ class BonPrelevement extends CommonObject while ($i < $num) { $obj = $this->db->fetch_object($resql); - $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $ListOfFactures, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); + $fileDebiteurSection .= $this->EnregDestinataireSEPA($obj->code, $obj->nom, $obj->address, $obj->zip, $obj->town, $obj->country_code, $obj->cb, $obj->cg, $obj->cc, $obj->somme, $obj->fac, $obj->idfac, $obj->iban, $obj->bic, $this->db->jdate($obj->datec), $obj->drum); $this->total = $this->total + $obj->somme; $i++; } diff --git a/htdocs/compta/prelevement/create.php b/htdocs/compta/prelevement/create.php index 8be897990ed..8a6f4bb7ecc 100644 --- a/htdocs/compta/prelevement/create.php +++ b/htdocs/compta/prelevement/create.php @@ -72,6 +72,7 @@ if ($action == 'create') $mesg=''; $mesg=$langs->trans("NoInvoiceCouldBeWithdrawed"); setEventMessages($mesg, null, 'errors'); + $mesg.='
'."\n"; foreach($bprev->invoice_in_error as $key => $val) { $mesg.=$val."
\n"; diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php index 77393b78f4e..92cb36059e4 100644 --- a/htdocs/compta/sociales/card.php +++ b/htdocs/compta/sociales/card.php @@ -521,9 +521,6 @@ if ($id > 0) print ''; } - // Status - //print ''; - print '
'; print $langs->trans('AlreadyPaidBack'); @@ -3751,7 +3753,7 @@ else if ($id > 0 || ! empty($ref)) else print $langs->trans('ExcessPaydBack'); print ' :' . price($sign * $resteapayeraffiche) . '' . price($sign * $resteapayeraffiche) . ' 
'.$langs->trans("Status").''.$object->getLibStatut(4, $totalpaye).'
'; print '
'; @@ -548,6 +545,8 @@ if ($id > 0) $resql = $db->query($sql); if ($resql) { + $totalpaye = 0; + $num = $db->num_rows($resql); $i = 0; $total = 0; print ''; @@ -582,8 +581,8 @@ if ($id > 0) print ''; } - if ($object->paye == 0) - { + //if ($object->status == ChargeSociales::STATUS_DRAFT) + //{ print "\n"; print "\n"; @@ -592,7 +591,7 @@ if ($id > 0) print ""; print '\n"; - } + //} print "
'.$langs->trans("None").'
".$langs->trans("AlreadyPaid")." :".price($totalpaye)."
".$langs->trans("AmountExpected")." :".price($object->amount)."
".$langs->trans("RemainderToPay")." :'.price($resteapayer)."
"; $db->free($resql); } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index 33e5110153b..04010fd3ad2 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -365,7 +365,7 @@ else } // Count total nb of records -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 3128a7612f5..daae2aa8c36 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2111,13 +2111,13 @@ else dol_print_error($db, $object->error, $object->errors); exit(); } - $fileparams = dol_most_recent_file($conf->commande->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); + $fileparams = dol_most_recent_file($conf->contrat->dir_output . '/' . $ref, preg_quote($ref, '/').'[^\-]+'); $file = $fileparams['fullname']; } print '
'; print '
'; - print load_fiche_titre($langs->trans('SendOrderByMail')); + print load_fiche_titre($langs->trans('SendContractByMail')); dol_fiche_head(''); @@ -2145,9 +2145,9 @@ else $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; if (empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__'); + $formmail->withtopic = $outputlangs->trans('SendContractRef', '__CONTRACTREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__ (__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendContractRef', '__CONTRACTREF__ (__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; @@ -2155,7 +2155,7 @@ else $formmail->withcancel = 1; // Tableau des substitutions $formmail->setSubstitFromObject($object); - $formmail->substit ['__ORDERREF__'] = $object->ref; + $formmail->substit ['__CONTRACTREF__'] = $object->ref; $custcontact = ''; $contactarr = array(); @@ -2165,7 +2165,7 @@ else { foreach ($contactarr as $contact) { - if ($contact['libelle'] == $langs->trans('TypeContact_commande_external_CUSTOMER')) { // TODO Use code and not label + if ($contact['libelle'] == $langs->trans('TypeContact_contract_external_CUSTOMER')) { // TODO Use code and not label $contactstatic = new Contact($db); $contactstatic->fetch($contact ['id']); $custcontact = $contactstatic->getFullName($langs, 1); @@ -2179,9 +2179,9 @@ else // Tableau des parametres complementaires $formmail->param['action'] = 'send'; - $formmail->param['models'] = 'order_send'; + $formmail->param['models'] = 'contract_send'; $formmail->param['models_id']=GETPOST('modelmailselected','int'); - $formmail->param['orderid'] = $object->id; + $formmail->param['contractid'] = $object->id; $formmail->param['returnurl'] = $_SERVER["PHP_SELF"] . '?id=' . $object->id; // Init list of files diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 202a3dc2a0d..c6d6c075d62 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -693,8 +693,8 @@ class Contrat extends CommonObject // fetch optionals attributes and labels $line->fetch_optionals($line->id,$extralabelsline); - $this->lines[] = $line; - $this->lines_id_index_mapper[$line->id] = key($this->lines); + $this->lines[$i] = $line; + $this->lines_id_index_mapper[$line->id] = $i; //dol_syslog("1 ".$line->desc); //dol_syslog("2 ".$line->product_desc); @@ -2199,21 +2199,19 @@ class Contrat extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) { - global $conf,$user,$langs; + global $conf,$langs; $langs->load("contracts"); - // Positionne le modele sur le nom du modele a utiliser - if (! dol_strlen($modele)) - { - if (! empty($conf->global->CONTRACT_ADDON_PDF)) - { + if (! dol_strlen($modele)) { + + $modele = 'strato'; + + if ($this->modelpdf) { + $modele = $this->modelpdf; + } elseif (! empty($conf->global->CONTRACT_ADDON_PDF)) { $modele = $conf->global->CONTRACT_ADDON_PDF; } - else - { - $modele = 'strato'; - } } $modelpath = "core/modules/contract/doc/"; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 8a8ff68097a..849a466e18d 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -288,7 +288,7 @@ if ($result) $totalnboflines = $db->num_rows($result); } -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/contrat/services.php b/htdocs/contrat/services.php index 4fc2f9f53c3..42ff4b04e83 100644 --- a/htdocs/contrat/services.php +++ b/htdocs/contrat/services.php @@ -236,7 +236,7 @@ if (! empty($filter_op2) && $filter_op2 != -1 && $filter_date2 != '') $sql.= " A if (! empty($filter_opcloture) && $filter_opcloture != -1 && $filter_datecloture != '') $sql.= " AND cd.date_cloture ".$filter_opcloture." '".$db->idate($filter_datecloture)."'"; $sql .= $db->order($sortfield,$sortorder); -$nbtotalofrecords = -1; +$nbtotalofrecords = ''; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 9ec3bfcb3b7..28799231fdd 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -337,24 +337,27 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO } // Initialisation of datas - $object->socid = $sendtosocid; // To link to a company - $object->sendtoid = $sendtoid; // To link to a contact/address - $object->actiontypecode = $actiontypecode; - $object->actionmsg = $actionmsg; // Long text - $object->actionmsg2 = $actionmsg2; // Short text - $object->trackid = $trackid; - $object->fk_element = $object->id; - $object->elementtype = $object->element; - - // Call of triggers - include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - $interface=new Interfaces($db); - $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); - if ($result < 0) { - $error++; $errors=$interface->errors; + if (is_object($object)) + { + $object->socid = $sendtosocid; // To link to a company + $object->sendtoid = $sendtoid; // To link to a contact/address + $object->actiontypecode = $actiontypecode; + $object->actionmsg = $actionmsg; // Long text + $object->actionmsg2 = $actionmsg2; // Short text + $object->trackid = $trackid; + $object->fk_element = $object->id; + $object->elementtype = $object->element; + + // Call of triggers + include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + $interface=new Interfaces($db); + $result=$interface->run_triggers($trigger_name,$object,$user,$langs,$conf); + if ($result < 0) { + $error++; $errors=$interface->errors; + } + // End call of triggers } - // End call of triggers - + if ($error) { dol_print_error($db); diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 22f4e45c25f..396952ace9c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -371,7 +371,9 @@ class CMailFile { // Use Swift Mailer library // ------------------------------------------ - + + $host = dol_getprefix('email'); + require_once DOL_DOCUMENT_ROOT.'/includes/swiftmailer/lib/swift_required.php'; // Create the message $this->message = Swift_Message::newInstance(); @@ -379,7 +381,7 @@ class CMailFile // Adding a trackid header to a message $headers = $this->message->getHeaders(); $headers->addTextHeader('X-Dolibarr-TRACKID', $trackid); - $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $conf->global->MAIN_MAIL_SMTP_SERVER; + $headerID = time() . '.swiftmailer-dolibarr-' . $trackid . '@' . $host; $msgid = $headers->get('Message-ID'); $msgid->setId($headerID); $headers->addIdHeader('References', $headerID); diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index 30ea6639196..05cf0b4c3cb 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -233,7 +233,7 @@ abstract class CommonInvoice extends CommonObject * @param int $status Id status * @param int $mode 0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=short label + picto * @param integer $alreadypaid 0=No payment already done, >0=Some payments were already done (we recommand to put here amount payed if you have it, 1 otherwise) - * @param int $type Type facture + * @param int $type Type invoice * @return string Libelle du statut */ function LibStatut($paye,$status,$mode=0,$alreadypaid=-1,$type=0) @@ -255,8 +255,8 @@ abstract class CommonInvoice extends CommonObject } else { - if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); - elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted'); + if ($type == 2) return $langs->trans('Bill'.$prefix.'StatusPaidBackOrConverted'); // credit note + elseif ($type == 3) return $langs->trans('Bill'.$prefix.'StatusConverted'); // deposit invoice else return $langs->trans('Bill'.$prefix.'StatusPaid'); } } @@ -340,7 +340,11 @@ abstract class CommonInvoice extends CommonObject if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut7'); - if ($alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); + if ($alreadypaid <= 0) + { + if ($type == 2) return ''.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' '.img_picto($langs->trans('StatusNotRefunded'),'statut1'); + return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); + } return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); } else diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index db3be3bc4ac..a49a2f1af00 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -942,18 +942,26 @@ abstract class CommonObject $result=array(); $i=0; + //cas particulier pour les expeditions + if($this->element=='shipping' && $this->origin_id != 0) { + $id=$this->origin_id; + $element='commande'; + } else { + $id=$this->id; + $element=$this->element; + } $sql = "SELECT ec.fk_socpeople"; $sql.= " FROM ".MAIN_DB_PREFIX."element_contact as ec,"; if ($source == 'internal') $sql.= " ".MAIN_DB_PREFIX."user as c,"; if ($source == 'external') $sql.= " ".MAIN_DB_PREFIX."socpeople as c,"; $sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc"; - $sql.= " WHERE ec.element_id = ".$this->id; + $sql.= " WHERE ec.element_id = ".$id; $sql.= " AND ec.fk_socpeople = c.rowid"; if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")"; if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe', 1).")"; $sql.= " AND ec.fk_c_type_contact = tc.rowid"; - $sql.= " AND tc.element = '".$this->element."'"; + $sql.= " AND tc.element = '".$element."'"; $sql.= " AND tc.source = '".$source."'"; $sql.= " AND tc.code = '".$code."'"; $sql.= " AND tc.active = 1"; @@ -3020,9 +3028,16 @@ abstract class CommonObject foreach ($this->lines as $line) { - - $totalOrdered+=$line->qty_asked; // defined for shipment only - $totalToShip+=$line->qty_shipped; // defined for shipment only + if (isset($line->qty_asked)) + { + if (empty($totalOrdered)) $totalOrdered=0; // Avoid warning because $totalOrdered is '' + $totalOrdered+=$line->qty_asked; // defined for shipment only + } + if (isset($line->qty_shipped)) + { + if (empty($totalToShip)) $totalToShip=0; // Avoid warning because $totalToShip is '' + $totalToShip+=$line->qty_shipped; // defined for shipment only + } // Define qty, weight, volume, weight_units, volume_units if ($this->element == 'shipping') $qty=$line->qty_shipped; // for shipments @@ -3037,8 +3052,11 @@ abstract class CommonObject if (! empty($weight_units)) $weightUnit = $weight_units; if (! empty($volume_units)) $volumeUnit = $volume_units; + if (empty($totalWeight)) $totalWeight=0; // Avoid warning because $totalWeight is '' + if (empty($totalVolume)) $totalVolume=0; // Avoid warning because $totalVolume is '' + //var_dump($line->volume_units); - if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($weight_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { $trueWeightUnit=pow(10, $weightUnit); $totalWeight += $weight * $qty * $trueWeightUnit; @@ -3047,7 +3065,7 @@ abstract class CommonObject { $totalWeight += $weight * $qty; // This may be wrong if we mix different units } - if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit) > 50 means an exotic unit (like inch) + if ($volume_units < 50) // >50 means a standard unit (power of 10 of official unit), > 50 means an exotic unit (like inch) { //print $line->volume."x".$line->volume_units."x".($line->volume_units < 50)."x".$volumeUnit; $trueVolumeUnit=pow(10, $volumeUnit); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 591402bbdea..e4049dd85ff 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5658,10 +5658,15 @@ class Form //print "paramid=$paramid,morehtml=$morehtml,shownav=$shownav,$fieldid,$fieldref,$morehtmlref,$moreparam"; $object->load_previous_next_ref((isset($object->next_prev_filter)?$object->next_prev_filter:''),$fieldid,$nodbprefix); - //$previous_ref = $object->ref_previous?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Previous"),'previous.png'):' ').'':''; - //$next_ref = $object->ref_next?''.(empty($conf->dol_use_jmobile)?img_picto($langs->trans("Next"),'next.png'):' ').'':''; - $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; - $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; + $navurl = $_SERVER["PHP_SELF"]; + // Special case for project/task page + if ($paramid == 'project_ref') + { + $navurl = preg_replace('/\/tasks\/(task|contact|time|note|document).php/','/tasks.php',$navurl); + $paramid='ref'; + } + $previous_ref = $object->ref_previous?''.(($conf->dol_use_jmobile != 4)?'<':' ').'':''.(($conf->dol_use_jmobile != 4)?'<':' ').''; + $next_ref = $object->ref_next?''.(($conf->dol_use_jmobile != 4)?'>':' ').'':''.(($conf->dol_use_jmobile != 4)?'>':' ').''; //print "xx".$previous_ref."x".$next_ref; $ret.='
'; diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index cd56b4d0b59..b6aad949b64 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -76,7 +76,7 @@ class FormFile global $conf,$langs, $hookmanager; $hookmanager->initHooks(array('formfile')); - + if (! empty($conf->browser->layout) && $conf->browser->layout != 'classic') $useajax=0; if ((! empty($conf->global->MAIN_USE_JQUERY_FILEUPLOAD) && $useajax) || ($useajax==2)) @@ -275,7 +275,7 @@ class FormFile if (0 !== $iconPDF) { dol_syslog(__METHOD__ . ": passing iconPDF parameter is deprecated", LOG_WARNING); } - + global $langs, $conf, $user, $hookmanager; global $form, $bc; @@ -287,7 +287,7 @@ class FormFile if (! empty($iconPDF)) { return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir); } - + $printer=0; if (in_array($modulepart,array('facture','supplier_proposal','propal','proposal','order','commande','expedition', 'commande_fournisseur', 'expensereport'))) // The direct print feature is implemented only for such elements { @@ -559,7 +559,7 @@ class FormFile $addcolumforpicto=($delallowed || $printer || $morepicto); $out.= ''; - + // Model if (! empty($modellist)) { @@ -1116,10 +1116,11 @@ class FormFile $minifile=getImageFileNameForSize($file['name'], '_mini'); // For new thumbs using same ext (in lower case howerver) than original if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // For backward compatibility of old thumbs that were created with filename in lower case and with .png extension //print $file['path'].'/'.$minifile.'
'; + $urlforhref=getAdvancedPreviewUrl($modulepart, $relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); - if (empty($urlforhref)) $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); + if (empty($urlforhref)) $urlforhref=DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&entity='.(!empty($object->entity)?$object->entity:$conf->entity).'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])); print ''; - print ''; + print ''; print ''; } else print ' '; diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 4ac3eb99c50..9cb402cfc89 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -37,8 +37,8 @@ */ class FormOther { - var $db; - var $error; + private $db; + public $error; /** diff --git a/htdocs/core/class/smtps.class.php b/htdocs/core/class/smtps.class.php index 083bec812fa..e7c7b343ac9 100644 --- a/htdocs/core/class/smtps.class.php +++ b/htdocs/core/class/smtps.class.php @@ -1217,7 +1217,7 @@ class SMTPs $host=preg_replace('@tcp://@i','',$host); // Remove prefix $host=preg_replace('@ssl://@i','',$host); // Remove prefix - $host=dol_getprefix('email').'-'.$host; + $host=dol_getprefix('email'); //NOTE: Message-ID should probably contain the username of the user who sent the msg $_header .= 'Subject: ' . $this->getSubject() . "\r\n"; diff --git a/htdocs/core/lib/bank.lib.php b/htdocs/core/lib/bank.lib.php index 74078740080..47d3539e3ba 100644 --- a/htdocs/core/lib/bank.lib.php +++ b/htdocs/core/lib/bank.lib.php @@ -197,9 +197,10 @@ function checkBanForAccount($account) $rib = strtr($rib, "abcdefghijklmnopqrstuvwxyz", "12345678912345678923456789"); // Separation du rib en 3 groupes de 7 + 1 groupe de 2. // Multiplication de chaque groupe par les coef du tableau + for ($i = 0, $s = 0; $i < 3; $i++) { $code = substr($rib, 7 * $i, 7); - $s += (0 + $code) * $coef[$i]; + $s += (0 + (int) $code) * $coef[$i]; } // Soustraction du modulo 97 de $s a 97 pour obtenir la cle $cle_rib = 97 - ($s % 97); diff --git a/htdocs/core/lib/cron.lib.php b/htdocs/core/lib/cron.lib.php index aade8149ce5..3392785a571 100644 --- a/htdocs/core/lib/cron.lib.php +++ b/htdocs/core/lib/cron.lib.php @@ -92,14 +92,16 @@ function dol_print_cron_urls() //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current // Cron launch + print '
'; print ''.$langs->trans("URLToLaunchCronJobs").':
'; $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login; print img_picto('','object_globe.png').' '.$url."
\n"; print ' '.$langs->trans("OrToLaunchASpecificJob").'
'; $url=$urlwithroot.'/public/cron/cron_run_jobs.php?'.(empty($conf->global->CRON_KEY)?'':'securitykey='.$conf->global->CRON_KEY.'&').'userlogin='.$user->login.'&id=cronjobid'; print img_picto('','object_globe.png').' '.$url."
\n"; - print '
'; - + print '
'; + print '
'; + $logintouse = 'firstadmin'; if ($user->admin) $logintouse = $user->login; @@ -110,21 +112,24 @@ function dol_print_cron_urls() print '
'; // Add note - $linuxlike=1; - if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; - if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; - print $langs->trans("Note").': '; - if ($linuxlike) + if (empty($conf->global->CRON_DISABLE_TUTORIAL_CRON)) { - print $langs->trans("CronExplainHowToRunUnix"); - print '
'; - print '
'; + $linuxlike=1; + if (preg_match('/^win/i',PHP_OS)) $linuxlike=0; + if (preg_match('/^mac/i',PHP_OS)) $linuxlike=0; + print $langs->trans("Note").': '; + if ($linuxlike) + { + print $langs->trans("CronExplainHowToRunUnix"); + print '
'; + print '
'; + } + else + { + print $langs->trans("CronExplainHowToRunWin"); + } } - else - { - print $langs->trans("CronExplainHowToRunWin"); - } - + return 0; } diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index a0d61144582..202a598d8ae 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -171,11 +171,11 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt if ($format == 'all' || $format == 'allwithouthour' || $format == 'allhour' || $format == 'allhourmin') { - if ($iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US + if ((int) $iSecond === 0) return '0'; // This is to avoid having 0 return a 12:00 AM for en_US $sTime=''; $sDay=0; - $sWeek=''; + $sWeek=0; if ($iSecond >= $lengthOfDay) { @@ -218,7 +218,7 @@ function convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengt } if ($format == 'allhourmin') { - return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))); + return sprintf("%02d",($sWeek*$lengthOfWeek*24 + $sDay*24 + (int) floor($iSecond/3600))).':'.sprintf("%02d",((int) floor(($iSecond % 3600)/60))); } if ($format == 'allhour') { diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index d097cc484ba..c1aadd3df6d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1289,21 +1289,19 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio } } elseif ($link) { - if (dol_mkdir($upload_dir) >= 0) { - require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; - $linkObject = new Link($db); - $linkObject->entity = $conf->entity; - $linkObject->url = $link; - $linkObject->objecttype = GETPOST('objecttype', 'alpha'); - $linkObject->objectid = GETPOST('objectid', 'int'); - $linkObject->label = GETPOST('label', 'alpha'); - $res = $linkObject->create($user); - $langs->load('link'); - if ($res > 0) { - setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); - } else { - setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors'); - } + require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php'; + $linkObject = new Link($db); + $linkObject->entity = $conf->entity; + $linkObject->url = $link; + $linkObject->objecttype = GETPOST('objecttype', 'alpha'); + $linkObject->objectid = GETPOST('objectid', 'int'); + $linkObject->label = GETPOST('label', 'alpha'); + $res = $linkObject->create($user); + $langs->load('link'); + if ($res > 0) { + setEventMessages($langs->trans("LinkComplete"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("ErrorFileNotLinked"), null, 'errors'); } } else diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 3cb4cc31093..874722def2e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -967,7 +967,7 @@ function dol_get_fiche_end($notab=0) * @param int $nodbprefix Do not include DB prefix to forge table name * @param string $morehtmlleft More html code to show before ref * @param string $morehtmlstatus More html code to show under navigation arrows - * @param int $onlybanner Put this to 1, if the card will contains only a banner + * @param int $onlybanner Put this to 1, if the card will contains only a banner (add css 'arearefnobottom' on div) * @param string $morehtmlright More html code to show before navigation arrows * @return void */ @@ -3184,7 +3184,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', * @param string $sortorder Order to sort ('' by default) * @param string $center String in the middle ('' by default). We often find here string $massaction comming from $form->selectMassAction() * @param int $num Number of records found by select with limit+1 - * @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to not show number. + * @param int|string $totalnboflines Total number of records/lines for all pages (if known). Use a negative value of number to not show number. Use '' if unknown. * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param string $morehtml More html to show @@ -3193,7 +3193,7 @@ function load_fiche_titre($titre, $morehtmlright='', $picto='title_generic.png', * @param int $hideselectlimit Force to hide select limit * @return void */ -function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines=-1, $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) +function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $sortorder='', $center='', $num=-1, $totalnboflines='', $picto='title_generic.png', $pictoisfullpath=0, $morehtml='', $morecss='', $limit=-1, $hideselectlimit=0) { global $conf,$langs; @@ -3223,7 +3223,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so print ''; if ($picto && $titre) print img_picto('', $picto, 'class="hideonsmartphone valignmiddle" id="pictotitle"', $pictoisfullpath); print '
'.$titre; - if (!empty($titre) && $savtotalnboflines >= 0) print ' ('.$totalnboflines.')'; + if (!empty($titre) && $savtotalnboflines >= 0 && (string) $savtotalnboflines != '') print ' ('.$totalnboflines.')'; print '
'; // Center @@ -3316,7 +3316,7 @@ function print_fleche_navigation($page, $file, $options='', $nextpage=0, $betwee if (! empty($conf->global->MAIN_PAGESIZE_CHOICES)) $pagesizechoices=$conf->global->MAIN_PAGESIZE_CHOICES; print '