diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php
index 25337446b5b..8a46079955b 100644
--- a/htdocs/comm/propal/card.php
+++ b/htdocs/comm/propal/card.php
@@ -279,7 +279,7 @@ if (empty($reshook))
if ($socid < 1) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), null, 'errors');
-
+
$action = 'create';
$error ++;
}
@@ -345,7 +345,7 @@ if (empty($reshook))
$object->origin = GETPOST('origin');
$object->origin_id = GETPOST('originid');
-
+
// Multicurrency
if (!empty($conf->multicurrency->enabled))
{
@@ -718,7 +718,7 @@ if (empty($reshook))
$tva_tx = get_default_tva($mysoc, $object->thirdparty, $prod->id);
$tva_npr = get_default_npr($mysoc, $object->thirdparty, $prod->id);
if (empty($tva_tx)) $tva_npr=0;
-
+
$pu_ht = $prod->price;
$pu_ttc = $prod->price_ttc;
$price_min = $prod->price_min;
@@ -932,7 +932,7 @@ if (empty($reshook))
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
- $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
+ $buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
$date_end = dol_mktime(GETPOST('date_endhour'), GETPOST('date_endmin'), GETPOST('date_endsec'), GETPOST('date_endmonth'), GETPOST('date_endday'), GETPOST('date_endyear'));
@@ -1082,7 +1082,7 @@ if (empty($reshook))
// Multicurrency rate
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
- $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
+ $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
}
// bank account
@@ -1167,12 +1167,12 @@ if (empty($reshook))
}
}
}
-
+
// Actions to build doc
$upload_dir = $conf->propal->dir_output;
$permissioncreate=$user->rights->propal->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
-
+
}
@@ -1432,11 +1432,11 @@ if ($action == 'create')
print '
';
print ''.fieldLabel('Currency','multicurrency_code').' ';
print '';
- $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
+ $currency_code = (!empty($soc->multicurrency_code) ? $soc->multicurrency_code : ($object->multicurrency_code ? $object->multicurrency_code : $conf->currency));
print $form->selectMultiCurrency($currency_code, 'multicurrency_code', 0);
print ' ';
}
-
+
// Public note
print '';
print '' . $langs->trans('NotePublic') . ' ';
@@ -1934,7 +1934,7 @@ if ($action == 'create')
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
}
print ' ';
-
+
// Multicurrency rate
print '';
print '';
@@ -2053,7 +2053,7 @@ if ($action == 'create')
print ' ' . price($object->total_ht, '', $langs, 0, - 1, - 1, $conf->currency) . ' ';
// Margin Infos
- if (! empty($conf->margin->enabled))
+ if (! empty($conf->margin->enabled))
{
$rowspan=4;
if ($mysoc->localtax1_assuj == "1" || $object->total_localtax1 != 0) $rowspan++;
@@ -2087,25 +2087,25 @@ if ($action == 'create')
print ' ' . $langs->trans('AmountTTC') . ' ';
print '' . price($object->total_ttc, '', $langs, 0, - 1, - 1, $conf->currency) . ' ';
print ' ';
-
+
if (!empty($conf->multicurrency->enabled))
{
// Multicurrency Amount HT
print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' ';
print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
print ' ';
-
+
// Multicurrency Amount VAT
print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' ';
print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
print ' ';
-
+
// Multicurrency Amount TTC
print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' ';
print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
- print ' ';
+ print '';
}
-
+
// Statut
print '' . $langs->trans('Status') . ' ' . $object->getLibStatut(4) . ' ';
@@ -2397,7 +2397,7 @@ if ($action == 'create')
{
include DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$formmail->frommail=dolAddEmailTrackId($formmail->frommail, 'pro'.$object->id);
- }
+ }
$formmail->withfrom = 1;
$liste = array();
foreach ($object->thirdparty->thirdparty_and_contact_email_array(1) as $key => $value)
diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php
index bf1925ed061..8409eb47e9e 100644
--- a/htdocs/commande/card.php
+++ b/htdocs/commande/card.php
@@ -262,14 +262,14 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
-
+
// Fill array 'array_options' with data from add form
if (! $error)
{
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
if ($ret < 0) $error++;
}
-
+
// If creation from another object of another module (Example: origin=propal, originid=1)
if (! empty($origin) && ! empty($originid))
{
@@ -388,7 +388,7 @@ if (empty($reshook))
}
$sqlcontact = "SELECT code, fk_socpeople FROM ".MAIN_DB_PREFIX."element_contact as ec, ".MAIN_DB_PREFIX."c_type_contact as ctc";
$sqlcontact.= " WHERE element_id = ".$originidforcontact." AND ec.fk_c_type_contact = ctc.rowid AND ctc.element = '".$originforcontact."'";
-
+
$resqlcontact = $db->query($sqlcontact);
if ($resqlcontact)
{
@@ -400,14 +400,14 @@ if (empty($reshook))
}
else dol_print_error($resqlcontact);
}
-
+
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
// modified by hook
if ($reshook < 0)
$error++;
-
+
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
@@ -475,12 +475,12 @@ if (empty($reshook))
else if ($action == 'classifyunbilled' && $user->rights->commande->creer)
{
$ret=$object->classifyUnBilled();
-
+
if ($ret < 0) {
setEventMessages($object->error, $object->errors, 'errors');
}
}
-
+
// Positionne ref commande client
else if ($action == 'set_ref_client' && $user->rights->commande->creer) {
$object->set_ref_client($user, GETPOST('ref_client'));
@@ -525,7 +525,7 @@ if (empty($reshook))
if ($result < 0)
setEventMessages($object->error, $object->errors, 'errors');
}
-
+
// Multicurrency Code
else if ($action == 'setmulticurrencycode' && $user->rights->commande->creer) {
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
@@ -533,9 +533,9 @@ if (empty($reshook))
// Multicurrency rate
else if ($action == 'setmulticurrencyrate' && $user->rights->commande->creer) {
- $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
+ $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
}
-
+
else if ($action == 'setavailability' && $user->rights->commande->creer) {
$result = $object->availability(GETPOST('availability_id'));
if ($result < 0)
@@ -1334,7 +1334,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_absolue = 0;
$currency_code = $conf->currency;
-
+
if (! empty($origin) && ! empty($originid)) {
// Parse element/subelement (ex: project_task)
$element = $subelement = $origin;
@@ -1405,7 +1405,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if (!empty($conf->multicurrency->enabled))
{
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
- if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
+ if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
}
$note_private = $object->getDefaultCreateValueFor('note_private', (! empty($objectsrc->note_private) ? $objectsrc->note_private : null));
@@ -1428,7 +1428,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$remise_absolue = 0;
$dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER)?-1:'';
$projectid = 0;
-
+
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
$note_private = $object->getDefaultCreateValueFor('note_private');
@@ -1696,12 +1696,12 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '' . $langs->trans('TotalTTC') . ' ' . price($objectsrc->total_ttc) . " ";
-
+
if (!empty($conf->multicurrency->enabled))
{
print '' . $langs->trans('MulticurrencyTotalHT') . ' ' . price($objectsrc->multicurrency_total_ht) . ' ';
print '' . $langs->trans('MulticurrencyTotalVAT') . ' ' . price($objectsrc->multicurrency_total_tva) . " ";
- print '' . $langs->trans('MulticurrencyTotalTTC') . ' ' . price($objectsrc->multicurrency_total_ttc) . " ";
+ print '' . $langs->trans('MulticurrencyTotalTTC') . ' ' . price($objectsrc->multicurrency_total_ttc) . " ";
}
}
else
@@ -1747,7 +1747,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print ' ';
print ' ';
print '';
-
+
print '';
// Show origin lines
@@ -2018,7 +2018,7 @@ if ($action == 'create' && $user->rights->commande->creer)
print '';
print '';
}
-
+
// Relative and absolute discounts
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final
@@ -2203,7 +2203,7 @@ if ($action == 'create' && $user->rights->commande->creer)
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
}
print '';
-
+
// Multicurrency rate
print '';
print '';
@@ -2269,8 +2269,8 @@ if ($action == 'create' && $user->rights->commande->creer)
print ' / ';
print showDimensionInBestUnit($totalVolume, 0, "volume", $langs, isset($conf->global->MAIN_VOLUME_DEFAULT_ROUND)?$conf->global->MAIN_VOLUME_DEFAULT_ROUND:-1, isset($conf->global->MAIN_VOLUME_DEFAULT_UNIT)?$conf->global->MAIN_VOLUME_DEFAULT_UNIT:'no');
print ' ';
- }
-
+ }
+
// TODO How record was recorded OrderMode (llx_c_input_method)
// Project
@@ -2385,16 +2385,16 @@ if ($action == 'create' && $user->rights->commande->creer)
print '' . fieldLabel('MulticurrencyAmountHT','multicurrency_total_ht') . ' ';
print '' . price($object->multicurrency_total_ht, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
print ' ';
-
+
// Multicurrency Amount VAT
print '' . fieldLabel('MulticurrencyAmountVAT','multicurrency_total_tva') . ' ';
print '' . price($object->multicurrency_total_tva, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
print ' ';
-
+
// Multicurrency Amount TTC
print '' . fieldLabel('MulticurrencyAmountTTC','multicurrency_total_ttc') . ' ';
print '' . price($object->multicurrency_total_ttc, '', $langs, 0, - 1, - 1, (!empty($object->multicurrency_code) ? $object->multicurrency_code : $conf->currency)) . ' ';
- print ' ';
+ print '';
}
// Statut
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index c2dbb5996a7..8586a5d77a5 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -141,7 +141,7 @@ if (empty($reshook))
$object->fetch_thirdparty();
$result = $object->add_object_linked('commande', GETPOST('linkedOrder'));
}
-
+
// Action clone object
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) {
// if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) {
@@ -290,9 +290,9 @@ if (empty($reshook))
// Multicurrency rate
else if ($action == 'setmulticurrencyrate' && $user->rights->facture->creer) {
- $result = $object->setMulticurrencyRate(GETPOST('multicurrency_tx', 'int'));
+ $result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
}
-
+
else if ($action == 'setinvoicedate' && $user->rights->facture->creer)
{
$object->fetch($id);
@@ -320,7 +320,7 @@ if (empty($reshook))
$result = $object->update($user);
if ($result < 0) dol_print_error($db, $object->error);
}
-
+
else if ($action == 'setconditions' && $user->rights->facture->creer)
{
$object->fetch($id);
@@ -713,7 +713,7 @@ if (empty($reshook))
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
+
if (! $error) {
// This is a replacement invoice
$result = $object->fetch($_POST['fac_replacement']);
@@ -766,7 +766,7 @@ if (empty($reshook))
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
+
if (! $error)
{
$object->socid = GETPOST('socid','int');
@@ -788,7 +788,7 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
-
+
// Proprietes particulieres a facture avoir
$object->fk_facture_source = $sourceinvoice > 0 ? $sourceinvoice : '';
$object->type = Facture::TYPE_CREDIT_NOTE;
@@ -875,7 +875,7 @@ if (empty($reshook))
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
+
if (! $error)
{
$object->socid = GETPOST('socid','int');
@@ -899,7 +899,7 @@ if (empty($reshook))
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
$object->multicurrency_code = GETPOST('multicurrency_code', 'alpha');
$object->multicurrency_tx = GETPOST('originmulticurrency_tx', 'int');
-
+
// Source facture
$object->fac_rec = GETPOST('fac_rec');
@@ -924,7 +924,7 @@ if (empty($reshook))
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
+
if (! $error)
{
// Si facture standard
@@ -1206,9 +1206,9 @@ if (empty($reshook))
$object->add_contact($objcontact->fk_socpeople, $objcontact->code);
}
}
- else dol_print_error($resqlcontact);
+ else dol_print_error($resqlcontact);
}
-
+
// Hooks
$parameters = array('objFrom' => $srcobject);
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
@@ -1218,7 +1218,7 @@ if (empty($reshook))
setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
$error++;
}
-
+
} else {
setEventMessages($object->error, $object->errors, 'errors');
$error++;
@@ -1250,7 +1250,7 @@ if (empty($reshook))
}
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
-
+
if (!($_POST['situations'] > 0)) {
$error++;
$mesg = '' . $langs->trans("ErrorFieldRequired", $langs->trans("InvoiceSituation")) . '
';
@@ -1265,8 +1265,8 @@ if (empty($reshook))
{
$object->origin = $origin;
$object->origin_id = $originid;
-
- foreach ($object->lines as &$line)
+
+ foreach ($object->lines as &$line)
{
$line->origin = $object->origin;
$line->origin_id = $line->id;
@@ -1612,7 +1612,7 @@ if (empty($reshook))
$pu_ht = GETPOST('price_ht');
$vat_rate = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
$qty = GETPOST('qty');
-
+
// Define info_bits
$info_bits = 0;
if (preg_match('/\*/', $vat_rate))
@@ -1797,7 +1797,7 @@ if (empty($reshook))
$upload_dir = $conf->facture->dir_output;
$permissioncreate=$user->rights->facture->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
-
+
if ($action == 'update_extras') {
// Fill array 'array_options' with data from add form
@@ -1904,7 +1904,7 @@ if ($action == 'create')
$res = $soc->fetch($socid);
$currency_code = $conf->currency;
-
+
// Load objectsrc
$remise_absolue = 0;
@@ -1976,9 +1976,9 @@ if ($action == 'create')
if (!empty($conf->multicurrency->enabled))
{
if (!empty($objectsrc->multicurrency_code)) $currency_code = $objectsrc->multicurrency_code;
- if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
+ if (!empty($conf->global->MULTICURRENCY_USE_ORIGIN_TX) && !empty($objectsrc->multicurrency_tx)) $currency_tx = $objectsrc->multicurrency_tx;
}
-
+
// Replicate extrafields
$objectsrc->fetch_optionals($originid);
$object->array_options = $objectsrc->array_options;
@@ -1992,7 +1992,7 @@ if ($action == 'create')
$remise_percent = $soc->remise_percent;
$remise_absolue = 0;
$dateinvoice = (empty($dateinvoice)?(empty($conf->global->MAIN_AUTOFILL_DATE)?-1:''):$dateinvoice); // Do not set 0 here (0 for a date is 1970)
-
+
if (!empty($conf->multicurrency->enabled) && !empty($soc->multicurrency_code)) $currency_code = $soc->multicurrency_code;
}
@@ -2018,7 +2018,7 @@ if ($action == 'create')
}
print info_admin($text, 0, 0, 0).' ';
}
-
+
print '