From c66823d72fe76881274d8798daf90f07d504dc45 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Sun, 14 Oct 2018 17:07:38 +0200 Subject: [PATCH 1/3] Fix numbering of supplier credit notes (issue #9624) --- htdocs/admin/supplier_invoice.php | 7 +++++-- .../mod_facture_fournisseur_tulip.php | 12 ++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/htdocs/admin/supplier_invoice.php b/htdocs/admin/supplier_invoice.php index 75a917dd185..5dbe26596fe 100644 --- a/htdocs/admin/supplier_invoice.php +++ b/htdocs/admin/supplier_invoice.php @@ -56,9 +56,12 @@ $specimenthirdparty->initAsSpecimen(); if ($action == 'updateMask') { $maskconstinvoice=GETPOST('maskconstinvoice','alpha'); - $maskvalue=GETPOST('maskinvoice','alpha'); + $maskconstcredit=GETPOST('maskconstcredit','alpha'); + $maskinvoice=GETPOST('maskinvoice','alpha'); + $maskcredit=GETPOST('maskcredit','alpha'); - if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskvalue,'chaine',0,'',$conf->entity); + if ($maskconstinvoice) $res = dolibarr_set_const($db,$maskconstinvoice,$maskinvoice,'chaine',0,'',$conf->entity); + if ($maskconstcredit) $res = dolibarr_set_const($db,$maskconstcredit,$maskcredit,'chaine',0,'',$conf->entity); if (! $res > 0) $error++; diff --git a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php index 2e155c04df8..7c595fe4e9d 100644 --- a/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php +++ b/htdocs/core/modules/supplier_invoice/mod_facture_fournisseur_tulip.php @@ -72,14 +72,18 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $tooltip.=$langs->trans("GenericMaskCodes5"); // Parametrage du prefix - $texte.= ''.$langs->trans("Mask"); - //$texte.= ' ('.$langs->trans("InvoiceStandard").')'; + $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceStandard").')'; $texte.= ':'; $texte.= ''.$form->textwithpicto('',$tooltip,1,1).''; $texte.= '  '; $texte.= ''; + + // Parametrage du prefix des avoirs + $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; + $texte.= ''.$form->textwithpicto('',$tooltip,1,1).''; + $texte.= ''; if ($conf->global->MAIN_FEATURE_LEVEL >= 2) { @@ -88,10 +92,6 @@ class mod_facture_fournisseur_tulip extends ModeleNumRefSuppliersInvoices $texte.= ''.$form->textwithpicto('',$tooltip,1,1).''; $texte.= ''; - // Parametrage du prefix des avoirs - $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceAvoir").'):'; - $texte.= ''.$form->textwithpicto('',$tooltip,1,1).''; - $texte.= ''; // Parametrage du prefix des acomptes $texte.= ''.$langs->trans("Mask").' ('.$langs->trans("InvoiceDeposit").'):'; From c9aaf01a7c6dceb13f40c74145384c92c5488cbd Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Tue, 16 Oct 2018 20:56:10 +0200 Subject: [PATCH 2/3] MOVE ticket dictionnary in API /setup --- htdocs/api/class/api_setup.class.php | 181 +++++++++++++++++++++++++++ 1 file changed, 181 insertions(+) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index ef2b4c8bb6d..a8c7456cf05 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -578,7 +578,188 @@ class Setup extends DolibarrApi return $list; } + +if ($conf->ticket->enabled) { + /** + * Get the list of tickets categories. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return List of events types + * + * @url GET dictionary/ticket_categories + * + * @throws RestException + */ + function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + $list = array(); + $sql = "SELECT rowid, code, pos, label, use_default, description"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_category as t"; + $sql.= " WHERE t.active = 1"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of ticket categories : '.$this->db->lasterror()); + } + + return $list; + } + + /** + * Get the list of tickets severity. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return List of events types + * + * @url GET dictionary/ticket_severities + * + * @throws RestException + */ + function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid, code, pos, label, use_default, color, description"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_severity as t"; + $sql.= " WHERE t.active = 1"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of ticket severities : '.$this->db->lasterror()); + } + + return $list; + } + + /** + * Get the list of tickets types. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return List of events types + * + * @url GET dictionary/ticket_types + * + * @throws RestException + */ + function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid, code, pos, label, use_default, description"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_ticket_type as t"; + $sql.= " WHERE t.active = 1"; + if ($type) $sql.=" AND t.type LIKE '%" . $this->db->escape($type) . "%'"; + if ($module) $sql.=" AND t.module LIKE '%" . $this->db->escape($module) . "%'"; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of ticket types : '.$this->db->lasterror()); + } + + return $list; + } + +} /** * Do a test of integrity for files and setup. From 737bbf6e7c0835ef5877ef1d5ea13ece4aaaa50b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Oct 2018 21:38:27 +0200 Subject: [PATCH 3/3] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index a8c7456cf05..b9a100972ac 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -579,7 +579,8 @@ class Setup extends DolibarrApi return $list; } -if ($conf->ticket->enabled) { +if (! empty($conf->ticket->enabled)) +{ /** * Get the list of tickets categories. *