diff --git a/htdocs/accountancy/admin/fiscalyear_card.php b/htdocs/accountancy/admin/fiscalyear_card.php index facbb5052e2..88890aa004f 100644 --- a/htdocs/accountancy/admin/fiscalyear_card.php +++ b/htdocs/accountancy/admin/fiscalyear_card.php @@ -274,23 +274,23 @@ if ($action == 'create') // Label print ''; - print $form->editfieldkey("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); + print $form->editfieldkey("Label", 'label', $object->label, $object, 1, 'alpha:32'); print ''; - print $form->editfieldval("Label", 'label', $object->label, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'alpha:32'); + print $form->editfieldval("Label", 'label', $object->label, $object, 1, 'alpha:32'); print ""; // Date start print ''; - print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); + print $form->editfieldkey("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); print ''; - print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); + print $form->editfieldval("DateStart", 'date_start', $object->date_start, $object, 1, 'datepicker'); print ''; // Date end print ''; - print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); + print $form->editfieldkey("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); print ''; - print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, $conf->global->MAIN_EDIT_ALSO_INLINE, 'datepicker'); + print $form->editfieldval("DateEnd", 'date_end', $object->date_end, $object, 1, 'datepicker'); print ''; // Statut diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 538e433cd16..4225dad5f31 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -273,7 +273,7 @@ class Adherent extends CommonObject 'zip' => array('type' => 'varchar(10)', 'label' => 'Zip', 'enabled' => 1, 'visible' => -1, 'position' => 80), 'town' => array('type' => 'varchar(50)', 'label' => 'Town', 'enabled' => 1, 'visible' => -1, 'position' => 85), 'state_id' => array('type' => 'integer', 'label' => 'State id', 'enabled' => 1, 'visible' => -1, 'position' => 90), - 'country' => array('type' => 'integer', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95), + 'country' => array('type' => 'integer:Ccountry:core/class/ccountry.class.php', 'label' => 'Country', 'enabled' => 1, 'visible' => -1, 'position' => 95), 'email' => array('type' => 'varchar(255)', 'label' => 'Email', 'enabled' => 1, 'visible' => -1, 'position' => 100), 'socialnetworks' => array('type' => 'text', 'label' => 'Socialnetworks', 'enabled' => 1, 'visible' => -1, 'position' => 105), 'phone' => array('type' => 'varchar(30)', 'label' => 'Phone', 'enabled' => 1, 'visible' => -1, 'position' => 115), diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 0a9fc7cd2c6..7ed417750a7 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -425,10 +425,9 @@ print ''; print ''; print ''; -print ''; print ''; -print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit); +print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'members', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "Information"; $modelmail = "member"; @@ -950,8 +949,6 @@ print "\n"; print ""; print ''; -if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, '', '', $limit, 1); - // End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/stats/byproperties.php b/htdocs/adherents/stats/byproperties.php index abc9b6d80a7..7927c2e3f00 100644 --- a/htdocs/adherents/stats/byproperties.php +++ b/htdocs/adherents/stats/byproperties.php @@ -58,7 +58,7 @@ llxHeader('', $langs->trans("MembersStatisticsByProperties"), '', '', 0, 0, arra $title = $langs->trans("MembersStatisticsByProperties"); -print load_fiche_titre($title, ''); +print load_fiche_titre($title, '', 'object_group'); dol_mkdir($dir); @@ -113,7 +113,8 @@ if (!count($data)) } else { - print load_fiche_titre($langs->trans("MembersByNature"), '', ''); + print $langs->trans("MembersByNature").'
'; + print '
'; } // Print array diff --git a/htdocs/adherents/stats/geo.php b/htdocs/adherents/stats/geo.php index 683ae558d28..5b51008a9a2 100644 --- a/htdocs/adherents/stats/geo.php +++ b/htdocs/adherents/stats/geo.php @@ -64,7 +64,7 @@ if ($mode == 'memberbyregion') $title = $langs->trans("MembersStatisticsByRegion llxHeader('', $title, '', '', 0, 0, $arrayjs); -print load_fiche_titre($title, $mesg); +print load_fiche_titre($title, '', 'object_group'); dol_mkdir($dir); diff --git a/htdocs/admin/const.php b/htdocs/admin/const.php index e228ab58e8a..59ac87a2c56 100644 --- a/htdocs/admin/const.php +++ b/htdocs/admin/const.php @@ -215,11 +215,11 @@ print "\n"; // Line to add new record print "\n"; -print ''."\n"; +print ''."\n"; print ''; -print ''; +print ''; print ''; -print ''; +print ''; print ''; print ''; print ''; diff --git a/htdocs/admin/events.php b/htdocs/admin/events.php index 65a03adc4f1..75976f0b07b 100644 --- a/htdocs/admin/events.php +++ b/htdocs/admin/events.php @@ -28,14 +28,26 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/agenda.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/events.class.php'; -if (!$user->admin) -accessforbidden(); +if (!$user->admin) { + accessforbidden(); +} // Load translation files required by the page $langs->loadLangs(array("users", "admin", "other")); $action = GETPOST('action', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'myobjectlist'; // To manage different context of search +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +// Load variable for pagination +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'alpha'); +$sortorder = GETPOST('sortorder', 'alpha'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; $securityevent = new Events($db); $eventstolog = $securityevent->eventstolog; @@ -44,6 +56,7 @@ $eventstolog = $securityevent->eventstolog; /* * Actions */ + if ($action == "save") { $i = 0; @@ -67,6 +80,12 @@ if ($action == "save") * View */ +$form = new Form($db); + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = ''; +$selectedfields .= $form->showCheckAddButtons('checkforselect', 1); + $wikihelp = 'EN:Setup_Security|FR:Paramétrage_Sécurité|ES:Configuración_Seguridad'; llxHeader('', $langs->trans("Audit"), $wikihelp); @@ -85,9 +104,10 @@ $head = security_prepare_head(); dol_fiche_head($head, 'audit', $langs->trans("Security"), -1); -print ""; +print '
'; print ""; -print ""; +print getTitleFieldOfList("LogEvents", 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, '')."\n"; +print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; print "\n"; // Loop on each event type foreach ($eventstolog as $key => $arr) @@ -96,10 +116,10 @@ foreach ($eventstolog as $key => $arr) { print ''; print ''; - print ''."\n"; } } @@ -109,7 +129,7 @@ dol_fiche_end(); print '
'; print "trans("Save")."\">"; -print "
"; +print ''; print "\n"; diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index f2412175880..cc2edb550a0 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -6,6 +6,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2011 Regis Houssin * Copyright (C) 2011 Juanjo Menent + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -30,6 +31,7 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/rssparser.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/infobox.class.php'; // Load translation files required by the page $langs->load("admin"); @@ -222,10 +224,13 @@ print '
'; print ''; print ''; print ''; -print '


'; +print ''; print ''; +print '

'; +print ''.$langs->trans('RssNote').' - '.$langs->trans('JumpToBoxes').''; +print '

'; $sql = "SELECT rowid, file, note FROM ".MAIN_DB_PREFIX."boxes_def"; $sql .= " WHERE file = 'box_external_rss.php'"; @@ -235,8 +240,9 @@ dol_syslog("select rss boxes", LOG_DEBUG); $resql = $db->query($sql); if ($resql) { - $num = $db->num_rows($resql); - $i = 0; + $boxlist = InfoBox::listBoxes($db, 'activated', -1, null); + $num = $db->num_rows($resql); + $i = 0; while ($i < $num) { @@ -252,32 +258,32 @@ if ($resql) $result = $rssparser->parser($conf->global->$keyrssurl, 5, 300, $conf->externalrss->dir_temp); print "
"; - print "
"; + print ''."\n"; - print '
".$langs->trans("LogEvents")."
'.$arr['id'].''; + print ''; $key = 'MAIN_LOGEVENTS_'.$arr['id']; $value = $conf->global->$key; - print ''; + print ''; print '
'; - print ''; + print '
'."\n"; + print ''."\n"; - print ""; + print ''; print ""; print ''; - print ""; + print ""."\n"; print ''; print ""; print ""; - print ""; + print ""."\n"; print ''; print ""; print ""; - print ""; + print ""."\n"; print ''; @@ -295,7 +301,7 @@ if ($resql) print ''; } print ""; - print ""; + print ""."\n"; // Logo if ($result > 0 && empty($rss->error)) @@ -309,12 +315,19 @@ if ($resql) if ($imageurl) print ''; else print $langs->trans("None"); print ''; - print ""; + print ""."\n"; } - print '
".$langs->trans("RSS")." ".($i + 1)."'; - print "trans("Modify")."\">"; + print ''; print "   "; - print "trans("Delete")."\">"; - print ""; + print ''; + print ''; print '
".$langs->trans("Title")."global->$keyrsstitle)."\">
".$langs->trans("URL")."global->$keyrssurl)."\">
'; + // Active + $active = _isInBoxList($idrss, $boxlist) ? 'yes' : 'no'; + print ''; + print ''.$langs->trans('WidgetEnabled').''; + print ''.yn($active).''; + print ""."\n"; - print ""; + print ''."\n"; + + print ""."\n"; $i++; } @@ -327,3 +340,23 @@ else // End of page llxFooter(); $db->close(); + +/** + * Check if the given RSS feed if inside the list of boxes/widgets + * + * @param int $idrss The id of the RSS feed + * @param array $boxlist A list with boxes/widgets + * @return bool true if the rss feed is inside the box/widget list, otherwise false + */ +function _isInBoxList($idrss, array $boxlist) +{ + foreach($boxlist as $box) + { + if($box->boxcode === "lastrssinfos" && strpos($box->note, $idrss) !== false) + { + return true; + } + } + + return false; +} diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index 0bb16b3cbd6..ab67974c920 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -154,8 +154,10 @@ if ($action == 'update') //dolibarr_set_const($db, "MAIN_DISABLE_JAVASCRIPT", GETPOST("MAIN_DISABLE_JAVASCRIPT", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_BUTTON_HIDE_UNAUTHORIZED", GETPOST("MAIN_BUTTON_HIDE_UNAUTHORIZED", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_START_WEEK", GETPOST("MAIN_START_WEEK", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'int'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'int'), 'chaine', 0, '', $conf->entity); + + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_DAYS", GETPOST("MAIN_DEFAULT_WORKING_DAYS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_DEFAULT_WORKING_HOURS", GETPOST("MAIN_DEFAULT_WORKING_HOURS", 'alphanohtml'), 'chaine', 0, '', $conf->entity); + dolibarr_set_const($db, "MAIN_FIRSTNAME_NAME_POSITION", GETPOST("MAIN_FIRSTNAME_NAME_POSITION", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_HELPCENTER_DISABLELINK", GETPOST('MAIN_HELPCENTER_DISABLELINK', 'aZ09'), 'chaine', 0, '', 0); // Param for all entities diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index 5a444c92ae1..339b98be44a 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -31,7 +31,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; // Load translation files required by the page -$langs->loadLangs(array('errors', 'admin')); +$langs->loadLangs(array('errors', 'admin', 'modulebuilder')); $mode = GETPOST('mode', 'alpha'); $action = GETPOST('action', 'alpha'); @@ -318,10 +318,13 @@ if ($mode == 'desc') $text .= ''.$langs->trans("Version").': '.$version; + $moduledescriptorfile = get_class($objMod).'.class.php'; + $text .= '
'.$langs->trans("DescriptorFile").': '.$moduledescriptorfile; + $textexternal = ''; if ($objMod->isCoreOrExternalModule() == 'external') { - $textexternal .= '
'.$langs->trans("Origin").': '.$langs->trans("ExternalModule", $dirofmodule); + $textexternal .= '
'.$langs->trans("Origin").': '.$langs->trans("ExternalModule").' - '.$langs->trans("InstalledInto", $dirofmodule); if ($objMod->editor_name != 'dolibarr') $textexternal .= '
'.$langs->trans("Publisher").': '.(empty($objMod->editor_name) ? $langs->trans("Unknown") : $objMod->editor_name); $editor_url = $objMod->editor_url; if (!preg_match('/^http/', $editor_url)) $editor_url = 'http://'.$editor_url; diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 9608b0270a3..926a4c34f70 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -482,8 +482,8 @@ if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouM print load_fiche_titre($langs->trans("ModulesSetup"), '', 'title_setup'); // Start to show page -if ($mode == 'common') print ''.$langs->trans("ModulesDesc")."
\n"; -if ($mode == 'commonkanban') print ''.$langs->trans("ModulesDesc")."
\n"; +if ($mode == 'common') print ''.$langs->trans("ModulesDesc", img_picto('', 'switch_off'))."
\n"; +if ($mode == 'commonkanban') print ''.$langs->trans("ModulesDesc", img_picto('', 'switch_off'))."
\n"; if ($mode == 'marketplace') print ''.$langs->trans("ModulesMarketPlaceDesc")."
\n"; if ($mode == 'deploy') print ''.$langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."
\n"; if ($mode == 'develop') print ''.$langs->trans("ModulesDevelopDesc")."
\n"; @@ -541,8 +541,8 @@ if ($mode == 'common' || $mode == 'commonkanban') $moreforfilter .= ''; $moreforfilter .= '
'; - $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition')); $moreforfilter .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=commonkanban'.$param, '', 1, array('morecss'=>'reposition')); + $moreforfilter .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-list-alt paddingleft imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.$param, '', 1, array('morecss'=>'reposition')); $moreforfilter .= '
'; $moreforfilter .= '
'.$moreinfo.'
'; @@ -868,7 +868,7 @@ if ($mode == 'common' || $mode == 'commonkanban') // Help print ''; //print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1); - print ''.img_picto($langs->trans("ClickToShowDescription"), $imginfo).''; + print ''.img_picto(($objMod->isCoreOrExternalModule() == 'external' ? $langs->trans("ExternalModule").' - ' : '').$langs->trans("ClickToShowDescription"), $imginfo).''; print ''; // Version diff --git a/htdocs/admin/notification.php b/htdocs/admin/notification.php index 88f973b8a20..99643401386 100644 --- a/htdocs/admin/notification.php +++ b/htdocs/admin/notification.php @@ -1,8 +1,9 @@ * Copyright (C) 2005-2015 Laurent Destailleur - * Copyright (C) 2013 Juanjo Menent + * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Bahfir Abbes + * Copyright (C) 2020 Thibault FOUCART * * 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 @@ -43,6 +44,32 @@ $action = GETPOST('action', 'aZ09'); * Actions */ +// Action to update or add a constant +if ($action == 'update' || $action == 'add') +{ + $constlineid = GETPOST('rowid', 'int'); + $constname=GETPOST('constname', 'alpha'); + + $constvalue=(GETPOSTISSET('constvalue_'.$constname) ? GETPOST('constvalue_'.$constname, 'alpha') : GETPOST('constvalue')); + $consttype=(GETPOSTISSET('consttype_'.$constname) ? GETPOST('consttype_'.$constname, 'alphanohtml') : GETPOST('consttype')); + $constnote=(GETPOSTISSET('constnote_'.$constname) ? GETPOST('constnote_'.$constname, 'none') : GETPOST('constnote')); + + $typetouse = empty($oldtypetonewone[$consttype]) ? $consttype : $oldtypetonewone[$consttype]; + + $res=dolibarr_set_const($db, $constname, $constvalue, $typetouse, 0, $constnote, $conf->entity); + + if (! $res > 0) $error++; + + if (! $error) + { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + if ($action == 'setvalue' && $user->admin) { $db->begin(); @@ -149,46 +176,82 @@ $title = $langs->trans("ListOfNotificationsPerUser"); if (!empty($conf->societe->enabled)) $title = $langs->trans("ListOfNotificationsPerUserOrContact"); print load_fiche_titre($title, '', ''); -print ''; -print ''; -print ''; -/*print ''; - print '';*/ -//print ''; -print "\n"; - // Load array of available notifications $notificationtrigger = new InterfaceNotification($db); $listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); -print ''; -print ''; -print '
'.$langs->trans("Label").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("NbOfTargetedContacts").'
'; -$i = 0; -foreach ($listofnotifiedevents as $notifiedevent) -{ - $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; - $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) { + // Editing global variables not related to a specific theme + $constantes=array(); + foreach ($listofnotifiedevents as $notifiedevent) + { + $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); - if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); - elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); - elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); - elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); - elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); - elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping'); - elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport'); + if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); + elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); + elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); + elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); + elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping'); + elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport'); - if ($i) print ', '; - print $label; + if ($notifiedevent['elementtype'] == 'propal') $model = 'propal_send'; + elseif ($notifiedevent['elementtype'] == 'commande') $model = 'order_send'; + elseif ($notifiedevent['elementtype'] == 'facture') $model = 'facture_send'; + elseif ($notifiedevent['elementtype'] == 'shipping') $model = 'shipping_send'; + elseif ($notifiedevent['elementtype'] == 'ficheinter') $model = 'fichinter_send'; + elseif ($notifiedevent['elementtype'] == 'expensereport') $model = 'expensereport_send'; + elseif ($notifiedevent['elementtype'] == 'order_supplier') $model = 'order_supplier_send'; + //elseif ($notifiedevent['elementtype'] == 'invoice_supplier') $model = 'invoice_supplier_send'; + elseif ($notifiedevent['elementtype'] == 'member') $model = 'member'; - $i++; + $constantes[$notifiedevent['code'].'_TEMPLATE'] = array('type'=>'emailtemplate:'.$model, 'label'=>$label); + } + + $helptext=''; + form_constantes($constantes, 0, $helptext); +} else { + print ''; + print ''; + print ''; + /*print ''; + print '';*/ + //print ''; + print "\n"; + + print ''; + print ''; + print '
'.$langs->trans("Label").''.$langs->trans("Code").''.$langs->trans("Label").''.$langs->trans("NbOfTargetedContacts").'
'; + + $i = 0; + foreach ($listofnotifiedevents as $notifiedevent) + { + $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; + $elementLabel = $langs->trans(ucfirst($notifiedevent['elementtype'])); + + if ($notifiedevent['elementtype'] == 'order_supplier') $elementLabel = $langs->trans('SupplierOrder'); + elseif ($notifiedevent['elementtype'] == 'propal') $elementLabel = $langs->trans('Proposal'); + elseif ($notifiedevent['elementtype'] == 'facture') $elementLabel = $langs->trans('Bill'); + elseif ($notifiedevent['elementtype'] == 'commande') $elementLabel = $langs->trans('Order'); + elseif ($notifiedevent['elementtype'] == 'ficheinter') $elementLabel = $langs->trans('Intervention'); + elseif ($notifiedevent['elementtype'] == 'shipping') $elementLabel = $langs->trans('Shipping'); + elseif ($notifiedevent['elementtype'] == 'expensereport') $elementLabel = $langs->trans('ExpenseReport'); + + if ($i) print ', '; + print $label; + + $i++; + } + + print '
'; } -print '
'; print '
'; print '* '.$langs->trans("GoOntoUserCardToAddMore").'
'; if (!empty($conf->societe->enabled)) print '** '.$langs->trans("GoOntoContactCardToAddMore").'
'; + print '
'; print '

'; @@ -205,10 +268,6 @@ print ''.$langs->trans("Threshold").''; print ''.''; print "\n"; -// Load array of available notifications -$notificationtrigger = new InterfaceNotification($db); -$listofnotifiedevents = $notificationtrigger->getListOfManagedEvents(); - foreach ($listofnotifiedevents as $notifiedevent) { $label = $langs->trans("Notify_".$notifiedevent['code']); //!=$langs->trans("Notify_".$notifiedevent['code'])?$langs->trans("Notify_".$notifiedevent['code']):$notifiedevent['label']; diff --git a/htdocs/admin/perms.php b/htdocs/admin/perms.php index 60bd157d283..0486edebeec 100644 --- a/htdocs/admin/perms.php +++ b/htdocs/admin/perms.php @@ -203,7 +203,7 @@ if ($result) // Show break line print ''; print ''; - print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName(); + print img_object('', $picto, 'class="pictoobjectwidth paddingright"').' '.$objMod->getName(); print ''; print ''; print ' '; @@ -218,8 +218,6 @@ if ($result) // Picto and label of module print ''; - //print img_object('', $picto, 'class="pictoobjectwidth"').' '.$objMod->getName(); - //print ' '; print ''; // Tick diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index db9a893ff9f..ce21c1f3ad8 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -401,7 +401,7 @@ function getTableColumnFunction(array $functions) * @param array $loaded A list with all loaded PHP extensions * @param array $functions A list with all PHP functions to check * - * @return array + * @return string */ function getResultColumn($name, array $activated, array $loaded, array $functions) { diff --git a/htdocs/asset/list.php b/htdocs/asset/list.php index e414193fb83..39fd0e0761d 100644 --- a/htdocs/asset/list.php +++ b/htdocs/asset/list.php @@ -328,12 +328,11 @@ print ''; print ''; print ''; -print ''; print ''; $newcardbutton = dolGetButtonTitle($langs->trans('NewAsset'), '', 'fa fa-plus-circle', dol_buildpath('/asset/card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accountancy', 0, $newcardbutton, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'accountancy', 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) $topicmail = "SendAssetsRef"; diff --git a/htdocs/barcode/codeinit.php b/htdocs/barcode/codeinit.php index dd700de8ce3..d2afa5e6871 100644 --- a/htdocs/barcode/codeinit.php +++ b/htdocs/barcode/codeinit.php @@ -253,7 +253,7 @@ if ($conf->product->enabled || $conf->product->service) $nbno = $nbtotal = 0; - print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'products'); + print load_fiche_titre($langs->trans("BarcodeInitForProductsOrServices"), '', 'product'); print '
'."\n"; $sql = "SELECT count(rowid) as nb, fk_product_type, datec"; diff --git a/htdocs/bom/bom_card.php b/htdocs/bom/bom_card.php index 1f4498cf9cc..48e9c9d965a 100644 --- a/htdocs/bom/bom_card.php +++ b/htdocs/bom/bom_card.php @@ -256,7 +256,7 @@ jQuery(document).ready(function() { // Part to create if ($action == 'create') { - print load_fiche_titre($langs->trans("NewBOM"), '', 'cubes'); + print load_fiche_titre($langs->trans("NewBOM"), '', 'bom'); print '
'; print ''; diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index 7f8826bf9e0..e2bafbecb48 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -440,12 +440,11 @@ print ''; print ''; print ''; -print ''; print ''; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/bom/bom_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $user->rights->bom->write); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cubes', 0, $newcardbutton, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'bom', 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) $topicmail = "SendBillOfMaterialsRef"; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index eb6dfaafcc6..9c0985078e7 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -144,6 +144,26 @@ class Categorie extends CommonObject 'website_page' => 'WebsitePage' ); + /** + * @var array Title Area mapping from type string + * + * @note Move to const array when PHP 5.6 will be our minimum target + */ + public static $MAP_TYPE_TITLE_AREA = array( + 'product' => 'ProductsCategoriesArea', + 'customer' => 'CustomersCategoriesArea', + 'supplier' => 'SuppliersCategoriesArea', + 'member' => 'MembersCategoriesArea', + 'contact' => 'ContactsCategoriesArea', + 'user' => 'UsersCategoriesArea', + 'account' => 'AccountsCategoriesArea', // old for bank account + 'bank_account' => 'AccountsCategoriesArea', + 'project' => 'ProjectsCategoriesArea', + 'warehouse'=> 'StocksCategoriesArea', + 'actioncomm' => 'ActioncommCategoriesArea', + 'website_page' => 'WebsitePageCategoriesArea' + ); + /** * @var array Object table mapping from type string (table llx_...) when value of key does not match table name. * @@ -291,6 +311,7 @@ class Categorie extends CommonObject if (!is_numeric($type)) $type = $this->MAP_ID[$type]; $sql = "SELECT rowid, fk_parent, entity, label, description, color, fk_soc, visible, type, ref_ext"; + $sql .= ", date_creation, tms, fk_user_creat, fk_user_modif"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie"; if ($id > 0) { @@ -315,16 +336,20 @@ class Categorie extends CommonObject $res = $this->db->fetch_array($resql); $this->id = $res['rowid']; - //$this->ref = $res['rowid']; + //$this->ref = $res['rowid']; $this->fk_parent = $res['fk_parent']; $this->label = $res['label']; $this->description = $res['description']; $this->color = $res['color']; $this->socid = $res['fk_soc']; $this->visible = $res['visible']; - $this->type = $res['type']; + $this->type = $res['type']; $this->ref_ext = $res['ref_ext']; $this->entity = $res['entity']; + $this->date_creation = $this->db->jdate($res['date_creation']); + $this->date_modification = $this->db->jdate($res['tms']); + $this->user_creation = $res['fk_user_creat']; + $this->user_modification = $res['fk_user_modif']; // Retreive all extrafield // fetch optionals attributes and labels @@ -389,7 +414,7 @@ class Categorie extends CommonObject } $this->db->begin(); - + $now = dol_now(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."categorie ("; $sql .= "fk_parent,"; $sql .= " label,"; @@ -403,7 +428,9 @@ class Categorie extends CommonObject $sql .= " type,"; $sql .= " import_key,"; $sql .= " ref_ext,"; - $sql .= " entity"; + $sql .= " entity,"; + $sql .= " date_creation,"; + $sql .= " fk_user_creat"; $sql .= ") VALUES ("; $sql .= $this->db->escape($this->fk_parent).","; $sql .= "'".$this->db->escape($this->label)."',"; @@ -417,7 +444,9 @@ class Categorie extends CommonObject $sql .= $this->db->escape($type).","; $sql .= (!empty($this->import_key) ? "'".$this->db->escape($this->import_key)."'" : 'null').","; $sql .= (!empty($this->ref_ext) ? "'".$this->db->escape($this->ref_ext)."'" : 'null').","; - $sql .= $this->db->escape($conf->entity); + $sql .= $this->db->escape($conf->entity).","; + $sql .= "'".$this->db->idate($now)."', "; + $sql .= (int) $user->id; $sql .= ")"; $res = $this->db->query($sql); @@ -515,6 +544,7 @@ class Categorie extends CommonObject } $sql .= ", visible = '".$this->db->escape($this->visible)."'"; $sql .= ", fk_parent = ".$this->fk_parent; + $sql .= ", fk_user_modif = ".(int) $user->id; $sql .= " WHERE rowid = ".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); diff --git a/htdocs/categories/info.php b/htdocs/categories/info.php new file mode 100644 index 00000000000..644886c7387 --- /dev/null +++ b/htdocs/categories/info.php @@ -0,0 +1,95 @@ + + * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2017 Ferran Marcet + * + * 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/categories/info.php + * \ingroup categories + * \brief Category info page + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + +if (!$user->rights->categorie->lire) { + accessforbidden(); +} + +// Load translation files required by the page +$langs->loadLangs(array('categories', 'sendings')); + +$socid = 0; +$id = GETPOST('id', 'int'); + +// Security check +if ($user->socid) $socid = $user->socid; +$result = restrictedArea($user, 'categorie', $id, '&category'); + +$object = new Categorie($db); +if (!$object->fetch($id) > 0) { + dol_print_error($db); + exit; +} +$type = $object->type; +if (is_numeric($type)) $type = Categorie::$MAP_ID_TO_CODE[$type]; // For backward compatibility + +/* + * View + */ + +$form = new Form($db); + +llxHeader('', $langs->trans('Categories'), ''); + +//$object->info($object->id); + +$head = categories_prepare_head($object, $type); + +$title = Categorie::$MAP_TYPE_TITLE_AREA[$type]; + +dol_fiche_head($head, 'info', $langs->trans($title), -1, 'category'); +$backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); +$linkback = ''.$langs->trans("BackToList").''; +$object->next_prev_filter = ' type = '.$type; +$object->ref = $object->label; +$morehtmlref = '
'.$langs->trans("Root").' >> '; +$ways = $object->print_all_ways(" >> ", '', 1); +foreach ($ways as $way) { + $morehtmlref .= $way."
\n"; +} +$morehtmlref .= '
'; + +dol_banner_tab($object, 'label', $linkback, ($user->socid ? 0 : 1), 'label', 'label', $morehtmlref, '&type='.$type, 0, '', '', 1); + +print '
'; +print '
'; + +print '
'; + +print '
'; +dol_print_object_info($object); +print '
'; +print '
'; + +dol_fiche_end(); + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/categories/photos.php b/htdocs/categories/photos.php index 598d060e5f6..07e5d56d268 100644 --- a/htdocs/categories/photos.php +++ b/htdocs/categories/photos.php @@ -112,20 +112,12 @@ $formother = new FormOther($db); if ($object->id) { - if ($type == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoryShort"); - elseif ($type == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoryShort"); - elseif ($type == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersCategoryShort"); - elseif ($type == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoryShort"); - elseif ($type == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort"); - elseif ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans("AccountsCategoriesShort"); - elseif ($type == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort"); - elseif ($type == Categorie::TYPE_USER) $title = $langs->trans("UsersCategoriesShort"); - else $title = $langs->trans("Category"); + $title = Categorie::$MAP_TYPE_TITLE_AREA[$type]; $head = categories_prepare_head($object, $type); - dol_fiche_head($head, 'photos', $title, -1, 'category'); + dol_fiche_head($head, 'photos', $langs->trans($title), -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = ' type = '.$object->type; diff --git a/htdocs/categories/traduction.php b/htdocs/categories/traduction.php index caf79d81e04..c3f87e404b7 100644 --- a/htdocs/categories/traduction.php +++ b/htdocs/categories/traduction.php @@ -173,15 +173,7 @@ $form = new Form($db); $formadmin = new FormAdmin($db); $formother = new FormOther($db); -if ($type == Categorie::TYPE_PRODUCT) $title = $langs->trans("ProductsCategoryShort"); -elseif ($type == Categorie::TYPE_SUPPLIER) $title = $langs->trans("SuppliersCategoryShort"); -elseif ($type == Categorie::TYPE_CUSTOMER) $title = $langs->trans("CustomersCategoryShort"); -elseif ($type == Categorie::TYPE_MEMBER) $title = $langs->trans("MembersCategoryShort"); -elseif ($type == Categorie::TYPE_CONTACT) $title = $langs->trans("ContactCategoriesShort"); -elseif ($type == Categorie::TYPE_ACCOUNT) $title = $langs->trans("AccountsCategoriesShort"); -elseif ($type == Categorie::TYPE_PROJECT) $title = $langs->trans("ProjectsCategoriesShort"); -elseif ($type == Categorie::TYPE_USER) $title = $langs->trans("UsersCategoriesShort"); -else $title = $langs->trans("Category"); +$title = Categorie::$MAP_TYPE_TITLE_AREA[$type]; $head = categories_prepare_head($object, $type); @@ -195,7 +187,7 @@ if (!empty($object->multilangs)) } } -dol_fiche_head($head, 'translation', $title, -1, 'category'); +dol_fiche_head($head, 'translation', $langs->trans($title), -1, 'category'); $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = ' type = '.$object->type; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 5b31d2285fc..d259c8ca5a5 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -207,21 +207,12 @@ $arrayofcss = array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css $helpurl = ''; llxHeader("", $langs->trans("Categories"), $helpurl, '', 0, 0, $arrayofjs, $arrayofcss); -if ($type == Categorie::TYPE_PRODUCT) { $title = $langs->trans("ProductsCategoriesArea"); $typetext = 'product'; } -elseif ($type == Categorie::TYPE_SUPPLIER) { $title = $langs->trans("SuppliersCategoriesArea"); $typetext = 'supplier'; } -elseif ($type == Categorie::TYPE_CUSTOMER) { $title = $langs->trans("CustomersCategoriesArea"); $typetext = 'customer'; } -elseif ($type == Categorie::TYPE_MEMBER) { $title = $langs->trans("MembersCategoriesArea"); $typetext = 'member'; } -elseif ($type == Categorie::TYPE_CONTACT) { $title = $langs->trans("ContactsCategoriesArea"); $typetext = 'contact'; } -elseif ($type == Categorie::TYPE_ACCOUNT) { $title = $langs->trans("AccountsCategoriesArea"); $typetext = 'bank_account'; } -elseif ($type == Categorie::TYPE_PROJECT) { $title = $langs->trans("ProjectsCategoriesArea"); $typetext = 'project'; } -elseif ($type == Categorie::TYPE_USER) { $title = $langs->trans("UsersCategoriesArea"); $typetext = 'user'; } -elseif ($type == Categorie::TYPE_WAREHOUSE) { $title = $langs->trans("StocksCategoriesArea"); $typetext = 'warehouse'; } -else { $title = $langs->trans("CategoriesArea"); $typetext = 'unknown'; } +$title = Categorie::$MAP_TYPE_TITLE_AREA[$type]; $head = categories_prepare_head($object, $type); -dol_fiche_head($head, 'card', $title, -1, 'category'); +dol_fiche_head($head, 'card', $langs->trans($title), -1, 'category'); $backtolist = (GETPOST('backtolist') ? GETPOST('backtolist') : DOL_URL_ROOT.'/categories/index.php?leftmenu=cat&type='.$type); $linkback = ''.$langs->trans("BackToList").''; $object->next_prev_filter = ' type = '.$object->type; @@ -350,7 +341,7 @@ else { $categstatic = new Categorie($db); - $fulltree = $categstatic->get_full_arbo($typetext, $object->id, 1); + $fulltree = $categstatic->get_full_arbo($type, $object->id, 1); // Load possible missing includes if ($conf->global->CATEGORY_SHOW_COUNTS) diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 9325b38cfb3..8c1e2051a81 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2017 Juanjo Menent * Copyright (C) 2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * * 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 @@ -898,25 +898,29 @@ class ActionComm extends CommonObject $error = 0; + dol_syslog(get_class($this)."::delete", LOG_DEBUG); + $this->db->begin(); - $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; - $sql .= " WHERE id=".$this->id; + // remove categorie association + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."categorie_actioncomm"; + $sql .= " WHERE fk_actioncomm=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); - $res = $this->db->query($sql); - if ($res < 0) { - $this->error = $this->db->lasterror(); - $error++; + $res = $this->db->query($sql); + if (!$res) { + $this->error = $this->db->lasterror(); + $error++; + } } + // remove actioncomm_resources if (!$error) { $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm_resources"; $sql .= " WHERE fk_actioncomm=".$this->id; - dol_syslog(get_class($this)."::delete", LOG_DEBUG); $res = $this->db->query($sql); - if ($res < 0) { + if (!$res) { $this->error = $this->db->lasterror(); $error++; } @@ -924,7 +928,7 @@ class ActionComm extends CommonObject // Removed extrafields if (!$error) { - $result = $this->deleteExtraFields(); + $result = $this->deleteExtraFields(); if ($result < 0) { $error++; @@ -932,6 +936,18 @@ class ActionComm extends CommonObject } } + // remove actioncomm + if (!$error) { + $sql = "DELETE FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE id=".$this->id; + + $res = $this->db->query($sql); + if (!$res) { + $this->error = $this->db->lasterror(); + $error++; + } + } + if (!$error) { if (!$notrigger) @@ -1381,7 +1397,7 @@ class ActionComm extends CommonObject if ($this->type_code != 'AC_OTH_AUTO') $labeltype = $langs->trans('ActionAC_MANUAL'); } - $tooltip = ''.$langs->trans('ShowAction').''; + $tooltip = ''.$langs->trans('Action').''; if (!empty($this->ref)) $tooltip .= '
'.$langs->trans('Ref').': '.$this->ref; if (!empty($label)) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 3b738452699..9f28d278ed1 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -382,7 +382,6 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; $nav = ''; @@ -443,7 +442,7 @@ if ($resql) $newcardbutton .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.sprintf("%04d%02d%02d", $tmpforcreatebutton['year'], $tmpforcreatebutton['mon'], $tmpforcreatebutton['mday']).$hourminsec.'&backtopage='.urlencode($_SERVER["PHP_SELF"].($newparam ? '?'.$newparam : ''))); } - print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit); + print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, -1 * $nbtotalofrecords, '', 0, $nav.$newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 1eadb2d0da0..8feaa5a4d93 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -34,6 +34,7 @@ $result = restrictedArea($user, 'mailing'); $sortfield = GETPOST("sortfield", 'alpha'); $sortorder = GETPOST("sortorder", 'alpha'); $limit = GETPOST('limit', 'int') ?GETPOST('limit', 'int') : $conf->liste_limit; +$optioncss = GETPOST('optioncss', 'alpha'); $page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); if (empty($page) || $page == -1 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; @@ -129,8 +130,6 @@ if ($filteremail) if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; - $sql .= $db->order($sortfield, $sortorder); - $sql .= $db->plimit($conf->liste_limit + 1, $offset); } else { @@ -141,15 +140,30 @@ else if ($search_all) $sql .= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (!$sortorder) $sortorder = "ASC"; if (!$sortfield) $sortfield = "m.rowid"; - $sql .= $db->order($sortfield, $sortorder); - $sql .= $db->plimit($conf->liste_limit + 1, $offset); } -//print $sql; -$result = $db->query($sql); -if ($result) +$sql .= $db->order($sortfield, $sortorder); + +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { - $num = $db->num_rows($result); + $resql = $db->query($sql); + $nbtotalofrecords = $db->num_rows($resql); + if (($page * $limit) > $nbtotalofrecords) // if total resultset is smaller then paging size (filtering), goto and load page 0 + { + $page = 0; + $offset = 0; + } +} + +$sql .= $db->plimit($limit + 1, $offset); +//print $sql; + +dol_syslog("comm/mailing/list.php", LOG_DEBUG); +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); $title = $langs->trans("ListOfEMailings"); if ($filteremail) $title .= ' ('.$langs->trans("SentTo", $filteremail).')'; @@ -163,17 +177,18 @@ if ($result) $i = 0; $param = "&search_all=".urlencode($search_all); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); if ($filteremail) $param .= '&filteremail='.urlencode($filteremail); - print ''; + print ''; if ($optioncss != '') print ''; print ''; print ''; print ''; print ''; - print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', $num, '', 'generic', 0, $newcardbutton); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'generic', 0, $newcardbutton, '', $limit, 0, 0, 1); $moreforfilter = ''; @@ -214,12 +229,12 @@ if ($result) while ($i < min($num, $limit)) { - $obj = $db->fetch_object($result); + $obj = $db->fetch_object($resql); $email->id = $obj->rowid; $email->ref = $obj->rowid; - print ""; + print ''; print ''; print $email->getNomUrl(1); @@ -280,7 +295,8 @@ if ($result) print ''; print ''; print ''; - $db->free($result); + + $db->free($resql); } else { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index d6e8208f792..92338ebf68e 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1513,7 +1513,6 @@ if ($action == 'create') $projectid = (!empty($objectsrc->fk_project) ? $objectsrc->fk_project : 0); $ref_client = (!empty($objectsrc->ref_client) ? $objectsrc->ref_client : ''); - $ref_int = (!empty($objectsrc->ref_int) ? $objectsrc->ref_int : ''); $soc = $objectsrc->thirdparty; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 53fa6113caa..e14e3ec8f71 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -258,7 +258,6 @@ class Propal extends CommonObject 'ref' =>array('type'=>'varchar(30)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>20), 'ref_client' =>array('type'=>'varchar(255)', 'label'=>'RefCustomer', 'enabled'=>1, 'visible'=>-1, 'position'=>22), 'ref_ext' =>array('type'=>'varchar(255)', 'label'=>'RefExt', 'enabled'=>1, 'visible'=>0, 'position'=>40), - 'ref_int' =>array('type'=>'varchar(255)', 'label'=>'RefInt', 'enabled'=>1, 'visible'=>0, 'position'=>45), // deprecated 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'position'=>23), 'fk_projet' =>array('type'=>'integer:Project:projet/class/project.class.php:1:fk_statut=1', 'label'=>'Fk projet', 'enabled'=>1, 'visible'=>-1, 'position'=>24), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7119bf2e01d..74a8ce7697f 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -494,10 +494,9 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendPropalRef"; $modelmail = "proposal_send"; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 43fed8a4e77..0fcce9ad14f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -499,13 +499,11 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; print ''; print ''; - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit); + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendOrderRef"; $modelmail = "order_send"; diff --git a/htdocs/commande/orderstoinvoice.php b/htdocs/commande/orderstoinvoice.php index 2920760b492..d47e711bc77 100644 --- a/htdocs/commande/orderstoinvoice.php +++ b/htdocs/commande/orderstoinvoice.php @@ -169,7 +169,6 @@ if (($action == 'create' || $action == 'add') && !$error) $object->note_public = trim($_POST['note_public']); $object->note = trim($_POST['note']); $object->ref_client = $_POST['ref_client']; - $object->ref_int = $_POST['ref_int']; $object->modelpdf = $_POST['model']; $object->fk_project = $_POST['projectid']; $object->cond_reglement_id = ($_POST['type'] == 3 ? 1 : $_POST['cond_reglement_id']); @@ -407,8 +406,6 @@ if ($action == 'create' && !$error) print ''; print ''."\n"; print ''; - print ''; - print ''; print ''; print ''; print ''; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 481ca2b03fe..fb97a2e9129 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1187,7 +1187,13 @@ if ($resql) $reg = array(); preg_match('/\((.+)\)/i', $objp->label, $reg); // Si texte entoure de parenthee on tente recherche de traduction if ($reg[1] && $langs->trans($reg[1]) != $reg[1]) print $langs->trans($reg[1]); - else print dol_trunc($objp->label, 40); + else { + if ($objp->label == '(payment_salary)') { + print dol_trunc($langs->trans("SalaryPayment", 40)); + } else { + print dol_trunc($objp->label, 40); + } + } //print " "; // Add links after description @@ -1195,6 +1201,7 @@ if ($resql) $cachebankaccount = array(); foreach ($links as $key=>$val) { + print ''; if ($links[$key]['type'] == 'withdraw') { $banktransferstatic->id = $links[$key]['url_id']; @@ -1540,7 +1547,7 @@ if ($resql) if ($user->rights->banque->modifier) { print 'rowid.'&id='.$objp->bankid.'&page='.$page.'">'; - print img_delete(); + print img_delete('', 'class="marginleftonly"'); print ''; } } diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index cba83d8f015..cbda53affed 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -214,6 +214,76 @@ class Account extends CommonObject */ public $date_solde; + + /** + * 'type' if the field format ('integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter]]', 'varchar(x)', 'double(24,8)', 'real', 'price', 'text', '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. + * 'enabled' is a condition when the field must be managed. + * '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' is the CSS style to use on field. For example: 'maxwidth200' + * 'help' is a string visible as a tooltip on field + * '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") + * '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), + 'ref' =>array('type'=>'varchar(12)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'showoncombobox'=>1, 'position'=>25), + 'label' =>array('type'=>'varchar(30)', 'label'=>'Label', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>30), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>35, 'index'=>1), + 'bank' =>array('type'=>'varchar(60)', 'label'=>'Bank', 'enabled'=>1, 'visible'=>-1, 'position'=>40), + 'code_banque' =>array('type'=>'varchar(128)', 'label'=>'Code banque', 'enabled'=>1, 'visible'=>-1, 'position'=>45), + 'code_guichet' =>array('type'=>'varchar(6)', 'label'=>'Code guichet', 'enabled'=>1, 'visible'=>-1, 'position'=>50), + 'number' =>array('type'=>'varchar(255)', 'label'=>'Number', 'enabled'=>1, 'visible'=>-1, 'position'=>55), + 'cle_rib' =>array('type'=>'varchar(5)', 'label'=>'Cle rib', 'enabled'=>1, 'visible'=>-1, 'position'=>60), + 'bic' =>array('type'=>'varchar(11)', 'label'=>'Bic', 'enabled'=>1, 'visible'=>-1, 'position'=>65), + 'iban_prefix' =>array('type'=>'varchar(34)', 'label'=>'Iban prefix', 'enabled'=>1, 'visible'=>-1, 'position'=>70), + 'country_iban' =>array('type'=>'varchar(2)', 'label'=>'Country iban', 'enabled'=>1, 'visible'=>-1, 'position'=>75), + 'cle_iban' =>array('type'=>'varchar(2)', 'label'=>'Cle iban', 'enabled'=>1, 'visible'=>-1, 'position'=>80), + 'domiciliation' =>array('type'=>'varchar(255)', 'label'=>'Domiciliation', 'enabled'=>1, 'visible'=>-1, 'position'=>85), + 'state_id' =>array('type'=>'integer', 'label'=>'State id', 'enabled'=>1, 'visible'=>-1, 'position'=>90), + 'fk_pays' =>array('type'=>'integer', 'label'=>'Fk pays', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>95), + 'proprio' =>array('type'=>'varchar(60)', 'label'=>'Proprio', 'enabled'=>1, 'visible'=>-1, 'position'=>100), + 'owner_address' =>array('type'=>'text', 'label'=>'Owner address', 'enabled'=>1, 'visible'=>-1, 'position'=>105), + 'courant' =>array('type'=>'smallint(6)', 'label'=>'Courant', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>110), + 'clos' =>array('type'=>'smallint(6)', 'label'=>'Clos', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>115), + 'rappro' =>array('type'=>'smallint(6)', 'label'=>'Rappro', 'enabled'=>1, 'visible'=>-1, 'position'=>120), + 'url' =>array('type'=>'varchar(128)', 'label'=>'Url', 'enabled'=>1, 'visible'=>-1, 'position'=>125), + 'account_number' =>array('type'=>'varchar(32)', 'label'=>'Account number', 'enabled'=>1, 'visible'=>-1, 'position'=>130), + 'accountancy_journal' =>array('type'=>'varchar(20)', 'label'=>'Accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>135), + 'currency_code' =>array('type'=>'varchar(3)', 'label'=>'Currency code', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>140), + 'min_allowed' =>array('type'=>'integer', 'label'=>'Min allowed', 'enabled'=>1, 'visible'=>-1, 'position'=>145), + 'min_desired' =>array('type'=>'integer', 'label'=>'Min desired', 'enabled'=>1, 'visible'=>-1, 'position'=>150), + 'comment' =>array('type'=>'text', 'label'=>'Comment', 'enabled'=>1, 'visible'=>-1, 'position'=>155), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>156), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>157), + 'fk_user_author' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'Fk user author', 'enabled'=>1, 'visible'=>-1, 'position'=>160), + 'fk_user_modif' =>array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>165), + 'note_public' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>170), + 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>1, 'visible'=>0, 'position'=>175), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'position'=>180), + 'extraparams' =>array('type'=>'varchar(255)', 'label'=>'Extraparams', 'enabled'=>1, 'visible'=>-1, 'position'=>185), + 'fk_accountancy_journal' =>array('type'=>'integer', 'label'=>'Fk accountancy journal', 'enabled'=>1, 'visible'=>-1, 'position'=>190), + ); + // END MODULEBUILDER PROPERTIES + /** * Current account */ diff --git a/htdocs/compta/bank/line.php b/htdocs/compta/bank/line.php index 515759547a6..5c64c4ee5d9 100644 --- a/htdocs/compta/bank/line.php +++ b/htdocs/compta/bank/line.php @@ -386,7 +386,7 @@ if ($result) print ''; } elseif ($links[$key]['type'] == 'payment_salary') { - print ''; + print ''; print img_object($langs->trans('ShowPaymentSalary'), 'payment').' '; print $langs->trans("SalaryPayment"); print ''; diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index d559fad2b30..313627016c8 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -333,14 +333,13 @@ print ''; print ''; print ''; -print ''; print ''; $permforcashfence = 1; $newcardbutton = dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/compta/cashcontrol/cashcontrol_card.php?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permforcashfence); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit); +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'cash-register', 0, $newcardbutton, '', $limit, 0, 0, 1); // Add code for pre mass action (confirmation or email presend form) $topicmail = "SendCashControlRef"; diff --git a/htdocs/compta/deplacement/card.php b/htdocs/compta/deplacement/card.php index de5cdb30205..463d9ea699f 100644 --- a/htdocs/compta/deplacement/card.php +++ b/htdocs/compta/deplacement/card.php @@ -439,9 +439,9 @@ elseif ($id) // Type print ''; - print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'select:types_fees'); + print $form->editfieldkey("Type", 'type', $langs->trans($object->type), $object, $user->rights->deplacement->creer, 'select:types_fees'); print ''; - print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'select:types_fees'); + print $form->editfieldval("Type", 'type', $form->cache_types_fees[$object->type], $object, $user->rights->deplacement->creer, 'select:types_fees'); print ''; // Who @@ -453,16 +453,16 @@ elseif ($id) // Date print ''; - print $form->editfieldkey("Date", 'dated', $object->date, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'datepicker'); + print $form->editfieldkey("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker'); print ''; - print $form->editfieldval("Date", 'dated', $object->date, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'datepicker'); + print $form->editfieldval("Date", 'dated', $object->date, $object, $user->rights->deplacement->creer, 'datepicker'); print ''; // Km/Price print ''; - print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'numeric:6'); + print $form->editfieldkey("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6'); print ''; - print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $conf->global->MAIN_EDIT_ALSO_INLINE && $user->rights->deplacement->creer, 'numeric:6'); + print $form->editfieldval("FeesKilometersOrAmout", 'km', $object->km, $object, $user->rights->deplacement->creer, 'numeric:6'); print ""; // Where diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 5efaed247c3..205ca88290e 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -6,7 +6,7 @@ * Copyright (C) 2012 Cedric Salvador * Copyright (C) 2013 Florian Henry * Copyright (C) 2015 Marcos García - * Copyright (C) 2017 Frédéric France + * Copyright (C) 2017-2020 Frédéric France * * 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 @@ -69,6 +69,11 @@ class FactureRec extends CommonInvoice */ public $entity; + /** + * {@inheritdoc} + */ + protected $table_ref_field = 'titre'; + public $number; public $date; public $remise; @@ -82,7 +87,14 @@ class FactureRec extends CommonInvoice public $nb_gen_done; public $nb_gen_max; + /** + * @var int Frequency + */ public $frequency; + + /** + * @var string Unit frequency + */ public $unit_frequency; public $rang; @@ -122,7 +134,7 @@ class FactureRec extends CommonInvoice */ public $fields = array( 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>10), - 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'visible'=>-1, 'position'=>15), + 'titre' =>array('type'=>'varchar(100)', 'label'=>'Titre', 'enabled'=>1, 'showoncombobox' => 1, 'visible'=>-1, 'position'=>15), 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'default'=>1, 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>20, 'index'=>1), 'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>25), 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'position'=>30), @@ -463,10 +475,9 @@ class FactureRec extends CommonInvoice * @param int $rowid Id of object to load * @param string $ref Reference of recurring invoice * @param string $ref_ext External reference of invoice - * @param int $ref_int Internal reference of other object * @return int >0 if OK, <0 if KO, 0 if not found */ - public function fetch($rowid, $ref = '', $ref_ext = '', $ref_int = '') + public function fetch($rowid, $ref = '', $ref_ext = '') { $sql = 'SELECT f.rowid, f.entity, f.titre as title, f.suspended, f.fk_soc, f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc'; $sql .= ', f.remise_percent, f.remise_absolue, f.remise'; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index d1df1d6ea24..9dc99b482ff 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -688,11 +688,10 @@ if ($resql) print ''; print ''; print ''; - print ''; print ''; print ''; - print_barre_liste($langs->trans('BillsCustomers').' '.($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit); + print_barre_liste($langs->trans('BillsCustomers').' '.($socid ? ' '.$soc->name : ''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'invoicing', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendBillRef"; $modelmail = "facture_send"; diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 4c7e0714caa..d6babe42416 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -546,8 +546,8 @@ if (!empty($conf->fournisseur->enabled) && $user->rights->fournisseur->facture-> -// Last donations -if (!empty($conf->don->enabled) && $user->rights->societe->lire) +// Latest donations +if (!empty($conf->don->enabled) && $user->rights->don->lire) { include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; diff --git a/htdocs/compta/paiement.php b/htdocs/compta/paiement.php index b4da848ea5a..4a7e387987c 100644 --- a/htdocs/compta/paiement.php +++ b/htdocs/compta/paiement.php @@ -357,11 +357,11 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie } // Invoice with Paypal transaction - // TODO add hook possibility (regis) - if (!empty($conf->paypalplus->enabled) && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && !empty($facture->ref_int)) + // TODO add hook here + if (!empty($conf->paypalplus->enabled) && $conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT && !empty($facture->ref_ext)) { if (!empty($conf->global->PAYPAL_BANK_ACCOUNT)) $accountid = $conf->global->PAYPAL_BANK_ACCOUNT; - $paymentnum = $facture->ref_int; + $paymentnum = $facture->ref_ext; } // Add realtime total information diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php index 762ebe0fbcf..5831467ce63 100644 --- a/htdocs/compta/stats/cabyprodserv.php +++ b/htdocs/compta/stats/cabyprodserv.php @@ -239,6 +239,7 @@ if ($modecompta == 'CREANCES-DETTES') } $sql .= " WHERE l.fk_facture = f.rowid"; $sql .= " AND f.fk_statut in (1,2)"; + $sql .= " AND l.product_type in (0,1)"; if (!empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) { $sql .= " AND f.type IN (0,1,2,5)"; } else { diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 8d880226ff4..7f52195297b 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1295,7 +1295,7 @@ class Contact extends CommonObject $label .= '
'; } - $label .= ''.$langs->trans("ShowContact").''; + $label .= ''.$langs->trans("Contact").''; $label .= '
'.$langs->trans("Name").': '.$this->getFullName($langs); //if ($this->civility_id) $label.= '
' . $langs->trans("Civility") . ': '.$this->civility_id; // TODO Translate cibilty_id code if (!empty($this->poste)) $label .= '
'.$langs->trans("Poste").': '.$this->poste; @@ -1348,7 +1348,7 @@ class Contact extends CommonObject } $result .= $linkstart; - if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip valigntextbottom"'), 0, 0, $notooltip ? 0 : 1); + if ($withpicto) $result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1); if ($withpicto != 2) $result .= ($maxlen ?dol_trunc($this->getFullName($langs), $maxlen) : $this->getFullName($langs)); $result .= $linkend; diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 7563013edf0..380ab05f01a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -382,10 +382,9 @@ print ''; print ''; print ''; -print ''; print ''; -print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'commercial', 0, $newcardbutton, '', $limit); +print_barre_liste($langs->trans("ListOfContracts"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $totalnboflines, 'commercial', 0, $newcardbutton, '', $limit, 0, 0, 1); $topicmail = "SendContractRef"; $modelmail = "contract"; diff --git a/htdocs/core/ajax/objectonoff.php b/htdocs/core/ajax/objectonoff.php index 1f0f6c4fcc8..dd39bce6d4e 100644 --- a/htdocs/core/ajax/objectonoff.php +++ b/htdocs/core/ajax/objectonoff.php @@ -39,9 +39,13 @@ $element = GETPOST('element', 'alpha'); $object = new GenericObject($db); // Security check -if (!empty($user->socid)) +if (!empty($user->socid)) { $socid = $user->socid; +} +if (empty($conf->global->MAIN_DIRECT_STATUS_UPDATE)) { + accessforbidden('Calling this file is allowed only when MAIN_DIRECT_STATUS_UPDATE is set'); +} /* @@ -52,20 +56,24 @@ top_httphead(); print ''."\n"; -if ($element == 'societe' && in_array($field, array('status'))) -{ - $result = restrictedArea($user, 'societe', $id); +if (in_array($field, array('status'))) { + $result = restrictedArea($user, $element, $id); } -elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) -{ +elseif ($element == 'product' && in_array($field, array('tosell', 'tobuy', 'tobatch'))) { // Special case for products $result = restrictedArea($user, 'produit|service', $id, 'product&product', '', '', 'rowid'); } -else -{ +else { accessforbidden("Bad value for combination of parameters element/field.", 0, 0, 1); exit; } // Registering new values -if (($action == 'set') && !empty($id)) - $object->setValueFrom($field, $value, $element, $id); +if (($action == 'set') && !empty($id)) { + $triggerkey = strtoupper($element).'_UPDATE'; + // Special case + if ($triggerkey == 'SOCIETE_UPDATE') { + $triggerkey = 'COMPANY_UPDATE'; + } + + $object->setValueFrom($field, $value, $element, $id, $user, $triggerkey); +} diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 18f2936e3ff..a70a2f9cafc 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -157,7 +157,6 @@ class Ccountry // extends CommonObject */ public function fetch($id, $code = '', $code_iso = '') { - global $langs; $sql = "SELECT"; $sql .= " t.rowid,"; $sql .= " t.code,"; diff --git a/htdocs/core/class/hookmanager.class.php b/htdocs/core/class/hookmanager.class.php index bffbfec9c50..e24bce5e247 100644 --- a/htdocs/core/class/hookmanager.class.php +++ b/htdocs/core/class/hookmanager.class.php @@ -149,7 +149,7 @@ class HookManager $parameters['context'] = join(':', $this->contextarray); //dol_syslog(get_class($this).'::executeHooks method='.$method." action=".$action." context=".$parameters['context']); - // Define type of hook ('output' or 'addreplace'. 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray). + // Define type of hook ('output' or 'addreplace'). Type 'returnvalue' is deprecated because a 'addreplace' hook can also return resPrint and resArray). $hooktype = 'output'; if (in_array( $method, @@ -199,6 +199,7 @@ class HookManager 'pdf_getlinetotalwithtax', 'paymentsupplierinvoices', 'printAddress', + 'printEmail', 'printSearchForm', 'printTabsHead', 'printObjectLine', diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 965bca72824..c543fd436a2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -2354,6 +2354,8 @@ class Form { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; + $num = $this->db->num_rows($result); $events = null; @@ -2882,6 +2884,7 @@ class Form if ($result) { require_once DOL_DOCUMENT_ROOT.'/product/dynamic_price/class/price_parser.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; $num = $this->db->num_rows($result); @@ -6117,6 +6120,12 @@ class Form } if ($tmpfieldstoshow) $fieldstoshow = $tmpfieldstoshow; } + else + { + // For backward compatibility + $objecttmp->fields['ref'] = array('type'=>'varchar(30)', 'label'=>'Ref', 'showoncombobox'=>1); + } + if (empty($fieldstoshow)) { if (isset($objecttmp->fields['ref'])) { @@ -7788,7 +7797,7 @@ class Form $(document).ready(function() { $("#checkallactions'.$id.'").click(function() { if($(this).is(\':checked\')){ - console.log("We check all"); + console.log("We check all '.$cssclass.'"); $(".'.$cssclass.'").prop(\'checked\', true).trigger(\'change\'); } else diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 8b1469dd446..7b689814960 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -110,7 +110,7 @@ class FormFile $maxlength = $size; - $out = "\n\n\n"; + $out = "\n\n".'
'."\n"; if (empty($title)) $title = $langs->trans("AttachANewFile"); if ($title != 'none') $out .= load_fiche_titre($title, null, null); @@ -220,11 +220,11 @@ class FormFile if (empty($sectionid)) $out .= '
'; } - $out .= "\n\n"; + $out .= "\n
\n"; if ($linkfiles) { - $out .= "\n\n"; + $out .= "\n".'
'."\n"; $langs->load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); @@ -260,7 +260,7 @@ class FormFile $out .= '
'; } - $out .= "\n\n"; + $out .= "\n
\n"; } $parameters = array('socid'=>(isset($GLOBALS['socid']) ? $GLOBALS['socid'] : ''), 'id'=>(isset($GLOBALS['id']) ? $GLOBALS['id'] : ''), 'url'=>$url, 'perm'=>$perm); @@ -1174,7 +1174,7 @@ class FormFile } // Show list of existing files - if ((empty($useinecm) || $useinecm == 6) && $title != 'none') print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles")); + if ((empty($useinecm) || $useinecm == 6) && $title != 'none') print load_fiche_titre($title ? $title : $langs->trans("AttachedFiles"), '', 'file-upload', 0, '', 'table-list-of-attached-files'); if (empty($url)) $url = $_SERVER["PHP_SELF"]; print ''."\n"; @@ -1790,7 +1790,7 @@ class FormFile print ''."\n"; // Show list of associated links - print load_fiche_titre($langs->trans("LinkedFiles")); + print load_fiche_titre($langs->trans("LinkedFiles"), '', 'external-link-square-alt', 0, '', 'table-list-of-links'); print '
'; print ''; diff --git a/htdocs/core/customreports.php b/htdocs/core/customreports.php index aa93acd4a75..8375e5f6770 100644 --- a/htdocs/core/customreports.php +++ b/htdocs/core/customreports.php @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * This tool can be included into a list page with + * Note: This tool can be included into a list page with : * define('USE_CUSTOME_REPORT_AS_INCLUDE', 1); * include DOL_DOCUMENT_ROOT.'/core/customreports.php'; */ @@ -214,6 +214,7 @@ if ($action == 'viewgraph') { } // Get all possible values of fields when a 'group by' is set, and save this into $arrayofvaluesforgroupby +// $arrayofvaluesforgroupby will be used to forge lael of each grouped series if (is_array($search_groupby) && count($search_groupby)) { foreach ($search_groupby as $gkey => $gval) { $gvalwithoutprefix = preg_replace('/^[a-z]+\./', '', $gval); @@ -260,11 +261,30 @@ if (is_array($search_groupby) && count($search_groupby)) { $keytouse = (string) $obj->val; $valuetranslated = $obj->val; } + + $regs = array(); if (!empty($object->fields[$gvalwithoutprefix]['arrayofkeyval'])) { $valuetranslated = $object->fields[$gvalwithoutprefix]['arrayofkeyval'][$obj->val]; if (is_null($valuetranslated)) $valuetranslated = $langs->transnoentitiesnoconv("UndefinedKey"); $valuetranslated = $langs->trans($valuetranslated); } + elseif (preg_match('/integer:([^:]+):([^:]+)$/', $object->fields[$gvalwithoutprefix]['type'], $regs)) { + $classname = $regs[1]; + $classpath = $regs[2]; + dol_include_once($classpath); + if (class_exists($classname)) { + $tmpobject = new $classname($db); + $tmpobject->fetch($obj->val); + foreach($tmpobject->fields as $fieldkey => $field) { + if ($field['showoncombobox']) { + $valuetranslated = $tmpobject->$fieldkey; + //if ($valuetranslated == '-') $valuetranslated = $langs->transnoentitiesnoconv("Unknown") + break; + } + } + //$valuetranslated = $tmpobject->ref.'eee'; + } + } $arrayofvaluesforgroupby['g_'.$gkey][$keytouse] = $valuetranslated; } @@ -313,7 +333,7 @@ foreach ($arrayoftype as $key => $val) { } } print $form->selectarray('objecttype', $newarrayoftype, $objecttype, 0, 0, 0, '', 1, 0, 0, '', 'minwidth200', 1); -if (empty($conf->use_javascript_ajax)) print ''; +if (empty($conf->use_javascript_ajax)) print ''; else { print '