--- /tmp/dsg/dolibarr/htdocs/fourn/paiement/github_card.php
+++ /tmp/dsg/dolibarr/htdocs/fourn/paiement/client_card.php
@@ -27,10 +27,10 @@
 

 require '../../main.inc.php';

 require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';

-require_once DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';

-require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';

-require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';

-require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';

+require DOL_DOCUMENT_ROOT.'/fourn/class/paiementfourn.class.php';

+require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.class.php';

+require DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php';

+require DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';

 

 $langs->loadLangs(array('bills', 'banks', 'companies', 'suppliers'));

 

@@ -40,19 +40,10 @@
 

 $object = new PaiementFourn($db);

 

-// Load object

-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.

-

-$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');

-

-// Security check

-if ($user->socid) $socid = $user->socid;

-// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.

-// It should be enough because all payments are done on invoices of the same thirdparty.

-if ($socid && $socid != $object->thirdparty->id) {

-	accessforbidden();

-}

-

+// PDF

+$hidedetails = (GETPOST('hidedetails', 'int') ? GETPOST('hidedetails', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));

+$hidedesc = (GETPOST('hidedesc', 'int') ? GETPOST('hidedesc', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));

+$hideref = (GETPOST('hideref', 'int') ? GETPOST('hideref', 'int') : (!empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF) ? 1 : 0));

 

 /*

  * Actions

@@ -63,12 +54,14 @@
 	$db->begin();

 

 	$object->fetch($id);

-	$result = $object->update_note(GETPOST('note', 'restricthtml'));

+	$result = $object->update_note(GETPOST('note', 'none'));

 	if ($result > 0)

 	{

 		$db->commit();

 		$action = '';

-	} else {

+	}

+	else

+	{

 		setEventMessages($object->error, $object->errors, 'errors');

 		$db->rollback();

 	}

@@ -83,15 +76,17 @@
 	if ($result > 0)

 	{

 		$db->commit();

-		header('Location: '.DOL_URL_ROOT.'/fourn/paiement/list.php');

+		header('Location: '.DOL_URL_ROOT.'/fourn/facture/paiement.php');

 		exit;

-	} else {

+	}

+	else

+	{

 		setEventMessages($object->error, $object->errors, 'errors');

 		$db->rollback();

 	}

 }

 

-if ($action == 'confirm_validate' && $confirm == 'yes' &&

+if ($action == 'confirm_valide' && $confirm == 'yes' &&

 	((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->facture->creer))

 	|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate)))

 )

@@ -99,12 +94,14 @@
 	$db->begin();

 

 	$object->fetch($id);

-	if ($object->validate() >= 0)

+	if ($object->valide() >= 0)

 	{

 		$db->commit();

 		header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);

 		exit;

-	} else {

+	}

+	else

+	{

 		setEventMessages($object->error, $object->errors, 'errors');

 		$db->rollback();

 	}

@@ -117,7 +114,9 @@
 	if ($res === 0)

 	{

 		setEventMessages($langs->trans('PaymentNumberUpdateSucceeded'), null, 'mesgs');

-	} else {

+	}

+	else

+	{

 		setEventMessages($langs->trans('PaymentNumberUpdateFailed'), null, 'errors');

 	}

 }

@@ -130,14 +129,16 @@
 	if ($res === 0)

 	{

 		setEventMessages($langs->trans('PaymentDateUpdateSucceeded'), null, 'mesgs');

-	} else {

+	}

+	else

+	{

 		setEventMessages($langs->trans('PaymentDateUpdateFailed'), null, 'errors');

 	}

 }

 

 // Build document

 $upload_dir = $conf->fournisseur->payment->dir_output;

-// TODO: get the appropriate permission

+// TODO: get the appropriate permisson

 $permissiontoadd = true;

 include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';

 

@@ -155,12 +156,12 @@
 

 $head = payment_supplier_prepare_head($object);

 

-print dol_get_fiche_head($head, 'payment', $langs->trans('SupplierPayment'), -1, 'payment');

+dol_fiche_head($head, 'payment', $langs->trans('SupplierPayment'), -1, 'payment');

 

 if ($result > 0)

 {

 	/*

-	 * Confirmation of payment's delete

+	 * Confirmation de la suppression du paiement

 	 */

 	if ($action == 'delete')

 	{

@@ -168,14 +169,14 @@
 	}

 

 	/*

-	 * Confirmation of payment's validation

+	 * Confirmation de la validation du paiement

 	 */

-	if ($action == 'validate')

-	{

-		print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_validate');

-	}

-

-	$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';

+	if ($action == 'valide')

+	{

+		print $form->formconfirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide');

+	}

+

+	$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/facture/paiement.php'.(!empty($socid) ? '?socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';

 

 

 	dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref');

@@ -186,46 +187,41 @@
 	print '<table class="border centpercent">';

 

 	/*print '<tr>';

-	print '<td width="20%">'.$langs->trans('Ref').'</td><td>';

+	print '<td width="20%" colspan="2">'.$langs->trans('Ref').'</td><td colspan="3">';

     print $form->showrefnav($object,'id','',1,'rowid','ref');

 	print '</td></tr>';*/

 

-	// Date of payment

-	print '<tr><td class="titlefield">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';

-	print '<td>';

+	// Date payment

+	print '<tr><td class="titlefield" colspan="2">'.$form->editfieldkey("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';

 	print $form->editfieldval("Date", 'datep', $object->date, $object, $object->statut == 0 && $user->rights->fournisseur->facture->creer, 'datehourpicker', '', null, $langs->trans('PaymentDateUpdateSucceeded'));

 	print '</td></tr>';

 

 	// Payment mode

 	$labeltype = $langs->trans("PaymentType".$object->type_code) != ("PaymentType".$object->type_code) ? $langs->trans("PaymentType".$object->type_code) : $object->type_label;

-	print '<tr><td>'.$langs->trans('PaymentMode').'</td>';

-	print '<td>'.$labeltype;

-	print $object->num_payment ? ' - '.$object->num_payment : '';

+	print '<tr><td colspan="2">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype;

+	print $object->num_paiement ? ' - '.$object->num_paiement : '';

 	print '</td></tr>';

 

 	// Payment numero

 	/* TODO Add field num_payment into payment table and save it

-	print '<tr><td>'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td>';

-	print '<td>';

+	print '<tr><td colspan="2">'.$form->editfieldkey("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';

 	print $form->editfieldval("Numero",'num_paiement',$object->num_paiement,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));

 	print '</td></tr>';

     */

 

 	// Amount

-	print '<tr><td>'.$langs->trans('Amount').'</td>';

-	print '<td>'.price($object->amount, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';

+	print '<tr><td colspan="2">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant, '', $langs, 0, 0, -1, $conf->currency).'</td></tr>';

 

 	if (!empty($conf->global->BILL_ADD_PAYMENT_VALIDATION))

 	{

-		print '<tr><td>'.$langs->trans('Status').'</td>';

-		print '<td>'.$object->getLibStatut(4).'</td></tr>';

+		print '<tr><td colspan="2">'.$langs->trans('Status').'</td><td colspan="3">'.$object->getLibStatut(4).'</td></tr>';

 	}

 

 	$allow_delete = 1;

 	// Bank account

 	if (!empty($conf->banque->enabled))

 	{

-		if ($object->fk_account)

+		if ($object->bank_account)

 		{

 			$bankline = new AccountLine($db);

 			$bankline->fetch($object->bank_line);

@@ -236,8 +232,8 @@
 			}

 

 			print '<tr>';

-			print '<td>'.$langs->trans('BankAccount').'</td>';

-			print '<td>';

+			print '<td colspan="2">'.$langs->trans('BankAccount').'</td>';

+			print '<td colspan="3">';

 			$accountstatic = new Account($db);

 			$accountstatic->fetch($bankline->fk_account);

 			print $accountstatic->getNomUrl(1);

@@ -245,8 +241,8 @@
 			print '</tr>';

 

 			print '<tr>';

-			print '<td>'.$langs->trans('BankTransactionLine').'</td>';

-			print '<td>';

+			print '<td colspan="2">'.$langs->trans('BankTransactionLine').'</td>';

+			print '<td colspan="3">';

 			print $bankline->getNomUrl(1, 0, 'showconciliated');

 			print '</td>';

 			print '</tr>';

@@ -254,8 +250,7 @@
 	}

 

 	// Note

-	print '<tr><td>'.$form->editfieldkey("Comments", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td>';

-	print '<td>';

+	print '<tr><td colspan="2">'.$form->editfieldkey("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';

 	print $form->editfieldval("Note", 'note', $object->note, $object, $user->rights->fournisseur->facture->creer, 'textarea');

 	print '</td></tr>';

 

@@ -266,10 +261,9 @@
 	print '<br>';

 

 	/**

-	 *	List of seller's invoices

+	 *	Liste des factures

 	 */

-	$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,';

-	$sql .= ' pf.amount, s.nom as name, s.rowid as socid';

+	$sql = 'SELECT f.rowid, f.ref, f.ref_supplier, f.total_ttc, pf.amount, f.rowid as facid, f.paye, f.fk_statut, s.nom as name, s.rowid as socid';

 	$sql .= ' FROM '.MAIN_DB_PREFIX.'paiementfourn_facturefourn as pf,'.MAIN_DB_PREFIX.'facture_fourn as f,'.MAIN_DB_PREFIX.'societe as s';

 	$sql .= ' WHERE pf.fk_facturefourn = f.rowid AND f.fk_soc = s.rowid';

 	$sql .= ' AND pf.fk_paiementfourn = '.$object->id;

@@ -280,10 +274,10 @@
 

 		$i = 0;

 		$total = 0;

-

+		print '<b>'.$langs->trans("Invoices").'</b><br>';

 		print '<table class="noborder centpercent">';

 		print '<tr class="liste_titre">';

-		print '<td>'.$langs->trans('Invoice').'</td>';

+		print '<td>'.$langs->trans('Ref').'</td>';

 		print '<td>'.$langs->trans('RefSupplier').'</td>';

 		print '<td>'.$langs->trans('Company').'</td>';

 		print '<td class="right">'.$langs->trans('ExpectedToPay').'</td>';

@@ -301,13 +295,6 @@
 

 				$facturestatic->id = $objp->facid;

 				$facturestatic->ref = ($objp->ref ? $objp->ref : $objp->rowid);

-				$facturestatic->date = $db->jdate($objp->date);

-				$facturestatic->type = $objp->type;

-				$facturestatic->total_ht = $objp->total_ht;

-				$facturestatic->total_tva = $objp->total_tva;

-				$facturestatic->total_ttc = $objp->total_ttc;

-				$facturestatic->statut = $objp->status;

-				$facturestatic->alreadypaid = -1; // unknown

 

 				print '<tr class="oddeven">';

 				// Ref

@@ -320,10 +307,10 @@
 				print '<td><a href="'.DOL_URL_ROOT.'/fourn/card.php?socid='.$objp->socid.'">'.img_object($langs->trans('ShowCompany'), 'company').' '.$objp->name.'</a></td>';

 				// Expected to pay

 				print '<td class="right">'.price($objp->total_ttc).'</td>';

-				// Paid

+				// Payed

 				print '<td class="right">'.price($objp->amount).'</td>';

 				// Status

-				print '<td class="right">'.$facturestatic->LibStatut($objp->paye, $objp->status, 6, 1).'</td>';

+				print '<td class="right">'.$facturestatic->LibStatut($objp->paye, $objp->fk_statut, 6, 1).'</td>';

 				print "</tr>\n";

 

 				if ($objp->paye == 1)

@@ -339,7 +326,9 @@
 

 		print "</table>\n";

 		$db->free($resql);

-	} else {

+	}

+	else

+	{

 		dol_print_error($db);

 	}

 

@@ -347,7 +336,7 @@
 

 

 	/*

-	 * Actions Buttons

+	 * Boutons Actions

 	 */

 

 	print '<div class="tabsAction">';

@@ -358,7 +347,7 @@
 			if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->facture->creer))

 		   	|| (!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && !empty($user->rights->fournisseur->supplier_invoice_advance->validate)))

 			{

-				print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=validate">'.$langs->trans('Valid').'</a>';

+				print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=valide">'.$langs->trans('Valid').'</a>';

 			}

 		}

 	}

@@ -368,8 +357,10 @@
 		{

 			if ($allow_delete)

 			{

-				print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete&amp;token='.newToken().'">'.$langs->trans('Delete').'</a>';

-			} else {

+				print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&amp;action=delete">'.$langs->trans('Delete').'</a>';

+			}

+			else

+			{

 				print '<a class="butActionRefused classfortooltip" href="#" title="'.$title_button.'">'.$langs->trans('Delete').'</a>';

 			}

 		}

@@ -390,7 +381,7 @@
 		$urlsource = $_SERVER['PHP_SELF'].'?id='.$object->id;

 		$genallowed = $user->rights->fournisseur->facture->lire;

 		$delallowed = $user->rights->fournisseur->facture->creer;

-		$modelpdf = (!empty($object->model_pdf) ? $object->model_pdf : (empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF) ? '' : $conf->global->SUPPLIER_PAYMENT_ADDON_PDF));

+		$modelpdf = (!empty($object->modelpdf) ? $object->modelpdf : (empty($conf->global->SUPPLIER_PAYMENT_ADDON_PDF) ? '' : $conf->global->SUPPLIER_PAYMENT_ADDON_PDF));

 

 		print $formfile->showdocuments('supplier_payment', $ref, $filedir, $urlsource, $genallowed, $delallowed, $modelpdf, 1, 0, 0, 40, 0, '', '', '', $societe->default_lang);

 		$somethingshown = $formfile->numoffiles;

@@ -406,12 +397,14 @@
 	*/

 

 	print '</div></div></div>';

-} else {

+}

+else

+{

 	$langs->load("errors");

 	print $langs->trans("ErrorRecordNotFound");

 }

 

-print dol_get_fiche_end();

+dol_fiche_end();

 

 // End of page

 llxFooter();

--- /tmp/dsg/dolibarr/htdocs/fourn/paiement/github_info.php
+++ /tmp/dsg/dolibarr/htdocs/fourn/paiement/client_info.php
@@ -33,26 +33,8 @@
 $id = GETPOST('id', 'int');

 

 $object = new PaiementFourn($db);

-

-// Load object

-include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.

-

-$result = restrictedArea($user, $object->element, $object->id, 'paiementfourn', '');

-

-// Security check

-if ($user->socid) $socid = $user->socid;

-// Now check also permission on thirdparty of invoices of payments. Thirdparty were loaded by the fetch_object before based on first invoice.

-// It should be enough because all payments are done on invoices of the same thirdparty.

-if ($socid && $socid != $object->thirdparty->id) {

-	accessforbidden();

-}

-

-

-/*

- * Actions

- */

-

-// None

+$object->fetch($id);

+$object->info($id);

 

 

 /*

@@ -61,17 +43,13 @@
 

 llxHeader();

 

-$object->info($id);

-

 $head = payment_supplier_prepare_head($object);

 

-print dol_get_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment');

-

-$linkback = '<a href="'.DOL_URL_ROOT.'/fourn/paiement/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';

+dol_fiche_head($head, 'info', $langs->trans("SupplierPayment"), 0, 'payment');

 

 dol_banner_tab($object, 'id', $linkback, -1, 'rowid', 'ref');

 

-print dol_get_fiche_end();

+dol_fiche_end();

 

 print '<table width="100%"><tr><td>';

 dol_print_object_info($object);