New: Can add product into category from category card.
This commit is contained in:
parent
0a4d040e9d
commit
2bbede6465
@ -5,6 +5,7 @@ English Dolibarr ChangeLog
|
|||||||
|
|
||||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||||
For users:
|
For users:
|
||||||
|
- New: Can add product into category from category card.
|
||||||
- New: PDF event report show project and status of event.
|
- New: PDF event report show project and status of event.
|
||||||
- New: Can filter on status on interventions.
|
- New: Can filter on status on interventions.
|
||||||
- New: Add help info of field type into dictionary of payment types.
|
- New: Add help info of field type into dictionary of payment types.
|
||||||
|
|||||||
@ -207,8 +207,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
setEventMessage($cat->error,'errors');
|
setEventMessages($cat->error,$this->errors,'errors');
|
||||||
setEventMessage($cat->errors,'errors');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -628,7 +627,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1)
|
|||||||
// Form to add record into a category
|
// Form to add record into a category
|
||||||
if ($showclassifyform)
|
if ($showclassifyform)
|
||||||
{
|
{
|
||||||
print '<form method="post" action="'.DOL_URL_ROOT.'/categories/categorie.php">';
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||||
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||||
|
|||||||
@ -38,6 +38,7 @@ $type=GETPOST('type');
|
|||||||
$action=GETPOST('action');
|
$action=GETPOST('action');
|
||||||
$confirm=GETPOST('confirm');
|
$confirm=GETPOST('confirm');
|
||||||
$removeelem = GETPOST('removeelem','int');
|
$removeelem = GETPOST('removeelem','int');
|
||||||
|
$elemid=GETPOST('elemid');
|
||||||
|
|
||||||
if ($id == "")
|
if ($id == "")
|
||||||
{
|
{
|
||||||
@ -120,6 +121,33 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
$newobject = new Product($db);
|
||||||
|
$result = $newobject->fetch($elemid);
|
||||||
|
$elementtype = 'product';
|
||||||
|
|
||||||
|
// TODO Add into categ
|
||||||
|
$result=$object->add_type($newobject,$elementtype);
|
||||||
|
if ($result >= 0)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("WasAddedSuccessfully",$newobject->ref));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($cat->error == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ObjectAlreadyLinkedToCategory"),'warnings');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($object->error,$object->errors,'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -144,6 +172,7 @@ dol_fiche_head($head, 'card', $title, 0, 'category');
|
|||||||
/*
|
/*
|
||||||
* Confirmation suppression
|
* Confirmation suppression
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&type='.$type,$langs->trans('DeleteCategory'),$langs->trans('ConfirmDeleteCategory'),'confirm_delete');
|
||||||
@ -251,10 +280,9 @@ else
|
|||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of products
|
// List of products or services (type is type of category)
|
||||||
if ($object->type == 0)
|
if ($object->type == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
$prods = $object->getObjectsInCateg("product");
|
$prods = $object->getObjectsInCateg("product");
|
||||||
if ($prods < 0)
|
if ($prods < 0)
|
||||||
{
|
{
|
||||||
@ -262,6 +290,29 @@ if ($object->type == 0)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$showclassifyform=1; $typeid=0;
|
||||||
|
|
||||||
|
// Form to add record into a category
|
||||||
|
if ($showclassifyform)
|
||||||
|
{
|
||||||
|
print '<br>';
|
||||||
|
print '<form method="post" action="'.$_SERVER["PHP_SELF"].'">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="typeid" value="'.$typeid.'">';
|
||||||
|
print '<input type="hidden" name="type" value="'.$typeid.'">';
|
||||||
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
|
print '<input type="hidden" name="action" value="addintocategory">';
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td width="40%">';
|
||||||
|
print $langs->trans("AddProductServiceIntoCategory").' ';
|
||||||
|
print $form->select_produits('','elemid','',0,0,-1,2,'',1);
|
||||||
|
print '</td><td>';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("ClassifyInCategory").'"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print '</table>';
|
||||||
|
print '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
print "<br>";
|
print "<br>";
|
||||||
print "<table class='noborder' width='100%'>\n";
|
print "<table class='noborder' width='100%'>\n";
|
||||||
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("ProductsAndServices")."</td></tr>\n";
|
||||||
|
|||||||
@ -111,3 +111,4 @@ ExtraFieldsCategories=Complementary attributes
|
|||||||
CategoriesSetup=Categories setup
|
CategoriesSetup=Categories setup
|
||||||
CategorieRecursiv=Link with parent category automatically
|
CategorieRecursiv=Link with parent category automatically
|
||||||
CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory
|
CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory
|
||||||
|
AddProductServiceIntoCategory=Add the following product/service
|
||||||
Loading…
Reference in New Issue
Block a user