diff --git a/ChangeLog b/ChangeLog
index 22b1631390f..c567d47a9bc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -174,7 +174,10 @@ Dolibarr better:
- Fix: Civility & birthdate wasn't save into adherent module.
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref
- Fix: Chars - is no more allowed into value for code for extra fields.
-( Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
+- Fix: [ bug #1622 ] Requesting holiday than spans across two years cause high CPU usage by Apache
+- Fix: [ bug #1595 ] Selected boolean extrafield in intervention creation page, does not save state
+- Fix: Show sender Country on PDF docs when sender Country <> receiver Country
+- Fix: [ bug #1624 ] Use lowest buying price for margin when selling with POS
***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users:
diff --git a/htdocs/admin/propal.php b/htdocs/admin/propal.php
index 328866eb964..aef978ec6ad 100644
--- a/htdocs/admin/propal.php
+++ b/htdocs/admin/propal.php
@@ -163,6 +163,22 @@ if ($action == 'setdefaultduration')
}
}
+if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL')
+{
+ $res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL",$value,'chaine',0,'',$conf->entity);
+
+ if (! $res > 0) $error++;
+
+ if (! $error)
+ {
+ setEventMessage($langs->trans("SetupSaved"));
+ }
+ else
+ {
+ setEventMessage($langs->trans("Error"),'errors');
+ }
+}
+
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions')
{
@@ -582,6 +598,35 @@ print ' '
print "\n";
print '';
+if ($conf->banque->enabled)
+{
+ $var=!$var;
+ print '
';
+ print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'   ';
+ if (! empty($conf->use_javascript_ajax))
+ {
+ print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL');
+ }
+ else
+ {
+ if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL))
+ {
+ print ''.img_picto($langs->trans("Disabled"),'switch_off').' ';
+ }
+ else
+ {
+ print ''.img_picto($langs->trans("Enabled"),'switch_on').' ';
+ }
+ }
+ print ' ';
+}
+else
+{
+ $var=!$var;
+ print '';
+ print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").' '.$langs->trans('NotAvailable').' ';
+}
+
print '';
diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 65f88cddbd8..465fe5e2d76 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -1310,9 +1310,11 @@ if ($action == 'create')
print '';
// Bank Account
- print '' . $langs->trans('BankAccount') . ' ';
- $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
- print ' ';
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) {
+ print '' . $langs->trans('BankAccount') . ' ';
+ $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
+ print ' ';
+ }
// What trigger creation
print '' . $langs->trans('Source') . ' ';
@@ -1893,7 +1895,7 @@ if ($action == 'create')
print ' ';
}
- if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL))
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->banque->enabled)
{
// Bank Account
print '';
diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php
index 12dbbe7d1c1..fb9d5257d49 100644
--- a/htdocs/comm/propal/class/propal.class.php
+++ b/htdocs/comm/propal/class/propal.class.php
@@ -416,7 +416,15 @@ class Propal extends CommonObject
// infos marge
- $this->line->fk_fournprice = $fk_fournprice;
+ if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
+ // by external module, take lowest buying price
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($fk_product);
+ $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ } else {
+ $this->line->fk_fournprice = $fk_fournprice;
+ }
$this->line->pa_ht = $pa_ht;
// Mise en option de la ligne
@@ -567,7 +575,15 @@ class Propal extends CommonObject
$this->line->skip_update_total = $skip_update_total;
// infos marge
- $this->line->fk_fournprice = $fk_fournprice;
+ if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
+ // by external module, take lowest buying price
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($fk_product);
+ $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ } else {
+ $this->line->fk_fournprice = $fk_fournprice;
+ }
$this->line->pa_ht = $pa_ht;
$this->line->date_start=$date_start;
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index 7f9cfb102fd..56511f43c97 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -1391,10 +1391,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
print ' ';
// Bank Account
- print '' . $langs->trans('BankAccount') . ' ';
- $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
- print ' ';
-
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
+ {
+ print '' . $langs->trans('BankAccount') . ' ';
+ $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
+ print ' ';
+ }
+
// Delivery delay
print '' . $langs->trans('AvailabilityPeriod') . ' ';
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
@@ -1995,22 +1998,25 @@ if ($action == 'create' && $user->rights->commande->creer) {
$rowspan ++;
// Bank Account
- print ' ';
- print '';
- print ' ';
- if ($action == 'editbankaccount') {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
- } else {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
- }
- print ' ';
- print ' ';
-
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
+ {
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editbankaccount') {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
+ } else {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
+ }
+ print ' ';
+ print ' ';
+ }
+
// Total HT
print '' . $langs->trans('AmountHT') . ' ';
print '' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . ' ';
diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index ed308394e6c..49ba2536bfa 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1224,7 +1224,15 @@ class Commande extends CommonOrder
$this->line->date_end=$date_end;
// infos marge
- $this->line->fk_fournprice = $fk_fournprice;
+ if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
+ // by external module, take lowest buying price
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($fk_product);
+ $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ } else {
+ $this->line->fk_fournprice = $fk_fournprice;
+ }
$this->line->pa_ht = $pa_ht;
// TODO Ne plus utiliser
@@ -2421,7 +2429,15 @@ class Commande extends CommonOrder
$this->line->skip_update_total=$skip_update_total;
// infos marge
- $this->line->fk_fournprice = $fk_fournprice;
+ if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
+ //by external module, take lowest buying price
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($fk_product);
+ $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ } else {
+ $this->line->fk_fournprice = $fk_fournprice;
+ }
$this->line->pa_ht = $pa_ht;
// TODO deprecated
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 4331d80925f..a6877ad9ed8 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -2203,7 +2203,15 @@ class Facture extends CommonInvoice
$this->line->skip_update_total = $skip_update_total;
// infos marge
- $this->line->fk_fournprice = $fk_fournprice;
+ if (!empty($fk_product) && empty($fk_fournprice) && empty($pa_ht)) {
+ // POS or external module, take lowest buying price
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($fk_product);
+ $this->line->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ } else {
+ $this->line->fk_fournprice = $fk_fournprice;
+ }
$this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) {
@@ -3498,6 +3506,14 @@ class FactureLigne extends CommonInvoiceLine
return -1;
}
}
+
+ // POS or by external module, take lowest buying price
+ if (!empty($this->fk_product) && empty($this->fk_fournprice) && empty($this->pa_ht)) {
+ include_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.product.class.php';
+ $productFournisseur = new ProductFournisseur($this->db);
+ $productFournisseur->find_min_price_product_fournisseur($this->fk_product);
+ $this->fk_fournprice = $productFournisseur->product_fourn_price_id;
+ }
$this->db->begin();
diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php
index fc2943f05e0..2359d70d07b 100644
--- a/htdocs/compta/index.php
+++ b/htdocs/compta/index.php
@@ -678,7 +678,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$societestatic->name=$obj->name;
$societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44);
- print '';
+ print '';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total_ht).' ';
print ''.price($obj->total_ttc).' ';
print ''.price($obj->total_ttc-$obj->tot_fttc).' ';
@@ -777,7 +777,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$societestatic->name=$obj->name;
$societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44);
- print '';
+ print '';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print ''.price($obj->total).' ';
print ''.price($obj->total_ttc).' ';
print ''.price($obj->am).' ';
diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php
index 4abfb1f9c86..1399ae40215 100644
--- a/htdocs/contrat/class/contrat.class.php
+++ b/htdocs/contrat/class/contrat.class.php
@@ -2385,39 +2385,4 @@ class ContratLigne extends CommonObject
}
}
- /**
- * Create a contract document on disk using template defined into CONTRACT_ADDON_PDF
- *
- * @param string $modele force le modele a utiliser ('' par defaut)
- * @param Translate $outputlangs objet lang a utiliser pour traduction
- * @param int $hidedetails Hide details of lines
- * @param int $hidedesc Hide description
- * @param int $hideref Hide ref
- * @return int 0 if KO, 1 if OK
- */
- public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
- {
- global $conf,$langs,$user,$hookmanager;
-
- $langs->load("contracts");
-
- // Positionne modele sur le nom du modele de contrat a utiliser
- if (! dol_strlen($modele))
- {
- if (! empty($conf->global->CONTRACT_ADDON_PDF))
- {
- $modele = $conf->global->CONTRACT_ADDON_PDF;
- }
- else
- {
- $modele = 'strato';
- }
- }
-
- $modelpath = "core/modules/contract/doc/";
-
- return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
- }
}
-
-
diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php
index b272f350717..9b2a5437b8a 100644
--- a/htdocs/core/boxes/box_graph_invoices_permonth.php
+++ b/htdocs/core/boxes/box_graph_invoices_permonth.php
@@ -215,9 +215,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow.=' ';
// Bank Account
- print '' . $langs->trans('BankAccount') . ' ';
- $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
- print ' ';
-
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
+ {
+ $langs->load("bank");
+ print '' . $langs->trans('BankAccount') . ' ';
+ $form->select_comptes($fk_account, 'fk_account', 0, '', 1);
+ print ' ';
+ }
+
print ''.$langs->trans('NotePublic').' ';
print '';
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
@@ -1539,22 +1544,25 @@ elseif (! empty($object->id))
print ' ';
// Bank Account
- print '';
- print '';
- print ' ';
- if ($action == 'editbankaccount') {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
- } else {
- $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
- }
- print ' ';
- print ' ';
-
+ if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
+ {
+ print '';
+ print '';
+ print ' ';
+ if ($action == 'editbankaccount') {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
+ } else {
+ $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
+ }
+ print ' ';
+ print ' ';
+ }
+
// Delivery date planed
print '';
print '';
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index e69168dbc21..a524ff8a5fe 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1139,6 +1139,7 @@ AddDeliveryAddressAbility=Add delivery date ability
UseOptionLineIfNoQuantity=A line of product/service with a zero amount is considered as an option
FreeLegalTextOnProposal=Free text on commercial proposals
WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty)
+BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal
##### Orders #####
OrdersSetup=Order management setup
OrdersNumberingModules=Orders numbering models
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 7fe13a97b91..d248a8c19ff 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1632,9 +1632,9 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print "\n";
print "\n";
print '