diff --git a/htdocs/api/class/api_access.class.php b/htdocs/api/class/api_access.class.php index 541682101c6..f246b20680c 100644 --- a/htdocs/api/class/api_access.class.php +++ b/htdocs/api/class/api_access.class.php @@ -113,15 +113,15 @@ class DolibarrApiAccess implements iAuthenticate $sql = "SELECT u.login, u.datec, u.api_key, "; $sql .= " u.tms as date_modification, u.entity"; $sql .= " FROM ".MAIN_DB_PREFIX."user as u"; - $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."'"; - // TODO Check if 2 users has same API key. + $sql .= " WHERE u.api_key = '".$this->db->escape($api_key)."' OR u.api_key = '".$this->db->escape(dolEncrypt($api_key, '', '', 'dolibarr'))."'"; $result = $this->db->query($sql); if ($result) { - if ($this->db->num_rows($result)) { + $nbrows = $this->db->num_rows($result); + if ($nbrows == 1) { $obj = $this->db->fetch_object($result); $login = $obj->login; - $stored_key = $obj->api_key; + $stored_key = dolDecrypt($obj->api_key); $userentity = $obj->entity; if (!defined("DOLENTITY") && $conf->entity != ($obj->entity ? $obj->entity : 1)) { // If API was not forced with HTTP_DOLENTITY, and user is on another entity, so we reset entity to entity of user @@ -130,6 +130,8 @@ class DolibarrApiAccess implements iAuthenticate dol_syslog("Entity was not set on http header with HTTP_DOLAPIENTITY (recommanded for performance purpose), so we switch now on entity of user (".$conf->entity.") and we have to reload configuration.", LOG_WARNING); $conf->setValues($this->db); } + } elseif ($nbrows > 1) { + throw new RestException(503, 'Error when fetching user api_key : More than 1 user with this apikey'); } } else { throw new RestException(503, 'Error when fetching user api_key :'.$this->db->error_msg); diff --git a/htdocs/api/class/api_login.class.php b/htdocs/api/class/api_login.class.php index 0b8d3e64828..7cad862b3be 100644 --- a/htdocs/api/class/api_login.class.php +++ b/htdocs/api/class/api_login.class.php @@ -18,6 +18,7 @@ use Luracast\Restler\RestException; +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/user.class.php'; /** @@ -152,7 +153,7 @@ class Login // We store API token into database $sql = "UPDATE ".MAIN_DB_PREFIX."user"; - $sql .= " SET api_key = '".$this->db->escape($token)."'"; + $sql .= " SET api_key = '".$this->db->escape(dolEncrypt($token, '', '', 'dolibarr'))."'"; $sql .= " WHERE login = '".$this->db->escape($login)."'"; dol_syslog(get_class($this)."::login", LOG_DEBUG); // No log diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index a36f944d6c5..f0354cba285 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -155,9 +155,6 @@ if (!empty($conf->global->AGENDA_REMINDER_EMAIL)) { $TDurationTypes = array('y'=>$langs->trans('Years'), 'm'=>$langs->trans('Month'), 'w'=>$langs->trans('Weeks'), 'd'=>$langs->trans('Days'), 'h'=>$langs->trans('Hours'), 'i'=>$langs->trans('Minutes')); $result = restrictedArea($user, 'agenda', $object->id, 'actioncomm&societe', 'myactions|allactions', 'fk_soc', 'id'); -if ($user->socid && $socid) { - $result = restrictedArea($user, 'societe', $socid); -} $usercancreate = $user->hasRight('agenda', 'allactions', 'create') || (($object->authorid == $user->id || $object->userownerid == $user->id) && $user->rights->agenda->myactions->create); diff --git a/htdocs/comm/propal/agenda.php b/htdocs/comm/propal/agenda.php index cb321ebfde7..9b9e396ee26 100644 --- a/htdocs/comm/propal/agenda.php +++ b/htdocs/comm/propal/agenda.php @@ -1,6 +1,5 @@ - * Copyright (C) ---Put here your own copyright and developer email--- +/* Copyright (C) 2023 Laurent Destailleur * * 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 @@ -71,7 +70,7 @@ if (!$sortorder) { $object = new Propal($db); $extrafields = new ExtraFields($db); $diroutputmassaction = $conf->propal->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; -$hookmanager->initHooks(array('myobjectagenda', 'globalcard')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('propalagenda', 'globalcard')); // Note that conf->hooks_modules contains array // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index e65a1b5e1a3..cae98408d44 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -955,6 +955,8 @@ if (empty($reshook)) { $price_ttc = ''; $price_ttc_devise = ''; + // TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) + if (GETPOST('price_ht') !== '') { $price_ht = price2num(GETPOST('price_ht'), 'MU', 2); } diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 75990668e5d..47e178292eb 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -871,6 +871,8 @@ class Propal extends CommonObject $txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate. } + // TODO Implement if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) ? + $tabprice = calcul_price_total($qty, $pu, $remise_percent, $txtva, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $mysoc, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise); $total_ht = $tabprice[0]; $total_tva = $tabprice[1]; diff --git a/htdocs/commande/agenda.php b/htdocs/commande/agenda.php new file mode 100644 index 00000000000..8eabb418ae9 --- /dev/null +++ b/htdocs/commande/agenda.php @@ -0,0 +1,255 @@ + + * + * 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/commande/agenda.php + * \ingroup commande + * \brief Tab of events on Sale Orders + */ +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("order", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); +} +$search_rowid = GETPOST('search_rowid'); +$search_agenda_label = GETPOST('search_agenda_label'); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'a.datep,a.id'; +} +if (!$sortorder) { + $sortorder = 'DESC,DESC'; +} + +// Initialize technical objects +$object = new Commande($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->commande->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('orderagenda', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || !empty($ref)) { + $upload_dir = $conf->commande->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; +} + +$permissiontoread = $user->hasRight("commande", "lire"); +$permissiontoadd = $user->hasRight("commande", "creer"); + +// Security check +if (!empty($user->socid)) { + $socid = $user->socid; +} +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +restrictedArea($user, 'commande', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + + +/* + * Actions + */ + +$parameters = array('id'=>$id); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; + } +} + + + +/* + * View + */ + +$form = new Form($db); + +if ($object->id > 0) { + $title = $langs->trans("Agenda"); + //if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; + llxHeader('', $title, $help_url); + + if (isModEnabled('notification')) { + $langs->load("mails"); + } + $head = commande_prepare_head($object); + + + print dol_get_fiche_head($head, 'agenda', $langs->trans("Order"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + + $object->info($object->id); + dol_print_object_info($object, 1); + + print '
'; + + print dol_get_fiche_end(); + + + + // Actions buttons + + $objthirdparty = $object; + $objcon = new stdClass(); + + $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; + $out .= '&backtopage='.urlencode($urlbacktopage); + $permok = $user->rights->agenda->myactions->create; + if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + $morehtmlright = ''; + + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + + if (isModEnabled('agenda')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } else { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); + } + } + + + if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); + } + + // Try to know count of actioncomm from cache + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_commande_'.$object->id; + $nbEvent = dol_getcache($cachekey); + + print_barre_liste($langs->trans("ActionsOnOrder").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + //print_barre_liste($langs->trans("ActionsOnOrder"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; + + // TODO Replace this with same code than into list.php + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : ''); + } +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index a04c2d15b33..b58a74ae67a 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2976,10 +2976,14 @@ if ($action == 'create' && $usercancreate) { print '
'; + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id); + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'order', $socid, 1); + $somethingshown = $formactions->showactions($object, 'order', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty print '
'; } diff --git a/htdocs/commande/info.php b/htdocs/commande/info.php deleted file mode 100644 index 2abe32aea71..00000000000 --- a/htdocs/commande/info.php +++ /dev/null @@ -1,129 +0,0 @@ - - * 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/commande/info.php - * \ingroup commande - * \brief Sale Order info page - */ - -// Load Dolibarr environment -require '../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/order.lib.php'; -if (isModEnabled('project')) { - require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} - -if (!$user->rights->commande->lire) { - accessforbidden(); -} - -// Load translation files required by the page -$langs->loadLangs(array('orders', 'sendings', 'bills')); - -$socid = 0; -$comid = GETPOST("id", 'int'); -$id = GETPOST("id", 'int'); -$ref = GETPOST('ref', 'alpha'); - -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$result = restrictedArea($user, 'commande', $comid, ''); - -$usercancreate = $user->hasRight("commande", "creer"); - -$object = new Commande($db); -if (!$object->fetch($id, $ref) > 0) { - dol_print_error($db); - exit; -} - - -/* - * View - */ - -$form = new Form($db); - -$title = $langs->trans('Order')." - ".$langs->trans('Info'); -$help_url = 'EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes|DE:Modul_Kundenaufträge'; -llxHeader('', $title, $help_url); - -$object->fetch_thirdparty(); -$object->info($object->id); - -$head = commande_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans("CustomerOrder"), -1, 'order'); - -// Order card - -$linkback = ''.$langs->trans("BackToList").''; - -$morehtmlref = '
'; -// Ref customer -$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); -$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); -// Thirdparty -$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); -// Project -if (isModEnabled('project')) { - $langs->load("projects"); - $morehtmlref .= '
'; - if (0) { - $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; - } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; - } - } - } -} -$morehtmlref .= '
'; - - -dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); - -print '
'; -print '
'; - -print '
'; - -print '
'; -dol_print_object_info($object); -print '
'; - -print '
'; - -print dol_get_fiche_end(); - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 177f68a1fbb..c665166b0af 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -223,6 +223,7 @@ include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php'; $object->fields = dol_sort_array($object->fields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position'); +$error = 0; /* @@ -1284,24 +1285,24 @@ if ($resql) { if ($permissiontovalidate) { $arrayofmassactions['prevalidate'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"); } - if ($permissiontosendbymail) { - $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); - } if ($permissiontoclose) { $arrayofmassactions['preshipped'] = img_picto('', 'dollyrevert', 'class="pictofixedwidth"').$langs->trans("ClassifyShipped"); } - if ($permissiontocancel) { - $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); - } - if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { - $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); - } if ($permissiontoclose) { $arrayofmassactions['setbilled'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("ClassifyBilled"); } + if ($permissiontocancel) { + $arrayofmassactions['cancelorders'] = img_picto('', 'close_title', 'class="pictofixedwidth"').$langs->trans("Cancel"); + } if ($permissiontodelete) { $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); } + if (isModEnabled('facture') && $user->hasRight("facture", "creer")) { + $arrayofmassactions['createbills'] = img_picto('', 'bill', 'class="pictofixedwidth"').$langs->trans("CreateInvoiceForThisCustomer"); + } + if ($permissiontosendbymail) { + $arrayofmassactions['presend'] = img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"); + } if (in_array($massaction, array('presend', 'predelete', 'createbills'))) { $arrayofmassactions = array(); } diff --git a/htdocs/compta/facture/agenda.php b/htdocs/compta/facture/agenda.php new file mode 100644 index 00000000000..b6bce2a160e --- /dev/null +++ b/htdocs/compta/facture/agenda.php @@ -0,0 +1,255 @@ + + * + * 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/compta/facture/agenda.php + * \ingroup facture + * \brief Tab of events on Invoices + */ +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +// Load translation files required by the page +$langs->loadLangs(array("facture", "other")); + +// Get parameters +$id = GETPOST('id', 'int'); +$ref = GETPOST('ref', 'alpha'); +$action = GETPOST('action', 'aZ09'); +$cancel = GETPOST('cancel', 'aZ09'); +$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search +$backtopage = GETPOST('backtopage', 'alpha'); + +if (GETPOST('actioncode', 'array')) { + $actioncode = GETPOST('actioncode', 'array', 3); + if (!count($actioncode)) { + $actioncode = '0'; + } +} else { + $actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : getDolGlobalString('AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT')); +} +$search_rowid = GETPOST('search_rowid'); +$search_agenda_label = GETPOST('search_agenda_label'); + +$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; +$sortfield = GETPOST('sortfield', 'aZ09comma'); +$sortorder = GETPOST('sortorder', 'aZ09comma'); +$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int'); +if (empty($page) || $page == -1) { + $page = 0; +} // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (!$sortfield) { + $sortfield = 'a.datep,a.id'; +} +if (!$sortorder) { + $sortorder = 'DESC,DESC'; +} + +// Initialize technical objects +$object = new Facture($db); +$extrafields = new ExtraFields($db); +$diroutputmassaction = $conf->facture->multidir_output[$conf->entity].'/temp/massgeneration/'.$user->id; +$hookmanager->initHooks(array('invoiceagenda', 'globalcard')); // Note that conf->hooks_modules contains array +// Fetch optionals attributes and labels +$extrafields->fetch_name_optionals_label($object->table_element); + +// Load object +include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id > 0 || !empty($ref)) { + $upload_dir = $conf->facture->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id; +} + +$permissiontoread = $user->hasRight("facture", "lire"); +$permissiontoadd = $user->hasRight("facture", "creer"); + +// Security check +if (!empty($user->socid)) { + $socid = $user->socid; +} +$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0); +restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); + + +/* + * Actions + */ + +$parameters = array('id'=>$id); +$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) { + setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); +} + +if (empty($reshook)) { + // Cancel + if (GETPOST('cancel', 'alpha') && !empty($backtopage)) { + header("Location: ".$backtopage); + exit; + } + + // Purge search criteria + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers + $actioncode = ''; + $search_agenda_label = ''; + } +} + + + +/* + * View + */ + +$form = new Form($db); + +if ($object->id > 0) { + $title = $langs->trans("Agenda"); + //if (!empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title; + $help_url = 'EN:Module_Agenda_En|DE:Modul_Terminplanung'; + llxHeader('', $title, $help_url); + + if (isModEnabled('notification')) { + $langs->load("mails"); + } + $head = facture_prepare_head($object); + + + print dol_get_fiche_head($head, 'agenda', $langs->trans("Invoice"), -1, $object->picto); + + // Object card + // ------------------------------------------------------------ + $linkback = ''.$langs->trans("BackToList").''; + + $morehtmlref = '
'; + // Ref customer + $morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); + $morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); + // Thirdparty + $morehtmlref .= '
'.$object->thirdparty->getNomUrl(1); + // Project + if (isModEnabled('project')) { + $langs->load("projects"); + $morehtmlref .= '
'; + if (0) { + $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); + if ($action != 'classify') { + $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; + } + $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); + } else { + if (!empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref .= $proj->getNomUrl(1); + if ($proj->title) { + $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; + } + } + } + } + $morehtmlref .= '
'; + + + dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref); + + print '
'; + print '
'; + + $object->info($object->id); + dol_print_object_info($object, 1); + + print '
'; + + print dol_get_fiche_end(); + + + + // Actions buttons + + $objthirdparty = $object; + $objcon = new stdClass(); + + $out = '&origin='.urlencode($object->element.(property_exists($object, 'module') ? '@'.$object->module : '')).'&originid='.urlencode($object->id); + $urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id; + $out .= '&backtopage='.urlencode($urlbacktopage); + $permok = $user->rights->agenda->myactions->create; + if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) { + //$out.='trans("AddAnAction"),'filenew'); + //$out.=""; + } + + $morehtmlright = ''; + + //$messagingUrl = DOL_URL_ROOT.'/societe/messaging.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('ShowAsConversation'), '', 'fa fa-comments imgforviewmode', $messagingUrl, '', 1); + //$messagingUrl = DOL_URL_ROOT.'/societe/agenda.php?socid='.$object->id; + //$morehtmlright .= dolGetButtonTitle($langs->trans('MessageListViewType'), '', 'fa fa-bars imgforviewmode', $messagingUrl, '', 2); + + if (isModEnabled('agenda')) { + if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda', 'allactions', 'create')) { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out); + } else { + $morehtmlright .= dolGetButtonTitle($langs->trans('AddAction'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out, '', 0); + } + } + + + if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + print '
'; + + $param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : ''); + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); + } + if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.urlencode($limit); + } + + // Try to know count of actioncomm from cache + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_facture_'.$object->id; + $nbEvent = dol_getcache($cachekey); + + print_barre_liste($langs->trans("ActionsOnBill").(is_numeric($nbEvent) ? '('.$nbEvent.')': ''), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + //print_barre_liste($langs->trans("ActionsOnBill"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', 0, $morehtmlright, '', 0, 1, 1); + + // List of all actions + $filters = array(); + $filters['search_agenda_label'] = $search_agenda_label; + $filters['search_rowid'] = $search_rowid; + + // TODO Replace this with same code than into list.php + show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, property_exists($object, 'module') ? $object->module : ''); + } +} + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a37fc313793..60d2360956e 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -5809,10 +5809,14 @@ if ($action == 'create') { print '
'; + $MAXEVENT = 10; + + $morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id); + // List of actions on element include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; $formactions = new FormActions($db); - $somethingshown = $formactions->showactions($object, 'invoice', $socid, 1); + $somethingshown = $formactions->showactions($object, 'invoice', $socid, 1, '', $MAXEVENT, '', $morehtmlcenter); // Show all action for thirdparty print '
'; } diff --git a/htdocs/compta/facture/info.php b/htdocs/compta/facture/info.php deleted file mode 100644 index 0619d629385..00000000000 --- a/htdocs/compta/facture/info.php +++ /dev/null @@ -1,144 +0,0 @@ - - * Copyright (C) 2004-2005 Laurent Destailleur - * 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/compta/facture/info.php - * \ingroup facture - * \brief Page des informations d'une facture - */ - -// Load Dolibarr environment -require '../../main.inc.php'; -require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; -require_once DOL_DOCUMENT_ROOT.'/core/lib/invoice.lib.php'; -if (isModEnabled('project')) { - include_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -} - -// Load translation files required by the page -$langs->loadLangs(array('companies', 'bills')); - -$id = GETPOST("facid", "int"); -$ref = GETPOST("ref", 'alpha'); - -$object = new Facture($db); - -$extrafields = new ExtraFields($db); - -// Fetch optionals attributes and labels -$extrafields->fetch_name_optionals_label($object->table_element); - -// Load object -if ($id > 0 || !empty($ref)) { - $ret = $object->fetch($id, $ref, '', '', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0)); -} - -// Security check -if ($user->socid) { - $socid = $user->socid; -} -$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0); - -$result = restrictedArea($user, 'facture', $object->id, '', '', 'fk_soc', 'rowid', $isdraft); - -$usercancreate = $user->hasRight("facture", "creer"); - - -/* - * View - */ - -$form = new Form($db); - -$title = $object->ref." - ".$langs->trans('Info'); -$help_url = "EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes"; - -llxHeader('', $title, $help_url); - -if (empty($object->id)) { - $langs->load('errors'); - echo '
'.$langs->trans("ErrorRecordNotFound").'
'; - llxFooter(); - exit; -} - -$object->fetch_thirdparty(); - -$object->info($object->id); - -$head = facture_prepare_head($object); -print dol_get_fiche_head($head, 'info', $langs->trans("InvoiceCustomer"), -1, 'bill'); - -$totalpaid = $object->getSommePaiement(); - -// Invoice content - -$linkback = ''.$langs->trans("BackToList").''; - -$morehtmlref = '
'; -// Ref customer -$morehtmlref .= $form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1); -$morehtmlref .= $form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1); -// Thirdparty -$morehtmlref .= '
'.$object->thirdparty->getNomUrl(1, 'customer'); -// Project -if (isModEnabled('project')) { - $langs->load("projects"); - $morehtmlref .= '
'; - if (0) { - $morehtmlref .= img_picto($langs->trans("Project"), 'project', 'class="pictofixedwidth"'); - if ($action != 'classify') { - $morehtmlref .= ''.img_edit($langs->transnoentitiesnoconv('SetProject')).' '; - } - $morehtmlref .= $form->form_project($_SERVER['PHP_SELF'].'?id='.$object->id, $object->socid, $object->fk_project, ($action == 'classify' ? 'projectid' : 'none'), 0, 0, 0, 1, '', 'maxwidth300'); - } else { - if (!empty($object->fk_project)) { - $proj = new Project($db); - $proj->fetch($object->fk_project); - $morehtmlref .= $proj->getNomUrl(1); - if ($proj->title) { - $morehtmlref .= ' - '.dol_escape_htmltag($proj->title).''; - } - } - } -} -$morehtmlref .= '
'; - -$object->totalpaid = $totalpaid; // To give a chance to dol_banner_tab to use already paid amount to show correct status - -dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0); - -print '
'; -print '
'; - -print '
'; - -print '
'; -dol_print_object_info($object); -print '
'; - -print '
'; - -print dol_get_fiche_end(); - -// End of page -llxFooter(); -$db->close(); diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index a36edf5cd88..825de33bec6 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -1035,7 +1035,7 @@ while ($i < $imaxinloop) { // Status if (!empty($arrayfields['status']['checked'])) { print ''; - print $invoicerectmp->getLibStatut(3, 0); + print $invoicerectmp->getLibStatut(5, 0); print ''; if (!$i) { $totalarray['nbfield']++; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index eb428c8a1cd..360e9680cb6 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -112,6 +112,7 @@ $search_zip = GETPOST('search_zip', 'alpha'); $search_state = GETPOST("search_state"); $search_country = GETPOST("search_country", 'alpha'); $search_type_thirdparty = GETPOST("search_type_thirdparty", 'int'); +$search_company_code_client = GETPOST("search_type_thirdparty", 'alpha'); $search_user = GETPOST('search_user', 'int'); $search_sale = GETPOST('search_sale', 'int'); $search_date_startday = GETPOST('search_date_startday', 'int'); diff --git a/htdocs/core/ajax/security.php b/htdocs/core/ajax/security.php index b01c952662e..2a836359e1c 100644 --- a/htdocs/core/ajax/security.php +++ b/htdocs/core/ajax/security.php @@ -36,7 +36,7 @@ if (!defined('NOREQUIREAJAX')) { if (!defined('NOREQUIRESOC')) { define('NOREQUIRESOC', '1'); } -// We need langs because the getRandomPassword may use user language to define some rules of pass generation +// We need langs because the getRandomPassword may use the user language to define some rules of pass generation /*if (!defined('NOREQUIRETRAN')) { define('NOREQUIRETRAN', '1'); }*/ diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 2635acd7951..04da241f16c 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -32,6 +32,7 @@ use OAuth\Common\Storage\DoliStorage; use OAuth\Common\Consumer\Credentials; + /** * Class to send emails (with attachments or not) * Usage: $mailfile = new CMailFile($subject,$sendto,$replyto,$message,$filepath,$mimetype,$filename,$cc,$ccc,$deliveryreceipt,$msgishtml,$errors_to,$css,$trackid,$moreinheader,$sendcontext,$replyto); @@ -171,6 +172,10 @@ class CMailFile { global $conf, $dolibarr_main_data_root, $user; + dol_syslog("CMailFile::CMailfile: charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext", LOG_DEBUG); + dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); + + // Clean values of $mimefilename_list if (is_array($mimefilename_list)) { foreach ($mimefilename_list as $key => $val) { @@ -214,9 +219,6 @@ class CMailFile // On defini alternative_boundary $this->alternative_boundary = 'mul_'.dol_hash(uniqid("dolibarr3"), 3); // Force md5 hash (does not contains special chars) - dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." charset=".$conf->file->character_set_client." from=$from, to=$to, addr_cc=$addr_cc, addr_bcc=$addr_bcc, errors_to=$errors_to, replyto=$replyto trackid=$trackid sendcontext=$sendcontext upload_dir_tmp=$upload_dir_tmp", LOG_DEBUG); - dol_syslog("CMailFile::CMailfile: subject=".$subject.", deliveryreceipt=".$deliveryreceipt.", msgishtml=".$msgishtml, LOG_DEBUG); - if (empty($subject)) { dol_syslog("CMailFile::CMailfile: Try to send an email with empty subject"); $this->error = 'ErrorSubjectIsRequired'; @@ -367,6 +369,8 @@ class CMailFile } } + dol_syslog("CMailFile::CMailfile: sendmode=".$this->sendmode." addr_bcc=$addr_bcc, replyto=$replyto", LOG_DEBUG); + // We set all data according to choosed sending method. // We also set a value for ->msgid if ($this->sendmode == 'mail') { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 00468a13bdd..cb5ddfcd395 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -6184,13 +6184,15 @@ abstract class CommonObject // If field is a computed field, value must become result of compute (regardless of whether a row exists // in the element's extrafields table) - foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { - if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { - //var_dump($conf->disable_compute); - if (empty($conf->disable_compute)) { - global $objectoffield; // We set a global variable to $objectoffield so - $objectoffield = $this; // we can use it inside computed formula - $this->array_options["options_".$key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); + if (is_array($extrafields->attributes[$this->table_element]['label'])) { + foreach ($extrafields->attributes[$this->table_element]['label'] as $key => $val) { + if (!empty($extrafields->attributes[$this->table_element]) && !empty($extrafields->attributes[$this->table_element]['computed'][$key])) { + //var_dump($conf->disable_compute); + if (empty($conf->disable_compute)) { + global $objectoffield; // We set a global variable to $objectoffield so + $objectoffield = $this; // we can use it inside computed formula + $this->array_options['options_' . $key] = dol_eval($extrafields->attributes[$this->table_element]['computed'][$key], 1, 0, ''); + } } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 6a91f38199f..14abaeeaff2 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -1346,6 +1346,8 @@ class Form $out .= img_picto($langs->trans("Search"), 'search'); } + $out .= ajax_event($htmlname, $events); + $out .= ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT . '/societe/ajax/company.php', $urloption, $conf->global->COMPANY_USE_SEARCH_TO_SELECT, 0, $ajaxoptions); } else { // Immediate load of all database diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index adf9d00e871..ecedab797ac 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -190,14 +190,10 @@ class FormActions $num = count($listofactions); if ($num || $forceshowtitle) { - if ($typeelement == 'invoice') { - $title = $langs->trans('ActionsOnBill'); - } elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') { + if ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') { $title = $langs->trans('ActionsOnBill'); } elseif ($typeelement == 'supplier_proposal') { $title = $langs->trans('ActionsOnSupplierProposal'); - } elseif ($typeelement == 'order') { - $title = $langs->trans('ActionsOnOrder'); } elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') { $title = $langs->trans('ActionsOnOrder'); } elseif ($typeelement == 'shipping') { diff --git a/htdocs/core/class/html.formticket.class.php b/htdocs/core/class/html.formticket.class.php index 1479c33510b..3f3a038b88c 100644 --- a/htdocs/core/class/html.formticket.class.php +++ b/htdocs/core/class/html.formticket.class.php @@ -436,7 +436,7 @@ class FormTicket $toolbarname = 'dolibarr_notes'; if ($this->ispublic) { $toolbarname = 'dolibarr_details'; - print '
'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'
'; + print '
'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HELP_MESSAGE", $langs->trans('TicketPublicPleaseBeAccuratelyDescribe'))).'
'; } include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; $uselocalbrowser = true; @@ -464,7 +464,7 @@ class FormTicket if (count($cate_arbo)) { // Categories - print ''.$langs->trans("Categories").''; + print ''.$langs->trans("Categories").''; print img_picto('', 'category', 'class="pictofixedwidth"').$form->multiselectarray('categories', $cate_arbo, GETPOST('categories', 'array'), '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0); print ""; } diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index cacd22269ad..fde2a988cf7 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -526,24 +526,46 @@ function ajax_combobox($htmlname, $events = array(), $minLengthToAutocomplete = } $msg .= ';'."\n"; - if (is_array($events) && count($events)) { // If an array of js events to do were provided. - $msg .= ' + $msg .= '});'."\n"; + $msg .= "\n"; + + $msg .= ajax_event($htmlname, $events); + + return $msg; +} + + +/** + * Add event management script. + * + * @param string $htmlname Name of html select field ('myid' or '.myclass') + * @param array $events Add some Ajax events option on change of $htmlname component to call ajax to autofill a HTML element (select#htmlname and #inputautocompletehtmlname) + * Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @return string Return JS string to manage event + */ +function ajax_event($htmlname, $events) +{ + $out = ''; + + if (is_array($events) && count($events)) { // If an array of js events to do were provided. + $out = ' + '; } - $msg .= '});'."\n"; - $msg .= "\n"; - - return $msg; + return $out; } + /** * On/off button for constant * diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index a560f5e34f7..f35561d25a1 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -1644,11 +1644,21 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon = '', $noprin if ($filterobj->id) { $sql .= " AND a.fk_element = ".((int) $filterobj->id); } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Commande') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } } elseif (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') { $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'order_supplier'"; if ($filterobj->id) { $sql .= " AND a.fk_element = ".((int) $filterobj->id); } + } elseif (is_object($filterobj) && get_class($filterobj) == 'Facture') { + $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'invoice'"; + if ($filterobj->id) { + $sql .= " AND a.fk_element = ".((int) $filterobj->id); + } } elseif (is_object($filterobj) && get_class($filterobj) == 'Product') { $sql .= " AND a.fk_element = o.rowid AND a.elementtype = 'product'"; if ($filterobj->id) { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 74947d9dd71..a3a6b1079ed 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11685,7 +11685,10 @@ function dolForgeCriteriaCallback($matches) return ''; } - $operator = strtoupper(preg_replace('/[^a-z<>=]/i', '', trim($tmp[1]))); + $operand = preg_replace('/[^a-z0-9\._]/i', '', trim($tmp[0])); + + $operator = strtoupper(preg_replace('/[^a-z<>!=]/i', '', trim($tmp[1]))); + if ($operator == 'NOTLIKE') { $operator = 'NOT LIKE'; } @@ -11723,7 +11726,7 @@ function dolForgeCriteriaCallback($matches) } } - return $db->escape($tmp[0]).' '.strtoupper($operator).' '.$tmpescaped; + return $db->escape($operand).' '.strtoupper($operator).' '.$tmpescaped; } diff --git a/htdocs/core/lib/invoice.lib.php b/htdocs/core/lib/invoice.lib.php index cf02832606a..3b17c830ed4 100644 --- a/htdocs/core/lib/invoice.lib.php +++ b/htdocs/core/lib/invoice.lib.php @@ -35,19 +35,19 @@ */ function facture_prepare_head($object) { - global $db, $langs, $conf; + global $db, $langs, $conf, $user; $h = 0; $head = array(); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/card.php?id='.$object->id; $head[$h][1] = $langs->trans('CustomerInvoice'); $head[$h][2] = 'compta'; $h++; if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) { $nbContact = count($object->liste_contact(-1, 'internal')) + count($object->liste_contact(-1, 'external')); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?facid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/contact.php?id='.urlencode($object->id); $head[$h][1] = $langs->trans('ContactsAddresses'); if ($nbContact > 0) { $head[$h][1] .= ''.$nbContact.''; @@ -73,7 +73,7 @@ function facture_prepare_head($object) } $langs->load("banks"); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.urlencode($object->id); + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/prelevement.php?id='.urlencode($object->id); $head[$h][1] = $langs->trans('StandingOrders'); if ($nbStandingOrders > 0) { $head[$h][1] .= ''.$nbStandingOrders.''; @@ -96,7 +96,7 @@ function facture_prepare_head($object) if (!empty($object->note_public)) { $nbNote++; } - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/note.php?id='.$object->id; $head[$h][1] = $langs->trans('Notes'); if ($nbNote > 0) { $head[$h][1] .= ''.$nbNote.''; @@ -110,7 +110,7 @@ function facture_prepare_head($object) $upload_dir = $conf->facture->dir_output."/".dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); $nbLinks = Link::count($db, $object->element, $object->id); - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?facid='.$object->id; + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/document.php?id='.$object->id; $head[$h][1] = $langs->trans('Documents'); if (($nbFiles + $nbLinks) > 0) { $head[$h][1] .= ''.($nbFiles + $nbLinks).''; @@ -118,9 +118,39 @@ function facture_prepare_head($object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/compta/facture/info.php?facid='.$object->id; - $head[$h][1] = $langs->trans('Info'); - $head[$h][2] = 'info'; + + $head[$h][0] = DOL_URL_ROOT.'/compta/facture/agenda.php?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + $nbEvent = 0; + // Enable caching of thirdparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_facture_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $nbEvent = $dataretrieved; + } else { + $sql = "SELECT COUNT(id) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".((int) $object->id); + $sql .= " AND elementtype = 'invoice'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbEvent = $obj->nb; + } else { + dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); + } + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. + } + + $head[$h][1] .= '/'; + $head[$h][1] .= $langs->trans("Agenda"); + if ($nbEvent > 0) { + $head[$h][1] .= ''.$nbEvent.''; + } + } + $head[$h][2] = 'agenda'; $h++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'invoice', 'add', 'external'); diff --git a/htdocs/core/lib/order.lib.php b/htdocs/core/lib/order.lib.php index a106bf62369..cb5a2247953 100644 --- a/htdocs/core/lib/order.lib.php +++ b/htdocs/core/lib/order.lib.php @@ -128,9 +128,39 @@ function commande_prepare_head(Commande $object) $head[$h][2] = 'documents'; $h++; - $head[$h][0] = DOL_URL_ROOT.'/commande/info.php?id='.$object->id; - $head[$h][1] = $langs->trans("Info"); - $head[$h][2] = 'info'; + + $head[$h][0] = DOL_URL_ROOT.'/commande/agenda.php?id='.$object->id; + $head[$h][1] = $langs->trans("Events"); + if (isModEnabled('agenda')&& (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) { + $nbEvent = 0; + // Enable caching of thirdparty count actioncomm + require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php'; + $cachekey = 'count_events_propal_'.$object->id; + $dataretrieved = dol_getcache($cachekey); + if (!is_null($dataretrieved)) { + $nbEvent = $dataretrieved; + } else { + $sql = "SELECT COUNT(id) as nb"; + $sql .= " FROM ".MAIN_DB_PREFIX."actioncomm"; + $sql .= " WHERE fk_element = ".((int) $object->id); + $sql .= " AND elementtype = 'order'"; + $resql = $db->query($sql); + if ($resql) { + $obj = $db->fetch_object($resql); + $nbEvent = $obj->nb; + } else { + dol_syslog('Failed to count actioncomm '.$db->lasterror(), LOG_ERR); + } + dol_setcache($cachekey, $nbEvent, 120); // If setting cache fails, this is not a problem, so we do not test result. + } + + $head[$h][1] .= '/'; + $head[$h][1] .= $langs->trans("Agenda"); + if ($nbEvent > 0) { + $head[$h][1] .= ''.$nbEvent.''; + } + } + $head[$h][2] = 'agenda'; $h++; complete_head_from_modules($conf, $langs, $object, $head, $h, 'order', 'add', 'external'); diff --git a/htdocs/core/lib/payments.lib.php b/htdocs/core/lib/payments.lib.php index 3dfccc88ea5..93c7a17de2f 100644 --- a/htdocs/core/lib/payments.lib.php +++ b/htdocs/core/lib/payments.lib.php @@ -146,7 +146,7 @@ function payment_supplier_prepare_head(Paiement $object) */ function getValidOnlinePaymentMethods($paymentmethod = '') { - global $conf, $langs, $hookmanager, $action; + global $langs, $hookmanager, $action; $validpaymentmethod = array(); @@ -434,6 +434,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, { global $conf; + $reg = array(); + // Juridical status $line1 = ""; if ($fromcompany->forme_juridique_code) { @@ -485,9 +487,8 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ''."\n"; + print '
'."\n"; print '
'; - - print '
'."\n"; if ($addformmessage) { print ''; print '
'; @@ -519,5 +520,6 @@ function htmlPrintOnlinePaymentFooter($fromcompany, $langs, $addformmessage = 0, print ' - '; } print $line2; - print '
'."\n"; + print ''; + print '
'."\n"; } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 7a5848adaf3..468c4d82a9b 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -725,11 +725,16 @@ function pdf_pagehead(&$pdf, $outputlangs, $page_height) $filepath = $conf->mycompany->dir_output.'/logos/'.$conf->global->MAIN_USE_BACKGROUND_ON_PDF; if (file_exists($filepath)) { $pdf->SetAutoPageBreak(0, 0); // Disable auto pagebreak before adding image + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha($conf->global->MAIN_USE_BACKGROUND_ON_PDF_ALPHA); } // Option for change opacity of background $pdf->Image($filepath, (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_X) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_X : 0), (isset($conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y) ? $conf->global->MAIN_USE_BACKGROUND_ON_PDF_Y : 0), 0, $page_height); + if (getDolGlobalString('MAIN_USE_BACKGROUND_ON_PDF_ALPHA')) { $pdf->SetAlpha(1); } $pdf->SetPageMark(); // This option avoid to have the images missing on some pages $pdf->SetAutoPageBreak(1, 0); // Restore pagebreak } } + if (getDolGlobalString('MAIN_ADD_PDF_BACKGROUND') && getDolGlobalString('MAIN_ADD_PDF_BACKGROUND') != '-1') { + $pdf->SetPageMark(); // This option avoid to have the images missing on some pages + } } @@ -1247,49 +1252,52 @@ function pdf_pagefoot(&$pdf, $outputlangs, $paramfreetext, $fromcompany, $marge_ $pdf->SetY(-$posy); - // Hide footer line if footer background color is set - if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { - $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); - } + // Option for hide all footer (page number will no hidden) + if (!getDolGlobalInt('PDF_FOOTER_HIDDEN')) { + // Hide footer line if footer background color is set + if (!getDolGlobalString('PDF_FOOTER_BACKGROUND_COLOR')) { + $pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy); + } - // Option for set top margin height of footer after freetext - if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) { - $posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN')); - } else { - $posy--; - } + // Option for set top margin height of footer after freetext + if (getDolGlobalString('PDF_FOOTER_TOP_MARGIN') || getDolGlobalInt('PDF_FOOTER_TOP_MARGIN') === 0) { + $posy -= floatval(getDolGlobalString('PDF_FOOTER_TOP_MARGIN')); + } else { + $posy--; + } - if (!empty($line1)) { - $pdf->SetFont('', 'B', 7); - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line1, 0, 'C', 0); - $posy -= 3; - $pdf->SetFont('', '', 7); - } + if (!empty($line1)) { + $pdf->SetFont('', 'B', 7); + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line1, 0, 'C', 0); + $posy -= 3; + $pdf->SetFont('', '', 7); + } - if (!empty($line2)) { - $pdf->SetFont('', 'B', 7); - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line2, 0, 'C', 0); - $posy -= 3; - $pdf->SetFont('', '', 7); - } + if (!empty($line2)) { + $pdf->SetFont('', 'B', 7); + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line2, 0, 'C', 0); + $posy -= 3; + $pdf->SetFont('', '', 7); + } - if (!empty($line3)) { - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line3, 0, 'C', 0); - } + if (!empty($line3)) { + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line3, 0, 'C', 0); + } - if (!empty($line4)) { - $posy -= 3; - $pdf->SetXY($dims['lm'], -$posy); - $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line4, 0, 'C', 0); + if (!empty($line4)) { + $posy -= 3; + $pdf->SetXY($dims['lm'], -$posy); + $pdf->MultiCell($dims['wk'] - $dims['rm'] - $dims['lm'], 2, $line4, 0, 'C', 0); + } } } } // Show page nb only on iso languages (so default Helvetica font) // if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') { - $pdf->SetXY($dims['wk'] - $dims['rm'] - 18, -$posy); + $pdf->SetXY($dims['wk'] - $dims['rm'] - 18 - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_X', 0), -$posy - getDolGlobalInt('PDF_FOOTER_PAGE_NUMBER_Y', 0)); // $pdf->MultiCell(18, 2, $pdf->getPageNumGroupAlias().' / '.$pdf->getPageGroupAlias(), 0, 'R', 0); // $pdf->MultiCell(18, 2, $pdf->PageNo().' / '.$pdf->getAliasNbPages(), 0, 'R', 0); // doesn't works with all fonts // $pagination = $pdf->getAliasNumPage().' / '.$pdf->getAliasNbPages(); // works with $pdf->Cell diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 66de4ca6017..1f7b9404a7c 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -113,10 +113,11 @@ function dolGetRandomBytes($length) * @param string $chain string to encode * @param string $key If '', we use $dolibarr_main_instance_unique_id * @param string $ciphering Default ciphering algorithm + * @param string $forceseed To force the seed * @return string encoded string * @see dolDecrypt(), dol_hash() */ -function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") +function dolEncrypt($chain, $key = '', $ciphering = 'AES-256-CTR', $forceseed = '') { global $dolibarr_main_instance_unique_id; global $dolibarr_disable_dolcrypt_for_debug; @@ -134,6 +135,9 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if (empty($key)) { $key = $dolibarr_main_instance_unique_id; } + if (empty($ciphering)) { + $ciphering = 'AES-256-CTR'; + } $newchain = $chain; @@ -145,7 +149,11 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR") if ($ivlen === false || $ivlen < 1 || $ivlen > 32) { $ivlen = 16; } - $ivseed = dolGetRandomBytes($ivlen); + if (empty($forceseed)) { + $ivseed = dolGetRandomBytes($ivlen); + } else { + $ivseed = dol_trunc(md5($forceseed), $ivlen, 'right', 'UTF-8', 1); + } $newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed); return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain; @@ -260,7 +268,7 @@ function dol_verifyHash($chain, $hash, $type = '0') global $conf; if ($type == '0' && !empty($conf->global->MAIN_SECURITY_HASH_ALGO) && $conf->global->MAIN_SECURITY_HASH_ALGO == 'password_hash' && function_exists('password_verify')) { - if ($hash[0] == '$') { + if (! empty($hash[0]) && $hash[0] == '$') { return password_verify($chain, $hash); } elseif (strlen($hash) == 32) { return dol_verifyHash($chain, $hash, '3'); // md5 diff --git a/htdocs/core/lib/security2.lib.php b/htdocs/core/lib/security2.lib.php index c68bb49d93b..b60054b9701 100644 --- a/htdocs/core/lib/security2.lib.php +++ b/htdocs/core/lib/security2.lib.php @@ -581,6 +581,9 @@ function dolJSToSetRandomPassword($htmlname, $htmlnameofbutton = 'generate_token token: \''.dol_escape_js(newToken()).'\' }, function(result) { + if ($("input#'.dol_escape_js($htmlname).'").attr("type") == "password") { + $("input#'.dol_escape_js($htmlname).'").attr("type", "text"); + } $("#'.dol_escape_js($htmlname).'").val(result); }); }); diff --git a/htdocs/core/lib/ticket.lib.php b/htdocs/core/lib/ticket.lib.php index 2c218421543..d31da45f968 100644 --- a/htdocs/core/lib/ticket.lib.php +++ b/htdocs/core/lib/ticket.lib.php @@ -203,7 +203,7 @@ function generate_random_id($car = 16) } /** - * Show header for public pages + * Show http header, open body tag and show HTML header banner for public pages for tickets * * @param string $title Title * @param string $head Head array @@ -216,11 +216,14 @@ function generate_random_id($car = 16) function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $arrayofjs = '', $arrayofcss = '') { global $user, $conf, $langs, $mysoc; + $urllogo = ""; top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss, 0, 1); // Show html headers print ''; - print '
'; + print '
'; + + print '
'; // Define urllogo if (getDolGlobalInt('TICKET_SHOW_COMPANY_LOGO') || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { @@ -239,21 +242,21 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ } // Output html code for logo - if ($urllogo || getDolGlobalInt('TICKET_PUBLIC_INTERFACE_TOPIC')) { + if ($urllogo || getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { print '
'; print '
'; if ($urllogo) { - print ''; + print ''; print ''; print ''; } - if (getDolGlobalInt('TICKET_PUBLIC_INTERFACE_TOPIC')) { + if (getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC')) { print '
'.(getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') ? getDolGlobalString('TICKET_PUBLIC_INTERFACE_TOPIC') : $langs->trans("TicketSystem")).''; } print '
'; if (!getDolGlobalInt('MAIN_HIDE_POWERED_BY')) { - print ''; + print ''; } print '
'; } @@ -264,7 +267,7 @@ function llxHeaderTicket($title, $head = "", $disablejs = 0, $disablehead = 0, $ print '
'; } - print '
'; + print ''; - print '
'; + //print '
'; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 52761509890..36b9cf6d9f2 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -412,7 +412,7 @@ if ($nolinesbefore) { diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index d9c8a09a384..a0bf235c0eb 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -228,9 +228,13 @@ $coldisplay++; print ''; } - if ($inputalsopricewithtax) { + if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { $coldisplay++; - print 'pu_ttc) ? $line->pu_ttc : null; + if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { + $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); + } + print 'multicurrency_code != $conf->currenc print ''.$langs->trans('PriceUHTCurrency', $this->multicurrency_code).''; } -if ($inputalsopricewithtax) { +if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { print ''.$langs->trans('PriceUTTC').''; } diff --git a/htdocs/core/tpl/objectline_view.tpl.php b/htdocs/core/tpl/objectline_view.tpl.php index 0f7dc25152b..153773a6519 100644 --- a/htdocs/core/tpl/objectline_view.tpl.php +++ b/htdocs/core/tpl/objectline_view.tpl.php @@ -325,8 +325,14 @@ print $tooltiponpriceend; multicurrency_subprice); ?> - pu_ttc) ? price($sign * $line->pu_ttc) : price($sign * $line->subprice)); ?> +if (!empty($inputalsopricewithtax) && !getDolGlobalInt('MAIN_NO_INPUT_PRICE_WITH_TAX')) { ?> + pu_ttc) ? $line->pu_ttc : null; + if (getDolGlobalInt('MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES')) { + $upinctax = price2num($line->total_ttc / $line->qty, 'MU'); + } + print (isset($upinctax) ? price($sign * $upinctax) : price($sign * $line->subprice)); + ?> diff --git a/htdocs/holiday/class/holiday.class.php b/htdocs/holiday/class/holiday.class.php index 341b0c700e1..f3c7130e7f8 100644 --- a/htdocs/holiday/class/holiday.class.php +++ b/htdocs/holiday/class/holiday.class.php @@ -1497,9 +1497,11 @@ class Holiday extends CommonObject } $out .= ''."\n"; - $out .= ajax_combobox($htmlname); - print $out; + $showempty= 0; + $out .= ajax_combobox($htmlname, array(), 0, 0, 'resolve', ($showempty < 0 ? (string) $showempty : '-1'), $morecss); + + return $out; } /** @@ -2488,7 +2490,7 @@ class Holiday extends CommonObject $return .= ''; if (property_exists($this, 'fk_type')) { $return .= '
'.$langs->trans("Type").' : '; - $return .= ''.arraydata['labeltype'].''; + $return .= ''.$arraydata['labeltype'].''; } if (property_exists($this, 'date_debut') && property_exists($this, 'date_fin')) { $return .= '
'.dol_print_date($this->date_debut, 'day').''; diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 2eb69145254..6ff31497a57 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -363,6 +363,7 @@ if (count($typeleaves) == 0) { print_liste_field_titre((empty($user->rights->holiday->define_holiday) ? '' : 'Note'), $_SERVER["PHP_SELF"]); print_liste_field_titre(''); + $selectedfields = ''; if ($massactionbutton) { $selectedfields = $form->showCheckAddButtons('checkforselect', 1); } diff --git a/htdocs/holiday/list.php b/htdocs/holiday/list.php index 3f8f9d69131..0be113d8205 100644 --- a/htdocs/holiday/list.php +++ b/htdocs/holiday/list.php @@ -143,7 +143,13 @@ if ($user->socid > 0) { // Protection if external user accessforbidden(); } -if (empty($conf->holiday->enabled)) accessforbidden('Module not enabled'); +$permissiontoread = $user->hasRight('holiday', 'read'); +$permissiontodelete = $user->hasRight('holiday', 'delete'); +$permissiontoapprove = $user->hasRight('holiday', 'approve'); + +if (!ismodEnabled('holiday')) { + accessforbidden('Module holiday not enabled'); +} $result = restrictedArea($user, 'holiday', '', ''); // If we are on the view of a specific user @@ -152,10 +158,10 @@ if ($id > 0) { if ($id == $user->id) { $canread = 1; } - if (!empty($user->rights->holiday->readall)) { + if ($user->hasRight('holiday', 'readall')) { $canread = 1; } - if (!empty($user->rights->holiday->read) && in_array($id, $childids)) { + if ($user->hasRight('holiday', 'read') && in_array($id, $childids)) { $canread = 1; } if (!$canread) { @@ -165,13 +171,13 @@ if ($id > 0) { - /* * Actions */ if (GETPOST('cancel', 'alpha')) { - $action = 'list'; $massaction = ''; + $action = 'list'; + $massaction = ''; } if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction = ''; @@ -211,9 +217,6 @@ if (empty($reshook)) { // Mass actions $objectclass = 'Holiday'; $objectlabel = 'Holiday'; - $permissiontoread = $user->hasRight('holiday', 'read'); - $permissiontodelete = $user->hasRight('holiday', 'delete'); - $permissiontoapprove = $user->hasRight('holiday', 'approve'); $uploaddir = $conf->holiday->dir_output; include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -236,6 +239,8 @@ $holidaystatic = new Holiday($db); $result = $object->updateBalance(); $title = $langs->trans('CPTitreMenu'); +$help_url = ''; + llxHeader('', $title); $max_year = 5; @@ -304,7 +309,8 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { // Add fields from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook -$sql .= $hookmanager->resPrint; +$sql .= preg_replace('/^,/', '', $hookmanager->resPrint); +$sql = preg_replace('/,\s*$/', '', $sql); $sqlfields = $sql; // $sql fields to remove for count total @@ -357,7 +363,7 @@ if ($id > 0) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; // Add where from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; // Count total nb of records @@ -374,7 +380,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { dol_print_error($db); } - if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0 + if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller than the paging size (filtering), goto and load page 0 $page = 0; $offset = 0; } @@ -389,656 +395,703 @@ if ($limit) { //print $sql; $resql = $db->query($sql); -if ($resql) { - $num = $db->num_rows($resql); +if (!$resql) { + dol_print_error($db); + exit; +} - $arrayofselected = is_array($toselect) ? $toselect : array(); +$num = $db->num_rows($resql); - $param = ''; - if (!empty($mode)) { - $param .= '&mode='.urlencode($mode); - } - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { - $param .= '&contextpage='.urlencode($contextpage); - } - if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); - } - if ($optioncss != '') { - $param .= '&optioncss='.urlencode($optioncss); - } - if ($search_ref) { - $param .= '&search_ref='.urlencode($search_ref); - } - if ($search_day_create) { - $param .= '&search_day_create='.urlencode($search_day_create); - } - if ($search_month_create) { - $param .= '&search_month_create='.urlencode($search_month_create); - } - if ($search_year_create) { - $param .= '&search_year_create='.urlencode($search_year_create); - } - if ($search_day_start) { - $param .= '&search_day_start='.urlencode($search_day_start); - } - if ($search_month_start) { - $param .= '&search_month_start='.urlencode($search_month_start); - } - if ($search_year_start) { - $param .= '&search_year_start='.urlencode($search_year_start); - } - if ($search_day_end) { - $param .= '&search_day_end='.urlencode($search_day_end); - } - if ($search_month_end) { - $param .= '&search_month_end='.urlencode($search_month_end); - } - if ($search_year_end) { - $param .= '&search_year_end='.urlencode($search_year_end); - } - if ($search_employee > 0) { - $param .= '&search_employee='.urlencode($search_employee); - } - if ($search_valideur > 0) { - $param .= '&search_valideur='.urlencode($search_valideur); - } - if ($search_type > 0) { - $param .= '&search_type='.urlencode($search_type); - } - if ($search_status > 0) { - $param .= '&search_status='.urlencode($search_status); - } - // Add $param from extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; +$arrayofselected = is_array($toselect) ? $toselect : array(); - // List of mass actions available - $arrayofmassactions = array( - //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), - //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), - //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), - ); - if (!empty($user->rights->holiday->delete)) { - $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); - } - if (!empty($user->rights->holiday->approve)) { - $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); - } - if (in_array($massaction, array('presend', 'predelete'))) { - $arrayofmassactions = array(); - } - $massactionbutton = $form->selectMassAction('', $arrayofmassactions); +$param = ''; +if (!empty($mode)) { + $param .= '&mode='.urlencode($mode); +} +if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { + $param .= '&contextpage='.urlencode($contextpage); +} +if ($limit > 0 && $limit != $conf->liste_limit) { + $param .= '&limit='.((int) $limit); +} +if ($optioncss != '') { + $param .= '&optioncss='.urlencode($optioncss); +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_day_create) { + $param .= '&search_day_create='.urlencode($search_day_create); +} +if ($search_month_create) { + $param .= '&search_month_create='.urlencode($search_month_create); +} +if ($search_year_create) { + $param .= '&search_year_create='.urlencode($search_year_create); +} +if ($search_day_start) { + $param .= '&search_day_start='.urlencode($search_day_start); +} +if ($search_month_start) { + $param .= '&search_month_start='.urlencode($search_month_start); +} +if ($search_year_start) { + $param .= '&search_year_start='.urlencode($search_year_start); +} +if ($search_day_end) { + $param .= '&search_day_end='.urlencode($search_day_end); +} +if ($search_month_end) { + $param .= '&search_month_end='.urlencode($search_month_end); +} +if ($search_year_end) { + $param .= '&search_year_end='.urlencode($search_year_end); +} +if ($search_employee > 0) { + $param .= '&search_employee='.urlencode($search_employee); +} +if ($search_valideur > 0) { + $param .= '&search_valideur='.urlencode($search_valideur); +} +if ($search_type > 0) { + $param .= '&search_type='.urlencode($search_type); +} +if ($search_status > 0) { + $param .= '&search_status='.urlencode($search_status); +} +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; - // Lines of title fields - print '
'."\n"; - if ($optioncss != '') { - print ''; - } - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; +// List of mass actions available +$arrayofmassactions = array( + //'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"), + //'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"), + //'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"), +); +if (!empty($permissiontodelete)) { + $arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete"); +} +if (!empty($permissiontoapprove)) { + $arrayofmassactions['preapproveleave'] = img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Approve"); +} +if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) { + $arrayofmassactions = array(); +} +$massactionbutton = $form->selectMassAction('', $arrayofmassactions); - if ($id > 0) { - print ''; +print ''."\n"; +if ($optioncss != '') { + print ''; +} +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +if ($id > 0) { + print ''; +} + +if ($id > 0) { // For user tab + $title = $langs->trans("User"); + $linkback = ''.$langs->trans("BackToList").''; + $head = user_prepare_head($fuser); + + print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + + dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + + if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { + print '
'; + + print '
'; + + showMyBalance($object, $user_id); } - if ($id > 0) { // For user tab - $title = $langs->trans("User"); - $linkback = ''.$langs->trans("BackToList").''; - $head = user_prepare_head($fuser); + print dol_get_fiche_end(); - print dol_get_fiche_head($head, 'paidholidays', $title, -1, 'user'); + // Buttons for actions - dol_banner_tab($fuser, 'id', $linkback, $user->rights->user->user->lire || $user->admin); + print '
'; - if (empty($conf->global->HOLIDAY_HIDE_BALANCE)) { - print '
'; - - print '
'; - - showMyBalance($object, $user_id); - } - - print dol_get_fiche_end(); - - // Buttons for actions - - print '
'; - - $cancreate = 0; - if (!empty($user->rights->holiday->writeall)) { - $cancreate = 1; - } - if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { - $cancreate = 1; - } - - if ($cancreate) { - print ''.$langs->trans("AddCP").''; - } - - print '
'; - } else { - $title = $langs->trans("ListeCP"); - - - $newcardbutton = ''; - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); - $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); - - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); + $cancreate = 0; + if (!empty($user->rights->holiday->writeall)) { + $cancreate = 1; + } + if (!empty($user->rights->holiday->write) && in_array($user_id, $childids)) { + $cancreate = 1; } - $topicmail = "Information"; - $modelmail = "leaverequest"; - $objecttmp = new Holiday($db); - $trackid = 'leav'.$object->id; - include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; - - if ($sall) { - foreach ($fieldstosearchall as $key => $val) { - $fieldstosearchall[$key] = $langs->trans($val); - } - print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; + if ($cancreate) { + print ''.$langs->trans("AddCP").''; } - $moreforfilter = ''; + print '
'; +} else { + $title = $langs->trans("ListeCP"); - $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook - if (empty($reshook)) { - $moreforfilter .= $hookmanager->resPrint; - } else { - $moreforfilter = $hookmanager->resPrint; + + $newcardbutton = ''; + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); + $newcardbutton .= dolGetButtonTitleSeparator(); + $newcardbutton .= dolGetButtonTitle($langs->trans('MenuAddCP'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/holiday/card.php?action=create', '', $user->rights->holiday->write); + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_hrm', 0, $newcardbutton, '', $limit, 0, 0, 1); +} + +$topicmail = "Information"; +$modelmail = "leaverequest"; +$objecttmp = new Holiday($db); +$trackid = 'leav'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($sall) { + $setupstring = ''; + foreach ($fieldstosearchall as $key => $val) { + $fieldstosearchall[$key] = $langs->trans($val); + $setupstring .= $key."=".$val.";"; + } + print ''."\n"; + print '
'.$langs->trans("FilterOnInto", $sall).join(', ', $fieldstosearchall).'
'; +} + +$moreforfilter = ''; + +$parameters = array(); +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +if (empty($reshook)) { + $moreforfilter .= $hookmanager->resPrint; +} else { + $moreforfilter = $hookmanager->resPrint; +} + +if (!empty($moreforfilter)) { + print '
'; + print $moreforfilter; + $parameters = array('type'=>$type); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
'; +} + +$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); + +$include = ''; +if (empty($user->rights->holiday->readall)) { + $include = 'hierarchyme'; // Can see only its hierarchyl +} + +print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table +print ''."\n"; + +// Fields title search +// -------------------------------------------------------------------- +print ''; +// Action column +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} +if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; +} + +if (!empty($arrayfields['cp.fk_user']['checked'])) { + $morefilter = ''; + if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { + $morefilter = 'AND employee = 1'; } - if (!empty($moreforfilter)) { - print '
'; - print $moreforfilter; - print '
'; + // User + $disabled = 0; + // If into the tab holiday of a user ($id is set in such a case) + if ($id && !GETPOSTISSET('search_employee')) { + $search_employee = $id; + $disabled = 1; } - $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')); // This also change content of $arrayfields - $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); - - - $include = ''; - if (empty($user->rights->holiday->readall)) { - $include = 'hierarchyme'; // Can see only its hierarchyl - } - - print '
'; - print '
'; + $searchpicto = $form->showFilterButtons('left'); + print $searchpicto; + print ''; + print ''; + print '
'."\n"; - - - // Filters - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - } - - if (!empty($arrayfields['cp.fk_user']['checked'])) { - $morefilter = ''; - if (!empty($conf->global->HOLIDAY_HIDE_FOR_NON_SALARIES)) { - $morefilter = 'AND employee = 1'; - } - - // User - $disabled = 0; - // If into the tab holiday of a user ($id is set in such a case) - if ($id && !GETPOSTISSET('search_employee')) { - $search_employee = $id; - $disabled = 1; - } + print ''; +} +// Approver +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + if ($user->hasRight('holiday', 'readall')) { print ''; - } - - // Approver - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - if ($user->hasRight('holiday', 'readall')) { - print ''; - } else { - print ''; - } - } - - // Type - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print ''; - } - - // Duration - if (!empty($arrayfields['duration']['checked'])) { + } else { print ''; } +} - // Start date - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; +// Type +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print ''; +} - // End date - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - } +// Duration +if (!empty($arrayfields['duration']['checked'])) { + print ''; +} - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print ''; - } +// Start date +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; +} - // Date appoval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - } +// End date +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; +} - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; +// Date validation +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; - } +// Date appoval +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; +} - // Create date - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - } +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; - // Status - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - } +// Fields from hook +$parameters = array('arrayfields'=>$arrayfields); +$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } +// Create date +if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''; +} - print "\n"; +// Create date +if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; +} - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); - } - if (!empty($arrayfields['duration']['checked'])) { - print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_valid']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); - } - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; - // Hook fields - $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - if (!empty($arrayfields['cp.date_create']['checked'])) { - print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); - } - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"], "", '', '', '', $sortfield, $sortorder, 'maxwidthsearch center '); - } - print "\n"; +// Status +if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; +} - $listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; +} + +print ''."\n"; + +$totalarray = array(); +$totalarray['nbfield'] = 0; + +// Fields title label +// -------------------------------------------------------------------- +print ''; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.ref']['checked'])) { + print_liste_field_titre($arrayfields['cp.ref']['label'], $_SERVER["PHP_SELF"], "cp.ref", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_user']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_user']['label'], $_SERVER["PHP_SELF"], "cp.fk_user", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_validator']['label'], $_SERVER["PHP_SELF"], "cp.fk_validator", "", $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.fk_type']['checked'])) { + print_liste_field_titre($arrayfields['cp.fk_type']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['duration']['checked'])) { + print_liste_field_titre($arrayfields['duration']['label'], $_SERVER["PHP_SELF"], '', '', $param, '', $sortfield, $sortorder, 'right maxwidth100'); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_debut']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_debut']['label'], $_SERVER["PHP_SELF"], "cp.date_debut", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_fin']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_fin']['label'], $_SERVER["PHP_SELF"], "cp.date_fin", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_valid']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_valid']['label'], $_SERVER["PHP_SELF"], "cp.date_valid", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.date_approval']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_approval']['label'], $_SERVER["PHP_SELF"], "cp.date_approval", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (!empty($arrayfields['cp.date_create']['checked'])) { + print_liste_field_titre($arrayfields['cp.date_create']['label'], $_SERVER["PHP_SELF"], "cp.date_create", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.tms']['checked'])) { + print_liste_field_titre($arrayfields['cp.tms']['label'], $_SERVER["PHP_SELF"], "cp.tms", "", $param, '', $sortfield, $sortorder, 'center '); + $totalarray['nbfield']++; +} +if (!empty($arrayfields['cp.statut']['checked'])) { + print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "cp.statut", "", $param, '', $sortfield, $sortorder, 'right '); + $totalarray['nbfield']++; +} +// Action column +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; +} +print ''."\n"; + +$listhalfday = array('morning'=>$langs->trans("Morning"), "afternoon"=>$langs->trans("Afternoon")); - // If we ask a dedicated card and not allow to see it, we force on user. - if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { - $langs->load("errors"); - print ''; - $result = 0; - } elseif ($num > 0 && !empty($mysoc->country_id)) { - // Lines - $userstatic = new User($db); - $approbatorstatic = new User($db); +// Loop on record +// -------------------------------------------------------------------- - $typeleaves = $object->getTypes(1, -1); +// If we ask a dedicated card and not allow to see it, we force on user. +if ($id && empty($user->rights->holiday->readall) && !in_array($id, $childids)) { + $langs->load("errors"); + print ''; + $result = 0; +} elseif ($num > 0 && !empty($mysoc->country_id)) { + // Lines + $userstatic = new User($db); + $approbatorstatic = new User($db); - $i = 0; - $totalarray = array(); - $totalarray['nbfield'] = 0; - $totalduration = 0; - $imaxinloop = ($limit ? min($num, $limit) : $num); - while ($i < $imaxinloop) { - $obj = $db->fetch_object($resql); + $typeleaves = $object->getTypes(1, -1); - // Leave request - $holidaystatic->id = $obj->rowid; - $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); - $holidaystatic->statut = $obj->status; - $holidaystatic->date_debut = $obj->date_debut; - $holidaystatic->date_fin = $obj->date_fin; + $i = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; + $totalduration = 0; + $imaxinloop = ($limit ? min($num, $limit) : $num); + while ($i < $imaxinloop) { + $obj = $db->fetch_object($resql); + if (empty($obj)) { + break; // Should not happen + } - // User - $userstatic->id = $obj->fk_user; - $userstatic->lastname = $obj->user_lastname; - $userstatic->firstname = $obj->user_firstname; - $userstatic->admin = $obj->user_admin; - $userstatic->email = $obj->user_email; - $userstatic->login = $obj->user_login; - $userstatic->statut = $obj->user_status; - $userstatic->photo = $obj->user_photo; + // Leave request + $holidaystatic->id = $obj->rowid; + $holidaystatic->ref = ($obj->ref ? $obj->ref : $obj->rowid); + $holidaystatic->statut = $obj->status; + $holidaystatic->date_debut = $obj->date_debut; + $holidaystatic->date_fin = $obj->date_fin; - // Validator - $approbatorstatic->id = $obj->fk_validator; - $approbatorstatic->lastname = $obj->validator_lastname; - $approbatorstatic->firstname = $obj->validator_firstname; - $approbatorstatic->admin = $obj->validator_admin; - $approbatorstatic->email = $obj->validator_email; - $approbatorstatic->login = $obj->validator_login; - $approbatorstatic->statut = $obj->validator_status; - $approbatorstatic->photo = $obj->validator_photo; + // User + $userstatic->id = $obj->fk_user; + $userstatic->lastname = $obj->user_lastname; + $userstatic->firstname = $obj->user_firstname; + $userstatic->admin = $obj->user_admin; + $userstatic->email = $obj->user_email; + $userstatic->login = $obj->user_login; + $userstatic->statut = $obj->user_status; + $userstatic->photo = $obj->user_photo; - $date = $obj->date_create; - $date_modif = $obj->date_update; + // Validator + $approbatorstatic->id = $obj->fk_validator; + $approbatorstatic->lastname = $obj->validator_lastname; + $approbatorstatic->firstname = $obj->validator_firstname; + $approbatorstatic->admin = $obj->validator_admin; + $approbatorstatic->email = $obj->validator_email; + $approbatorstatic->login = $obj->validator_login; + $approbatorstatic->statut = $obj->validator_status; + $approbatorstatic->photo = $obj->validator_photo; - $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; - $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; + $date = $obj->date_create; + $date_modif = $obj->date_update; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; + $starthalfday = ($obj->halfday == -1 || $obj->halfday == 2) ? 'afternoon' : 'morning'; + $endhalfday = ($obj->halfday == 1 || $obj->halfday == 2) ? 'morning' : 'afternoon'; - if ($mode == 'kanban') { - if ($i == 0) { - print ''; + } + } else { + // Show here line of result + $j = 0; + print ''; + // Action column + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; - } - } else { - print ''; - // Action column - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - if (!empty($arrayfields['cp.ref']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_user']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_validator']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.fk_type']['checked'])) { - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - } - - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_debut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.date_fin']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - // Date validation - if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval - print ''; - if (!$i) $totalarray['nbfield']++; - } - // Date approval - if (!empty($arrayfields['cp.date_approval']['checked'])) { - print ''; - if (!$i) $totalarray['nbfield']++; - } - - // Extra fields - include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; - // Fields from hook - $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook - print $hookmanager->resPrint; - - // Date creation - if (!empty($arrayfields['cp.date_create']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.tms']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - if (!empty($arrayfields['cp.statut']['checked'])) { - print ''; - if (!$i) { - $totalarray['nbfield']++; - } - } - - // Action column - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + print ''; } + print ''; if (!$i) { $totalarray['nbfield']++; } - - print ''."\n"; } - $i++; - } - - // Add a line for total if there is a total to show - if (!empty($arrayfields['duration']['checked'])) { - print ''; - if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; - } - foreach ($arrayfields as $key => $val) { - if (!empty($val['checked'])) { - if ($key == 'duration') { - print ''; - } else { - print ''; - } + if (!empty($arrayfields['cp.ref']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; } } - // status - if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print ''; + if (!empty($arrayfields['cp.fk_user']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } } - print ''; + if (!empty($arrayfields['cp.fk_validator']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.fk_type']['checked'])) { + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); + } + + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['duration']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_debut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.date_fin']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + // Date validation + if (!empty($arrayfields['cp.date_valid']['checked'])) { // date_valid is both date_valid but also date_approval + print ''; + if (!$i) $totalarray['nbfield']++; + } + // Date approval + if (!empty($arrayfields['cp.date_approval']['checked'])) { + print ''; + if (!$i) $totalarray['nbfield']++; + } + + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + + // Date creation + if (!empty($arrayfields['cp.date_create']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.tms']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + if (!empty($arrayfields['cp.statut']['checked'])) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + // Action column + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + if (!$i) { + $totalarray['nbfield']++; + } + } + + print ''."\n"; } + $i++; } - // Si il n'y a pas d'enregistrement suite Ă  une recherche - if ($num == 0) { - $colspan = 1; + // Add a line for total if there is a total to show + if ($mode != 'kanban' && !empty($arrayfields['duration']['checked'])) { + print ''; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } foreach ($arrayfields as $key => $val) { if (!empty($val['checked'])) { - $colspan++; + if ($key == 'duration') { + print ''; + } else { + print ''; + } } } - print ''; + // status + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } + print ''; } - - print '
'; - $searchpicto = $form->showFilterButtons('left'); - print $searchpicto; - print ''; - print ''; - print ''; + print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); + print ''; - print $form->select_dolusers($search_employee, "search_employee", 1, "", $disabled, $include, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ''; - $validator = new UserGroup($db); - $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; - $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); - $valideurarray = array(); - foreach ($valideurobjects as $val) { - $valideurarray[$val] = $val; - } - print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); - print ' '; - if (empty($mysoc->country_id)) { - setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); - } else { - $typeleaves = $holidaystatic->getTypes(1, -1); - $arraytypeleaves = array(); - foreach ($typeleaves as $key => $val) { - $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); - //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); - $arraytypeleaves[$val['rowid']] = $labeltoshow; - } - print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); + $validator = new UserGroup($db); + $excludefilter = $user->admin ? '' : 'u.rowid <> '.$user->id; + $valideurobjects = $validator->listUsersForGroup($excludefilter, 1); + $valideurarray = array(); + foreach ($valideurobjects as $val) { + $valideurarray[$val] = $val; } + print $form->select_dolusers($search_valideur, "search_valideur", 1, "", 0, $valideurarray, '', 0, 0, 0, $morefilter, 0, '', 'maxwidth125'); print ' '; - print ''; - print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); - print ''; + if (empty($mysoc->country_id)) { + setEventMessages(null, array($langs->trans("ErrorSetACountryFirst"), $langs->trans("CompanyFoundation")), 'errors'); + } else { + $typeleaves = $holidaystatic->getTypes(1, -1); + $arraytypeleaves = array(); + foreach ($typeleaves as $key => $val) { + $labeltoshow = ($langs->trans($val['code']) != $val['code'] ? $langs->trans($val['code']) : $val['label']); + //$labeltoshow .= ($val['delay'] > 0 ? ' ('.$langs->trans("NoticePeriod").': '.$val['delay'].' '.$langs->trans("days").')':''); + $arraytypeleaves[$val['rowid']] = $labeltoshow; + } + print $form->selectarray('search_type', $arraytypeleaves, $search_type, 1, 0, 0, '', 0, 0, 0, '', 'maxwidth100', 1); } + print ''; - print ''; - print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); - print ' '; - print ''; + print ''; + print $formother->selectyear($search_year_start, 'search_year_start', 1, $min_year, $max_year); + print ''; - print ''; + print ''; + print $formother->selectyear($search_year_end, 'search_year_end', 1, $min_year, $max_year); + print ''; + print ''; - print ''; - print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); - print ''; + print ''; - print ''; - print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); - print ''; - $object->selectStatutCP($search_status, 'search_status', 'minwidth125'); - print ''; - $searchpicto = $form->showFilterButtons(); - print $searchpicto; - print ''; + print ''; + print $formother->selectyear($search_year_create, 'search_year_create', 1, $min_year, 0); + print '
'; + print ''; + print $formother->selectyear($search_year_update, 'search_year_update', 1, $min_year, 0); + print '
'; + print $object->selectStatutCP($search_status, 'search_status', 'search_status width100 onrightofpage'); + print ''; + $searchpicto = $form->showFilterButtons(); + print $searchpicto; + print '
'.$langs->trans("NotEnoughPermissions").'
'.$langs->trans("NotEnoughPermissions").'
'; - print '
'; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + + if ($mode == 'kanban') { + if ($i == 0) { + print '
'; + print '
'; + } + + $holidaystatic->fk_type = empty($typeleaves[$obj->fk_type]['rowid']) ? 0 : $typeleaves[$obj->fk_type]['rowid']; + + // Output Kanban + if ($massactionbutton || $massaction) { + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + if (empty($typeleaves[$obj->fk_type])) { + $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); + } else { + $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); } - $holidaystatic->fk_type = $typeleaves[$obj->fk_type]['rowid']; - - // Output Kanban - if ($massactionbutton || $massaction) { + $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); + } + print $holidaystatic->getKanbanView('', $arraydata); + if ($i == ($imaxinloop - 1)) { + print '
'; + print '
'; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; - if (in_array($object->id, $arrayofselected)) { + if (in_array($obj->rowid, $arrayofselected)) { $selected = 1; } - if (empty($typeleaves[$obj->fk_type])) { - $labeltypeleavetoshow = $langs->trans("TypeWasDisabledOrRemoved", $obj->fk_type); - } else { - $labeltypeleavetoshow = ($langs->trans($typeleaves[$obj->fk_type]['code']) != $typeleaves[$obj->fk_type]['code'] ? $langs->trans($typeleaves[$obj->fk_type]['code']) : $typeleaves[$obj->fk_type]['label']); - } - - $arraydata = array('user'=>$userstatic, 'labeltype'=>$labeltypeleavetoshow); - print $holidaystatic->getKanbanView('', $arraydata); - } - if ($i == ($imaxinloop - 1)) { - print ''; - print '
'; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print ''; - print $holidaystatic->getNomUrl(1, 1); - print ''.$userstatic->getNomUrl(-1, 'leave').''.$approbatorstatic->getNomUrl(-1).''; - print $labeltypeleavetoshow; - print ''; - $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates - $totalduration += $nbopenedday; - print $nbopenedday; - //print ' '.$langs->trans('DurationDays'); - print ''; - print dol_print_date($db->jdate($obj->date_debut), 'day'); - print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_fin), 'day'); - print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; - print ''; - print dol_print_date($db->jdate($obj->date_valid), 'day'); - print ''; - print dol_print_date($db->jdate($obj->date_approval), 'day'); - print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; - if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined - $selected = 0; - if (in_array($obj->rowid, $arrayofselected)) { - $selected = 1; - } - print ''; - } - print '
'.$totalduration.' '.$langs->trans('DurationDays').''; + print $holidaystatic->getNomUrl(1, 1); + print ''.$userstatic->getNomUrl(-1, 'leave').'
'.$approbatorstatic->getNomUrl(-1).''; + print $labeltypeleavetoshow; + print ''; + $nbopenedday = num_open_day($db->jdate($obj->date_debut, 1), $db->jdate($obj->date_fin, 1), 0, 1, $obj->halfday); // user jdate(..., 1) because num_open_day need UTC dates + $totalduration += $nbopenedday; + print $nbopenedday; + //print ' '.$langs->trans('DurationDays'); + print ''; + print dol_print_date($db->jdate($obj->date_debut), 'day'); + print ' ('.$langs->trans($listhalfday[$starthalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_fin), 'day'); + print ' ('.$langs->trans($listhalfday[$endhalfday]).')'; + print ''; + print dol_print_date($db->jdate($obj->date_valid), 'day'); + print ''; + print dol_print_date($db->jdate($obj->date_approval), 'day'); + print ''.dol_print_date($date, 'dayhour').''.dol_print_date($date_modif, 'dayhour').''.$holidaystatic->getLibStatut(5).''; + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($obj->rowid, $arrayofselected)) { + $selected = 1; + } + print ''; + } + print '
'.$totalduration.' '.$langs->trans('DurationDays').'
'.$langs->trans("NoRecordFound").'
'; - print '
'; - - print '
'; -} else { - dol_print_error($db); } +// If no record found +if ($num == 0) { + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } + print ''.$langs->trans("NoRecordFound").''; +} + +$db->free($resql); + +$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print ''."\n"; +print '
'."\n"; + +print ''."\n"; + // End of page llxFooter(); $db->close(); diff --git a/htdocs/install/mysql/data/llx_00_c_country.sql b/htdocs/install/mysql/data/llx_00_c_country.sql index bbc0be55335..829d6ffe8cb 100644 --- a/htdocs/install/mysql/data/llx_00_c_country.sql +++ b/htdocs/install/mysql/data/llx_00_c_country.sql @@ -279,255 +279,255 @@ INSERT INTO llx_c_country (rowid, code, code_iso, label, active, favorite) VALUE -UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG"; -UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA"; -UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB"; -UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU"; -UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND"; -UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO"; -UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA"; -UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA"; -UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG"; -UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU"; -UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA"; -UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG"; -UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM"; -UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW"; -UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS"; -UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT"; -UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE"; -UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS"; -UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD"; -UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB"; -UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR"; -UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL"; -UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ"; -UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN"; -UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU"; -UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR"; -UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL"; -UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES"; -UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH"; -UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA"; -UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA"; -UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN"; -UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR"; -UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA"; -UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI"; -UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN"; -UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV"; -UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM"; -UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR"; -UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN"; -UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT"; -UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD"; -UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL"; -UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN"; -UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP"; -UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL"; -UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM"; -UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK"; -UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR"; -UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV"; -UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI"; -UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV"; -UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB"; -UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW"; -UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK"; -UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA"; -UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU"; -UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY"; -UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV"; -UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE"; -UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI"; -UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK"; -UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN"; -UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP"; -UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA"; -UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST"; -UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH"; -UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL"; -UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN"; -UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI"; -UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA"; -UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB"; -UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB"; -UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO"; -UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA"; -UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB"; -UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD"; -UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC"; -UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL"; -UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP"; -UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM"; -UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM"; -UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF"; -UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY"; -UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN"; -UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB"; -UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ"; -UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY"; -UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI"; -UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND"; -UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG"; -UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN"; -UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND"; -UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN"; -UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ"; -UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN"; -UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL"; -UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT"; -UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN"; -UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR"; -UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL"; -UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM"; -UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK"; -UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK"; -UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO"; -UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS"; -UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD"; -UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK"; -UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP"; -UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL"; -UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN"; -UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB"; -UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA"; -UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI"; -UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB"; -UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR"; -UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR"; -UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA"; -UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM"; -UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN"; -UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY"; -UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR"; -UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ"; -UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN"; -UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ"; -UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR"; -UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT"; -UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO"; -UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO"; -UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA"; -UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN"; -UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR"; -UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY"; -UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE"; -UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU"; -UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX"; -UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC"; -UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD"; -UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG"; -UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS"; -UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI"; -UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV"; -UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI"; -UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT"; -UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR"; -UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ"; -UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS"; -UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT"; -UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT"; -UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX"; -UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM"; -UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA"; -UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO"; -UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG"; -UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE"; -UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR"; -UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ"; -UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR"; -UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM"; -UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU"; -UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL"; -UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC"; -UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER"; -UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA"; -UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU"; -UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK"; -UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR"; -UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL"; -UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL"; -UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN"; -UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD"; -UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK"; -UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW"; -UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE"; -UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN"; -UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG"; -UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY"; -UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER"; -UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF"; -UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL"; -UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT"; -UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI"; -UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR"; -UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH"; -UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF"; -UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE"; -UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG"; -UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD"; -UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM"; -UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU"; -UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA"; -UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU"; -UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS"; -UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM"; -UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM"; -UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM"; -UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA"; -UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR"; -UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF"; -UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM"; -UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT"; -UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN"; -UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA"; -UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP"; -UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN"; -UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB"; -UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC"; -UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE"; -UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP"; -UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM"; -UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR"; -UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM"; -UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA"; -UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ"; -UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF"; -UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN"; -UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD"; -UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE"; -UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE"; -UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR"; -UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM"; -UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA"; -UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN"; -UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA"; -UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK"; -UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT"; -UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF"; -UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS"; -UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO"; -UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL"; -UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON"; -UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO"; -UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN"; -UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM"; -UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR"; -UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV"; -UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR"; -UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA"; -UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY"; -UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB"; -UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT"; -UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT"; -UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN"; -UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM"; -UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF"; -UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM"; -UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI"; -UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB"; -UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE"; +UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG'; +UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA'; +UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB'; +UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU'; +UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND'; +UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO'; +UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA'; +UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA'; +UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG'; +UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU'; +UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA'; +UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG'; +UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM'; +UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW'; +UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS'; +UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT'; +UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE'; +UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS'; +UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD'; +UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB'; +UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR'; +UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL'; +UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ'; +UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN'; +UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU'; +UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR'; +UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL'; +UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES'; +UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH'; +UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA'; +UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA'; +UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN'; +UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR'; +UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA'; +UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI'; +UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN'; +UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV'; +UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM'; +UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR'; +UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN'; +UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT'; +UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD'; +UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL'; +UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN'; +UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP'; +UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL'; +UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM'; +UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK'; +UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR'; +UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV'; +UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI'; +UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV'; +UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB'; +UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW'; +UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK'; +UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA'; +UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU'; +UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY'; +UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV'; +UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE'; +UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI'; +UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK'; +UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN'; +UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP'; +UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA'; +UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST'; +UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH'; +UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL'; +UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN'; +UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI'; +UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA'; +UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB'; +UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB'; +UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO'; +UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA'; +UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB'; +UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD'; +UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC'; +UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL'; +UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP'; +UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM'; +UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM'; +UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF'; +UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY'; +UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN'; +UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB'; +UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ'; +UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY'; +UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI'; +UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND'; +UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG'; +UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN'; +UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND'; +UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN'; +UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ'; +UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN'; +UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL'; +UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT'; +UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN'; +UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR'; +UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL'; +UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM'; +UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK'; +UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK'; +UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO'; +UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS'; +UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD'; +UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK'; +UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP'; +UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL'; +UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN'; +UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB'; +UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA'; +UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI'; +UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB'; +UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR'; +UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR'; +UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA'; +UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM'; +UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN'; +UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY'; +UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR'; +UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ'; +UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN'; +UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ'; +UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR'; +UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT'; +UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO'; +UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO'; +UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA'; +UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN'; +UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR'; +UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY'; +UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE'; +UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU'; +UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX'; +UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC'; +UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD'; +UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG'; +UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS'; +UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI'; +UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV'; +UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI'; +UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT'; +UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR'; +UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ'; +UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS'; +UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT'; +UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT'; +UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX'; +UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM'; +UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA'; +UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO'; +UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG'; +UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE'; +UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR'; +UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ'; +UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR'; +UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM'; +UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU'; +UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL'; +UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC'; +UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER'; +UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA'; +UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU'; +UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK'; +UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR'; +UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL'; +UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL'; +UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN'; +UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD'; +UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK'; +UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW'; +UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE'; +UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN'; +UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG'; +UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY'; +UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER'; +UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF'; +UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL'; +UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT'; +UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI'; +UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR'; +UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH'; +UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF'; +UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE'; +UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG'; +UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD'; +UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM'; +UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU'; +UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA'; +UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU'; +UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS'; +UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM'; +UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM'; +UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM'; +UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA'; +UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR'; +UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF'; +UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM'; +UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT'; +UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN'; +UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA'; +UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP'; +UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN'; +UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB'; +UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC'; +UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE'; +UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP'; +UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM'; +UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR'; +UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM'; +UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA'; +UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ'; +UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF'; +UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN'; +UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD'; +UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE'; +UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE'; +UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR'; +UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM'; +UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA'; +UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN'; +UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA'; +UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK'; +UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT'; +UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF'; +UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS'; +UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO'; +UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL'; +UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON'; +UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO'; +UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN'; +UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM'; +UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR'; +UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV'; +UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR'; +UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA'; +UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY'; +UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB'; +UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT'; +UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT'; +UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN'; +UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM'; +UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF'; +UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM'; +UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI'; +UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB'; +UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE'; diff --git a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql index 4ec2e7228b2..a1e24fa6d2c 100644 --- a/htdocs/install/mysql/migration/16.0.0-17.0.0.sql +++ b/htdocs/install/mysql/migration/16.0.0-17.0.0.sql @@ -33,8 +33,9 @@ -- Missing in v16 or lower - +ALTER TABLE llx_accounting_account DROP FOREIGN KEY fk_accounting_account_fk_pcg_version; ALTER TABLE llx_accounting_system MODIFY COLUMN pcg_version varchar(32) NOT NULL; +ALTER TABLE llx_accounting_account ADD CONSTRAINT fk_accounting_account_fk_pcg_version FOREIGN KEY (fk_pcg_version) REFERENCES llx_accounting_system (pcg_version); ALTER TABLE llx_c_action_trigger MODIFY elementtype VARCHAR(64); diff --git a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql index e1830c6473b..1299e5f3a13 100644 --- a/htdocs/install/mysql/migration/17.0.0-18.0.0.sql +++ b/htdocs/install/mysql/migration/17.0.0-18.0.0.sql @@ -123,254 +123,254 @@ ALTER TABLE llx_element_time ADD INDEX idx_element_time_datehour (element_dateho ALTER TABLE llx_c_country ADD COLUMN numeric_code VARCHAR(3); -UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = "AFG"; -UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = "ALA"; -UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = "ALB"; -UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = "DEU"; -UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = "AND"; -UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = "AGO"; -UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = "AIA"; -UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = "ATA"; -UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = "ATG"; -UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = "SAU"; -UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = "DZA"; -UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = "ARG"; -UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = "ARM"; -UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = "ABW"; -UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = "AUS"; -UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = "AUT"; -UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = "AZE"; -UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = "BHS"; -UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = "BGD"; -UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = "BRB"; -UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = "BHR"; -UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = "BEL"; -UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = "BLZ"; -UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = "BEN"; -UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = "BMU"; -UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = "BLR"; -UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = "BOL"; -UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = "BES"; -UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = "BIH"; -UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = "BWA"; -UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = "BRA"; -UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = "BRN"; -UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = "BGR"; -UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = "BFA"; -UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = "BDI"; -UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = "BTN"; -UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = "CPV"; -UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = "KHM"; -UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = "CMR"; -UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = "CAN"; -UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = "QAT"; -UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = "TCD"; -UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = "CHL"; -UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = "CHN"; -UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = "CYP"; -UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = "COL"; -UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = "COM"; -UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = "PRK"; -UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = "KOR"; -UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = "CIV"; -UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = "CRI"; -UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = "HRV"; -UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = "CUB"; -UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = "CUW"; -UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = "DNK"; -UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = "DMA"; -UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = "ECU"; -UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = "EGY"; -UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = "SLV"; -UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = "ARE"; -UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = "ERI"; -UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = "SVK"; -UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = "SVN"; -UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = "ESP"; -UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = "USA"; -UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = "EST"; -UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = "ETH"; -UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = "PHL"; -UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = "FIN"; -UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = "FJI"; -UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = "FRA"; -UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = "GAB"; -UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = "GMB"; -UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = "GEO"; -UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = "GHA"; -UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = "GIB"; -UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = "GRD"; -UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = "GRC"; -UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = "GRL"; -UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = "GLP"; -UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = "GUM"; -UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = "GTM"; -UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = "GUF"; -UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = "GGY"; -UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = "GIN"; -UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = "GNB"; -UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = "GNQ"; -UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = "GUY"; -UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = "HTI"; -UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = "HND"; -UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = "HKG"; -UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = "HUN"; -UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = "IND"; -UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = "IDN"; -UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = "IRQ"; -UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = "IRN"; -UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = "IRL"; -UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = "BVT"; -UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = "IMN"; -UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = "CXR"; -UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = "ISL"; -UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = "CYM"; -UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = "CCK"; -UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = "COK"; -UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = "FRO"; -UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = "SGS"; -UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = "HMD"; -UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = "FLK"; -UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = "MNP"; -UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = "MHL"; -UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = "PCN"; -UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = "SLB"; -UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = "TCA"; -UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = "UMI"; -UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = "VGB"; -UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = "VIR"; -UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = "ISR"; -UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = "ITA"; -UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = "JAM"; -UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = "JPN"; -UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = "JEY"; -UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = "JOR"; -UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = "KAZ"; -UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = "KEN"; -UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = "KGZ"; -UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = "KIR"; -UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = "KWT"; -UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = "LAO"; -UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = "LSO"; -UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = "LVA"; -UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = "LBN"; -UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = "LBR"; -UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = "LBY"; -UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = "LIE"; -UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = "LTU"; -UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = "LUX"; -UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = "MAC"; -UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = "MKD"; -UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = "MDG"; -UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = "MYS"; -UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = "MWI"; -UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = "MDV"; -UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = "MLI"; -UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = "MLT"; -UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = "MAR"; -UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = "MTQ"; -UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = "MUS"; -UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = "MRT"; -UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = "MYT"; -UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = "MEX"; -UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = "FSM"; -UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = "MDA"; -UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = "MCO"; -UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = "MNG"; -UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = "MNE"; -UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = "MSR"; -UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = "MOZ"; -UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = "MMR"; -UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = "NAM"; -UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = "NRU"; -UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = "NPL"; -UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = "NIC"; -UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = "NER"; -UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = "NGA"; -UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = "NIU"; -UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = "NFK"; -UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = "NOR"; -UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = "NCL"; -UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = "NZL"; -UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = "OMN"; -UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = "NLD"; -UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = "PAK"; -UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = "PLW"; -UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = "PSE"; -UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = "PAN"; -UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = "PNG"; -UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = "PRY"; -UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = "PER"; -UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = "PYF"; -UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = "POL"; -UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = "PRT"; -UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = "PRI"; -UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = "GBR"; -UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = "ESH"; -UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = "CAF"; -UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = "CZE"; -UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = "COG"; -UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = "COD"; -UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = "DOM"; -UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = "REU"; -UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = "RWA"; -UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = "ROU"; -UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = "RUS"; -UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = "WSM"; -UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = "ASM"; -UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = "BLM"; -UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = "KNA"; -UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = "SMR"; -UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = "MAF"; -UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = "SPM"; -UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = "VCT"; -UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = "SHN"; -UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = "LCA"; -UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = "STP"; -UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = "SEN"; -UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = "SRB"; -UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = "SYC"; -UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = "SLE"; -UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = "SGP"; -UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = "SXM"; -UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = "SYR"; -UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = "SOM"; -UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = "LKA"; -UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = "SWZ"; -UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = "ZAF"; -UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = "SDN"; -UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = "SSD"; -UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = "SWE"; -UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = "CHE"; -UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = "SUR"; -UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = "SJM"; -UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = "THA"; -UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = "TWN"; -UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = "TZA"; -UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = "TJK"; -UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = "IOT"; -UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = "ATF"; -UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = "TLS"; -UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = "TGO"; -UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = "TKL"; -UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = "TON"; -UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = "TTO"; -UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = "TUN"; -UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = "TKM"; -UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = "TUR"; -UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = "TUV"; -UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = "UKR"; -UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = "UGA"; -UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = "URY"; -UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = "UZB"; -UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = "VUT"; -UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = "VAT"; -UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = "VEN"; -UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = "VNM"; -UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = "WLF"; -UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = "YEM"; -UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = "DJI"; -UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = "ZMB"; -UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = "ZWE"; +UPDATE llx_c_country SET numeric_code = '004' WHERE code_iso = 'AFG'; +UPDATE llx_c_country SET numeric_code = '248' WHERE code_iso = 'ALA'; +UPDATE llx_c_country SET numeric_code = '008' WHERE code_iso = 'ALB'; +UPDATE llx_c_country SET numeric_code = '276' WHERE code_iso = 'DEU'; +UPDATE llx_c_country SET numeric_code = '020' WHERE code_iso = 'AND'; +UPDATE llx_c_country SET numeric_code = '024' WHERE code_iso = 'AGO'; +UPDATE llx_c_country SET numeric_code = '660' WHERE code_iso = 'AIA'; +UPDATE llx_c_country SET numeric_code = '010' WHERE code_iso = 'ATA'; +UPDATE llx_c_country SET numeric_code = '028' WHERE code_iso = 'ATG'; +UPDATE llx_c_country SET numeric_code = '682' WHERE code_iso = 'SAU'; +UPDATE llx_c_country SET numeric_code = '012' WHERE code_iso = 'DZA'; +UPDATE llx_c_country SET numeric_code = '032' WHERE code_iso = 'ARG'; +UPDATE llx_c_country SET numeric_code = '051' WHERE code_iso = 'ARM'; +UPDATE llx_c_country SET numeric_code = '533' WHERE code_iso = 'ABW'; +UPDATE llx_c_country SET numeric_code = '036' WHERE code_iso = 'AUS'; +UPDATE llx_c_country SET numeric_code = '040' WHERE code_iso = 'AUT'; +UPDATE llx_c_country SET numeric_code = '031' WHERE code_iso = 'AZE'; +UPDATE llx_c_country SET numeric_code = '044' WHERE code_iso = 'BHS'; +UPDATE llx_c_country SET numeric_code = '050' WHERE code_iso = 'BGD'; +UPDATE llx_c_country SET numeric_code = '052' WHERE code_iso = 'BRB'; +UPDATE llx_c_country SET numeric_code = '048' WHERE code_iso = 'BHR'; +UPDATE llx_c_country SET numeric_code = '056' WHERE code_iso = 'BEL'; +UPDATE llx_c_country SET numeric_code = '084' WHERE code_iso = 'BLZ'; +UPDATE llx_c_country SET numeric_code = '204' WHERE code_iso = 'BEN'; +UPDATE llx_c_country SET numeric_code = '060' WHERE code_iso = 'BMU'; +UPDATE llx_c_country SET numeric_code = '112' WHERE code_iso = 'BLR'; +UPDATE llx_c_country SET numeric_code = '068' WHERE code_iso = 'BOL'; +UPDATE llx_c_country SET numeric_code = '535' WHERE code_iso = 'BES'; +UPDATE llx_c_country SET numeric_code = '070' WHERE code_iso = 'BIH'; +UPDATE llx_c_country SET numeric_code = '072' WHERE code_iso = 'BWA'; +UPDATE llx_c_country SET numeric_code = '076' WHERE code_iso = 'BRA'; +UPDATE llx_c_country SET numeric_code = '096' WHERE code_iso = 'BRN'; +UPDATE llx_c_country SET numeric_code = '100' WHERE code_iso = 'BGR'; +UPDATE llx_c_country SET numeric_code = '854' WHERE code_iso = 'BFA'; +UPDATE llx_c_country SET numeric_code = '108' WHERE code_iso = 'BDI'; +UPDATE llx_c_country SET numeric_code = '064' WHERE code_iso = 'BTN'; +UPDATE llx_c_country SET numeric_code = '132' WHERE code_iso = 'CPV'; +UPDATE llx_c_country SET numeric_code = '116' WHERE code_iso = 'KHM'; +UPDATE llx_c_country SET numeric_code = '120' WHERE code_iso = 'CMR'; +UPDATE llx_c_country SET numeric_code = '124' WHERE code_iso = 'CAN'; +UPDATE llx_c_country SET numeric_code = '634' WHERE code_iso = 'QAT'; +UPDATE llx_c_country SET numeric_code = '148' WHERE code_iso = 'TCD'; +UPDATE llx_c_country SET numeric_code = '152' WHERE code_iso = 'CHL'; +UPDATE llx_c_country SET numeric_code = '156' WHERE code_iso = 'CHN'; +UPDATE llx_c_country SET numeric_code = '196' WHERE code_iso = 'CYP'; +UPDATE llx_c_country SET numeric_code = '170' WHERE code_iso = 'COL'; +UPDATE llx_c_country SET numeric_code = '174' WHERE code_iso = 'COM'; +UPDATE llx_c_country SET numeric_code = '408' WHERE code_iso = 'PRK'; +UPDATE llx_c_country SET numeric_code = '410' WHERE code_iso = 'KOR'; +UPDATE llx_c_country SET numeric_code = '384' WHERE code_iso = 'CIV'; +UPDATE llx_c_country SET numeric_code = '188' WHERE code_iso = 'CRI'; +UPDATE llx_c_country SET numeric_code = '191' WHERE code_iso = 'HRV'; +UPDATE llx_c_country SET numeric_code = '192' WHERE code_iso = 'CUB'; +UPDATE llx_c_country SET numeric_code = '531' WHERE code_iso = 'CUW'; +UPDATE llx_c_country SET numeric_code = '208' WHERE code_iso = 'DNK'; +UPDATE llx_c_country SET numeric_code = '212' WHERE code_iso = 'DMA'; +UPDATE llx_c_country SET numeric_code = '218' WHERE code_iso = 'ECU'; +UPDATE llx_c_country SET numeric_code = '818' WHERE code_iso = 'EGY'; +UPDATE llx_c_country SET numeric_code = '222' WHERE code_iso = 'SLV'; +UPDATE llx_c_country SET numeric_code = '784' WHERE code_iso = 'ARE'; +UPDATE llx_c_country SET numeric_code = '232' WHERE code_iso = 'ERI'; +UPDATE llx_c_country SET numeric_code = '703' WHERE code_iso = 'SVK'; +UPDATE llx_c_country SET numeric_code = '705' WHERE code_iso = 'SVN'; +UPDATE llx_c_country SET numeric_code = '724' WHERE code_iso = 'ESP'; +UPDATE llx_c_country SET numeric_code = '840' WHERE code_iso = 'USA'; +UPDATE llx_c_country SET numeric_code = '233' WHERE code_iso = 'EST'; +UPDATE llx_c_country SET numeric_code = '231' WHERE code_iso = 'ETH'; +UPDATE llx_c_country SET numeric_code = '608' WHERE code_iso = 'PHL'; +UPDATE llx_c_country SET numeric_code = '246' WHERE code_iso = 'FIN'; +UPDATE llx_c_country SET numeric_code = '242' WHERE code_iso = 'FJI'; +UPDATE llx_c_country SET numeric_code = '250' WHERE code_iso = 'FRA'; +UPDATE llx_c_country SET numeric_code = '266' WHERE code_iso = 'GAB'; +UPDATE llx_c_country SET numeric_code = '270' WHERE code_iso = 'GMB'; +UPDATE llx_c_country SET numeric_code = '268' WHERE code_iso = 'GEO'; +UPDATE llx_c_country SET numeric_code = '288' WHERE code_iso = 'GHA'; +UPDATE llx_c_country SET numeric_code = '292' WHERE code_iso = 'GIB'; +UPDATE llx_c_country SET numeric_code = '308' WHERE code_iso = 'GRD'; +UPDATE llx_c_country SET numeric_code = '300' WHERE code_iso = 'GRC'; +UPDATE llx_c_country SET numeric_code = '304' WHERE code_iso = 'GRL'; +UPDATE llx_c_country SET numeric_code = '312' WHERE code_iso = 'GLP'; +UPDATE llx_c_country SET numeric_code = '316' WHERE code_iso = 'GUM'; +UPDATE llx_c_country SET numeric_code = '320' WHERE code_iso = 'GTM'; +UPDATE llx_c_country SET numeric_code = '254' WHERE code_iso = 'GUF'; +UPDATE llx_c_country SET numeric_code = '831' WHERE code_iso = 'GGY'; +UPDATE llx_c_country SET numeric_code = '324' WHERE code_iso = 'GIN'; +UPDATE llx_c_country SET numeric_code = '624' WHERE code_iso = 'GNB'; +UPDATE llx_c_country SET numeric_code = '226' WHERE code_iso = 'GNQ'; +UPDATE llx_c_country SET numeric_code = '328' WHERE code_iso = 'GUY'; +UPDATE llx_c_country SET numeric_code = '332' WHERE code_iso = 'HTI'; +UPDATE llx_c_country SET numeric_code = '340' WHERE code_iso = 'HND'; +UPDATE llx_c_country SET numeric_code = '344' WHERE code_iso = 'HKG'; +UPDATE llx_c_country SET numeric_code = '348' WHERE code_iso = 'HUN'; +UPDATE llx_c_country SET numeric_code = '356' WHERE code_iso = 'IND'; +UPDATE llx_c_country SET numeric_code = '360' WHERE code_iso = 'IDN'; +UPDATE llx_c_country SET numeric_code = '368' WHERE code_iso = 'IRQ'; +UPDATE llx_c_country SET numeric_code = '364' WHERE code_iso = 'IRN'; +UPDATE llx_c_country SET numeric_code = '372' WHERE code_iso = 'IRL'; +UPDATE llx_c_country SET numeric_code = '074' WHERE code_iso = 'BVT'; +UPDATE llx_c_country SET numeric_code = '833' WHERE code_iso = 'IMN'; +UPDATE llx_c_country SET numeric_code = '162' WHERE code_iso = 'CXR'; +UPDATE llx_c_country SET numeric_code = '352' WHERE code_iso = 'ISL'; +UPDATE llx_c_country SET numeric_code = '136' WHERE code_iso = 'CYM'; +UPDATE llx_c_country SET numeric_code = '166' WHERE code_iso = 'CCK'; +UPDATE llx_c_country SET numeric_code = '184' WHERE code_iso = 'COK'; +UPDATE llx_c_country SET numeric_code = '234' WHERE code_iso = 'FRO'; +UPDATE llx_c_country SET numeric_code = '239' WHERE code_iso = 'SGS'; +UPDATE llx_c_country SET numeric_code = '334' WHERE code_iso = 'HMD'; +UPDATE llx_c_country SET numeric_code = '238' WHERE code_iso = 'FLK'; +UPDATE llx_c_country SET numeric_code = '580' WHERE code_iso = 'MNP'; +UPDATE llx_c_country SET numeric_code = '584' WHERE code_iso = 'MHL'; +UPDATE llx_c_country SET numeric_code = '612' WHERE code_iso = 'PCN'; +UPDATE llx_c_country SET numeric_code = '090' WHERE code_iso = 'SLB'; +UPDATE llx_c_country SET numeric_code = '796' WHERE code_iso = 'TCA'; +UPDATE llx_c_country SET numeric_code = '581' WHERE code_iso = 'UMI'; +UPDATE llx_c_country SET numeric_code = '092' WHERE code_iso = 'VGB'; +UPDATE llx_c_country SET numeric_code = '850' WHERE code_iso = 'VIR'; +UPDATE llx_c_country SET numeric_code = '376' WHERE code_iso = 'ISR'; +UPDATE llx_c_country SET numeric_code = '380' WHERE code_iso = 'ITA'; +UPDATE llx_c_country SET numeric_code = '388' WHERE code_iso = 'JAM'; +UPDATE llx_c_country SET numeric_code = '392' WHERE code_iso = 'JPN'; +UPDATE llx_c_country SET numeric_code = '832' WHERE code_iso = 'JEY'; +UPDATE llx_c_country SET numeric_code = '400' WHERE code_iso = 'JOR'; +UPDATE llx_c_country SET numeric_code = '398' WHERE code_iso = 'KAZ'; +UPDATE llx_c_country SET numeric_code = '404' WHERE code_iso = 'KEN'; +UPDATE llx_c_country SET numeric_code = '417' WHERE code_iso = 'KGZ'; +UPDATE llx_c_country SET numeric_code = '296' WHERE code_iso = 'KIR'; +UPDATE llx_c_country SET numeric_code = '414' WHERE code_iso = 'KWT'; +UPDATE llx_c_country SET numeric_code = '418' WHERE code_iso = 'LAO'; +UPDATE llx_c_country SET numeric_code = '426' WHERE code_iso = 'LSO'; +UPDATE llx_c_country SET numeric_code = '428' WHERE code_iso = 'LVA'; +UPDATE llx_c_country SET numeric_code = '422' WHERE code_iso = 'LBN'; +UPDATE llx_c_country SET numeric_code = '430' WHERE code_iso = 'LBR'; +UPDATE llx_c_country SET numeric_code = '434' WHERE code_iso = 'LBY'; +UPDATE llx_c_country SET numeric_code = '438' WHERE code_iso = 'LIE'; +UPDATE llx_c_country SET numeric_code = '440' WHERE code_iso = 'LTU'; +UPDATE llx_c_country SET numeric_code = '442' WHERE code_iso = 'LUX'; +UPDATE llx_c_country SET numeric_code = '446' WHERE code_iso = 'MAC'; +UPDATE llx_c_country SET numeric_code = '807' WHERE code_iso = 'MKD'; +UPDATE llx_c_country SET numeric_code = '450' WHERE code_iso = 'MDG'; +UPDATE llx_c_country SET numeric_code = '458' WHERE code_iso = 'MYS'; +UPDATE llx_c_country SET numeric_code = '454' WHERE code_iso = 'MWI'; +UPDATE llx_c_country SET numeric_code = '462' WHERE code_iso = 'MDV'; +UPDATE llx_c_country SET numeric_code = '466' WHERE code_iso = 'MLI'; +UPDATE llx_c_country SET numeric_code = '470' WHERE code_iso = 'MLT'; +UPDATE llx_c_country SET numeric_code = '504' WHERE code_iso = 'MAR'; +UPDATE llx_c_country SET numeric_code = '474' WHERE code_iso = 'MTQ'; +UPDATE llx_c_country SET numeric_code = '480' WHERE code_iso = 'MUS'; +UPDATE llx_c_country SET numeric_code = '478' WHERE code_iso = 'MRT'; +UPDATE llx_c_country SET numeric_code = '175' WHERE code_iso = 'MYT'; +UPDATE llx_c_country SET numeric_code = '484' WHERE code_iso = 'MEX'; +UPDATE llx_c_country SET numeric_code = '583' WHERE code_iso = 'FSM'; +UPDATE llx_c_country SET numeric_code = '498' WHERE code_iso = 'MDA'; +UPDATE llx_c_country SET numeric_code = '492' WHERE code_iso = 'MCO'; +UPDATE llx_c_country SET numeric_code = '496' WHERE code_iso = 'MNG'; +UPDATE llx_c_country SET numeric_code = '499' WHERE code_iso = 'MNE'; +UPDATE llx_c_country SET numeric_code = '500' WHERE code_iso = 'MSR'; +UPDATE llx_c_country SET numeric_code = '508' WHERE code_iso = 'MOZ'; +UPDATE llx_c_country SET numeric_code = '104' WHERE code_iso = 'MMR'; +UPDATE llx_c_country SET numeric_code = '516' WHERE code_iso = 'NAM'; +UPDATE llx_c_country SET numeric_code = '520' WHERE code_iso = 'NRU'; +UPDATE llx_c_country SET numeric_code = '524' WHERE code_iso = 'NPL'; +UPDATE llx_c_country SET numeric_code = '558' WHERE code_iso = 'NIC'; +UPDATE llx_c_country SET numeric_code = '562' WHERE code_iso = 'NER'; +UPDATE llx_c_country SET numeric_code = '566' WHERE code_iso = 'NGA'; +UPDATE llx_c_country SET numeric_code = '570' WHERE code_iso = 'NIU'; +UPDATE llx_c_country SET numeric_code = '574' WHERE code_iso = 'NFK'; +UPDATE llx_c_country SET numeric_code = '578' WHERE code_iso = 'NOR'; +UPDATE llx_c_country SET numeric_code = '540' WHERE code_iso = 'NCL'; +UPDATE llx_c_country SET numeric_code = '554' WHERE code_iso = 'NZL'; +UPDATE llx_c_country SET numeric_code = '512' WHERE code_iso = 'OMN'; +UPDATE llx_c_country SET numeric_code = '528' WHERE code_iso = 'NLD'; +UPDATE llx_c_country SET numeric_code = '586' WHERE code_iso = 'PAK'; +UPDATE llx_c_country SET numeric_code = '585' WHERE code_iso = 'PLW'; +UPDATE llx_c_country SET numeric_code = '275' WHERE code_iso = 'PSE'; +UPDATE llx_c_country SET numeric_code = '591' WHERE code_iso = 'PAN'; +UPDATE llx_c_country SET numeric_code = '598' WHERE code_iso = 'PNG'; +UPDATE llx_c_country SET numeric_code = '600' WHERE code_iso = 'PRY'; +UPDATE llx_c_country SET numeric_code = '604' WHERE code_iso = 'PER'; +UPDATE llx_c_country SET numeric_code = '258' WHERE code_iso = 'PYF'; +UPDATE llx_c_country SET numeric_code = '616' WHERE code_iso = 'POL'; +UPDATE llx_c_country SET numeric_code = '620' WHERE code_iso = 'PRT'; +UPDATE llx_c_country SET numeric_code = '630' WHERE code_iso = 'PRI'; +UPDATE llx_c_country SET numeric_code = '826' WHERE code_iso = 'GBR'; +UPDATE llx_c_country SET numeric_code = '732' WHERE code_iso = 'ESH'; +UPDATE llx_c_country SET numeric_code = '140' WHERE code_iso = 'CAF'; +UPDATE llx_c_country SET numeric_code = '203' WHERE code_iso = 'CZE'; +UPDATE llx_c_country SET numeric_code = '178' WHERE code_iso = 'COG'; +UPDATE llx_c_country SET numeric_code = '180' WHERE code_iso = 'COD'; +UPDATE llx_c_country SET numeric_code = '214' WHERE code_iso = 'DOM'; +UPDATE llx_c_country SET numeric_code = '638' WHERE code_iso = 'REU'; +UPDATE llx_c_country SET numeric_code = '646' WHERE code_iso = 'RWA'; +UPDATE llx_c_country SET numeric_code = '642' WHERE code_iso = 'ROU'; +UPDATE llx_c_country SET numeric_code = '643' WHERE code_iso = 'RUS'; +UPDATE llx_c_country SET numeric_code = '882' WHERE code_iso = 'WSM'; +UPDATE llx_c_country SET numeric_code = '016' WHERE code_iso = 'ASM'; +UPDATE llx_c_country SET numeric_code = '652' WHERE code_iso = 'BLM'; +UPDATE llx_c_country SET numeric_code = '659' WHERE code_iso = 'KNA'; +UPDATE llx_c_country SET numeric_code = '674' WHERE code_iso = 'SMR'; +UPDATE llx_c_country SET numeric_code = '663' WHERE code_iso = 'MAF'; +UPDATE llx_c_country SET numeric_code = '666' WHERE code_iso = 'SPM'; +UPDATE llx_c_country SET numeric_code = '670' WHERE code_iso = 'VCT'; +UPDATE llx_c_country SET numeric_code = '654' WHERE code_iso = 'SHN'; +UPDATE llx_c_country SET numeric_code = '662' WHERE code_iso = 'LCA'; +UPDATE llx_c_country SET numeric_code = '678' WHERE code_iso = 'STP'; +UPDATE llx_c_country SET numeric_code = '686' WHERE code_iso = 'SEN'; +UPDATE llx_c_country SET numeric_code = '688' WHERE code_iso = 'SRB'; +UPDATE llx_c_country SET numeric_code = '690' WHERE code_iso = 'SYC'; +UPDATE llx_c_country SET numeric_code = '694' WHERE code_iso = 'SLE'; +UPDATE llx_c_country SET numeric_code = '702' WHERE code_iso = 'SGP'; +UPDATE llx_c_country SET numeric_code = '534' WHERE code_iso = 'SXM'; +UPDATE llx_c_country SET numeric_code = '760' WHERE code_iso = 'SYR'; +UPDATE llx_c_country SET numeric_code = '706' WHERE code_iso = 'SOM'; +UPDATE llx_c_country SET numeric_code = '144' WHERE code_iso = 'LKA'; +UPDATE llx_c_country SET numeric_code = '748' WHERE code_iso = 'SWZ'; +UPDATE llx_c_country SET numeric_code = '710' WHERE code_iso = 'ZAF'; +UPDATE llx_c_country SET numeric_code = '729' WHERE code_iso = 'SDN'; +UPDATE llx_c_country SET numeric_code = '728' WHERE code_iso = 'SSD'; +UPDATE llx_c_country SET numeric_code = '752' WHERE code_iso = 'SWE'; +UPDATE llx_c_country SET numeric_code = '756' WHERE code_iso = 'CHE'; +UPDATE llx_c_country SET numeric_code = '740' WHERE code_iso = 'SUR'; +UPDATE llx_c_country SET numeric_code = '744' WHERE code_iso = 'SJM'; +UPDATE llx_c_country SET numeric_code = '764' WHERE code_iso = 'THA'; +UPDATE llx_c_country SET numeric_code = '158' WHERE code_iso = 'TWN'; +UPDATE llx_c_country SET numeric_code = '834' WHERE code_iso = 'TZA'; +UPDATE llx_c_country SET numeric_code = '762' WHERE code_iso = 'TJK'; +UPDATE llx_c_country SET numeric_code = '086' WHERE code_iso = 'IOT'; +UPDATE llx_c_country SET numeric_code = '260' WHERE code_iso = 'ATF'; +UPDATE llx_c_country SET numeric_code = '626' WHERE code_iso = 'TLS'; +UPDATE llx_c_country SET numeric_code = '768' WHERE code_iso = 'TGO'; +UPDATE llx_c_country SET numeric_code = '772' WHERE code_iso = 'TKL'; +UPDATE llx_c_country SET numeric_code = '776' WHERE code_iso = 'TON'; +UPDATE llx_c_country SET numeric_code = '780' WHERE code_iso = 'TTO'; +UPDATE llx_c_country SET numeric_code = '788' WHERE code_iso = 'TUN'; +UPDATE llx_c_country SET numeric_code = '795' WHERE code_iso = 'TKM'; +UPDATE llx_c_country SET numeric_code = '792' WHERE code_iso = 'TUR'; +UPDATE llx_c_country SET numeric_code = '798' WHERE code_iso = 'TUV'; +UPDATE llx_c_country SET numeric_code = '804' WHERE code_iso = 'UKR'; +UPDATE llx_c_country SET numeric_code = '800' WHERE code_iso = 'UGA'; +UPDATE llx_c_country SET numeric_code = '858' WHERE code_iso = 'URY'; +UPDATE llx_c_country SET numeric_code = '860' WHERE code_iso = 'UZB'; +UPDATE llx_c_country SET numeric_code = '548' WHERE code_iso = 'VUT'; +UPDATE llx_c_country SET numeric_code = '336' WHERE code_iso = 'VAT'; +UPDATE llx_c_country SET numeric_code = '862' WHERE code_iso = 'VEN'; +UPDATE llx_c_country SET numeric_code = '704' WHERE code_iso = 'VNM'; +UPDATE llx_c_country SET numeric_code = '876' WHERE code_iso = 'WLF'; +UPDATE llx_c_country SET numeric_code = '887' WHERE code_iso = 'YEM'; +UPDATE llx_c_country SET numeric_code = '262' WHERE code_iso = 'DJI'; +UPDATE llx_c_country SET numeric_code = '894' WHERE code_iso = 'ZMB'; +UPDATE llx_c_country SET numeric_code = '716' WHERE code_iso = 'ZWE'; diff --git a/htdocs/master.inc.php b/htdocs/master.inc.php index 8cf649148a6..a3a6da38951 100644 --- a/htdocs/master.inc.php +++ b/htdocs/master.inc.php @@ -222,6 +222,12 @@ if (!defined('NOREQUIREDB') && !defined('NOREQUIRESOC')) { // For FR, default value of option to show category of operations is on by default. Decret n°2099-1299 2022-10-07 $conf->global->INVOICE_CATEGORY_OF_OPERATION = 1; } + + if ($mysoc->localtax1_assuj || $mysoc->localtax2_assuj) { + // For countries using the 2nd or 3rd tax, we disable input/edit of lines using the price including tax (because 2nb and 3rd tax not yet taken into account). + // Work In Progress to support all taxes into unit price entry when MAIN_UNIT_PRICE_WITH_TAX_IS_FOR_ALL_TAXES is set. + $conf->global->MAIN_NO_INPUT_PRICE_WITH_TAX = 1; + } } diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index ec5d8c979ed..e0cdd1f8ab4 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -547,14 +547,14 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; - $parameters = array('type'=>$type); + $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print '
'; } $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; -$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table @@ -631,7 +631,7 @@ $totalarray['nbfield'] = 0; // -------------------------------------------------------------------- print ''; if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } foreach ($object->fields as $key => $val) { @@ -663,7 +663,7 @@ print $hookmanager->resPrint; }*/ // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; $totalarray['nbfield']++; } print ''."\n"; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index eb2f0f35069..89a189a98c8 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -1821,7 +1821,6 @@ class Task extends CommonObjectLine } if (!$error) { - $timespent = new TimeSpent($this->db); $timespent->fetch($this->timespent_id); diff --git a/htdocs/projet/tasks.php b/htdocs/projet/tasks.php index 7be9a3c93f5..9e448b6cf45 100644 --- a/htdocs/projet/tasks.php +++ b/htdocs/projet/tasks.php @@ -1111,11 +1111,11 @@ if ($action == 'create' && $user->rights->projet->creer && (empty($object->third $j = 0; $level = 0; $nboftaskshown = projectLinesa($j, 0, $tasksarray, $level, true, 0, $tasksrole, $object->id, 1, $object->id, $filterprogresscalc, ($object->usage_bill_time ? 1 : 0), $arrayfields, $arrayofselected); } else { - $colspan = 10; + $colspan = 11; if ($object->usage_bill_time) { $colspan += 2; } - print ''.$langs->trans("NoTasks").''; + print ''.$langs->trans("NoTasks").''; } print ""; diff --git a/htdocs/public/ticket/create_ticket.php b/htdocs/public/ticket/create_ticket.php index 80ea664292b..2bb574def50 100644 --- a/htdocs/public/ticket/create_ticket.php +++ b/htdocs/public/ticket/create_ticket.php @@ -512,7 +512,7 @@ $arrayofcss = array('/opensurvey/css/style.css', '/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("CreateTicket"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; if ($action != "infos_success") { $formticket->withfromsocid = isset($socid) ? $socid : $user->socid; diff --git a/htdocs/public/ticket/index.php b/htdocs/public/ticket/index.php index 97af18c0bb6..a36a0023324 100644 --- a/htdocs/public/ticket/index.php +++ b/htdocs/public/ticket/index.php @@ -80,7 +80,7 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; print '

'.(getDolGlobalString("TICKET_PUBLIC_TEXT_HOME", ''.$langs->trans("TicketPublicDesc")).'

').'

'; print '
'; diff --git a/htdocs/public/ticket/list.php b/htdocs/public/ticket/list.php index aafea0365e0..8e56d57e871 100644 --- a/htdocs/public/ticket/list.php +++ b/htdocs/public/ticket/list.php @@ -193,9 +193,8 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); - if ($action == "view_ticketlist") { - print '
'; + print '
'; print '
'; if ($display_ticket_list) { @@ -426,6 +425,7 @@ if ($action == "view_ticketlist") { $reshook=$hookmanager->executeHooks('printFieldListHeader', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; + print '
'; print ''; // Filter bar @@ -697,6 +697,8 @@ if ($action == "view_ticketlist") { } print '
'; + print '
'; + print ''; print '
'; } else { - print '
'; + print '
'; print '

'.$langs->trans("TicketPublicMsgViewLogIn").'

'; print '
'; diff --git a/htdocs/public/ticket/view.php b/htdocs/public/ticket/view.php index 67b582c0afd..b8f5b48fbac 100644 --- a/htdocs/public/ticket/view.php +++ b/htdocs/public/ticket/view.php @@ -232,7 +232,7 @@ $arrayofcss = array('/ticket/css/styles.css.php'); llxHeaderTicket($langs->trans("Tickets"), "", 0, 0, $arrayofjs, $arrayofcss); -print '
'; +print '
'; if ($action == "view_ticket" || $action == "presend" || $action == "close" || $action == "confirm_public_close") { if ($display_ticket) { @@ -382,7 +382,7 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a // Close ticket if ($object->dao->fk_statut >= Ticket::STATUS_NOT_READ && $object->dao->fk_statut < Ticket::STATUS_CLOSED) { - print ''; + print ''; } } @@ -396,10 +396,11 @@ if ($action == "view_ticket" || $action == "presend" || $action == "close" || $a print ''; } } else { - print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; + print '
'.$langs->trans("TicketPublicMsgViewLogIn").'
'; print '
'; print ''; + print ''; print ''; diff --git a/htdocs/public/users/view.php b/htdocs/public/users/view.php index 0eaeb1b6c8f..c62420c76d8 100644 --- a/htdocs/public/users/view.php +++ b/htdocs/public/users/view.php @@ -205,7 +205,7 @@ $arrayofjs = array(); $arrayofcss = array(); $replacemainarea = (empty($conf->dol_hide_leftmenu) ? '
' : '').'
'; -llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview nopointervent' : ''), $replacemainarea, 1, 1); +llxHeader($head, $object->getFullName($langs).' - '.$langs->trans("PublicVirtualCard"), '', '', 0, 0, '', '', '', 'onlinepaymentbody'.(GETPOST('mode')=='preview' ? ' scalepreview cursorpointer virtualcardpreview' : ''), $replacemainarea, 1, 1); print ''."\n"; print '
'."\n"; @@ -451,8 +451,6 @@ print '
'."\n"; print '
'; -//htmlPrintOnlinePaymentFooter($mysoc, $langs); - print ''; print '
'; +$fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); +$fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); + +print ''; + llxFooter('', 'public'); $db->close(); diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 42afd27304b..8e2114f9bae 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -1248,10 +1248,12 @@ if ($action == 'create' || $action == 'presend') { } print ''; // Group - print ''.$langs->trans("TicketCategory").''; + $s = ''; if (!empty($object->category_code)) { - print $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); + $s = $langs->getLabelFromKey($db, 'TicketCategoryShort'.$object->category_code, 'c_ticket_category', 'code', 'label', $object->category_code); } + print ''.$langs->trans("TicketCategory").''; + print dol_escape_htmltag($s); print ''; // Severity print ''.$langs->trans("TicketSeverity").''; diff --git a/htdocs/ticket/css/styles.css.php b/htdocs/ticket/css/styles.css.php index 81d7d21748f..2ebc3420a14 100644 --- a/htdocs/ticket/css/styles.css.php +++ b/htdocs/ticket/css/styles.css.php @@ -124,4 +124,10 @@ div.ticketform .index_create, div.ticketform .index_display { @media only screen and (max-width: 767px) { #form_create_ticket input.text, #form_create_ticket textarea { width: unset;} + + #form_create_ticket, #form_view_ticket + { + margin-left: 0; + margin-right: 0; + } } diff --git a/htdocs/user/card.php b/htdocs/user/card.php index 8db29a87449..dfd90b4dc0f 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1046,13 +1046,13 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? ' + ' : '').$langs->trans("HTTPBasicPassword"); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if (!empty($ldap_pass)) { // For very old system comaptibilty. Now clear password can't be viewed from LDAP read $valuetoshow .= ($valuetoshow ? ' + ' : '').''; // Dolibarr password is preffiled with LDAP known password $valuetoshow .= preg_replace('/./i', '*', $ldap_pass); } else { // We do not use a field password but a field text to show new password to use. - $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; + $valuetoshow .= ($valuetoshow ? ' + '.$langs->trans("DolibarrPassword") : '').''; if (!empty($conf->use_javascript_ajax)) { $valuetoshow .= ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_password" class="linkobject"'); } @@ -1076,7 +1076,7 @@ if ($action == 'create' || $action == 'adduserldap') { //$generated_password = getRandomPassword(false); print ''.$langs->trans("ApiKey").''; print ''; - print ''; + print ''; if (!empty($conf->use_javascript_ajax)) { print ' '.img_picto($langs->trans('Generate'), 'refresh', 'id="generate_api_key" class="linkobject"'); } @@ -2423,14 +2423,16 @@ if ($action == 'create' || $action == 'adduserldap') { if (preg_match('/http/', $dolibarr_main_authentication)) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').$form->textwithpicto($text, $langs->trans("DolibarrInHttpAuthenticationSoPasswordUseless", $dolibarr_main_authentication), 1, 'warning'); } - if (preg_match('/dolibarr/', $dolibarr_main_authentication)) { + if (preg_match('/dolibarr/', $dolibarr_main_authentication) || preg_match('/forceuser/', $dolibarr_main_authentication)) { if ($caneditpassword) { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').''; + if (!empty($conf->use_javascript_ajax)) { + $valuetoshow .= ' '.img_picto((getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? $langs->trans('NoPasswordGenerationRuleConfigured') : $langs->trans('Generate')), 'refresh', 'id="generate_password" class="'.(getDolGlobalString('USER_PASSWORD_GENERATED') === 'none' ? ' opacitymedium' : ' linkobject').'"'); + } } else { $valuetoshow .= ($valuetoshow ? (' '.$langs->trans("or").' ') : '').preg_replace('/./i', '*', $object->pass); } } - // Other form for user password $parameters = array('valuetoshow' => $valuetoshow, 'caneditpassword' => $caneditpassword); $reshook = $hookmanager->executeHooks('printUserPasswordField', $parameters, $object, $action); // Note that $action and $object may have been modified by hook diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index c4c0b4e2b92..1186cf7a914 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -35,9 +35,11 @@ * \ingroup core */ +require_once DOL_DOCUMENT_ROOT.'/core/lib/security.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; + /** * Class to manage Dolibarr users */ @@ -509,7 +511,7 @@ class User extends CommonObject $this->pass_indatabase_crypted = $obj->pass_crypted; $this->pass = $obj->pass; $this->pass_temp = $obj->pass_temp; - $this->api_key = $obj->api_key; + $this->api_key = dolDecrypt($obj->api_key); $this->address = $obj->address; $this->zip = $obj->zip; @@ -1963,7 +1965,7 @@ class User extends CommonObject $sql .= ", national_registration_number = '".$this->db->escape($this->national_registration_number)."'"; $sql .= ", employee = ".(int) $this->employee; $sql .= ", login = '".$this->db->escape($this->login)."'"; - $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape($this->api_key)."'" : "null"); + $sql .= ", api_key = ".($this->api_key ? "'".$this->db->escape(dolEncrypt($this->api_key, '', '', 'dolibarr'))."'" : "null"); $sql .= ", gender = ".($this->gender != -1 ? "'".$this->db->escape($this->gender)."'" : "null"); // 'man' or 'woman' $sql .= ", birth=".(strval($this->birth) != '' ? "'".$this->db->idate($this->birth, 'tzserver')."'" : 'null'); if (!empty($user->admin)) { @@ -3867,9 +3869,10 @@ class User extends CommonObject * Return string with full Url to virtual card * * @param string $mode Mode for link + * @param string $typeofurl 'external' or 'internal' * @return string Url string link */ - public function getOnlineVirtualCardUrl($mode = '') + public function getOnlineVirtualCardUrl($mode = '', $typeofurl = 'external') { global $dolibarr_main_instance_unique_id, $dolibarr_main_url_root; global $conf; @@ -3885,6 +3888,10 @@ class User extends CommonObject $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file //$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current + if ($typeofurl == 'internal') { + $urlwithroot = DOL_URL_ROOT; + } + return $urlwithroot.'/public/users/view.php?id='.$this->id.'&securekey='.$encodedsecurekey.$entity_qr.($mode ? '&mode='.urlencode($mode) : ''); } diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9bf322b49b6..7f237b385ad 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -116,7 +116,7 @@ class UserGroup extends CommonObject 'rowid'=>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), 'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'notnull'=> 1, 'default'=>1, 'index'=>1, 'position'=>5), 'nom'=>array('type'=>'varchar(180)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Group name'), - 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1,), + 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>1, 'visible'=>1, 'position'=>20, 'notnull'=>-1, 'searchall'=>1), 'datec' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>50, 'notnull'=>1,), 'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'position'=>60, 'notnull'=>1,), 'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPDF', 'enabled'=>1, 'visible'=>0, 'position'=>100), diff --git a/htdocs/user/group/card.php b/htdocs/user/group/card.php index 7bafaf5aee5..60c1c30e9fb 100644 --- a/htdocs/user/group/card.php +++ b/htdocs/user/group/card.php @@ -473,7 +473,7 @@ if ($action == 'create') { print "\n"; } } else { - print ''.$langs->trans("None").''; + print ''.$langs->trans("None").''; } print ""; print '
'; diff --git a/htdocs/user/group/list.php b/htdocs/user/group/list.php index 94331d44d3d..54117de403a 100644 --- a/htdocs/user/group/list.php +++ b/htdocs/user/group/list.php @@ -30,9 +30,9 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/user/class/usergroup.class.php'; // Load translation files required by page -$langs->load("users"); +$langs->loadLangs(array("users")); -$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ... +$action = GETPOST('action', 'aZ09') ? GETPOST('action', 'aZ09') : 'view'; // The action 'create'/'add', 'edit'/'update', 'view', ... $massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists) $show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ? $confirm = GETPOST('confirm', 'alpha'); // Result of a confirmation @@ -40,8 +40,8 @@ $cancel = GETPOST('cancel', 'alpha'); // We click on a Cancel button $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search $backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page -$optioncss = GETPOST('optioncss', 'aZ09'); // Option for the css output (always '' except when 'print') -$mode = GETPOST('mode', 'aZ'); +$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print') +$mode = GETPOST('mode', 'aZ'); // The output mode ('list', 'kanban', 'hierarchy', 'calendar', ...) $search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml')); $search_group = GETPOST('search_group'); @@ -64,7 +64,7 @@ $pagenext = $page + 1; $object = new UserGroup($db); $extrafields = new ExtraFields($db); //$diroutputmassaction = $conf->mymodule->dir_output.'/temp/massgeneration/'.$user->id; -//$hookmanager->initHooks(array('myobjectlist')); // Note that conf->hooks_modules contains array +$hookmanager->initHooks(array($contextpage)); // Note that conf->hooks_modules contains array of activated contexes // Fetch optionals attributes and labels $extrafields->fetch_name_optionals_label($object->table_element); @@ -80,10 +80,12 @@ if (!$sortorder) { } // List of fields to search into when doing a "search in all" -$fieldstosearchall = array( - 'g.nom'=>"Group", - 'g.note'=>"Note" -); +$fieldstosearchall = array(); +foreach ($object->fields as $key => $val) { + if (!empty($val['searchall'])) { + $fieldstosearchall['t.'.$key] = $val['label']; + } +} if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { if (!$user->hasRight("user", "group_advance", "read") && !$user->admin) { @@ -102,6 +104,7 @@ if (!$user->hasRight("user", "user", "read") && !$user->admin) { // Defini si peux lire/modifier utilisateurs et permisssions $caneditperms = ($user->admin || $user->hasRight("user", "user", "write")); +$permissiontodelete = ($user->admin || $user->hasRight("user", "user", "write")); // Advanced permissions if (!empty($conf->global->MAIN_USE_ADVANCED_PERMS)) { $caneditperms = ($user->admin || $user->hasRight("user", "group_advance", "write")); @@ -146,6 +149,12 @@ if (empty($reshook)) { || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) { $massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation } + + // Mass actions + $objectclass = 'UserGroup'; + $objectlabel = 'UserGroup'; + $uploaddir = $conf->user->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; } @@ -155,8 +164,10 @@ if (empty($reshook)) { $form = new Form($db); -$help_url = ''; +$now = dol_now(); + $title = $langs->trans("UserGroups"); +$help_url = ''; $morejs = array(); $morecss = array(); @@ -214,7 +225,7 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { $param .= '&contextpage='.urlencode($contextpage); } if ($limit > 0 && $limit != $conf->liste_limit) { - $param .= '&limit='.urlencode($limit); + $param .= '&limit='.((int) $limit); } foreach ($search as $key => $val) { if (is_array($search[$key])) { @@ -238,7 +249,7 @@ if ($optioncss != '') { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; // Add $param from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -267,6 +278,7 @@ print ''; print ''; print ''; print ''; +print ''; print ''; $newcardbutton = ''; @@ -274,11 +286,18 @@ $newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars i $newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition')); if ($caneditperms) { + $newcardbutton .= dolGetButtonTitleSeparator(); $newcardbutton .= dolGetButtonTitle($langs->trans('NewGroup'), '', 'fa fa-plus-circle', DOL_URL_ROOT.'/user/group/card.php?action=create&leftmenu='); } +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1); -print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_group', 0, $newcardbutton, '', $limit, 0, 0, 1); +// Add code for pre mass action (confirmation or email presend form) +$topicmail = "SendGroup"; +$modelmail = "group"; +$objecttmp = new UserGroup($db); +$trackid = 'grp'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; if ($search_all) { $setupstring = ''; @@ -286,14 +305,14 @@ if ($search_all) { $fieldstosearchall[$key] = $langs->trans($val); $setupstring .= $key."=".$val.";"; } - print ''."\n"; + print ''."\n"; print '
'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'
'."\n"; } $moreforfilter = ''; $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -303,16 +322,15 @@ if (empty($reshook)) { if (!empty($moreforfilter)) { print '
'; print $moreforfilter; + $parameters = array(); + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; print '
'; } $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; -$arrayfields = array(); -$selectedfields = ''; -if (!empty($arrayfields)) { - $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields - $selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); -} +$selectedfields = ($mode != 'kanban' ? $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')) : ''); // This also change content of $arrayfields +$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : ''); print '
'; print ''."\n"; @@ -327,8 +345,9 @@ $totalarray['nbfield'] = 0; // Fields title label // -------------------------------------------------------------------- print ''; -if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } print_liste_field_titre("Group", $_SERVER["PHP_SELF"], "g.nom", $param, "", "", $sortfield, $sortorder); $totalarray['nbfield']++; @@ -349,17 +368,17 @@ $totalarray['nbfield']++; include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; // Hook fields $parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray); -$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; /*if (!empty($arrayfields['anotherfield']['checked'])) { print ''; $totalarray['nbfield']++; }*/ // Action column -if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { - print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; +if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n"; + $totalarray['nbfield']++; } -$totalarray['nbfield']++; // For the column action print ''."\n"; @@ -390,6 +409,12 @@ while ($i < $imaxinloop) { print '
'; } // Output Kanban + if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + $selected = 0; + if (in_array($object->id, $arrayofselected)) { + $selected = 1; + } + } print $object->getKanbanView(''); if ($i == ($imaxinloop - 1)) { print '
'; @@ -400,7 +425,7 @@ while ($i < $imaxinloop) { $j = 0; print ''; // Action column - if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; + if (!$i) { + $totalarray['nbfield']++; + } } print ''; - } - if (!$i) { - $totalarray['nbfield']++; + if (!$i) { + $totalarray['nbfield']++; + } } print ''."\n"; @@ -485,7 +513,12 @@ if ($num == 0) { $colspan++; } }*/ - $colspan = $savnbfield; + $colspan = 1; + foreach ($arrayfields as $key => $val) { + if (!empty($val['checked'])) { + $colspan++; + } + } print ''; } diff --git a/htdocs/user/list.php b/htdocs/user/list.php index 981c3744028..3ea1307224c 100644 --- a/htdocs/user/list.php +++ b/htdocs/user/list.php @@ -1152,10 +1152,13 @@ while ($i < $imaxinloop) { } } if (!empty($arrayfields['u.api_key']['checked'])) { - print '
'.$langs->trans("AnotherField").'
'; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -410,6 +435,9 @@ while ($i < $imaxinloop) { print ''; } print ''; @@ -451,10 +479,10 @@ while ($i < $imaxinloop) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Action column - if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) { + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined $selected = 0; @@ -464,9 +492,9 @@ while ($i < $imaxinloop) { print ''; } print '
'.$langs->trans("NoRecordFound").'
'; - if ($obj->api_key) { + $api_key = dolDecrypt($obj->api_key); + print ''; + if ($api_key) { if ($canreadsecretapi) { - print dol_escape_htmltag($obj->api_key); + print ''; + print showValueWithClipboardCPButton($object->api_key, 1, dol_trunc($api_key, 3)); // TODO Add an option to also reveal the hash, not only copy paste + print ''; } else { print ''.$langs->trans("Hidden").''; } diff --git a/htdocs/user/virtualcard.php b/htdocs/user/virtualcard.php index 252ae3aca80..55d63c3d40a 100644 --- a/htdocs/user/virtualcard.php +++ b/htdocs/user/virtualcard.php @@ -165,7 +165,8 @@ if (getDolUserInt('USER_ENABLE_PUBLIC', 0, $object)) { //print $langs->trans('FollowingLinksArePublic').'
'; print img_picto('', 'globe').' '.$langs->trans('PublicVirtualCardUrl').'
'; - $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl(); + $fullexternaleurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'external'); + $fullinternalurltovirtualcard = $object->getOnlineVirtualCardUrl('', 'internal'); print '