forked from Wavyzz/dolibarr
NEW Dolibarr#22848 Add order tags
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formorder.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmargin.class.php';
|
||||
@@ -564,6 +565,13 @@ if (empty($reshook)) {
|
||||
$action = '';
|
||||
}
|
||||
|
||||
if (isModEnabled('categorie')) {
|
||||
$categories = GETPOST('categories', 'array');
|
||||
if (method_exists($object, 'setCategories')) {
|
||||
$object->setCategories($categories);
|
||||
}
|
||||
}
|
||||
|
||||
// End of object creation, we show it
|
||||
if ($object_id > 0 && !$error) {
|
||||
$db->commit();
|
||||
@@ -690,6 +698,11 @@ if (empty($reshook)) {
|
||||
// $result = $object->setDiscount($user, price2num(GETPOST('remise_percent'), '', 2));
|
||||
//} elseif ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
// $result = $object->set_remise_absolue($user, price2num(GETPOST('remise_absolue'), 'MU', 2));
|
||||
} elseif ($action == 'settags' && isModEnabled('categorie') && $usercancreate) {
|
||||
$result = $object->setCategories(GETPOST('categories', 'array'));
|
||||
if ($result < 0) {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
}
|
||||
} elseif ($action == 'addline' && GETPOST('submitforalllines', 'aZ09') && (GETPOST('alldate_start', 'alpha') || GETPOST('alldate_end', 'alpha')) && $usercancreate) {
|
||||
// Define date start and date end for all line
|
||||
$alldate_start = dol_mktime(GETPOSTINT('alldate_starthour'), GETPOSTINT('alldate_startmin'), 0, GETPOSTINT('alldate_startmonth'), GETPOSTINT('alldate_startday'), GETPOSTINT('alldate_startyear'));
|
||||
@@ -2155,6 +2168,15 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Categories
|
||||
if (!empty($conf->categorie->enabled)) {
|
||||
print '<tr><td>'.$langs->trans("Categories").'</td><td colspan="3">';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ORDER, '', 'parent', 64, 0, 1);
|
||||
$arrayselected = GETPOST('categories', 'array');
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, 'quatrevingtpercent widthcentpercentminusx', 0, 0);
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Note public
|
||||
print '<tr>';
|
||||
print '<td class="tdtop">'.$langs->trans('NotePublic').'</td>';
|
||||
@@ -2841,6 +2863,40 @@ if ($action == 'create' && $usercancreate) {
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Tags-Categories
|
||||
if (isModEnabled('categorie')) {
|
||||
print '<tr><td>';
|
||||
print '<table class="nobordernopadding centpercent"><tr><td>';
|
||||
print $langs->trans("Categories");
|
||||
print '<td><td class="right">';
|
||||
if ($usercancreate) {
|
||||
print '<a class="editfielda" href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=edittags&token='.newToken().'">'.img_edit().'</a>';
|
||||
} else {
|
||||
print ' ';
|
||||
}
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td>';
|
||||
$cate_arbo = $form->select_all_categories(Categorie::TYPE_ORDER, '', 'parent', 64, 0, 1);
|
||||
if ($action == 'edittags') {
|
||||
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
print '<input type="hidden" name="action" value="settags">';
|
||||
print '<input type="hidden" name="token" value="'.newToken().'">';
|
||||
$c = new Categorie($db);
|
||||
$cats = $c->containing($object->id, Categorie::TYPE_ORDER);
|
||||
$arrayselected=[];
|
||||
foreach ($cats as $cat) {
|
||||
$arrayselected[] = $cat->id;
|
||||
}
|
||||
print img_picto('', 'category').$form->multiselectarray('categories', $cate_arbo, $arrayselected, 0, 0, 'quatrevingtpercent widthcentpercentminusx', 0, '0');
|
||||
print '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
print '</form>';
|
||||
} else {
|
||||
print $form->showCategories($object->id, Categorie::TYPE_ORDER, 1);
|
||||
}
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user