diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index fb6d723ad7e..e44bb0ac90b 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -47,12 +47,9 @@ $action = GETPOST('action', 'aZ09'); $cancel = GETPOST('cancel', 'alpha'); // Security check -if (isset($_GET["id"]) || isset($_GET["ref"])) -{ - $id = isset($_GET["id"])?GETPOST("id"):(isset($_GET["ref"])?GETPOST("ref"):''); -} -$fieldid = isset($_GET["ref"])?'ref':'rowid'; -if ($user->societe_id) $socid=$user->societe_id; +$id = GETPOST("id", 'int') ? GETPOST("id", 'int'): GETPOST('ref', 'alpha'); +$fieldid = GETPOSTISSET("ref") ? 'ref' : 'rowid'; + $result=restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid); $object = new Account($db); @@ -289,7 +286,7 @@ if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights-> } else { - setEventMessages($account->error, $account->errors, 'errors'); + setEventMessages($object->error, $object->errors, 'errors'); $action=''; } } @@ -410,10 +407,15 @@ if ($action == 'create') { print ''.$langs->trans("Categories").''; $cate_arbo = $form->select_all_categories(Categorie::TYPE_ACCOUNT, '', 'parent', 64, 0, 1); + + $arrayselected = array(); $c = new Categorie($db); $cats = $c->containing($object->id, Categorie::TYPE_ACCOUNT); - foreach($cats as $cat) { - $arrayselected[] = $cat->id; + if (is_array($cats)) + { + foreach($cats as $cat) { + $arrayselected[] = $cat->id; + } } print $form->multiselectarray('categories', $cate_arbo, $arrayselected, '', 0, '', 0, '100%'); print ""; diff --git a/htdocs/mrp/mo_card.php b/htdocs/mrp/mo_card.php index 29003b3304f..9e4846570c7 100644 --- a/htdocs/mrp/mo_card.php +++ b/htdocs/mrp/mo_card.php @@ -336,15 +336,15 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 1); $morehtmlref.='
'; $morehtmlref.=''; $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=$formproject->select_projects($object->fk_soc, $object->fk_project, 'projectid', 0, 0, 1, 0, 1, 0, 0, '', 1); $morehtmlref.=''; $morehtmlref.='
'; } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->fk_soc, $object->fk_project, 'none', 0, 0, 0, 1); } } else { if (! empty($object->fk_project)) { @@ -465,7 +465,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Clone if (! empty($user->rights->mrp->write)) { - print '
' . $langs->trans("ToClone") . '
'; + print '
' . $langs->trans("ToClone") . '
'; } // Delete (need delete permission, or if draft, just need create/modify permission)