$error++; $errors[] = $langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Warehouse")); $action = ''; } } if (!$error) { $result = $object->validate($user, '', $idwarehouse); if ($result < 0) { setEventMessage($object->error, 'errors'); setEventMessage($object->errors, 'errors'); } } } elseif ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->fournisseur->facture->supprimer) { $object->fetch($id); $object->fetch_thirdparty(); $result = $object->delete($id); if ($result > 0) { header('Location: list.php'); exit; } else { $mesg = '<div class="error">' . $object->error . '</div>'; } } elseif ($action == 'confirm_delete_line' && $confirm == 'yes' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); $ret = $object->deleteline(GETPOST('lineid')); if ($ret > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit; } else { $mesg = '<div class="error">' . $object->error . '</div>'; /* Fix bug 1485 : Reset action to avoid asking again confirmation on failure */
/** * testFactureFournisseurDelete * * @param int $id Id of supplier invoice * @return void * * @depends testFactureFournisseurOther * The depends says test is run only if previous is ok */ public function testFactureFournisseurDelete($id) { global $conf, $user, $langs, $db; $conf = $this->savconf; $user = $this->savuser; $langs = $this->savlangs; $db = $this->savdb; $localobject = new FactureFournisseur($this->savdb); $result = $localobject->fetch($id); $result = $localobject->delete($id); print __METHOD__ . " id=" . $id . " result=" . $result . "\n"; $this->assertLessThan($result, 0); return $result; }
$facturefourn=new FactureFournisseur($db); $facturefourn->fetch($_GET['facid']); $result = $facturefourn->validate($user); if ($result < 0) { $mesg='<div class="error">'.$facturefourn->error.'</div>'; } } if ($_REQUEST['action'] == 'confirm_delete' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->fournisseur->facture->supprimer ) { $facturefourn = new FactureFournisseur($db); $factfournid = $_GET['facid']; $result=$facturefourn->delete($factfournid); if ($result > 0) { Header('Location: index.php'); exit; } else { $mesg='<div class="error">'.$facturefourn->error.'</div>'; } } } if ($_REQUEST['action'] == 'confirm_deleteproductline' && $_REQUEST['confirm'] == 'yes') { if ($user->rights->fournisseur->facture->creer)