stock done
This commit is contained in:
parent
268618d045
commit
e4bd4ce78e
@ -890,39 +890,7 @@ class Entrepot extends CommonObject
|
|||||||
*/
|
*/
|
||||||
public function setCategories($categories)
|
public function setCategories($categories)
|
||||||
{
|
{
|
||||||
$type_categ = Categorie::TYPE_WAREHOUSE;
|
|
||||||
|
|
||||||
// Handle single category
|
|
||||||
if (!is_array($categories)) {
|
|
||||||
$categories = array($categories);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get current categories
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
|
||||||
$c = new Categorie($this->db);
|
return parent::setCategoriesCommon($categories, Categorie::TYPE_WAREHOUSE);
|
||||||
$existing = $c->containing($this->id, $type_categ, 'id');
|
|
||||||
|
|
||||||
// Diff
|
|
||||||
if (is_array($existing)) {
|
|
||||||
$to_del = array_diff($existing, $categories);
|
|
||||||
$to_add = array_diff($categories, $existing);
|
|
||||||
} else {
|
|
||||||
$to_del = array(); // Nothing to delete
|
|
||||||
$to_add = $categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process
|
|
||||||
foreach ($to_del as $del) {
|
|
||||||
if ($c->fetch($del) > 0) {
|
|
||||||
$c->del_type($this, $type_categ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach ($to_add as $add) {
|
|
||||||
if ($c->fetch($add) > 0) {
|
|
||||||
$c->add_type($this, $type_categ);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -46,6 +46,8 @@ $toselect = GETPOST('toselect', 'array'); // Array of ids of elements selected
|
|||||||
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'stocklist'; // To manage different context of search
|
$contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'stocklist'; // To manage different context of search
|
||||||
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
|
||||||
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
$optioncss = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
|
||||||
|
$toselect = GETPOST('toselect', 'array');
|
||||||
|
|
||||||
|
|
||||||
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ?GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
|
||||||
$search_ref = GETPOST("sref", "alpha") ?GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha");
|
$search_ref = GETPOST("sref", "alpha") ?GETPOST("sref", "alpha") : GETPOST("search_ref", "alpha");
|
||||||
@ -160,7 +162,7 @@ if (empty($reshook))
|
|||||||
{
|
{
|
||||||
$search[$key] = '';
|
$search[$key] = '';
|
||||||
}
|
}
|
||||||
$toselect = '';
|
$toselect = array();
|
||||||
$search_array_options = array();
|
$search_array_options = array();
|
||||||
}
|
}
|
||||||
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
|
||||||
@ -174,6 +176,7 @@ if (empty($reshook))
|
|||||||
$objectlabel = 'Warehouse';
|
$objectlabel = 'Warehouse';
|
||||||
$permissiontoread = $user->rights->stock->lire;
|
$permissiontoread = $user->rights->stock->lire;
|
||||||
$permissiontodelete = $user->rights->stock->supprimer;
|
$permissiontodelete = $user->rights->stock->supprimer;
|
||||||
|
$permissiontoadd = $user->rights->stock->creer;
|
||||||
$uploaddir = $conf->stock->dir_output;
|
$uploaddir = $conf->stock->dir_output;
|
||||||
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
|
||||||
}
|
}
|
||||||
@ -344,6 +347,7 @@ $arrayofmassactions = array(
|
|||||||
);
|
);
|
||||||
//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
//if ($user->rights->stock->supprimer) $arrayofmassactions['predelete']='<span class="fa fa-trash paddingrightonly"></span>'.$langs->trans("Delete");
|
||||||
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) $arrayofmassactions = array();
|
||||||
|
if ($user->rights->stock->creer) $arrayofmassactions['preaffecttag'] = '<span class="fa fa-tag paddingrightonly"></span>'.$langs->trans("AffectTag");
|
||||||
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
|
||||||
|
|
||||||
print '<form action="'.$_SERVER["PHP_SELF"].'" id="searchFormList" method="POST" name="formulaire">';
|
print '<form action="'.$_SERVER["PHP_SELF"].'" id="searchFormList" method="POST" name="formulaire">';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user