mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 09:38:23 +01:00
Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'update')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action='create';
|
$action='create';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -147,7 +147,7 @@ if ($action == 'add' || $action == 'update')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$reload = 0;
|
$reload = 0;
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action= "edit";
|
$action= "edit";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ if (empty($reshook))
|
|||||||
$result=$object->fetch($id);
|
$result=$object->fetch($id);
|
||||||
$object->code_compta=$_POST["customeraccountancycode"];
|
$object->code_compta=$_POST["customeraccountancycode"];
|
||||||
$result=$object->update($object->id,$user,1,1,0);
|
$result=$object->update($object->id,$user,1,1,0);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// conditions de reglement
|
// conditions de reglement
|
||||||
@@ -113,7 +113,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
$result=$object->setPaymentTerms(GETPOST('cond_reglement_id','int'));
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// mode de reglement
|
// mode de reglement
|
||||||
@@ -121,7 +121,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
$result=$object->setPaymentMethods(GETPOST('mode_reglement_id','int'));
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// assujetissement a la TVA
|
// assujetissement a la TVA
|
||||||
@@ -130,7 +130,7 @@ if (empty($reshook))
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->tva_assuj=$_POST['assujtva_value'];
|
$object->tva_assuj=$_POST['assujtva_value'];
|
||||||
$result=$object->update($object->id);
|
$result=$object->update($object->id);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
// set prospect level
|
// set prospect level
|
||||||
@@ -157,7 +157,7 @@ if (empty($reshook))
|
|||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
$object->outstanding_limit=GETPOST('outstanding_limit');
|
$object->outstanding_limit=GETPOST('outstanding_limit');
|
||||||
$result=$object->set_OutstandingBill($user);
|
$result=$object->set_OutstandingBill($user);
|
||||||
if ($result < 0) setEventMessage($object->error,$object->errors,'errors');
|
if ($result < 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$statut=2; // Status 'sent partially' (because at least one error)
|
$statut=2; // Status 'sent partially' (because at least one error)
|
||||||
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
if ($nbok > 0) setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||||
else setEventMessage($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
else setEventMessages($langs->transnoentitiesnoconv("EMailSentToNRecipients",$nbok), null, 'mesgs');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
|
||||||
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2010-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
@@ -131,7 +131,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
if (! GETPOST('socid', 3))
|
if (! GETPOST('socid', 3))
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("NoCloneOptionsSpecified"), 'errors');
|
setEventMessages($langs->trans("NoCloneOptionsSpecified"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -141,7 +141,7 @@ if (empty($reshook))
|
|||||||
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
header("Location: " . $_SERVER['PHP_SELF'] . '?id=' . $result);
|
||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$action = '';
|
$action = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,7 +157,7 @@ if (empty($reshook))
|
|||||||
exit();
|
exit();
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans($object->error), 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,8 +211,8 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
if (count($object->errors) > 0) setEventMessage($object->errors, 'errors');
|
if (count($object->errors) > 0) setEventMessages($object->error, $object->errors, 'errors');
|
||||||
else setEventMessage($langs->trans($object->error), 'errors');
|
else setEventMessages($langs->trans($object->error), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +318,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
$id = $object->create_from($user);
|
$id = $object->create_from($user);
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToCopyProposal", GETPOST('copie_propal')), null, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$object->ref = GETPOST('ref');
|
$object->ref = GETPOST('ref');
|
||||||
@@ -507,7 +507,7 @@ if (empty($reshook))
|
|||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToAddContact"), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,7 +671,7 @@ if (empty($reshook))
|
|||||||
if ($object->id > 0) {
|
if ($object->id > 0) {
|
||||||
$result = $object->insert_discount($_POST["remise_id"]);
|
$result = $object->insert_discount($_POST["remise_id"]);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -875,7 +875,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
||||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||||
setEventMessage($mesg, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, $idprod, $remise_percent, $price_base_type, $pu_ttc, $info_bits, $type, - 1, 0, GETPOST('fk_parent_line'), $fournprice, $buyingprice, $label, $date_start, $date_end, $array_options, $fk_unit);
|
||||||
@@ -929,13 +929,13 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mise a jour d'une ligne dans la propale
|
// Update a line within proposal
|
||||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
||||||
{
|
{
|
||||||
// Define info_bits
|
// Define info_bits
|
||||||
@@ -991,7 +991,7 @@ if (empty($reshook))
|
|||||||
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
$label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : '');
|
||||||
|
|
||||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors');
|
||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -1040,7 +1040,7 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
|
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1137,9 +1137,9 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||||
} else {
|
} else {
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1636,13 +1636,13 @@ if ($action == 'create')
|
|||||||
else if ($action == 'validate') {
|
else if ($action == 'validate') {
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
// on verifie si l'objet est en numerotation provisoire
|
// We verifie whether the object is provisionally numbering
|
||||||
$ref = substr($object->ref, 1, 4);
|
$ref = substr($object->ref, 1, 4);
|
||||||
if ($ref == 'PROV') {
|
if ($ref == 'PROV') {
|
||||||
$numref = $object->getNextNumRef($soc);
|
$numref = $object->getNextNumRef($soc);
|
||||||
if (empty($numref)) {
|
if (empty($numref)) {
|
||||||
$error ++;
|
$error ++;
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$numref = $object->ref;
|
$numref = $object->ref;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
/* Copyright (C) 2005 Patrick Rouillon <patrick@rouillon.net>
|
||||||
* Copyright (C) 2005-2009 Destailleur Laurent <eldy@users.sourceforge.net>
|
* Copyright (C) 2005-2009 Destailleur Laurent <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-2012 Philippe Grand <philippe.grand@atoo-net.com>
|
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -54,12 +54,12 @@ if ($id > 0 || ! empty($ref))
|
|||||||
if ($ret == 0)
|
if ($ret == 0)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans('ErrorRecordNotFound'), 'errors');
|
setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
else if ($ret < 0)
|
else if ($ret < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -75,7 +75,7 @@ else
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ajout d'un nouveau contact
|
* Add a new contact
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'addcontact' && $user->rights->propale->creer)
|
if ($action == 'addcontact' && $user->rights->propale->creer)
|
||||||
@@ -96,16 +96,16 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
|
|||||||
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
setEventMessage($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), 'errors');
|
setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bascule du statut d'un contact
|
// Toggle the status of a contact
|
||||||
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
if ($object->id > 0)
|
if ($object->id > 0)
|
||||||
@@ -114,7 +114,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Efface un contact
|
// Deletes a contact
|
||||||
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
else if ($action == 'deletecontact' && $user->rights->propale->creer)
|
||||||
{
|
{
|
||||||
$result = $object->delete_contact($lineid);
|
$result = $object->delete_contact($lineid);
|
||||||
|
|||||||
@@ -65,17 +65,17 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
|
|||||||
if (! $res > 0)
|
if (! $res > 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorFailedToLoadDiscount"), 'errors');
|
setEventMessages($langs->trans("ErrorFailedToLoadDiscount"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
if (! $error && price2num($_POST["amount_ttc_1"]+$_POST["amount_ttc_2"]) != $discount->amount_ttc)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), 'errors');
|
setEventMessages($langs->trans("TotalOfTwoDiscountMustEqualsOriginal"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error && $discount->fk_facture_line)
|
if (! $error && $discount->fk_facture_line)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($langs->trans("ErrorCantSplitAUsedDiscount"), 'errors');
|
setEventMessages($langs->trans("ErrorCantSplitAUsedDiscount"), null, 'errors');
|
||||||
}
|
}
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@@ -166,13 +166,13 @@ if ($action == 'setremise')
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
setEventMessage($soc->error, 'errors');
|
setEventMessages($soc->error, $soc->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), 'errors');
|
setEventMessages($langs->trans("ErrorFieldFormat",$langs->trans("NewGlobalDiscount")), null, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ if (GETPOST("action") == 'confirm_remove' && GETPOST("confirm")=='yes')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($discount->error, 'errors');
|
setEventMessages($discount->error, $discount->errors, 'errors');
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ if ($socid > 0)
|
|||||||
$object->fetch($socid);
|
$object->fetch($socid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Affichage onglets
|
* Display tabs
|
||||||
*/
|
*/
|
||||||
$head = societe_prepare_head($object);
|
$head = societe_prepare_head($object);
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ if ($socid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Liste remises fixes restant en cours (= liees a acune facture ni ligne de facture)
|
* Liste remises fixes restant en cours (= liees a aucune facture ni ligne de facture)
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
$sql = "SELECT rc.rowid, rc.amount_ht, rc.amount_tva, rc.amount_ttc, rc.tva_tx,";
|
||||||
$sql.= " rc.datec as dc, rc.description,";
|
$sql.= " rc.datec as dc, rc.description,";
|
||||||
|
|||||||
@@ -258,7 +258,7 @@ class ExtraFields
|
|||||||
|
|
||||||
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname))
|
||||||
{
|
{
|
||||||
if(is_array($param) and count($param) > 0)
|
if(is_array($param) && count($param) > 0)
|
||||||
{
|
{
|
||||||
$params = $this->db->escape(serialize($param));
|
$params = $this->db->escape(serialize($param));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
|
|||||||
$ref_prodserv = "";
|
$ref_prodserv = "";
|
||||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||||
{
|
{
|
||||||
if ($prodser->isservice())
|
if ($prodser->isService())
|
||||||
{
|
{
|
||||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1166,7 +1166,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
|||||||
$ref_prodserv = "";
|
$ref_prodserv = "";
|
||||||
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
if (! empty($conf->global->PRODUCT_ADD_TYPE_IN_DOCUMENTS)) // In standard mode, we do not show this
|
||||||
{
|
{
|
||||||
if ($prodser->isservice())
|
if ($prodser->isService())
|
||||||
{
|
{
|
||||||
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
$prefix_prodserv = $outputlangs->transnoentitiesnoconv("Service")." ";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ function product_prepare_head($object)
|
|||||||
$head[$h][2] = 'referers';
|
$head[$h][2] = 'referers';
|
||||||
$h++;
|
$h++;
|
||||||
|
|
||||||
if ($object->isproduct() || ($object->isservice() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
|
if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
|
||||||
{
|
{
|
||||||
if (! empty($conf->stock->enabled) && $user->rights->stock->lire)
|
if (! empty($conf->stock->enabled) && $user->rights->stock->lire)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
|
||||||
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||||
*
|
*
|
||||||
* 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
|
||||||
@@ -315,14 +316,39 @@ else {
|
|||||||
<?php
|
<?php
|
||||||
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
|
if ((! empty($conf->service->enabled) || ($object->element == 'contrat')) && $dateSelector && GETPOST('type') != '0') // We show date field if required
|
||||||
{
|
{
|
||||||
if(! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) $colspan = 10;
|
$colspan = 6;
|
||||||
else $colspan = 9;
|
|
||||||
if($this->situation_cycle_ref) $colspan++;
|
if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
|
||||||
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
$colspan++;
|
||||||
if (in_array($object->element,array('propal','askpricesupplier','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
|
}
|
||||||
|
if ($this->situation_cycle_ref) {
|
||||||
|
$colspan++;
|
||||||
|
}
|
||||||
|
// We add 1 if col total ttc
|
||||||
|
if (!empty($inputalsopricewithtax)) {
|
||||||
|
$colspan++;
|
||||||
|
}
|
||||||
if ($conf->global->PRODUCT_USE_UNITS) {
|
if ($conf->global->PRODUCT_USE_UNITS) {
|
||||||
$colspan++;
|
$colspan++;
|
||||||
}
|
}
|
||||||
|
if (count($object->lines)) {
|
||||||
|
//There will be an edit and a delete button
|
||||||
|
$colspan += 2;
|
||||||
|
|
||||||
|
// With this, there is a column move button ONLY if lines > 1
|
||||||
|
if (in_array($object->element, array(
|
||||||
|
'propal',
|
||||||
|
'askpricesupplier',
|
||||||
|
'facture',
|
||||||
|
'invoice',
|
||||||
|
'commande',
|
||||||
|
'order',
|
||||||
|
'order_supplier',
|
||||||
|
'invoice_supplier'
|
||||||
|
))) {
|
||||||
|
$colspan++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ if ($resql)
|
|||||||
if ($search_all)
|
if ($search_all)
|
||||||
{
|
{
|
||||||
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
|
||||||
print $langs->trans("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
|
print $langs->transnoentities("FilterOnInto", $search_all, join(', ',$fieldstosearchall));
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="liste" width="100%">';
|
print '<table class="liste" width="100%">';
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ CREATE TABLE llx_opensurvey_sondage (
|
|||||||
allow_comments tinyint NOT NULL DEFAULT 1,
|
allow_comments tinyint NOT NULL DEFAULT 1,
|
||||||
allow_spy tinyint NOT NULL DEFAULT 1,
|
allow_spy tinyint NOT NULL DEFAULT 1,
|
||||||
tms TIMESTAMP,
|
tms TIMESTAMP,
|
||||||
sujet TEXT, -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions
|
sujet TEXT -- Not filled if format = 'F'. Question are into table llx_opensurvey_formquestions
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|||||||
@@ -1038,7 +1038,7 @@ else
|
|||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
|
||||||
$type = $langs->trans('Product');
|
$type = $langs->trans('Product');
|
||||||
if ($object->isservice()) $type = $langs->trans('Service');
|
if ($object->isService()) $type = $langs->trans('Service');
|
||||||
//print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
|
//print load_fiche_titre($langs->trans('Modify').' '.$type.' : '.(is_object($object->oldcopy)?$object->oldcopy->ref:$object->ref), "");
|
||||||
|
|
||||||
// Main official, simple, and not duplicated code
|
// Main official, simple, and not duplicated code
|
||||||
@@ -1144,7 +1144,7 @@ else
|
|||||||
|
|
||||||
// Stock
|
// Stock
|
||||||
/*
|
/*
|
||||||
if ($object->isproduct() && ! empty($conf->stock->enabled))
|
if ($object->isProduct() && ! empty($conf->stock->enabled))
|
||||||
{
|
{
|
||||||
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td>';
|
print "<tr>".'<td>'.$langs->trans("StockLimit").'</td><td>';
|
||||||
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
|
print '<input name="seuil_stock_alerte" size="4" value="'.$object->seuil_stock_alerte.'">';
|
||||||
@@ -1169,7 +1169,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->isservice())
|
if ($object->isService())
|
||||||
{
|
{
|
||||||
// Duration
|
// Duration
|
||||||
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3"><input name="duration_value" size="3" maxlength="5" value="'.$object->duration_value.'">';
|
print '<tr><td>'.$langs->trans("Duration").'</td><td colspan="3"><input name="duration_value" size="3" maxlength="5" value="'.$object->duration_value.'">';
|
||||||
@@ -1435,7 +1435,7 @@ else
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->isservice())
|
if ($object->isService())
|
||||||
{
|
{
|
||||||
// Duration
|
// Duration
|
||||||
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
print '<tr><td class="titlefield">'.$langs->trans("Duration").'</td><td colspan="2">'.$object->duration_value.' ';
|
||||||
|
|||||||
@@ -3804,7 +3804,7 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return boolean True if it's a product
|
* @return boolean True if it's a product
|
||||||
*/
|
*/
|
||||||
function isproduct()
|
function isProduct()
|
||||||
{
|
{
|
||||||
return ($this->type == Product::TYPE_PRODUCT ? true : false);
|
return ($this->type == Product::TYPE_PRODUCT ? true : false);
|
||||||
}
|
}
|
||||||
@@ -3814,7 +3814,7 @@ class Product extends CommonObject
|
|||||||
*
|
*
|
||||||
* @return boolean True if it's a service
|
* @return boolean True if it's a service
|
||||||
*/
|
*/
|
||||||
function isservice()
|
function isService()
|
||||||
{
|
{
|
||||||
return ($this->type == Product::TYPE_SERVICE ? true : false);
|
return ($this->type == Product::TYPE_SERVICE ? true : false);
|
||||||
}
|
}
|
||||||
@@ -4088,4 +4088,19 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the rights used for this class
|
||||||
|
* @return stdClass
|
||||||
|
*/
|
||||||
|
public function getRights()
|
||||||
|
{
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
if ($this->isProduct()) {
|
||||||
|
return $user->rights->produit;
|
||||||
|
} else {
|
||||||
|
return $user->rights->service;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ if ($id > 0 || ! empty($ref))
|
|||||||
print "<tr>";
|
print "<tr>";
|
||||||
|
|
||||||
$nblignes=6;
|
$nblignes=6;
|
||||||
if ($object->isproduct() && ! empty($conf->stock->enabled)) $nblignes++;
|
if ($object->isProduct() && ! empty($conf->stock->enabled)) $nblignes++;
|
||||||
if ($object->isservice()) $nblignes++;
|
if ($object->isService()) $nblignes++;
|
||||||
|
|
||||||
// Reference
|
// Reference
|
||||||
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
|
print '<td width="25%">'.$langs->trans("Ref").'</td><td>';
|
||||||
|
|||||||
@@ -521,7 +521,7 @@ if ($id > 0 || $ref)
|
|||||||
{
|
{
|
||||||
// Suppliers list title
|
// Suppliers list title
|
||||||
print '<table class="noborder" width="100%">';
|
print '<table class="noborder" width="100%">';
|
||||||
if ($object->isproduct()) $nblignefour=4;
|
if ($object->isProduct()) $nblignefour=4;
|
||||||
else $nblignefour=4;
|
else $nblignefour=4;
|
||||||
|
|
||||||
$param="&id=".$object->id;
|
$param="&id=".$object->id;
|
||||||
|
|||||||
@@ -113,86 +113,115 @@ if (empty($reshook))
|
|||||||
$action='';
|
$action='';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($action == 'update_price') && !$cancel && ($user->rights->produit->creer || $user->rights->service->creer))
|
if (($action == 'update_price') && !$cancel && $object->getRights()->creer)
|
||||||
{
|
{
|
||||||
$newprice = '';
|
$error = 0;
|
||||||
$newprice_min = '';
|
$pricestoupdate = array();
|
||||||
$newpricebase = '';
|
|
||||||
$newvat = '';
|
|
||||||
|
|
||||||
|
$psq = GETPOST('psqflag');
|
||||||
|
$psq = empty($newpsq) ? 0 : $newpsq;
|
||||||
$maxpricesupplier = $object->min_recommended_price();
|
$maxpricesupplier = $object->min_recommended_price();
|
||||||
|
|
||||||
|
if (!empty($conf->dynamicprices->enabled)) {
|
||||||
$object->fk_price_expression = empty($eid) ? 0 : $eid; //0 discards expression
|
$object->fk_price_expression = empty($eid) ? 0 : $eid; //0 discards expression
|
||||||
|
|
||||||
// MultiPrix
|
|
||||||
if (!empty($conf->global->PRODUIT_MULTIPRICES)) {
|
|
||||||
|
|
||||||
//Shall we generate prices using price rules?
|
|
||||||
$object->price_autogen = GETPOST('usePriceRules') == 'on' ? true : false;
|
|
||||||
$object->update($object->id, $user);
|
|
||||||
|
|
||||||
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
|
|
||||||
if (isset($_POST ["price_".$i])) {
|
|
||||||
$level = $i;
|
|
||||||
$newprice = price2num($_POST ["price_".$i], 'MU');
|
|
||||||
$newprice_min = price2num($_POST ["price_min_".$i], 'MU');
|
|
||||||
$newpricebase = $_POST ["multiprices_base_type_".$i];
|
|
||||||
$newnpr = (preg_match('/\*/', $_POST ["tva_tx_".$i]) ? 1 : 0);
|
|
||||||
$newvat = str_replace('*', '', $_POST ["tva_tx_".$i]);
|
|
||||||
$newpsq = GETPOST('psqflag');
|
|
||||||
$newpsq = empty($newpsq) ? 0 : $newpsq;
|
|
||||||
break; // We found submited price
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$level = 0;
|
|
||||||
$newprice = price2num($_POST ["price"], 'MU');
|
|
||||||
$newprice_min = price2num($_POST ["price_min"], 'MU');
|
|
||||||
$newpricebase = $_POST ["price_base_type"];
|
|
||||||
$newnpr = (preg_match('/\*/', $_POST ["tva_tx"]) ? 1 : 0);
|
|
||||||
$newvat = str_replace('*', '', $_POST ["tva_tx"]);
|
|
||||||
$newpsq = GETPOST('psqflag');
|
|
||||||
$newpsq = empty($newpsq) ? 0 : $newpsq;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
|
|
||||||
setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors');
|
|
||||||
$error ++;
|
|
||||||
$action = 'edit_price';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($newprice < $newprice_min && !empty($object->fk_price_expression)) {
|
|
||||||
$newprice = $newprice_min; //Set price same as min, the user will not see the
|
|
||||||
}
|
|
||||||
|
|
||||||
$res = $object->updatePrice($newprice, $newpricebase, $user, $newvat, $newprice_min, $level, $newnpr, $newpsq);
|
|
||||||
|
|
||||||
if ($res) {
|
|
||||||
|
|
||||||
if ($object->fk_price_expression != 0) {
|
if ($object->fk_price_expression != 0) {
|
||||||
//Check the expression validity by parsing it
|
//Check the expression validity by parsing it
|
||||||
$priceparser = new PriceParser($db);
|
$priceparser = new PriceParser($db);
|
||||||
$price_result = $priceparser->parseProduct($object);
|
|
||||||
if ($price_result < 0) { //Expression is not valid
|
if ($priceparser->parseProduct($object) < 0) {
|
||||||
$error ++;
|
$error ++;
|
||||||
$action = 'edit_price';
|
|
||||||
setEventMessage($priceparser->translatedError(), 'errors');
|
setEventMessage($priceparser->translatedError(), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (empty($error) && !empty($conf->dynamicprices->enabled)) {
|
}
|
||||||
$ret = $object->setPriceExpression($object->fk_price_expression);
|
|
||||||
if ($ret < 0) {
|
// Multiprices
|
||||||
|
if (!$error && !empty($conf->global->PRODUIT_MULTIPRICES)) {
|
||||||
|
|
||||||
|
$newprice = GETPOST('price', 'array');
|
||||||
|
$newprice_min = GETPOST('price_min', 'array');
|
||||||
|
$newpricebase = GETPOST('multiprices_base_type', 'array');
|
||||||
|
$newvattx = GETPOST('tva_tx', 'array');
|
||||||
|
|
||||||
|
//Shall we generate prices using price rules?
|
||||||
|
$object->price_autogen = GETPOST('usePriceRules') == 'on' ? true : false;
|
||||||
|
|
||||||
|
for ($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++) {
|
||||||
|
|
||||||
|
if (!isset($newprice[$i])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$newnpr = (preg_match('/\*/', $newvattx[$i] ? 1 : 0));
|
||||||
|
$newvat = str_replace('*', '', $newvattx[$i]);
|
||||||
|
|
||||||
|
$pricestoupdate[$i] = array(
|
||||||
|
'price' => $newprice[$i],
|
||||||
|
'price_min' => $newprice_min[$i],
|
||||||
|
'price_base_type' => $newpricebase[$i],
|
||||||
|
'vat_tx' => $newvat,
|
||||||
|
'npr' => $newnpr
|
||||||
|
);
|
||||||
|
|
||||||
|
//If autogeneration is enabled, then we only set the first level
|
||||||
|
if ($object->price_autogen) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$pricestoupdate[0] = array(
|
||||||
|
'price' => $_POST ["price"],
|
||||||
|
'price_min' => $_POST ["price_min"],
|
||||||
|
'price_base_type' => $_POST ["price_base_type"],
|
||||||
|
'vat_tx' => str_replace('*', '', $_POST ["tva_tx"]),
|
||||||
|
'npr' => preg_match('/\*/', $_POST ["tva_tx"]) ? 1 : 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error && $object->update($object->id, $user) < 1) {
|
||||||
$error++;
|
$error++;
|
||||||
$action = 'edit_price';
|
|
||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
|
$action = 'edit_price';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$error) {
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
foreach ($pricestoupdate as $key => $val) {
|
||||||
|
|
||||||
|
$newprice = $val['price'];
|
||||||
|
|
||||||
|
if ($val['price'] < $val['price_min'] && !empty($object->fk_price_expression)) {
|
||||||
|
$newprice = $val['price_min']; //Set price same as min, the user will not see the
|
||||||
|
}
|
||||||
|
|
||||||
|
$newprice = price2num($newprice, 'MU');
|
||||||
|
$newprice_min = price2num($val['price_min'], 'MU');
|
||||||
|
|
||||||
|
if (!empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE) && $newprice_min < $maxpricesupplier) {
|
||||||
|
setEventMessage($langs->trans("MinimumPriceLimit", price($maxpricesupplier, 0, '', 1, - 1, - 1, 'auto')), 'errors');
|
||||||
|
$error ++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$res = $object->updatePrice($newprice, $val['price_base_type'], $user, $val['vat_tx'], $newprice_min, $key, $val['npr'], $psq);
|
||||||
|
|
||||||
|
if ($res < 0) {
|
||||||
|
$error ++;
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($error)) {
|
if (empty($error)) {
|
||||||
$action = '';
|
$action = '';
|
||||||
setEventMessage($langs->trans("RecordSaved"));
|
setEventMessage($langs->trans("RecordSaved"));
|
||||||
}
|
$db->commit();
|
||||||
} else {
|
} else {
|
||||||
$action = 'edit_price';
|
$action = 'edit_price';
|
||||||
setEventMessage($object->error, 'errors');
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -423,13 +452,13 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
// Selling price
|
// Selling price
|
||||||
print '<tr><td class="titlefield">' . $langs->trans("SellingPrice") . '</td>';
|
print '<tr><td class="titlefield">' . $langs->trans("SellingPrice") . '</td>';
|
||||||
print '<td colspan="2">';
|
print '<td colspan="2">';
|
||||||
if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') {
|
if ($object->multiprices_base_type[$soc->price_level] == 'TTC') {
|
||||||
print price($object->multiprices_ttc["$soc->price_level"]);
|
print price($object->multiprices_ttc[$soc->price_level]);
|
||||||
} else {
|
} else {
|
||||||
print price($object->multiprices["$soc->price_level"]);
|
print price($object->multiprices[$soc->price_level]);
|
||||||
}
|
}
|
||||||
if ($object->multiprices_base_type["$soc->price_level"]) {
|
if ($object->multiprices_base_type[$soc->price_level]) {
|
||||||
print ' ' . $langs->trans($object->multiprices_base_type["$soc->price_level"]);
|
print ' ' . $langs->trans($object->multiprices_base_type[$soc->price_level]);
|
||||||
} else {
|
} else {
|
||||||
print ' ' . $langs->trans($object->price_base_type);
|
print ' ' . $langs->trans($object->price_base_type);
|
||||||
}
|
}
|
||||||
@@ -437,18 +466,18 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
|
|
||||||
// Price min
|
// Price min
|
||||||
print '<tr><td>' . $langs->trans("MinPrice") . '</td><td colspan="2">';
|
print '<tr><td>' . $langs->trans("MinPrice") . '</td><td colspan="2">';
|
||||||
if ($object->multiprices_base_type["$soc->price_level"] == 'TTC')
|
if ($object->multiprices_base_type[$soc->price_level] == 'TTC')
|
||||||
{
|
{
|
||||||
print price($object->multiprices_min_ttc["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type["$soc->price_level"]);
|
print price($object->multiprices_min_ttc[$soc->price_level]) . ' ' . $langs->trans($object->multiprices_base_type[$soc->price_level]);
|
||||||
} else {
|
} else {
|
||||||
print price($object->multiprices_min["$soc->price_level"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$soc->price_level"])?'HT':$object->multiprices_base_type["$soc->price_level"]);
|
print price($object->multiprices_min[$soc->price_level]) . ' ' . $langs->trans(empty($object->multiprices_base_type[$soc->price_level])?'HT':$object->multiprices_base_type[$soc->price_level]);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // using this option is a bug. kept for backward compatibility
|
||||||
{
|
{
|
||||||
// TVA
|
// TVA
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx["$soc->price_level"], true) . '</td></tr>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td colspan="2">' . vatrate($object->multiprices_tva_tx[$soc->price_level], true) . '</td></tr>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -482,28 +511,28 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES))
|
|||||||
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
|
if (! empty($conf->global->$keyforlabel)) print ' - '.$langs->trans($conf->global->$keyforlabel);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
|
|
||||||
if ($object->multiprices_base_type ["$i"] == 'TTC') {
|
if ($object->multiprices_base_type [$i] == 'TTC') {
|
||||||
print '<td style="text-align: right">' . price($object->multiprices_ttc["$i"]);
|
print '<td style="text-align: right">' . price($object->multiprices_ttc[$i]);
|
||||||
} else {
|
} else {
|
||||||
print '<td style="text-align: right">' . price($object->multiprices["$i"]);
|
print '<td style="text-align: right">' . price($object->multiprices[$i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($object->multiprices_base_type["$i"]) {
|
if ($object->multiprices_base_type[$i]) {
|
||||||
print ' '.$langs->trans($object->multiprices_base_type ["$i"]).'</td>';;
|
print ' '.$langs->trans($object->multiprices_base_type [$i]).'</td>';
|
||||||
} else {
|
} else {
|
||||||
print ' '.$langs->trans($object->price_base_type).'</td>';;
|
print ' '.$langs->trans($object->price_base_type).'</td>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prix min
|
// Prix min
|
||||||
print '<td style="text-align: right">';
|
print '<td style="text-align: right">';
|
||||||
if (empty($object->multiprices_base_type["$i"])) $object->multiprices_base_type["$i"]="HT";
|
if (empty($object->multiprices_base_type[$i])) $object->multiprices_base_type[$i]="HT";
|
||||||
if ($object->multiprices_base_type["$i"] == 'TTC')
|
if ($object->multiprices_base_type[$i] == 'TTC')
|
||||||
{
|
{
|
||||||
print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]);
|
print price($object->multiprices_min_ttc[$i]) . ' ' . $langs->trans($object->multiprices_base_type[$i]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print price($object->multiprices_min["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]);
|
print price($object->multiprices_min[$i]) . ' ' . $langs->trans($object->multiprices_base_type[$i]);
|
||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
@@ -877,7 +906,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
<script>
|
<script>
|
||||||
|
|
||||||
var showHidePriceRules = function () {
|
var showHidePriceRules = function () {
|
||||||
var otherPrices = $('div.fiche form:not(:first)');
|
var otherPrices = $('div.fiche form table:not(:first), div.fiche form table:first tr:not(:first)');
|
||||||
var minPrice1 = $('div.fiche form:first tr:eq(1)');
|
var minPrice1 = $('div.fiche form:first tr:eq(1)');
|
||||||
|
|
||||||
if (jQuery('input#usePriceRules').prop('checked')) {
|
if (jQuery('input#usePriceRules').prop('checked')) {
|
||||||
@@ -897,10 +926,11 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
||||||
|
|
||||||
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
for($i = 1; $i <= $conf->global->PRODUIT_MULTIPRICES_LIMIT; $i ++)
|
||||||
{
|
{
|
||||||
|
|
||||||
print '<form action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="POST">';
|
|
||||||
if ($i > 1) print '<br>';
|
if ($i > 1) print '<br>';
|
||||||
elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
|
elseif (! empty($conf->global->PRODUIT_MULTIPRICES) && ! empty($conf->global->PRODUIT_MULTIPRICES_ALLOW_AUTOCALC_PRICELEVEL)) {
|
||||||
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
|
print $langs->trans('UseMultipriceRules'). ' <input type="checkbox" id="usePriceRules" name="usePriceRules" '.($object->price_autogen ? 'checked' : '').'><br><br>';
|
||||||
@@ -910,7 +940,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
print '<input type="hidden" name="id" value="' . $object->id . '">';
|
||||||
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL))
|
if (empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL))
|
||||||
{
|
{
|
||||||
print '<input type="hidden" name="tva_tx_' . $i . '" value="' . $object->tva_tx . '">';
|
print '<input type="hidden" name="tva_tx[' . $i . ']" value="' . $object->tva_tx . '">';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
@@ -919,7 +949,7 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // This option is kept for backward compatibility but has no sense
|
if (! empty($conf->global->PRODUIT_MULTIPRICES_USE_VAT_PER_LEVEL)) // This option is kept for backward compatibility but has no sense
|
||||||
{
|
{
|
||||||
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
print '<tr><td>' . $langs->trans("VATRate") . '</td><td>';
|
||||||
print $form->load_tva("tva_tx_" . $i, $object->multiprices_tva_tx["$i"], $mysoc, '', $object->id);
|
print $form->load_tva("tva_tx[" . $i.']', $object->multiprices_tva_tx[$i], $mysoc, '', $object->id);
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -928,22 +958,22 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
$text = $langs->trans('SellingPrice') . ' ' . $i;
|
$text = $langs->trans('SellingPrice') . ' ' . $i;
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
print '</td><td>';
|
print '</td><td>';
|
||||||
if ($object->multiprices_base_type ["$i"] == 'TTC') {
|
if ($object->multiprices_base_type [$i] == 'TTC') {
|
||||||
print '<input name="price_' . $i . '" size="10" value="' . price($object->multiprices_ttc ["$i"]) . '">';
|
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices_ttc [$i]) . '">';
|
||||||
} else {
|
} else {
|
||||||
print '<input name="price_' . $i . '" size="10" value="' . price($object->multiprices ["$i"]) . '">';
|
print '<input name="price[' . $i . ']" size="10" value="' . price($object->multiprices [$i]) . '">';
|
||||||
}
|
}
|
||||||
print $form->selectPriceBaseType($object->multiprices_base_type ["$i"], "multiprices_base_type_" . $i);
|
print ' '.$form->selectPriceBaseType($object->multiprices_base_type [$i], "multiprices_base_type[" . $i."]");
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Min price
|
// Min price
|
||||||
print '<tr><td>';
|
print '<tr><td>';
|
||||||
$text = $langs->trans('MinPrice') . ' ' . $i;
|
$text = $langs->trans('MinPrice') . ' ' . $i;
|
||||||
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
print $form->textwithpicto($text, $langs->trans("PrecisionUnitIsLimitedToXDecimals", $conf->global->MAIN_MAX_DECIMALS_UNIT), 1, 1);
|
||||||
if ($object->multiprices_base_type ["$i"] == 'TTC') {
|
if ($object->multiprices_base_type [$i] == 'TTC') {
|
||||||
print '<td><input name="price_min_' . $i . '" size="10" value="' . price($object->multiprices_min_ttc ["$i"]) . '">';
|
print '<td><input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min_ttc [$i]) . '">';
|
||||||
} else {
|
} else {
|
||||||
print '<td><input name="price_min_' . $i . '" size="10" value="' . price($object->multiprices_min ["$i"]) . '">';
|
print '<td><input name="price_min[' . $i . ']" size="10" value="' . price($object->multiprices_min [$i]) . '">';
|
||||||
}
|
}
|
||||||
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
if ( !empty($conf->global->PRODUCT_MINIMUM_RECOMMENDED_PRICE))
|
||||||
{
|
{
|
||||||
@@ -951,15 +981,16 @@ if ($action == 'edit_price' && ($user->rights->produit->creer || $user->rights->
|
|||||||
}
|
}
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
|
||||||
print ' ';
|
|
||||||
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></td></tr>';
|
|
||||||
|
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print '<br><div style="text-align: center">';
|
||||||
|
print '<input type="submit" class="button" value="' . $langs->trans("Save") . '">';
|
||||||
|
print ' ';
|
||||||
|
print '<input type="submit" class="button" name="cancel" value="' . $langs->trans("Cancel") . '"></div>';
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
dol_fiche_end();
|
dol_fiche_end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,7 +583,7 @@ if (GETPOST("source") == 'contractline' && $valid)
|
|||||||
$duration='';
|
$duration='';
|
||||||
if ($contractline->fk_product)
|
if ($contractline->fk_product)
|
||||||
{
|
{
|
||||||
if ($product->isservice() && $product->duration_value > 0)
|
if ($product->isService() && $product->duration_value > 0)
|
||||||
{
|
{
|
||||||
$label=$langs->trans("Duration");
|
$label=$langs->trans("Duration");
|
||||||
|
|
||||||
|
|||||||
@@ -720,7 +720,7 @@ if (GETPOST("source") == 'contractline' && $valid)
|
|||||||
$duration='';
|
$duration='';
|
||||||
if ($contractline->fk_product)
|
if ($contractline->fk_product)
|
||||||
{
|
{
|
||||||
if ($product->isservice() && $product->duration_value > 0)
|
if ($product->isService() && $product->duration_value > 0)
|
||||||
{
|
{
|
||||||
$label=$langs->trans("Duration");
|
$label=$langs->trans("Duration");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user