Merge branch '3.7' of git@github.com:Dolibarr/dolibarr.git into 3.7

This commit is contained in:
Laurent Destailleur 2014-11-29 12:41:26 +01:00
commit 278cdf72d6
41 changed files with 496 additions and 296 deletions

View File

@ -174,7 +174,10 @@ Dolibarr better:
- Fix: Civility & birthdate wasn't save into adherent module. - Fix: Civility & birthdate wasn't save into adherent module.
- Fix: webservice Thirdparty parameter lastname for invidual creation is now lastname and not ref - 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: 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.* ***** ***** ChangeLog for 3.6.1 compared to 3.6.* *****
For users: 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, ...) // Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
if ($action == 'setModuleOptions') if ($action == 'setModuleOptions')
{ {
@ -582,6 +598,35 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'
print "</td></tr>\n"; print "</td></tr>\n";
print '</form>'; 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>'; print '</table>';

View File

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

View File

@ -3,7 +3,8 @@
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com> * Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2014 Frederic France <frederic.france@free.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -22,14 +23,13 @@
/** /**
* \file htdocs/comm/propal/apercu.php * \file htdocs/comm/propal/apercu.php
* \ingroup propal * \ingroup propal
* \brief Page de l'onglet apercu d'une propal * \brief Preview tab of propal
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.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/propal.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.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('propal');
$langs->load("bills"); $langs->load("bills");
@ -44,18 +44,11 @@ $result = restrictedArea($user, 'propal', $id);
/* /*
* View * View Mode
*/ */
llxHeader(); llxHeader();
$form = new Form($db);
/* *************************************************************************** */
/* */
/* Mode fiche */
/* */
/* *************************************************************************** */
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
@ -73,29 +66,30 @@ if ($id > 0 || ! empty($ref))
/* /*
* Propal * Propal
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="5">'.$object->ref.'</td></tr>'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td>';
print '<td colspan="5">'.$object->ref.'</td>';
print '</tr>';
// Ref client // Ref client
print '<tr><td>'; print '<tr><td>'.$langs->trans('RefCustomer').'</td>';
print '<table class="nobordernopadding" width="100%"><tr><td class="nowrap">'; print '<td colspan="5">'.$object->ref_client.'</td>';
print $langs->trans('RefCustomer').'</td><td align="left">'; print '</tr>';
print '</td>';
print '</tr></table>';
print '</td><td colspan="5">';
print $object->ref_client;
print '</td>';
print '</tr>';
$rowspan=2;
// Tiers // Thirdparty
print '<tr><td>'.$langs->trans('Company').'</td><td colspan="5">'.$soc->getNomUrl(1).'</td>'; print '<tr><td>'.$langs->trans('Company').'</td>';
print '</tr>'; print '<td colspan="5">'.$soc->getNomUrl(1).'</td>';
print '</tr>';
// Ligne info remises tiers // Status
print '<tr><td>'.$langs->trans("Status").'</td>';
print '<td colspan="5">'.$object->getLibStatut(4).'</td>';
print '</tr>';
// Discount
print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">'; print '<tr><td>'.$langs->trans('Discounts').'</td><td colspan="5">';
if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent); if ($soc->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$soc->remise_percent);
else print $langs->trans("CompanyHasNoRelativeDiscount"); else print $langs->trans("CompanyHasNoRelativeDiscount");
@ -103,44 +97,43 @@ if ($id > 0 || ! empty($ref))
print '. '; print '. ';
if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency)); if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",$absolute_discount,$langs->trans("Currency".$conf->currency));
else print $langs->trans("CompanyHasNoAbsoluteDiscount"); else print $langs->trans("CompanyHasNoAbsoluteDiscount");
print '.'; print '.</td>';
print '</td></tr>'; print '</tr>';
// ligne // Date
// partie Gauche print '<tr><td>'.$langs->trans('Date').'</td>';
print '<tr><td>'.$langs->trans('Date').'</td><td colspan="3">'; print '<td>'.dol_print_date($object->date,'daytext').'</td>';
print dol_print_date($object->date,'daytext');
print '</td>';
// partie Droite sur $rowspan lignes // Right part with $rowspan lines
print '<td colspan="2" rowspan="'.$rowspan.'" valign="top" width="50%">'; $rowspan=4;
print '<td rowspan="'.$rowspan.'" valign="top" width="50%">';
/* /*
* Documents * Documents
*/ */
$objectref = dol_sanitizeFileName($object->ref); $objectref = dol_sanitizeFileName($object->ref);
$dir_output = $conf->propal->dir_output . "/"; $dir_output = $conf->propal->dir_output . "/";
$filepath = $dir_output . $objectref . "/"; $filepath = $dir_output . $objectref . "/";
$file = $filepath . $objectref . ".pdf"; $file = $filepath . $objectref . ".pdf";
$filedetail = $filepath . $objectref . "-detail.pdf"; $filedetail = $filepath . $objectref . "-detail.pdf";
$relativepath = $objectref.'/'.$objectref.'.pdf'; $relativepath = $objectref.'/'.$objectref.'.pdf';
$relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf'; $relativepathdetail = $objectref.'/'.$objectref.'-detail.pdf';
// Define path to preview pdf file (preview precompiled "file.ext" are "file.ext_preview.png") // 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 $fileimagebis = $file.'_preview-0.pdf.png'; // If PDF has more than one page
$relativepathimage = $relativepath.'_preview.png'; $relativepathimage = $relativepath.'_preview.png';
$var=true; $var=true;
// Si fichier PDF existe // Si fichier PDF existe
if (file_exists($file)) if (file_exists($file))
{ {
$encfile = urlencode($file); $encfile = urlencode($file);
print_titre($langs->trans("Documents")); print '<table class="nobordernopadding" width="100%">';
print '<table class="border" width="100%">'; print '<tr class="liste_titre"><td colspan="4">'.$langs->trans("Documents").'</td></tr>';
print "<tr ".$bc[$var]."><td>".$langs->trans("Propal")." PDF</td>"; print '<tr '.$bc[$var].'><td>'.$langs->trans("Proposal").' PDF</td>';
print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>'; print '<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=propal&file='.urlencode($relativepath).'">'.$object->ref.'.pdf</a></td>';
@ -166,13 +159,25 @@ if ($id > 0 || ! empty($ref))
} }
} }
print "</td>"; print '</td>';
print '</tr>'; print '</tr>';
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>'; // Total HT - left part
print '<td align="right" colspan="2"><b>'.price($object->price).'</b></td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>'; print '<td align="right" class="nowrap"><b>' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</table>'; print '</tr>';
// Total VAT - left part
print '<tr><td>'.$langs->trans('AmountVAT').'</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_tva, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</tr>';
// Total TTC - left part
print '<tr><td>'.$langs->trans('AmountTTC').'</td>';
print '<td align="right" class="nowrap"><b>' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . '</b></td>';
print '</tr>';
print '</table>';
dol_fiche_end(); dol_fiche_end();
} }
@ -183,10 +188,13 @@ if ($id > 0 || ! empty($ref))
} }
} }
print '<table class="border" width="100%">';
print '<tr><td>';
print '<div class="photolist">';
// Si fichier png PDF d'1 page trouve // Si fichier png PDF d'1 page trouve
if (file_exists($fileimage)) if (file_exists($fileimage))
{ {
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">'; print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&amp;file='.urlencode($relativepathimage).'">';
} }
// Si fichier png PDF de plus d'1 page trouve // Si fichier png PDF de plus d'1 page trouve
elseif (file_exists($fileimagebis)) elseif (file_exists($fileimagebis))
@ -199,10 +207,13 @@ elseif (file_exists($fileimagebis))
if (file_exists($dir_output.$preview)) if (file_exists($dir_output.$preview))
{ {
print '<img style="background: #FFF" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($preview).'"><p>'; print '<img class="photo photowithmargin" src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&amp;file='.urlencode($preview).'"><p>';
} }
} }
} }
print '</div>';
print '</td></tr>';
print '</table>';
llxFooter(); llxFooter();

View File

@ -416,7 +416,15 @@ class Propal extends CommonObject
// infos marge // 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->pa_ht = $pa_ht;
// Mise en option de la ligne // Mise en option de la ligne
@ -567,7 +575,15 @@ class Propal extends CommonObject
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // 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->pa_ht = $pa_ht;
$this->line->date_start=$date_start; $this->line->date_start=$date_start;

View File

@ -1391,9 +1391,12 @@ if ($action == 'create' && $user->rights->commande->creer) {
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">'; if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); {
print '</td></tr>'; print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">';
$form->select_comptes($fk_account, 'fk_account', 0, '', 1);
print '</td></tr>';
}
// Delivery delay // Delivery delay
print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">'; print '<tr><td>' . $langs->trans('AvailabilityPeriod') . '</td><td colspan="2">';
@ -1995,21 +1998,24 @@ if ($action == 'create' && $user->rights->commande->creer) {
$rowspan ++; $rowspan ++;
// Bank Account // Bank Account
print '<tr><td class="nowrap">'; if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && ! empty($conf->banque->enabled))
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; {
print $langs->trans('BankAccount'); print '<tr><td class="nowrap">';
print '<td>'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
if ($action != 'editbankaccount' && $user->rights->commande->creer) print $langs->trans('BankAccount');
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td>';
print '</tr></table>'; if ($action != 'editbankaccount' && $user->rights->commande->creer)
print '</td><td colspan="3">'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
if ($action == 'editbankaccount') { print '</tr></table>';
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); print '</td><td colspan="3">';
} else { if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} } else {
print '</td>'; $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
print '</tr>'; }
print '</td>';
print '</tr>';
}
// Total HT // Total HT
print '<tr><td>' . $langs->trans('AmountHT') . '</td>'; print '<tr><td>' . $langs->trans('AmountHT') . '</td>';

View File

@ -1224,7 +1224,15 @@ class Commande extends CommonOrder
$this->line->date_end=$date_end; $this->line->date_end=$date_end;
// infos marge // 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->pa_ht = $pa_ht;
// TODO Ne plus utiliser // TODO Ne plus utiliser
@ -2421,7 +2429,15 @@ class Commande extends CommonOrder
$this->line->skip_update_total=$skip_update_total; $this->line->skip_update_total=$skip_update_total;
// infos marge // 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->pa_ht = $pa_ht;
// TODO deprecated // TODO deprecated

View File

@ -2203,7 +2203,15 @@ class Facture extends CommonInvoice
$this->line->skip_update_total = $skip_update_total; $this->line->skip_update_total = $skip_update_total;
// infos marge // 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; $this->line->pa_ht = $pa_ht;
if (is_array($array_option) && count($array_option)>0) { if (is_array($array_option) && count($array_option)>0) {
@ -3499,6 +3507,14 @@ class FactureLigne extends CommonInvoiceLine
} }
} }
// 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(); $this->db->begin();
// Insertion dans base de la ligne // Insertion dans base de la ligne

View File

@ -678,7 +678,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us
$societestatic->name=$obj->name; $societestatic->name=$obj->name;
$societestatic->client=1; $societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44); 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>'; 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).'</td>';
print '<td align="right">'.price($obj->total_ttc-$obj->tot_fttc).'</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->name=$obj->name;
$societestatic->client=1; $societestatic->client=1;
print $societestatic->getNomUrl(1,'customer',44); 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>'; 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->total_ttc).'</td>';
print '<td align="right">'.price($obj->am).'</td>'; print '<td align="right">'.price($obj->am).'</td>';

View File

@ -536,10 +536,10 @@ else if ($action == 'addline' && $user->rights->contrat->creer)
$outputlangs = new Translate("", $conf); $outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang); $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 $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']); unset($_POST ['prod_entry_mode']);

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.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $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="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.=' &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.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">'; $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).'">'; $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.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $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="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.=' &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.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">'; $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).'">'; $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.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $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="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.=' &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.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">'; $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).'">'; $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.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $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="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.=' &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.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">'; $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).'">'; $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.='<form class="flat formboxfilter" method="POST" action="'.$_SERVER["PHP_SELF"].'">';
$stringtoshow.='<input type="hidden" name="action" value="'.$refreshaction.'">'; $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="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.=' &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.='<br>';
$stringtoshow.=$langs->trans("Year").' <input class="flat" size="4" type="text" name="'.$param_year.'" value="'.$endyear.'">'; $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).'">'; $stringtoshow.='<input type="image" alt="'.$langs->trans("Refresh").'" src="'.img_picto($langs->trans("Refresh"),'refresh.png','','',1).'">';

View File

@ -228,7 +228,7 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty"
print '</td><td class="nocellnopadd boxclose nowrap">'; print '</td><td class="nocellnopadd boxclose nowrap">';
// The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object // The image must have the class 'boxhandle' beause it's value used in DOM draggable objects to define the area used to catch the full object
print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"'); print img_picto($langs->trans("MoveBox",$this->box_id),'grip_title','class="boxhandle hideonsmartphone" style="cursor:move;"');
print img_picto($langs->trans("Close",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"'); print img_picto($langs->trans("Close2",$this->box_id),'close_title','class="boxclose" rel="x:y" style="cursor:pointer;" id="imgclose'.$this->box_id.'"');
$label=$head['text']; $label=$head['text'];
if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')'; if (! empty($head['graph'])) $label.=' ('.$langs->trans("Graph").')';
print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">'; print '<input type="hidden" id="boxlabelentry'.$this->box_id.'" value="'.dol_escape_htmltag($label).'">';

View File

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

View File

@ -766,11 +766,12 @@ function dol_bc($var,$moreclass='')
* @param Object $object A company or contact object * @param Object $object A company or contact object
* @param int $withcountry 1=Add country into address string * @param int $withcountry 1=Add country into address string
* @param string $sep Separator to use to build 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 * @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=''; $ret='';
$countriesusingstate=array('AU','US','IN','GB','ES','UK','TR'); $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; $ret.=", ".$object->state;
} }
} }
if (! is_object($outputlangs)) $outputlangs=$langs;
if ($withcountry) $ret.=($object->country?$sep.$object->country:''); if ($withcountry) $ret.=($object->country_code?$sep.$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->country_code)):'');
return $ret; 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) * 'MT'=Round to Max for totals with Tax (MAIN_MAX_DECIMALS_TOT)
* 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN) * 'MS'=Round to Max Shown (MAIN_MAX_DECIMALS_SHOWN)
* @param int $alreadysqlnb Put 1 if you know that content is already universal format number * @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 * @see price Opposite function of price2num
*/ */

View File

@ -312,7 +312,10 @@ function pdf_build_address($outputlangs,$sourcecompany,$targetcompany='',$target
if ($mode == 'source') 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)) if (empty($conf->global->MAIN_PDF_DISABLESOURCEDETAILS))
{ {

View File

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

View File

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

View File

@ -53,6 +53,18 @@ class pdf_strato extends ModelePDFContract
var $marge_haute; var $marge_haute;
var $marge_basse; var $marge_basse;
/**
* Issuer
* @var Societe
*/
public $emetteur;
/**
* Recipient
* @var Societe
*/
public $recipient;
/** /**
* Constructor * Constructor
* *
@ -543,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 .= ($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 // Show sender
$posy=42; $posy=42;
@ -581,17 +593,17 @@ class pdf_strato extends ModelePDFContract
$result=$object->fetch_contact($arrayidcontact[0]); $result=$object->fetch_contact($arrayidcontact[0]);
} }
$this->recipient = $object->client;
// Recipient name // Recipient name
if (! empty($usecontact)) if (! empty($usecontact)) {
{
// On peut utiliser le nom de la societe du contact // On peut utiliser le nom de la societe du contact
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname; if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socname = $object->contact->socname;
else $socname = $object->client->name; else $socname = $object->client->name;
$this->recipient->name=$outputlangs->convToOutputCharset($socname); $this->recipient->name = $outputlangs->convToOutputCharset($socname);
} }
else else {
{ $this->recipient->name = $outputlangs->convToOutputCharset($object->client->name);
$this->recipient->name=$outputlangs->convToOutputCharset($object->client->name);
} }
$carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target'); $carac_client=pdf_build_address($outputlangs, $this->emetteur, $object->client, (isset($object->contact)?$object->contact:''), $usecontact, 'target');

View File

@ -539,7 +539,7 @@ class pdf_merou extends ModelePdfExpedition
$pdf->SetTextColor(0,0,0); $pdf->SetTextColor(0,0,0);
// Sender properties // 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->SetFont('','', $default_font_size - 3);
$pdf->SetXY($blSocX,$blSocY+4); $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 .= ($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 // Show sender
$posx=$this->marge_gauche; $posx=$this->marge_gauche;

View File

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

View File

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

View File

@ -1022,7 +1022,7 @@ class pdf_muscadet extends ModelePDFSuppliersOrders
if ($showaddress) if ($showaddress)
{ {
// Sender properties // Sender properties
$carac_emetteur = pdf_build_address($outputlangs,$this->emetteur); $carac_emetteur = pdf_build_address($outputlangs, $this->emetteur, $object->client);
// Show sender // Show sender
$posy=42; $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"' : ''); ?>> <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"); ?> <div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td> </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_vat"><?php echo $langs->trans('VAT'); ?></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_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
<?php if (! empty($inputalsopricewithtax)) { ?> <?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 } ?> <?php } ?>
<td align="right"><label for="qty"><?php echo $langs->trans('Qty'); ?></label></td> <td align="right"><?php echo $langs->trans('Qty'); ?></td>
<td align="right"><label for="remise_percent"><?php echo $langs->trans('ReductionShort'); ?></label></td> <td align="right"><?php echo $langs->trans('ReductionShort'); ?></td>
<?php <?php
if (! empty($usemargins)) if (! empty($usemargins))
{ {
?> ?>
<td align="right" class="margininfos"> <td align="right" class="margininfos">
<?php <?php
echo '<label for="buying_price">';
if ($conf->global->MARGIN_TYPE == "1") if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice'); echo $langs->trans('BuyingPrice');
else else
echo $langs->trans('CostPrice'); echo $langs->trans('CostPrice');
echo '</label>';
?> ?>
</td> </td>
<?php <?php
@ -103,20 +101,25 @@ else {
// Show radio free line // Show radio free line
if ($forceall >= 0 && (! empty($conf->product->enabled) || ! empty($conf->service->enabled))) 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 '<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"' : ((empty($forceall) && (empty($conf->product->enabled) || empty($conf->service->enabled)))?' checked="true"':'') );
echo (GETPOST('prod_entry_mode')=='free' ? ' checked="true"' : ''); echo (GETPOST('prod_entry_mode')=='free' ? ' checked="true"' : '');
echo '> '; echo '> ';
} // Show type selector
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">';
echo $langs->trans("FreeLineOfType"); echo $langs->trans("FreeLineOfType");
echo '</label>';
echo ' '; 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); 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>'; if ($forceall >= 0) echo '<br>';
echo '<span>'; 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 '<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($senderissupplier))
{ {
if (! empty($conf->product->enabled) && empty($conf->service->enabled)) echo $langs->trans('PredefinedProductsToSell'); 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 // 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')); $result=$object->setBankAccount(GETPOST('fk_account', 'int'));
} }
// date de livraison // date de livraison
if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer) if ($action == 'setdate_livraison' && $user->rights->fournisseur->commande->creer)
@ -1268,9 +1269,13 @@ if ($action=="create")
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
print '<tr><td>' . $langs->trans('BankAccount') . '</td><td colspan="2">'; if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
$form->select_comptes($fk_account, 'fk_account', 0, '', 1); {
print '</td></tr>'; $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 '<tr><td>'.$langs->trans('NotePublic').'</td>';
print '<td>'; print '<td>';
@ -1539,21 +1544,24 @@ elseif (! empty($object->id))
print '</td></tr>'; print '</td></tr>';
// Bank Account // Bank Account
print '<tr><td class="nowrap">'; if (! empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_SUPPLIER_ORDER) && ! empty($conf->banque->enabled))
print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">'; {
print $langs->trans('BankAccount'); print '<tr><td class="nowrap">';
print '<td>'; print '<table width="100%" class="nobordernopadding"><tr><td class="nowrap">';
if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer) print $langs->trans('BankAccount');
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>'; print '<td>';
print '</tr></table>'; if ($action != 'editbankaccount' && $user->rights->fournisseur->commande->creer)
print '</td><td colspan="3">'; print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&amp;id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
if ($action == 'editbankaccount') { print '</tr></table>';
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1); print '</td><td colspan="3">';
} else { if ($action == 'editbankaccount') {
$form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none'); $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'fk_account', 1);
} } else {
print '</td>'; $form->formSelectAccount($_SERVER['PHP_SELF'].'?id='.$object->id, $object->fk_account, 'none');
print '</tr>'; }
print '</td>';
print '</tr>';
}
// Delivery date planed // Delivery date planed
print '<tr><td>'; print '<tr><td>';

View File

@ -123,7 +123,7 @@ if ($search_user)
} }
if ($search_ttc) if ($search_ttc)
{ {
$sql .= " AND total_ttc = ".price2num($search_ttc); $sql .= " AND total_ttc = '".$db->escape(price2num($search_ttc))."'";
} }
if ($sall) if ($sall)
{ {

View File

@ -144,17 +144,14 @@ if($cp_events == 1)
print '</form><br>'; print '</form><br>';
} }
dol_fiche_head();
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n"; print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">'."\n";
print '<input type="hidden" name="action" value="update" />'; print '<input type="hidden" name="action" value="update" />';
print '<table class="noborder" width="100%;">'; print '<table class="noborder" width="100%;">';
print "<tr class=\"liste_titre\">"; print "<tr class=\"liste_titre\">";
print '<td width="5%">'.$langs->trans('ID').'</td>'; print '<td width="55%">'.$langs->trans('Employee').'</td>';
print '<td width="50%">'.$langs->trans('Employee').'</td>';
print '<td width="20%" style="text-align:center">'.$langs->trans('Available').'</td>'; print '<td width="20%" style="text-align:center">'.$langs->trans('Available').'</td>';
print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>'; print '<td width="20%" style="text-align:center">'.$langs->trans('Note').'</td>';
print '<td style="text-align:center">'.$langs->trans('UpdateButtonCP').'</td>'; print '<td></td>';
print '</tr>'; print '</tr>';
foreach($listUsers as $users) foreach($listUsers as $users)
@ -163,7 +160,6 @@ foreach($listUsers as $users)
$var=!$var; $var=!$var;
print '<tr '.$bc[$var].' style="height: 20px;">'; print '<tr '.$bc[$var].' style="height: 20px;">';
print '<td>'.$users['rowid'].'</td>';
print '<td>'; print '<td>';
$userstatic->id=$users['rowid']; $userstatic->id=$users['rowid'];
$userstatic->lastname=$users['name']; $userstatic->lastname=$users['name'];
@ -183,9 +179,6 @@ foreach($listUsers as $users)
print '</table>'; print '</table>';
print '</form>'; print '</form>';
dol_fiche_end();
llxFooter(); llxFooter();
$db->close(); $db->close();

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 UseOptionLineIfNoQuantity=A line of product/service with a zero amount is considered as an option
FreeLegalTextOnProposal=Free text on commercial proposals FreeLegalTextOnProposal=Free text on commercial proposals
WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty) WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty)
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal
##### Orders ##### ##### Orders #####
OrdersSetup=Order management setup OrdersSetup=Order management setup
OrdersNumberingModules=Orders numbering models OrdersNumberingModules=Orders numbering models

View File

@ -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. ErrorCantDeleteCP=Error you don't have the right to delete this leave request.
CantCreateCP=You don't have the right to make leave requests. CantCreateCP=You don't have the right to make leave requests.
InvalidValidatorCP=You must choose an approbator to your leave request. InvalidValidatorCP=You must choose an approbator to your leave request.
UpdateButtonCP=Update
CantUpdate=You cannot update this leave request. CantUpdate=You cannot update this leave request.
NoDateDebut=You must select a start date. NoDateDebut=You must select a start date.
NoDateFin=You must select an end date. NoDateFin=You must select an end date.

View File

@ -1628,9 +1628,12 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print "<!-- End Bookmarks -->\n"; print "<!-- End Bookmarks -->\n";
} }
//Dolibarr version print "\n";
$doliurl='http://www.dolibarr.org'; print "<!-- Begin Help Block-->\n";
print '<div id="blockvmenuhelp" class="blockvmenuhelp">'."\n";
//Dolibarr version
$doliurl='http://www.dolibarr.org';
//local communities //local communities
if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr'; if (preg_match('/fr/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.fr';
if (preg_match('/es/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.es'; if (preg_match('/es/i',$langs->defaultlang)) $doliurl='http://www.dolibarr.es';
@ -1649,11 +1652,11 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
else $appli.=" ".DOL_VERSION; else $appli.=" ".DOL_VERSION;
} }
else $appli.=" ".DOL_VERSION; else $appli.=" ".DOL_VERSION;
print '<div id="blockvmenuhelp" class="blockvmenuhelp">'; print '<div id="blockvmenuhelpapp" class="blockvmenuhelp">';
if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">'; if ($doliurl) print '<a class="help" target="_blank" href="'.$doliurl.'">';
print $appli; print $appli;
if ($doliurl) print '</a>'; if ($doliurl) print '</a>';
print '</div>'; print '</div>'."\n";
// Link to Dolibarr wiki pages // Link to Dolibarr wiki pages
if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK)) if ($helppagename && empty($conf->global->MAIN_HELP_DISABLELINK))
@ -1673,7 +1676,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
// Link to help pages // Link to help pages
if ($helpbaseurl && $helppage) if ($helpbaseurl && $helppage)
{ {
print '<div id="blockvmenuhelp" class="blockvmenuhelp">'; print '<div id="blockvmenuhelpwiki" class="blockvmenuhelp">';
print '<a class="help" target="_blank" title="'.$langs->trans($mode == 'wiki' ? 'GoToWikiHelpPage': 'GoToHelpPage'); 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;'; if ($mode == 'wiki') print ' - '.$langs->trans("PageWiki").' &quot;'.dol_escape_htmltag(strtr($helppage,'_',' ')).'&quot;';
print '" href="'; print '" href="';
@ -1684,7 +1687,7 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
print $langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help'); print $langs->trans($mode == 'wiki' ? 'OnlineHelp': 'Help');
//if ($mode == 'wiki') print ' ('.dol_trunc(strtr($helppage,'_',' '),8).')'; //if ($mode == 'wiki') print ' ('.dol_trunc(strtr($helppage,'_',' '),8).')';
print '</a>'; print '</a>';
print '</div>'; print '</div>'."\n";
} }
} }
@ -1701,14 +1704,16 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
$bugbaseurl.=urlencode($langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."\n"); $bugbaseurl.=urlencode($langs->trans("Server").": ".$_SERVER["SERVER_SOFTWARE"]."\n");
$bugbaseurl.=urlencode($langs->trans("PHP").": ".version_php()."\n"); $bugbaseurl.=urlencode($langs->trans("PHP").": ".version_php()."\n");
$bugbaseurl.=urlencode($langs->trans("Url").": ".$_SERVER["REQUEST_URI"]."\n"); $bugbaseurl.=urlencode($langs->trans("Url").": ".$_SERVER["REQUEST_URI"]."\n");
print '<div id="blockvmenubugtracker" 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 "\n";
print "</div>\n"; print "</div>\n";
print "<!-- End left menu -->\n"; print "<!-- End Help Block-->\n";
print "\n";
print "\n"; print "</div>\n";
print "<!-- End left menu -->\n";
print "\n";
// Execute hook printLeftBlock // Execute hook printLeftBlock
$parameters=array(); $parameters=array();

View File

@ -434,9 +434,13 @@ if ($action == 'create' && $user->rights->projet->creer)
// Customer // Customer
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>'; print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
$text=$form->select_company(GETPOST('socid','int'),'socid','',1,1); $text=$form->select_company(GETPOST('socid','int'),'socid','',1,1);
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty"); if (empty($conf->global->PROJECT_CAN_ALWAYS_LINK_TO_ALL_SUPPLIERS) && empty($conf->dol_use_jmobile))
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1); {
$texthelp=$langs->trans("IfNeedToUseOhterObjectKeepEmpty");
print $form->textwithtooltip($text.' '.img_help(),$texthelp,1);
}
else print $text;
print '</td></tr>'; print '</td></tr>';
// Public // Public

View File

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

View File

@ -29,6 +29,7 @@ set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs');
require_once '../master.inc.php'; require_once '../master.inc.php';
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
require_once DOL_DOCUMENT_ROOT.'/core/lib/ws.lib.php'; 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"); 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 // Define other specific objects
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'line', 'line',
@ -91,33 +138,7 @@ $server->wsdl->addComplexType(
'struct', 'struct',
'all', 'all',
'', '',
array( $line_fields
'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')
)
); );
/*$server->wsdl->addComplexType( /*$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( $server->wsdl->addComplexType(
'order', 'order',
'complexType', 'complexType',
'struct', 'struct',
'all', 'all',
'', '',
array( $order_fields
'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')
)
); );
/* /*
$server->wsdl->addComplexType( $server->wsdl->addComplexType(
'OrdersArray', 'OrdersArray',
@ -644,6 +685,16 @@ function createOrder($authentication,$order)
$newobject->demand_reason_id=$order['demand_reason_id']; $newobject->demand_reason_id=$order['demand_reason_id'];
$newobject->date_creation=$now; $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 // Trick because nusoap does not store data with same structure if there is one or several lines
$arrayoflines=array(); $arrayoflines=array();
if (isset($order['lines']['line'][0])) $arrayoflines=$order['lines']['line']; if (isset($order['lines']['line'][0])) $arrayoflines=$order['lines']['line'];
@ -666,6 +717,17 @@ function createOrder($authentication,$order)
$newline->total_ttc=$line['total']; $newline->total_ttc=$line['total'];
$newline->date_start=$line['date_start']; $newline->date_start=$line['date_start'];
$newline->date_end=$line['date_end']; $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; $newobject->lines[]=$newline;
} }

View File

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