diff --git a/htdocs/categories/viewcat.php b/htdocs/categories/viewcat.php index 14a63ffc8373ffea05b4e2f08e623adfa6b6208a..c55f324ab0681aab8154bc8eda7d83a568de8a44 100644 --- a/htdocs/categories/viewcat.php +++ b/htdocs/categories/viewcat.php @@ -38,7 +38,7 @@ $type=GETPOST('type'); $action=GETPOST('action'); $confirm=GETPOST('confirm'); $removeelem = GETPOST('removeelem','int'); -$elemid=GETPOST('elemid'); +$elemid=GETPOST('elemid'); if ($id == "") { @@ -121,32 +121,32 @@ if ($user->rights->categorie->supprimer && $action == 'confirm_delete' && $confi } } -if ($type==0 && $elemid && $action == 'addintocategory' && ($user->rights->produit->creer || $user->rights->service->creer)) +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); + 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'); - } - } - -} + $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'); + } + } + +} @@ -292,26 +292,26 @@ if ($object->type == 0) { $showclassifyform=1; $typeid=0; - // Form to add record into a category - if ($showclassifyform) - { + // 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 '<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 '<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 "<table class='noborder' width='100%'>\n";