*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -809,14 +809,16 @@ if (empty($reshook))
// Total credit note and deposit
$total_creditnote_and_deposit = 0;
- $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
- $sql .= " re.description, re.fk_facture_source";
- $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
- $sql .= " WHERE fk_facture = " . $object->id;
- $resql = $db->query($sql);
- if (!empty($resql)) {
- while ($obj = $db->fetch_object($resql)) $total_creditnote_and_deposit += $obj->amount_ttc;
- } else dol_print_error($db);
+ $sql = "SELECT re.rowid, re.amount_ht, re.amount_tva, re.amount_ttc,";
+ $sql .= " re.description, re.fk_facture_source";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "societe_remise_except as re";
+ $sql .= " WHERE fk_facture = " . $object->id;
+ $resql = $db->query($sql);
+ if (!empty($resql)) {
+ while ($obj = $db->fetch_object($resql)) {
+ $total_creditnote_and_deposit += $obj->amount_ttc;
+ }
+ } else dol_print_error($db);
$discount->amount_ht = $discount->amount_ttc = $total_paiements + $total_creditnote_and_deposit - $object->total_ttc;
$discount->amount_tva = 0;
@@ -1516,7 +1518,7 @@ if (empty($reshook))
$localtax1_tx = get_localtax($tva_tx, 1, $object->thirdparty);
$localtax2_tx = get_localtax($tva_tx, 2, $object->thirdparty);
- $result = $object->addline(
+ $result = $object->addline(
$desc, $lines[$i]->subprice, $lines[$i]->qty, $tva_tx, $localtax1_tx, $localtax2_tx, $lines[$i]->fk_product,
$lines[$i]->remise_percent, $date_start, $date_end, 0, $lines[$i]->info_bits, $lines[$i]->fk_remise_except,
'HT', 0, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $object->origin, $lines[$i]->rowid,
@@ -2726,7 +2728,7 @@ if ($action == 'create')
$text.=' '.$langs->trans("ToCreateARecurringInvoiceGene", $langs->transnoentitiesnoconv("MenuFinancial"), $langs->transnoentitiesnoconv("BillsCustomers"), $langs->transnoentitiesnoconv("ListOfTemplates"));
if (empty($conf->global->INVOICE_DISABLE_AUTOMATIC_RECURRING_INVOICE))
{
- $text.=' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
+ $text.=' '.$langs->trans("ToCreateARecurringInvoiceGeneAuto", $langs->transnoentitiesnoconv('Module2300Name'));
}
print info_admin($text, 0, 0, 0).' ';
}
@@ -3274,12 +3276,12 @@ if ($action == 'create')
print '';
include_once DOL_DOCUMENT_ROOT . '/core/modules/facture/modules_facture.php';
$liste = ModelePDFFactures::liste_modeles($db);
- if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){ // Hidden conf
- $paramkey='FACTURE_ADDON_PDF_'.$object->type;
- $curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
- }
- else{
- $curent = $conf->global->FACTURE_ADDON_PDF;
+ if(!empty($conf->global->INVOICE_USE_DEFAULT_DOCUMENT)){
+ // Hidden conf
+ $paramkey='FACTURE_ADDON_PDF_'.$object->type;
+ $curent = !empty($conf->global->$paramkey)?$conf->global->$paramkey:$conf->global->FACTURE_ADDON_PDF;
+ } else {
+ $curent = $conf->global->FACTURE_ADDON_PDF;
}
print $form->selectarray('model', $liste, $curent);
print " ";
@@ -3803,19 +3805,20 @@ elseif ($id > 0 || ! empty($ref))
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($usercancreate)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php
index 654af5aeaac..25d92fad92a 100644
--- a/htdocs/compta/facture/class/api_invoices.class.php
+++ b/htdocs/compta/facture/class/api_invoices.class.php
@@ -415,7 +415,7 @@ class Invoices extends DolibarrApi
return $this->_cleanObjectDatas($this->invoice);
}
- /**
+ /**
* Delete a contact type of given invoice
*
* @param int $id Id of invoice to update
@@ -529,10 +529,9 @@ class Invoices extends DolibarrApi
// update bank account
if (!empty($this->invoice->fk_account))
{
- if($this->invoice->setBankAccount($this->invoice->fk_account) == 0)
- {
- throw new RestException(400, $this->invoice->error);
- }
+ if ($this->invoice->setBankAccount($this->invoice->fk_account) == 0) {
+ throw new RestException(400, $this->invoice->error);
+ }
}
if($this->invoice->update(DolibarrApiAccess::$user))
@@ -909,18 +908,18 @@ class Invoices extends DolibarrApi
$result = $this->invoice->fetch($id);
- if( ! $result ) {
+ if (! $result) {
throw new RestException(404, 'Invoice not found');
}
- if( ! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
+ if (! DolibarrApi::_checkAccessToResource('facture', $this->invoice->id)) {
throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login);
}
return $this->_cleanObjectDatas($this->invoice);
}
- /**
+ /**
* Create a discount (credit available) for a credit note or a deposit.
*
* @param int $id Invoice ID
diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php
index 0cb6921a6f3..8859578e94b 100644
--- a/htdocs/compta/facture/class/facture.class.php
+++ b/htdocs/compta/facture/class/facture.class.php
@@ -862,10 +862,10 @@ class Facture extends CommonInvoice
if (! $error && ! $notrigger)
{
- // Call trigger
- $result=$this->call_trigger('BILL_CREATE', $user);
- if ($result < 0) $error++;
- // End call triggers
+ // Call trigger
+ $result=$this->call_trigger('BILL_CREATE', $user);
+ if ($result < 0) $error++;
+ // End call triggers
}
if (! $error)
@@ -1605,9 +1605,9 @@ class Facture extends CommonInvoice
// multilangs
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($objp->fk_product) && ! empty($loadalsotranslation)) {
- $line = new Product($this->db);
- $line->fetch($objp->fk_product);
- $line->getMultiLangs();
+ $line = new Product($this->db);
+ $line->fetch($objp->fk_product);
+ $line->getMultiLangs();
}
$this->lines[$i] = $line;
@@ -2545,7 +2545,7 @@ class Facture extends CommonInvoice
if (empty($final)) $this->situation_final = 0;
else $this->situation_final = 1;
- $this->setFinal($user);
+ $this->setFinal($user);
}
}
}
@@ -2587,10 +2587,12 @@ class Facture extends CommonInvoice
$next_invoice->brouillon = 1;
foreach ($next_invoice->lines as $line)
{
- $result = $next_invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
- $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
- $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
- $line->fk_unit);
+ $result = $next_invoice->updateline(
+ $line->id, $line->desc, $line->subprice, $line->qty, $line->remise_percent,
+ $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type,
+ $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent,
+ $line->fk_unit
+ );
if ($result < 0)
{
diff --git a/htdocs/compta/facture/contact.php b/htdocs/compta/facture/contact.php
index 5fb26a21cd6..62960b71346 100644
--- a/htdocs/compta/facture/contact.php
+++ b/htdocs/compta/facture/contact.php
@@ -163,20 +163,21 @@ if ($id > 0 || ! empty($ref))
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- $morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ $morehtmlref.=' : ';
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php
index fb56ccb916f..79780402108 100644
--- a/htdocs/compta/facture/fiche-rec.php
+++ b/htdocs/compta/facture/fiche-rec.php
@@ -1242,19 +1242,20 @@ else
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php
index e13dc30204f..f714d51cf6e 100644
--- a/htdocs/compta/facture/invoicetemplate_list.php
+++ b/htdocs/compta/facture/invoicetemplate_list.php
@@ -223,8 +223,9 @@ $sql.= " f.nb_gen_done, f.nb_gen_max, f.date_last_gen, f.date_when, f.suspended,
$sql.= " f.datec, f.tms,";
$sql.= " f.fk_cond_reglement, f.fk_mode_reglement";
// Add fields from extrafields
-if (! empty($extrafields->attributes[$object->table_element]['label']))
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
@@ -513,68 +514,68 @@ if ($resql)
if (! empty($arrayfields['f.titre']['checked']))
{
- print '';
- print $invoicerectmp->getNomUrl(1);
- print "";
- print " \n";
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print $invoicerectmp->getNomUrl(1);
+ print "";
+ print " \n";
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['s.nom']['checked']))
{
- print ''.$companystatic->getNomUrl(1, 'customer').' ';
- if (! $i) $totalarray['nbfield']++;
+ print ''.$companystatic->getNomUrl(1, 'customer').' ';
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.total']['checked']))
{
- print ''.price($objp->total).' '."\n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total';
- $totalarray['val']['f.total'] += $objp->total;
+ print ''.price($objp->total).' '."\n";
+ if (! $i) $totalarray['nbfield']++;
+ if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total';
+ $totalarray['val']['f.total'] += $objp->total;
}
if (! empty($arrayfields['f.tva']['checked']))
{
- print ''.price($objp->total_vat).' '."\n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva';
- $totalarray['val']['f.tva'] += $objp->total_vat;
+ print ''.price($objp->total_vat).' '."\n";
+ if (! $i) $totalarray['nbfield']++;
+ if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.tva';
+ $totalarray['val']['f.tva'] += $objp->total_vat;
}
if (! empty($arrayfields['f.total_ttc']['checked']))
{
- print ''.price($objp->total_ttc).' '."\n";
- if (! $i) $totalarray['nbfield']++;
- if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
- $totalarray['val']['f.total_ttc'] += $objp->total_ttc;
+ print ''.price($objp->total_ttc).' '."\n";
+ if (! $i) $totalarray['nbfield']++;
+ if (! $i) $totalarray['pos'][$totalarray['nbfield']]='f.total_ttc';
+ $totalarray['val']['f.total_ttc'] += $objp->total_ttc;
}
// Payment term
if (! empty($arrayfields['f.fk_cond_reglement']['checked']))
{
- print '';
- print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
- print ' '."\n";
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print $form->form_conditions_reglement('', $objp->fk_cond_reglement, 'none');
+ print ' '."\n";
+ if (! $i) $totalarray['nbfield']++;
}
// Payment mode
if (! empty($arrayfields['f.fk_mode_reglement']['checked']))
{
- print '';
- print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
- print ' '."\n";
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print $form->form_modes_reglement('', $objp->fk_mode_reglement, 'none');
+ print ' '."\n";
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['recurring']['checked']))
{
- print ''.yn($objp->frequency?1:0).' ';
- if (! $i) $totalarray['nbfield']++;
+ print ''.yn($objp->frequency?1:0).' ';
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.frequency']['checked']))
{
- print ''.($objp->frequency > 0 ? $objp->frequency : '').' ';
- if (! $i) $totalarray['nbfield']++;
+ print ''.($objp->frequency > 0 ? $objp->frequency : '').' ';
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.unit_frequency']['checked']))
{
- print ''.($objp->frequency > 0 ? $objp->unit_frequency : '').' ';
- if (! $i) $totalarray['nbfield']++;
+ print ''.($objp->frequency > 0 ? $objp->unit_frequency : '').' ';
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.nb_gen_done']['checked']))
{
@@ -586,10 +587,10 @@ if ($resql)
// Date last generation
if (! empty($arrayfields['f.date_last_gen']['checked']))
{
- print '';
- print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').' ');
- print ' ';
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print ($objp->frequency > 0 ? dol_print_date($db->jdate($objp->date_last_gen), 'day') : ''.$langs->trans('NA').' ');
+ print ' ';
+ if (! $i) $totalarray['nbfield']++;
}
// Date next generation
if (! empty($arrayfields['f.date_when']['checked']))
@@ -611,17 +612,17 @@ if ($resql)
}
if (! empty($arrayfields['f.datec']['checked']))
{
- print '';
- print dol_print_date($db->jdate($objp->datec), 'dayhour');
- print ' ';
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print dol_print_date($db->jdate($objp->datec), 'dayhour');
+ print ' ';
+ if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.tms']['checked']))
{
- print '';
- print dol_print_date($db->jdate($objp->tms), 'dayhour');
- print ' ';
- if (! $i) $totalarray['nbfield']++;
+ print '';
+ print dol_print_date($db->jdate($objp->tms), 'dayhour');
+ print ' ';
+ if (! $i) $totalarray['nbfield']++;
}
$obj = $objp;
@@ -632,12 +633,11 @@ if ($resql)
$reshook=$hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
// Status
- if (! empty($arrayfields['status']['checked']))
- {
- print '';
- print $invoicerectmp->getLibStatut(3, 0);
- print ' ';
- if (! $i) $totalarray['nbfield']++;
+ if (! empty($arrayfields['status']['checked'])) {
+ print '';
+ print $invoicerectmp->getLibStatut(3, 0);
+ print ' ';
+ if (! $i) $totalarray['nbfield']++;
}
// Action column
print '';
diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php
index 4642c0b7da1..5f1ce9e44c3 100644
--- a/htdocs/compta/facture/list.php
+++ b/htdocs/compta/facture/list.php
@@ -400,8 +400,9 @@ $sql.= " p.rowid as project_id, p.ref as project_ref, p.title as project_label";
if (! $sall) $sql.= ', SUM(pf.amount) as dynamount_payed';
if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc";
// Add fields from extrafields
-if (! empty($extrafields->attributes[$object->table_element]['label']))
+if (! empty($extrafields->attributes[$object->table_element]['label'])) {
foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) $sql.=($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key.' as options_'.$key : '');
+}
// Add fields from hooks
$parameters=array();
$reshook=$hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook
@@ -1346,32 +1347,31 @@ if ($resql)
// Show total line
if (isset($totalarray['totalhtfield'])
- || isset($totalarray['totalvatfield'])
- || isset($totalarray['totallocaltax1field'])
- || isset($totalarray['totallocaltax2field'])
- || isset($totalarray['totalttcfield'])
- || isset($totalarray['totalamfield'])
- || isset($totalarray['totalrtpfield'])
- )
- {
+ || isset($totalarray['totalvatfield'])
+ || isset($totalarray['totallocaltax1field'])
+ || isset($totalarray['totallocaltax2field'])
+ || isset($totalarray['totalttcfield'])
+ || isset($totalarray['totalamfield'])
+ || isset($totalarray['totalrtpfield'])
+ ) {
print ' ';
$i=0;
while ($i < $totalarray['nbfield'])
{
- $i++;
- if ($i == 1)
- {
+ $i++;
+ if ($i == 1)
+ {
if ($num < $limit && empty($offset)) print ''.$langs->trans("Total").' ';
else print ''.$langs->trans("Totalforthispage").' ';
- }
- elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).' ';
- elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).' ';
- elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).' ';
- elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).' ';
- elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).' ';
- elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).' ';
- elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).' ';
- else print ' ';
+ }
+ elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).' ';
+ elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).' ';
+ elseif ($totalarray['totallocaltax1field'] == $i) print ''.price($totalarray['totallocaltax1']).' ';
+ elseif ($totalarray['totallocaltax2field'] == $i) print ''.price($totalarray['totallocaltax2']).' ';
+ elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).' ';
+ elseif ($totalarray['totalamfield'] == $i) print ''.price($totalarray['totalam']).' ';
+ elseif ($totalarray['totalrtpfield'] == $i) print ''.price($totalarray['totalrtp']).' ';
+ else print ' ';
}
print ' ';
}
diff --git a/htdocs/compta/facture/prelevement.php b/htdocs/compta/facture/prelevement.php
index 45bbfc3eef3..cf59af89cf6 100644
--- a/htdocs/compta/facture/prelevement.php
+++ b/htdocs/compta/facture/prelevement.php
@@ -189,20 +189,21 @@ if ($object->id > 0)
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($user->rights->facture->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
//$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- $morehtmlref.=' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ $morehtmlref.=' : ';
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php
index d475c5c3e5f..dadbb27b30d 100644
--- a/htdocs/compta/facture/stats/index.php
+++ b/htdocs/compta/facture/stats/index.php
@@ -233,48 +233,45 @@ foreach ($tmp_companies as $value) {
print '';
-//if (empty($socid))
-//{
- // Show filter box
- print '
';
- print '
';
-//}
+// Show filter box
+print '
';
+print '
';
print '
';
print '
';
diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
index b48c0478609..d2cad75ca77 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php
@@ -24,11 +24,7 @@ if (empty($conf) || ! is_object($conf))
exit;
}
-?>
-
-
-
-\n";
global $user;
global $noMoreLinkedObjectBlockAfter;
@@ -40,73 +36,70 @@ $langs->load("bills");
$linkedObjectBlock = dol_sort_array($linkedObjectBlock, 'date', 'desc', 0, 0, 1);
-$total=0; $ilink=0;
+$total=0;
+$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
-?>
-
- type) {
- case Facture::TYPE_REPLACEMENT:
- echo $langs->trans("InvoiceReplacement");
- break;
- case Facture::TYPE_CREDIT_NOTE:
- echo $langs->trans("InvoiceAvoir");
- break;
- case Facture::TYPE_DEPOSIT:
- echo $langs->trans("InvoiceDeposit");
- break;
- case Facture::TYPE_PROFORMA:
- echo $langs->trans("InvoiceProForma");
- break;
- case Facture::TYPE_SITUATION:
- echo $langs->trans("InvoiceSituation");
- break;
- default:
- echo $langs->trans("CustomerInvoice");
- break;
- }
- ?>
- getNomUrl(1); ?>
- ref_client; ?>
- date, 'day'); ?>
- rights->facture->lire) {
- $sign = 1;
- if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
- if ($objectlink->statut != 3) // If not abandonned
- {
- $total = $total + $sign * $objectlink->total_ht;
- echo price($objectlink->total_ht);
- }
- else
- {
- echo ''.price($objectlink->total_ht).' ';
- }
- } ?>
- getLibStatut(3); ?>
- id.'&action=dellink&dellinkid='.$key; ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
-
-element.'" data-id="'.$objectlink->id.'" >';
+ print '';
+ switch ($objectlink->type) {
+ case Facture::TYPE_REPLACEMENT:
+ echo $langs->trans("InvoiceReplacement");
+ break;
+ case Facture::TYPE_CREDIT_NOTE:
+ echo $langs->trans("InvoiceAvoir");
+ break;
+ case Facture::TYPE_DEPOSIT:
+ echo $langs->trans("InvoiceDeposit");
+ break;
+ case Facture::TYPE_PROFORMA:
+ echo $langs->trans("InvoiceProForma");
+ break;
+ case Facture::TYPE_SITUATION:
+ echo $langs->trans("InvoiceSituation");
+ break;
+ default:
+ echo $langs->trans("CustomerInvoice");
+ break;
+ }
+ print ' ';
+ print ''.$objectlink->getNomUrl(1).' ';
+ print ''.$objectlink->ref_client.' ';
+ print ''.dol_print_date($objectlink->date, 'day').' ';
+ print '';
+ if ($user->rights->facture->lire) {
+ $sign = 1;
+ if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
+ if ($objectlink->statut != 3) {
+ // If not abandonned
+ $total = $total + $sign * $objectlink->total_ht;
+ echo price($objectlink->total_ht);
+ }
+ else
+ {
+ echo ''.price($objectlink->total_ht).' ';
+ }
+ }
+ print ' ';
+ print ''.$objectlink->getLibStatut(3).' ';
+ print 'id.'&action=dellink&dellinkid='.$key.'">'.img_picto($langs->transnoentitiesnoconv("RemoveLink"), 'unlink').' ';
+ print "\n";
}
if (count($linkedObjectBlock) > 1)
{
- ?>
-
- trans("Total"); ?>
-
-
-
-
-
-
-
- ';
+ print ''.$langs->trans("Total").' ';
+ print ' ';
+ print ' ';
+ print ' ';
+ print ''.price($total).' ';
+ print ' ';
+ print ' ';
+ print '';
}
-?>
-
+print "\n";
diff --git a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
index f6f854d9635..cb16ce407f8 100644
--- a/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
+++ b/htdocs/compta/facture/tpl/linkedobjectblockForRec.tpl.php
@@ -24,11 +24,9 @@ if (empty($conf) || ! is_object($conf))
exit;
}
-?>
-
+print "\n";
-load("bills");
-$total=0; $ilink=0;
+$total=0;
+$ilink=0;
foreach($linkedObjectBlock as $key => $objectlink)
{
$ilink++;
$trclass='oddeven';
if ($ilink == count($linkedObjectBlock) && empty($noMoreLinkedObjectBlockAfter) && count($linkedObjectBlock) <= 1) $trclass.=' liste_sub_total';
-?>
+ ?>
trans("RepeatableInvoice"); ?>
getNomUrl(1); ?>
date_when, 'day'); ?>
rights->facture->lire) {
- $total = $total + $objectlink->total_ht;
- echo price($objectlink->total_ht);
- } ?>
+ if ($user->rights->facture->lire) {
+ $total = $total + $objectlink->total_ht;
+ echo price($objectlink->total_ht);
+ }
+ ?>
getLibStatut(3); ?>
id.'&action=dellink&dellinkid='.$key; ?>">transnoentitiesnoconv("RemoveLink"), 'unlink'); ?>
- 1)
{
@@ -75,6 +75,5 @@ if (count($linkedObjectBlock) > 1)
-
+print "\n";
diff --git a/htdocs/compta/prelevement/card.php b/htdocs/compta/prelevement/card.php
index ea5a4e8d07c..1282226623c 100644
--- a/htdocs/compta/prelevement/card.php
+++ b/htdocs/compta/prelevement/card.php
@@ -271,7 +271,7 @@ if ($id > 0 || $ref)
print ''.$langs->trans("TransMetod").' ';
print $form->selectarray("methode", $object->methodes_trans);
print ' ';
-/* print ''.$langs->trans("File").' ';
+ /*print ' '.$langs->trans("File").' ';
print ' ';
print ' ';
print ' ';*/
diff --git a/htdocs/compta/prelevement/class/bonprelevement.class.php b/htdocs/compta/prelevement/class/bonprelevement.class.php
index 5f2d73af0aa..4016ebdc813 100644
--- a/htdocs/compta/prelevement/class/bonprelevement.class.php
+++ b/htdocs/compta/prelevement/class/bonprelevement.class.php
@@ -1686,7 +1686,7 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR ='';
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$CrLf;
- // $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).' '.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
+ // $XML_DEBITOR .=' '.('AS-'.dol_trunc($row_ref,20).'-'.$Rowing).' '.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' '.(($conf->global->PRELEVEMENT_END_TO_END != "" ) ? $conf->global->PRELEVEMENT_END_TO_END : ('AS-'.dol_trunc($row_ref, 20)).'-'.$Rowing).' '.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.round($row_somme, 2).' '.$CrLf;
@@ -1718,8 +1718,8 @@ class BonPrelevement extends CommonObject
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$CrLf;
- // $XML_DEBITOR .=' '.($row_ref.'/'.$Rowing.'/'.$Rum).' '.$CrLf;
- // $XML_DEBITOR .=' '.dol_trunc($row_ref, 135).' '.$CrLf; // 140 max
+ // $XML_DEBITOR .=' '.($row_ref.'/'.$Rowing.'/'.$Rum).' '.$CrLf;
+ // $XML_DEBITOR .=' '.dol_trunc($row_ref, 135).' '.$CrLf; // 140 max
$XML_DEBITOR .=' '.(($conf->global->PRELEVEMENT_USTRD != "" ) ? $conf->global->PRELEVEMENT_USTRD : dol_trunc($row_ref, 135) ).' '.$CrLf; // 140 max
$XML_DEBITOR .=' '.$CrLf;
$XML_DEBITOR .=' '.$CrLf;
@@ -1887,15 +1887,15 @@ class BonPrelevement extends CommonObject
$XML_SEPA_INFO .= ' '.$this->emetteur_bic.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
-/* $XML_SEPA_INFO .= ' '.$CrLf;
+ /* $XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$this->raison_sociale.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$country[1].' '.$CrLf;
$XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ADDRESS.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$conf->global->MAIN_INFO_SOCIETE_ZIP.' '.$conf->global->MAIN_INFO_SOCIETE_TOWN.' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
- $XML_SEPA_INFO .= ' '.$CrLf;
-*/ $XML_SEPA_INFO .= ' SLEV '.$CrLf;
+ $XML_SEPA_INFO .= ' '.$CrLf;*/
+ $XML_SEPA_INFO .= ' SLEV '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
$XML_SEPA_INFO .= ' '.$CrLf;
diff --git a/htdocs/compta/prelevement/fiche-rejet.php b/htdocs/compta/prelevement/fiche-rejet.php
index 24aa2f9bcb9..3dbfec69461 100644
--- a/htdocs/compta/prelevement/fiche-rejet.php
+++ b/htdocs/compta/prelevement/fiche-rejet.php
@@ -223,7 +223,7 @@ if ($resql)
}
else
{
- print ''.$langs->trans("None").' ';
+ print ''.$langs->trans("None").' ';
}
if ($num > 0)
diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php
index 5efa036055f..0503f31d6fb 100644
--- a/htdocs/compta/resultat/index.php
+++ b/htdocs/compta/resultat/index.php
@@ -749,17 +749,17 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco
$sql.= " AND fk_statut in (1,2)";
if (! empty($date_start) && ! empty($date_end))
$sql.= " AND p.datedon >= '".$db->idate($date_start)."' AND p.datedon <= '".$db->idate($date_end)."'";
- }
- elseif ($modecompta == 'RECETTES-DEPENSES') {
+ } elseif ($modecompta == 'RECETTES-DEPENSES') {
$sql = "SELECT p.societe as nom, p.firstname, p.lastname, date_format(pe.datep,'%Y-%m') as dm, sum(p.amount) as amount";
$sql.= " FROM ".MAIN_DB_PREFIX."don as p";
$sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id";
$sql.= " WHERE p.entity IN (".getEntity('donation').")";
$sql.= " AND fk_statut >= 2";
- if (! empty($date_start) && ! empty($date_end))
- $sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
- }
+ if (! empty($date_start) && ! empty($date_end)) {
+ $sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'";
+ }
+ }
$sql.= " GROUP BY p.societe, p.firstname, p.lastname, dm";
diff --git a/htdocs/compta/sociales/card.php b/htdocs/compta/sociales/card.php
index cc6280070a0..7399a7098c6 100644
--- a/htdocs/compta/sociales/card.php
+++ b/htdocs/compta/sociales/card.php
@@ -454,19 +454,20 @@ if ($id > 0)
$morehtmlref.=' '.$langs->trans('Project') . ' ';
if ($user->rights->tax->charges->creer)
{
- if ($action != 'classify')
+ if ($action != 'classify') {
$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : ';
- if ($action == 'classify') {
- //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
- $morehtmlref.='';
- } else {
- $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
- }
+ }
+ if ($action == 'classify') {
+ //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+ $morehtmlref.='';
+ } else {
+ $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+ }
} else {
if (! empty($object->fk_project)) {
$proj = new Project($db);
diff --git a/htdocs/compta/stats/byratecountry.php b/htdocs/compta/stats/byratecountry.php
index 0cd02bc04bd..590269b332c 100644
--- a/htdocs/compta/stats/byratecountry.php
+++ b/htdocs/compta/stats/byratecountry.php
@@ -241,165 +241,163 @@ if (! empty($conf->accounting->enabled) && $modecompta != 'BOOKKEEPING')
}
-if ($modecompta == 'CREANCES-DETTES')
-{
-print '';
-print '' . $langs->trans("TurnoverbyVatrate") . ' ';
-print '' . $langs->trans("ProductOrService") . ' ';
-print '' . $langs->trans("Country") . ' ';
-$i=0;
-while($i < 12)
-{
- $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
- if ($j > 12) $j -= 12;
- print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' ';
- $i++;
-}
-print '' . $langs->trans("TotalHT") . ' ';
+if ($modecompta == 'CREANCES-DETTES') {
+ print '';
+ print '' . $langs->trans("TurnoverbyVatrate") . ' ';
+ print '' . $langs->trans("ProductOrService") . ' ';
+ print '' . $langs->trans("Country") . ' ';
+ $i=0;
+ while($i < 12) {
+ $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
+ if ($j > 12) $j -= 12;
+ print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' ';
+ $i++;
+ }
+ print '' . $langs->trans("TotalHT") . ' ';
-$sql = "SELECT fd.tva_tx AS vatrate,";
-$sql .= " fd.product_type AS product_type,";
-$sql .= " cc.label AS country,";
-for ($i = 1; $i <= 12; $i ++) {
- $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
-}
-$sql .= " SUM(fd.total_ht) as total";
-$sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
-$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
-$sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
-$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
-$sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
-$sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
-$sql.= " AND f.fk_statut in (1,2)";
-if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql.= " AND f.type IN (0,1,2,5)";
-} else {
- $sql.= " AND f.type IN (0,1,2,3,5)";
-}
-$sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")";
-$sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
+ $sql = "SELECT fd.tva_tx AS vatrate,";
+ $sql .= " fd.product_type AS product_type,";
+ $sql .= " cc.label AS country,";
+ for ($i = 1; $i <= 12; $i ++) {
+ $sql .= " SUM(" . $db->ifsql('MONTH(f.datef)=' . $i, 'fd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
+ }
+ $sql .= " SUM(fd.total_ht) as total";
+ $sql .= " FROM " . MAIN_DB_PREFIX . "facturedet as fd";
+ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "facture as f ON f.rowid = fd.fk_facture";
+ $sql .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = f.fk_soc";
+ $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
+ $sql .= " WHERE f.datef >= '" . $db->idate($date_start) . "'";
+ $sql .= " AND f.datef <= '" . $db->idate($date_end) . "'";
+ $sql.= " AND f.fk_statut in (1,2)";
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $sql.= " AND f.type IN (0,1,2,5)";
+ } else {
+ $sql.= " AND f.type IN (0,1,2,3,5)";
+ }
+ $sql .= " AND f.entity IN (" . getEntity('invoice', 0) . ")";
+ $sql .= " GROUP BY fd.tva_tx,fd.product_type, cc.label ";
-dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
-$resql = $db->query($sql);
-if ($resql) {
- $num = $db->num_rows($resql);
- $totalpermonth = array();
- while ( $obj = $db->fetch_object($resql)) {
- print '' . vatrate($obj->vatrate) . ' ';
- if ($obj->product_type == 0) {
- print ''. $langs->trans("Product") . ' ';
- } else {
- print ''. $langs->trans("Service") . ' ';
+ dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
+ $resql = $db->query($sql);
+ if ($resql) {
+ $num = $db->num_rows($resql);
+ $totalpermonth = array();
+ while ( $obj = $db->fetch_object($resql)) {
+ print '' . vatrate($obj->vatrate) . ' ';
+ if ($obj->product_type == 0) {
+ print ''. $langs->trans("Product") . ' ';
+ } else {
+ print ''. $langs->trans("Service") . ' ';
+ }
+ print '' .$obj->country . ' ';
+ for($i = 0; $i < 12; $i++) {
+ $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
+ if ($j > 12) $j -= 12;
+ $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
+ print '' . price($obj->$monthj) . ' ';
+ $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
+ }
+ print '' . price($obj->total) . ' ';
+ $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
+ print ' ';
}
- print '' .$obj->country . ' ';
+ $db->free($resql);
+
+ // Total
+ print ' ';
+ print ' ';
+ print ' ';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
- print '' . price($obj->$monthj) . ' ';
- $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
+ print '' . price($totalpermonth[$j]) . ' ';
}
- print '' . price($obj->total) . ' ';
- $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
+ print '' . price($totalpermonth['total']) . ' ';
print ' ';
+ } else {
+ print $db->lasterror(); // Show last sql error
}
- $db->free($resql);
- // Total
- print ' ';
- print ' ';
- print ' ';
- for($i = 0; $i < 12; $i++) {
+
+ print '' . $langs->trans("PurchasebyVatrate") . ' ';
+ print '' . $langs->trans("ProductOrService") . ' ';
+ print '' . $langs->trans("Country") . ' ';
+ $i=0;
+ while($i < 12)
+ {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
- $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
- print '' . price($totalpermonth[$j]) . ' ';
+ print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' ';
+ $i++;
}
- print '' . price($totalpermonth['total']) . ' ';
- print ' ';
-} else {
- print $db->lasterror(); // Show last sql error
-}
+ print '' . $langs->trans("TotalHT") . ' ';
+ $sql2 = "SELECT ffd.tva_tx AS vatrate,";
+ $sql2 .= " ffd.product_type AS product_type,";
+ $sql2 .= " cc.label AS country,";
+ for($i = 1; $i <= 12; $i ++) {
+ $sql2 .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
+ }
+ $sql2 .= " SUM(ffd.total_ht) as total";
+ $sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
+ $sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
+ $sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
+ $sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
+ $sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
+ $sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
+ $sql.= " AND ff.fk_statut in (1,2)";
+ if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
+ $sql.= " AND ff.type IN (0,1,2,5)";
+ } else {
+ $sql.= " AND ff.type IN (0,1,2,3,5)";
+ }
+ $sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
+ $sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
-print '' . $langs->trans("PurchasebyVatrate") . ' ';
-print '' . $langs->trans("ProductOrService") . ' ';
-print '' . $langs->trans("Country") . ' ';
-$i=0;
-while($i < 12)
-{
- $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
- if ($j > 12) $j -= 12;
- print '' . $langs->trans('MonthShort' . str_pad($j, 2, '0', STR_PAD_LEFT)) . ' ';
- $i++;
-}
-print '' . $langs->trans("TotalHT") . ' ';
-
-$sql2 = "SELECT ffd.tva_tx AS vatrate,";
-$sql2 .= " ffd.product_type AS product_type,";
-$sql2 .= " cc.label AS country,";
-for($i = 1; $i <= 12; $i ++) {
- $sql2 .= " SUM(" . $db->ifsql('MONTH(ff.datef)=' . $i, 'ffd.total_ht', '0') . ") AS month" . str_pad($i, 2, '0', STR_PAD_LEFT) . ",";
-}
-$sql2 .= " SUM(ffd.total_ht) as total";
-$sql2 .= " FROM " . MAIN_DB_PREFIX . "facture_fourn_det as ffd";
-$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "facture_fourn as ff ON ff.rowid = ffd.fk_facture_fourn";
-$sql2 .= " INNER JOIN " . MAIN_DB_PREFIX . "societe as soc ON soc.rowid = ff.fk_soc";
-$sql2 .= " LEFT JOIN " . MAIN_DB_PREFIX . "c_country as cc ON cc.rowid = soc.fk_pays";
-$sql2 .= " WHERE ff.datef >= '" . $db->idate($date_start) . "'";
-$sql2 .= " AND ff.datef <= '" . $db->idate($date_end) . "'";
-$sql.= " AND ff.fk_statut in (1,2)";
-if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
- $sql.= " AND ff.type IN (0,1,2,5)";
-} else {
- $sql.= " AND ff.type IN (0,1,2,3,5)";
-}
-$sql2 .= " AND ff.entity IN (" . getEntity("facture_fourn", 0) . ")";
-$sql2 .= " GROUP BY ffd.tva_tx, ffd.product_type, cc.label";
-
-//print $sql2;
-dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
-$resql2 = $db->query($sql2);
-if ($resql2) {
- $num = $db->num_rows($resql2);
- $totalpermonth = array();
- while ( $obj = $db->fetch_object($resql2)) {
- print '' . vatrate($obj->vatrate) . ' ';
- if ($obj->product_type == 0) {
- print ''. $langs->trans("Product") . ' ';
- } else {
- print ''. $langs->trans("Service") . ' ';
+ //print $sql2;
+ dol_syslog("htdocs/compta/tva/index.php sql=" . $sql, LOG_DEBUG);
+ $resql2 = $db->query($sql2);
+ if ($resql2) {
+ $num = $db->num_rows($resql2);
+ $totalpermonth = array();
+ while ( $obj = $db->fetch_object($resql2)) {
+ print '' . vatrate($obj->vatrate) . ' ';
+ if ($obj->product_type == 0) {
+ print ''. $langs->trans("Product") . ' ';
+ } else {
+ print ''. $langs->trans("Service") . ' ';
+ }
+ print '' . $obj->country . ' ';
+ for($i = 0; $i < 12; $i++) {
+ $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
+ if ($j > 12) $j -= 12;
+ $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
+ print '' . price($obj->$monthj) . ' ';
+ $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
+ }
+ print '' . price($obj->total) . ' ';
+ $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
+ print ' ';
}
- print '' . $obj->country . ' ';
+ $db->free($resql2);
+
+ // Total
+ print ' ';
+ print ' ';
+ print ' ';
for($i = 0; $i < 12; $i++) {
$j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
if ($j > 12) $j -= 12;
$monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
- print '' . price($obj->$monthj) . ' ';
- $totalpermonth[$j]=(empty($totalpermonth[$j])?0:$totalpermonth[$j])+$obj->$monthj;
+ print '' . price($totalpermonth[$j]) . ' ';
}
- print '' . price($obj->total) . ' ';
- $totalpermonth['total']=(empty($totalpermonth['total'])?0:$totalpermonth['total'])+$obj->total;
+ print '' . price($totalpermonth['total']) . ' ';
print ' ';
+ } else {
+ print $db->lasterror(); // Show last sql error
}
- $db->free($resql2);
-
- // Total
- print ' ';
- print ' ';
- print ' ';
- for($i = 0; $i < 12; $i++) {
- $j = $i + (empty($conf->global->SOCIETE_FISCAL_MONTH_START)?1:$conf->global->SOCIETE_FISCAL_MONTH_START);
- if ($j > 12) $j -= 12;
- $monthj = 'month'.str_pad($j, 2, '0', STR_PAD_LEFT);
- print '' . price($totalpermonth[$j]) . ' ';
- }
- print '' . price($totalpermonth['total']) . ' ';
- print ' ';
-} else {
- print $db->lasterror(); // Show last sql error
-}
-print "
\n";
+ print "
\n";
} else {
// $modecompta != 'CREANCES-DETTES'
// "Calculation of part of each product for accountancy in this mode is not possible. When a partial payment (for example 5 euros) is done on an
diff --git a/htdocs/compta/stats/cabyprodserv.php b/htdocs/compta/stats/cabyprodserv.php
index 8a97be4d252..5570b08435b 100644
--- a/htdocs/compta/stats/cabyprodserv.php
+++ b/htdocs/compta/stats/cabyprodserv.php
@@ -240,7 +240,7 @@ if ($modecompta == 'CREANCES-DETTES')
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) {
$sql.= " AND f.type IN (0,1,2,5)";
} else {
- $sql.= " AND f.type IN (0,1,2,3,5)";
+ $sql.= " AND f.type IN (0,1,2,3,5)";
}
if ($date_start && $date_end) {
$sql.= " AND f.datef >= '".$db->idate($date_start)."' AND f.datef <= '".$db->idate($date_end)."'";
@@ -326,7 +326,7 @@ if ($modecompta == 'CREANCES-DETTES')
// Array header
print "";
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("Product"),
$_SERVER["PHP_SELF"],
"ref",
@@ -336,7 +336,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans('Quantity'),
$_SERVER["PHP_SELF"],
"qty",
@@ -346,7 +346,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"],
"qty",
@@ -356,7 +356,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans('AmountHT'),
$_SERVER["PHP_SELF"],
"amount",
@@ -366,7 +366,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("AmountTTC"),
$_SERVER["PHP_SELF"],
"amount_ttc",
@@ -376,7 +376,7 @@ print_liste_field_titre(
$sortfield,
$sortorder
);
-print_liste_field_titre(
+ print_liste_field_titre(
$langs->trans("Percentage"),
$_SERVER["PHP_SELF"],
"amount_ttc",
diff --git a/htdocs/compta/stats/index.php b/htdocs/compta/stats/index.php
index cf1f49ae1a8..cf28a4cd5d6 100644
--- a/htdocs/compta/stats/index.php
+++ b/htdocs/compta/stats/index.php
@@ -172,7 +172,7 @@ if ($modecompta == 'CREANCES-DETTES')
if (! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS)) $sql.= " AND f.type IN (0,1,2,5)";
else $sql.= " AND f.type IN (0,1,2,3,5)";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
-if ($socid) $sql.= " AND f.fk_soc = ".$socid;
+ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
}
elseif ($modecompta=="RECETTES-DEPENSES")
{
@@ -187,7 +187,7 @@ elseif ($modecompta=="RECETTES-DEPENSES")
$sql.= " WHERE p.rowid = pf.fk_paiement";
$sql.= " AND pf.fk_facture = f.rowid";
$sql.= " AND f.entity IN (".getEntity('invoice').")";
-if ($socid) $sql.= " AND f.fk_soc = ".$socid;
+ if ($socid) $sql.= " AND f.fk_soc = ".$socid;
}
elseif ($modecompta=="BOOKKEEPING")
{
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
index 921535bf20f..35772ee6f34 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_edit.tpl.php
@@ -135,13 +135,15 @@ echo $this->control->tpl['ajax_selectcountry'];
-control->tpl['contact_element'])) { ?>
-control->tpl['contact_element'] as $element) { ?>
-
-
-
-
-
+control->tpl['contact_element'])) {
+ foreach ($this->control->tpl['contact_element'] as $element) {
+ print '';
+ print ''.$element['linked_element_label'].' ';
+ print ''.$element['linked_element_value'].' ';
+ print ' ';
+ }
+} ?>
trans("DolibarrLogin"); ?>
diff --git a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
index a9ccf9bff3d..d7cfe53b0bc 100644
--- a/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
+++ b/htdocs/contact/canvas/default/tpl/contactcard_view.tpl.php
@@ -24,17 +24,14 @@ if (empty($conf) || ! is_object($conf))
$contact = $GLOBALS['objcanvas']->control->object;
-?>
-
-control->tpl['showhead']; ?>
+print "\n";
+echo $this->control->tpl['showhead'];
-control->tpl['error'], $this->control->tpl['errors']);
-?>
-control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user']; ?>
-control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
+if (! empty($this->control->tpl['action_create_user'])) echo $this->control->tpl['action_create_user'];
+if (! empty($this->control->tpl['action_delete'])) echo $this->control->tpl['action_delete']; ?>
@@ -134,29 +131,27 @@ dol_htmloutput_errors($this->control->tpl['error'], $this->control->tpl['errors'
-control->tpl['showend']; ?>
+control->tpl['showend'];
-societe_id)) { ?>
-
+if (empty($user->societe_id)) {
+ print '
-
';
+}
echo $this->control->tpl['actionstodo'];
echo $this->control->tpl['actionsdone'];
-?>
-
+print "\n";
diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php
index f0f18ffc672..b68a0f9b124 100644
--- a/htdocs/contact/card.php
+++ b/htdocs/contact/card.php
@@ -678,7 +678,7 @@ else
print $formcompany->select_state(GETPOST("state_id", 'alpha')?GETPOST("state_id", 'alpha'):$object->state_id, $object->country_code, 'state_id');
}
else
- {
+ {
print $countrynotdefined;
}
print '
';
diff --git a/htdocs/contact/consumption.php b/htdocs/contact/consumption.php
index c82795b9449..00817ee5799 100644
--- a/htdocs/contact/consumption.php
+++ b/htdocs/contact/consumption.php
@@ -151,7 +151,7 @@ if ($object->thirdparty->fournisseur)
if ($conf->fournisseur->enabled && $user->rights->fournisseur->commande->lire) $elementTypeArray['supplier_order']=$langs->transnoentitiesnoconv('SuppliersOrders');
// There no contact type for supplier proposals
-// if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
+ // if ($conf->fournisseur->enabled && $user->rights->supplier_proposal->lire) $elementTypeArray['supplier_proposal']=$langs->transnoentitiesnoconv('SupplierProposals');
}
print '
';
@@ -298,7 +298,7 @@ if (!empty($sql_select))
$sql.= " ";
if ($type_element != 'fichinter') $sql.= ", p.ref as prod_ref, p.label as product_label";
$sql.= " FROM "/*.MAIN_DB_PREFIX."societe as s, "*/.$tables_from;
-// if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
+ // if ($type_element != 'fichinter') $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON d.fk_product = p.rowid ';
$sql.= $where;
$sql.= dolSqlDateFilter($dateprint, 0, $month, $year);
if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$db->escape($sref)."%'";
diff --git a/htdocs/contact/document.php b/htdocs/contact/document.php
index ad8bbb68e5f..1dbc22d1a51 100644
--- a/htdocs/contact/document.php
+++ b/htdocs/contact/document.php
@@ -63,8 +63,8 @@ $offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
- if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; }
- if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; }
+if (! empty($conf->global->MAIN_DOC_SORT_FIELD)) { $sortfield=$conf->global->MAIN_DOC_SORT_FIELD; }
+if (! empty($conf->global->MAIN_DOC_SORT_ORDER)) { $sortorder=$conf->global->MAIN_DOC_SORT_ORDER; }
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name";
diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php
index d31766578b2..653ab5d1c58 100644
--- a/htdocs/contact/list.php
+++ b/htdocs/contact/list.php
@@ -680,9 +680,9 @@ if (! empty($arrayfields['p.thirdparty']['checked']))
if (! empty($arrayfields['p.priv']['checked']))
{
print '
';
- $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
- print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
- print ' ';
+ $selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
+ print $form->selectarray('search_priv', $selectarray, $search_priv, 1);
+ print '';
}
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
@@ -930,9 +930,9 @@ while ($i < min($num, $limit))
print '
';
if ($obj->socid)
{
- $objsoc = new Societe($db);
- $objsoc->fetch($obj->socid);
- print $objsoc->getNomUrl(1);
+ $objsoc = new Societe($db);
+ $objsoc->fetch($obj->socid);
+ print $objsoc->getNomUrl(1);
}
else
print ' ';