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 '
';
diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php
index e575c8f27fc..87281e7ea63 100644
--- a/htdocs/comm/propal/apercu.php
+++ b/htdocs/comm/propal/apercu.php
@@ -3,7 +3,8 @@
* Copyright (C) 2004 Eric Seigne
* Copyright (C) 2004-2007 Laurent Destailleur
* Copyright (C) 2005-2012 Regis Houssin
- * Copyright (C) 2011 Juanjo Menent
+ * Copyright (C) 2011 Juanjo Menent
+ * Copyright (C) 2014 Frederic France
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,14 +23,13 @@
/**
* \file htdocs/comm/propal/apercu.php
* \ingroup propal
- * \brief Page de l'onglet apercu d'une propal
+ * \brief Preview tab of propal
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
-if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
$langs->load('propal');
$langs->load("bills");
@@ -44,18 +44,11 @@ $result = restrictedArea($user, 'propal', $id);
/*
- * View
+ * View Mode
*/
llxHeader();
-$form = new Form($db);
-
-/* *************************************************************************** */
-/* */
-/* Mode fiche */
-/* */
-/* *************************************************************************** */
if ($id > 0 || ! empty($ref))
{
@@ -73,29 +66,30 @@ if ($id > 0 || ! empty($ref))
/*
* Propal
*/
- print '';
+ print '';
- // Ref
- print ''.$langs->trans('Ref').' '.$object->ref.' ';
+ // Ref
+ print ''.$langs->trans('Ref').' ';
+ print ''.$object->ref.' ';
+ print ' ';
- // Ref client
- print '';
- print '';
- print $langs->trans('RefCustomer').' ';
- print ' ';
- print '
';
- print ' ';
- print $object->ref_client;
- print ' ';
- print ' ';
+ // Ref client
+ print ''.$langs->trans('RefCustomer').' ';
+ print ''.$object->ref_client.' ';
+ print ' ';
- $rowspan=2;
- // Tiers
- print ''.$langs->trans('Company').' '.$soc->getNomUrl(1).' ';
- print ' ';
+ // Thirdparty
+ print ''.$langs->trans('Company').' ';
+ print ''.$soc->getNomUrl(1).' ';
+ print ' ';
- // Ligne info remises tiers
+ // Status
+ print ''.$langs->trans("Status").' ';
+ print ''.$object->getLibStatut(4).' ';
+ print ' ';
+
+ // Discount
print ''.$langs->trans('Discounts').' ';
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount");
@@ -103,44 +97,43 @@ if ($id > 0 || ! empty($ref))
print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount");
- print '.';
- print ' ';
+ print '.';
+ print '';
- // ligne
- // partie Gauche
- print ''.$langs->trans('Date').' ';
- print dol_print_date($object->date,'daytext');
- print ' ';
+ // Date
+ print ''.$langs->trans('Date').' ';
+ print ''.dol_print_date($object->date,'daytext').' ';
- // partie Droite sur $rowspan lignes
- print '';
+ // Right part with $rowspan lines
+ $rowspan=4;
+ print ' ';
- /*
- * Documents
- */
- $objectref = dol_sanitizeFileName($object->ref);
- $dir_output = $conf->propal->dir_output . "/";
- $filepath = $dir_output . $objectref . "/";
- $file = $filepath . $objectref . ".pdf";
- $filedetail = $filepath . $objectref . "-detail.pdf";
+ /*
+ * Documents
+ */
+ $objectref = dol_sanitizeFileName($object->ref);
+ $dir_output = $conf->propal->dir_output . "/";
+ $filepath = $dir_output . $objectref . "/";
+ $file = $filepath . $objectref . ".pdf";
+ $filedetail = $filepath . $objectref . "-detail.pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf';
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png")
- $fileimage = $file.'_preview.png'; // If PDF has 1 page
+ $fileimage = $file.'_preview.png'; // If PDF has 1 page
$fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
$relativepathimage = $relativepath.'_preview.png';
- $var=true;
+ $var=true;
// Si fichier PDF existe
if (file_exists($file))
{
$encfile = urlencode($file);
- print_titre($langs->trans("Documents"));
- print '';
+ print '';
+ print ''.$langs->trans("Documents").' ';
- print "".$langs->trans("Propal")." PDF ";
+ print ''.$langs->trans("Proposal").' PDF ';
print ''.$object->ref.'.pdf ';
@@ -166,13 +159,25 @@ if ($id > 0 || ! empty($ref))
}
}
- print "";
- print ' ';
+ print '';
+ print '';
- print ''.$langs->trans('AmountHT').' ';
- print ''.price($object->price).' ';
- print ''.$langs->trans("Currency".$conf->currency).' ';
- print '
';
+ // Total HT - left part
+ print ''.$langs->trans('AmountHT').' ';
+ print '' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ' ';
+ print ' ';
+
+ // Total VAT - left part
+ print ''.$langs->trans('AmountVAT').' ';
+ print '' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . ' ';
+ print ' ';
+
+ // Total TTC - left part
+ print ''.$langs->trans('AmountTTC').' ';
+ print '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . ' ';
+ print ' ';
+
+ print '
';
dol_fiche_end();
}
@@ -183,10 +188,13 @@ if ($id > 0 || ! empty($ref))
}
}
+print '';
+print '';
+print '';
// Si fichier png PDF d'1 page trouve
if (file_exists($fileimage))
{
- print '
';
+ print '
';
}
// Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis))
@@ -199,10 +207,13 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview))
{
- print '
';
+ print '
';
}
}
}
+print '
';
+print ' ';
+print '
';
llxFooter();
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 4bf1eceb6dc..79a6797245a 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/card.php b/htdocs/contrat/card.php
index 20fd6939f5d..dfdf0e95a87 100644
--- a/htdocs/contrat/card.php
+++ b/htdocs/contrat/card.php
@@ -536,10 +536,10 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
- $model=$object->modelpdf;
- if (empty($model)) { $tmp=getListOfModels($db, 'contract'); $keys=array_keys($tmp); $model=$keys[0]; }
+
$ret = $object->fetch($id); // Reload to get new records
- $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
+
+ $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
}
unset($_POST ['prod_entry_mode']);
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/fourn/commande/list.php b/htdocs/fourn/commande/list.php
index 6affbae3045..4f0974abd10 100644
--- a/htdocs/fourn/commande/list.php
+++ b/htdocs/fourn/commande/list.php
@@ -123,7 +123,7 @@ if ($search_user)
}
if ($search_ttc)
{
- $sql .= " AND total_ttc = ".price2num($search_ttc);
+ $sql .= " AND total_ttc = '".$db->escape(price2num($search_ttc))."'";
}
if ($sall)
{
diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php
index 217cb16bad1..fa3f745de81 100644
--- a/htdocs/holiday/define_holiday.php
+++ b/htdocs/holiday/define_holiday.php
@@ -144,17 +144,14 @@ if($cp_events == 1)
print ' ';
}
-dol_fiche_head();
-
print '';
-dol_fiche_end();
-
-
llxFooter();
$db->close();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 1eeb5a7f443..fec89ae5bcd 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/langs/en_US/holiday.lang b/htdocs/langs/en_US/holiday.lang
index 698d34eb539..f5b87fefb08 100644
--- a/htdocs/langs/en_US/holiday.lang
+++ b/htdocs/langs/en_US/holiday.lang
@@ -48,7 +48,6 @@ ConfirmDeleteCP=Confirm the deletion of this leave request?
ErrorCantDeleteCP=Error you don't have the right to delete this leave request.
CantCreateCP=You don't have the right to make leave requests.
InvalidValidatorCP=You must choose an approbator to your leave request.
-UpdateButtonCP=Update
CantUpdate=You cannot update this leave request.
NoDateDebut=You must select a start date.
NoDateFin=You must select an end date.
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 1182752eace..15f2281cc1f 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -1628,9 +1628,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print "\n";
}
- //Dolibarr version
- $doliurl='http://www.dolibarr.org';
+ print "\n";
+ print "\n";
+ print '\n";
+ print "\n";
+ print "\n";
// Execute hook printLeftBlock
$parameters=array();
diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php
index f60d56cb633..b376133699b 100644
--- a/htdocs/projet/card.php
+++ b/htdocs/projet/card.php
@@ -434,9 +434,13 @@ if ($action == 'create' && $user->rights->projet->creer)
// Customer
print ' '.$langs->trans("ThirdParty").' ';
- $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1);
- $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
- print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
+ $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1);
+ if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
+ {
+ $texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
+ print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
+ }
+ else print $text;
print ' ';
// Public
diff --git a/htdocs/societe/soc.php b/htdocs/societe/soc.php
index 701efe742eb..3a3bba15653 100644
--- a/htdocs/societe/soc.php
+++ b/htdocs/societe/soc.php
@@ -782,16 +782,18 @@ else
print '';
print $langs->trans("ThirdPartyType").': ';
print '
';
- print ' ';
print '';
+ print ' ';
print ' ';
print $langs->trans("Company/Fundation");
print ' ';
print ' ';
+ print '';
print ' ';
print ' ';
print $langs->trans("Individual");
- print ' ('.$langs->trans("ToCreateContactWithSameName").')';
+ print '('.$langs->trans("ToCreateContactWithSameName").')
';
+ print ' ';
print '';
print " \n";
}
diff --git a/htdocs/webservices/server_order.php b/htdocs/webservices/server_order.php
index 9903c6b4ed9..2318780608c 100644
--- a/htdocs/webservices/server_order.php
+++ b/htdocs/webservices/server_order.php
@@ -29,6 +29,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
require_once(DOL_DOCUMENT_ROOT."/commande/class/commande.class.php");
@@ -84,6 +85,52 @@ $server->wsdl->addComplexType(
)
);
+$line_fields = array(
+ 'id' => array('name'=>'id','type'=>'xsd:string'),
+ 'type' => array('name'=>'type','type'=>'xsd:int'),
+ 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'),
+ 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'),
+ 'desc' => array('name'=>'desc','type'=>'xsd:string'),
+ 'qty' => array('name'=>'qty','type'=>'xsd:double'),
+ 'price' => array('name'=>'price','type'=>'xsd:double'),
+ 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'),
+ 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'),
+
+ 'remise' => array('name'=>'remise','type'=>'xsd:double'),
+ 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'),
+
+ 'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
+ 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
+ 'total' => array('name'=>'total','type'=>'xsd:double'),
+
+ 'date_start' => array('name'=>'date_start','type'=>'xsd:date'),
+ 'date_end' => array('name'=>'date_end','type'=>'xsd:date'),
+
+ // From product
+ 'product_id' => array('name'=>'product_id','type'=>'xsd:int'),
+ 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'),
+ 'product_label' => array('name'=>'product_label','type'=>'xsd:string'),
+ 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string')
+);
+
+
+//Retreive all extrafield for thirdsparty
+// fetch optionals attributes and labels
+$extrafields=new ExtraFields($db);
+$extralabels=$extrafields->fetch_name_optionals_label('commandedet',true);
+if (count($extrafields)>0) {
+ $extrafield_line_array = array();
+}
+foreach($extrafields->attribute_label as $key=>$label)
+{
+ //$value=$object->array_options["options_".$key];
+ $type =$extrafields->attribute_type[$key];
+ if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
+ else {$type='xsd:string';}
+ $extrafield_line_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
+}
+$line_fields=array_merge($line_fields,$extrafield_line_array);
+
// Define other specific objects
$server->wsdl->addComplexType(
'line',
@@ -91,33 +138,7 @@ $server->wsdl->addComplexType(
'struct',
'all',
'',
- array(
- 'id' => array('name'=>'id','type'=>'xsd:string'),
- 'type' => array('name'=>'type','type'=>'xsd:int'),
- 'fk_commande' => array('name'=>'fk_commande','type'=>'xsd:int'),
- 'fk_parent_line' => array('name'=>'fk_parent_line','type'=>'xsd:int'),
- 'desc' => array('name'=>'desc','type'=>'xsd:string'),
- 'qty' => array('name'=>'qty','type'=>'xsd:double'),
- 'price' => array('name'=>'price','type'=>'xsd:double'),
- 'unitprice' => array('name'=>'unitprice','type'=>'xsd:double'),
- 'vat_rate' => array('name'=>'vat_rate','type'=>'xsd:double'),
-
- 'remise' => array('name'=>'remise','type'=>'xsd:double'),
- 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:double'),
-
- 'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
- 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
- 'total' => array('name'=>'total','type'=>'xsd:double'),
-
- 'date_start' => array('name'=>'date_start','type'=>'xsd:date'),
- 'date_end' => array('name'=>'date_end','type'=>'xsd:date'),
-
- // From product
- 'product_id' => array('name'=>'product_id','type'=>'xsd:int'),
- 'product_ref' => array('name'=>'product_ref','type'=>'xsd:string'),
- 'product_label' => array('name'=>'product_label','type'=>'xsd:string'),
- 'product_desc' => array('name'=>'product_desc','type'=>'xsd:string')
- )
+ $line_fields
);
/*$server->wsdl->addComplexType(
@@ -151,53 +172,73 @@ $server->wsdl->addComplexType(
)
);
+$order_fields = array(
+ 'id' => array('name'=>'id','type'=>'xsd:string'),
+ 'ref' => array('name'=>'ref','type'=>'xsd:string'),
+ 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'),
+ 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
+ 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'),
+ 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'),
+ 'status' => array('name'=>'status','type'=>'xsd:int'),
+ 'facturee' => array('name'=>'facturee','type'=>'xsd:string'),
+ 'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
+ 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
+ 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'),
+ 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'),
+ 'total' => array('name'=>'total','type'=>'xsd:double'),
+ 'date' => array('name'=>'date','type'=>'xsd:date'),
+ 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'),
+ 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'),
+ 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'),
+ 'remise' => array('name'=>'remise','type'=>'xsd:string'),
+ 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'),
+ 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'),
+ 'source' => array('name'=>'source','type'=>'xsd:string'),
+ 'note_private' => array('name'=>'note_private','type'=>'xsd:string'),
+ 'note_public' => array('name'=>'note_public','type'=>'xsd:string'),
+ 'project_id' => array('name'=>'project_id','type'=>'xsd:string'),
+
+ 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'),
+ 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'),
+ 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'),
+ 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'),
+ 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'),
+ 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'),
+ 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'),
+
+ 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'),
+ 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'),
+ 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'),
+
+ 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2')
+);
+
+//Retreive all extrafield for thirdsparty
+// fetch optionals attributes and labels
+$extrafields=new ExtraFields($db);
+$extralabels=$extrafields->fetch_name_optionals_label('commande',true);
+if (count($extrafields)>0) {
+ $extrafield_array = array();
+}
+foreach($extrafields->attribute_label as $key=>$label)
+{
+ //$value=$object->array_options["options_".$key];
+ $type =$extrafields->attribute_type[$key];
+ if ($type=='date' || $type=='datetime') {$type='xsd:dateTime';}
+ else {$type='xsd:string';}
+ $extrafield_array['options_'.$key]=array('name'=>'options_'.$key,'type'=>$type);
+}
+$order_fields=array_merge($order_fields,$extrafield_array);
+
$server->wsdl->addComplexType(
'order',
'complexType',
'struct',
'all',
'',
- array(
- 'id' => array('name'=>'id','type'=>'xsd:string'),
- 'ref' => array('name'=>'ref','type'=>'xsd:string'),
- 'ref_client' => array('name'=>'ref_client','type'=>'xsd:string'),
- 'ref_ext' => array('name'=>'ref_ext','type'=>'xsd:string'),
- 'ref_int' => array('name'=>'ref_int','type'=>'xsd:string'),
- 'thirdparty_id' => array('name'=>'thirdparty_id','type'=>'xsd:int'),
- 'status' => array('name'=>'status','type'=>'xsd:int'),
- 'facturee' => array('name'=>'facturee','type'=>'xsd:string'),
- 'total_net' => array('name'=>'total_net','type'=>'xsd:double'),
- 'total_vat' => array('name'=>'total_vat','type'=>'xsd:double'),
- 'total_localtax1' => array('name'=>'total_localtax1','type'=>'xsd:double'),
- 'total_localtax2' => array('name'=>'total_localtax2','type'=>'xsd:double'),
- 'total' => array('name'=>'total','type'=>'xsd:double'),
- 'date' => array('name'=>'date','type'=>'xsd:date'),
- 'date_creation' => array('name'=>'date_creation','type'=>'xsd:dateTime'),
- 'date_validation' => array('name'=>'date_validation','type'=>'xsd:dateTime'),
- 'date_modification' => array('name'=>'date_modification','type'=>'xsd:dateTime'),
- 'remise' => array('name'=>'remise','type'=>'xsd:string'),
- 'remise_percent' => array('name'=>'remise_percent','type'=>'xsd:string'),
- 'remise_absolue' => array('name'=>'remise_absolue','type'=>'xsd:string'),
- 'source' => array('name'=>'source','type'=>'xsd:string'),
- 'note_private' => array('name'=>'note_private','type'=>'xsd:string'),
- 'note_public' => array('name'=>'note_public','type'=>'xsd:string'),
- 'project_id' => array('name'=>'project_id','type'=>'xsd:string'),
-
- 'mode_reglement_id' => array('name'=>'mode_reglement_id','type'=>'xsd:string'),
- 'mode_reglement_code' => array('name'=>'mode_reglement_code','type'=>'xsd:string'),
- 'mode_reglement' => array('name'=>'mode_reglement','type'=>'xsd:string'),
- 'cond_reglement_id' => array('name'=>'cond_reglement_id','type'=>'xsd:string'),
- 'cond_reglement_code' => array('name'=>'cond_reglement_code','type'=>'xsd:string'),
- 'cond_reglement' => array('name'=>'cond_reglement','type'=>'xsd:string'),
- 'cond_reglement_doc' => array('name'=>'cond_reglement_doc','type'=>'xsd:string'),
-
- 'date_livraison' => array('name'=>'date_livraison','type'=>'xsd:date'),
- 'fk_delivery_address' => array('name'=>'fk_delivery_address','type'=>'xsd:int'),
- 'demand_reason_id' => array('name'=>'demand_reason_id','type'=>'xsd:string'),
-
- 'lines' => array('name'=>'lines','type'=>'tns:LinesArray2')
- )
+ $order_fields
);
+
/*
$server->wsdl->addComplexType(
'OrdersArray',
@@ -643,6 +684,16 @@ function createOrder($authentication,$order)
$newobject->cond_reglement_id=$order['cond_reglement_id'];
$newobject->demand_reason_id=$order['demand_reason_id'];
$newobject->date_creation=$now;
+
+ // Retrieve all extrafield for order
+ // fetch optionals attributes and labels
+ $extrafields=new ExtraFields($db);
+ $extralabels=$extrafields->fetch_name_optionals_label('commandet',true);
+ foreach($extrafields->attribute_label as $key=>$label)
+ {
+ $key='options_'.$key;
+ $newobject->array_options[$key]=$order[$key];
+ }
// Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines=array();
@@ -666,6 +717,17 @@ function createOrder($authentication,$order)
$newline->total_ttc=$line['total'];
$newline->date_start=$line['date_start'];
$newline->date_end=$line['date_end'];
+
+ // Retrieve all extrafield for lines
+ // fetch optionals attributes and labels
+ $extrafields=new ExtraFields($db);
+ $extralabels=$extrafields->fetch_name_optionals_label('commandedet',true);
+ foreach($extrafields->attribute_label as $key=>$label)
+ {
+ $key='options_'.$key;
+ $newline->array_options[$key]=$line[$key];
+ }
+
$newobject->lines[]=$newline;
}
diff --git a/test/phpunit/FunctionsLibTest.php b/test/phpunit/FunctionsLibTest.php
index f26718f1dd9..af5f3393672 100755
--- a/test/phpunit/FunctionsLibTest.php
+++ b/test/phpunit/FunctionsLibTest.php
@@ -824,4 +824,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals(dol_nl2br($string, 1, 1), "a a");
}
+ /**
+ * testDolPrice2Num
+ *
+ * @return boolean
+ */
+ public function testDolPrice2Num()
+ {
+ $this->assertEquals(1000, price2num('1 000.0'));
+ $this->assertEquals(1000, price2num('1 000','MT'));
+ $this->assertEquals(1000, price2num('1 000','MU'));
+
+ $this->assertEquals(1000.123456, price2num('1 000.123456'));
+
+ // Round down
+ $this->assertEquals(1000.12, price2num('1 000.123452','MT'));
+ $this->assertEquals(1000.12345, price2num('1 000.123452','MU'),"Test MU");
+
+ // Round up
+ $this->assertEquals(1000.13, price2num('1 000.125456','MT'));
+ $this->assertEquals(1000.12546, price2num('1 000.125456','MU'),"Test MU");
+
+ // Text can't be converted
+ $this->assertEquals('12.4$',price2num('12.4$'));
+ $this->assertEquals('12r.4$',price2num('12r.4$'));
+
+ return true;
+ }
+
}