diff --git a/ChangeLog b/ChangeLog index 17cebdf9a73..637a8a27407 100644 --- a/ChangeLog +++ b/ChangeLog @@ -167,7 +167,8 @@ NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding am NEW: ticket classification on create from email collector NEW: Ticket message notifications when edited from public interface NEW: translate classification labels in ticket -NEW: Add VAT and juridical status for Algeria +NEW: VAT rate for Angola #15606 +NEW: VAT and juridical status for Algeria NEW: VAT report - Invert constant to show by default zero VAT in reports NEW: website page fields selection NEW: Weighing Scale compatibility with TakePOS connector @@ -211,7 +212,6 @@ NEW: Triggers Attributes and Attributes values NEW: added incoterms data into the substitution array NEW: add send context for ticket NEW: add a message in error_log after detection of SQL or script injection -NEW: add two hooks printFieldListFrom and printFieldSearchParam NEW: add __TYPE__ substitution key NEW: add validation of MX domain for emails NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) @@ -221,6 +221,7 @@ NEW: Hook on propal card NEW: add hooks on newpayment page to allow external payment modules NEW: add hooks on stats pages NEW: add formConfirm hook on product page +NEW: add two hooks printFieldListFrom and printFieldSearchParam WARNING: @@ -269,7 +270,7 @@ FIX: Look and feel v12: First tab must be name of object FIX: missing entity check FIX: missing param for hook FIX: Missing transaction on PO actions -FIX: MySql Strict mode +FIX: MySQL Strict mode FIX: param entity in html form file FIX: Problems on FEC format FIX: round stock value on product list diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 4516d2e1d45..02bb5afbafd 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -111,6 +111,71 @@ class Setup extends DolibarrApi return $list; } + /** + * Get the list of ordering origins. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param int $active Payment type is active or not {@min 0} {@max 1} + * @param string $sqlfilters SQL criteria to filter with. Syntax example "(t.code:=:'OrderByWWW')" + * + * @url GET dictionary/ordering_origins + * + * @return array [List of ordering reasons] + * + * @throws RestException 400 + */ + public function getOrderingOrigins($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + + if (!DolibarrApiAccess::$user->rights->commande->lire) { + throw new RestException(401); + } + + $sql = "SELECT rowid, code, label, module"; + $sql .= " FROM ".MAIN_DB_PREFIX."c_input_reason as t"; + $sql .= " WHERE t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (!DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(400, '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(400, $this->db->lasterror()); + } + + return $list; + } + /** * Get the list of payments types. * diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index 524877746f8..f4fa779fd7d 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -771,11 +771,11 @@ print '
| '.$morehtml.' ';
if ($mode == 'showalltime')
{
- print '';
+ print '';
print $langs->trans("GoBack");
print '';
} else {
- print '';
+ print '';
print $langs->trans("ShowAllTimeBalance");
print '';
}
@@ -793,7 +793,7 @@ if ($mode == 'standard')
if ($nextmonth > 12) { $nextmonth = 1; $nextyear++; }
// For month
- $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"')."";
+ $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Month")." ".img_next('', 'class="valignbottom"')."";
print ' '.$link.' ';
print '';
@@ -807,7 +807,7 @@ if ($mode == 'standard')
// For year
$prevyear = $year - 1; $nextyear = $year + 1;
- $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"')."";
+ $link = "".img_previous('', 'class="valignbottom"')." ".$langs->trans("Year")." ".img_next('', 'class="valignbottom"')."";
print ' '.$link.' ';
diff --git a/htdocs/compta/facture/card-rec.php b/htdocs/compta/facture/card-rec.php
index 4f754fbd173..11dec142a17 100644
--- a/htdocs/compta/facture/card-rec.php
+++ b/htdocs/compta/facture/card-rec.php
@@ -117,6 +117,8 @@ $usercancreatewithdrarequest = $user->rights->prelevement->bons->creer;
$now = dol_now();
+$error = 0;
+
/*
* Actions
@@ -287,13 +289,21 @@ if (empty($reshook))
elseif ($action == 'setref' && $user->rights->facture->creer)
{
//var_dump(GETPOST('ref', 'alpha'));exit;
- $result = $object->setValueFrom('titre', GETPOST('ref', 'alpha'), '', null, 'text', '', $user, 'BILLREC_MODIFY');
+ $result = $object->setValueFrom('titre', $ref, '', null, 'text', '', $user, 'BILLREC_MODIFY');
if ($result > 0)
{
$object->titre = GETPOST('ref', 'alpha'); // deprecated
$object->title = GETPOST('ref', 'alpha');
$object->ref = $object->title;
- } else dol_print_error($db, $object->error, $object->errors);
+ } else {
+ $error++;
+ if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ $langs->load("errors");
+ setEventMessages($langs->trans('ErrorRefAlreadyExists', $ref), null, 'errors');
+ } else {
+ setEventMessages($object->error, $object->errors, 'errors');
+ }
+ }
} // Set bank account
elseif ($action == 'setbankaccount' && $user->rights->facture->creer)
{
diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php
index def74e173a3..110db6d8166 100644
--- a/htdocs/compta/facture/card.php
+++ b/htdocs/compta/facture/card.php
@@ -4074,7 +4074,7 @@ if ($action == 'create')
print $object->getLibType();
print '';
if ($object->module_source) {
- print ' ('.$langs->trans("POS").' '.$object->module_source.' - '.$langs->trans("Terminal").' '.$object->pos_source.')';
+ print ' ('.$langs->trans("POS").' '.ucfirst($object->module_source).' - '.$langs->trans("Terminal").' '.$object->pos_source.')';
}
if ($object->type == Facture::TYPE_REPLACEMENT) {
$facreplaced = new Facture($db);
diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
index 24690895ff5..f4f4d5015cc 100644
--- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
+++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php
@@ -106,7 +106,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$sql .= " AND s.outstanding_limit > 0";
$sql .= " AND s.rowid IN (SELECT fk_soc from ".MAIN_DB_PREFIX."facture as f WHERE f.fk_statut = 1 and f.fk_soc = s.rowid)";
$sql .= " ORDER BY s.tms DESC";
- $sql .= $this->db->plimit($max, 0);
+ //$sql .= $this->db->plimit($max, 0);
dol_syslog(get_class($this)."::loadBox", LOG_DEBUG);
$result = $this->db->query($sql);
@@ -114,10 +114,13 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
{
$num = $this->db->num_rows($result);
+ $nboutstandingbillreachedcustomers = 0;
+
$line = 0;
while ($line < $num)
{
$objp = $this->db->fetch_object($result);
+
$datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->tms);
$thirdpartystatic->id = $objp->socid;
@@ -136,22 +139,21 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes
$outstandingtotal = $thirdpartystatic->getOutstandingBills()['opened'];
$outstandinglimit = $thirdpartystatic->outstanding_limit;
- $nboutstandingbillreachedcustomers = 0;
-
if ($outstandingtotal >= $outstandinglimit)
{
- $this->info_box_contents[$line][] = array(
+ $this->info_box_contents[$nboutstandingbillreachedcustomers][] = array(
'td' => '',
- 'text' => $thirdpartystatic->getNomUrl(1),
+ 'text' => $thirdpartystatic->getNomUrl(1, 'customer'),
'asis' => 1,
);
- $this->info_box_contents[$line][] = array(
+ $this->info_box_contents[$nboutstandingbillreachedcustomers][] = array(
'td' => 'class="right" width="18"',
'text' => $thirdpartystatic->LibStatut($objp->status, 3)
);
$nboutstandingbillreachedcustomers++;
}
+
$line++;
}
diff --git a/htdocs/core/boxes/box_last_modified_ticket.php b/htdocs/core/boxes/box_last_modified_ticket.php
index 2950eb9cfd8..94734894ad7 100644
--- a/htdocs/core/boxes/box_last_modified_ticket.php
+++ b/htdocs/core/boxes/box_last_modified_ticket.php
@@ -204,6 +204,6 @@ class box_last_modified_ticket extends ModeleBoxes
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_last_ticket.php b/htdocs/core/boxes/box_last_ticket.php
index 9ada300901c..268a6861524 100644
--- a/htdocs/core/boxes/box_last_ticket.php
+++ b/htdocs/core/boxes/box_last_ticket.php
@@ -202,6 +202,6 @@ class box_last_ticket extends ModeleBoxes
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/boxes/box_lastlogin.php b/htdocs/core/boxes/box_lastlogin.php
index b45986387a8..c3ddb0fcdff 100644
--- a/htdocs/core/boxes/box_lastlogin.php
+++ b/htdocs/core/boxes/box_lastlogin.php
@@ -111,6 +111,6 @@ class box_lastlogin extends ModeleBoxes
*/
public function showBox($head = null, $contents = null, $nooutput = 0)
{
- parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
+ return parent::showBox($this->info_box_head, $this->info_box_contents, $nooutput);
}
}
diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 243d4d57f7c..33ac1aba696 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1817,7 +1817,11 @@ abstract class CommonObject
return -2;
}
} else {
- $this->error = $this->db->lasterror();
+ if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ $this->error = 'DB_ERROR_RECORD_ALREADY_EXISTS';
+ } else {
+ $this->error = $this->db->lasterror();
+ }
$this->db->rollback();
return -1;
}
@@ -6885,7 +6889,7 @@ abstract class CommonObject
$helptoshow = $langs->trans($extrafields->attributes[$this->table_element]['help'][$key]);
$out .= '';
}
$out .= ' | ';
/*
- * Show boxes
+ * Show widgets (boxes)
*/
$boxlist .= ' | ';
diff --git a/htdocs/install/mysql/data/llx_10_c_regions.sql b/htdocs/install/mysql/data/llx_10_c_regions.sql
index bbb7af35bb7..43d2652298f 100644
--- a/htdocs/install/mysql/data/llx_10_c_regions.sql
+++ b/htdocs/install/mysql/data/llx_10_c_regions.sql
@@ -380,3 +380,7 @@ insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,931,
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,932, '新',0,'新疆维吾尔自治区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,933, '港',0,'香港特别行政区');
insert into llx_c_regions (fk_pays,code_region,cheflieu,tncc,nom) values (9,934, '澳',0,'澳门特别行政区');
+
+-- Regions Angola (rowid country=35)
+INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES (35, 35001, 'AO', NULL, 'Angola');
+
diff --git a/htdocs/install/mysql/data/llx_20_c_departements.sql b/htdocs/install/mysql/data/llx_20_c_departements.sql
index 54ab237c9b8..00f30fab0be 100644
--- a/htdocs/install/mysql/data/llx_20_c_departements.sql
+++ b/htdocs/install/mysql/data/llx_20_c_departements.sql
@@ -1606,3 +1606,23 @@ INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc
INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI038', NULL, NULL, 'UPPER CARNIOLA', 'Upper Carniola');
INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI043', NULL, NULL, 'GORIZIA', 'Gorizia');
INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('20204', 'SI044', NULL, NULL, 'COASTAL–KARST', 'Coastal–Karst');
+
+-- Provinces (postal districts) Angola (rowid country=35)
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-ABO', NULL, NULL, 'BENGO', 'Bengo');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-BGU', NULL, NULL, 'BENGUELA', 'Benguela');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-BIE', NULL, NULL, 'BIÉ', 'Bié');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-CAB', NULL, NULL, 'CABINDA', 'Cabinda');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-CCU', NULL, NULL, 'KUANDO KUBANGO', 'Kuando Kubango');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-CNO', NULL, NULL, 'KWANZA NORTE', 'Kwanza Norte');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-CUS', NULL, NULL, 'KWANZA SUL', 'Kwanza Sul');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-CNN', NULL, NULL, 'CUNENE', 'Cunene');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-HUA', NULL, NULL, 'HUAMBO', 'Huambo');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-HUI', NULL, NULL, 'HUÍLA', 'Huila');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-LUA', NULL, NULL, 'LUANDA', 'Luanda');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-LNO', NULL, NULL, 'LUNDA-NORTE', 'Lunda-Norte');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-LSU',NULL, NULL, 'LUNDA-SUL', 'Lunda-Sul');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-MAL', NULL, NULL, 'MALANGE', 'Malange');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-MOX', NULL, NULL, 'MOXICO', 'Moxico');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-NAM', NULL, NULL, 'NAMÍBE', 'Namíbe');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-UIG', NULL, NULL, 'UÍGE', 'Uíge');
+INSERT INTO llx_c_departements (fk_region, code_departement, cheflieu, tncc, ncc, nom) VALUES ('35001', 'AO-ZAI', NULL, NULL, 'ZAÍRE', 'Zaíre');
diff --git a/htdocs/install/mysql/data/llx_accounting_abc.sql b/htdocs/install/mysql/data/llx_accounting_abc.sql
index d3f9ad5fd69..9118b7a4651 100644
--- a/htdocs/install/mysql/data/llx_accounting_abc.sql
+++ b/htdocs/install/mysql/data/llx_accounting_abc.sql
@@ -8,7 +8,12 @@
-- Copyright (C) 2011-2018 Alexandre Spangaro |