Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
81beadbed8
@ -240,6 +240,7 @@ if (empty($reshook))
|
||||
{
|
||||
$datecommande = dol_mktime(12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
|
||||
$datelivraison = dol_mktime(12, 0, 0, GETPOST('liv_month'), GETPOST('liv_day'), GETPOST('liv_year'));
|
||||
$selectedLines = GETPOST('toselect', 'array');
|
||||
|
||||
if ($datecommande == '') {
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), null, 'errors');
|
||||
@ -346,6 +347,8 @@ if (empty($reshook))
|
||||
|
||||
for($i = 0; $i < $num; $i ++)
|
||||
{
|
||||
if(!in_array($lines[$i]->id, $selectedLines)) continue; // Skip unselected lines
|
||||
|
||||
$label = (! empty($lines[$i]->label) ? $lines[$i]->label : '');
|
||||
$desc = (! empty($lines[$i]->desc) ? $lines[$i]->desc : '');
|
||||
$product_type = (! empty($lines[$i]->product_type) ? $lines[$i]->product_type : 0);
|
||||
@ -1881,8 +1884,6 @@ if ($action == 'create' && $usercancreate)
|
||||
print '<input type="button" class="button" name="cancel" value="' . $langs->trans("Cancel") . '" onclick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
// Show origin lines
|
||||
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
|
||||
$title = $langs->trans('ProductsAndServices');
|
||||
@ -1890,10 +1891,12 @@ if ($action == 'create' && $usercancreate)
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
$objectsrc->printOriginLinesList();
|
||||
$objectsrc->printOriginLinesList('', $selectedLines);
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
// Mode view
|
||||
$now = dol_now();
|
||||
|
||||
@ -4186,11 +4186,12 @@ abstract class CommonObject
|
||||
* But for the moment we don't know if it's possible, so we keep the method available on overloaded objects.
|
||||
*
|
||||
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only
|
||||
* @param array $selectedLines Array of lines id for selected lines
|
||||
* @return void
|
||||
*/
|
||||
public function printOriginLinesList($restrictlist = '')
|
||||
public function printOriginLinesList($restrictlist = '', $selectedLines = array())
|
||||
{
|
||||
global $langs, $hookmanager, $conf;
|
||||
global $langs, $hookmanager, $conf, $form;
|
||||
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans('Ref').'</td>';
|
||||
@ -4203,8 +4204,9 @@ abstract class CommonObject
|
||||
{
|
||||
print '<td class="left">'.$langs->trans('Unit').'</td>';
|
||||
}
|
||||
print '<td class="right">'.$langs->trans('ReductionShort').'</td></tr>';
|
||||
|
||||
print '<td class="right">'.$langs->trans('ReductionShort').'</td>';
|
||||
print '<td class="center">'.$form->showCheckAddButtons('checkforselect', 1).'</td>';
|
||||
print '</tr>';
|
||||
$var = true;
|
||||
$i = 0;
|
||||
|
||||
@ -4223,7 +4225,7 @@ abstract class CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->printOriginLine($line, $var, $restrictlist);
|
||||
$this->printOriginLine($line, $var, $restrictlist, '/core/tpl', $selectedLines);
|
||||
}
|
||||
|
||||
$i++;
|
||||
@ -4241,9 +4243,10 @@ abstract class CommonObject
|
||||
* @param string $var Var
|
||||
* @param string $restrictlist ''=All lines, 'services'=Restrict to services only (strike line if not)
|
||||
* @param string $defaulttpldir Directory where to find the template
|
||||
* @param array $selectedLines Array of lines id for selected lines
|
||||
* @return void
|
||||
*/
|
||||
public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl')
|
||||
public function printOriginLine($line, $var, $restrictlist = '', $defaulttpldir = '/core/tpl', $selectedLines = array())
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
@ -4267,6 +4270,8 @@ abstract class CommonObject
|
||||
if ($line->date_fin_reel) $date_end=$line->date_fin_reel;
|
||||
}
|
||||
|
||||
$this->tpl['id'] = $line->id;
|
||||
|
||||
$this->tpl['label'] = '';
|
||||
if (! empty($line->fk_parent_line)) $this->tpl['label'].= img_picto('', 'rightarrow');
|
||||
|
||||
|
||||
@ -40,6 +40,10 @@ if($conf->global->PRODUCT_USE_UNITS)
|
||||
print '<td class="left">'.$langs->trans($this->tpl['unit']).'</td>';
|
||||
|
||||
print '<td class="right">'.$this->tpl['remise_percent'].'</td>';
|
||||
|
||||
$selected=1;
|
||||
if (!empty($selectedLines) && !in_array($this->tpl['id'], $selectedLines)) $selected=0;
|
||||
print '<td class="center"><input id="cb'.$this->tpl['id'].'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$this->tpl['id'].'"'.($selected?' checked="checked"':'').'></td>';
|
||||
print '</tr>'."\n";
|
||||
?>
|
||||
<!-- END PHP TEMPLATE originproductline.tpl.php -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user