Merge remote-tracking branch 'Dolibarr/11.0' into 11
This commit is contained in:
parent
afb2b6a931
commit
e5ddc8dfa3
@ -3206,13 +3206,13 @@ if ($action == 'create')
|
||||
|
||||
$thirdparty = $soc;
|
||||
$discount_type = 0;
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin').'&originid='.GETPOST('originid'));
|
||||
$backtopage = urlencode($_SERVER["PHP_SELF"].'?socid='.$thirdparty->id.'&action='.$action.'&origin='.GETPOST('origin', 'alpha').'&originid='.GETPOST('originid', 'int'));
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/object_discounts.tpl.php';
|
||||
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
$datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int'));
|
||||
|
||||
// Date invoice
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DateInvoice').'</td><td colspan="2">';
|
||||
@ -3223,14 +3223,14 @@ if ($action == 'create')
|
||||
if (!empty($conf->global->INVOICE_POINTOFTAX_DATE))
|
||||
{
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans('DatePointOfTax').'</td><td colspan="2">';
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, $_POST['date_pointoftaxmonth'], $_POST['date_pointoftaxday'], $_POST['date_pointoftaxyear']);
|
||||
$date_pointoftax = dol_mktime(12, 0, 0, GETPOST('date_pointoftaxmonth', 'int'), GETPOST('date_pointoftaxday', 'int'), GETPOST('date_pointoftaxyear', 'int'));
|
||||
print $form->selectDate($date_pointoftax ? $date_pointoftax : -1, 'date_pointoftax', '', '', '', "add", 1, 1);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Payment term
|
||||
print '<tr><td class="nowrap fieldrequired">'.$langs->trans('PaymentConditionsShort').'</td><td colspan="2">';
|
||||
$form->select_conditions_paiements(isset($_POST['cond_reglement_id']) ? $_POST['cond_reglement_id'] : $cond_reglement_id, 'cond_reglement_id');
|
||||
$form->select_conditions_paiements(GETPOSTISSET('cond_reglement_id') ? GETPOST('cond_reglement_id', 'int') : $cond_reglement_id, 'cond_reglement_id');
|
||||
print '</td></tr>';
|
||||
|
||||
if (!empty($conf->global->INVOICE_USE_SITUATION))
|
||||
|
||||
@ -170,9 +170,11 @@ elseif ($modecompta == "RECETTES-DEPENSES")
|
||||
}
|
||||
elseif ($modecompta == "BOOKKEEPING")
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
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);
|
||||
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
|
||||
print '<td class="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES')
|
||||
{
|
||||
if ($modecompta == 'RECETTES-DEPENSES') {
|
||||
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 {
|
||||
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) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
//print '<a href="#">';
|
||||
}
|
||||
print price($amount_ht[$key]);
|
||||
if ($key > 0) print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Amount with VAT
|
||||
print '<td class="right">';
|
||||
if ($modecompta != 'CREANCES-DETTES') {
|
||||
if ($modecompta == 'RECETTES-DEPENSES') {
|
||||
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 {
|
||||
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) {
|
||||
print '<a href="'.DOL_URL_ROOT.'/compta/facture/list.php?userid='.$key.'">';
|
||||
} else {
|
||||
print '<a href="#">';
|
||||
//print '<a href="#">';
|
||||
}
|
||||
}
|
||||
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>';
|
||||
|
||||
// Percent
|
||||
|
||||
@ -3522,6 +3522,7 @@ abstract class CommonObject
|
||||
if ($elementTable == 'user') $fieldstatus = "statut";
|
||||
if ($elementTable == 'expensereport') $fieldstatus = "fk_statut";
|
||||
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 .= " SET ".$fieldstatus." = ".$status;
|
||||
@ -3572,7 +3573,7 @@ abstract class CommonObject
|
||||
else
|
||||
{
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1567,7 +1567,7 @@ function dol_banner_tab($object, $paramid, $morehtml = '', $shownav = 1, $fieldi
|
||||
{
|
||||
$accounted = $object->getVentilExportCompta();
|
||||
$langs->load("accountancy");
|
||||
$morehtmlstatus .= '</div><div class="statusref statusrefbis">'.($accounted > 0 ? $langs->trans("Accounted") : '<span class="opacitymedium">'.$langs->trans("NotYetAccounted").'</span>');
|
||||
$morehtmlstatus .= '</div><div class="statusref statusrefbis"><span class="opacitymedium">'.($accounted > 0 ? $langs->trans("Accounted") : $langs->trans("NotYetAccounted")).'</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -115,7 +115,7 @@ print "\n";
|
||||
print "<!-- Begin SearchForm -->\n";
|
||||
print '<div class="center"><div class="center" style="padding: 6px;">';
|
||||
print '<style>.menu_titre { padding-top: 7px; }</style>';
|
||||
print '<div id="blockvmenusearch">'."\n";
|
||||
print '<div id="blockvmenusearch" class="tagtable center searchpage">'."\n";
|
||||
print $searchform;
|
||||
print '</div>'."\n";
|
||||
print '</div></div>';
|
||||
|
||||
@ -1248,6 +1248,7 @@ AskForPreferredShippingMethod=Ask for preferred shipping method for Third Partie
|
||||
FieldEdition=Edition of field %s
|
||||
FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced)
|
||||
GetBarCode=Get barcode
|
||||
NumberingModules=Numbering models
|
||||
##### Module password generation
|
||||
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.
|
||||
|
||||
@ -584,8 +584,8 @@ class MyObject extends CommonObject
|
||||
// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
|
||||
$oldref = dol_sanitizeFileName($this->ref);
|
||||
$newref = dol_sanitizeFileName($num);
|
||||
$dirsource = $conf->myobject->dir_output.'/'.$oldref;
|
||||
$dirdest = $conf->myobject->dir_output.'/'.$newref;
|
||||
$dirsource = $conf->mymodule->dir_output.'/myobject/'.$oldref;
|
||||
$dirdest = $conf->mymodule->dir_output.'/myobject/'.$newref;
|
||||
if (!$error && file_exists($dirsource))
|
||||
{
|
||||
dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
|
||||
@ -594,7 +594,7 @@ class MyObject extends CommonObject
|
||||
{
|
||||
dol_syslog("Rename ok");
|
||||
// Rename docs starting with $oldref with $newref
|
||||
$listoffiles = dol_dir_list($conf->myobject->dir_output.'/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
$listoffiles = dol_dir_list($conf->mymodule->dir_output.'/myobject/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
|
||||
foreach ($listoffiles as $fileentry)
|
||||
{
|
||||
$dirsource = $fileentry['name'];
|
||||
|
||||
@ -21,12 +21,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/mod_bom_advanced.php
|
||||
* \ingroup bom
|
||||
* \file htdocs/core/modules/mymodule/mod_myobject_advanced.php
|
||||
* \ingroup mymodule
|
||||
* \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.= '<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("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");
|
||||
|
||||
// Parametrage du prefix
|
||||
$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"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||
|
||||
@ -137,9 +137,9 @@ class mod_myobject_advanced extends ModeleNumRefMyObject
|
||||
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;
|
||||
}
|
||||
|
||||
@ -18,11 +18,12 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/mod_bom_standard.php
|
||||
* \ingroup bom
|
||||
* \file htdocs/core/modules/mymodule/mod_myobject_standard.php
|
||||
* \ingroup mymodule
|
||||
* \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
|
||||
@ -85,7 +86,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
|
||||
|
||||
$posindice=8;
|
||||
$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.= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -119,7 +120,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
|
||||
// D'abord on recupere la valeur max
|
||||
$posindice=9;
|
||||
$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.= " AND entity = ".$conf->entity;
|
||||
|
||||
@ -132,7 +133,7 @@ class mod_myobject_standard extends ModeleNumRefMyObject
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog("mod_bom_standard::getNextValue", LOG_DEBUG);
|
||||
dol_syslog("mod_myobject_standard::getNextValue", LOG_DEBUG);
|
||||
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
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,10 +23,9 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/modules/bom/modules_bom.php
|
||||
* \ingroup bom
|
||||
* \brief File that contains parent class for boms models
|
||||
* and parent class for boms numbering models
|
||||
* \file htdocs/core/modules/mymodule/modules_myobject.php
|
||||
* \ingroup mymodule
|
||||
* \brief File that contains parent class for myobjects document models and parent class for myobjects numbering models
|
||||
*/
|
||||
|
||||
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
|
||||
{
|
||||
@ -52,7 +51,7 @@ abstract class ModelePDFMyObject extends CommonDocGenerator
|
||||
// phpcs:enable
|
||||
global $conf;
|
||||
|
||||
$type = 'bom';
|
||||
$type = 'mymodule_myobject';
|
||||
$list = array();
|
||||
|
||||
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
|
||||
{
|
||||
@ -92,7 +91,7 @@ abstract class ModeleNumRefMyObject
|
||||
public function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mrp");
|
||||
$langs->load("mymodule@mymodule");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
@ -104,7 +103,7 @@ abstract class ModeleNumRefMyObject
|
||||
public function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("mrp");
|
||||
$langs->load("mymodule@mymodule");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
|
||||
@ -182,25 +182,39 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
// Record consumption
|
||||
$moline = new MoLine($db);
|
||||
|
||||
$result = $moline->create($user);
|
||||
if ($result <= 0) {
|
||||
$idstockmove = 0;
|
||||
if (! $error && GETPOST('idwarehouse-'.$line->id.'-'.$i) > 0) {
|
||||
// Record stock movement
|
||||
$id_product_batch = 0;
|
||||
$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 ($idstockmove < 0) {
|
||||
$error++;
|
||||
setEventMessages($moline->error, $moline->errors, 'errors');
|
||||
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
// Record stock movement
|
||||
$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);
|
||||
if ($result <= 0) {
|
||||
$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($stockmove->error, $stockmove->errors, 'errors');
|
||||
setEventMessages($moline->error, $moline->errors, 'errors');
|
||||
}
|
||||
|
||||
$pos++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -230,25 +244,39 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
// Record production
|
||||
$moline = new MoLine($db);
|
||||
|
||||
$result = $moline->create($user);
|
||||
if ($result <= 0) {
|
||||
$idstockmove = 0;
|
||||
if (! $error && GETPOST('idwarehousetoproduce-'.$line->id.'-'.$i) > 0) {
|
||||
// Record stock movement
|
||||
$id_product_batch = 0;
|
||||
$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 ($idstockmove < 0) {
|
||||
$error++;
|
||||
setEventMessages($moline->error, $moline->errors, 'errors');
|
||||
setEventMessages($stockmove->error, $stockmove->errors, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
// Record stock movement
|
||||
$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);
|
||||
if ($result <= 0) {
|
||||
$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($stockmove->error, $stockmove->errors, 'errors');
|
||||
setEventMessages($moline->error, $moline->errors, 'errors');
|
||||
}
|
||||
|
||||
$pos++;
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -261,9 +289,13 @@ if (empty($reshook))
|
||||
$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 {
|
||||
$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');
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,13 +305,11 @@ if (empty($reshook))
|
||||
} else {
|
||||
$db->commit();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -498,12 +528,13 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action == 'consumeandproduceall')
|
||||
{
|
||||
$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 '<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.'"> ';
|
||||
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 class="button" type="submit" value="'.$langs->trans("Confirm").'" name="confirm">';
|
||||
print ' ';
|
||||
|
||||
@ -97,7 +97,7 @@ class MouvementStock extends CommonObject
|
||||
* @param int $entrepot_id Id of warehouse
|
||||
* @param int $qty Qty of movement (can be <0 or >0 depending on parameter type)
|
||||
* @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)
|
||||
* 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.
|
||||
|
||||
@ -843,7 +843,11 @@ if (!$source)
|
||||
{
|
||||
$found = true;
|
||||
$tag = GETPOST("tag", 'alpha');
|
||||
$fulltag = "TAG=".$tag;
|
||||
if (GETPOST('fulltag', 'alpha')) {
|
||||
$fulltag = GETPOST('fulltag', 'alpha');
|
||||
} else {
|
||||
$fulltag = "TAG=".$tag;
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
$fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id;
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
if (GETPOST('fulltag', 'alpha')) {
|
||||
$fulltag = GETPOST('fulltag', 'alpha');
|
||||
} else {
|
||||
$fulltag = 'ORD='.$order->id.'.CUS='.$order->thirdparty->id;
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
}
|
||||
$fulltag = dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
@ -1029,9 +1037,12 @@ if ($source == 'invoice')
|
||||
$amount = price2num($amount);
|
||||
}
|
||||
|
||||
$fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id;
|
||||
//$fulltag.='.NAM='.strtr($invoice->thirdparty->name,"-"," ");
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
if (GETPOST('fulltag', 'alpha')) {
|
||||
$fulltag = GETPOST('fulltag', 'alpha');
|
||||
} else {
|
||||
$fulltag = 'INV='.$invoice->id.'.CUS='.$invoice->thirdparty->id;
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
}
|
||||
$fulltag = dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
@ -1202,9 +1213,12 @@ if ($source == 'contractline')
|
||||
$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');
|
||||
//$fulltag.='.NAM='.strtr($contract->thirdparty->name,"-"," ");
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
if (GETPOST('fulltag', 'alpha')) {
|
||||
$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; }
|
||||
}
|
||||
$fulltag = dol_string_unaccent($fulltag);
|
||||
|
||||
$qty = 1;
|
||||
@ -1367,8 +1381,12 @@ if ($source == 'membersubscription')
|
||||
$amount = price2num($amount);
|
||||
}
|
||||
|
||||
$fulltag = 'MEM='.$member->id.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M');
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
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; }
|
||||
}
|
||||
$fulltag = dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
@ -1531,8 +1549,12 @@ if ($source == 'donation')
|
||||
$amount = price2num($amount);
|
||||
}
|
||||
|
||||
$fulltag = 'DON='.$don->ref.'.DAT='.dol_print_date(dol_now(), '%Y%m%d%H%M');
|
||||
if (!empty($TAG)) { $tag = $TAG; $fulltag .= '.TAG='.$TAG; }
|
||||
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; }
|
||||
}
|
||||
$fulltag = dol_string_unaccent($fulltag);
|
||||
|
||||
// Creditor
|
||||
|
||||
@ -5173,9 +5173,17 @@ dd.dropdowndd ul li {
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
/* JMobile */
|
||||
/* JMobile - Android */
|
||||
/* ============================================================================== */
|
||||
|
||||
.searchpage .tagtr .tagtd {
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.searchpage .tagtr .tagtd .button {
|
||||
background: unset;
|
||||
border: unset;
|
||||
}
|
||||
|
||||
li.ui-li-divider .ui-link {
|
||||
color: #FFF !important;
|
||||
}
|
||||
|
||||
@ -5306,9 +5306,17 @@ dd.dropdowndd ul li {
|
||||
|
||||
|
||||
/* ============================================================================== */
|
||||
/* JMobile */
|
||||
/* JMobile - Android */
|
||||
/* ============================================================================== */
|
||||
|
||||
.searchpage .tagtr .tagtd {
|
||||
padding-bottom: 3px;
|
||||
}
|
||||
.searchpage .tagtr .tagtd .button {
|
||||
background: unset;
|
||||
border: unset;
|
||||
}
|
||||
|
||||
li.ui-li-divider .ui-link {
|
||||
color: #FFF !important;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user