diff --git a/ChangeLog b/ChangeLog index 6c13b73daf1..dafb9ae8fa1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ English Dolibarr ChangeLog ***** ChangeLog for 3.7 compared to 3.6.* ***** For users: +- New: Can add product into category from category card. - New: PDF event report show project and status of event. - New: Can filter on status on interventions. - New: Add help info of field type into dictionary of payment types. diff --git a/build.xml b/build.xml index fc267bf196e..570821a7c7b 100644 --- a/build.xml +++ b/build.xml @@ -1,6 +1,6 @@ - +fdfds diff --git a/htdocs/categories/categorie.php b/htdocs/categories/categorie.php index 52e352779ba..c74eefdc430 100644 --- a/htdocs/categories/categorie.php +++ b/htdocs/categories/categorie.php @@ -207,8 +207,7 @@ if (empty($reshook)) } else { - setEventMessage($cat->error,'errors'); - setEventMessage($cat->errors,'errors'); + setEventMessages($cat->error,$this->errors,'errors'); } } } @@ -628,7 +627,7 @@ function formCategory($db,$object,$typeid,$socid=0,$showclassifyform=1) // Form to add record into a category if ($showclassifyform) { - print '
'; + print ''; print ''; print ''; print ''; diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 29ed8a5d6b8..14a63ffc837 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -38,6 +38,7 @@ $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); $removeelem = GETPOST('removeelem','int'); +$elemid=GETPOST('elemid'); 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 */ + if ($action == '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 "\n"; } -// List of products +// List of products or services (type is type of category) if ($object->type == 0) { - $prods = $object->getObjectsInCateg("product"); if ($prods < 0) { @@ -262,6 +290,29 @@ if ($object->type == 0) } else { + $showclassifyform=1; $typeid=0; + + // Form to add record into a category + if ($showclassifyform) + { + print '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print '
'; + print $langs->trans("AddProductServiceIntoCategory").'  '; + print $form->select_produits('','elemid','',0,0,-1,2,'',1); + print ''; + print '
'; + print '
'; + } + print "
"; print "\n"; print '\n"; diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index fb9ad8a3b6d..3ee731f0824 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -111,3 +111,4 @@ ExtraFieldsCategories=Complementary attributes CategoriesSetup=Categories setup CategorieRecursiv=Link with parent category automatically CategorieRecursivHelp=If activated, product will also linked to parent category when adding into a subcategory +AddProductServiceIntoCategory=Add the following product/service \ No newline at end of file diff --git a/htdocs/product/price.php b/htdocs/product/price.php index 6971a5bb125..801573a316f 100644 --- a/htdocs/product/price.php +++ b/htdocs/product/price.php @@ -341,21 +341,23 @@ if ($isphoto) { print ''; // MultiPrix -if (! empty($conf->global->PRODUIT_MULTIPRICES)) { - if (! empty($socid)) { +if (! empty($conf->global->PRODUIT_MULTIPRICES)) +{ + if (! empty($socid)) + { $soc = new Societe($db); $soc->id = $socid; $soc->fetch($socid); print ''; - if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { + if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') { print ''; // TVA - print ''; + print ''; } else { @@ -393,12 +396,12 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { print ''; if ($object->multiprices_base_type ["$i"] == 'TTC') { - print '';
'.$langs->trans("ProductsAndServices")."
' . $langs->trans("SellingPrice") . '' . price($object->multiprices_ttc ["$soc->price_level"]); } else { print '' . price($object->multiprices ["$soc->price_level"]); } - if ($object->multiprices_base_type ["$soc->price_level"]) { + if ($object->multiprices_base_type["$soc->price_level"]) { print ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); } else { print ' ' . $langs->trans($object->price_base_type); @@ -364,15 +366,16 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Prix mini print '
' . $langs->trans("MinPrice") . ''; - if ($object->multiprices_base_type ["$soc->price_level"] == 'TTC') { - print price($object->multiprices_min_ttc ["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); + if ($object->multiprices_base_type["$soc->price_level"] == 'TTC') + { + print price($object->multiprices_min_ttc["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type["$soc->price_level"]); } else { - print price($object->multiprices_min ["$soc->price_level"]) . ' ' . $langs->trans($object->multiprices_base_type ["$soc->price_level"]); + print price($object->multiprices_min["$soc->price_level"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$soc->price_level"])?'HT':$object->multiprices_base_type["$soc->price_level"]); } print '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx ["$soc->price_level"], true) . '
' . $langs->trans("VATRate") . '' . vatrate($object->multiprices_tva_tx["$soc->price_level"], true) . '
' . price($object->multiprices_ttc ["$i"]); + print '' . price($object->multiprices_ttc["$i"]); } else { - print '' . price($object->multiprices ["$i"]); + print '' . price($object->multiprices["$i"]); } - if ($object->multiprices_base_type ["$i"]) { + if ($object->multiprices_base_type["$i"]) { print ' ' . $langs->trans($object->multiprices_base_type ["$i"]); } else { print ' ' . $langs->trans($object->price_base_type); @@ -408,9 +411,9 @@ if (! empty($conf->global->PRODUIT_MULTIPRICES)) { // Prix mini print '
' . $langs->trans("MinPrice") . ' ' . $i . ''; if ($object->multiprices_base_type ["$i"] == 'TTC') { - print price($object->multiprices_min_ttc ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); + print price($object->multiprices_min_ttc["$i"]) . ' ' . $langs->trans($object->multiprices_base_type["$i"]); } else { - print price($object->multiprices_min ["$i"]) . ' ' . $langs->trans($object->multiprices_base_type ["$i"]); + print price($object->multiprices_min["$i"]) . ' ' . $langs->trans(empty($object->multiprices_base_type["$i"])?'HT':$object->multiprices_base_type["$i"]); } print '