diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php
index 6fad266ea36..d30e851b9a2 100644
--- a/htdocs/adherents/class/api_members.class.php
+++ b/htdocs/adherents/class/api_members.class.php
@@ -358,7 +358,7 @@ class Members extends DolibarrApi
if ($member->update(DolibarrApiAccess::$user) >= 0) {
return $this->get($id);
} else {
- throw new RestException(500, $member->error);
+ throw new RestException(500, 'Error when updating member: '.$member->error);
}
}
diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php
index be8f22f3c45..d95de755166 100644
--- a/htdocs/adherents/class/api_memberstypes.class.php
+++ b/htdocs/adherents/class/api_memberstypes.class.php
@@ -204,7 +204,7 @@ class MembersTypes extends DolibarrApi
if ($membertype->update(DolibarrApiAccess::$user) >= 0) {
return $this->get($id);
} else {
- throw new RestException(500, $membertype->error);
+ throw new RestException(500, 'Error when updating member type: '.$membertype->error);
}
}
diff --git a/htdocs/adherents/class/api_subscriptions.class.php b/htdocs/adherents/class/api_subscriptions.class.php
index 55b93df7663..f969017146b 100644
--- a/htdocs/adherents/class/api_subscriptions.class.php
+++ b/htdocs/adherents/class/api_subscriptions.class.php
@@ -159,7 +159,7 @@ class Subscriptions extends DolibarrApi
$subscription->$field = $value;
}
if ($subscription->create(DolibarrApiAccess::$user) < 0) {
- throw new RestException(500, 'Error when creating subscription', array_merge(array($subscription->error), $subscription->errors));
+ throw new RestException(500, 'Error when creating contribution', array_merge(array($subscription->error), $subscription->errors));
}
return $subscription->id;
}
@@ -193,7 +193,7 @@ class Subscriptions extends DolibarrApi
if ($subscription->update(DolibarrApiAccess::$user) > 0) {
return $this->get($id);
} else {
- throw new RestException(500, $subscription->error);
+ throw new RestException(500, 'Error when updating contribution: '.$subscription->error);
}
}
diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php
index 28dbef6887e..da49e4cbba7 100644
--- a/htdocs/api/class/api_documents.class.php
+++ b/htdocs/api/class/api_documents.class.php
@@ -126,7 +126,7 @@ class Documents extends DolibarrApi
* @param string $langcode Language code like 'en_US', 'fr_FR', 'es_ES', ... (If not set, use the default language).
* @return array List of documents
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 501
* @throws RestException 400
* @throws RestException 401
@@ -249,7 +249,7 @@ class Documents extends DolibarrApi
* @throws RestException 400
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @url GET /
*/
@@ -546,7 +546,7 @@ class Documents extends DolibarrApi
* @throws RestException 400
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @url POST /upload
*/
diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php
index 4a00894d26b..1d084c915d8 100644
--- a/htdocs/comm/action/card.php
+++ b/htdocs/comm/action/card.php
@@ -1491,6 +1491,10 @@ if ($id > 0) {
$("#fullday").change(function() {
setdatefields();
});
+ $("#actioncode").change(function() {
+ if ($("#actioncode").val() == \'AC_RDV\') $("#dateend").addClass("fieldrequired");
+ else $("#dateend").removeClass("fieldrequired");
+ });
})';
print ''."\n";
}
@@ -1535,7 +1539,11 @@ if ($id > 0) {
print '
| ';
+ print ''.$langs->trans("DateActionStart").'';
+ print ' - ';
+ print 'type_code == 'AC_RDV' ? ' class="fieldrequired"' : '').'>'.$langs->trans("DateActionEnd").'';
+ print ' | ';
$tzforfullday = getDolGlobalString('MAIN_STORE_FULL_EVENT_IN_GMT');
if (GETPOST("afaire") == 1) {
print $form->selectDate($datep ? $datep : $object->datep, 'ap', 1, 1, 0, "action", 1, 1, 0, 'fulldaystart', '', '', '', 1, '', '', $object->fulldayevent ? ($tzforfullday ? $tzforfullday : 'tzuser') : 'tzuser');
diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 61ecb966359..76a5c92b4cd 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -246,8 +246,11 @@ if (empty($reshook)) {
// Remove line
$result = $object->deleteline($lineid);
// reorder lines
- if ($result) {
+ if ($result > 0) {
$object->line_order(true);
+ } else {
+ $langs->load("errors");
+ setEventMessages($object->error, $object->errors, 'errors');
}
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php
index f03d66bae54..59a03f78bb2 100644
--- a/htdocs/comm/propal/class/api_proposals.class.php
+++ b/htdocs/comm/propal/class/api_proposals.class.php
@@ -625,7 +625,7 @@ class Proposals extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function deleteContact($id, $contactid, $type)
{
@@ -799,7 +799,7 @@ class Proposals extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @return array
*/
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 6a6031c3a99..e7c1f520949 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -992,6 +992,8 @@ class Propal extends CommonObject
$this->db->commit();
return 1;
} else {
+ $this->error = $line->error;
+ $this->errors = $line->errors;
$this->db->rollback();
return -1;
}
@@ -4194,36 +4196,40 @@ class PropaleLigne extends CommonObjectLine
$error = 0;
$this->db->begin();
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."propaldet WHERE rowid = ".((int) $this->rowid);
- dol_syslog("PropaleLigne::delete", LOG_DEBUG);
- if ($this->db->query($sql)) {
- // Remove extrafields
- if (!$error) {
- $this->id = $this->rowid;
- $result = $this->deleteExtraFields();
- if ($result < 0) {
- $error++;
- dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
- }
+ if (!$notrigger) {
+ // Call trigger
+ $result = $this->call_trigger('LINEPROPAL_DELETE', $user);
+ if ($result < 0) {
+ $error++;
}
+ }
+ // End call triggers
- if (!$error && !$notrigger) {
- // Call trigger
- $result = $this->call_trigger('LINEPROPAL_DELETE', $user);
- if ($result < 0) {
- $this->db->rollback();
- return -1;
+ if (!$error) {
+ $sql = "DELETE FROM " . MAIN_DB_PREFIX . "propaldet WHERE rowid = " . ((int) $this->rowid);
+ dol_syslog("PropaleLigne::delete", LOG_DEBUG);
+ if ($this->db->query($sql)) {
+ // Remove extrafields
+ if (!$error) {
+ $this->id = $this->rowid;
+ $result = $this->deleteExtraFields();
+ if ($result < 0) {
+ $error++;
+ dol_syslog(get_class($this) . "::delete error -4 " . $this->error, LOG_ERR);
+ }
}
+ } else {
+ $this->error = $this->db->error() . " sql=" . $sql;
+ $error++;
}
- // End call triggers
+ }
- $this->db->commit();
-
- return 1;
- } else {
- $this->error = $this->db->error()." sql=".$sql;
+ if ($error) {
$this->db->rollback();
return -1;
+ } else {
+ $this->db->commit();
+ return 1;
}
}
diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php
index 48865f958a2..fb912139d5f 100644
--- a/htdocs/commande/class/api_orders.class.php
+++ b/htdocs/commande/class/api_orders.class.php
@@ -574,7 +574,7 @@ class Orders extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function deleteContact($id, $contactid, $type)
{
@@ -704,7 +704,7 @@ class Orders extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @return array
*/
@@ -974,7 +974,7 @@ class Orders extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function getOrderShipments($id)
{
@@ -1030,7 +1030,7 @@ class Orders extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function createOrderShipment($id, $warehouse_id)
{
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index a73b4fb597f..551edb05731 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -519,7 +519,7 @@ class Invoices extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function deleteContact($id, $contactid, $type)
{
@@ -661,7 +661,7 @@ class Invoices extends DolibarrApi
$result = $this->invoice->delete(DolibarrApiAccess::$user);
if ($result < 0) {
- throw new RestException(500);
+ throw new RestException(500, 'Error when deleting invoice');
}
return array(
@@ -780,7 +780,7 @@ class Invoices extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
*/
public function addContact($id, $fk_socpeople, $type_contact, $source, $notrigger = 0)
@@ -829,7 +829,7 @@ class Invoices extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
*/
public function settodraft($id, $idwarehouse = -1)
@@ -932,7 +932,7 @@ class Invoices extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function settopaid($id, $close_code = '', $close_note = '')
{
@@ -982,7 +982,7 @@ class Invoices extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function settounpaid($id)
{
@@ -1069,7 +1069,7 @@ class Invoices extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function markAsCreditAvailable($id)
{
diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php
index 0c8eefdef44..55bd7071ee8 100644
--- a/htdocs/contrat/list.php
+++ b/htdocs/contrat/list.php
@@ -351,7 +351,7 @@ if ($search_dfyear > 0 && $search_op2df) {
}
}
-$nbtotalofrecords = 0;
+$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
//$result = $db->query($sql);
//$nbtotalofrecords = $db->num_rows($result);
diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php
index 7939965828a..bdc5e746566 100644
--- a/htdocs/core/class/discount.class.php
+++ b/htdocs/core/class/discount.class.php
@@ -54,12 +54,21 @@ class DiscountAbsolute
public $fk_soc;
public $discount_type; // 0 => customer discount, 1 => supplier discount
- public $amount_ht; //
- public $amount_tva; //
- public $amount_ttc; //
- public $multicurrency_amount_ht;
- public $multicurrency_amount_tva;
- public $multicurrency_amount_ttc;
+
+ public $total_ht;
+ public $total_tva;
+ public $total_ttc;
+ public $amount_ht; // deprecated
+ public $amount_tva; // deprecated
+ public $amount_ttc; // deprecated
+
+ public $multicurrency_total_ht;
+ public $multicurrency_total_tva;
+ public $multicurrency_total_ttc;
+ public $multicurrency_amount_ht; // deprecated
+ public $multicurrency_amount_tva; // deprecated
+ public $multicurrency_amount_ttc; // deprecated
+
// Vat rate
public $tva_tx;
public $vat_src_code;
@@ -163,13 +172,21 @@ class DiscountAbsolute
$this->fk_soc = $obj->fk_soc;
$this->discount_type = $obj->discount_type;
- $this->amount_ht = $obj->amount_ht;
- $this->amount_tva = $obj->amount_tva;
- $this->amount_ttc = $obj->amount_ttc;
+ $this->total_ht = $obj->amount_ht;
+ $this->total_tva = $obj->amount_tva;
+ $this->total_ttc = $obj->amount_ttc;
+ // For backward compatibility
+ $this->amount_ht = $this->total_ht;
+ $this->amount_tva = $this->total_tva;
+ $this->amount_ttc = $this->total_ttc;
- $this->multicurrency_amount_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
- $this->multicurrency_amount_tva = $obj->multicurrency_amount_tva;
- $this->multicurrency_amount_ttc = $obj->multicurrency_amount_ttc;
+ $this->multicurrency_total_ht = $this->multicurrency_subprice = $obj->multicurrency_amount_ht;
+ $this->multicurrency_total_tva = $obj->multicurrency_amount_tva;
+ $this->multicurrency_total_ttc = $obj->multicurrency_amount_ttc;
+ // For backward compatibility
+ $this->multicurrency_amount_ht = $this->multicurrency_total_ht;
+ $this->multicurrency_amount_tva = $this->multicurrency_total_tva;
+ $this->multicurrency_amount_ttc = $this->multicurrency_total_ttc;
$this->tva_tx = $obj->tva_tx;
$this->vat_src_code = $obj->vat_src_code;
diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
index 68b48af57ea..df4bfeedb9c 100644
--- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php
@@ -897,7 +897,7 @@ class pdf_crabe extends ModelePDFFactures
$tab3_width = 80;
$tab3_height = 4;
if ($this->page_largeur < 210) { // To work with US executive format
- $tab3_posx -= 20;
+ $tab3_posx -= 15;
}
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1289,7 +1289,8 @@ class pdf_crabe extends ModelePDFFactures
$col1x = 120;
$col2x = 170;
if ($this->page_largeur < 210) { // To work with US executive format
- $col2x -= 20;
+ $col1x -= 15;
+ $col2x -= 10;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
diff --git a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
index 7f3b543ebba..5d5b3cf762a 100644
--- a/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
+++ b/htdocs/core/modules/facture/doc/pdf_sponge.modules.php
@@ -540,7 +540,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->useTemplate($tplidx);
}
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
// $this->_pagefoot($pdf,$object,$outputlangs,1);
$pdf->setTopMargin($tab_top_newpage);
@@ -598,7 +598,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->useTemplate($tplidx);
}
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
$height_note = $posyafter - $tab_top_newpage;
$pdf->Rect($this->marge_gauche, $tab_top_newpage - 1, $tab_width, $height_note + 1);
@@ -620,7 +620,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->useTemplate($tplidx);
}
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
$posyafter = $tab_top_newpage;
@@ -922,7 +922,7 @@ class pdf_sponge extends ModelePDFFactures
$pdf->setPage($pagenb);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
}
@@ -940,7 +940,7 @@ class pdf_sponge extends ModelePDFFactures
}
$pagenb++;
if (empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD)) {
- $this->_pagehead($pdf, $object, 0, $outputlangs);
+ $this->_pagehead($pdf, $object, 0, $outputlangs, $outputlangsbis);
}
}
}
@@ -1026,7 +1026,7 @@ class pdf_sponge extends ModelePDFFactures
$tab3_width = 80;
$tab3_height = 4;
if ($this->page_largeur < 210) { // To work with US executive format
- $tab3_posx -= 20;
+ $tab3_posx -= 15;
}
$default_font_size = pdf_getPDFFontSize($outputlangs);
@@ -1356,7 +1356,8 @@ class pdf_sponge extends ModelePDFFactures
$col1x = 120;
$col2x = 170;
if ($this->page_largeur < 210) { // To work with US executive format
- $col2x -= 20;
+ $col1x -= 15;
+ $col2x -= 10;
}
$largcol2 = ($this->page_largeur - $this->marge_droite - $col2x);
diff --git a/htdocs/don/class/api_donations.class.php b/htdocs/don/class/api_donations.class.php
index 597f15b7f10..f9af0568bf0 100644
--- a/htdocs/don/class/api_donations.class.php
+++ b/htdocs/don/class/api_donations.class.php
@@ -293,7 +293,7 @@ class Donations extends DolibarrApi
* @throws RestException 304
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @return array
*/
diff --git a/htdocs/expensereport/class/api_expensereports.class.php b/htdocs/expensereport/class/api_expensereports.class.php
index df942ff93e6..37319a3ec71 100644
--- a/htdocs/expensereport/class/api_expensereports.class.php
+++ b/htdocs/expensereport/class/api_expensereports.class.php
@@ -401,7 +401,7 @@ class ExpenseReports extends DolibarrApi
*
* @throws RestException 401 Not allowed
* @throws RestException 404 Expense report not found
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function put($id, $request_data = null)
{
diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index 06c836b4d77..35e783729ff 100644
--- a/htdocs/fourn/class/api_supplier_invoices.class.php
+++ b/htdocs/fourn/class/api_supplier_invoices.class.php
@@ -211,7 +211,7 @@ class SupplierInvoices extends DolibarrApi
* @return int ID of supplier invoice
*
* @throws RestException 401
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function post($request_data = null)
{
@@ -283,7 +283,7 @@ class SupplierInvoices extends DolibarrApi
*
* @throws RestException 401
* @throws RestException 404
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function delete($id)
{
@@ -300,7 +300,7 @@ class SupplierInvoices extends DolibarrApi
}
if ($this->invoice->delete(DolibarrApiAccess::$user) < 0) {
- throw new RestException(500);
+ throw new RestException(500, 'Error when deleting invoice');
}
return array(
@@ -326,7 +326,7 @@ class SupplierInvoices extends DolibarrApi
* @throws RestException 401
* @throws RestException 404
* @throws RestException 405
- * @throws RestException 500
+ * @throws RestException 500 System error
*/
public function validate($id, $idwarehouse = 0, $notrigger = 0)
{
diff --git a/htdocs/fourn/class/api_supplier_orders.class.php b/htdocs/fourn/class/api_supplier_orders.class.php
index e21eb3436dc..d55a398dbd6 100644
--- a/htdocs/fourn/class/api_supplier_orders.class.php
+++ b/htdocs/fourn/class/api_supplier_orders.class.php
@@ -309,7 +309,7 @@ class SupplierOrders extends DolibarrApi
}
if ($this->order->delete(DolibarrApiAccess::$user) < 0) {
- throw new RestException(500);
+ throw new RestException(500, 'Error when deleting order');
}
return array(
diff --git a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
index 434d30bdfe4..2ec43548bb6 100644
--- a/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
+++ b/htdocs/install/mysql/migration/13.0.0-14.0.0.sql
@@ -84,8 +84,8 @@ UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'a
UPDATE llx_const set value = __ENCRYPT('eldy')__ WHERE __DECRYPT('value')__ = 'cameleo';
DELETE FROM llx_user_param where param = 'MAIN_THEME' and value in ('auguria', 'amarok', 'cameleo');
-ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging varchar(64) DEFAULT NULL;
-ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging varchar(64) DEFAULT NULL;
+ALTER TABLE llx_product_fournisseur_price ADD COLUMN packaging real DEFAULT NULL;
+ALTER TABLE llx_product_fournisseur_price MODIFY COLUMN packaging real DEFAULT NULL;
-- For v14
diff --git a/htdocs/install/mysql/tables/llx_partnership-partnership.key.sql b/htdocs/install/mysql/tables/llx_partnership-partnership.key.sql
index 7d09cdddda8..1a2cf6af5bb 100644
--- a/htdocs/install/mysql/tables/llx_partnership-partnership.key.sql
+++ b/htdocs/install/mysql/tables/llx_partnership-partnership.key.sql
@@ -19,3 +19,6 @@
ALTER TABLE llx_partnership ADD INDEX idx_partnership_entity (entity);
ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_partnership_ref (ref, entity);
+
+ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_soc (fk_type, fk_soc, date_partnership_start);
+ALTER TABLE llx_partnership ADD UNIQUE INDEX uk_fk_type_fk_member (fk_type, fk_member, date_partnership_start);
diff --git a/htdocs/product/class/api_products.class.php b/htdocs/product/class/api_products.class.php
index ad590e0f83c..e44aef221f6 100644
--- a/htdocs/product/class/api_products.class.php
+++ b/htdocs/product/class/api_products.class.php
@@ -742,7 +742,7 @@ class Products extends DolibarrApi
* @param int $fk_barcode_type Barcode type
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url POST {id}/purchase_prices
@@ -1161,7 +1161,7 @@ class Products extends DolibarrApi
* @param string $ref_ext External reference of Attribute
* @return array
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url GET attributes/ref_ext/{ref_ext}
@@ -1212,7 +1212,7 @@ class Products extends DolibarrApi
* @param string $ref_ext Reference of Attribute
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url POST attributes
@@ -1289,7 +1289,7 @@ class Products extends DolibarrApi
* @param int $id ID of Attribute
* @return int Result of deletion
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url DELETE attributes/{id}
@@ -1317,7 +1317,7 @@ class Products extends DolibarrApi
* @param int $id ID of Attribute value
* @return array
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url GET attributes/values/{id}
@@ -1358,7 +1358,7 @@ class Products extends DolibarrApi
* @param string $ref Ref of Attribute value
* @return array
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url GET attributes/{id}/values/ref/{ref}
@@ -1445,7 +1445,7 @@ class Products extends DolibarrApi
* @return array
*
* @throws RestException 401
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @url GET attributes/{id}/values
*/
@@ -1517,7 +1517,7 @@ class Products extends DolibarrApi
* @param string $value Value of Attribute value
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url POST attributes/{id}/values
@@ -1551,7 +1551,7 @@ class Products extends DolibarrApi
* @return array
*
* @throws RestException 401
- * @throws RestException 500
+ * @throws RestException 500 System error
*
* @url PUT attributes/values/{id}
*/
@@ -1596,7 +1596,7 @@ class Products extends DolibarrApi
* @param int $id ID of Attribute value
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url DELETE attributes/values/{id}
@@ -1623,7 +1623,7 @@ class Products extends DolibarrApi
* @param int $includestock Default value 0. If parameter is set to 1 the response will contain stock data of each variant
* @return array
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url GET {id}/variants
@@ -1659,7 +1659,7 @@ class Products extends DolibarrApi
* @param string $ref Ref of Product
* @return array
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url GET ref/{ref}/variants
@@ -1701,7 +1701,7 @@ class Products extends DolibarrApi
* @param string $ref_ext External reference of variant
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
* @throws RestException 404
*
@@ -1758,7 +1758,7 @@ class Products extends DolibarrApi
* @param array $features List of attributes pairs id_attribute->id_value. Example: array(id_color=>id_Blue, id_size=>id_small, id_option=>id_val_a, ...)
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
* @throws RestException 404
*
@@ -1813,7 +1813,7 @@ class Products extends DolibarrApi
* @param array $request_data Datas
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url PUT variants/{id}
@@ -1847,7 +1847,7 @@ class Products extends DolibarrApi
* @param int $id ID of Variant
* @return int Result of deletion
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
*
* @url DELETE variants/{id}
@@ -1875,7 +1875,7 @@ class Products extends DolibarrApi
* @param int $selected_warehouse_id ID of warehouse
* @return int
*
- * @throws RestException 500
+ * @throws RestException 500 System error
* @throws RestException 401
* @throws RestException 404
*
diff --git a/htdocs/product/inventory/inventory.php b/htdocs/product/inventory/inventory.php
index aaaf4428ff5..6026e4316e4 100644
--- a/htdocs/product/inventory/inventory.php
+++ b/htdocs/product/inventory/inventory.php
@@ -216,7 +216,7 @@ if (empty($reshook)) {
}
}
- // Save quantity found during inventory
+ // Save quantity found during inventory (when we click on Save button on inventory page)
if ($action =='updateinventorylines' && $permissiontoadd) {
$sql = 'SELECT id.rowid, id.datec as date_creation, id.tms as date_modification, id.fk_inventory, id.fk_warehouse,';
$sql .= ' id.fk_product, id.batch, id.qty_stock, id.qty_view, id.qty_regulated';
@@ -236,6 +236,9 @@ if (empty($reshook)) {
$line = $db->fetch_object($resql);
$lineid = $line->rowid;
+ $result = 0;
+ $resultupdate = 0;
+
if (GETPOST("id_".$lineid, 'alpha') != '') { // If a value was set ('0' or something else)
$qtytoupdate = price2num(GETPOST("id_".$lineid, 'alpha'), 'MS');
$result = $inventoryline->fetch($lineid);
@@ -265,7 +268,7 @@ if (empty($reshook)) {
}
}
- // Update line with id of stock movement (and the start quantity if it has changed this last recording)
+ // Update user that update quantities
if (! $error) {
$sqlupdate = "UPDATE ".MAIN_DB_PREFIX."inventory";
$sqlupdate .= " SET fk_user_modif = ".((int) $user->id);
diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php
index 47e893846e6..962bbf021b8 100644
--- a/htdocs/societe/class/api_thirdparties.class.php
+++ b/htdocs/societe/class/api_thirdparties.class.php
@@ -1409,7 +1409,7 @@ class Thirdparties extends DolibarrApi
if ($result > 0) {
return array("success" => $result);
} else {
- throw new RestException(500);
+ throw new RestException(500, 'Error generating the document '.$this->error);
}
}
diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php
index 75c2db21224..3151f75877b 100644
--- a/htdocs/ticket/class/api_tickets.class.php
+++ b/htdocs/ticket/class/api_tickets.class.php
@@ -377,7 +377,7 @@ class Tickets extends DolibarrApi
}
$this->ticket->message = $ticketMessageText;
if (!$this->ticket->createTicketMessage(DolibarrApiAccess::$user)) {
- throw new RestException(500);
+ throw new RestException(500, 'Error when creating ticket');
}
return $this->ticket->id;
}
@@ -438,7 +438,7 @@ class Tickets extends DolibarrApi
}
if (!$this->ticket->delete($id)) {
- throw new RestException(500);
+ throw new RestException(500, 'Error when deleting ticket');
}
return array(
diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php
index b2f8085de5a..3ef98da8f5b 100644
--- a/htdocs/user/class/api_users.class.php
+++ b/htdocs/user/class/api_users.class.php
@@ -466,7 +466,7 @@ class Users extends DolibarrApi
*
* @throws RestException 401 Not allowed
* @throws RestException 404 User not found
- * @throws RestException 500 Error
+ * @throws RestException 500 System error
*
* @url GET {id}/setGroup/{group}
*/
|