This commit is contained in:
Frédéric FRANCE
2019-10-20 11:17:54 +02:00
parent 66b0c27645
commit 33c35780e0
26 changed files with 479 additions and 506 deletions

View File

@@ -539,7 +539,9 @@ class Setup extends DolibarrApi
$sql.= " WHERE t.active = ".$active; $sql.= " WHERE t.active = ".$active;
if (!empty($multicurrency)) { if (!empty($multicurrency)) {
$sql.= " AND m.entity IN (".getEntity('multicurrency').")"; $sql.= " AND m.entity IN (".getEntity('multicurrency').")";
if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; if (!empty($multicurrency) && $multicurrency != 2) {
$sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)";
}
} }
// Add sql filters // Add sql filters

View File

@@ -47,22 +47,20 @@ $colspan = 3; // Columns: total ht + col edit + col delete
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php --> print "<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->\n";
<?php
$nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines); $nolinesbefore=(count($this->lines) == 0 || $forcetoshowtitlelines);
if ($nolinesbefore) { if ($nolinesbefore) {
?> print '<tr class="liste_titre'.($nolinesbefore?'':' liste_titre_add_').' nodrag nodrop">';
<tr class="liste_titre<?php echo ($nolinesbefore?'':' liste_titre_add_') ?> nodrag nodrop"> if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> print '<td class="linecolnum center"></td>';
<td class="linecolnum center"></td> }
<?php } ?> print '<td class="linecoldescription minwidth500imp">';
<td class="linecoldescription minwidth500imp"> print '<div id="add"></div><span class="hideonsmartphone">'.$langs->trans('AddNewLine').'</span>';
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?> // echo $langs->trans("FreeZone");
</td> print '</td>';
<td class="linecolqty right"><?php echo $langs->trans('Qty'); ?></td> print '<td class="linecolqty right">'.$langs->trans('Qty').'</td>';
<?php
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
print '<td class="linecoluseunit left">'; print '<td class="linecoluseunit left">';
@@ -70,15 +68,11 @@ if ($nolinesbefore) {
print $langs->trans('Unit'); print $langs->trans('Unit');
print '</span></td>'; print '</span></td>';
} }
?> print '<td class="linecollost right">'.$form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')).'</td>';
<td class="linecollost right"><?php echo $form->textwithpicto($langs->trans('ManufacturingEfficiency'), $langs->trans('ValueOfMeansLoss')); ?></td> print '<td class="linecoledit" colspan="'.$colspan.'">&nbsp;</td>';
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td> print '</tr>';
</tr>
<?php
} }
?> print '<tr class="pair nodrag nodrop nohoverpair'.($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'.'">';
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_create'; ?>">
<?php
$coldisplay=0; $coldisplay=0;
// Adds a line numbering column // Adds a line numbering column
@@ -88,10 +82,8 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom linecoldescription minwidth500imp">';
<td class="nobottom linecoldescription minwidth500imp">
<?php
// Predefined product/service // Predefined product/service
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) if (! empty($conf->product->enabled) || ! empty($conf->service->enabled))
{ {
@@ -115,10 +107,8 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="'.(isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1).'">';
<td class="nobottom linecolqty right"><input type="text" size="2" name="qty" id="qty" class="flat right" value="<?php echo (isset($_POST["qty"])?GETPOST("qty", 'alpha', 2):1); ?>"> print '</td>';
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
$coldisplay++; $coldisplay++;
@@ -128,18 +118,18 @@ if ($nolinesbefore) {
} }
$coldisplay++; $coldisplay++;
?>
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo (GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1); ?>"></td> print '<td class="nobottom nowrap linecollost right">';
<?php print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.(GETPOSTISSET("efficiency")?GETPOST("efficiency", 'alpha'):1).'">';
print '</td>';
$coldisplay += $colspan; $coldisplay += $colspan;
?> print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>"> print '<input type="submit" class="button" value="'.$langs->trans('Add').'" name="addline" id="addline">';
<input type="submit" class="button" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline"> print '</td>';
</td> print '</tr>';
</tr>
<?php
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }

View File

@@ -49,19 +49,16 @@ $colspan = 3; // Columns: total ht + col edit + col delete
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($this->db); $objectline = new BOMLine($this->db);
?>
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php --> print "<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->\n";
<?php
$coldisplay=0; $coldisplay=0;
?> print '<tr class="oddeven tredited">';
<tr class="oddeven tredited">
<?php
// Adds a line numbering column // Adds a line numbering column
if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> print '<td class="linecolnum center">'.($i+1).'</td>';
<?php } $coldisplay++;
}
$coldisplay++; $coldisplay++;
?> ?>
@@ -89,10 +86,8 @@ $coldisplay=0;
$reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action); $reshook=$hookmanager->executeHooks('formEditProductOptions', $parameters, $this, $action);
} }
?> print '</td>';
</td>
<?php
/*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines /*if ($object->element == 'supplier_proposal' || $object->element == 'order_supplier' || $object->element == 'invoice_supplier') // We must have same test in printObjectLines
{ {
$coldisplay++; $coldisplay++;
@@ -102,19 +97,17 @@ $coldisplay=0;
*/ */
$coldisplay++; $coldisplay++;
?>
<td class="nobottom linecolqty right"> print '<td class="nobottom linecolqty right">';
<?php if (($line->info_bits & 2) != 2) { if (($line->info_bits & 2) != 2) {
// I comment this because it shows info even when not required // I comment this because it shows info even when not required
// for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated // for example always visible on invoice but must be visible only if stock module on and stock decrease option is on invoice validation and status is not validated
// must also not be output for most entities (proposal, intervention, ...) // must also not be output for most entities (proposal, intervention, ...)
//if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." "; //if($line->qty > $line->stock) print img_picto($langs->trans("StockTooLow"),"warning", 'style="vertical-align: bottom;"')." ";
print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '">'; print '<input size="3" type="text" class="flat right" name="qty" id="qty" value="' . $line->qty . '">';
} }
?> print '</td>';
</td>
<?php
if ($conf->global->PRODUCT_USE_UNITS) if ($conf->global->PRODUCT_USE_UNITS)
{ {
$coldisplay++; $coldisplay++;
@@ -124,22 +117,20 @@ $coldisplay=0;
} }
$coldisplay++; $coldisplay++;
?> print '<td class="nobottom nowrap linecollost right">';
<td class="nobottom nowrap linecollost right"><input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="<?php echo $line->efficiency; ?>"></td> print '<input type="text" size="1" name="efficiency" id="efficiency" class="flat right" value="'.$line->efficiency.'"></td>';
<?php
$coldisplay+=$colspan; $coldisplay+=$colspan;
?> print '<td class="nobottom linecoledit center valignmiddle" colspan="'.$colspan.'">';
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay+=$colspan; ?> $coldisplay+=$colspan;
<input type="submit" class="button" id="savelinebutton" name="save" value="<?php echo $langs->trans("Save"); ?>"><br> print '<input type="submit" class="button" id="savelinebutton" name="save" value="'.$langs->trans("Save").'">';
<input type="submit" class="button" id="cancellinebutton" name="cancel" value="<?php echo $langs->trans("Cancel"); ?>"> print '<br>';
</td> print '<input type="submit" class="button" id="cancellinebutton" name="cancel" value="'.$langs->trans("Cancel").'">';
</tr> print '</td>';
print '</tr>';
<?php
if (is_object($objectline)) { if (is_object($objectline)) {
print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $objectline->showOptionals($extrafields, 'edit', array('style'=>$bcnd[$var], 'colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?>
<!-- END PHP TEMPLATE objectline_edit.tpl.php --> print "<!-- END PHP TEMPLATE objectline_edit.tpl.php -->\n";

View File

@@ -39,9 +39,7 @@ if (empty($object) || ! is_object($object))
print "Error, template page can't be called as URL"; print "Error, template page can't be called as URL";
exit; exit;
} }
?> print "<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->\n";
<!-- BEGIN PHP TEMPLATE objectline_title.tpl.php -->
<?php
// Title line // Title line
print "<thead>\n"; print "<thead>\n";
@@ -79,6 +77,5 @@ if ($action == 'selectlines')
print "</tr>\n"; print "</tr>\n";
print "</thead>\n"; print "</thead>\n";
?>
<!-- END PHP TEMPLATE objectline_title.tpl.php --> print "<!-- END PHP TEMPLATE objectline_title.tpl.php -->\n";

View File

@@ -59,27 +59,25 @@ $domData .= ' data-product_type="'.$line->product_type.'"';
// Lines for extrafield // Lines for extrafield
$objectline = new BOMLine($object->db); $objectline = new BOMLine($object->db);
?> $coldisplay=0;
<?php $coldisplay=0; ?> print "<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php -->\n";
<!-- BEGIN PHP TEMPLATE objectline_view.tpl.php --> print '<tr id="row-'.$line->id.'" class="drag drop oddeven" '.$domData.' >';
<tr id="row-<?php echo $line->id?>" class="drag drop oddeven" <?php echo $domData; ?> > if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) {
<?php if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { ?> print '<td class="linecolnum center">'.($i+1).'</td>';
<td class="linecolnum center"><?php $coldisplay++; ?><?php echo ($i+1); ?></td> $coldisplay++;
<?php } ?> }
<td class="linecoldescription minwidth300imp"><?php $coldisplay++; ?><div id="line_<?php echo $line->id; ?>"></div> print '<td class="linecoldescription minwidth300imp">';
<?php print '<div id="line_'.$line->id.'"></div>';
$coldisplay++;
$tmpproduct = new Product($object->db); $tmpproduct = new Product($object->db);
$tmpproduct->fetch($line->fk_product); $tmpproduct->fetch($line->fk_product);
print $tmpproduct->getNomUrl(1); print $tmpproduct->getNomUrl(1);
?> print '</td>';
</td> print '<td class="linecolqty nowrap right">';
<td class="linecolqty nowrap right"><?php $coldisplay++; ?> $coldisplay++;
<?php
echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price echo price($line->qty, 0, '', 0, 0); // Yes, it is a quantity, not a price, but we just want the formating role of function price
?> print '</td>';
</td>
<?php
if($conf->global->PRODUCT_USE_UNITS) if($conf->global->PRODUCT_USE_UNITS)
{ {
print '<td class="linecoluseunit nowrap left">'; print '<td class="linecoluseunit nowrap left">';
@@ -89,70 +87,65 @@ $objectline = new BOMLine($object->db);
} }
print '</td>'; print '</td>';
} }
?> print '<td class="linecolqty nowrap right">';
<td class="linecolqty nowrap right"><?php $coldisplay++; ?> $coldisplay++;
<?php
echo $line->efficiency; echo $line->efficiency;
?> print '</td>';
</td>
<?php
if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) { ?> if ($this->statut == 0 && ($object_rights->write) && $action != 'selectlines' ) {
<td class="linecoledit center"><?php $coldisplay++; ?> print '<td class="linecoledit center">';
<?php if (($line->info_bits & 2) == 2 || ! empty($disableedit)) { ?> $coldisplay++;
<?php } else { ?> if (($line->info_bits & 2) == 2 || ! empty($disableedit)) {
<a href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id; ?>"> } else {
<?php echo img_edit(); ?> print '<a href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=editline&amp;lineid='.$line->id.'#line_'.$line->id.'">'.img_edit().'</a>';
</a> }
<?php } ?> print '</td>';
</td>
<td class="linecoldelete center"><?php $coldisplay++; ?> print '<td class="linecoldelete center">';
<?php $coldisplay++;
if (($line->fk_prev_id == null ) && empty($disableremove)) { //La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation if (($line->fk_prev_id == null ) && empty($disableremove)) {
//La suppression n'est autorisée que si il n'y a pas de ligne dans une précédente situation
print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=deleteline&amp;lineid=' . $line->id . '">'; print '<a href="' . $_SERVER["PHP_SELF"] . '?id=' . $this->id . '&amp;action=deleteline&amp;lineid=' . $line->id . '">';
print img_delete(); print img_delete();
print '</a>'; print '</a>';
} }
?> print '</td>';
</td>
<?php if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) {
if ($num > 1 && $conf->browser->layout != 'phone' && empty($disablemove)) { ?> print '<td class="linecolmove tdlineupdown center">';
<td class="linecolmove tdlineupdown center"><?php $coldisplay++; ?> $coldisplay++;
<?php if ($i > 0) { ?> if ($i > 0) {
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id; ?>"> print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=up&amp;rowid='.$line->id.'">';
<?php echo img_up('default', 0, 'imgupforline'); ?> echo img_up('default', 0, 'imgupforline');
</a> print '</a>';
<?php } ?> }
<?php if ($i < $num-1) { ?> if ($i < $num-1) {
<a class="lineupdown" href="<?php echo $_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id; ?>"> print '<a class="lineupdown" href="'.$_SERVER["PHP_SELF"].'?id='.$this->id.'&amp;action=down&amp;rowid='.$line->id.'">';
<?php echo img_down('default', 0, 'imgdownforline'); ?> echo img_down('default', 0, 'imgdownforline');
</a> print '</a>';
<?php } ?> }
</td> print '</td>';
<?php } else { ?>
<td <?php echo (($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"'); ?>><?php $coldisplay++; ?></td>
<?php } ?>
<?php
} else { } else {
?> print '<td '.(($conf->browser->layout != 'phone' && empty($disablemove)) ?' class="linecolmove tdlineupdown center"':' class="linecolmove center"').'></td>';
<td colspan="3"><?php $coldisplay=$coldisplay+3; ?></td> $coldisplay++;
<?php }
} else {
print '<td colspan="3"></td>';
$coldisplay=$coldisplay+3;
} }
if($action == 'selectlines'){ ?> if ($action == 'selectlines') {
<td class="linecolcheck center"><input type="checkbox" class="linecheckbox" name="line_checkbox[<?php echo $i+1; ?>]" value="<?php echo $line->id; ?>" ></td> print '<td class="linecolcheck center">';
<?php } ?> print '<input type="checkbox" class="linecheckbox" name="line_checkbox['.($i+1).']" value="'.$line->id.'" >';
print '</td>';
}
</tr> print '</tr>';
<?php
//Line extrafield //Line extrafield
if (!empty($extrafields)) if (!empty($extrafields))
{ {
print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1); print $line->showOptionals($extrafields, 'view', array('style'=>'class="drag drop oddeven"','colspan'=>$coldisplay), '', '', empty($conf->global->MAIN_EXTRAFIELDS_IN_ONE_TD)?0:1);
} }
?>
<!-- END PHP TEMPLATE objectline_view.tpl.php --> print "<!-- END PHP TEMPLATE objectline_view.tpl.php -->\n";

View File

@@ -181,7 +181,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'CONTACT_MODIFY': case 'CONTACT_MODIFY':
case 'CONTACT_DELETE': case 'CONTACT_DELETE':
case 'CONTACT_ENABLEDISABLE': case 'CONTACT_ENABLEDISABLE':
break;
// Products // Products
// case 'PRODUCT_CREATE': // case 'PRODUCT_CREATE':
// case 'PRODUCT_MODIFY': // case 'PRODUCT_MODIFY':
@@ -221,7 +221,7 @@ class InterfaceZapierTriggers extends DolibarrTriggers
case 'LINEORDER_INSERT': case 'LINEORDER_INSERT':
case 'LINEORDER_UPDATE': case 'LINEORDER_UPDATE':
case 'LINEORDER_DELETE': case 'LINEORDER_DELETE':
break;
// Supplier orders // Supplier orders
// case 'ORDER_SUPPLIER_CREATE': // case 'ORDER_SUPPLIER_CREATE':
// case 'ORDER_SUPPLIER_CLONE': // case 'ORDER_SUPPLIER_CLONE':