Debug v17

This commit is contained in:
Laurent Destailleur 2022-11-14 12:38:10 +01:00
parent 9d9799c12e
commit 198e477142
3 changed files with 24 additions and 19 deletions

View File

@ -327,24 +327,11 @@ if ($action == 'create') {
print '<div class="div-table-responsive-no-min">';
if (!empty($object->lines) || ($permissiontoedit && $action != 'selectlines' && $action != 'editline')) {
print '<table id="tablelines" class="noborder noshadow" width="100%">';
}
// Form to add new line
if ($permissiontoedit && $action != 'selectlines') {
if ($action != 'editline') {
// Add products/services form
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, $soc);
}
print '<table id="tablelines" class="noborder centpercent">';
}
if (!empty($object->lines)) {
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1, '/variants/tpl', ($permissiontoedit ? 1 : 0));
}
if (!empty($object->lines) || ($permissiontoedit && $action != 'selectlines' && $action != 'editline')) {

View File

@ -1272,11 +1272,13 @@ class ProductAttribute extends CommonObject
* @param int $selected Object line selected
* @param int $dateSelector 1=Show also date range input fields
* @param string $defaulttpldir Directory where to find the template
* @param int $addcreateline 1=Add create line
* @return void
*/
public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/variants/tpl')
public function printObjectLines($action, $seller, $buyer, $selected = 0, $dateSelector = 0, $defaulttpldir = '/variants/tpl', $addcreateline = 0)
{
global $conf, $hookmanager, $langs, $user, $form, $object;
global $mysoc;
// TODO We should not use global var for this
global $disableedit, $disablemove, $disableremove;
@ -1306,9 +1308,25 @@ class ProductAttribute extends CommonObject
}
}
if ($addcreateline) {
// Form to add new line
if ($action != 'selectlines') {
if ($action != 'editline') {
// Add products/services form
$parameters = array();
$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
if (empty($reshook))
$object->formAddObjectLine(1, $mysoc, $buyer);
}
}
}
$i = 0;
print "<!-- begin printObjectLines() --><tbody>\n";
print "<!-- begin printObjectLines() -->\n";
foreach ($this->lines as $line) {
if (is_object($hookmanager)) { // Old code is commented on preceding line.
$parameters = array('line' => $line, 'num' => $num, 'i' => $i, 'selected' => $selected, 'table_element_line' => $line->table_element);
@ -1320,7 +1338,7 @@ class ProductAttribute extends CommonObject
$i++;
}
print "</tbody><!-- end printObjectLines() -->\n";
print "<!-- end printObjectLines() -->\n";
}
/**

View File

@ -84,7 +84,7 @@ if ($nolinesbefore) {
</td>
<td class="nobottom linecoledit center valignmiddle" colspan="<?php echo $colspan; ?>"><?php $coldisplay += $colspan; ?>
<input type="submit" class="button reposition" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
<input type="submit" class="button reposition small" value="<?php echo $langs->trans('Add'); ?>" name="addline" id="addline">
</td>
</tr>