Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/main.inc.php
This commit is contained in:
Laurent Destailleur 2014-11-28 02:26:40 +01:00
commit a724c3aa70
34 changed files with 260 additions and 142 deletions

View File

@ -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:

View File

@ -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 '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n";
print '</form>';
if ($conf->banque->enabled)
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp</td><td align="center">';
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 '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
}
else
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL&amp;value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
}
}
print '</td></tr>';
}
else
{
$var=!$var;
print '<tr '.$bc[$var].'><td>';
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL").'</td><td>&nbsp;</td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
}
print '</table>';

View File

@ -1310,9 +1310,11 @@ if ($action == 'create')
print '</td></tr>';
// Bank Account
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL) && $conf->module->banque->enabled) {
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// What trigger creation
print '<tr><td>' . $langs->trans('Source') . '</td><td>';
@ -1893,7 +1895,7 @@ if ($action == 'create')
print '</tr>';
}
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 '<tr><td>';

View File

@ -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;

View File

@ -1391,10 +1391,13 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</td></tr>';
// Bank Account
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
{
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
$form->selectAvailabilityDelay($availability_id, 'availability_id', '', 1);
@ -1995,22 +1998,25 @@ if ($action == 'create' && $user->rights->commande->creer) {
$rowspan ++;
// Bank Account
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
{
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
}
// Total HT
print '<tr><td>' . $langs->trans('AmountHT') . '</td>';
print '<td align="right">' . price($object->total_ht, 1, '', 1, - 1, - 1, $conf->currency) . '</td>';

View File

@ -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

View File

@ -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();

View File

@ -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 '</a></td>';
print '</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total_ht).'</td>';
print '<td align="right">'.price($obj->total_ttc).'</td>';
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</td>';
@ -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 '</a></td>';
print '</td>';
if (! empty($conf->global->MAIN_SHOW_HT_ON_SUMMARY)) print '<td align="right">'.price($obj->total).'</td>';
print '<td align="right">'.price($obj->total_ttc).'</td>';
print '<td align="right">'.price($obj->am).'</td>';

View File

@ -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);
}
}

View File

@ -215,9 +215,9 @@ class box_graph_invoices_permonth extends ModeleBoxes
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -214,9 +214,9 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'> '.$langs->trans("NumberOfBillsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'> '.$langs->trans("AmountOfBillsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -215,9 +215,9 @@ class box_graph_orders_permonth extends ModeleBoxes
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -214,9 +214,9 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'> '.$langs->trans("NumberOfOrdersByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'> '.$langs->trans("AmountOfOrdersByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -218,9 +218,9 @@ class box_graph_propales_permonth extends ModeleBoxes
$stringtoshow.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">';
$stringtoshow.='<input type="hidden" name="DOL_AUTOSET_COOKIE" value="DOLUSERCOOKIE_box_'.$this->boxcode.':year,shownb,showtot">';
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'"> '.$langs->trans("NumberOfProposalsByMonth");
$stringtoshow.='<input type="checkbox" name="'.$param_shownb.'"'.($shownb?' checked="true"':'').'> '.$langs->trans("NumberOfProposalsByMonth");
$stringtoshow.=' &nbsp; ';
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'"> '.$langs->trans("AmountOfProposalsByMonthHT");
$stringtoshow.='<input type="checkbox" name="'.$param_showtot.'"'.($showtot?' checked="true"':'').'> '.$langs->trans("AmountOfProposalsByMonthHT");
$stringtoshow.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">';
$stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -2622,7 +2622,7 @@ class Form
$i++;
}
print "</select>";
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
} else {
print $langs->trans("NoShippingMethodDefined");
}

View File

@ -766,11 +766,12 @@ function dol_bc($var,$moreclass='')
* @param Object $object A company or contact object
* @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build string
* @param Tranlsate $outputlangs Object lang that contains language for text translation.
* @return string Formated string
*/
function dol_format_address($object,$withcountry=0,$sep="\n")
function dol_format_address($object,$withcountry=0,$sep="\n",$outputlangs='')
{
global $conf;
global $conf,$langs;
$ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR');
@ -815,8 +816,8 @@ function dol_format_address($object,$withcountry=0,$sep="\n")
$ret.=", ".$object->state;
}
}
if ($withcountry) $ret.=($object->country?$sep.$object->country:'');
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret;
}
@ -2905,7 +2906,7 @@ function price($amount, $form=0, $outlangs='', $trunc=1, $rounding=-1, $forcerou
* 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
* 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN)
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number
* @return string Amount with universal numeric format (Example: '99.99999')
* @return string Amount with universal numeric format (Example: '99.99999') or unchanged text if conversion fails.
*
* @see price Opposite function of price2num
*/

View File

@ -312,7 +312,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source')
{
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany))."\n";
$withCountry = 0;
if (!empty($sourcecompany->country_code) && ($targetcompany->country_code != $sourcecompany->country_code)) $withCountry = 1;
$stringaddress .= ($stringaddress ? "\n" : '' ).$outputlangs->convToOutputCharset(dol_format_address($sourcecompany, $withCountry, "\n", $outputlangs))."\n";
if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{

View File

@ -1188,7 +1188,7 @@ class pdf_einstein extends ModelePDFCommandes
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -1145,7 +1145,7 @@ class pdf_proforma extends ModelePDFCommandes
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -555,7 +555,7 @@ class pdf_strato extends ModelePDFContract
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
}
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -539,7 +539,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetTextColor(0,0,0);
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
$pdf->SetFont('','', $default_font_size - 3);
$pdf->SetXY($blSocX,$blSocY+4);

View File

@ -587,7 +587,7 @@ class pdf_rouget extends ModelePdfExpedition
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
}
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posx=$this->marge_gauche;

View File

@ -1434,7 +1434,7 @@ class pdf_crabe extends ModelePDFFactures
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -522,7 +522,7 @@ class pdf_soleil extends ModelePDFFicheinter
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
}
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -1284,7 +1284,7 @@ class pdf_azur extends ModelePDFPropales
$carac_emetteur .= ($carac_emetteur ? "\n" : '' ).$outputlangs->transnoentities("Name").": ".$outputlangs->convToOutputCharset($object->user->getFullName($outputlangs))."\n";
}
$carac_emetteur .= pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur .= pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -970,7 +970,7 @@ class pdf_canelle extends ModelePDFSuppliersInvoices
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -1022,7 +1022,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($showaddress)
{
// Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur);
$carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender
$posy=42;

View File

@ -50,25 +50,23 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>
<td align="right"><span id="title_vat"><label for="tva_tx"><?php echo $langs->trans('VAT'); ?></label></span></td>
<td align="right"><span id="title_up_ht"><label for="price_ht"><?php echo $langs->trans('PriceUHT'); ?></label></span></td>
<td align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
<td align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<?php if (! empty($inputalsopricewithtax)) { ?>
<td align="right"><span id="title_up_ttc"><label for="price_ttc"><?php echo $langs->trans('PriceUTTC'); ?></label></span></td>
<td align="right"><span id="title_up_ttc"><?php echo $langs->trans('PriceUTTC'); ?></span></td>
<?php } ?>
<td align="right"><label for="qty"><?php echo $langs->trans('Qty'); ?></label></td>
<td align="right"><label for="remise_percent"><?php echo $langs->trans('ReductionShort'); ?></label></td>
<td align="right"><?php echo $langs->trans('Qty'); ?></td>
<td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php
if (! empty($usemargins))
{
?>
<td align="right" class="margininfos">
<?php
echo '<label for="buying_price">';
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
echo $langs->trans('CostPrice');
echo '</label>';
?>
</td>
<?php
@ -103,20 +101,25 @@ else {
// Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled)))
{
echo '<label for="prod_entry_mode_free">';
echo '<input type="radio" name="prod_entry_mode" id="prod_entry_mode_free" value="free"';
//echo (GETPOST('prod_entry_mode')=='free' ? ' checked="true"' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked="true"':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked="true"' : '');
echo '> ';
}
else echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector
if ($forceall >= 0)
{
echo '<label for="select_type">';
// Show type selector
echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' ';
echo '</label>';
}
else
{
echo '<input type="hidden" id="prod_entry_mode_free" name="prod_entry_mode" value="free">';
// Show type selector
if ($forceall >= 0)
{
echo $langs->trans("FreeLineOfType");
echo ' ';
}
}
echo $form->select_type_of_lines(isset($_POST["type"])?$_POST["type"]:-1,'type',1,1,$forceall);
@ -128,9 +131,8 @@ else {
{
if ($forceall >= 0) echo '<br>';
echo '<span>';
echo '<input type="radio" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked="true"':'').'> ';
echo '<label for="prod_entry_mode_predef">';
echo '<input type="radio" name="prod_entry_mode" id="prod_entry_mode_predef" value="predef"'.(GETPOST('prod_entry_mode')=='predef'?' checked="true"':'').'> ';
if (empty($senderissupplier))
{
if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell');

View File

@ -136,9 +136,10 @@ else if ($action == 'setmode' && $user->rights->fournisseur->commande->creer)
}
// bank account
else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer) {
else if ($action == 'setbankaccount' && $user->rights->fournisseur->commande->creer)
{
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
}
}
// date de livraison
if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer)
@ -1268,10 +1269,14 @@ if ($action=="create")
print '</td></tr>';
// Bank Account
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
{
$langs->load("bank");
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>';
$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 '</td></tr>';
// Bank Account
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
{
print '<tr><td class="nowrap">';
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
print $langs->trans('BankAccount');
print '<td>';
if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer)
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
print '</tr></table>';
print '</td><td colspan="3">';
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 '</td>';
print '</tr>';
}
// Delivery date planed
print '<tr><td>';
print '<table class="nobordernopadding" width="100%"><tr><td>';

View File

@ -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

View File

@ -1632,9 +1632,9 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print "\n";
print "<!-- Begin Help Block-->\n";
print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
//Dolibarr version
$doliurl='http://www.dolibarr.org';
//local communities
if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr';
if (preg_match('/es/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.es';
@ -1653,7 +1653,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
else $appli.=" ".DOL_VERSION;
}
else $appli.=" ".DOL_VERSION;
print '<div class="blockvmenuhelp">';
print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
print $appli;
if ($doliurl) print '</a>';
@ -1677,7 +1677,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
// Link to help pages
if ($helpbaseurl && $helppage)
{
print '<div class="blockvmenuhelp">';
print '<div id="blockvmenuhelpwiki" class="blockvmenuhelp">';
print '<a class="help" target="_blank" title="'.$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage');
if ($mode == 'wiki') print ' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage,'_',' ')).'&quot;';
print '" href="';
@ -1705,7 +1705,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$bugbaseurl.=urlencode($langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."\n");
$bugbaseurl.=urlencode($langs->trans("PHP").": ".version_php()."\n");
$bugbaseurl.=urlencode($langs->trans("Url").": ".$_SERVER["REQUEST_URI"]."\n");
print '<div class="blockvmenuhelp"><a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a></div>';
print '<div id="blockvmenuhelpbugreport" class="blockvmenuhelp"><a class="help" target="_blank" href="'.$bugbaseurl.'">'.$langs->trans("FindBug").'</a></div>';
}
print "</div>\n";

View File

@ -434,9 +434,13 @@ if ($action == 'create' && $user->rights->projet->creer)
// Customer
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$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 '</td></tr>';
// Public

View File

@ -782,16 +782,18 @@ else
print '<div class="hideonsmartphone float">';
print $langs->trans("ThirdPartyType").': &nbsp; &nbsp; ';
print '</div>';
print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private?'':' checked="checked"').'>';
print '<label for="radiocompany">';
print '<input type="radio" id="radiocompany" class="flat" name="private" value="0"'.($private?'':' checked="checked"').'>';
print '&nbsp;';
print $langs->trans("Company/Fundation");
print '</label>';
print ' &nbsp; &nbsp; ';
print '<label for="radioprivate">';
print '<input type="radio" id="radioprivate" class="flat" name="private" value="1"'.($private?' checked="checked"':'').'>';
print '&nbsp;';
print $langs->trans("Individual");
print ' ('.$langs->trans("ToCreateContactWithSameName").')';
print '<div class="hideonsmartphone">('.$langs->trans("ToCreateContactWithSameName").')</div>';
print '</label>';
print '</div>';
print "<br>\n";
}

View File

@ -824,4 +824,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
$this->assertEquals(dol_nl2br($string, 1, 1), "a<br />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;
}
}