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

This commit is contained in:
Laurent Destailleur 2020-01-06 14:09:46 +01:00
commit 57bbac2015
9 changed files with 151 additions and 78 deletions

View File

@ -170,9 +170,11 @@ elseif ($modecompta == "RECETTES-DEPENSES")
} }
elseif ($modecompta == "BOOKKEEPING") elseif ($modecompta == "BOOKKEEPING")
{ {
// TODO
} }
elseif ($modecompta == "BOOKKEEPINGCOLLECTED") elseif ($modecompta == "BOOKKEEPINGCOLLECTED")
{ {
// TODO
} }
$period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0); $period = $form->selectDate($date_start, 'date_start', 0, 0, 0, '', 1, 0).' - '.$form->selectDate($date_end, 'date_end', 0, 0, 0, '', 1, 0);
if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>'; if ($date_end == dol_time_plus_duree($date_start, 1, 'y') - 1) $periodlink = '<a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start - 1).'&modecompta='.$modecompta.'">'.img_previous().'</a> <a href="'.$_SERVER["PHP_SELF"].'?year='.($year_start + 1).'&modecompta='.$modecompta.'">'.img_next().'</a>';
@ -387,39 +389,53 @@ if (count($amount)) {
// Amount w/o VAT // Amount w/o VAT
print '<td class="right">'; print '<td class="right">';
if ($modecompta != 'CREANCES-DETTES') if ($modecompta == 'RECETTES-DEPENSES') {
{
if ($key > 0) { if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">'; //print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else { } else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">'; //print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
} }
} else { }
elseif ($modecompta == 'CREANCES-DETTES') {
if ($key > 0) { if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else { } else {
print '<a href="#">'; //print '<a href="#">';
} }
print price($amount_ht[$key]); print price($amount_ht[$key]);
if ($key > 0) print '</a>';
} }
print '</td>'; print '</td>';
// Amount with VAT // Amount with VAT
print '<td class="right">'; print '<td class="right">';
if ($modecompta != 'CREANCES-DETTES') { if ($modecompta == 'RECETTES-DEPENSES') {
if ($key > 0) { if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">'; //print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid='.$key.'">';
} else { } else {
print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">'; //print '<a href="'.DOL_URL_ROOT.'/compta/paiement/list.php?userid=-1">';
} }
} else { }
elseif ($modecompta == 'CREANCES-DETTES') {
if ($key > 0) { if ($key > 0) {
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
} else { } else {
print '<a href="#">'; //print '<a href="#">';
} }
} }
print price($amount[$key]); print price($amount[$key]);
if ($modecompta == 'RECETTES-DEPENSES') {
if ($key > 0) {
//print '</a>';
} else {
//print '</a>';
}
}
elseif ($modecompta == 'CREANCES-DETTES') {
if ($key > 0) {
print '</a>';
}
}
print '</td>'; print '</td>';
// Percent // Percent

View File

@ -3522,6 +3522,7 @@ abstract class CommonObject
if ($elementTable == 'user') $fieldstatus = "statut"; if ($elementTable == 'user') $fieldstatus = "statut";
if ($elementTable == 'expensereport') $fieldstatus = "fk_statut"; if ($elementTable == 'expensereport') $fieldstatus = "fk_statut";
if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus = "status"; if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus = "status";
if (is_array($this->fields) && array_key_exists('status', $this->fields)) $fieldstatus = 'status';
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable; $sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
$sql .= " SET ".$fieldstatus." = ".$status; $sql .= " SET ".$fieldstatus." = ".$status;
@ -3572,7 +3573,7 @@ abstract class CommonObject
else else
{ {
$this->db->rollback(); $this->db->rollback();
dol_syslog(get_class($this)."::setStatus ".$this->error, LOG_ERR); dol_syslog(get_class($this)."::setStatut ".$this->error, LOG_ERR);
return -1; return -1;
} }
} }

View File

@ -1248,6 +1248,7 @@ AskForPreferredShippingMethod=Ask for preferred shipping method for Third Partie
FieldEdition=Edition of field %s FieldEdition=Edition of field %s
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
GetBarCode=Get barcode GetBarCode=Get barcode
NumberingModules=Numbering models
##### Module password generation ##### Module password generation
PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase. PasswordGenerationStandard=Return a password generated according to internal Dolibarr algorithm: 8 characters containing shared numbers and characters in lowercase.
PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually. PasswordGenerationNone=Do not suggest a generated password. Password must be typed in manually.

View File

@ -21,12 +21,12 @@
*/ */
/** /**
* \file htdocs/core/modules/bom/mod_bom_advanced.php * \file htdocs/core/modules/mymodule/mod_myobject_advanced.php
* \ingroup bom * \ingroup mymodule
* \brief File containing class for advanced numbering model of MyObject * \brief File containing class for advanced numbering model of MyObject
*/ */
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
/** /**
@ -71,15 +71,15 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
$texte.= '<input type="hidden" name="maskconstBom" value="MYMODULE_MYOBJECT_ADVANCED_MASK">'; $texte.= '<input type="hidden" name="maskconstBom" value="MYMODULE_MYOBJECT_ADVANCED_MASK">';
$texte.= '<table class="nobordernopadding" width="100%">'; $texte.= '<table class="nobordernopadding" width="100%">';
$tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); $tooltip=$langs->trans("GenericMaskCodes", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject"));
$tooltip.=$langs->trans("GenericMaskCodes2"); $tooltip.=$langs->trans("GenericMaskCodes2");
$tooltip.=$langs->trans("GenericMaskCodes3"); $tooltip.=$langs->trans("GenericMaskCodes3");
$tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("Bom"), $langs->transnoentities("Bom")); $tooltip.=$langs->trans("GenericMaskCodes4a", $langs->transnoentities("MyObject"), $langs->transnoentities("MyObject"));
$tooltip.=$langs->trans("GenericMaskCodes5"); $tooltip.=$langs->trans("GenericMaskCodes5");
// Parametrage du prefix // Parametrage du prefix
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>'; $texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
$texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskBom" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>'; $texte.= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskMyObject" value="'.$conf->global->MYMODULE_MYOBJECT_ADVANCED_MASK.'">', $tooltip, 1, 1).'</td>';
$texte.= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>'; $texte.= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
@ -137,9 +137,9 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
return 0; return 0;
} }
$date = ($object->date_bom ? $object->date_bom : $object->date); $date = $object->date;
$numFinal=get_next_value($db, $mask, 'bom_bom', 'ref', '', null, $date); $numFinal=get_next_value($db, $mask, 'mymodule_myobject', 'ref', '', null, $date);
return $numFinal; return $numFinal;
} }

View File

@ -18,11 +18,12 @@
*/ */
/** /**
* \file htdocs/core/modules/bom/mod_bom_standard.php * \file htdocs/core/modules/mymodule/mod_myobject_standard.php
* \ingroup bom * \ingroup mymodule
* \brief File of class to manage MyObject numbering rules standard * \brief File of class to manage MyObject numbering rules standard
*/ */
require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; dol_include_once('/mymodule/core/modules/mymodule/modules_myobject.php');
/** /**
* Class to manage customer order numbering rules standard * Class to manage customer order numbering rules standard
@ -85,7 +86,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
$posindice=8; $posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bom"; $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@ -119,7 +120,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
// D'abord on recupere la valeur max // D'abord on recupere la valeur max
$posindice=9; $posindice=9;
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; $sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
$sql.= " FROM ".MAIN_DB_PREFIX."bom_bom"; $sql.= " FROM ".MAIN_DB_PREFIX."mymodule_myobject";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'"; $sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
$sql.= " AND entity = ".$conf->entity; $sql.= " AND entity = ".$conf->entity;
@ -132,7 +133,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
} }
else else
{ {
dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG); dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG);
return -1; return -1;
} }
@ -143,7 +144,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
else $num = sprintf("%04s", $max+1); else $num = sprintf("%04s", $max+1);
dol_syslog("mod_bom_standard::getNextValue return ".$this->prefix.$yymm."-".$num); dol_syslog("mod_myobject_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
return $this->prefix.$yymm."-".$num; return $this->prefix.$yymm."-".$num;
} }
} }

View File

@ -23,10 +23,9 @@
*/ */
/** /**
* \file htdocs/core/modules/bom/modules_bom.php * \file htdocs/core/modules/mymodule/modules_myobject.php
* \ingroup bom * \ingroup mymodule
* \brief File that contains parent class for boms models * \brief File that contains parent class for myobjects document models and parent class for myobjects numbering models
* and parent class for boms numbering models
*/ */
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
@ -34,7 +33,7 @@ require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // requir
/** /**
* Parent class for boms models * Parent class for documents models
*/ */
abstract class ModelePDFMyObject extends CommonDocGenerator abstract class ModelePDFMyObject extends CommonDocGenerator
{ {
@ -52,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
// phpcs:enable // phpcs:enable
global $conf; global $conf;
$type = 'bom'; $type = 'mymodule_myobject';
$list = array(); $list = array();
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
@ -65,7 +64,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
/** /**
* Parent class to manage numbering of BOMs * Parent class to manage numbering of MyObject
*/ */
abstract class ModeleNumRefMyObject abstract class ModeleNumRefMyObject
{ {
@ -92,7 +91,7 @@ abstract class ModeleNumRefMyObject
public function info() public function info()
{ {
global $langs; global $langs;
$langs->load("mrp"); $langs->load("mymodule@mymodule");
return $langs->trans("NoDescription"); return $langs->trans("NoDescription");
} }
@ -104,7 +103,7 @@ abstract class ModeleNumRefMyObject
public function getExample() public function getExample()
{ {
global $langs; global $langs;
$langs->load("mrp"); $langs->load("mymodule@mymodule");
return $langs->trans("NoExample"); return $langs->trans("NoExample");
} }

View File

@ -182,27 +182,41 @@ if (empty($reshook))
} }
} }
if (! $error) { $idstockmove = 0;
// Record consumption if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) {
$moline = new MoLine($db);
$result = $moline->create($user);
if ($result <= 0) {
$error++;
setEventMessages($moline->error, $moline->errors, 'errors');
}
}
if (! $error) {
// Record stock movement // Record stock movement
$id_product_batch = 0; $id_product_batch = 0;
$result = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); $idstockmove = $stockmove->livraison($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement);
if ($result <= 0) { if ($idstockmove < 0) {
$error++; $error++;
setEventMessages($stockmove->error, $stockmove->errors, 'errors'); setEventMessages($stockmove->error, $stockmove->errors, 'errors');
} }
} }
if (! $error) {
$pos = 0;
// Record consumption
$moline = new MoLine($db);
$moline->fk_mo = $object->id;
$moline->position = $pos;
$moline->fk_product = $line->fk_product;
$moline->fk_warehouse = GETPOST('idwarehouse-'.$line->id.'-'.$i);
$moline->qty = GETPOST('qty-'.$line->id.'-'.$i);
$moline->batch = GETPOST('batch-'.$line->id.'-'.$i);
$moline->role = 'consumed';
$moline->fk_mrp_production = $line->id;
$moline->fk_stock_movement = $idstockmove;
$moline->fk_user_creat = $user->id;
$resultmoline = $moline->create($user);
if ($resultmoline <= 0) {
$error++;
setEventMessages($moline->error, $moline->errors, 'errors');
}
$pos++;
}
$i++; $i++;
} }
} }
@ -230,27 +244,41 @@ if (empty($reshook))
} }
} }
if (! $error) { $idstockmove = 0;
// Record production if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) {
$moline = new MoLine($db);
$result = $moline->create($user);
if ($result <= 0) {
$error++;
setEventMessages($moline->error, $moline->errors, 'errors');
}
}
if (! $error) {
// Record stock movement // Record stock movement
$id_product_batch = 0; $id_product_batch = 0;
$result = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehouse-'.$line->id.'-'.$i), GETPOST('qty-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batch-'.$line->id.'-'.$i), $id_product_batch, $codemovement); $idstockmove = $stockmove->reception($user, $line->fk_product, GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i), GETPOST('qtytoproduce-'.$line->id.'-'.$i), 0, $labelmovement, dol_now(), '', '', GETPOST('batchtoproduce-'.$line->id.'-'.$i), $id_product_batch, $codemovement);
if ($result <= 0) { if ($idstockmove < 0) {
$error++; $error++;
setEventMessages($stockmove->error, $stockmove->errors, 'errors'); setEventMessages($stockmove->error, $stockmove->errors, 'errors');
} }
} }
if (! $error) {
$pos = 0;
// Record production
$moline = new MoLine($db);
$moline->fk_mo = $object->id;
$moline->position = $pos;
$moline->fk_product = $line->fk_product;
$moline->fk_warehouse = GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i);
$moline->qty = GETPOST('qtytoproduce-'.$line->id.'-'.$i);
$moline->batch = GETPOST('batchtoproduce-'.$line->id.'-'.$i);
$moline->role = 'produced';
$moline->fk_mrp_production = $line->id;
$moline->fk_stock_movement = $idstockmove;
$moline->fk_user_creat = $user->id;
$resultmoline = $moline->create($user);
if ($resultmoline <= 0) {
$error++;
setEventMessages($moline->error, $moline->errors, 'errors');
}
$pos++;
}
$i++; $i++;
} }
} }
@ -261,9 +289,13 @@ if (empty($reshook))
$qtyremaintoconsume = 0; $qtyremaintoconsume = 0;
$qtyremaintoproduce = 0; $qtyremaintoproduce = 0;
if ($qtyremaintoconsume == 0 && $qtyremaintoproduce == 0) { if ($qtyremaintoconsume == 0 && $qtyremaintoproduce == 0) {
$object->setStatut($object::STATUS_INPROGRESS); $result = $object->setStatut($object::STATUS_INPROGRESS, 0, '', 'MRP_MO_PRODUCED');
} else { } else {
$object->setStatut($object::STATUS_PRODUCED); $result = $object->setStatut($object::STATUS_PRODUCED, 0, '', 'MRP_MO_PRODUCED');
}
if ($result <= 0) {
$error++;
setEventMessages($object->error, $object->errors, 'errors');
} }
} }
@ -496,12 +528,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
if ($action == 'consumeandproduceall') if ($action == 'consumeandproduceall')
{ {
$defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard')); $defaultstockmovementlabel = GETPOST('inventorylabel', 'alphanohtml') ? GETPOST('inventorylabel', 'alphanohtml') : $langs->trans("ProductionForRefAndDate", $object->ref, dol_print_date(dol_now(), 'standard'));
$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog'); //$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref.'_'.dol_print_date(dol_now(), 'dayhourlog');
$defaultstockmovementcode = GETPOST('inventorycode', 'alphanohtml') ? GETPOST('inventorycode', 'alphanohtml') : $object->ref;
print '<div class="center">'; print '<div class="center">';
print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></span>'; print '<span class="opacitymedium hideonsmartphone">'.$langs->trans("ConfirmProductionDesc", $langs->transnoentitiesnoconv("Confirm")).'<br></span>';
print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"> &nbsp; '; print $langs->trans("MovementLabel").': <input type="text" class="minwidth300" name="inventorylabel" value="'.$defaultstockmovementlabel.'"> &nbsp; ';
print $langs->trans("InventoryCode").': <input type="text" class="minwidth200" name="inventorycode" value="'.$defaultstockmovementcode.'"><br><br>'; print $langs->trans("InventoryCode").': <input type="text" class="maxwidth150" name="inventorycode" value="'.$defaultstockmovementcode.'"><br><br>';
print '<input type="checkbox" name="autoclose" value="1" checked="checked"> '.$langs->trans("AutoCloseMO").'<br>'; print '<input type="checkbox" name="autoclose" value="1" checked="checked"> '.$langs->trans("AutoCloseMO").'<br>';
print '<input class="button" type="submit" value="'.$langs->trans("Confirm").'" name="confirm">'; print '<input class="button" type="submit" value="'.$langs->trans("Confirm").'" name="confirm">';
print ' &nbsp; '; print ' &nbsp; ';

View File

@ -97,7 +97,7 @@ class MouvementStock extends CommonObject
* @param int $entrepot_id Id of warehouse * @param int $entrepot_id Id of warehouse
* @param int $qty Qty of movement (can be <0 or >0 depending on parameter type) * @param int $qty Qty of movement (can be <0 or >0 depending on parameter type)
* @param int $type Direction of movement: * @param int $type Direction of movement:
* 0=input (stock increase by a stock transfer), 1=output (stock decrease after by a stock transfer), * 0=input (stock increase by a stock transfer), 1=output (stock decrease by a stock transfer),
* 2=output (stock decrease), 3=input (stock increase) * 2=output (stock decrease), 3=input (stock increase)
* Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2. * Note that qty should be > 0 with 0 or 3, < 0 with 1 or 2.
* @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed. * @param int $price Unit price HT of product, used to calculate average weighted price (PMP in french). If 0, average weighted price is not changed.

View File

@ -843,7 +843,11 @@ if (!$source)
{ {
$found = true; $found = true;
$tag = GETPOST("tag", 'alpha'); $tag = GETPOST("tag", 'alpha');
if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = "TAG=".$tag; $fulltag = "TAG=".$tag;
}
// Creditor // Creditor
print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor"); print '<tr class="CTableRow'.($var ? '1' : '2').'"><td class="CTableRow'.($var ? '1' : '2').'">'.$langs->trans("Creditor");
@ -910,8 +914,12 @@ if ($source == 'order')
$amount = price2num($amount); $amount = price2num($amount);
} }
if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id; $fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id;
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
}
$fulltag = dol_string_unaccent($fulltag); $fulltag = dol_string_unaccent($fulltag);
// Creditor // Creditor
@ -1029,9 +1037,12 @@ if ($source == 'invoice')
$amount = price2num($amount); $amount = price2num($amount);
} }
if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id; $fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id;
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
}
$fulltag = dol_string_unaccent($fulltag); $fulltag = dol_string_unaccent($fulltag);
// Creditor // Creditor
@ -1202,9 +1213,12 @@ if ($source == 'contractline')
$amount = price2num($amount); $amount = price2num($amount);
} }
$fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); if (GETPOST('fulltag', 'alpha')) {
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," "); $fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'COL='.$contractline->id.'.CON='.$contract->id.'.CUS='.$contract->thirdparty->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S');
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
}
$fulltag = dol_string_unaccent($fulltag); $fulltag = dol_string_unaccent($fulltag);
$qty = 1; $qty = 1;
@ -1367,8 +1381,12 @@ if ($source == 'membersubscription')
$amount = price2num($amount); $amount = price2num($amount);
} }
$fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S');
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
}
$fulltag = dol_string_unaccent($fulltag); $fulltag = dol_string_unaccent($fulltag);
// Creditor // Creditor
@ -1531,8 +1549,12 @@ if ($source == 'donation')
$amount = price2num($amount); $amount = price2num($amount);
} }
$fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M'); if (GETPOST('fulltag', 'alpha')) {
$fulltag = GETPOST('fulltag', 'alpha');
} else {
$fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M%S');
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; } if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
}
$fulltag = dol_string_unaccent($fulltag); $fulltag = dol_string_unaccent($fulltag);
// Creditor // Creditor