28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/compta/facture/class/facture.class.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/class/discount.class.php';
31 require_once DOL_DOCUMENT_ROOT.
'/core/lib/invoice.lib.php';
33 require_once DOL_DOCUMENT_ROOT.
'/projet/class/project.class.php';
37 $langs->loadLangs(array(
'companies',
'bills'));
41 $socid =
GETPOST(
'socid',
'int');
42 $action =
GETPOST(
'action',
'aZ09');
46 if ($id > 0 || !empty($ref)) {
47 $object->fetch($id, $ref,
'',
'', (!empty($conf->global->INVOICE_USE_SITUATION) ? $conf->global->INVOICE_USE_SITUATION : 0));
50 $permissionnote = $user->rights->facture->creer;
55 $socid = $user->socid;
57 $hookmanager->initHooks(array(
'invoicenote'));
66 $reshook = $hookmanager->executeHooks(
'doActions', array(), $object, $action);
70 if (empty($reshook)) {
71 include DOL_DOCUMENT_ROOT.
'/core/actions_setnotes.inc.php';
80 if (empty($object->id)) {
82 $langs->load(
'errors');
83 echo
'<div class="error">'.$langs->trans(
"ErrorRecordNotFound").
'</div>';
88 $title = $langs->trans(
'InvoiceCustomer').
" - ".$langs->trans(
'Notes');
89 $helpurl =
"EN:Customers_Invoices|FR:Factures_Clients|ES:Facturas_a_clientes";
94 if ($id > 0 || !empty($ref)) {
96 $object->fetch($id, $ref);
98 $object->fetch_thirdparty();
102 $totalpaid = $object->getSommePaiement();
104 print
dol_get_fiche_head($head,
'note', $langs->trans(
"InvoiceCustomer"), -1,
'bill');
108 $linkback =
'<a href="'.DOL_URL_ROOT.
'/compta/facture/list.php?restore_lastsearch_values=1'.(!empty($socid) ?
'&socid='.$socid :
'').
'">'.$langs->trans(
"BackToList").
'</a>';
110 $morehtmlref =
'<div class="refidno">';
112 $morehtmlref .=
$form->editfieldkey(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'', 0, 1);
113 $morehtmlref .=
$form->editfieldval(
"RefCustomer",
'ref_client', $object->ref_client, $object, 0,
'string',
'',
null,
null,
'', 1);
115 $morehtmlref .=
'<br>'.$langs->trans(
'ThirdParty').
' : '.$object->thirdparty->getNomUrl(1,
'customer');
118 $langs->load(
"projects");
119 $morehtmlref .=
'<br>'.$langs->trans(
'Project').
' ';
120 if ($user->rights->facture->creer) {
121 if ($action !=
'classify') {
123 $morehtmlref .=
' : ';
125 if ($action ==
'classify') {
127 $morehtmlref .=
'<form method="post" action="'.$_SERVER[
'PHP_SELF'].
'?id='.$object->id.
'">';
128 $morehtmlref .=
'<input type="hidden" name="action" value="classin">';
129 $morehtmlref .=
'<input type="hidden" name="token" value="'.newToken().
'">';
130 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project,
'projectid', $maxlength, 0, 1, 0, 1, 0, 0,
'', 1);
131 $morehtmlref .=
'<input type="submit" class="button valignmiddle" value="'.$langs->trans(
"Modify").
'">';
132 $morehtmlref .=
'</form>';
134 $morehtmlref .=
$form->form_project($_SERVER[
'PHP_SELF'].
'?id='.$object->id, $object->socid, $object->fk_project,
'none', 0, 0, 0, 1);
137 if (!empty($object->fk_project)) {
139 $proj->fetch($object->fk_project);
140 $morehtmlref .=
' : '.$proj->getNomUrl(1);
142 $morehtmlref .=
' - '.$proj->title;
149 $morehtmlref .=
'</div>';
151 $object->totalpaid = $totalpaid;
153 dol_banner_tab($object,
'ref', $linkback, 1,
'ref',
'ref', $morehtmlref,
'', 0);
155 print
'<div class="fichecenter">';
156 print
'<div class="underbanner clearboth"></div>';
159 $cssclass =
"titlefield";
160 include DOL_DOCUMENT_ROOT.
'/core/tpl/notes.tpl.php';