Merge remote-tracking branch 'upstream/develop' into socialnetworks

This commit is contained in:
Frédéric FRANCE 2019-10-14 19:02:46 +02:00
commit 2351750d2b
No known key found for this signature in database
GPG Key ID: 06809324E4B2ABC1
21 changed files with 170 additions and 102 deletions

View File

@ -21,7 +21,9 @@
* \brief Page to activate/disable all modules * \brief Page to activate/disable all modules
*/ */
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', '1'); // Disabled because this page is into a popup on module search page and we want to avoid to have an Anti CSRF token error (done if MAIN_SECURITY_CSRF_WITH_TOKEN is on) when we make a second search after closing popup.
require '../main.inc.php'; require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';

View File

@ -94,6 +94,7 @@ class BOM extends CommonObject
'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'), 'fk_product' => array('type'=>'integer:Product:product/class/product.class.php', 'label'=>'Product', 'enabled'=>1, 'visible'=>1, 'position'=>35, 'notnull'=>1, 'index'=>1, 'help'=>'ProductBOMHelp'),
'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'), 'qty' => array('type'=>'real', 'label'=>'Quantity', 'enabled'=>1, 'visible'=>1, 'default'=>1, 'position'=>55, 'notnull'=>1, 'isameasure'=>'1', 'css'=>'maxwidth75imp'),
'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'), 'efficiency' => array('type'=>'real', 'label'=>'ManufacturingEfficiency', 'enabled'=>1, 'visible'=>-1, 'default'=>1, 'position'=>100, 'notnull'=>0, 'css'=>'maxwidth50imp', 'help'=>'ValueOfMeansLoss'),
'duration' => array('type'=>'real', 'label'=>'EstimatedDuration', 'enabled'=>1, 'visible'=>-1, 'position'=>101, 'notnull'=>-1, 'css'=>'maxwidth50imp', 'help'=>'EstimatedDurationDesc'),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,), 'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>-1, 'position'=>161, 'notnull'=>-1,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,), 'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>-1, 'position'=>162, 'notnull'=>-1,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,), 'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>300, 'notnull'=>1,),
@ -202,7 +203,7 @@ class BOM extends CommonObject
*/ */
public function create(User $user, $notrigger = false) public function create(User $user, $notrigger = false)
{ {
if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1; if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1;
return $this->createCommon($user, $notrigger); return $this->createCommon($user, $notrigger);
} }
@ -412,7 +413,7 @@ class BOM extends CommonObject
*/ */
public function update(User $user, $notrigger = false) public function update(User $user, $notrigger = false)
{ {
if ($this->efficiency < 0 || $this->efficiency > 1) $this->efficiency = 1; if ($this->efficiency <= 0 || $this->efficiency > 1) $this->efficiency = 1;
return $this->updateCommon($user, $notrigger); return $this->updateCommon($user, $notrigger);
} }

View File

@ -126,7 +126,7 @@ if (GETPOST('clearlist', 'int'))
if (GETPOST('exportcsv', 'int')) if (GETPOST('exportcsv', 'int'))
{ {
$completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'csv'; $completefilename = 'targets_emailing'.$object->id.'_'.dol_print_date(dol_now(), 'dayhourlog').'.csv';
header('Content-Type: text/csv'); header('Content-Type: text/csv');
header('Content-Disposition: attachment;filename=' . $completefilename); header('Content-Disposition: attachment;filename=' . $completefilename);

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2019 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com> * Copyright (C) 2009-2012 Regis Houssin <regis.houssin@inodbox.com>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr> * Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
@ -1241,14 +1241,17 @@ class FactureRec extends CommonInvoice
$result=''; $result='';
$label = '<u>' . $langs->trans("ShowInvoice") . '</u>'; $label = '<u>' . $langs->trans("ShowInvoice") . '</u>';
if (! empty($this->ref)) if (! empty($this->ref)) {
$label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref; $label .= '<br><b>'.$langs->trans('Ref') . ':</b> ' . $this->ref;
if (! empty($this->date_last_gen)) }
if ($this->frequency > 0) {
$label .= '<br><b>'.$langs->trans('Frequency') . ':</b> ' . $langs->trans('FrequencyPer_'.$this->unit_frequency, $this->frequency);
}
if (! empty($this->date_last_gen)) {
$label .= '<br><b>'.$langs->trans('DateLastGeneration') . ':</b> ' . dol_print_date($this->date_last_gen, 'dayhour'); $label .= '<br><b>'.$langs->trans('DateLastGeneration') . ':</b> ' . dol_print_date($this->date_last_gen, 'dayhour');
if ($this->frequency > 0) }
{ if ($this->frequency > 0) {
if (! empty($this->date_when)) if (! empty($this->date_when)) {
{
$label .= '<br><b>'.$langs->trans('NextDateToExecution') . ':</b> '; $label .= '<br><b>'.$langs->trans('NextDateToExecution') . ':</b> ';
$label .= (empty($this->suspended)?'':'<strike>'). dol_print_date($this->date_when, 'day').(empty($this->suspended)?'':'</strike>'); // No hour for this property $label .= (empty($this->suspended)?'':'<strike>'). dol_print_date($this->date_when, 'day').(empty($this->suspended)?'':'</strike>'); // No hour for this property
if (! empty($this->suspended)) $label .= ' ('.$langs->trans("Disabled").')'; if (! empty($this->suspended)) $label .= ' ('.$langs->trans("Disabled").')';

View File

@ -1233,7 +1233,7 @@ class Facture extends CommonInvoice
*/ */
public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '') public function getNomUrl($withpicto = 0, $option = '', $max = 0, $short = 0, $moretitle = '', $notooltip = 0, $addlinktonotes = 0, $save_lastsearch_value = -1, $target = '')
{ {
global $langs, $conf, $user; global $langs, $conf, $user, $mysoc;
if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips
@ -1276,11 +1276,11 @@ class Facture extends CommonInvoice
if (! empty($this->total_ht)) if (! empty($this->total_ht))
$label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountHT') . ':</b> ' . price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_tva)) if (! empty($this->total_tva))
$label.= '<br><b>' . $langs->trans('VAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountVAT') . ':</b> ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000' if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000'
$label.= '<br><b>' . $langs->trans('LT1') . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->transcountry('AmountLT1', $mysoc->country_code) . ':</b> ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_localtax2) && $this->total_localtax2 != 0) if (! empty($this->total_localtax2) && $this->total_localtax2 != 0)
$label.= '<br><b>' . $langs->trans('LT2') . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->transcountry('AmountLT2', $mysoc->country_code) . ':</b> ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency);
if (! empty($this->total_ttc)) if (! empty($this->total_ttc))
$label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); $label.= '<br><b>' . $langs->trans('AmountTTC') . ':</b> ' . price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency);
if ($moretitle) $label.=' - '.$moretitle; if ($moretitle) $label.=' - '.$moretitle;

View File

@ -154,7 +154,7 @@ if (empty($reshook))
// Create predefined invoice // Create predefined invoice
if ($action == 'add') if ($action == 'add')
{ {
if (! GETPOST('titre')) if (! GETPOST('titre', 'nohtml'))
{ {
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors'); setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
$action = "create"; $action = "create";
@ -162,15 +162,15 @@ if (empty($reshook))
} }
$frequency=GETPOST('frequency', 'int'); $frequency=GETPOST('frequency', 'int');
$reyear=GETPOST('reyear'); $reyear=GETPOST('reyear', 'int');
$remonth=GETPOST('remonth'); $remonth=GETPOST('remonth', 'int');
$reday=GETPOST('reday'); $reday=GETPOST('reday', 'int');
$rehour=GETPOST('rehour'); $rehour=GETPOST('rehour', 'int');
$remin=GETPOST('remin'); $remin=GETPOST('remin', 'int');
$nb_gen_max=GETPOST('nb_gen_max', 'int'); $nb_gen_max=GETPOST('nb_gen_max', 'int');
//if (empty($nb_gen_max)) $nb_gen_max =0; //if (empty($nb_gen_max)) $nb_gen_max =0;
if (GETPOST('frequency')) if (GETPOST('frequency', 'int'))
{ {
if (empty($reyear) || empty($remonth) || empty($reday)) if (empty($reyear) || empty($remonth) || empty($reday))
{ {
@ -188,12 +188,12 @@ if (empty($reshook))
if (! $error) if (! $error)
{ {
$object->titre = GETPOST('titre', 'alpha'); // deprecated $object->titre = GETPOST('titre', 'nohtml'); // deprecated
$object->title = GETPOST('titre', 'alpha'); $object->title = GETPOST('titre', 'nohtml');
$object->note_private = GETPOST('note_private', 'none'); $object->note_private = GETPOST('note_private', 'none');
$object->note_public = GETPOST('note_public', 'none'); $object->note_public = GETPOST('note_public', 'none');
$object->modelpdf = GETPOST('modelpdf', 'alpha'); $object->modelpdf = GETPOST('modelpdf', 'alpha');
$object->usenewprice = GETPOST('usenewprice'); $object->usenewprice = GETPOST('usenewprice', 'alpha');
$object->frequency = $frequency; $object->frequency = $frequency;
$object->unit_frequency = GETPOST('unit_frequency', 'alpha'); $object->unit_frequency = GETPOST('unit_frequency', 'alpha');

View File

@ -48,7 +48,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
?> ?>
<tr class="<?php echo $trclass; ?>" > <tr class="<?php echo $trclass; ?>" >
<td class="linkedcol-element"><?php echo $langs->trans("RepeatableInvoice"); ?></td> <td class="linkedcol-element"><?php echo $langs->trans("RepeatableInvoice"); ?></td>
<td class="linkedcol-name nowraponall"><?php echo $objectlink->getNomUrl(1); ?></td> <td class="linkedcol-name"><!-- nowraponall because ref is a label --><?php echo $objectlink->getNomUrl(1); ?></td>
<td class="linkedcol-ref" align="center"></td> <td class="linkedcol-ref" align="center"></td>
<td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td> <td class="linkedcol-date" align="center"><?php echo dol_print_date($objectlink->date_when, 'day'); ?></td>
<td class="linkedcol-amount right"><?php <td class="linkedcol-amount right"><?php

View File

@ -142,7 +142,7 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0)
{ {
dol_print_error($bprev->error); dol_print_error($bprev->error);
} }
print '<table class="border" width="100%">'; print '<table class="border centpercent tableforfield">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfInvoiceToWithdraw").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
print '<td>'; print '<td>';
@ -161,6 +161,7 @@ print '</div>';
if ($mesg) print $mesg; if ($mesg) print $mesg;
print "<div class=\"tabsAction\">\n"; print "<div class=\"tabsAction\">\n";
print '<form action="' . $_SERVER['PHP_SELF'] . '?action=create" method="POST">'; print '<form action="' . $_SERVER['PHP_SELF'] . '?action=create" method="POST">';
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">'; print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
if ($nb) { if ($nb) {
@ -193,6 +194,7 @@ else
} }
print "</form>\n"; print "</form>\n";
print "</div>\n"; print "</div>\n";
print '<br>'; print '<br>';
@ -245,7 +247,7 @@ if ($resql)
print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit); print_barre_liste($langs->trans("InvoiceWaitingWithdraw"), $page, $_SERVER['PHP_SELF'], $param, '', '', '', $num, $nbtotalofrecords, 'invoicing', 0, '', '', $limit);
print '<table class="noborder" width="100%">'; print '<table class="noborder centpercent">';
print '<tr class="liste_titre">'; print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Invoice").'</td>'; print '<td>'.$langs->trans("Invoice").'</td>';
print '<td>'.$langs->trans("ThirdParty").'</td>'; print '<td>'.$langs->trans("ThirdParty").'</td>';
@ -299,7 +301,10 @@ if ($resql)
$i++; $i++;
} }
} }
else print '<tr class="oddeven"><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>'; else
{
print '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
}
print "</table>"; print "</table>";
print "</form>"; print "</form>";
print "<br>\n"; print "<br>\n";

View File

@ -1559,9 +1559,9 @@ else
print '<td>'.$langs->trans("ServiceNb", $cursorline).'</td>'; print '<td>'.$langs->trans("ServiceNb", $cursorline).'</td>';
print '<td width="80" class="center">'.$langs->trans("VAT").'</td>'; print '<td width="80" class="center">'.$langs->trans("VAT").'</td>';
print '<td width="80" class="right">'.$langs->trans("PriceUHT").'</td>'; print '<td width="80" class="right">'.$langs->trans("PriceUHT").'</td>';
if (!empty($conf->multicurrency->enabled)) { //if (!empty($conf->multicurrency->enabled)) {
print '<td width="80" class="right">'.$langs->trans("PriceUHTCurrency").'</td>'; // print '<td width="80" class="right">'.$langs->trans("PriceUHTCurrency").'</td>';
} //}
print '<td width="30" class="center">'.$langs->trans("Qty").'</td>'; print '<td width="30" class="center">'.$langs->trans("Qty").'</td>';
if ($conf->global->PRODUCT_USE_UNITS) print '<td width="30" class="left">'.$langs->trans("Unit").'</td>'; if ($conf->global->PRODUCT_USE_UNITS) print '<td width="30" class="left">'.$langs->trans("Unit").'</td>';
print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>'; print '<td width="50" class="right">'.$langs->trans("ReductionShort").'</td>';
@ -1571,8 +1571,7 @@ else
$objp = $db->fetch_object($result); $objp = $db->fetch_object($result);
// // Line in view mode
if ($action != 'editline' || GETPOST('rowid') != $objp->rowid) if ($action != 'editline' || GETPOST('rowid') != $objp->rowid)
{ {
print '<tr class="tdtop oddeven">'; print '<tr class="tdtop oddeven">';
@ -1608,21 +1607,21 @@ else
{ {
print '<td>'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."</td>\n"; print '<td>'.img_object($langs->trans("ShowProductOrService"), ($objp->product_type ? 'service' : 'product')).' '.dol_htmlentitiesbr($objp->description)."</td>\n";
} }
// TVA // VAT
print '<td class="center">'; print '<td class="center">';
print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits); print vatrate($objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), '%', $objp->info_bits);
print '</td>'; print '</td>';
// Price // Price
print '<td class="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n"; print '<td class="right">'.($objp->subprice != '' ? price($objp->subprice) : '')."</td>\n";
// Price multicurrency // Price multicurrency
if (!empty($conf->multicurrency->enabled)) { /*if (!empty($conf->multicurrency->enabled)) {
print '<td class="linecoluht_currency nowrap right">'.price($objp->multicurrency_subprice).'</td>'; print '<td class="linecoluht_currency nowrap right">'.price($objp->multicurrency_subprice).'</td>';
} }*/
// Quantite // Quantity
print '<td class="center">'.$objp->qty.'</td>'; print '<td class="center">'.$objp->qty.'</td>';
// Unit // Unit
if($conf->global->PRODUCT_USE_UNITS) print '<td class="left">'.$langs->trans($object->lines[$cursorline-1]->getLabelOfUnit()).'</td>'; if($conf->global->PRODUCT_USE_UNITS) print '<td class="left">'.$langs->trans($object->lines[$cursorline-1]->getLabelOfUnit()).'</td>';
// Remise // Discount
if ($objp->remise_percent > 0) if ($objp->remise_percent > 0)
{ {
print '<td class="right">'.$objp->remise_percent."%</td>\n"; print '<td class="right">'.$objp->remise_percent."%</td>\n";
@ -1711,7 +1710,7 @@ else
print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="oddeven"', 'colspan'=>$colspan), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
} }
// Ligne en mode update // Line in mode update
else else
{ {
// Ligne carac // Ligne carac
@ -1741,18 +1740,34 @@ else
$doleditor->Create(); $doleditor->Create();
print '</td>'; print '</td>';
// VAT
print '<td class="right">'; print '<td class="right">';
print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1); print $form->load_tva("eltva_tx", $objp->tva_tx.($objp->vat_src_code?(' ('.$objp->vat_src_code.')'):''), $mysoc, $object->thirdparty, $objp->fk_product, $objp->info_bits, $objp->product_type, 0, 1);
print '</td>'; print '</td>';
// Price
print '<td class="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>'; print '<td class="right"><input size="5" type="text" name="elprice" value="'.price($objp->subprice).'"></td>';
// Price multicurrency
/*if (!empty($conf->multicurrency->enabled)) {
print '<td class="linecoluht_currency nowrap right">'.price($objp->multicurrency_subprice).'</td>';
}*/
// Quantity
print '<td class="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>'; print '<td class="center"><input size="2" type="text" name="elqty" value="'.$objp->qty.'"></td>';
// Unit
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
print '<td class="left">'; print '<td class="left">';
print $form->selectUnits($objp->fk_unit, "unit"); print $form->selectUnits($objp->fk_unit, "unit");
print '</td>'; print '</td>';
} }
// Discount
print '<td class="nowrap right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>'; print '<td class="nowrap right"><input size="1" type="text" name="elremise_percent" value="'.$objp->remise_percent.'">%</td>';
if (! empty($usemargins)) if (! empty($usemargins))
{ {
print '<td class="right">'; print '<td class="right">';
@ -2063,6 +2078,7 @@ else
if ($action != 'editline') if ($action != 'editline')
{ {
$forcetoshowtitlelines=1; $forcetoshowtitlelines=1;
if (empty($object->multicurrency_code)) $object->multicurrency_code = $conf->currency; // TODO Remove this when multicurrency supported on contracts
// Add free products/services // Add free products/services
$object->formAddObjectLine(1, $mysoc, $soc); $object->formAddObjectLine(1, $mysoc, $soc);

View File

@ -2579,8 +2579,7 @@ abstract class CommonObject
public function updateRangOfLine($rowid, $rang) public function updateRangOfLine($rowid, $rang)
{ {
$fieldposition = 'rang'; // @TODO Rename 'rang' into 'position' $fieldposition = 'rang'; // @TODO Rename 'rang' into 'position'
if (in_array($this->table_element_line, array('ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position'; if (in_array($this->table_element_line, array('bom_bomline', 'ecm_files', 'emailcollector_emailcollectoraction'))) $fieldposition = 'position';
if (in_array($this->table_element_line, array('bom_bomline'))) $fieldposition = 'position';
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang; $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element_line.' SET '.$fieldposition.' = '.$rang;
$sql.= ' WHERE rowid = '.$rowid; $sql.= ' WHERE rowid = '.$rowid;
@ -2886,11 +2885,11 @@ abstract class CommonObject
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_PROPOSAL";
elseif ($this->element == 'commande' || $this->element == 'order') elseif ($this->element == 'commande' || $this->element == 'order')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_ORDER";
elseif ($this->element == 'facture') elseif ($this->element == 'facture' || $this->element == 'invoice')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_INVOICE";
elseif ($this->element == 'facture_fourn') elseif ($this->element == 'facture_fourn' || $this->element == 'supplier_invoice')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_INVOICE";
elseif ($this->element == 'order_supplier') elseif ($this->element == 'order_supplier' || $this->element == 'supplier_order')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_ORDER";
elseif ($this->element == 'supplier_proposal') elseif ($this->element == 'supplier_proposal')
$MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL"; $MODULE = "MODULE_DISALLOW_UPDATE_PRICE_SUPPLIER_PROPOSAL";
@ -6278,18 +6277,12 @@ abstract class CommonObject
$value=''; $value='';
} }
} }
elseif ($type == 'double') elseif ($type == 'double' || $type == 'real')
{ {
if (!empty($value)) { if (!empty($value)) {
$value=price($value); $value=price($value);
} }
} }
elseif ($type == 'real')
{
if (!empty($value)) {
$value=price($value);
}
}
elseif ($type == 'boolean') elseif ($type == 'boolean')
{ {
$checked=''; $checked='';
@ -7122,7 +7115,7 @@ abstract class CommonObject
* Function test if type is array * Function test if type is array
* *
* @param array $info content informations of field * @param array $info content informations of field
* @return bool * @return bool true if array
*/ */
protected function isArray($info) protected function isArray($info)
{ {
@ -7131,42 +7124,26 @@ abstract class CommonObject
if(isset($info['type']) && $info['type']=='array') return true; if(isset($info['type']) && $info['type']=='array') return true;
else return false; else return false;
} }
else return false; return false;
}
/**
* Function test if type is null
*
* @param array $info content informations of field
* @return bool
*/
protected function isNull($info)
{
if(is_array($info))
{
if(isset($info['type']) && $info['type']=='null') return true;
else return false;
}
else return false;
} }
/** /**
* Function test if type is date * Function test if type is date
* *
* @param array $info content informations of field * @param array $info content informations of field
* @return bool * @return bool true if date
*/ */
public function isDate($info) public function isDate($info)
{ {
if(isset($info['type']) && ($info['type']=='date' || $info['type']=='datetime' || $info['type']=='timestamp')) return true; if(isset($info['type']) && ($info['type']=='date' || $info['type']=='datetime' || $info['type']=='timestamp')) return true;
else return false; return false;
} }
/** /**
* Function test if type is integer * Function test if type is integer
* *
* @param array $info content informations of field * @param array $info content informations of field
* @return bool * @return bool true if integer
*/ */
public function isInt($info) public function isInt($info)
{ {
@ -7182,7 +7159,7 @@ abstract class CommonObject
* Function test if type is float * Function test if type is float
* *
* @param array $info content informations of field * @param array $info content informations of field
* @return bool * @return bool true if float
*/ */
public function isFloat($info) public function isFloat($info)
{ {
@ -7191,14 +7168,14 @@ abstract class CommonObject
if (isset($info['type']) && (preg_match('/^(double|real|price)/i', $info['type']))) return true; if (isset($info['type']) && (preg_match('/^(double|real|price)/i', $info['type']))) return true;
else return false; else return false;
} }
else return false; return false;
} }
/** /**
* Function test if type is text * Function test if type is text
* *
* @param array $info content informations of field * @param array $info content informations of field
* @return bool * @return bool true if type text
*/ */
public function isText($info) public function isText($info)
{ {
@ -7207,7 +7184,39 @@ abstract class CommonObject
if(isset($info['type']) && $info['type']=='text') return true; if(isset($info['type']) && $info['type']=='text') return true;
else return false; else return false;
} }
else return false; return false;
}
/**
* Function test if field can be null
*
* @param array $info content informations of field
* @return bool true if it can be null
*/
protected function canBeNull($info)
{
if(is_array($info))
{
if(isset($info['notnull']) && $info['notnull']!='1') return true;
else return false;
}
return true;
}
/**
* Function test if field is forced to null if zero or empty
*
* @param array $info content informations of field
* @return bool true if forced to null
*/
protected function isForcedToNullIfZero($info)
{
if(is_array($info))
{
if(isset($info['notnull']) && $info['notnull']=='-1') return true;
else return false;
}
return false;
} }
/** /**
@ -7223,7 +7232,7 @@ abstract class CommonObject
if(isset($info['index']) && $info['index']==true) return true; if(isset($info['index']) && $info['index']==true) return true;
else return false; else return false;
} }
else return false; return false;
} }
/** /**
@ -7316,17 +7325,30 @@ abstract class CommonObject
elseif($this->isInt($info)) elseif($this->isInt($info))
{ {
if ($field == 'rowid') $this->id = (int) $obj->{$field}; if ($field == 'rowid') $this->id = (int) $obj->{$field};
else $this->{$field} = (int) $obj->{$field}; else
{
if ($this->isForcedToNullIfZero($info))
{
if (empty($obj->{$field})) $this->{$field} = null;
else $this->{$field} = (double) $obj->{$field};
}
else
{
$this->{$field} = (int) $obj->{$field};
}
}
} }
elseif($this->isFloat($info)) elseif($this->isFloat($info))
{ {
$this->{$field} = (double) $obj->{$field}; if ($this->isForcedToNullIfZero($info))
} {
elseif($this->isNull($info)) if (empty($obj->{$field})) $this->{$field} = null;
{ else $this->{$field} = (double) $obj->{$field};
$val = $obj->{$field}; }
// zero is not null else
$this->{$field} = (is_null($val) || (empty($val) && $val!==0 && $val!=='0') ? null : $val); {
$this->{$field} = (double) $obj->{$field};
}
} }
else else
{ {
@ -7383,6 +7405,7 @@ abstract class CommonObject
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now); if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) $fieldvalues['date_creation']=$this->db->idate($now);
if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id; if (array_key_exists('fk_user_creat', $fieldvalues) && ! ($fieldvalues['fk_user_creat'] > 0)) $fieldvalues['fk_user_creat']=$user->id;
unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert. unset($fieldvalues['rowid']); // The field 'rowid' is reserved field name for autoincrement field so we don't need it into insert.
if (array_key_exists('ref', $fieldvalues)) $fieldvalues['ref']=dol_string_nospecial($fieldvalues['ref']); // If field is a ref,we sanitize data
$keys=array(); $keys=array();
$values = array(); $values = array();

View File

@ -54,14 +54,14 @@ class modBom extends DolibarrModules
// It is used to group modules by family in module setup page // It is used to group modules by family in module setup page
$this->family = "products"; $this->family = "products";
// Module position in the family on 2 digits ('01', '10', '20', ...) // Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '90'; $this->module_position = '60';
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
// Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module). // Module label (no space allowed), used if translation string 'ModuleBomName' not found (Bom is name of module).
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module). // Module description, used if translation string 'ModuleBomDesc' not found (Bom is name of module).
$this->description = "Bill of Materials (BOM) definitions for Manufacturing Resource Planning"; $this->description = "Module to define your Bills Of Materials (BOM). Can be used for Manufacturing Resource Planning by the module Manufacturing Orders (MO)";
// Used only if file README.md and README-LL.md not found. // Used only if file README.md and README-LL.md not found.
$this->descriptionlong = "Bill of Materials definitions. They can be used to make Manufacturing Resource Planning"; $this->descriptionlong = "Bill of Materials definitions. They can be used to make Manufacturing Resource Planning";
@ -75,7 +75,7 @@ class modBom extends DolibarrModules
// Name of image file used for this module. // Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue' // If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module' // If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='generic'; $this->picto='bom';
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...) // Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array( $this->module_parts = array(

View File

@ -53,6 +53,8 @@ class modVariants extends DolibarrModules
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page // It is used to group modules in module setup page
$this->family = "products"; $this->family = "products";
// Module position in the family on 2 digits ('01', '10', '20', ...)
$this->module_position = '50';
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i', '', get_class($this)); $this->name = preg_replace('/^mod/i', '', get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)

View File

@ -49,6 +49,8 @@ UPDATE llx_c_units SET label = 'SurfaceUnitm2' WHERE code IN ('M2');
-- For v11 -- For v11
ALTER TABLE llx_bom_bom ADD COLUMN duration double(8,4) DEFAULT NULL;
create table llx_categorie_warehouse create table llx_categorie_warehouse
( (
fk_categorie integer NOT NULL, fk_categorie integer NOT NULL,

View File

@ -26,6 +26,7 @@ CREATE TABLE llx_bom_bom(
fk_product integer, fk_product integer,
qty double(24,8), qty double(24,8),
efficiency double(8,4) DEFAULT 1, efficiency double(8,4) DEFAULT 1,
duration double(8,4) DEFAULT NULL,
date_creation datetime NOT NULL, date_creation datetime NOT NULL,
date_valid datetime, date_valid datetime,
tms timestamp, tms timestamp,

View File

@ -1,6 +1,10 @@
Mrp=Manufacturing Orders
MRPDescription=Module to manage Manufacturing Orders (MO).
MRPArea=MRP Area MRPArea=MRP Area
MrpSetupPage=Setup of module MO
MenuBOM=Bills of material MenuBOM=Bills of material
LatestBOMModified=Latest %s Bills of materials modified LatestBOMModified=Latest %s Bills of materials modified
Bom=Bills of Material
BillOfMaterials=Bill of Material BillOfMaterials=Bill of Material
BOMsSetup=Setup of module BOM BOMsSetup=Setup of module BOM
ListOfBOMs=List of bills of material - BOM ListOfBOMs=List of bills of material - BOM
@ -22,3 +26,5 @@ QtyToProduce=Qty to produce
DateStartPlannedMo=Date start planned DateStartPlannedMo=Date start planned
DateEndPlannedMo=Date end planned DateEndPlannedMo=Date end planned
KeepEmptyForAsap=Empty means 'As Soon As Possible' KeepEmptyForAsap=Empty means 'As Soon As Possible'
EstimatedDuration=Estimated duration
EstimatedDurationDesc=Estimated duration to manufacture this product using this BOM

View File

@ -171,7 +171,7 @@ $arrayfields=array(
'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->service->enabled))), 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->service->enabled))),
'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))),
'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled) && (string) $type == '1')),
'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled))), 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled))),
'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))),
'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))),
@ -604,7 +604,7 @@ if ($resql)
print '</td>'; print '</td>';
} }
// Duration // Duration
if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) if (! empty($arrayfields['p.duration']['checked']))
{ {
print '<td class="liste_titre">'; print '<td class="liste_titre">';
print '</td>'; print '</td>';
@ -748,7 +748,7 @@ if ($resql)
if (! empty($arrayfields['p.barcode']['checked'])) { if (! empty($arrayfields['p.barcode']['checked'])) {
print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder); print_liste_field_titre($arrayfields['p.barcode']['label'], $_SERVER["PHP_SELF"], "p.barcode", "", $param, "", $sortfield, $sortorder);
} }
if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) { if (! empty($arrayfields['p.duration']['checked'])) {
print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, '', $sortfield, $sortorder, 'center '); print_liste_field_titre($arrayfields['p.duration']['label'], $_SERVER["PHP_SELF"], "p.duration", "", $param, '', $sortfield, $sortorder, 'center ');
} }
if (! empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['p.weight']['checked'])) print_liste_field_titre($arrayfields['p.weight']['label'], $_SERVER["PHP_SELF"], "p.weight", "", $param, '', $sortfield, $sortorder, 'center ');
@ -921,7 +921,7 @@ if ($resql)
} }
// Duration // Duration
if ((string) $type == '1' && ! empty($arrayfields['p.duration']['checked'])) if (! empty($arrayfields['p.duration']['checked']))
{ {
print '<td class="center nowraponall">'; print '<td class="center nowraponall">';
@ -939,9 +939,9 @@ if ($resql)
$dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year")); $dur=array("i"=>$langs->trans("Minute"),"h"=>$langs->trans("Hour"),"d"=>$langs->trans("Day"),"w"=>$langs->trans("Week"),"m"=>$langs->trans("Month"),"y"=>$langs->trans("Year"));
} }
print $duration_value; print $duration_value;
print (! empty($duration_unit) && isset($dur[$duration_unit]) ? ' '.$langs->trans($dur[$duration_unit]) : ''); print ((! empty($duration_unit) && isset($dur[$duration_unit]) && $duration_value != '') ? ' '.$langs->trans($dur[$duration_unit]) : '');
} }
else elseif (! preg_match('/^[a-z]$/i', $obj->duration)) // If duration is a simple char (like 's' of 'm'), we do not show value
{ {
print $obj->duration; print $obj->duration;
} }

View File

@ -785,6 +785,9 @@ table[summary="list_of_modules"] .fa-cog {
font-size: 1.5em; font-size: 1.5em;
} }
.linkedcol-element {
min-width: 100px;
}
/* ============================================================================== */ /* ============================================================================== */
/* Styles to hide objects */ /* Styles to hide objects */
@ -865,6 +868,10 @@ table[summary="list_of_modules"] .fa-cog {
.minwidth300imp { min-width: 300px !important; } .minwidth300imp { min-width: 300px !important; }
.minwidth400imp { min-width: 300px !important; } .minwidth400imp { min-width: 300px !important; }
.minwidth500imp { min-width: 300px !important; } .minwidth500imp { min-width: 300px !important; }
.linkedcol-element {
min-width: unset;
}
} }
/* Force values for small screen 1000 */ /* Force values for small screen 1000 */
@ -1101,8 +1108,8 @@ div.blockvmenulogo
} }
.menulogocontainer { .menulogocontainer {
margin: <?php echo $disableimages?'0':'6'; ?>px; margin: <?php echo $disableimages?'0':'6'; ?>px;
margin-left: 8px; margin-left: 12px;
margin-right: 8px; margin-right: 4px;
padding: 0; padding: 0;
height: <?php echo $disableimages?'20':'32'; ?>px; height: <?php echo $disableimages?'20':'32'; ?>px;
/* width: 100px; */ /* width: 100px; */

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

View File

@ -70,7 +70,7 @@ $colorbackbody='255,255,255';
$colortexttitlenotab='110,80,20'; $colortexttitlenotab='110,80,20';
$colortexttitle='0,0,0'; $colortexttitle='0,0,0';
$colortext='0,0,0'; $colortext='0,0,0';
$colortextlink='10, 20, 120'; $colortextlink='10, 20, 110';
$fontsize='0.86em'; $fontsize='0.86em';
$fontsizesmaller='0.75em'; $fontsizesmaller='0.75em';
$topMenuFontSize='1.2em'; $topMenuFontSize='1.2em';

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B