33require
'../../main.inc.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formfile.class.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/payments.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/fourn/class/fournisseur.facture.class.php';
45require_once DOL_DOCUMENT_ROOT.
'/fourn/class/paiementfourn.class.php';
48$langs->loadLangs(array(
'banks',
'bills',
'companies',
'suppliers'));
53$action =
GETPOST(
'action',
'alpha');
54$confirm =
GETPOST(
'confirm',
'alpha');
62$hookmanager->initHooks(array(
'supplierpaymentcard',
'globalcard'));
65include DOL_DOCUMENT_ROOT.
'/core/actions_fetchobject.inc.php';
70if ($user->isExternalUser()) {
71 $socid = $user->isExternalUser();
75if ($socid && $socid !=
$object->thirdparty->id) {
79$permissiontoadd = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"write"));
80$permissiontovalidate = ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"write"))) || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"supplier_invoice_advance",
"validate")));
81$permissiontodelete = ($user->hasRight(
"fournisseur",
"facture",
"supprimer") || $user->hasRight(
"supplier_invoice",
"delete"));
88if ($action ==
'setnote' && $permissiontoadd) {
102if ($action ==
'confirm_delete' && $confirm ==
'yes' && $permissiontodelete) {
106 $result =
$object->delete($user);
109 header(
'Location: '.DOL_URL_ROOT.
'/fourn/paiement/list.php');
117if ($action ==
'confirm_validate' && $confirm ==
'yes' && $permissiontovalidate) {
121 if (
$object->validate() >= 0) {
123 header(
'Location: '.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id);
131if ($action ==
'setnum_paiement' &&
GETPOST(
'num_paiement') && $permissiontoadd) {
135 setEventMessages($langs->trans(
'PaymentNumberUpdateSucceeded'),
null,
'mesgs');
137 setEventMessages($langs->trans(
'PaymentNumberUpdateFailed'),
null,
'errors');
141if ($action ==
'setdatep' &&
GETPOST(
'datepday') && $permissiontoadd) {
144 $res =
$object->update_date($datepaye);
146 setEventMessages($langs->trans(
'PaymentDateUpdateSucceeded'),
null,
'mesgs');
153$upload_dir =
$conf->fournisseur->payment->dir_output;
154include DOL_DOCUMENT_ROOT.
'/core/actions_builddoc.inc.php';
157$triggersendname =
'PAYMENTRECEIPT_SENTBYMAIL';
159$autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
160$trackid =
'pre'.$object->id;
161include DOL_DOCUMENT_ROOT.
'/core/actions_sendmails.inc.php';
175$head = payment_supplier_prepare_head($object);
177print
dol_get_fiche_head($head,
'payment', $langs->trans(
'SupplierPayment'), -1,
'payment');
183 if ($action ==
'delete') {
184 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
"DeletePayment"), $langs->trans(
"ConfirmDeletePayment"),
'confirm_delete');
190 if ($action ==
'validate') {
191 print $form->formconfirm($_SERVER[
'PHP_SELF'].
'?id='.
$object->id, $langs->trans(
"ValidatePayment"), $langs->trans(
"ConfirmValidatePayment"),
'confirm_validate');
194 $linkback =
'<a href="'.DOL_URL_ROOT.
'/fourn/paiement/list.php'.(!empty($socid) ?
'?socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
198 dol_banner_tab($object,
'id', $linkback, 1,
'rowid',
'ref', $morehtmlref);
200 print
'<div class="fichecenter">';
201 print
'<div class="underbanner clearboth"></div>';
203 print
'<table class="border centpercent">';
211 print
'<tr><td class="titlefield">'.$form->editfieldkey(
"Date",
'datep',
$object->date, $object, (
int) (
$object->statut == 0 && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")))).
'</td>';
213 print $form->editfieldval(
"Date",
'datep',
$object->date, $object,
$object->statut == 0 && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")),
'datehourpicker',
'',
null, $langs->trans(
'PaymentDateUpdateSucceeded'));
217 $labeltype = $langs->trans(
"PaymentType".
$object->type_code) !=
"PaymentType".$object->type_code ? $langs->trans(
"PaymentType".
$object->type_code) :
$object->type_label;
218 print
'<tr><td>'.$langs->trans(
'PaymentMode').
'</td>';
219 print
'<td>'.$labeltype;
220 print
$object->num_payment ?
' - '.$object->num_payment :
'';
232 print
'<tr><td>'.$langs->trans(
'Amount').
'</td>';
233 print
'<td><span class="amount">'.price(
$object->amount, 0, $langs, 0, 0, -1,
$conf->currency).
'</span></td></tr>';
237 print
'<tr><td>'.$langs->trans(
'Status').
'</td>';
238 print
'<td>'.$object->getLibStatut(4).
'</td></tr>';
247 $bankline->fetch(
$object->bank_line);
248 if ($bankline->rappro) {
250 $title_button =
dol_escape_htmltag($langs->transnoentitiesnoconv(
"CantRemoveConciliatedPayment"));
254 print
'<td>'.$langs->trans(
'BankAccount').
'</td>';
257 $accountstatic->fetch($bankline->fk_account);
258 print $accountstatic->getNomUrl(1);
263 print
'<td>'.$langs->trans(
'BankTransactionLine').
'</td>';
265 print $bankline->getNomUrl(1, 0,
'showconciliatedandaccounted');
272 print
'<tr><td>'.$form->editfieldkey(
"Comments",
'note',
$object->note_private, $object, (
int) ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"))).
'</td>';
274 print $form->editfieldval(
"Note",
'note',
$object->note_private, $object, ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")),
'textarea');
288 $sql =
'SELECT f.rowid, f.rowid as facid, f.ref, f.ref_supplier, f.type, f.paye, f.total_ht, f.total_tva, f.total_ttc, f.datef as date, f.fk_statut as status,';
289 $sql .=
' pf.amount, s.nom as name, s.rowid as socid';
290 $sql .=
' FROM '.MAIN_DB_PREFIX.
'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.
'facture_fourn as f,'.MAIN_DB_PREFIX.
'societe as s';
291 $sql .=
' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid';
292 $sql .=
' AND pf.fk_paiementfourn = '.((int)
$object->id);
293 $resql =
$db->query($sql);
295 $num =
$db->num_rows($resql);
300 print
'<table class="noborder centpercent">';
301 print
'<tr class="liste_titre">';
302 print
'<td>'.$langs->trans(
'Invoice').
'</td>';
303 print
'<td>'.$langs->trans(
'RefSupplier').
'</td>';
304 print
'<td>'.$langs->trans(
'Company').
'</td>';
305 print
'<td class="right">'.$langs->trans(
'ExpectedToPay').
'</td>';
306 print
'<td class="right">'.$langs->trans(
'PayedByThisPayment').
'</td>';
307 print
'<td class="right">'.$langs->trans(
'Status').
'</td>';
314 $objp =
$db->fetch_object($resql);
316 $facturestatic->id = $objp->facid;
317 $facturestatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);
318 $facturestatic->date =
$db->jdate($objp->date);
319 $facturestatic->type = $objp->type;
320 $facturestatic->total_ht = $objp->total_ht;
321 $facturestatic->total_tva = $objp->total_tva;
322 $facturestatic->total_ttc = $objp->total_ttc;
323 $facturestatic->statut = $objp->status;
324 $facturestatic->status = $objp->status;
325 $facturestatic->alreadypaid = -1;
327 print
'<tr class="oddeven">';
330 print $facturestatic->getNomUrl(1);
333 print
'<td>'.$objp->ref_supplier.
"</td>\n";
335 print
'<td><a href="'.DOL_URL_ROOT.
'/fourn/card.php?socid='.$objp->socid.
'">'.
img_object($langs->trans(
'ShowCompany'),
'company').
' '.$objp->name.
'</a></td>';
337 print
'<td class="right">'.price($objp->total_ttc).
'</td>';
339 print
'<td class="right">'.price($objp->amount).
'</td>';
341 print
'<td class="right">'.$facturestatic->LibStatut($objp->paye, $objp->status, 6, 1).
'</td>';
344 if ($objp->paye == 1) {
346 $title_button =
dol_escape_htmltag($langs->transnoentitiesnoconv(
"CantRemovePaymentWithOneInvoicePaid"));
348 $total += $objp->amount;
367 print
'<div class="tabsAction">';
370 if ($user->socid == 0 && $action !=
'presend') {
371 $usercansend = (!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"supplier_invoice_advance",
"send")));
373 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
dolBuildUrl($_SERVER[
"PHP_SELF"], [
'id' =>
$object->id,
'action' =>
'presend',
'mode' =>
'init'],
true).
'#formmailbeforetitle',
'');
375 print dolGetButtonAction(
'', $langs->trans(
'SendMail'),
'email',
'#',
'',
false);
381 if ($user->socid == 0 &&
$object->statut == 0 && $action ==
'') {
382 if ((!
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer")))
383 || (
getDolGlobalString(
'MAIN_USE_ADVANCED_PERMS') && $user->hasRight(
"fournisseur",
"supplier_invoice_advance",
"validate"))) {
384 print
'<a class="butAction" href="'.$_SERVER[
'PHP_SELF'].
'?id='.
$object->id.
'&action=validate&token='.newToken().
'">'.$langs->trans(
'Valid').
'</a>';
390 if ($user->socid == 0 && $action !=
'presend') {
391 if ($user->hasRight(
'fournisseur',
'facture',
'supprimer')) {
393 print dolGetButtonAction($langs->trans(
"Delete"),
'',
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', 1);
395 print dolGetButtonAction($title_button, $langs->trans(
"Delete"),
'delete', $_SERVER[
"PHP_SELF"].
'?id='.
$object->id.
'&action=delete&token='.newToken(),
'delete', 0);
402 if (
GETPOST(
'modelselected')) {
406 if ($action !=
'presend') {
407 print
'<div class="fichecenter"><div class="fichehalfleft">';
410 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
412 if (is_array($modellist)) {
415 $urlsource = $_SERVER[
'PHP_SELF'].
'?id='.
$object->id;
416 $genallowed = ($user->hasRight(
"fournisseur",
"facture",
"lire") || $user->hasRight(
"supplier_invoice",
"lire"));
417 $delallowed = ($user->hasRight(
"fournisseur",
"facture",
"creer") || $user->hasRight(
"supplier_invoice",
"creer"));
419 if (empty($modelpdf) && !empty($modellist)) {
420 $tmpkeys = array_keys($modellist);
421 $modelpdf = (
string) $tmpkeys[0];
423 if (empty($modelpdf)) {
424 $modelpdf =
'standard_supplierpayment';
427 print $formfile->showdocuments(
'supplier_payment', $ref, $filedir, $urlsource, (
int) $genallowed, (int) $delallowed, $modelpdf, 1, 0, 0, 40, 0,
'',
'',
'',
$object->thirdparty->default_lang);
428 $somethingshown = $formfile->numoffiles;
431 print
'</div><div class="fichehalfright">';
440 print
'</div></div>';
444 if ($action ==
'presend' && empty(
$object->model_pdf)) {
446 if (!empty($defaultpdfmodel)) {
447 $object->model_pdf = $defaultpdfmodel;
449 include_once DOL_DOCUMENT_ROOT.
'/core/modules/supplier_payment/modules_supplier_payment.php';
451 if (!empty($modellist)) {
452 $tmpkeys = array_keys($modellist);
456 if (empty(
$object->model_pdf)) {
457 $object->model_pdf =
'standard_supplierpayment';
462 $modelmail =
'supplier_payment_send';
463 $defaulttopic =
'SendPaymentReceipt';
464 $diroutput =
$conf->fournisseur->payment->dir_output;
465 $autocopy =
'MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO';
466 $trackid =
'pre'.$object->id;
468 include DOL_DOCUMENT_ROOT.
'/core/tpl/card_presend.tpl.php';
470 recordNotFound(
'', 0);
$id
Support class for third parties, contacts, members, users or resources.
if(! $sortfield) if(! $sortorder) $object
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Class to manage bank accounts.
Class to manage bank transaction lines.
Class to manage suppliers invoices.
static liste_modeles($db, $maxfilenamelength=0)
Return list of active generation modules.
Class to manage payments for supplier invoices.
dol_mktime($hour, $minute, $second, $month, $day, $year, $gm='auto', $check=1)
Return a timestamp date built from detailed information (by default a local PHP server timestamp) Rep...
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
img_object($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $allowothertags=array())
Show a picto called object_picto (generic function)
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
print $langs trans("Show") . '< td style="' . $timeColor . '" align="center"> s</td > badge status0 badge status4 badge status3 Error badge status8< td align="center">< span class="badge ' . $badge . '"></span ></td >< td align="center">< a href="#" class="button button-small" onclick="openLogModal(this)" data-req="' . dol_escape_htmltag($reqSafe) . '" data-res="' . dol_escape_htmltag($resSafe) . '" data-err="' . dol_escape_htmltag($errSafe) . '">< span class="fa fa-search-plus"></span ></a ></td ></tr >< tr >< td colspan="' . $colspan . '" class="opacitymedium"></td ></tr ></table ></div ></form > logModal none logModal none s a JSON string
buildzip.php
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $mode=0)
Check permissions of a user to show a page and an object.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.