Merge remote-tracking branch 'origin/3.7' into develop
Conflicts: htdocs/compta/facture.php htdocs/fourn/class/fournisseur.product.class.php
This commit is contained in:
commit
ef14e4e7ed
@ -302,6 +302,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
// Check if we need to also synchronize user information
|
// Check if we need to also synchronize user information
|
||||||
$nosyncuser=0;
|
$nosyncuser=0;
|
||||||
@ -471,6 +472,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
// Check parameters
|
// Check parameters
|
||||||
if (empty($morphy) || $morphy == "-1") {
|
if (empty($morphy) || $morphy == "-1") {
|
||||||
|
|||||||
@ -89,6 +89,7 @@ if ($action == 'add' && $user->rights->adherent->configurer)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($adht->libelle)
|
if ($adht->libelle)
|
||||||
{
|
{
|
||||||
@ -126,6 +127,7 @@ if ($action == 'update' && $user->rights->adherent->configurer)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$adht);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$adht->update($user);
|
$adht->update($user);
|
||||||
|
|
||||||
|
|||||||
@ -127,6 +127,7 @@ if ($action == 'add' && $user->rights->categorie->creer)
|
|||||||
if ($parent != "-1") $object->fk_parent = $parent;
|
if ($parent != "-1") $object->fk_parent = $parent;
|
||||||
|
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! $object->label)
|
if (! $object->label)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -90,6 +90,7 @@ if ($action == 'update' && $user->rights->categorie->creer)
|
|||||||
if (empty($categorie->error))
|
if (empty($categorie->error))
|
||||||
{
|
{
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$categorie);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$categorie);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($categorie->update($user) > 0)
|
if ($categorie->update($user) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -275,6 +275,7 @@ if ($action == 'add')
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -430,6 +431,7 @@ if ($action == 'update')
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1110,10 +1110,10 @@ if (empty($reshook))
|
|||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
|
{
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('propaldao'));
|
$hookmanager->initHooks(array('propaldao'));
|
||||||
|
|||||||
@ -93,6 +93,8 @@ if ($id > 0 || ! empty($ref)) {
|
|||||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||||
|
|
||||||
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote = $user->rights->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
$permissionedit = $user->rights->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -104,7 +106,11 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
|||||||
|
|
||||||
if (empty($reshook))
|
if (empty($reshook))
|
||||||
{
|
{
|
||||||
include DOL_DOCUMENT_ROOT . '/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if ($cancel) $action='';
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->commande->creer)
|
||||||
@ -281,8 +287,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -375,10 +380,10 @@ if (empty($reshook))
|
|||||||
} else {
|
} else {
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
|
{
|
||||||
$object_id = $object->create($user);
|
$object_id = $object->create($user);
|
||||||
|
|
||||||
// If some invoice's lines already known
|
// If some invoice's lines already known
|
||||||
@ -1046,56 +1051,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if ($action == 'builddoc') // In get or post
|
||||||
* Ordonnancement des lignes
|
|
||||||
*/
|
|
||||||
|
|
||||||
else if ($action == 'up' && $user->rights->commande->creer) {
|
|
||||||
$object->line_up(GETPOST('rowid'));
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
|
||||||
$newlang = $_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
if (! empty($newlang)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($action == 'down' && $user->rights->commande->creer) {
|
|
||||||
$object->line_down(GETPOST('rowid'));
|
|
||||||
|
|
||||||
// Define output language
|
|
||||||
$outputlangs = $langs;
|
|
||||||
$newlang = '';
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
|
|
||||||
$newlang = $_REQUEST['lang_id'];
|
|
||||||
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
|
|
||||||
$newlang = $object->thirdparty->default_lang;
|
|
||||||
if (! empty($newlang)) {
|
|
||||||
$outputlangs = new Translate("", $conf);
|
|
||||||
$outputlangs->setDefaultLang($newlang);
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
|
|
||||||
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '#' . GETPOST('rowid'));
|
|
||||||
exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ($action == 'builddoc') // In get or post
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Generate order document
|
* Generate order document
|
||||||
@ -1126,8 +1082,10 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove file in doc form
|
// Remove file in doc form
|
||||||
else if ($action == 'remove_file') {
|
if ($action == 'remove_file')
|
||||||
if ($object->id > 0) {
|
{
|
||||||
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
|
||||||
|
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
@ -1142,14 +1100,15 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ($action == 'update_extras') {
|
if ($action == 'update_extras')
|
||||||
|
{
|
||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
|
{
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
// FIXME le hook fait double emploi avec le trigger !!
|
||||||
$hookmanager->initHooks(array('orderdao'));
|
$hookmanager->initHooks(array('orderdao'));
|
||||||
|
|||||||
@ -1788,8 +1788,7 @@ if (empty($reshook))
|
|||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Actions on extra fields (by external module or standard code)
|
||||||
|
|||||||
@ -200,6 +200,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! GETPOST("lastname"))
|
if (! GETPOST("lastname"))
|
||||||
{
|
{
|
||||||
@ -303,6 +304,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result = $object->update($contactid, $user);
|
$result = $object->update($contactid, $user);
|
||||||
|
|
||||||
|
|||||||
@ -359,6 +359,7 @@ if ($action == 'add' && $user->rights->contrat->creer)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -725,19 +726,20 @@ else if ($action == 'confirm_move' && $confirm == 'yes' && $user->rights->contra
|
|||||||
// Fill array 'array_options' with data from update form
|
// Fill array 'array_options' with data from update form
|
||||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels, $object, GETPOST('attribute'));
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
$error ++;
|
|
||||||
|
|
||||||
if (! $error) {
|
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$result = $object->insertExtraFields();
|
$result = $object->insertExtraFields();
|
||||||
if ($result < 0) {
|
if ($result < 0)
|
||||||
|
{
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
} else if ($reshook < 0)
|
}
|
||||||
$error ++;
|
else if ($reshook < 0) $error++;
|
||||||
|
|
||||||
if ($error) {
|
if ($error)
|
||||||
|
{
|
||||||
$action = 'edit_extras';
|
$action = 'edit_extras';
|
||||||
setEventMessage($object->error,'errors');
|
setEventMessage($object->error,'errors');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// $action must be defined
|
// $action must be defined
|
||||||
// $permission must be defined to permission to edit object
|
// $permissionnote must be defined to permission to edit object
|
||||||
// $object must be defined (object is loaded in this file with fetch)
|
// $object must be defined (object is loaded in this file with fetch)
|
||||||
// $id must be defined (object is loaded in this file with fetch)
|
// $id must be defined (object is loaded in this file with fetch)
|
||||||
|
|
||||||
|
|||||||
@ -2568,9 +2568,10 @@ abstract class CommonObject
|
|||||||
* @param string $buyer Object of buyer third party
|
* @param string $buyer Object of buyer third party
|
||||||
* @param string $selected Object line selected
|
* @param string $selected Object line selected
|
||||||
* @param int $dateSelector 1=Show also date range input fields
|
* @param int $dateSelector 1=Show also date range input fields
|
||||||
|
* @param int $permtoedit Permission to edit line
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0)
|
function printObjectLines($action, $seller, $buyer, $selected=0, $dateSelector=0, $permtoedit=0)
|
||||||
{
|
{
|
||||||
global $conf, $hookmanager, $inputalsopricewithtax, $usermargins, $langs, $user;
|
global $conf, $hookmanager, $inputalsopricewithtax, $usermargins, $langs, $user;
|
||||||
|
|
||||||
@ -2659,7 +2660,7 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline);
|
$this->printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected,$extrafieldsline,$permtoedit);
|
||||||
}
|
}
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -2680,9 +2681,10 @@ abstract class CommonObject
|
|||||||
* @param string $buyer Object of buyer third party
|
* @param string $buyer Object of buyer third party
|
||||||
* @param string $selected Object line selected
|
* @param string $selected Object line selected
|
||||||
* @param object $extrafieldsline Object of extrafield line attribute
|
* @param object $extrafieldsline Object of extrafield line attribute
|
||||||
|
* @param int $permtoedit Permission to edit
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0)
|
function printObjectLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected=0,$extrafieldsline=0,$permtoedit=0)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$user,$object,$hookmanager;
|
global $conf,$langs,$user,$object,$hookmanager;
|
||||||
global $form,$bc,$bcdd;
|
global $form,$bc,$bcdd;
|
||||||
@ -3502,7 +3504,8 @@ abstract class CommonObject
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add/Update all extra fields values for the current object.
|
* Add/Update all extra fields values for the current object.
|
||||||
* All data to describe values to insert are stored into $this->array_options=array('keyextrafield'=>'valueextrafieldtoadd')
|
* Data to describe values to insert/update are stored into $this->array_options=array('options_codeforfield1'=>'valueforfield1', 'options_codeforfield2'=>'valueforfield2', ...)
|
||||||
|
* This function delte record with all extrafields and insert them again from the array $this->array_options.
|
||||||
*
|
*
|
||||||
* @return int -1=error, O=did nothing, 1=OK
|
* @return int -1=error, O=did nothing, 1=OK
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1264,7 +1264,7 @@ class ExtraFields
|
|||||||
* @param array $extralabels $array of extrafields
|
* @param array $extralabels $array of extrafields
|
||||||
* @param object $object Object
|
* @param object $object Object
|
||||||
* @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
|
* @param string $onlykey Only following key is filled. When we make update of only one extrafield ($action = 'update_extras'), calling page must must set this to avoid to have other extrafields being reset.
|
||||||
* @return int 1 if array_options set / 0 if no value
|
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
|
||||||
*/
|
*/
|
||||||
function setOptionalsFromPost($extralabels,&$object,$onlykey='')
|
function setOptionalsFromPost($extralabels,&$object,$onlykey='')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -25,6 +25,8 @@
|
|||||||
* $langs
|
* $langs
|
||||||
* $dateSelector
|
* $dateSelector
|
||||||
* $forceall (0 by default, 1 for supplier invoices/orders)
|
* $forceall (0 by default, 1 for supplier invoices/orders)
|
||||||
|
* $element (used to test $user->rights->$element->creer)
|
||||||
|
* $permtoedit (used to replace test $user->rights->$element->creer)
|
||||||
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
|
* $senderissupplier (0 by default, 1 for supplier invoices/orders)
|
||||||
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
* $inputalsopricewithtax (0 by default, 1 to also show column with unit price including tax)
|
||||||
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
|
* $usemargins (0 to disable all margins columns, 1 to show according to margin setup)
|
||||||
@ -167,7 +169,7 @@ if (empty($usemargins)) $usemargins=0;
|
|||||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
|
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo price($line->total_ht); ?></td>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($this->statut == 0 && $user->rights->$element->creer) { ?>
|
<?php if ($this->statut == 0 && ($user->rights->$element->creer || $permtoedit)) { ?>
|
||||||
<td align="center"><?php $coldisplay++; ?>
|
<td align="center"><?php $coldisplay++; ?>
|
||||||
<?php if (($line->info_bits & 2) == 2) { ?>
|
<?php if (($line->info_bits & 2) == 2) { ?>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
|
|||||||
@ -214,13 +214,13 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$sql.= " l.qty,";
|
$sql.= " l.qty,";
|
||||||
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
|
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
|
||||||
$sql.= " l.localtax1_tx, l. localtax2_tx, l.total_localtax1, l.total_localtax2,";
|
$sql.= " l.localtax1_tx, l. localtax2_tx, l.total_localtax1, l.total_localtax2,";
|
||||||
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
|
$sql.= " l.total_ht, l.total_tva, l.total_ttc, l.special_code, l.fk_parent_line, l.rang,";
|
||||||
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,";
|
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc,";
|
||||||
$sql.= " l.date_start, l.date_end";
|
$sql.= " l.date_start, l.date_end";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
$sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseurdet as l";
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
|
||||||
$sql.= " WHERE l.fk_commande = ".$this->id;
|
$sql.= " WHERE l.fk_commande = ".$this->id;
|
||||||
$sql.= " ORDER BY l.rowid";
|
$sql.= " ORDER BY l.rang, l.rowid";
|
||||||
//print $sql;
|
//print $sql;
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch get lines", LOG_DEBUG);
|
||||||
@ -267,6 +267,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$line->date_start = $this->db->jdate($objp->date_start);
|
$line->date_start = $this->db->jdate($objp->date_start);
|
||||||
$line->date_end = $this->db->jdate($objp->date_end);
|
$line->date_end = $this->db->jdate($objp->date_end);
|
||||||
|
|
||||||
|
$this->special_line = $objp->special_line;
|
||||||
|
$this->fk_parent_line = $objp->fk_parent_line;
|
||||||
|
|
||||||
|
$this->rang = $objp->rang;
|
||||||
|
|
||||||
$this->lines[$i] = $line;
|
$this->lines[$i] = $line;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
@ -1117,9 +1122,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param bool $notrigger Disable triggers
|
* @param bool $notrigger Disable triggers
|
||||||
* @param int $date_start Date start of service
|
* @param int $date_start Date start of service
|
||||||
* @param int $date_end Date end of service
|
* @param int $date_end Date end of service
|
||||||
|
* @param array $array_option extrafields array
|
||||||
* @return int <=0 if KO, >0 if OK
|
* @return int <=0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null)
|
function addline($desc, $pu_ht, $qty, $txtva, $txlocaltax1=0.0, $txlocaltax2=0.0, $fk_product=0, $fk_prod_fourn_price=0, $fourn_ref='', $remise_percent=0.0, $price_base_type='HT', $pu_ttc=0.0, $type=0, $info_bits=0, $notrigger=false, $date_start=null, $date_end=null, $array_option=0)
|
||||||
{
|
{
|
||||||
global $langs,$mysoc;
|
global $langs,$mysoc;
|
||||||
|
|
||||||
@ -1773,9 +1779,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param int $notrigger Disable triggers
|
* @param int $notrigger Disable triggers
|
||||||
* @param timestamp $date_start Date start of service
|
* @param timestamp $date_start Date start of service
|
||||||
* @param timestamp $date_end Date end of service
|
* @param timestamp $date_end Date end of service
|
||||||
|
* @param array $array_option extrafields array
|
||||||
* @return int < 0 if error, > 0 if ok
|
* @return int < 0 if error, > 0 if ok
|
||||||
*/
|
*/
|
||||||
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='')
|
function updateline($rowid, $desc, $pu, $qty, $remise_percent, $txtva, $txlocaltax1=0, $txlocaltax2=0, $price_base_type='HT', $info_bits=0, $type=0, $notrigger=false, $date_start='', $date_end='', $array_option=0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
|
dol_syslog(get_class($this)."::updateline $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $type");
|
||||||
@ -2167,6 +2174,14 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
*/
|
*/
|
||||||
class CommandeFournisseurLigne extends CommonOrderLine
|
class CommandeFournisseurLigne extends CommonOrderLine
|
||||||
{
|
{
|
||||||
|
var $db;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
public $element='commande_fournisseurdet';
|
||||||
|
public $table_element='commande_fournisseurdet';
|
||||||
|
|
||||||
|
var $oldline;
|
||||||
|
|
||||||
// From llx_commandedet
|
// From llx_commandedet
|
||||||
var $qty;
|
var $qty;
|
||||||
var $tva_tx;
|
var $tva_tx;
|
||||||
|
|||||||
@ -450,7 +450,7 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$result=$this->fetch_lines();
|
$result=$this->fetch_lines();
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,11 +482,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
|
$sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx, f.tva';
|
||||||
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
$sql.= ', f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 ';
|
||||||
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits';
|
$sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line';
|
||||||
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
|
$sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc';
|
||||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f';
|
||||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid';
|
||||||
$sql.= ' WHERE fk_facture_fourn='.$this->id;
|
$sql.= ' WHERE fk_facture_fourn='.$this->id;
|
||||||
|
$sql.= ' ORDER BY f.rang, f.rowid';
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
dol_syslog(get_class($this)."::fetch_lines", LOG_DEBUG);
|
||||||
$resql_rows = $this->db->query($sql);
|
$resql_rows = $this->db->query($sql);
|
||||||
@ -500,7 +501,9 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
$obj = $this->db->fetch_object($resql_rows);
|
$obj = $this->db->fetch_object($resql_rows);
|
||||||
|
|
||||||
$this->lines[$i] = new stdClass();
|
$this->lines[$i] = new FactureFournisseurLigne($this->db);
|
||||||
|
|
||||||
|
$this->lines[$i]->id = $obj->rowid;
|
||||||
$this->lines[$i]->rowid = $obj->rowid;
|
$this->lines[$i]->rowid = $obj->rowid;
|
||||||
$this->lines[$i]->description = $obj->description;
|
$this->lines[$i]->description = $obj->description;
|
||||||
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
|
$this->lines[$i]->product_ref = $obj->product_ref; // Internal reference
|
||||||
@ -524,6 +527,9 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$this->lines[$i]->fk_product = $obj->fk_product;
|
$this->lines[$i]->fk_product = $obj->fk_product;
|
||||||
$this->lines[$i]->product_type = $obj->product_type;
|
$this->lines[$i]->product_type = $obj->product_type;
|
||||||
$this->lines[$i]->info_bits = $obj->info_bits;
|
$this->lines[$i]->info_bits = $obj->info_bits;
|
||||||
|
$this->lines[$i]->fk_parent_line = $obj->fk_parent_line;
|
||||||
|
$this->lines[$i]->special_code = $obj->special_code;
|
||||||
|
$this->lines[$i]->rang = $obj->rang;
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -1109,11 +1115,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
* @param int $type Type of line (0=product, 1=service)
|
* @param int $type Type of line (0=product, 1=service)
|
||||||
* @param int $rang Position of line
|
* @param int $rang Position of line
|
||||||
* @param int $notrigger Disable triggers
|
* @param int $notrigger Disable triggers
|
||||||
|
* @param array $array_option extrafields array
|
||||||
* @return int >0 if OK, <0 if KO
|
* @return int >0 if OK, <0 if KO
|
||||||
*
|
*
|
||||||
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
* FIXME Add field ref (that should be named ref_supplier) and label into update. For example can be filled when product line created from order.
|
||||||
*/
|
*/
|
||||||
function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false)
|
function addline($desc, $pu, $txtva, $txlocaltax1, $txlocaltax2, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0, $rang=-1, $notrigger=false, $array_option=0)
|
||||||
{
|
{
|
||||||
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
|
dol_syslog(get_class($this)."::addline $desc,$pu,$qty,$txtva,$fk_product,$remise_percent,$date_start,$date_end,$ventil,$info_bits,$price_base_type,$type", LOG_DEBUG);
|
||||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/price.lib.php';
|
||||||
@ -1202,9 +1209,12 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
* @param int $type Type of line (0=product, 1=service)
|
* @param int $type Type of line (0=product, 1=service)
|
||||||
* @param double $remise_percent Pourcentage de remise de la ligne
|
* @param double $remise_percent Pourcentage de remise de la ligne
|
||||||
* @param int $notrigger Disable triggers
|
* @param int $notrigger Disable triggers
|
||||||
|
* @param timestamp $date_start Date start of service
|
||||||
|
* @param timestamp $date_end Date end of service
|
||||||
|
* @param array $array_option extrafields array
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, >0 if OK
|
||||||
*/
|
*/
|
||||||
function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false)
|
function updateline($id, $desc, $pu, $vatrate, $txlocaltax1=0, $txlocaltax2=0, $qty=1, $idproduct=0, $price_base_type='HT', $info_bits=0, $type=0, $remise_percent=0, $notrigger=false, $date_start='', $date_end='', $array_option=0)
|
||||||
{
|
{
|
||||||
global $mysoc;
|
global $mysoc;
|
||||||
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
|
dol_syslog(get_class($this)."::updateline $id,$desc,$pu,$vatrate,$qty,$idproduct,$price_base_type,$info_bits,$type,$remise_percent", LOG_DEBUG);
|
||||||
@ -1820,8 +1830,25 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
/**
|
/**
|
||||||
* Class to manage line invoices
|
* Class to manage line invoices
|
||||||
*/
|
*/
|
||||||
class FactureFournisseurLigne extends CommonInvoiceLine
|
class FactureFournisseurLigne extends CommonInvoice
|
||||||
{
|
{
|
||||||
|
var $db;
|
||||||
|
var $error;
|
||||||
|
|
||||||
|
public $element='facture_fourn_det';
|
||||||
|
public $table_element='facture_fourn_det';
|
||||||
|
|
||||||
|
var $oldline;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db= $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -487,12 +487,18 @@ class ProductFournisseur extends Product
|
|||||||
*
|
*
|
||||||
* @param int $prodid Product id
|
* @param int $prodid Product id
|
||||||
* @param int $qty Minimum quantity
|
* @param int $qty Minimum quantity
|
||||||
* @return int <0 if KO, >0 if OK
|
* @return int <0 if KO, 0=Not found of no product id provided, >0 if OK
|
||||||
*/
|
*/
|
||||||
function find_min_price_product_fournisseur($prodid, $qty=0)
|
function find_min_price_product_fournisseur($prodid, $qty=0)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
|
if (empty($prodid))
|
||||||
|
{
|
||||||
|
dol_syslog("Warning function find_min_price_product_fournisseur were called with prodid empty. May be a bug.", LOG_WARNING);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$this->product_fourn_price_id = '';
|
$this->product_fourn_price_id = '';
|
||||||
$this->product_fourn_id = '';
|
$this->product_fourn_id = '';
|
||||||
$this->fourn_ref = '';
|
$this->fourn_ref = '';
|
||||||
|
|||||||
@ -109,19 +109,24 @@ else if (! empty($socid) && $socid > 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$permissionnote=$user->rights->fournisseur->commande->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote=$user->rights->fournisseur->commande->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
$permissiontoedit=$user->rights->fournisseur->commande->creer; // Used by the include of actions_lineupdown.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action='';
|
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($cancel) $action='';
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
if ($action == 'setref_supplier' && $user->rights->fournisseur->commande->creer)
|
||||||
{
|
{
|
||||||
@ -221,6 +226,18 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
$qty = GETPOST('qty'.$predef);
|
$qty = GETPOST('qty'.$predef);
|
||||||
$remise_percent=GETPOST('remise_percent'.$predef);
|
$remise_percent=GETPOST('remise_percent'.$predef);
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||||
|
// Unset extrafield
|
||||||
|
if (is_array($extralabelsline)) {
|
||||||
|
// Get extra fields
|
||||||
|
foreach ($extralabelsline as $key => $value) {
|
||||||
|
unset($_POST["options_" . $key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
|
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
@ -295,7 +312,8 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end
|
$date_end,
|
||||||
|
$array_options
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($idprod == -2 || $idprod == 0)
|
if ($idprod == -2 || $idprod == 0)
|
||||||
@ -333,14 +351,14 @@ if ($action == 'addline' && $user->rights->fournisseur->commande->creer)
|
|||||||
{
|
{
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
$ht = price2num($_POST['price_ht']);
|
$ht = price2num($_POST['price_ht']);
|
||||||
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type,'','', $date_start, $date_end);
|
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, 0, $type,'','', $date_start, $date_end, $array_options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ttc = price2num($_POST['price_ttc']);
|
$ttc = price2num($_POST['price_ttc']);
|
||||||
$ht = $ttc / (1 + ($tauxtva / 100));
|
$ht = $ttc / (1 + ($tauxtva / 100));
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end);
|
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,6 +439,17 @@ if ($action == 'updateline' && $user->rights->fournisseur->commande->creer && !
|
|||||||
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$mysoc,$object->thirdparty);
|
$localtax1_tx=get_localtax($_POST['tva_tx'],1,$mysoc,$object->thirdparty);
|
||||||
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$mysoc,$object->thirdparty);
|
$localtax2_tx=get_localtax($_POST['tva_tx'],2,$mysoc,$object->thirdparty);
|
||||||
|
|
||||||
|
// Extrafields Lines
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
|
// Unset extrafield POST Data
|
||||||
|
if (is_array($extralabelsline)) {
|
||||||
|
foreach ($extralabelsline as $key => $value) {
|
||||||
|
unset($_POST["options_" . $key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$result = $object->updateline(
|
$result = $object->updateline(
|
||||||
$_POST['elrowid'],
|
$_POST['elrowid'],
|
||||||
$_POST['eldesc'],
|
$_POST['eldesc'],
|
||||||
@ -435,7 +464,8 @@ if ($action == 'updateline' && $user->rights->fournisseur->commande->creer && !
|
|||||||
isset($_POST["type"])?$_POST["type"]:$line->product_type,
|
isset($_POST["type"])?$_POST["type"]:$line->product_type,
|
||||||
false,
|
false,
|
||||||
$date_start,
|
$date_start,
|
||||||
$date_end
|
$date_end,
|
||||||
|
$array_option
|
||||||
);
|
);
|
||||||
unset($_POST['qty']);
|
unset($_POST['qty']);
|
||||||
unset($_POST['type']);
|
unset($_POST['type']);
|
||||||
@ -716,40 +746,6 @@ if ($action == 'confirm_cancel' && $confirm == 'yes' && $user->rights->fournisse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Line ordering
|
|
||||||
if ($action == 'up' && $user->rights->fournisseur->commande->creer)
|
|
||||||
{
|
|
||||||
$object->line_up($_GET['rowid']);
|
|
||||||
|
|
||||||
$outputlangs = $langs;
|
|
||||||
if (! empty($_REQUEST['lang_id']))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
if ($action == 'down' && $user->rights->fournisseur->commande->creer)
|
|
||||||
{
|
|
||||||
$object->line_down($_GET['rowid']);
|
|
||||||
|
|
||||||
$outputlangs = $langs;
|
|
||||||
if (! empty($_REQUEST['lang_id']))
|
|
||||||
{
|
|
||||||
$outputlangs = new Translate("",$conf);
|
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
|
||||||
}
|
|
||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
|
||||||
$object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
|
||||||
}
|
|
||||||
header('Location: '.$_SERVER["PHP_SELF"].'?id='.$id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#'.$_GET['rowid']));
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post
|
if ($action == 'builddoc' && $user->rights->fournisseur->commande->creer) // En get ou en post
|
||||||
{
|
{
|
||||||
// Build document
|
// Build document
|
||||||
@ -849,19 +845,26 @@ if ($action == 'add' && $user->rights->fournisseur->commande->creer)
|
|||||||
$object->date_livraison = $datelivraison;
|
$object->date_livraison = $datelivraison;
|
||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id < 0)
|
if ($id < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
|
setEventMessage($langs->trans($object->error), 'errors');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
setEventMessage($langs->trans($object->error), 'errors');
|
|
||||||
$action='create';
|
$action='create';
|
||||||
$_GET['socid']=$_POST['socid'];
|
$_GET['socid']=$_POST['socid'];
|
||||||
}
|
}
|
||||||
@ -1202,6 +1205,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fourniss
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1717,7 +1721,7 @@ elseif (! empty($object->id))
|
|||||||
// Show object lines
|
// Show object lines
|
||||||
$inputalsopricewithtax=1;
|
$inputalsopricewithtax=1;
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1);
|
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1, $user->rights->fournisseur->commande->creer);
|
||||||
|
|
||||||
$num = count($object->lines);
|
$num = count($object->lines);
|
||||||
|
|
||||||
|
|||||||
@ -86,19 +86,24 @@ if ($id > 0 || ! empty($ref))
|
|||||||
}
|
}
|
||||||
|
|
||||||
$permissionnote=$user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php
|
$permissionnote=$user->rights->fournisseur->facture->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
$permissionedit=$user->rights->fournisseur->facture->creer; // Used by the include of actions_lineupdown.inc.php
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($cancel) $action='';
|
|
||||||
|
|
||||||
$parameters=array('socid'=>$socid);
|
$parameters=array('socid'=>$socid);
|
||||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
if (empty($reshook))
|
||||||
|
{
|
||||||
|
if ($cancel) $action='';
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||||
|
|
||||||
// Action clone object
|
// Action clone object
|
||||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||||
@ -536,17 +541,29 @@ elseif ($action == 'updateline' && $user->rights->fournisseur->facture->creer)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
$label = $_POST['desc'];
|
$label = $_POST['desc'];
|
||||||
$type = $_POST["type"]?$_POST["type"]:0;
|
$type = $_POST["type"]?$_POST["type"]:0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$date_start=dol_mktime(GETPOST('date_start'.$date_pf.'hour'), GETPOST('date_start'.$date_pf.'min'), 0, GETPOST('date_start'.$date_pf.'month'), GETPOST('date_start'.$date_pf.'day'), GETPOST('date_start'.$date_pf.'year'));
|
||||||
|
$date_end=dol_mktime(GETPOST('date_end'.$date_pf.'hour'), GETPOST('date_end'.$date_pf.'min'), 0, GETPOST('date_end'.$date_pf.'month'), GETPOST('date_end'.$date_pf.'day'), GETPOST('date_end'.$date_pf.'year'));
|
||||||
|
|
||||||
$localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
|
$localtax1_tx= get_localtax($_POST['tauxtva'], 1, $mysoc,$object->thirdparty);
|
||||||
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
$localtax2_tx= get_localtax($_POST['tauxtva'], 2, $mysoc,$object->thirdparty);
|
||||||
$remise_percent=GETPOST('remise_percent');
|
$remise_percent=GETPOST('remise_percent');
|
||||||
|
|
||||||
$result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent);
|
// Extrafields Lines
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
|
// Unset extrafield POST Data
|
||||||
|
if (is_array($extralabelsline)) {
|
||||||
|
foreach ($extralabelsline as $key => $value) {
|
||||||
|
unset($_POST["options_" . $key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$result=$object->updateline(GETPOST('lineid'), $label, $pu, GETPOST('tauxtva'), $localtax1_tx, $localtax2_tx, GETPOST('qty'), GETPOST('idprod'), $price_base_type, 0, $type, $remise_percent, 0, $date_start, $date_end, $array_options);
|
||||||
if ($result >= 0)
|
if ($result >= 0)
|
||||||
{
|
{
|
||||||
unset($_POST['label']);
|
unset($_POST['label']);
|
||||||
@ -593,6 +610,18 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
|||||||
$qty = GETPOST('qty'.$predef);
|
$qty = GETPOST('qty'.$predef);
|
||||||
$remise_percent=GETPOST('remise_percent'.$predef);
|
$remise_percent=GETPOST('remise_percent'.$predef);
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
$extrafieldsline = new ExtraFields($db);
|
||||||
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
|
$array_option = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||||
|
// Unset extrafield
|
||||||
|
if (is_array($extralabelsline)) {
|
||||||
|
// Get extra fields
|
||||||
|
foreach ($extralabelsline as $key => $value) {
|
||||||
|
unset($_POST["options_" . $key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
|
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
|
||||||
{
|
{
|
||||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||||
@ -647,9 +676,10 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
|||||||
$localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
|
$localtax2_tx= get_localtax($tvatx, 2, $mysoc,$object->thirdparty);
|
||||||
|
|
||||||
$type = $productsupplier->type;
|
$type = $productsupplier->type;
|
||||||
|
$price_base_type = 'HT';
|
||||||
|
|
||||||
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
|
// TODO Save the product supplier ref into database into field ref_supplier (must rename field ref into ref_supplier first)
|
||||||
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr);
|
$result=$object->addline($desc, $productsupplier->fourn_pu, $tvatx, $localtax1_tx, $localtax2_tx, $qty, $idprod, $remise_percent, '', '', 0, $npr, $price_base_type, $type, -1, 0, $array_options);
|
||||||
}
|
}
|
||||||
if ($idprod == -2 || $idprod == 0)
|
if ($idprod == -2 || $idprod == 0)
|
||||||
{
|
{
|
||||||
@ -688,7 +718,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
|||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
|
|
||||||
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
|
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
|
||||||
$result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
|
$result=$object->addline($product_desc, $ht, $tva_tx, $localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type, -1, 0, $array_options);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -696,7 +726,7 @@ elseif ($action == 'addline' && $user->rights->fournisseur->facture->creer)
|
|||||||
$ht = $ttc / (1 + ($tva_tx / 100));
|
$ht = $ttc / (1 + ($tva_tx / 100));
|
||||||
$price_base_type = 'HT';
|
$price_base_type = 'HT';
|
||||||
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
|
//print $product_desc, $pu, $txtva, $qty, $fk_product=0, $remise_percent=0, $date_start='', $date_end='', $ventil=0, $info_bits='', $price_base_type='HT', $type=0
|
||||||
$result=$object->addline($product_desc, $ht, $tva_tx,$localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type);
|
$result=$object->addline($product_desc, $ht, $tva_tx,$localtax1_tx, $localtax2_tx, $qty, 0, $remise_percent, $datestart, $dateend, 0, $npr, $price_base_type, $type, -1, 0, $array_options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1019,7 +1049,7 @@ if ($action == 'send' && ! $_POST['addfile'] && ! $_POST['removedfile'] && ! $_P
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build document
|
// Build document
|
||||||
elseif ($action == 'builddoc')
|
if ($action == 'builddoc')
|
||||||
{
|
{
|
||||||
// Save modele used
|
// Save modele used
|
||||||
$object->fetch($id);
|
$object->fetch($id);
|
||||||
@ -1044,7 +1074,7 @@ elseif ($action == 'builddoc')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Make calculation according to calculationrule
|
// Make calculation according to calculationrule
|
||||||
elseif ($action == 'calculate')
|
if ($action == 'calculate')
|
||||||
{
|
{
|
||||||
$calculationrule=GETPOST('calculationrule');
|
$calculationrule=GETPOST('calculationrule');
|
||||||
|
|
||||||
@ -1058,7 +1088,7 @@ elseif ($action == 'calculate')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete file in doc form
|
// Delete file in doc form
|
||||||
elseif ($action == 'remove_file')
|
if ($action == 'remove_file')
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -1073,12 +1103,11 @@ elseif ($action == 'remove_file')
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
elseif ($action == 'update_extras')
|
if ($action == 'update_extras')
|
||||||
{
|
{
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($object->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute'));
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object,GETPOST('attribute'));
|
||||||
|
|
||||||
if ($ret < 0) $error++;
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (!$error)
|
if (!$error)
|
||||||
@ -1172,6 +1201,7 @@ if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->fourniss
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1998,7 +2028,7 @@ else
|
|||||||
|
|
||||||
// Show object lines
|
// Show object lines
|
||||||
if (! empty($object->lines))
|
if (! empty($object->lines))
|
||||||
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1);
|
$ret = $object->printObjectLines($action, $soc, $mysoc, $lineid, 1, $user->rights->fournisseur->facture->creer);
|
||||||
|
|
||||||
$num=count($object->lines);
|
$num=count($object->lines);
|
||||||
|
|
||||||
|
|||||||
@ -219,3 +219,11 @@ create table llx_facture_fourn_det_extrafields
|
|||||||
|
|
||||||
ALTER TABLE llx_facture_fourn_det_extrafields ADD INDEX idx_facture_fourn_det_extrafields (fk_object);
|
ALTER TABLE llx_facture_fourn_det_extrafields ADD INDEX idx_facture_fourn_det_extrafields (fk_object);
|
||||||
|
|
||||||
|
ALTER TABLE llx_facture_fourn_det ADD COLUMN special_code integer DEFAULT 0;
|
||||||
|
ALTER TABLE llx_facture_fourn_det ADD COLUMN rang integer DEFAULT 0;
|
||||||
|
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_parent_line integer NULL after fk_facture_fourn;
|
||||||
|
|
||||||
|
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN special_code integer DEFAULT 0;
|
||||||
|
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN rang integer DEFAULT 0;
|
||||||
|
ALTER TABLE llx_commande_fournisseurdet ADD COLUMN fk_parent_line integer NULL after fk_commande;
|
||||||
|
|
||||||
|
|||||||
@ -22,6 +22,7 @@ create table llx_commande_fournisseurdet
|
|||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_commande integer NOT NULL,
|
fk_commande integer NOT NULL,
|
||||||
|
fk_parent_line integer NULL,
|
||||||
fk_product integer,
|
fk_product integer,
|
||||||
ref varchar(50), -- supplier product ref
|
ref varchar(50), -- supplier product ref
|
||||||
label varchar(255), -- product label
|
label varchar(255), -- product label
|
||||||
@ -44,5 +45,7 @@ create table llx_commande_fournisseurdet
|
|||||||
date_start datetime DEFAULT NULL, -- date debut si service
|
date_start datetime DEFAULT NULL, -- date debut si service
|
||||||
date_end datetime DEFAULT NULL, -- date fin si service
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
|
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||||
|
rang integer DEFAULT 0,
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -51,7 +51,7 @@ create table llx_commandedet
|
|||||||
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
buy_price_ht double(24,8) DEFAULT 0, -- buying price
|
||||||
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
fk_product_fournisseur_price integer DEFAULT NULL, -- reference of supplier price when line was added (may be used to update buy_price_ht current price when future invoice will be created)
|
||||||
|
|
||||||
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
|
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||||
rang integer DEFAULT 0,
|
rang integer DEFAULT 0,
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -22,6 +22,7 @@ create table llx_facture_fourn_det
|
|||||||
(
|
(
|
||||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
fk_facture_fourn integer NOT NULL,
|
fk_facture_fourn integer NOT NULL,
|
||||||
|
fk_parent_line integer NULL,
|
||||||
fk_product integer NULL,
|
fk_product integer NULL,
|
||||||
ref varchar(50), -- supplier product ref
|
ref varchar(50), -- supplier product ref
|
||||||
label varchar(255), -- product label
|
label varchar(255), -- product label
|
||||||
@ -45,5 +46,7 @@ create table llx_facture_fourn_det
|
|||||||
date_end datetime DEFAULT NULL, -- date fin si service
|
date_end datetime DEFAULT NULL, -- date fin si service
|
||||||
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
info_bits integer DEFAULT 0, -- TVA NPR ou non
|
||||||
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
fk_code_ventilation integer DEFAULT 0 NOT NULL,
|
||||||
|
special_code integer DEFAULT 0, -- code pour les lignes speciales
|
||||||
|
rang integer DEFAULT 0,
|
||||||
import_key varchar(14)
|
import_key varchar(14)
|
||||||
)ENGINE=innodb;
|
)ENGINE=innodb;
|
||||||
|
|||||||
@ -262,8 +262,12 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
|
}
|
||||||
|
|
||||||
if ($id > 0)
|
if ($id > 0)
|
||||||
{
|
{
|
||||||
@ -339,8 +343,9 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if ($object->check())
|
if (! $error && $object->check())
|
||||||
{
|
{
|
||||||
if ($object->update($object->id, $user) > 0)
|
if ($object->update($object->id, $user) > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -148,6 +148,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result = $object->create($user);
|
$result = $object->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
@ -224,10 +225,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
if ($ret < 0)
|
if ($ret < 0) $error++;
|
||||||
{
|
|
||||||
$error++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
@ -91,14 +91,17 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->projet->creer)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$result=$object->update($user);
|
$result=$object->update($user);
|
||||||
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
setEventMessages($object->error,$object->errors,'errors');
|
setEventMessages($object->error,$object->errors,'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$action='edit';
|
$action='edit';
|
||||||
|
|||||||
@ -250,6 +250,7 @@ if ($action == 'add')
|
|||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$extralabels=$extrafields->fetch_name_optionals_label($adh->table_element);
|
$extralabels=$extrafields->fetch_name_optionals_label($adh->table_element);
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$adh);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$adh);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
$result=$adh->create($user);
|
$result=$adh->create($user);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -193,7 +193,7 @@ if (empty($reshook))
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (GETPOST('deletephoto')) $object->logo = '';
|
if (GETPOST('deletephoto')) $object->logo = '';
|
||||||
else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
|
else if (! empty($_FILES['photo']['name'])) $object->logo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||||
|
|||||||
@ -211,6 +211,7 @@ if ($action == 'add' && $canadduser)
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
// Set entity of new user
|
// Set entity of new user
|
||||||
$entity=GETPOST('entity','int');
|
$entity=GETPOST('entity','int');
|
||||||
@ -361,6 +362,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled))
|
if (! empty($conf->multicompany->enabled))
|
||||||
{
|
{
|
||||||
@ -385,8 +387,9 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
if (GETPOST('deletephoto')) $object->photo='';
|
if (GETPOST('deletephoto')) $object->photo='';
|
||||||
if (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
if (! empty($_FILES['photo']['name'])) $object->photo = dol_sanitizeFileName($_FILES['photo']['name']);
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
$ret=$object->update($user);
|
$ret=$object->update($user);
|
||||||
|
|
||||||
if ($ret < 0)
|
if ($ret < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
$error++;
|
||||||
@ -400,6 +403,7 @@ if ($action == 'update' && ! $_POST["cancel"])
|
|||||||
setEventMessage($object->error, 'errors');
|
setEventMessage($object->error, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error && isset($_POST['contactid']))
|
if (! $error && isset($_POST['contactid']))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -101,6 +101,7 @@ if ($action == 'add')
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
||||||
else $object->entity = $_POST["entity"];
|
else $object->entity = $_POST["entity"];
|
||||||
@ -183,6 +184,7 @@ if ($action == 'update')
|
|||||||
|
|
||||||
// Fill array 'array_options' with data from add form
|
// Fill array 'array_options' with data from add form
|
||||||
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
$ret = $extrafields->setOptionalsFromPost($extralabels,$object);
|
||||||
|
if ($ret < 0) $error++;
|
||||||
|
|
||||||
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
if (! empty($conf->multicompany->enabled) && ! empty($conf->multicompany->transverse_mode)) $object->entity = 0;
|
||||||
else $object->entity = $_POST["entity"];
|
else $object->entity = $_POST["entity"];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user