diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 5895ea5905d..297ca4c212a 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -155,7 +155,7 @@ if ($action == 'add') { $sql = "INSERT INTO ".MAIN_DB_PREFIX."overwrite_trans(lang, transkey, transvalue, entity) VALUES ('".$db->escape($langcode)."','".$db->escape($transkey)."','".$db->escape($transvalue)."', ".((int) $conf->entity).")"; $result = $db->query($sql); - if ($result > 0) { + if ($result) { $db->commit(); setEventMessages($langs->trans("RecordSaved"), null, 'mesgs'); $action = ""; @@ -177,7 +177,7 @@ if ($action == 'add') { if ($action == 'delete') { $sql = "DELETE FROM ".MAIN_DB_PREFIX."overwrite_trans WHERE rowid = ".((int) $id); $result = $db->query($sql); - if ($result >= 0) { + if ($result) { setEventMessages($langs->trans("RecordDeleted"), null, 'mesgs'); } else { dol_print_error($db); @@ -297,7 +297,7 @@ foreach ($modulesdir as $keydir => $tmpsearchdir) { $result = $newlang->load($langkey, 0, 0, '', 0); // Load translation files + database overwrite $result = $newlangfileonly->load($langkey, 0, 0, '', 1); // Load translation files only - if ($result < 0) { + if (!$result) { print 'Failed to load language file '.$tmpfile.'
'."\n"; } else { $listoffiles[$langkey] = $tmpfile; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index a315a1fb1c9..281d520ece2 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1036,7 +1036,8 @@ if (empty($reshook)) { } } - if (!$error && ($qty >= 0) && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { + $propal_qty_requirement = (!empty($conf->global->PROPAL_ENABLE_NEGATIVE_QTY) ? ($qty >= 0 || $qty <= 0) : $qty >= 0); + if (!$error && $propal_qty_requirement && (!empty($product_desc) || (!empty($idprod) && $idprod > 0))) { $pu_ht = 0; $pu_ttc = 0; $pu_ht_devise = 0; diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 21427edba07..fefa9a33330 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -370,7 +370,7 @@ if (($action == 'send' || $action == 'relance') && !GETPOST('addfile') && !GETPO $action = 'presend'; } else { $result = $mailfile->sendfile(); - if ($result) { + if ($result >= 0) { // Initialisation of datas of object to call trigger if (is_object($object)) { if (empty($actiontypecode)) { diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 2416c2ec5ac..35b99d90541 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9349,7 +9349,12 @@ abstract class CommonObject $line = (object) $line; } - $result = $line->create($user, 1); + $result = 0; + if (method_exists($line, 'insert')) { + $result = $line->insert($user, 1); + } elseif (method_exists($line, 'create')) { + $result = $line->create($user, 1); + } if ($result < 0) { $this->error = $line->error; $this->db->rollback(); diff --git a/htdocs/product/stock/tpl/stockcorrection.tpl.php b/htdocs/product/stock/tpl/stockcorrection.tpl.php index 9906b3606e7..f87fa3d55f3 100644 --- a/htdocs/product/stock/tpl/stockcorrection.tpl.php +++ b/htdocs/product/stock/tpl/stockcorrection.tpl.php @@ -67,16 +67,16 @@ print '