| ' . $langs->trans('VATReverseCharge') . ' | ';
// Try to propose to use VAT reverse charge even if the VAT reverse charge is not activated in the supplier card, if this corresponds to the context of use, the activation is proposed
- if ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) {
+ if (GETPOSTISSET('vat_reverse_charge')) { // Check if form was submitted previously
+ $vat_reverse_charge = (GETPOST('vat_reverse_charge', 'alpha') == 'on' || GETPOST('vat_reverse_charge', 'alpha') == '1') ? 1 : 0;
+ } elseif ($vat_reverse_charge == 1 || $societe->vat_reverse_charge == 1 || ($societe->country_code != 'FR' && isInEEC($societe) && !empty($societe->tva_intra))) {
$vat_reverse_charge = 1;
} else {
$vat_reverse_charge = 0;
@@ -3212,14 +3219,12 @@ if ($action == 'create') {
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 0, 1);
}
- if (!$formconfirm) {
- $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
- $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
- if (empty($reshook)) {
- $formconfirm .= $hookmanager->resPrint;
- } elseif ($reshook > 0) {
- $formconfirm = $hookmanager->resPrint;
- }
+ $parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
+ $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+ if (empty($reshook)) {
+ $formconfirm .= $hookmanager->resPrint;
+ } elseif ($reshook > 0) {
+ $formconfirm = $hookmanager->resPrint;
}
// Print form confirm
diff --git a/htdocs/install/mysql/migration/repair.sql b/htdocs/install/mysql/migration/repair.sql
index 6f6762f5cb0..8262a3e1c98 100644
--- a/htdocs/install/mysql/migration/repair.sql
+++ b/htdocs/install/mysql/migration/repair.sql
@@ -422,7 +422,7 @@ drop table tmp_c_shipment_mode;
-- Restore id of user on link for payment of expense report
drop table tmp_bank_url_expense_user;
-create table tmp_bank_url_expense_user (select e.fk_user_author, bu2.fk_bank from llx_expensereport as e, llx_bank_url as bu2 where bu2.url_id = e.rowid and bu2.type = 'payment_expensereport');
+create table tmp_bank_url_expense_user as (select e.fk_user_author, bu2.fk_bank from llx_expensereport as e, llx_bank_url as bu2 where bu2.url_id = e.rowid and bu2.type = 'payment_expensereport');
update llx_bank_url as bu set url_id = (select e.fk_user_author from tmp_bank_url_expense_user as e where e.fk_bank = bu.fk_bank) where (bu.url_id = 0 OR bu.url_id IS NULL) and bu.type ='user';
drop table tmp_bank_url_expense_user;
diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php
index 96d5b569677..bed97fcfd14 100644
--- a/htdocs/projet/element.php
+++ b/htdocs/projet/element.php
@@ -948,7 +948,7 @@ foreach ($listofreferent as $key => $value) {
$total_ttc_by_line = $element->total_ttc;
}
- // Change sign of $total_ht_by_line and $total_ttc_by_line for some cases
+ // Change sign of $total_ht_by_line and $total_ttc_by_line for various payments
if ($tablename == 'payment_various') {
if ($element->sens == 1) {
$total_ht_by_line = -$total_ht_by_line;
@@ -956,6 +956,12 @@ foreach ($listofreferent as $key => $value) {
}
}
+ // Change sign of $total_ht_by_line and $total_ttc_by_line for supplier proposal and supplier order
+ if ($tablename == 'commande_fournisseur' || $tablename == 'supplier_proposal') {
+ $total_ht_by_line = -$total_ht_by_line;
+ $total_ttc_by_line = -$total_ttc_by_line;
+ }
+
// Add total if we have to
if ($qualifiedfortotal) {
$total_ht += $total_ht_by_line;
diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php
index 54c65999286..f885e2fe1d7 100644
--- a/htdocs/ticket/card.php
+++ b/htdocs/ticket/card.php
@@ -431,7 +431,7 @@ if (empty($reshook)) {
// Action to add a message (private or not, with email or not).
// This may also send an email (concatenated with email_intro and email footer if checkbox was selected)
if ($action == 'add_message' && GETPOSTISSET('btn_add_message') && $permissiontoread) {
- $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "on" ? 1 : 0), 0);
+ $ret = $object->newMessage($user, $action, (GETPOST('private_message', 'alpha') == "1" ? 1 : 0), 0);
if ($ret > 0) {
if (!empty($backtopage)) {
|