{ $objp = $db->fetch_object($result); $totalpaye += $objp->amount; $i++; } } $resteapayer = $fac->total_ttc - $totalpaye; // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees //$ventilExportCompta = $fac->getVentilExportCompta(); // On verifie si aucun paiement n'a ete effectue if ($resteapayer == $fac->total_ttc && $fac->paye == 0 && $ventilExportCompta == 0) { $fac->set_draft($user); $outputlangs = $langs; if (! empty($_REQUEST['lang_id'])) { $outputlangs = new Translate("",$conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } //supplier_invoice_pdf_create($db, $fac->id, $fac->modelpdf, $outputlangs); } } if ($_GET['action'] == 'reopen' && $user->rights->fournisseur->facture->creer) { $fac = new FactureFournisseur($db); $result = $fac->fetch($_GET['facid']);
$mesg = '<div class="error">' . $object->error . '</div>'; } } $action = ''; } elseif ($action == 'classin') { $object->fetch($id); $result = $object->setProject($_POST['projectid']); } elseif ($action == 'edit' && $user->rights->fournisseur->facture->creer) { $object->fetch($id); $totalpaye = $object->getSommePaiement(); $resteapayer = $object->total_ttc - $totalpaye; // On verifie si les lignes de factures ont ete exportees en compta et/ou ventilees //$ventilExportCompta = $object->getVentilExportCompta(); // On verifie si aucun paiement n'a ete effectue if ($resteapayer == $object->total_ttc && $object->paye == 0 && $ventilExportCompta == 0) { $object->set_draft($user); $outputlangs = $langs; if (!empty($_REQUEST['lang_id'])) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($_REQUEST['lang_id']); } //if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) supplier_invoice_pdf_create($db, $object->id, $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); $action = ''; } } elseif ($action == 'reopen' && $user->rights->fournisseur->facture->creer) { $result = $object->fetch($id); if ($object->statut == 2 || $object->statut == 3 && $object->close_code != 'replaced') { $result = $object->set_unpaid($user); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); exit;