QUAL rename facnumber by ref

This commit is contained in:
Maxime Kohlhaas 2018-12-02 14:31:45 +01:00
parent aa2ecd4b73
commit 2e496ea83a
77 changed files with 284 additions and 253 deletions

View File

@ -94,7 +94,7 @@ $facture_static = new Facture($db);
$formaccounting = new FormAccounting($db);
if (! empty($id)) {
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price,";
$sql = "SELECT f.ref, f.rowid as facid, l.fk_product, l.description, l.price,";
$sql .= " l.qty, l.rowid, l.tva_tx, l.remise_percent, l.subprice, p.accountancy_code_sell as code_sell,";
$sql .= " l.fk_code_ventilation, aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as l";
@ -128,7 +128,7 @@ if (! empty($id)) {
// Ref facture
print '<tr><td>' . $langs->trans("Invoice") . '</td>';
$facture_static->ref = $objp->facnumber;
$facture_static->ref = $objp->ref;
$facture_static->id = $objp->facid;
print '<td>' . $facture_static->getNomUrl(1) . '</td>';
print '</tr>';

View File

@ -64,7 +64,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$offset = $limit * $page;
if (! $sortfield)
$sortfield = "f.datef, f.facnumber, fd.rowid";
$sortfield = "f.datef, f.ref, fd.rowid";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_DONE > 0) {
$sortorder = "DESC";
@ -167,7 +167,7 @@ print '<script type="text/javascript">
/*
* Customer Invoice lines
*/
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.type, f.datef, f.ref_client,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.rowid, fd.description, fd.product_type as line_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.vat_src_code, fd.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.code_client,";
$sql.= " p.rowid as product_id, p.fk_product_type as product_type, p.ref as product_ref, p.label as product_label, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number, aa.label as label_compte,";
@ -195,7 +195,7 @@ if ($search_lineid) {
$sql .= natural_search("fd.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice);
$sql .= natural_search("f.ref", $search_invoice);
}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
@ -331,8 +331,8 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "fd.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, fd.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "fd.description", "", $param, '', $sortfield, $sortorder);

View File

@ -75,7 +75,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortfield)
$sortfield = "f.datef, f.facnumber, l.rowid";
$sortfield = "f.datef, f.ref, l.rowid";
if (! $sortorder) {
if ($conf->global->ACCOUNTING_LIST_SORT_VENTILATION_TODO > 0) {
$sortorder = "DESC";
@ -209,7 +209,7 @@ if (empty($chartaccountcode))
}
// Customer Invoice lines
$sql = "SELECT f.rowid as facid, f.facnumber as ref, f.datef, f.type as ftype,";
$sql = "SELECT f.rowid as facid, f.ref as ref, f.datef, f.type as ftype,";
$sql.= " l.rowid, l.fk_product, l.description, l.total_ht, l.fk_code_ventilation, l.product_type as type_l, l.tva_tx as tva_tx_line, l.vat_src_code,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type, p.accountancy_code_sell as code_sell, p.tva_tx as tva_tx_prod,";
$sql.= " aa.rowid as aarowid,";
@ -233,7 +233,7 @@ if ($search_lineid) {
$sql .= natural_search("l.rowid", $search_lineid, 1);
}
if (strlen(trim($search_invoice))) {
$sql .= natural_search("f.facnumber", $search_invoice);
$sql .= natural_search("f.ref", $search_invoice);
}
if (strlen(trim($search_ref))) {
$sql .= natural_search("p.ref", $search_ref);
@ -399,8 +399,8 @@ if ($result) {
print '<tr class="liste_titre">';
print_liste_field_titre("LineId", $_SERVER["PHP_SELF"], "l.rowid", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.facnumber, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("Invoice", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Date", $_SERVER["PHP_SELF"], "f.datef, f.ref, l.rowid", "", $param, 'align="center"', $sortfield, $sortorder);
print_liste_field_titre("ProductRef", $_SERVER["PHP_SELF"], "p.ref", "", $param, '', $sortfield, $sortorder);
//print_liste_field_titre("ProductLabel", $_SERVER["PHP_SELF"], "p.label", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "l.description", "", $param, '', $sortfield, $sortorder);

View File

@ -1179,7 +1179,7 @@ function getSourceDocRef($val, $typerecord)
$sqlmid = '';
if ($typerecord == 'payment')
{
$sqlmid = 'SELECT payfac.fk_facture as id, f.facnumber as ref';
$sqlmid = 'SELECT payfac.fk_facture as id, f.ref as ref';
$sqlmid .= " FROM ".MAIN_DB_PREFIX."paiement_facture as payfac, ".MAIN_DB_PREFIX."facture as f";
$sqlmid .= " WHERE payfac.fk_facture = f.rowid AND payfac.fk_paiement=" . $val["paymentid"];
$ref = $langs->trans("Invoice");

View File

@ -97,7 +97,7 @@ if (! GETPOSTISSET('date_startmonth') && (empty($date_start) || empty($date_end)
$idpays = $mysoc->country_id;
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql = "SELECT f.rowid, f.ref, f.type, f.datef as df, f.ref_client, f.date_lim_reglement as dlr, f.close_code,";
$sql .= " fd.rowid as fdid, fd.description, fd.product_type, fd.total_ht, fd.total_tva, fd.total_localtax1, fd.total_localtax2, fd.tva_tx, fd.total_ttc, fd.situation_percent, fd.vat_src_code,";
$sql .= " s.rowid as socid, s.nom as name, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell, aa.rowid as fk_compte, aa.account_number as compte, aa.label as label_compte";
@ -195,7 +195,7 @@ if ($result) {
// Invoice lines
$tabfac[$obj->rowid]["date"] = $db->jdate($obj->df);
$tabfac[$obj->rowid]["datereg"] = $db->jdate($obj->dlr);
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
$tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["type"] = $obj->type;
$tabfac[$obj->rowid]["description"] = $obj->label_compte;
$tabfac[$obj->rowid]["close_code"] = $obj->close_code; // close_code = 'replaced' for replacement invoices (not used in most european countries)

View File

@ -96,7 +96,7 @@ $facturefournisseur_static = new FactureFournisseur($db);
$formaccounting = new FormAccounting($db);
if (! empty($id)) {
$sql = "SELECT f.ref as facnumber, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql = "SELECT f.ref as ref, f.rowid as facid, l.fk_product, l.description, l.rowid, l.fk_code_ventilation, ";
$sql .= " p.rowid as product_id, p.ref as product_ref, p.label as product_label";
$sql .= ", aa.account_number, aa.label";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as l";
@ -129,7 +129,7 @@ if (! empty($id)) {
// ref invoice
print '<tr><td>' . $langs->trans("BillsSuppliers") . '</td>';
$facturefournisseur_static->ref = $objp->facnumber;
$facturefournisseur_static->ref = $objp->ref;
$facturefournisseur_static->id = $objp->facid;
print '<td>' . $facturefournisseur_static->getNomUrl(1) . '</td>';
print '</tr>';

View File

@ -413,7 +413,7 @@ class BlockedLog
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public','lines'
))) continue; // Discard if not into a dedicated list
if ($key == 'lines')
{
@ -444,7 +444,7 @@ class BlockedLog
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value)) $this->object_data->{$key} = $value;
}
@ -557,7 +557,7 @@ class BlockedLog
{
if (in_array($key, $arrayoffieldstoexclude)) continue; // Discard some properties
if (! in_array($key, array(
'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
'ref','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public'
))) continue; // Discard if not into a dedicated list
if (!is_object($value))
{

View File

@ -1136,7 +1136,7 @@ if ($object->id > 0)
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.amount';
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.amount';
$sql.= ', f.total as total_ht';
$sql.= ', f.tva as total_tva';
$sql.= ', f.total_ttc';
@ -1147,7 +1147,7 @@ if ($object->id > 0)
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON f.rowid=pf.fk_facture';
$sql.= " WHERE f.fk_soc = s.rowid AND s.rowid = ".$object->id;
$sql.= " AND f.entity = ".$conf->entity;
$sql.= ' GROUP BY f.rowid, f.facnumber, f.type, f.amount, f.total, f.tva, f.total_ttc,';
$sql.= ' GROUP BY f.rowid, f.ref, f.type, f.amount, f.total, f.tva, f.total_ttc,';
$sql.= ' f.datef, f.datec, f.paye, f.fk_statut,';
$sql.= ' s.nom, s.rowid';
$sql.= " ORDER BY f.datef DESC, f.datec DESC";
@ -1176,7 +1176,7 @@ if ($object->id > 0)
$objp = $db->fetch_object($resql);
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->ref = $objp->ref;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;

View File

@ -2775,7 +2775,7 @@ class Propal extends CommonObject
if (count($linkedInvoices) > 0)
{
$sql= "SELECT rowid as facid, facnumber, total, datef as df, fk_user_author, fk_statut, paye";
$sql= "SELECT rowid as facid, ref, total, datef as df, fk_user_author, fk_statut, paye";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE rowid IN (".implode(',',$linkedInvoices).")";

View File

@ -415,7 +415,7 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description,";
$sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,";
$sql.= " fa.facnumber as ref, fa.type as type";
$sql.= " fa.ref as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."societe_remise_except as rc";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fa ON rc.fk_facture_source = fa.rowid";
$sql.= " WHERE rc.fk_soc = " . $object->id;
@ -704,8 +704,8 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql.= " rc.fk_facture_source,";
$sql.= " u.login, u.rowid as user_id,";
$sql.= " f.rowid, f.facnumber,";
$sql.= " fa.facnumber as ref, fa.type as type";
$sql.= " f.rowid, f.ref,";
$sql.= " fa.ref as ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."user as u";
$sql.= " , ".MAIN_DB_PREFIX."facturedet as fc";
@ -723,8 +723,8 @@ if ($socid > 0)
$sql2.= " rc.datec as dc, rc.description, rc.fk_facture_line, rc.fk_facture,";
$sql2.= " rc.fk_facture_source,";
$sql2.= " u.login, u.rowid as user_id,";
$sql2.= " f.rowid, f.facnumber,";
$sql2.= " fa.facnumber as ref, fa.type as type";
$sql2.= " f.rowid, f.ref,";
$sql2.= " fa.ref as ref, fa.type as type";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
$sql2.= " , ".MAIN_DB_PREFIX."societe_remise_except as rc";
@ -819,7 +819,7 @@ if ($socid > 0)
print $obj->description;
print '</td>';
}
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>';
@ -858,7 +858,7 @@ if ($socid > 0)
$sql.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql.= " rc.fk_invoice_supplier_source,";
$sql.= " u.login, u.rowid as user_id,";
$sql.= " f.rowid, f.ref as facnumber,";
$sql.= " f.rowid, f.ref as ref,";
$sql.= " fa.ref, fa.type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql.= " , ".MAIN_DB_PREFIX."user as u";
@ -877,7 +877,7 @@ if ($socid > 0)
$sql2.= " rc.datec as dc, rc.description, rc.fk_invoice_supplier_line, rc.fk_invoice_supplier,";
$sql2.= " rc.fk_invoice_supplier_source,";
$sql2.= " u.login, u.rowid as user_id,";
$sql2.= " f.rowid, f.ref as facnumber,";
$sql2.= " f.rowid, f.ref as ref,";
$sql2.= " fa.ref, fa.type as type";
$sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as f";
$sql2.= " , ".MAIN_DB_PREFIX."user as u";
@ -973,7 +973,7 @@ if ($socid > 0)
print $obj->description;
print '</td>';
}
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->facnumber.'</a></td>';
print '<td align="left" class="nowrap"><a href="'.DOL_URL_ROOT.'/fourn/facture/card.php?facid='.$obj->rowid.'">'.img_object($langs->trans("ShowBill"),'bill').' '.$obj->ref.'</a></td>';
print '<td align="right">'.price($obj->amount_ht).'</td>';
print '<td align="right">'.price2num($obj->tva_tx,'MU').'%</td>';
print '<td align="right">'.price($obj->amount_ttc).'</td>';

View File

@ -136,7 +136,7 @@ if (($action == 'create' || $action == 'add') && !$error)
$closeOrders = GETPOST('autocloseorders') ? true : false;
// Security check
$fieldid = GETPOST('ref','alpha')?'facnumber':'rowid';
$fieldid = GETPOST('ref','alpha')?'ref':'rowid';
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
@ -163,7 +163,7 @@ if (($action == 'create' || $action == 'add') && !$error)
// Si facture standard
$object->socid = $_POST['socid'];
$object->type = $_POST['type'];
$object->number = $_POST['facnumber'];
$object->number = $_POST['ref'];
$object->date = $datefacture;
$object->note_public = trim($_POST['note_public']);
$object->note = trim($_POST['note']);
@ -405,7 +405,7 @@ if ($action == 'create' && !$error)
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="'.$soc->id.'">' ."\n";
print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="'.$ref_client.'">';
print '<input name="ref_int" type="hidden" value="'.$ref_int.'">';
print '<input type="hidden" name="origin" value="'.GETPOST('origin').'">';

View File

@ -136,7 +136,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"])
$sqls = array();
// Customer invoices
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
$sql = "SELECT 'invoice' as family, f.rowid as objid, f.ref as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,";
$sql.= " s.rowid as socid, s.nom as name, s.fournisseur";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid";

View File

@ -88,7 +88,7 @@ $filesarray=array();
$result=false;
if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){
$wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'";
$sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql="SELECT rowid as id, ref as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture";
$sql.=" WHERE datef between ".$wheretail;
$sql.=" UNION ALL";
$sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn";

View File

@ -128,7 +128,7 @@ $permissiondellink = $usercancreate; // Used by the include of actions_dellink.i
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdonw.inc.php
// Security check
$fieldid = (! empty($ref) ? 'facnumber' : 'rowid');
$fieldid = (! empty($ref) ? 'ref' : 'rowid');
if ($user->societe_id) $socid = $user->societe_id;
$isdraft = (($object->statut == Facture::STATUS_DRAFT) ? 1 : 0);
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid, $isdraft);
@ -912,7 +912,7 @@ if (empty($reshook))
if (! $error)
{
$object->socid = GETPOST('socid','int');
$object->number = $_POST['facnumber'];
$object->number = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none'));
@ -1093,7 +1093,7 @@ if (empty($reshook))
{
$object->socid = GETPOST('socid','int');
$object->type = $_POST['type'];
$object->number = $_POST['facnumber'];
$object->number = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none'));
@ -1144,7 +1144,7 @@ if (empty($reshook))
// Si facture standard
$object->socid = GETPOST('socid','int');
$object->type = GETPOST('type');
$object->number = $_POST['facnumber'];
$object->number = $_POST['ref'];
$object->date = $dateinvoice;
$object->date_pointoftax = $date_pointoftax;
$object->note_public = trim(GETPOST('note_public','none'));
@ -2718,7 +2718,7 @@ if ($action == 'create')
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
if ($soc->id > 0) print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
print '<input type="hidden" name="origin" value="' . $origin . '">';
@ -3740,7 +3740,7 @@ else if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';

View File

@ -93,7 +93,7 @@ class Facture extends CommonInvoice
/**
* {@inheritdoc}
*/
protected $table_ref_field = 'facnumber';
protected $table_ref_field = 'ref';
public $socid;
@ -450,7 +450,7 @@ class Facture extends CommonInvoice
$socid = $this->socid;
$sql = "INSERT INTO ".MAIN_DB_PREFIX."facture (";
$sql.= " facnumber";
$sql.= " ref";
$sql.= ", entity";
$sql.= ", ref_ext";
$sql.= ", type";
@ -514,7 +514,7 @@ class Facture extends CommonInvoice
// Update ref with new one
$this->ref='(PROV'.$this->id.')';
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET facnumber='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
$sql = 'UPDATE '.MAIN_DB_PREFIX."facture SET ref='".$this->db->escape($this->ref)."' WHERE rowid=".$this->id;
$resql=$this->db->query($sql);
if (! $resql) $error++;
@ -1310,7 +1310,7 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql = 'SELECT f.rowid,f.entity,f.ref,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df, f.date_pointoftax';
@ -1336,7 +1336,7 @@ class Facture extends CommonInvoice
if ($rowid) $sql.= " WHERE f.rowid=".$rowid;
else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
if ($ref) $sql.= " AND f.ref='".$this->db->escape($ref)."'";
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
@ -1351,7 +1351,7 @@ class Facture extends CommonInvoice
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->facnumber;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
$this->ref_int = $obj->ref_int;
@ -1615,7 +1615,7 @@ class Facture extends CommonInvoice
// Clean parameters
if (empty($this->type)) $this->type= self::TYPE_STANDARD;
if (isset($this->facnumber)) $this->facnumber=trim($this->ref);
if (isset($this->ref)) $this->ref=trim($this->ref);
if (isset($this->ref_client)) $this->ref_client=trim($this->ref_client);
if (isset($this->increment)) $this->increment=trim($this->increment);
if (isset($this->close_code)) $this->close_code=trim($this->close_code);
@ -1631,7 +1631,7 @@ class Facture extends CommonInvoice
// Update request
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET";
$sql.= " facnumber=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " ref=".(isset($this->ref)?"'".$this->db->escape($this->ref)."'":"null").",";
$sql.= " type=".(isset($this->type)?$this->db->escape($this->type):"null").",";
$sql.= " ref_client=".(isset($this->ref_client)?"'".$this->db->escape($this->ref_client)."'":"null").",";
$sql.= " increment=".(isset($this->increment)?"'".$this->db->escape($this->increment)."'":"null").",";
@ -2337,7 +2337,7 @@ class Facture extends CommonInvoice
// Validate
$sql = 'UPDATE '.MAIN_DB_PREFIX.'facture';
$sql.= " SET facnumber='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
$sql.= " SET ref='".$num."', fk_statut = ".self::STATUS_VALIDATED.", fk_user_valid = ".($user->id > 0 ? $user->id : "null").", date_valid = '".$this->db->idate($now)."'";
if (! empty($conf->global->FAC_FORCE_DATE_VALIDATION)) // If option enabled, we force invoice date
{
$sql.= ", datef='".$this->db->idate($this->date)."'";
@ -2446,7 +2446,7 @@ class Facture extends CommonInvoice
if (! $error)
{
$this->ref = $num;
$this->facnumber=$num;
$this->ref=$num;
$this->statut= self::STATUS_VALIDATED;
$this->brouillon=0;
$this->date_validation=$now;
@ -3479,7 +3479,7 @@ class Facture extends CommonInvoice
$ga = array();
$sql = "SELECT s.rowid, s.nom as name, s.client,";
$sql.= " f.rowid as fid, f.facnumber as ref, f.datef as df";
$sql.= " f.rowid as fid, f.ref as ref, f.datef as df";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", sc.fk_soc, sc.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as f";
if (! $user->rights->societe->client->voir && ! $socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -3549,7 +3549,7 @@ class Facture extends CommonInvoice
$return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut,";
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut,";
$sql.= " ff.rowid as rowidnext";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
@ -3560,7 +3560,7 @@ class Facture extends CommonInvoice
$sql.= " AND pf.fk_paiement IS NULL"; // Aucun paiement deja fait
$sql.= " AND ff.fk_statut IS NULL"; // Renvoi vrai si pas facture de remplacement
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber";
$sql.= " ORDER BY f.ref";
dol_syslog(get_class($this)."::list_replacable_invoices", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -3569,7 +3569,7 @@ class Facture extends CommonInvoice
while ($obj=$this->db->fetch_object($resql))
{
$return[$obj->rowid]=array( 'id' => $obj->rowid,
'ref' => $obj->facnumber,
'ref' => $obj->ref,
'status' => $obj->fk_statut);
}
//print_r($return);
@ -3600,7 +3600,7 @@ class Facture extends CommonInvoice
$return = array();
$sql = "SELECT f.rowid as rowid, f.facnumber, f.fk_statut, f.type, f.paye, pf.fk_paiement";
$sql = "SELECT f.rowid as rowid, f.ref, f.fk_statut, f.type, f.paye, pf.fk_paiement";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."paiement_facture as pf ON f.rowid = pf.fk_facture";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as ff ON (f.rowid = ff.fk_facture_source AND ff.type=".self::TYPE_REPLACEMENT.")";
@ -3629,7 +3629,7 @@ class Facture extends CommonInvoice
}
if ($socid > 0) $sql.=" AND f.fk_soc = ".$socid;
$sql.= " ORDER BY f.facnumber";
$sql.= " ORDER BY f.ref";
dol_syslog(get_class($this)."::list_qualified_avoir_invoices", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -3642,9 +3642,9 @@ class Facture extends CommonInvoice
if ($obj->fk_statut == self::STATUS_CLOSED) $qualified=1;
if ($qualified)
{
//$ref=$obj->facnumber;
//$ref=$obj->ref;
$paymentornot=($obj->fk_paiement?1:0);
$return[$obj->rowid]=array('ref'=>$obj->facnumber,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
$return[$obj->rowid]=array('ref'=>$obj->ref,'status'=>$obj->fk_statut,'type'=>$obj->type,'paye'=>$obj->paye,'paymentornot'=>$paymentornot);
}
}

View File

@ -193,7 +193,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
dol_fiche_end();

View File

@ -160,7 +160,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -107,7 +107,7 @@ $morehtmlref.='</div>';
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -117,7 +117,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
// Security check
$fieldid = (! empty($ref)?'facnumber':'rowid');
$fieldid = (! empty($ref)?'ref':'rowid');
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id,'','','fk_soc',$fieldid);
@ -138,7 +138,7 @@ $search_array_options=$extrafields->getOptionalsFromPost($object->table_element,
// List of fields to search into when doing a "search in all"
$fieldstosearchall = array(
'f.facnumber'=>'Ref',
'f.ref'=>'Ref',
'f.ref_client'=>'RefCustomer',
'pd.description'=>'Description',
's.nom'=>"ThirdParty",
@ -148,7 +148,7 @@ if (empty($user->socid)) $fieldstosearchall["f.note_private"]="NotePrivate";
$checkedtypetiers=0;
$arrayfields=array(
'f.facnumber'=>array('label'=>"Ref", 'checked'=>1),
'f.ref'=>array('label'=>"Ref", 'checked'=>1),
'f.ref_client'=>array('label'=>"RefCustomer", 'checked'=>1),
'f.type'=>array('label'=>"Type", 'checked'=>0),
'f.date'=>array('label'=>"DateInvoice", 'checked'=>1),
@ -358,7 +358,7 @@ $thirdpartystatic=new Societe($db);
$sql = 'SELECT';
if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT';
$sql.= ' f.rowid as id, f.facnumber as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.rowid as id, f.ref as ref, f.ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total as total_ht, f.tva as total_vat, f.total_ttc,';
$sql.= ' f.localtax1 as total_localtax1, f.localtax2 as total_localtax2,';
$sql.= ' f.datef as df, f.date_lim_reglement as datelimite,';
$sql.= ' f.paye as paye, f.fk_statut,';
@ -417,7 +417,7 @@ if ($filtre)
$sql .= ' AND ' . $db->escape(trim($filt[0])) . ' = ' . $db->escape(trim($filt[1]));
}
}
if ($search_ref) $sql .= natural_search('f.facnumber', $search_ref);
if ($search_ref) $sql .= natural_search('f.ref', $search_ref);
if ($search_refcustomer) $sql .= natural_search('f.ref_client', $search_refcustomer);
if ($search_type != '' && $search_type != '-1') $sql.=" AND f.type IN (".$db->escape($search_type).")";
if ($search_project) $sql .= natural_search('p.ref', $search_project);
@ -491,7 +491,7 @@ $sql.=$hookmanager->resPrint;
if (! $sall)
{
$sql.= ' GROUP BY f.rowid, f.facnumber, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' GROUP BY f.rowid, f.ref, ref_client, f.type, f.note_private, f.note_public, f.increment, f.fk_mode_reglement, f.total, f.tva, f.total_ttc,';
$sql.= ' f.localtax1, f.localtax2,';
$sql.= ' f.datef, f.date_lim_reglement,';
$sql.= ' f.paye, f.fk_statut,';
@ -706,7 +706,7 @@ if ($resql)
// Filters lines
print '<tr class="liste_titre_filter">';
// Ref
if (! empty($arrayfields['f.facnumber']['checked']))
if (! empty($arrayfields['f.ref']['checked']))
{
print '<td class="liste_titre" align="left">';
print '<input class="flat" size="6" type="text" name="search_ref" value="'.dol_escape_htmltag($search_ref).'">';
@ -878,7 +878,7 @@ if ($resql)
print "</tr>\n";
print '<tr class="liste_titre">';
if (! empty($arrayfields['f.facnumber']['checked'])) print_liste_field_titre($arrayfields['f.facnumber']['label'],$_SERVER['PHP_SELF'],'f.facnumber','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref']['checked'])) print_liste_field_titre($arrayfields['f.ref']['label'],$_SERVER['PHP_SELF'],'f.ref','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.ref_client']['checked'])) print_liste_field_titre($arrayfields['f.ref_client']['label'],$_SERVER["PHP_SELF"],'f.ref_client','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.type']['checked'])) print_liste_field_titre($arrayfields['f.type']['label'],$_SERVER["PHP_SELF"],'f.type','',$param,'',$sortfield,$sortorder);
if (! empty($arrayfields['f.date']['checked'])) print_liste_field_titre($arrayfields['f.date']['label'],$_SERVER['PHP_SELF'],'f.datef','',$param,'align="center"',$sortfield,$sortorder);
@ -960,7 +960,7 @@ if ($resql)
}
print '<tr class="oddeven">';
if (! empty($arrayfields['f.facnumber']['checked']))
if (! empty($arrayfields['f.ref']['checked']))
{
print '<td class="nowrap">';

View File

@ -130,7 +130,7 @@ if ($id > 0 || ! empty($ref))
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0);
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0);
print '<div class="fichecenter">';
print '<div class="underbanner clearboth"></div>';

View File

@ -45,7 +45,7 @@ $ref=GETPOST('ref','alpha');
$socid=GETPOST('socid','int');
$action=GETPOST('action','alpha');
$fieldid = (! empty($ref)?'facnumber':'rowid');
$fieldid = (! empty($ref)?'ref':'rowid');
if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'facture', $id, '', '', 'fk_soc', $fieldid);
@ -208,7 +208,7 @@ if ($object->id > 0)
$object->totalpaye = $totalpaye; // To give a chance to dol_banner_tab to use already paid amount to show correct status
dol_banner_tab($object, 'ref', $linkback, 1, 'facnumber', 'ref', $morehtmlref, '', 0, '', '');
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '');
print '<div class="fichecenter">';
print '<div class="fichehalfleft">';

View File

@ -136,7 +136,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
*/
if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$sql = "SELECT f.facnumber";
$sql = "SELECT f.ref";
$sql.= ", f.rowid, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.ref_client";
$sql.= ", f.type";
$sql.= ", s.nom as name";
@ -177,7 +177,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber;
$facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
@ -320,7 +320,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$langs->load("boxes");
$facstatic=new Facture($db);
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid";
@ -339,7 +339,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerLastModified',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.code_client, s.code_compta, s.email,";
$sql.= " cc.rowid, cc.code";
$sql.= " ORDER BY f.tms DESC ";
@ -365,7 +365,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber;
$facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
@ -399,8 +399,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
}
print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td></tr></table>';
@ -812,7 +812,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$facstatic=new Facture($db);
$sql = "SELECT f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql = "SELECT f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total as total_ht, f.tva as total_tva, f.total_ttc, f.paye, f.tms";
$sql.= ", f.date_lim_reglement as datelimite";
$sql.= ", s.nom as name";
$sql.= ", s.rowid as socid, s.email";
@ -831,9 +831,9 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
$reshook=$hookmanager->executeHooks('printFieldListWhereCustomerUnpaid',$parameters);
$sql.=$hookmanager->resPrint;
$sql.= " GROUP BY f.rowid, f.facnumber, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " GROUP BY f.rowid, f.ref, f.fk_statut, f.datef, f.type, f.total, f.tva, f.total_ttc, f.paye, f.tms, f.date_lim_reglement,";
$sql.= " s.nom, s.rowid, s.email, s.code_client, s.code_compta, cc.rowid, cc.code";
$sql.= " ORDER BY f.datef ASC, f.facnumber ASC";
$sql.= " ORDER BY f.datef ASC, f.ref ASC";
$resql = $db->query($sql);
if ($resql)
@ -858,7 +858,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
{
$obj = $db->fetch_object($resql);
$facturestatic->ref=$obj->facnumber;
$facturestatic->ref=$obj->ref;
$facturestatic->id=$obj->rowid;
$facturestatic->total_ht=$obj->total_ht;
$facturestatic->total_tva=$obj->total_tva;
@ -891,8 +891,8 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
}
print '</td>';
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($obj->facnumber);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->facnumber);
$filename=dol_sanitizeFileName($obj->ref);
$filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref);
$urlsource=$_SERVER['PHP_SELF'].'?facid='.$obj->rowid;
print $formfile->getDocumentsLink($facturestatic->element, $filename, $filedir);
print '</td></tr></table>';

View File

@ -100,7 +100,7 @@ report_header($name,'',$period,$periodlink,$description,$builddate,$exportlink);
$p = explode(":", $conf->global->MAIN_INFO_SOCIETE_COUNTRY);
$idpays = $p[0];
$sql = "SELECT f.rowid, f.facnumber, f.type, f.datef, f.ref_client,";
$sql = "SELECT f.rowid, f.ref, f.type, f.datef, f.ref_client,";
$sql.= " fd.product_type, fd.total_ht, fd.total_tva, fd.tva_tx, fd.total_ttc, fd.localtax1_tx, fd.localtax2_tx, fd.total_localtax1, fd.total_localtax2, fd.rowid as id, fd.situation_percent,";
$sql.= " s.rowid as socid, s.nom as name, s.code_compta, s.client,";
$sql.= " p.rowid as pid, p.ref as pref, p.accountancy_code_sell,";
@ -180,7 +180,7 @@ if ($result)
//la ligne facture
$tabfac[$obj->rowid]["date"] = $obj->datef;
$tabfac[$obj->rowid]["ref"] = $obj->facnumber;
$tabfac[$obj->rowid]["ref"] = $obj->ref;
$tabfac[$obj->rowid]["type"] = $obj->type;
if (! isset($tabttc[$obj->rowid][$compta_soc])) $tabttc[$obj->rowid][$compta_soc]=0;
if (! isset($tabht[$obj->rowid][$compta_prod])) $tabht[$obj->rowid][$compta_prod]=0;

View File

@ -525,7 +525,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
* List of unpaid invoices
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type,';
$sql.= ' f.datef as df, f.fk_soc as socid, f.date_lim_reglement as dlr';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.= ' WHERE f.entity IN ('.getEntity('facture', $conf->entity).')';
@ -550,7 +550,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Sort invoices by date and serial number: the older one comes first
$sql.=' ORDER BY f.datef ASC, f.facnumber ASC';
$sql.=' ORDER BY f.datef ASC, f.ref ASC';
$resql = $db->query($sql);
if ($resql)
@ -844,7 +844,7 @@ if (! GETPOST('action','aZ09'))
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='p.datep';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as c ON p.fk_paiement = c.id';
$sql.= ', '.MAIN_DB_PREFIX.'facture as f';
@ -867,7 +867,7 @@ if (! GETPOST('action','aZ09'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'ref','','','',$sortfield,$sortorder);
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
@ -879,7 +879,7 @@ if (! GETPOST('action','aZ09'))
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount).'</td><td>&nbsp;</td>';

View File

@ -316,7 +316,7 @@ dol_fiche_end();
* List of invoices
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
$sql = 'SELECT f.rowid as facid, f.ref, f.type, f.total_ttc, f.paye, f.fk_statut, pf.amount, s.nom as name, s.rowid as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture as f,'.MAIN_DB_PREFIX.'societe as s';
$sql.= ' WHERE pf.fk_facture = f.rowid';
$sql.= ' AND f.fk_soc = s.rowid';

View File

@ -1349,7 +1349,7 @@ class BonPrelevement extends CommonObject
$sql = "SELECT soc.code_client as code, soc.address, soc.zip, soc.town, c.code as country_code,";
$sql.= " pl.client_nom as nom, pl.code_banque as cb, pl.code_guichet as cg, pl.number as cc, pl.amount as somme,";
$sql.= " f.facnumber as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " f.ref as fac, pf.fk_facture as idfac, rib.datec, rib.iban_prefix as iban, rib.bic as bic, rib.rowid as drum";
$sql.= " FROM";
$sql.= " ".MAIN_DB_PREFIX."prelevement_lignes as pl,";
$sql.= " ".MAIN_DB_PREFIX."facture as f,";
@ -1488,12 +1488,12 @@ class BonPrelevement extends CommonObject
* @param string $rib_guichet code of bank office
* @param string $rib_number bank account
* @param float $amount amount
* @param string $facnumber ref of invoice
* @param string $ref ref of invoice
* @param int $facid id of invoice
* @param string $rib_dom rib domiciliation
* @return void
*/
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $facnumber, $facid, $rib_dom='')
function EnregDestinataire($rowid, $client_nom, $rib_banque, $rib_guichet, $rib_number, $amount, $ref, $facid, $rib_dom='')
{
// phpcs:enable
fputs($this->file, "06");
@ -1537,7 +1537,7 @@ class BonPrelevement extends CommonObject
// Libelle F
fputs($this->file, substr("*_".$facnumber."_RDVnet".$rowid." ", 0, 31));
fputs($this->file, substr("*_".$ref."_RDVnet".$rowid." ", 0, 31));
// Code etablissement G1
@ -1580,7 +1580,7 @@ class BonPrelevement extends CommonObject
* @param string $row_cg pl.code_guichet AS cg, Not used for SEPA
* @param string $row_cc pl.number AS cc, Not used for SEPA
* @param string $row_somme pl.amount AS somme,
* @param string $row_facnumber f.facnumber
* @param string $row_ref f.ref
* @param string $row_idfac pf.fk_facture AS idfac,
* @param string $row_iban rib.iban_prefix AS iban,
* @param string $row_bic rib.bic AS bic,
@ -1588,7 +1588,7 @@ class BonPrelevement extends CommonObject
* @param string $row_drum rib.rowid used to generate rum
* @return string Return string with SEPA part DrctDbtTxInf
*/
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_facnumber, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
function EnregDestinataireSEPA($row_code_client, $row_nom, $row_address, $row_zip, $row_town, $row_country_code, $row_cb, $row_cg, $row_cc, $row_somme, $row_ref, $row_idfac, $row_iban, $row_bic, $row_datec, $row_drum)
{
// phpcs:enable
$CrLf = "\n";
@ -1604,8 +1604,8 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR ='';
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
$XML_DEBITOR .=' <PmtId>'.$CrLf;
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_ref,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' </PmtId>'.$CrLf;
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
@ -1636,9 +1636,9 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' </Id>'.$CrLf;
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max
// $XML_DEBITOR .=' <Ustrd>'.($row_ref.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_ref, 135).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_ref, 135) ).'</Ustrd>'.$CrLf; // 140 max
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
return $XML_DEBITOR;

View File

@ -188,7 +188,7 @@ print '<br>';
* Invoices waiting for withdraw
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql = "SELECT f.ref, f.rowid, f.total_ttc, s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande, pfd.amount";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
$sql.= " ".MAIN_DB_PREFIX."societe as s,";
@ -249,7 +249,7 @@ if ($resql)
print '<tr class="oddeven">';
print '<td>';
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
$invoicestatic->ref=$obj->ref;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';
// Thirdparty

View File

@ -52,7 +52,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="DESC";
if (! $sortfield) $sortfield="f.facnumber";
if (! $sortfield) $sortfield="f.ref";
/*
@ -66,7 +66,7 @@ $invoicestatic=new Facture($db);
// List of requests
$sql= "SELECT f.facnumber, f.rowid, f.total_ttc,";
$sql= "SELECT f.ref, f.rowid, f.total_ttc,";
$sql.= " s.nom as name, s.rowid as socid,";
$sql.= " pfd.date_demande as date_demande,";
$sql.= " pfd.fk_user_demande";
@ -138,7 +138,7 @@ if ($resql)
// Ref facture
print '<td>';
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
$invoicestatic->ref=$obj->ref;
print $invoicestatic->getNomUrl(1,'withdraw');
print '</td>';

View File

@ -144,7 +144,7 @@ if ($prev_id > 0 || $ref)
// List of invoices
$sql = "SELECT pf.rowid,";
$sql.= " f.rowid as facid, f.facnumber as ref, f.total_ttc,";
$sql.= " f.rowid as facid, f.ref as ref, f.total_ttc,";
$sql.= " s.rowid as socid, s.nom as name, pl.statut, pl.amount as amount_requested";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= ", ".MAIN_DB_PREFIX."prelevement_lignes as pl";

View File

@ -91,7 +91,7 @@ print '</td></tr></table><br>';
/*
* Invoices waiting for withdraw
*/
$sql = "SELECT f.facnumber, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql = "SELECT f.ref, f.rowid, f.total_ttc, f.fk_statut, f.paye, f.type,";
$sql.= " pfd.date_demande, pfd.amount,";
$sql.= " s.nom as name, s.rowid as socid";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f,";
@ -120,7 +120,7 @@ if ($resql)
$obj = $db->fetch_object($resql);
$invoicestatic->id=$obj->rowid;
$invoicestatic->ref=$obj->facnumber;
$invoicestatic->ref=$obj->ref;
$invoicestatic->statut=$obj->fk_statut;
$invoicestatic->paye=$obj->paye;
$invoicestatic->type=$obj->type;

View File

@ -261,7 +261,7 @@ if ($id)
* List of invoices
*/
$sql = "SELECT pf.rowid";
$sql.= " ,f.rowid as facid, f.facnumber as ref, f.total_ttc, f.paye, f.fk_statut";
$sql.= " ,f.rowid as facid, f.ref as ref, f.total_ttc, f.paye, f.fk_statut";
$sql.= " , s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
$sql.= " , ".MAIN_DB_PREFIX."prelevement_lignes as pl";

View File

@ -82,7 +82,7 @@ $form=new Form($db);
llxHeader('',$langs->trans("WithdrawalsLines"));
$sql = "SELECT p.rowid, p.ref, p.statut, p.datec";
$sql.= " ,f.rowid as facid, f.facnumber, f.total_ttc";
$sql.= " ,f.rowid as facid, f.ref, f.total_ttc";
$sql.= " , s.rowid as socid, s.nom as name, s.code_client";
$sql.= " , pl.amount, pl.statut as statut_ligne, pl.rowid as rowid_ligne";
$sql.= " FROM ".MAIN_DB_PREFIX."prelevement_bons as p";
@ -155,7 +155,7 @@ if ($result)
print '<tr class="liste_titre">';
print_liste_field_titre("Line",$_SERVER["PHP_SELF"]);
print_liste_field_titre("WithdrawalsReceipts",$_SERVER["PHP_SELF"],"p.ref");
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.facnumber",'',$urladd);
print_liste_field_titre("Bill",$_SERVER["PHP_SELF"],"f.ref",'',$urladd);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom");
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client",'','','align="center"');
print_liste_field_titre("Date",$_SERVER["PHP_SELF"],"p.datec","","",'align="center"');
@ -185,7 +185,7 @@ if ($result)
print '<td><a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">';
print img_object($langs->trans("ShowBill"),"bill");
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->facnumber."</a></td>\n";
print '&nbsp;<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?facid='.$obj->facid.'">'.$obj->ref."</a></td>\n";
print '</a></td>';
print '<td><a href="card.php?id='.$obj->rowid.'">'.$obj->name."</a></td>\n";

View File

@ -117,7 +117,7 @@ if ($id > 0)
$TData = array();
$sql = "SELECT s.nom, s.rowid as socid, f.facnumber, f.amount, f.datef as df,";
$sql = "SELECT s.nom, s.rowid as socid, f.ref, f.amount, f.datef as df,";
$sql.= " f.paye as paye, f.fk_statut as statut, f.rowid as facid,";
$sql.= " u.login, u.rowid as userid";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."user as u";

View File

@ -541,14 +541,14 @@ print '</div>';
// Factures non reglees
// Y a bug ici. Il faut prendre le reste a payer et non le total des factures non reglees !
$sql = "SELECT f.facnumber, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am";
$sql = "SELECT f.ref, f.rowid, s.nom, s.rowid as socid, f.total_ttc, sum(pf.amount) as am";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s,".MAIN_DB_PREFIX."facture as f left join ".MAIN_DB_PREFIX."paiement_facture as pf on f.rowid=pf.fk_facture";
$sql .= " WHERE s.rowid = f.fk_soc AND f.paye = 0 AND f.fk_statut = 1";
if ($socid)
{
$sql .= " AND f.fk_soc = $socid";
}
$sql .= " GROUP BY f.facnumber,f.rowid,s.nom, s.rowid, f.total_ttc";
$sql .= " GROUP BY f.ref,f.rowid,s.nom, s.rowid, f.total_ttc";
$resql=$db->query($sql);
if ($resql)

View File

@ -89,7 +89,7 @@ class box_factures extends ModeleBoxes
if ($user->rights->facture->lire) {
$sql = "SELECT f.rowid as facid";
$sql.= ", f.facnumber, f.type, f.total as total_ht";
$sql.= ", f.ref, f.type, f.total as total_ht";
$sql.= ", f.tva as total_tva";
$sql.= ", f.total_ttc";
$sql.= ", f.datef as df";
@ -103,8 +103,8 @@ class box_factures extends ModeleBoxes
$sql.= " AND f.entity = ".$conf->entity;
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
else $sql.= " ORDER BY f.tms DESC, f.facnumber DESC ";
if ($conf->global->MAIN_LASTBOX_ON_OBJECT_DATE) $sql.= " ORDER BY f.datef DESC, f.ref DESC ";
else $sql.= " ORDER BY f.tms DESC, f.ref DESC ";
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
@ -123,7 +123,7 @@ class box_factures extends ModeleBoxes
$datem = $db->jdate($objp->tms);
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->ref = $objp->ref;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;

View File

@ -89,7 +89,7 @@ class box_factures_imp extends ModeleBoxes
$sql = "SELECT s.nom as name, s.rowid as socid, s.email,";
$sql.= " s.code_client,";
$sql.= " s.logo,";
$sql.= " f.facnumber, f.date_lim_reglement as datelimite,";
$sql.= " f.ref, f.date_lim_reglement as datelimite,";
$sql.= " f.type,";
$sql.= " f.amount, f.datef as df,";
$sql.= " f.total as total_ht,";
@ -107,10 +107,10 @@ class box_factures_imp extends ModeleBoxes
$sql.= " AND fk_statut = 1";
if (!$user->rights->societe->client->voir && !$user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if($user->societe_id) $sql.= " AND s.rowid = ".$user->societe_id;
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.facnumber, f.date_lim_reglement,";
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, s.logo, f.ref, f.date_lim_reglement,";
$sql.= " f.type, f.amount, f.datef, f.total, f.tva, f.total_ttc, f.paye, f.fk_statut, f.rowid";
//$sql.= " ORDER BY f.datef DESC, f.facnumber DESC ";
$sql.= " ORDER BY datelimite ASC, f.facnumber ASC ";
//$sql.= " ORDER BY f.datef DESC, f.ref DESC ";
$sql.= " ORDER BY datelimite ASC, f.ref ASC ";
$sql.= $db->plimit($max, 0);
$result = $db->query($sql);
@ -127,7 +127,7 @@ class box_factures_imp extends ModeleBoxes
$objp = $db->fetch_object($result);
$datelimite=$db->jdate($objp->datelimite);
$facturestatic->id = $objp->facid;
$facturestatic->ref = $objp->facnumber;
$facturestatic->ref = $objp->ref;
$facturestatic->type = $objp->type;
$facturestatic->total_ht = $objp->total_ht;
$facturestatic->total_tva = $objp->total_tva;

View File

@ -364,11 +364,11 @@ abstract class CommonInvoice extends CommonObject
if ($this->element != 'invoice_supplier')
{
if (empty($this->thirdparty)) $this->fetch_thirdparty(); // We need to have this->thirdparty defined, in case of numbering rule use tags that depend on thirdparty (like {t} tag).
$maxfacnumber = $this->getNextNumRef($this->thirdparty,'last');
$maxref = $this->getNextNumRef($this->thirdparty,'last');
// If there is no invoice into the reset range and not already dispatched, we can delete
// If invoice to delete is last one and not already dispatched, we can delete
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $maxfacnumber != '' && $maxfacnumber != $this->ref) return -2;
if (empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $maxref != '' && $maxref != $this->ref) return -2;
// TODO If there is payment in bookkeeping, check payment is not dispatched in accounting
// ...

View File

@ -126,7 +126,7 @@ class DiscountAbsolute
$sql.= " sr.multicurrency_amount_ht, sr.multicurrency_amount_tva, sr.multicurrency_amount_ttc,";
$sql.= " sr.fk_facture_line, sr.fk_facture, sr.fk_facture_source, sr.fk_invoice_supplier_line, sr.fk_invoice_supplier, sr.fk_invoice_supplier_source, sr.description,";
$sql.= " sr.datec,";
$sql.= " f.facnumber as ref_facture_source, fsup.facnumber as ref_invoice_supplier_source";
$sql.= " f.ref as ref_facture_source, fsup.ref as ref_invoice_supplier_source";
$sql.= " FROM ".MAIN_DB_PREFIX."societe_remise_except as sr";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as f ON sr.fk_facture_source = f.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture as fsup ON sr.fk_invoice_supplier_source = fsup.rowid";

View File

@ -3439,7 +3439,7 @@ class Form
$langs->load('bills');
$opt = '<option value ="" selected></option>';
$sql = 'SELECT rowid, facnumber, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1';
$sql = 'SELECT rowid, ref, situation_cycle_ref, situation_counter, situation_final, fk_soc FROM ' . MAIN_DB_PREFIX . 'facture WHERE situation_counter>=1';
$sql.= ' ORDER by situation_cycle_ref, situation_counter desc';
$resql = $this->db->query($sql);
if ($resql && $this->db->num_rows($resql) > 0) {
@ -3455,11 +3455,11 @@ class Form
//not final ?
if ($obj->situation_final != 1) {
//Not prov?
if (substr($obj->facnumber, 1, 4) != 'PROV') {
if (substr($obj->ref, 1, 4) != 'PROV') {
if ($selected == $obj->rowid) {
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->facnumber . '</option>';
$opt .= '<option value="' . $obj->rowid . '" selected>' . $obj->ref . '</option>';
} else {
$opt .= '<option value="' . $obj->rowid . '">' . $obj->facnumber . '</option>';
$opt .= '<option value="' . $obj->rowid . '">' . $obj->ref . '</option>';
}
}
}
@ -6415,7 +6415,7 @@ class Form
$possiblelinks=array(
'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'),
'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'),
'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'),
'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'),

View File

@ -507,7 +507,7 @@ class FormProjets
$sql = "SELECT t.rowid, t.label as ref";
break;
case "facture":
$sql = "SELECT t.rowid, t.facnumber as ref";
$sql = "SELECT t.rowid, t.ref as ref";
break;
case "facture_fourn":
$sql = "SELECT t.rowid, t.ref, t.ref_supplier";

View File

@ -50,13 +50,13 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
*/
function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filter, $dateafterdate, $datebeforedate, $paymentdateafter, $paymentdatebefore, $usestdout, $regenerate=0, $filesuffix='', $paymentbankid='', $thirdpartiesid='', $fileprefix='mergedpdf')
{
$sql = "SELECT DISTINCT f.rowid, f.facnumber";
$sql = "SELECT DISTINCT f.rowid, f.ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sqlwhere='';
$sqlorder='';
if (in_array('all',$filter))
{
$sqlorder = " ORDER BY f.facnumber ASC";
$sqlorder = " ORDER BY f.ref ASC";
}
if (in_array('date',$filter))
{
@ -175,11 +175,11 @@ function rebuild_merge_pdf($db, $langs, $conf, $diroutputpdf, $newlangid, $filte
$filename=$conf->facture->dir_output.'/'.$fac->ref.'/'.$fac->ref.'.pdf';
if ($regenerate || ! dol_is_file($filename))
{
if ($usestdout) print "Build PDF for invoice ".$obj->facnumber." - Lang = ".$outputlangs->defaultlang."\n";
if ($usestdout) print "Build PDF for invoice ".$obj->ref." - Lang = ".$outputlangs->defaultlang."\n";
$result= $fac->generateDocument($regenerate?$regenerate:$fac->modelpdf, $outputlangs);
}
else {
if ($usestdout) print "PDF for invoice ".$obj->facnumber." already exists\n";
if ($usestdout) print "PDF for invoice ".$obj->ref." already exists\n";
}
// Add file into files array

View File

@ -109,7 +109,7 @@ function tax_by_thirdparty($type, $db, $y, $date_start, $date_end, $modetax, $di
$total_tva='total_tva';
$paymenttable='paiement';
$paymentfacturetable='paiement_facture';
$invoicefieldref='facnumber';
$invoicefieldref='ref';
}
if ($direction == 'buy')
{
@ -578,7 +578,7 @@ function tax_by_rate($type, $db, $y, $q, $date_start, $date_end, $modetax, $dire
$total_tva='total_tva';
$paymenttable='paiement';
$paymentfacturetable='paiement_facture';
$invoicefieldref='facnumber';
$invoicefieldref='ref';
}
else
{

View File

@ -99,9 +99,9 @@ class mod_facture_mars extends ModeleNumRefFactures
$fayymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
@ -121,9 +121,9 @@ class mod_facture_mars extends ModeleNumRefFactures
$fayymm='';
$posindice=8;
$sql = "SELECT MAX(SUBSTRING(facnumber FROM ".$posindice.")) as max"; // This is standard SQL
$sql = "SELECT MAX(SUBSTRING(ref FROM ".$posindice.")) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
@ -162,9 +162,9 @@ class mod_facture_mars extends ModeleNumRefFactures
// D'abord on recupere la valeur max
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " WHERE ref LIKE '".$prefix."____-%'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$resql=$db->query($sql);
@ -186,9 +186,9 @@ class mod_facture_mars extends ModeleNumRefFactures
else $num = sprintf("%04s",$max);
$ref='';
$sql = "SELECT facnumber as ref";
$sql = "SELECT ref as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " WHERE ref LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

View File

@ -167,7 +167,7 @@ class mod_facture_mercure extends ModeleNumRefFactures
// Get entities
$entity = getEntity('invoicenumber', 1, $invoice);
$numFinal=get_next_value($db,$mask,'facture','facnumber',$where,$objsoc,$invoice->date,$mode,false,null,$entity);
$numFinal=get_next_value($db,$mask,'facture','ref',$where,$objsoc,$invoice->date,$mode,false,null,$entity);
if (! preg_match('/([0-9])+/',$numFinal)) $this->error = $numFinal;
return $numFinal;

View File

@ -96,9 +96,9 @@ class mod_facture_terre extends ModeleNumRefFactures
$fayymm=''; $max='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefixinvoice)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
@ -118,9 +118,9 @@ class mod_facture_terre extends ModeleNumRefFactures
$fayymm='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefixcreditnote)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
@ -139,9 +139,9 @@ class mod_facture_terre extends ModeleNumRefFactures
$fayymm='';
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " WHERE ref LIKE '".$db->escape($this->prefixdeposit)."____-%'";
$sql.= " AND entity = ".$conf->entity;
$resql=$db->query($sql);
@ -177,9 +177,9 @@ class mod_facture_terre extends ModeleNumRefFactures
// D'abord on recupere la valeur max
$posindice=8;
$sql = "SELECT MAX(CAST(SUBSTRING(facnumber FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-%'";
$sql.= " WHERE ref LIKE '".$prefix."____-%'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
$resql=$db->query($sql);
@ -201,9 +201,9 @@ class mod_facture_terre extends ModeleNumRefFactures
else $num = sprintf("%04s",$max);
$ref='';
$sql = "SELECT facnumber as ref";
$sql = "SELECT ref as ref";
$sql.= " FROM ".MAIN_DB_PREFIX."facture";
$sql.= " WHERE facnumber LIKE '".$prefix."____-".$num."'";
$sql.= " WHERE ref LIKE '".$prefix."____-".$num."'";
$sql.= " AND entity IN (".getEntity('invoicenumber', 1, $invoice).")";
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);

View File

@ -194,7 +194,7 @@ class modApi extends DolibarrModules
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
// 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",
// 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",
@ -203,7 +203,7 @@ class modApi extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
// 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",
// 'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",
// 'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'

View File

@ -178,13 +178,13 @@ class modBanque extends DolibarrModules
$this->export_label[$r]='Bordereaux remise Chq/Fact';
$this->export_permission[$r]=array(array("banque","export"));
$this->export_fields_array[$r]=array("bch.rowid"=>"DepositId","bch.ref"=>"Numero","bch.ref_ext"=>"RefExt",'ba.ref'=>'AccountRef','ba.label'=>'AccountLabel','b.datev'=>'DateValue','b.num_chq'=>'ChequeOrTransferNumber','b.amount'=>'Credit','b.num_releve'=>'AccountStatement','b.datec'=>"DateCreation",
"bch.date_bordereau"=>"Date","bch.amount"=>"Total","bch.nbcheque"=>"NbCheque","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","f.facnumber"=>"InvoiceRef"
"bch.date_bordereau"=>"Date","bch.amount"=>"Total","bch.nbcheque"=>"NbCheque","bu.url_id"=>"IdThirdParty","s.nom"=>"ThirdParty","s.code_compta"=>"CustomerAccountancyCode","f.ref"=>"InvoiceRef"
);
$this->export_TypeFields_array[$r]=array('ba.ref'=>'Text','ba.label'=>'Text','b.datev'=>'Date','b.num_chq'=>'Text','b.amount'=>'Numeric','b.num_releve'=>'Text','b.datec'=>"Date",
"bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.ref"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","s.code_compta"=>"Text","f.facnumber"=>"Text"
"bch.date_bordereau"=>"Date","bch.rowid"=>"Numeric","bch.ref"=>"Numeric","bch.ref_ext"=>"Text","bch.amount"=>"Numeric","bch.nbcheque"=>"Numeric","bu.url_id"=>"Text","s.nom"=>"Text","s.code_compta"=>"Text","f.ref"=>"Text"
);
$this->export_entities_array[$r]=array('ba.ref'=>'account','ba.label'=>'account','b.datev'=>'account','b.num_chq'=>'account','b.amount'=>'account','b.num_releve'=>'account','b.datec'=>"account",
"bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company","f.facnumber"=>"invoice");
"bu.url_id"=>"company","s.nom"=>"company","s.code_compta"=>"company","s.code_compta_fournisseur"=>"company","f.ref"=>"invoice");
$this->export_special_array[$r]=array('b.amount'=>'NULLIFNEG');
$this->export_sql_start[$r]='SELECT DISTINCT ';

View File

@ -213,7 +213,7 @@ class modFacture extends DolibarrModules
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.facnumber'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaid", 'f.fk_statut'=>'InvoiceStatus',
'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin',
@ -226,7 +226,7 @@ class modFacture extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>'Numeric', 'f.facnumber'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.rowid'=>'Numeric', 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'none.rest'=>"NumericCompute", 'f.paye'=>"Boolean", 'f.fk_statut'=>'Numeric',
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
'pj.ref'=>'Text', 'fd.rowid'=>'Numeric', 'fd.label'=>'Text', 'fd.description'=>"Text", 'fd.subprice'=>"Numeric", 'fd.tva_tx'=>"Numeric",
@ -277,7 +277,7 @@ class modFacture extends DolibarrModules
's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.code_client'=>'CustomerCode', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', 'c.code'=>'CountryCode', 's.phone'=>'Phone',
's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.code_compta'=>'CustomerAccountancyCode',
's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra',
'f.rowid'=>"InvoiceId", 'f.facnumber'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.rowid'=>"InvoiceId", 'f.ref'=>"InvoiceRef", 'f.ref_client'=>'RefCustomer',
'f.type'=>"Type", 'f.datec'=>"InvoiceDateCreation", 'f.datef'=>"DateInvoice", 'f.date_lim_reglement'=>"DateDue", 'f.total'=>"TotalHT",
'f.total_ttc'=>"TotalTTC", 'f.tva'=>"TotalVAT", 'none.rest'=>'Rest', 'f.paye'=>"InvoicePaid", 'f.fk_statut'=>'InvoiceStatus',
'f.note_private'=>"NotePrivate", 'f.note_public'=>"NotePublic", 'f.fk_user_author'=>'CreatedById', 'uc.login'=>'CreatedByLogin',
@ -288,7 +288,7 @@ class modFacture extends DolibarrModules
$this->export_TypeFields_array[$r] = array(
's.rowid'=>'Numeric', 's.nom'=>'Text', 's.code_client'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', 'c.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text',
's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text',
'f.rowid'=>"Numeric", 'f.facnumber'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.rowid'=>"Numeric", 'f.ref'=>"Text", 'f.ref_client'=>'Text', 'f.type'=>"Numeric", 'f.datec'=>"Date", 'f.datef'=>"Date", 'f.date_lim_reglement'=>"Date",
'f.total'=>"Numeric", 'f.total_ttc'=>"Numeric", 'f.tva'=>"Numeric", 'none.rest'=>'NumericCompute', 'f.paye'=>"Boolean", 'f.fk_statut'=>'Status',
'f.note_private'=>"Text", 'f.note_public'=>"Text", 'f.fk_user_author'=>'Numeric', 'uc.login'=>'Text', 'f.fk_user_valid'=>'Numeric', 'uv.login'=>'Text',
'pj.ref'=>'Text', 'p.amount'=>'Numeric', 'pf.amount'=>'Numeric', 'p.rowid'=>'Numeric', 'p.ref'=>'Text', 'p.datep'=>'Date', 'p.num_paiement'=>'Numeric',

View File

@ -173,7 +173,7 @@ class modGravatar extends DolibarrModules
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
// 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",
// 'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",
@ -182,7 +182,7 @@ class modGravatar extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
// 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",
// 'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",
// 'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'

View File

@ -227,7 +227,7 @@ class modHoliday extends DolibarrModules
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
// 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",
// 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",
@ -236,7 +236,7 @@ class modHoliday extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
// 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",
// 'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",
// 'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",
// 'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'
@ -244,7 +244,7 @@ class modHoliday extends DolibarrModules
// $this->export_alias_array[$r]=array(
// 's.rowid'=>"socid",'s.nom'=>'soc_name','s.address'=>'soc_adres','s.zip'=>'soc_zip','s.town'=>'soc_town','s.fk_pays'=>'soc_pays','s.phone'=>'soc_tel',
// 's.siren'=>'soc_siren','s.siret'=>'soc_siret','s.ape'=>'soc_ape','s.idprof4'=>'soc_idprof4','s.code_compta'=>'soc_customer_accountancy',
// 's.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"invoiceid",'f.facnumber'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",
// 's.code_compta_fournisseur'=>'soc_supplier_accountancy','f.rowid'=>"invoiceid",'f.ref'=>"ref",'f.datec'=>"datecreation",'f.datef'=>"dateinvoice",
// 'f.total'=>"totalht",'f.total_ttc'=>"totalttc",'f.tva'=>"totalvat",'f.paye'=>"paid",'f.fk_statut'=>'status','f.note'=>"note",'fd.rowid'=>'lineid',
// 'fd.description'=>"linedescription",'fd.price'=>"lineprice",'fd.total_ht'=>"linetotalht",'fd.total_tva'=>"linetotaltva",'fd.total_ttc'=>"linetotalttc",
// 'fd.tva_tx'=>"linevatrate",'fd.qty'=>"lineqty",'fd.date_start'=>"linedatestart",'fd.date_end'=>"linedateend",'fd.fk_product'=>'productid',

View File

@ -221,7 +221,7 @@ class modMultiCurrency extends DolibarrModules
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
// 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",
// 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",
@ -231,7 +231,7 @@ class modMultiCurrency extends DolibarrModules
// 't.date'=>'Date', 't.qte'=>'Numeric', 't.poids'=>'Numeric', 't.fad'=>'Numeric', 't.paq'=>'Numeric', 't.stockage'=>'Numeric', 't.fadparliv'=>'Numeric',
// 't.livau100'=>'Numeric', 't.forfait'=>'Numeric', 's.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text',
// 's.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text',
// 'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",
// 'f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",
// 'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.subprice'=>"Numeric",
// 'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",
// 'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text',
@ -240,7 +240,7 @@ class modMultiCurrency extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
// 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",
// 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",
// 'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",
// 'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",
// 'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'

View File

@ -168,7 +168,7 @@ class modPayBox extends DolibarrModules
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town',
// 's.fk_pays'=>'Country','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3',
// 's.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode',
// 'f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",
// 'f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",
// 'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note'=>"InvoiceNote",'fd.rowid'=>'LineId',
// 'fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",
// 'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef',
@ -176,7 +176,7 @@ class modPayBox extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company',
// 's.fk_pays'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company',
// 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",
// 's.code_compta'=>'company','s.code_compta_fournisseur'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",
// 'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice',
// 'f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",
// 'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",

View File

@ -174,7 +174,7 @@ class modPaypal extends DolibarrModules
// $this->export_fields_array[$r]=array(
// 's.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','s.fk_pays'=>'Country','s.phone'=>'Phone',
// 's.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode',
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",
// 'f.datef'=>"DateInvoice",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus',
// 'f.note'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.price'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",
// 'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalTVA",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",
@ -183,7 +183,7 @@ class modPaypal extends DolibarrModules
// $this->export_entities_array[$r]=array(
// 's.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','s.fk_pays'=>'company','s.phone'=>'company',
// 's.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company',
// 'f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",
// 'f.rowid'=>"invoice",'f.ref'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",
// 'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",
// 'fd.price'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",
// 'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.fk_product'=>'product','p.ref'=>'product'

View File

@ -180,7 +180,7 @@ class pdf_paiement
// number of bill
switch ($this->doc_type) {
case "client":
$sql = "SELECT p.datep as dp, f.facnumber";
$sql = "SELECT p.datep as dp, f.ref";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
@ -211,7 +211,7 @@ class pdf_paiement
$sql.= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
break;
case "fourn":
$sql = "SELECT p.datep as dp, f.ref as facnumber";
$sql = "SELECT p.datep as dp, f.ref as ref";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
@ -254,7 +254,7 @@ class pdf_paiement
{
$objp = $this->db->fetch_object($result);
$lines[$i][0] = $objp->facnumber;
$lines[$i][0] = $objp->ref;
$lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"day",false,$outputlangs,true);
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;

View File

@ -307,7 +307,7 @@ if ($action == 'create' && !$error) {
print '<input type="hidden" name="token" value="' . $_SESSION['newtoken'] . '">';
print '<input type="hidden" name="action" value="add">';
print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
print '<input name="facnumber" type="hidden" value="provisoire">';
print '<input name="ref" type="hidden" value="provisoire">';
print '<input name="ref_client" type="hidden" value="' . $ref_client . '">';
print '<input name="ref_int" type="hidden" value="' . $ref_int . '">';
print '<input type="hidden" name="origin" value="' . GETPOST('origin') . '">';

View File

@ -0,0 +1,31 @@
--
-- Be carefull to requests order.
-- This file must be loaded by calling /install/index.php page
-- when current version is 9.0.0 or higher.
--
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
-- To make pk to be auto increment (postgres):
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
-- Note: fields with type BLOB/TEXT can't have default value.
ALTER TABLE llx_facture CHANGE facnumber ref VARCHAR(30) NOT NULL;

View File

@ -77,14 +77,14 @@ ALTER TABLE llx_propal DROP FOREIGN KEY fk_propal_fk_currency;
ALTER TABLE llx_commande DROP FOREIGN KEY fk_commande_fk_currency;
ALTER TABLE llx_facture DROP FOREIGN KEY fk_facture_fk_currency;
delete from llx_facturedet where fk_facture in (select rowid from llx_facture where facnumber in ('(PROV)','ErrorBadMask'));
delete from llx_facture where facnumber in ('(PROV)','ErrorBadMask');
delete from llx_facturedet where fk_facture in (select rowid from llx_facture where ref in ('(PROV)','ErrorBadMask'));
delete from llx_facture where ref in ('(PROV)','ErrorBadMask');
delete from llx_commandedet where fk_commande in (select rowid from llx_commande where ref in ('(PROV)','ErrorBadMask'));
delete from llx_commande where ref in ('(PROV)','ErrorBadMask');
delete from llx_propaldet where fk_propal in (select rowid from llx_propal where ref in ('(PROV)','ErrorBadMask'));
delete from llx_propal where ref in ('(PROV)','ErrorBadMask');
delete from llx_facturedet where fk_facture in (select rowid from llx_facture where facnumber = '');
delete from llx_facture where facnumber = '';
delete from llx_facturedet where fk_facture in (select rowid from llx_facture where ref = '');
delete from llx_facture where ref = '';
delete from llx_commandedet where fk_commande in (select rowid from llx_commande where ref = '');
delete from llx_commande where ref = '';
delete from llx_propaldet where fk_propal in (select rowid from llx_propal where ref = '');

View File

@ -19,7 +19,7 @@
-- ============================================================================
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_facnumber (facnumber, entity);
ALTER TABLE llx_facture ADD UNIQUE INDEX idx_facture_uk_ref (ref, entity);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_soc (fk_soc);
ALTER TABLE llx_facture ADD INDEX idx_facture_fk_user_author (fk_user_author);

View File

@ -26,7 +26,7 @@ create table llx_facture
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
facnumber varchar(30) NOT NULL, -- invoice reference number
ref varchar(30) NOT NULL, -- invoice reference number
entity integer DEFAULT 1 NOT NULL, -- multi company id
ref_ext varchar(255), -- reference into an external system (not used by dolibarr)

View File

@ -49,7 +49,7 @@ $offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder = "DESC";
if (! $sortfield) $sortfield = 'f.facnumber';
if (! $sortfield) $sortfield = 'f.ref';
$startdate = $enddate = '';
@ -185,7 +185,7 @@ $massactionbutton='';
$sql = "SELECT";
$sql .= " f.facnumber, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty";
$sql .= " f.ref, f.rowid as invoiceid, d.rowid as invoicedetid, d.buy_price_ht, d.total_ht, d.subprice, d.label, d.description , d.qty";
$sql .= " ,d.fk_product";
$sql .= " FROM " . MAIN_DB_PREFIX . "facture as f ";
$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facturedet as d ON d.fk_facture = f.rowid";
@ -194,7 +194,7 @@ $sql .= " WHERE f.fk_statut > 0";
$sql .= " AND f.entity IN (" . getEntity('facture') . ") ";
if (! empty($startdate)) $sql .= " AND f.datef >= '" . $db->idate($startdate) . "'";
if (! empty($enddate)) $sql .= " AND f.datef <= '" . $db->idate($enddate) . "'";
if ($search_ref) $sql.=natural_search('f.facnumber', $search_ref);
if ($search_ref) $sql.=natural_search('f.ref', $search_ref);
$sql .= " AND d.buy_price_ht IS NOT NULL";
$sql .= $db->order($sortfield, $sortorder);
@ -249,7 +249,7 @@ if ($result) {
print "</tr>\n";
print '<tr class="liste_titre">';
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "f.facnumber", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Ref", $_SERVER["PHP_SELF"], "f.ref", "", $param, '', $sortfield, $sortorder);
print_liste_field_titre("Description", $_SERVER["PHP_SELF"], "", "", $param, 'width=20%', $sortfield, $sortorder);
print_liste_field_titre("UnitPriceHT", $_SERVER["PHP_SELF"], "d.subprice", "", $param, 'align="right"', $sortfield, $sortorder);
print_liste_field_titre($labelcostprice, $_SERVER["PHP_SELF"], "d.buy_price_ht", "", $param, 'align="right"', $sortfield, $sortorder);

View File

@ -202,7 +202,7 @@ print '</form>';
$sql = "SELECT";
$sql.= " s.rowid as socid, s.nom as name, s.code_client, s.client,";
if ($client) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
if ($client) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
$sql.= " sum(d.total_ht) as selling_price,";
// Note: qty and buy_price_ht is always positive (if not, your database may be corrupted, you can update this)
$sql.= " sum(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
@ -235,7 +235,7 @@ $sql.= " AND f.datef <= '".$db->idate($enddate)."'";
$sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql .= " AND d.buy_price_ht <> 0";
if ($client) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
if ($client) $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut";
else $sql.= " GROUP BY s.rowid, s.nom, s.code_client, s.client";
$sql.=$db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination
@ -260,7 +260,7 @@ if ($result)
print '<tr class="liste_titre">';
if (! empty($client)) {
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&amp;socid=".$socid,'',$sortfield,$sortorder);
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.ref","","&amp;socid=".$socid,'',$sortfield,$sortorder);
print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&amp;socid=".$socid,'align="center"',$sortfield,$sortorder);
}
else
@ -304,7 +304,7 @@ if ($result)
if ($client) {
print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$invoicestatic->ref=$objp->ref;
print $invoicestatic->getNomUrl(1);
print "</td>\n";
print "<td align=\"center\">";

View File

@ -176,7 +176,7 @@ print '</form>';
$sql = "SELECT p.label, p.rowid, p.fk_product_type, p.ref, p.entity as pentity,";
if ($id > 0) $sql.= " d.fk_product,";
if ($id > 0) $sql.= " f.rowid as facid, f.facnumber, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
if ($id > 0) $sql.= " f.rowid as facid, f.ref, f.total as total_ht, f.datef, f.paye, f.fk_statut as statut,";
$sql.= " SUM(d.total_ht) as selling_price,";
// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this)
$sql.= " SUM(".$db->ifsql('d.total_ht < 0','d.qty * d.buy_price_ht * -1','d.qty * d.buy_price_ht').") as buying_price,";
@ -204,7 +204,7 @@ if (!empty($enddate))
$sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1)
$sql .= " AND d.buy_price_ht <> 0";
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut";
if ($id > 0) $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity, d.fk_product, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut";
else $sql.= " GROUP BY p.label, p.rowid, p.fk_product_type, p.ref, p.entity";
$sql.=$db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination
@ -233,7 +233,7 @@ if ($result)
print '<tr class="liste_titre">';
if ($id > 0) {
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&amp;id=".$id,'',$sortfield,$sortorder);
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.ref","","&amp;id=".$id,'',$sortfield,$sortorder);
print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&amp;id=".$id,'align="center"',$sortfield,$sortorder);
}
else
@ -277,7 +277,7 @@ if ($result)
if ($id > 0) {
print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$invoicestatic->ref=$objp->ref;
print $invoicestatic->getNomUrl(1);
print "</td>\n";
print "<td align=\"center\">";

View File

@ -131,7 +131,7 @@ if ($id > 0 || ! empty($ref))
if ($user->rights->facture->lire) {
$sql = "SELECT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,";
$sql.= " f.rowid as facid, f.ref, f.total as total_ht,";
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,";
if (!$user->rights->societe->client->voir && !$socid) $sql.= " sc.fk_soc, sc.fk_user,";
$sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive
@ -151,7 +151,7 @@ if ($id > 0 || ! empty($ref))
if (! empty($socid)) $sql.= " AND f.fk_soc = $socid";
$sql .= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0";
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.type";
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut, f.type";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user";
$sql.= $db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination
@ -169,7 +169,7 @@ if ($id > 0 || ! empty($ref))
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&amp;id=".$object->id,'',$sortfield,$sortorder);
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.ref","","&amp;id=".$object->id,'',$sortfield,$sortorder);
print_liste_field_titre("Company",$_SERVER["PHP_SELF"],"s.nom","","&amp;id=".$object->id,'',$sortfield,$sortorder);
print_liste_field_titre("CustomerCode",$_SERVER["PHP_SELF"],"s.code_client","","&amp;id=".$object->id,'',$sortfield,$sortorder);
print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&amp;id=".$object->id,'align="center"',$sortfield,$sortorder);
@ -199,7 +199,7 @@ if ($id > 0 || ! empty($ref))
print '<tr class="oddeven">';
print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$invoicestatic->ref=$objp->ref;
print $invoicestatic->getNomUrl(1);
print "</td>\n";
print '<td><a href="'.DOL_URL_ROOT.'/comm/card.php?socid='.$objp->socid.'">'.img_object($langs->trans("ShowCompany"),"company").' '.dol_trunc($objp->name,44).'</a></td>';

View File

@ -144,7 +144,7 @@ if ($socid > 0)
print '<br>';
$sql = "SELECT distinct s.nom, s.rowid as socid, s.code_client,";
$sql.= " f.rowid as facid, f.facnumber, f.total as total_ht,";
$sql.= " f.rowid as facid, f.ref, f.total as total_ht,";
$sql.= " f.datef, f.paye, f.fk_statut as statut, f.type,";
$sql.= " sum(d.total_ht) as selling_price,"; // may be negative or positive
$sql.= " sum(d.qty * d.buy_price_ht) as buying_price,"; // always positive
@ -159,7 +159,7 @@ if ($socid > 0)
$sql.= " AND f.fk_soc = $socid";
$sql.= " AND d.buy_price_ht IS NOT NULL";
if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPriceIfNull == 1) $sql .= " AND d.buy_price_ht <> 0";
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.facnumber, f.total, f.datef, f.paye, f.fk_statut, f.type";
$sql.= " GROUP BY s.nom, s.rowid, s.code_client, f.rowid, f.ref, f.total, f.datef, f.paye, f.fk_statut, f.type";
$sql.= $db->order($sortfield,$sortorder);
// TODO: calculate total to display then restore pagination
//$sql.= $db->plimit($conf->liste_limit +1, $offset);
@ -177,7 +177,7 @@ if ($socid > 0)
print "<table class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.facnumber","","&amp;socid=".$_REQUEST["socid"],'',$sortfield,$sortorder);
print_liste_field_titre("Invoice",$_SERVER["PHP_SELF"],"f.ref","","&amp;socid=".$_REQUEST["socid"],'',$sortfield,$sortorder);
print_liste_field_titre("DateInvoice",$_SERVER["PHP_SELF"],"f.datef","","&amp;socid=".$_REQUEST["socid"],'align="center"',$sortfield,$sortorder);
print_liste_field_titre("SoldAmount",$_SERVER["PHP_SELF"],"selling_price","","&amp;socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
print_liste_field_titre("PurchasedAmount",$_SERVER["PHP_SELF"],"buying_price","","&amp;socid=".$_REQUEST["socid"],'align="right"',$sortfield,$sortorder);
@ -211,7 +211,7 @@ if ($socid > 0)
print '<tr class="oddeven">';
print '<td>';
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$invoicestatic->ref=$objp->ref;
print $invoicestatic->getNomUrl(1);
print "</td>\n";
print "<td align=\"center\">";

View File

@ -147,7 +147,7 @@ if ($id > 0 || ! empty($ref))
elseif ($user->rights->facture->lire)
{
$sql = "SELECT DISTINCT s.nom as name, s.rowid as socid, s.code_client,";
$sql.= " f.facnumber, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
$sql.= " f.ref, f.datef, f.paye, f.type, f.fk_statut as statut, f.rowid as facid,";
$sql.= " d.rowid, d.total_ht as total_ht, d.qty"; // We must keep the d.rowid here to not loose record because of the distinct used to ignore duplicate line when link on societe_commerciaux is used
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", sc.fk_soc, sc.fk_user ";
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
@ -239,7 +239,7 @@ if ($id > 0 || ! empty($ref))
$total_qty+=$objp->qty;
$invoicestatic->id=$objp->facid;
$invoicestatic->ref=$objp->facnumber;
$invoicestatic->ref=$objp->ref;
$societestatic->fetch($objp->socid);
$paiement = $invoicestatic->getSommePaiement();

View File

@ -894,7 +894,7 @@ class Thirdparties extends DolibarrApi
}
$sql = "SELECT f.facnumber, f.type as factype, re.fk_facture_source, re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc, re.description, re.fk_facture, re.fk_facture_line";
$sql = "SELECT f.ref, f.type as factype, re.fk_facture_source, re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc, re.description, re.fk_facture, re.fk_facture_line";
$sql .= " FROM ".MAIN_DB_PREFIX."societe_remise_except as re, ".MAIN_DB_PREFIX."facture as f";
$sql .= " WHERE f.rowid = re.fk_facture_source AND re.fk_soc = ".$id;
if ($filter == "available") $sql .= " AND re.fk_facture IS NULL AND re.fk_facture_line IS NULL";

View File

@ -200,13 +200,13 @@ if ($type_element == 'invoice')
{ // Customer : show products from invoices
require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php';
$documentstatic=new Facture($db);
$sql_select = 'SELECT f.rowid as doc_id, f.facnumber as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, ';
$sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, f.type as doc_type, f.datef as dateprint, f.fk_statut as status, f.paye as paid, ';
$tables_from = MAIN_DB_PREFIX."facture as f,".MAIN_DB_PREFIX."facturedet as d";
$where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid;
$where.= " AND d.fk_facture = f.rowid";
$where.= " AND f.entity = ".$conf->entity;
$dateprint = 'f.datef';
$doc_number='f.facnumber';
$doc_number='f.ref';
$thirdTypeSelect='customer';
}
if ($type_element == 'propal')

View File

@ -762,7 +762,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
* List of unpaid invoices
*/
$sql = 'SELECT f.rowid as facid, f.facnumber, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, ';
$sql = 'SELECT f.rowid as facid, f.ref, f.total_ttc, f.multicurrency_code, f.multicurrency_total_ttc, f.type, ';
$sql.= ' f.datef as df, f.fk_soc as socid';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
@ -789,7 +789,7 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
}
// Sort invoices by date and serial number: the older one comes first
$sql.=' ORDER BY f.datef ASC, f.facnumber ASC';
$sql.=' ORDER BY f.datef ASC, f.ref ASC';
$resql = $db->query($sql);
if ($resql)
@ -1073,7 +1073,7 @@ if (! GETPOST('action'))
if (! $sortorder) $sortorder='DESC';
if (! $sortfield) $sortfield='p.datep';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.facnumber';
$sql = 'SELECT p.datep as dp, p.amount, f.amount as fa_amount, f.ref';
$sql.=', f.rowid as facid, c.libelle as paiement_type, p.num_paiement';
$sql.= ' FROM '.MAIN_DB_PREFIX.'paiement as p, '.MAIN_DB_PREFIX.'facture as f, '.MAIN_DB_PREFIX.'c_paiement as c';
$sql.= ' WHERE p.fk_facture = f.rowid AND p.fk_paiement = c.id';
@ -1095,7 +1095,7 @@ if (! GETPOST('action'))
print_barre_liste($langs->trans('Payments'), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'facnumber','','','',$sortfield,$sortorder);
print_liste_field_titre('Invoice',$_SERVER["PHP_SELF"],'ref','','','',$sortfield,$sortorder);
print_liste_field_titre('Date',$_SERVER["PHP_SELF"],'dp','','','',$sortfield,$sortorder);
print_liste_field_titre('Type',$_SERVER["PHP_SELF"],'libelle','','','',$sortfield,$sortorder);
print_liste_field_titre('Amount',$_SERVER["PHP_SELF"],'fa_amount','','','align="right"',$sortfield,$sortorder);
@ -1106,7 +1106,7 @@ if (! GETPOST('action'))
{
$objp = $db->fetch_object($resql);
print '<tr class="oddeven">';
print '<td><a href="'.DOL_URL_ROOT.'compta/facture/card.php?facid='.$objp->facid.'">'.$objp->facnumber."</a></td>\n";
print '<td><a href="'.DOL_URL_ROOT.'compta/facture/card.php?facid='.$objp->facid.'">'.$objp->ref."</a></td>\n";
print '<td>'.dol_print_date($db->jdate($objp->dp))."</td>\n";
print '<td>'.$objp->paiement_type.' '.$objp->num_paiement."</td>\n";
print '<td align="right">'.price($objp->amount).'</td><td>&nbsp;</td>';

View File

@ -55,7 +55,7 @@ $_GET['optioncss'] = 'print';
*/
if ($action=="change") {
$sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where facnumber='(PROV-POS-".$place.")'";
$sql="UPDATE ".MAIN_DB_PREFIX."facture set fk_soc=".$idcustomer." where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
?>
<script>

View File

@ -40,7 +40,7 @@ $idline = GETPOST('idline');
$desc = GETPOST('desc','alpha');
$pay = GETPOST('pay');
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where facnumber='(PROV-POS-".$place.")'";
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array ($resql);
$placeid=$row[0];
@ -71,7 +71,7 @@ if ($action == 'valid' && $user->rights->facture->creer){
if ($pay=="cash") $payment->paiementid=4;
else if ($pay=="card") $payment->paiementid=6;
else if ($pay=="cheque") $payment->paiementid=7;
$payment->num_paiement=$invoice->facnumber;
$payment->num_paiement=$invoice->ref;
$payment->create($user);
$payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', '');
$invoice->set_paid($user);
@ -89,7 +89,7 @@ if (($action=="addline" || $action=="freezone") and $placeid==0)
$invoice->pos_source = (string) (empty($place)?'0':$place);
$placeid=$invoice->create($user);
$sql="UPDATE ".MAIN_DB_PREFIX."facture set facnumber='(PROV-POS-".$place.")' where rowid=".$placeid;
$sql="UPDATE ".MAIN_DB_PREFIX."facture set ref='(PROV-POS-".$place.")' where rowid=".$placeid;
$db->query($sql);
}
}
@ -280,7 +280,7 @@ print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).'&nbs
print '</p>';
//}
if ($action=="valid"){
print '<p style="font-size:120%;" align="center"><b>'.$invoice->facnumber." ".$langs->trans('BillShortStatusValidated').'</b></p>';
print '<p style="font-size:120%;" align="center"><b>'.$invoice->ref." ".$langs->trans('BillShortStatusValidated').'</b></p>';
if ($conf->global->TAKEPOSCONNECTOR) print '<center><button type="button" onclick="TakeposPrinting('.$placeid.');">'.$langs->trans('PrintTicket').'</button><center>';
else print '<center><button type="button" onclick="Print('.$placeid.');">'.$langs->trans('PrintTicket').'</button><center>';
}

View File

@ -37,7 +37,7 @@ $place = GETPOST('place','int');
* View
*/
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where facnumber='(PROV-POS-".$place.")'";
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array ($resql);
$placeid=$row[0];

View File

@ -32,7 +32,7 @@ top_httphead('text/html');
$facid=GETPOST('facid','int');
$place=GETPOST('place','int');
if ($place>0){
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where facnumber='(PROV-POS-".$place.")'";
$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where ref='(PROV-POS-".$place.")'";
$resql = $db->query($sql);
$row = $db->fetch_array ($resql);
$facid=$row[0];

View File

@ -426,7 +426,7 @@ function getInvoicesForThirdParty($authentication,$idthirdparty)
{
$linesinvoice=array();
$sql ='SELECT f.rowid as facid, facnumber as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
$sql ='SELECT f.rowid as facid, ref as ref, ref_ext, type, fk_statut as status, total_ttc, total, tva';
$sql.=' FROM '.MAIN_DB_PREFIX.'facture as f';
$sql.=" WHERE f.entity = ".$conf->entity;
if ($idthirdparty != 'all' ) $sql.=" AND f.fk_soc = ".$db->escape($idthirdparty);

View File

@ -78,7 +78,7 @@ print $script_file." launched with mode ".$mode." default lang=".$langs->default
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date,";
$sql = "SELECT f.ref, f.total_ttc, f.date_lim_reglement as due_date,";
$sql.= " s.rowid as sid, s.nom as name, s.email, s.default_lang";
if ($targettype == 'contacts') $sql.= ", sp.rowid as cid, sp.firstname as cfirstname, sp.lastname as clastname, sp.email as cemail";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
@ -90,7 +90,7 @@ if (is_numeric($duration_value)) $sql.= " AND f.date_lim_reglement < '".$db->ida
if ($targettype == 'contacts') $sql.= " AND s.rowid = sp.fk_soc";
$sql.= " ORDER BY";
if ($targettype == 'contacts') $sql.= " sp.email, sp.rowid,";
$sql.= " s.email ASC, s.rowid ASC, f.facnumber ASC"; // Order by email to allow one message per email
$sql.= " s.email ASC, s.rowid ASC, f.ref ASC"; // Order by email to allow one message per email
//print $sql;
$resql=$db->query($sql);
@ -157,11 +157,11 @@ if ($resql)
if (dol_strlen($newemail))
{
$message .= $outputlangs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)."\n";
$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)."\n";
dol_syslog("email_unpaid_invoices_to_customers.php: ".$newemail." ".$message);
$foundtoprocess++;
}
print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day').", customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.", ":"")."email ".$newemail.", lang ".$outputlangs->defaultlang.": ";
print "Unpaid invoice ".$obj->ref.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day').", customer id ".$obj->sid." ".$obj->name.", ".($obj->cid?"contact id ".$obj->cid." ".$obj->clastname." ".$obj->cfirstname.", ":"")."email ".$newemail.", lang ".$outputlangs->defaultlang.": ";
if (dol_strlen($newemail)) print "qualified.";
else print "disqualified (no email).";
print "\n";

View File

@ -75,7 +75,7 @@ print $script_file." launched with mode ".$mode." default lang=".$langs->default
if ($mode != 'confirm') $conf->global->MAIN_DISABLE_ALL_MAILS=1;
$sql = "SELECT f.facnumber, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, s.email, s.default_lang,";
$sql = "SELECT f.ref, f.total_ttc, f.date_lim_reglement as due_date, s.nom as name, s.email, s.default_lang,";
$sql.= " u.rowid as uid, u.lastname, u.firstname, u.email, u.lang";
$sql .= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql .= " , ".MAIN_DB_PREFIX."societe as s";
@ -86,7 +86,7 @@ $sql .= " AND f.fk_soc = s.rowid";
if (is_numeric($duration_value)) $sql .= " AND f.date_lim_reglement < '".$db->idate(dol_time_plus_duree($now, $duration_value, "d"))."'";
$sql .= " AND sc.fk_soc = s.rowid";
$sql .= " AND sc.fk_user = u.rowid";
$sql .= " ORDER BY u.email ASC, s.rowid ASC, f.facnumber ASC"; // Order by email to allow one message per email
$sql .= " ORDER BY u.email ASC, s.rowid ASC, f.ref ASC"; // Order by email to allow one message per email
//print $sql;
$resql=$db->query($sql);
@ -137,11 +137,11 @@ if ($resql)
if (dol_strlen($obj->email))
{
$message .= $outputlangs->trans("Invoice")." ".$obj->facnumber." : ".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)." : ".$obj->name."\n";
$message .= $outputlangs->trans("Invoice")." ".$obj->ref." : ".price($obj->total_ttc,0,$outputlangs,0,0,-1,$conf->currency)." : ".$obj->name."\n";
dol_syslog("email_unpaid_invoices_to_representatives.php: ".$obj->email);
$foundtoprocess++;
}
print "Unpaid invoice ".$obj->facnumber.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." (linked to company ".$obj->name.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email.", lang ".$outputlangs->defaultlang."): ";
print "Unpaid invoice ".$obj->ref.", price ".price2num($obj->total_ttc).", due date ".dol_print_date($db->jdate($obj->due_date),'day')." (linked to company ".$obj->name.", sale representative ".dolGetFirstLastname($obj->firstname, $obj->lastname).", email ".$obj->email.", lang ".$outputlangs->defaultlang."): ";
if (dol_strlen($obj->email)) print "qualified.";
else print "disqualified (no email).";
print "\n";

View File

@ -217,16 +217,16 @@ class ExportTest extends PHPUnit_Framework_TestCase
{
global $conf,$user,$langs,$db;
$sql = "SELECT f.facnumber as f_facnumber, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
$sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
$objexport=new Export($db);
//$objexport->load_arrays($user,$datatoexport);
// Define properties
$datatoexport='test';
$array_selected = array("f.facnumber"=>1, "f.total"=>2, "f.tva"=>3);
$array_export_fields = array("f.facnumber"=>"FacNumber", "f.total"=>"FacTotal", "f.tva"=>"FacVat");
$array_alias = array("f_facnumber"=>"facnumber", "f_total"=>"total", "f_tva"=>"tva");
$array_selected = array("f.ref"=>1, "f.total"=>2, "f.tva"=>3);
$array_export_fields = array("f.ref"=>"FacNumber", "f.total"=>"FacTotal", "f.tva"=>"FacVat");
$array_alias = array("f_ref"=>"ref", "f_total"=>"total", "f_tva"=>"tva");
$objexport->array_export_fields[0]=$array_export_fields;
$objexport->array_export_alias[0]=$array_alias;
@ -266,18 +266,18 @@ class ExportTest extends PHPUnit_Framework_TestCase
{
global $conf,$user,$langs,$db;
/*
$sql = "SELECT f.facnumber as f_facnumber, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
$sql = "SELECT f.ref as f_ref, f.total as f_total, f.tva as f_tva FROM ".MAIN_DB_PREFIX."facture f";
$objexport=new Export($db);
//$objexport->load_arrays($user,$datatoexport);
// Define properties
$datatoexport='test_filtered';
$array_selected = array("f.facnumber"=>1, "f.total"=>2, "f.tva"=>3);
$array_export_fields = array("f.facnumber"=>"FacNumber", "f.total"=>"FacTotal", "f.tva"=>"FacVat");
$array_selected = array("f.ref"=>1, "f.total"=>2, "f.tva"=>3);
$array_export_fields = array("f.ref"=>"FacNumber", "f.total"=>"FacTotal", "f.tva"=>"FacVat");
$array_filtervalue = array("f.total" => ">100");
$array_filtered = array("f.total" => 1);
$array_alias = array("f_facnumber"=>"facnumber", "f_total"=>"total", "f_tva"=>"tva");
$array_alias = array("f_ref"=>"ref", "f_total"=>"total", "f_tva"=>"tva");
$objexport->array_export_fields[0]=$array_export_fields;
$objexport->array_export_alias[0]=$array_alias;

View File

@ -230,7 +230,7 @@ class FactureTest extends PHPUnit_Framework_TestCase
true,
array(
'newref','oldref','id','lines','client','thirdparty','brouillon','user_author','date_creation','date_validation','datem','date_modification',
'ref','statut','paye','specimen','facnumber','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement',
'ref','statut','paye','specimen','ref','actiontypecode','actionmsg2','actionmsg','mode_reglement','cond_reglement',
'cond_reglement_doc','situation_cycle_ref','situation_counter','situation_final','multicurrency_total_ht','multicurrency_total_tva',
'multicurrency_total_ttc','fk_multicurrency','multicurrency_code','multicurrency_tx'
)