Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
981a6bc6e7
@ -7,6 +7,7 @@
|
|||||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||||
|
* Copyright (C) 2016 Meziane Sof <virtualsof@yahoo.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -242,9 +243,9 @@ if ($action == 'add')
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete
|
// Delete
|
||||||
if ($action == 'delete' && $user->rights->facture->supprimer)
|
if ($action == 'confirm_deleteinvoice' && $confirm == 'yes' && $user->rights->facture->supprimer)
|
||||||
{
|
{
|
||||||
$object->delete($user);
|
$object->delete();
|
||||||
header("Location: " . $_SERVER['PHP_SELF'] );
|
header("Location: " . $_SERVER['PHP_SELF'] );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -368,7 +369,8 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline, $predef);
|
||||||
// Unset extrafield
|
// Unset extrafield
|
||||||
if (is_array($extralabelsline)) {
|
if (is_array($extralabelsline))
|
||||||
|
{
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach ($extralabelsline as $key => $value) {
|
foreach ($extralabelsline as $key => $value) {
|
||||||
unset($_POST["options_" . $key . $predef]);
|
unset($_POST["options_" . $key . $predef]);
|
||||||
@ -402,7 +404,8 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$error ++;
|
$error ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
|
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod)))
|
||||||
|
{
|
||||||
$ret = $object->fetch($id);
|
$ret = $object->fetch($id);
|
||||||
if ($ret < 0) {
|
if ($ret < 0) {
|
||||||
dol_print_error($db, $object->error);
|
dol_print_error($db, $object->error);
|
||||||
@ -464,8 +467,10 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
|
$filter = array('t.fk_product' => $prod->id,'t.fk_soc' => $object->thirdparty->id);
|
||||||
|
|
||||||
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
$result = $prodcustprice->fetch_all('', '', 0, 0, $filter);
|
||||||
if ($result) {
|
if ($result)
|
||||||
if (count($prodcustprice->lines) > 0) {
|
{
|
||||||
|
if (count($prodcustprice->lines) > 0)
|
||||||
|
{
|
||||||
$pu_ht = price($prodcustprice->lines[0]->price);
|
$pu_ht = price($prodcustprice->lines[0]->price);
|
||||||
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
$pu_ttc = price($prodcustprice->lines[0]->price_ttc);
|
||||||
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
$price_base_type = $prodcustprice->lines[0]->price_base_type;
|
||||||
@ -497,27 +502,32 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$desc = '';
|
$desc = '';
|
||||||
|
|
||||||
// Define output language
|
// Define output language
|
||||||
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) {
|
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
|
||||||
|
{
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
$newlang = '';
|
$newlang = '';
|
||||||
if (empty($newlang) && GETPOST('lang_id'))
|
if (empty($newlang) && GETPOST('lang_id'))
|
||||||
$newlang = GETPOST('lang_id');
|
$newlang = GETPOST('lang_id');
|
||||||
if (empty($newlang))
|
if (empty($newlang))
|
||||||
$newlang = $object->thirdparty->default_lang;
|
$newlang = $object->thirdparty->default_lang;
|
||||||
if (! empty($newlang)) {
|
if (! empty($newlang))
|
||||||
|
{
|
||||||
$outputlangs = new Translate("", $conf);
|
$outputlangs = new Translate("", $conf);
|
||||||
$outputlangs->setDefaultLang($newlang);
|
$outputlangs->setDefaultLang($newlang);
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
|
$desc = (! empty($prod->multilangs [$outputlangs->defaultlang] ["description"])) ? $prod->multilangs [$outputlangs->defaultlang] ["description"] : $prod->description;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$desc = $prod->description;
|
$desc = $prod->description;
|
||||||
}
|
}
|
||||||
|
|
||||||
$desc = dol_concatdesc($desc, $product_desc);
|
$desc = dol_concatdesc($desc, $product_desc);
|
||||||
|
|
||||||
// Add custom code and origin country into description
|
// Add custom code and origin country into description
|
||||||
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code))) {
|
if (empty($conf->global->MAIN_PRODUCT_DISABLE_CUSTOMCOUNTRYCODE) && (! empty($prod->customcode) || ! empty($prod->country_code)))
|
||||||
|
{
|
||||||
$tmptxt = '(';
|
$tmptxt = '(';
|
||||||
if (! empty($prod->customcode))
|
if (! empty($prod->customcode))
|
||||||
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
$tmptxt .= $langs->transnoentitiesnoconv("CustomCode") . ': ' . $prod->customcode;
|
||||||
@ -527,11 +537,15 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
$tmptxt .= $langs->transnoentitiesnoconv("CountryOrigin") . ': ' . getCountry($prod->country_code, 0, $db, $langs, 0);
|
||||||
$tmptxt .= ')';
|
$tmptxt .= ')';
|
||||||
$desc = dol_concatdesc($desc, $tmptxt);
|
$desc = dol_concatdesc($desc, $tmptxt);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$type = $prod->type;
|
$type = $prod->type;
|
||||||
$fk_unit = $prod->fk_unit;
|
$fk_unit = $prod->fk_unit;
|
||||||
} else {
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$pu_ht = price2num($price_ht, 'MU');
|
$pu_ht = price2num($price_ht, 'MU');
|
||||||
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
$pu_ttc = price2num(GETPOST('price_ttc'), 'MU');
|
||||||
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
$tva_npr = (preg_match('/\*/', $tva_tx) ? 1 : 0);
|
||||||
@ -555,10 +569,13 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
if ($tva_npr)
|
if ($tva_npr)
|
||||||
$info_bits |= 0x01;
|
$info_bits |= 0x01;
|
||||||
|
|
||||||
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) {
|
if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))
|
||||||
|
{
|
||||||
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
$mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency));
|
||||||
setEventMessages($mesg, null, 'errors');
|
setEventMessages($mesg, null, 'errors');
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Insert line
|
// Insert line
|
||||||
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit);
|
$result = $object->addline($desc, $pu_ht, $qty, $tva_tx, $idprod, $remise_percent, $price_base_type, $info_bits, '', $pu_ttc, $type, - 1, $special_code, $label, $fk_unit);
|
||||||
|
|
||||||
@ -618,7 +635,9 @@ if ($action == 'addline' && $user->rights->facture->creer)
|
|||||||
|
|
||||||
unset($_POST['situations']);
|
unset($_POST['situations']);
|
||||||
unset($_POST['progress']);
|
unset($_POST['progress']);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -661,9 +680,11 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
$extralabelsline = $extrafieldsline->fetch_name_optionals_label($object->table_element_line);
|
||||||
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
$array_options = $extrafieldsline->getOptionalsFromPost($extralabelsline);
|
||||||
// Unset extrafield
|
// Unset extrafield
|
||||||
if (is_array($extralabelsline)) {
|
if (is_array($extralabelsline))
|
||||||
|
{
|
||||||
// Get extra fields
|
// Get extra fields
|
||||||
foreach ($extralabelsline as $key => $value) {
|
foreach ($extralabelsline as $key => $value)
|
||||||
|
{
|
||||||
unset($_POST["options_" . $key]);
|
unset($_POST["options_" . $key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,12 +742,29 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update line
|
// Update line
|
||||||
if (! $error) {
|
if (! $error)
|
||||||
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty,
|
{
|
||||||
$vat_rate, GETPOST('productid'), GETPOST('remise_percent'), 'HT', $info_bits, 0, 0, $type,
|
$result = $object->updateline(
|
||||||
0, $special_code, $label, GETPOST('units'));
|
GETPOST('lineid'),
|
||||||
|
$description,
|
||||||
|
$pu_ht,
|
||||||
|
$qty,
|
||||||
|
$vat_rate,
|
||||||
|
GETPOST('productid'),
|
||||||
|
GETPOST('remise_percent'),
|
||||||
|
'HT',
|
||||||
|
$info_bits,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
$type,
|
||||||
|
0,
|
||||||
|
$special_code,
|
||||||
|
$label,
|
||||||
|
GETPOST('units')
|
||||||
|
);
|
||||||
|
|
||||||
if ($result >= 0) {
|
if ($result >= 0)
|
||||||
|
{
|
||||||
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
/*if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) {
|
||||||
// Define output language
|
// Define output language
|
||||||
$outputlangs = $langs;
|
$outputlangs = $langs;
|
||||||
@ -781,7 +819,9 @@ elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('
|
|||||||
|
|
||||||
unset($_POST['situations']);
|
unset($_POST['situations']);
|
||||||
unset($_POST['progress']);
|
unset($_POST['progress']);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
setEventMessages($object->error, $object->errors, 'errors');
|
setEventMessages($object->error, $object->errors, 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1003,6 +1043,11 @@ else
|
|||||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id . '&lineid=' . $lineid, $langs->trans('DeleteProductLine'), $langs->trans('ConfirmDeleteProductLine'), 'confirm_deleteline', '', 'no', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Confirm delete of repeatable invoice
|
||||||
|
if ($action == 'ask_deleteinvoice') {
|
||||||
|
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('DeleteRepeatableInvoice'), $langs->trans('ConfirmDeleteRepeatableInvoice'), 'confirm_deleteinvoice', '', 'no', 1);
|
||||||
|
}
|
||||||
|
|
||||||
print $formconfirm;
|
print $formconfirm;
|
||||||
|
|
||||||
$author = new User($db);
|
$author = new User($db);
|
||||||
@ -1056,9 +1101,12 @@ else
|
|||||||
print '</td><td colspan="3">';
|
print '</td><td colspan="3">';
|
||||||
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
if ($object->type != Facture::TYPE_CREDIT_NOTE)
|
||||||
{
|
{
|
||||||
if ($action == 'editconditions') {
|
if ($action == 'editconditions')
|
||||||
|
{
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
|
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $object->cond_reglement_id, 'none');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1102,7 +1150,8 @@ else
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
// Project
|
// Project
|
||||||
if (! empty($conf->projet->enabled)) {
|
if (! empty($conf->projet->enabled))
|
||||||
|
{
|
||||||
$langs->load('projects');
|
$langs->load('projects');
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
@ -1359,7 +1408,7 @@ else
|
|||||||
//if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer)
|
//if ($object->statut == Facture::STATUS_DRAFT && $user->rights->facture->supprimer)
|
||||||
if ($user->rights->facture->supprimer)
|
if ($user->rights->facture->supprimer)
|
||||||
{
|
{
|
||||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
print '<div class="inline-block divButAction"><a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=ask_deleteinvoice&id='.$object->id.'">'.$langs->trans('Delete').'</a></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|||||||
@ -27,8 +27,10 @@
|
|||||||
|
|
||||||
require '../../main.inc.php';
|
require '../../main.inc.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/report.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/tax.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||||
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php';
|
||||||
|
|
||||||
@ -63,6 +65,10 @@ if (! empty($conf->accounting->enabled)) $result=restrictedArea($user,'accountin
|
|||||||
// Date range
|
// Date range
|
||||||
$year=GETPOST("year");
|
$year=GETPOST("year");
|
||||||
$month=GETPOST("month");
|
$month=GETPOST("month");
|
||||||
|
$search_societe = GETPOST("search_societe");
|
||||||
|
$search_zip = GETPOST("search_zip");
|
||||||
|
$search_town = GETPOST("search_town");
|
||||||
|
$search_country = GETPOST("search_country");
|
||||||
$date_startyear = GETPOST("date_startyear");
|
$date_startyear = GETPOST("date_startyear");
|
||||||
$date_startmonth = GETPOST("date_startmonth");
|
$date_startmonth = GETPOST("date_startmonth");
|
||||||
$date_startday = GETPOST("date_startday");
|
$date_startday = GETPOST("date_startday");
|
||||||
@ -130,6 +136,10 @@ $headerparams['q'] = $q;
|
|||||||
|
|
||||||
$tableparams = array();
|
$tableparams = array();
|
||||||
$tableparams['search_categ'] = $selected_cat;
|
$tableparams['search_categ'] = $selected_cat;
|
||||||
|
$tableparams['search_societe'] = $search_societe;
|
||||||
|
$tableparams['search_zip'] = $search_zip;
|
||||||
|
$tableparams['search_town'] = $search_town;
|
||||||
|
$tableparams['search_country'] = $search_country;
|
||||||
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
$tableparams['subcat'] = ($subcat === true)?'yes':'';
|
||||||
|
|
||||||
// Adding common parameters
|
// Adding common parameters
|
||||||
@ -182,7 +192,7 @@ report_header($nom,$nomlink,$period,$periodlink,$description,$builddate,$exportl
|
|||||||
// Show Array
|
// Show Array
|
||||||
$catotal=0;
|
$catotal=0;
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name,";
|
$sql = "SELECT DISTINCT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays,";
|
||||||
$sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
$sql.= " sum(f.total) as amount, sum(f.total_ttc) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f, ".MAIN_DB_PREFIX."societe as s";
|
||||||
if ($selected_cat === -2) // Without any category
|
if ($selected_cat === -2) // Without any category
|
||||||
@ -218,7 +228,7 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
* Liste des paiements (les anciens paiements ne sont pas vus par cette requete car, sur les
|
||||||
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
* vieilles versions, ils n'etaient pas lies via paiement_facture. On les ajoute plus loin)
|
||||||
*/
|
*/
|
||||||
$sql = "SELECT s.rowid as socid, s.nom as name, sum(pf.amount) as amount_ttc";
|
$sql = "SELECT s.rowid as socid, s.nom as name, s.zip, s.town, s.fk_pays, sum(pf.amount) as amount_ttc";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
|
$sql.= ", ".MAIN_DB_PREFIX."paiement_facture as pf";
|
||||||
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
$sql.= ", ".MAIN_DB_PREFIX."paiement as p";
|
||||||
@ -248,6 +258,10 @@ if ($modecompta == 'CREANCES-DETTES') {
|
|||||||
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
$sql.= " AND cs.fk_categorie = c.rowid AND cs.fk_soc = s.rowid";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(!empty($search_societe)) $sql.= ' AND s.nom LIKE "%'.$search_societe.'%"';
|
||||||
|
if(!empty($search_zip)) $sql.= ' AND s.zip LIKE "%'.$search_zip.'%"';
|
||||||
|
if(!empty($search_town)) $sql.= ' AND s.town LIKE "%'.$search_town.'%"';
|
||||||
|
if($search_country > 0) $sql.= ' AND s.fk_pays = '.$search_country.'';
|
||||||
$sql.= " AND f.entity = ".$conf->entity;
|
$sql.= " AND f.entity = ".$conf->entity;
|
||||||
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
if ($socid) $sql.= " AND f.fk_soc = ".$socid;
|
||||||
$sql.= " GROUP BY s.rowid, s.nom";
|
$sql.= " GROUP BY s.rowid, s.nom";
|
||||||
@ -264,6 +278,9 @@ if ($result) {
|
|||||||
$amount_ht[$obj->socid] = $obj->amount;
|
$amount_ht[$obj->socid] = $obj->amount;
|
||||||
$amount[$obj->socid] = $obj->amount_ttc;
|
$amount[$obj->socid] = $obj->amount_ttc;
|
||||||
$name[$obj->socid] = $obj->name.' '.$obj->firstname;
|
$name[$obj->socid] = $obj->name.' '.$obj->firstname;
|
||||||
|
$address_zip[$obj->socid] = $obj->zip;
|
||||||
|
$address_town[$obj->socid] = $obj->town;
|
||||||
|
$address_pays[$obj->socid] = getCountry($obj->fk_pays);
|
||||||
$catotal_ht+=$obj->amount;
|
$catotal_ht+=$obj->amount;
|
||||||
$catotal+=$obj->amount_ttc;
|
$catotal+=$obj->amount_ttc;
|
||||||
$i++;
|
$i++;
|
||||||
@ -296,6 +313,9 @@ if ($modecompta != 'CREANCES-DETTES') {
|
|||||||
$obj = $db->fetch_object($result);
|
$obj = $db->fetch_object($result);
|
||||||
$amount[$obj->rowid] += $obj->amount_ttc;
|
$amount[$obj->rowid] += $obj->amount_ttc;
|
||||||
$name[$obj->rowid] = $obj->name;
|
$name[$obj->rowid] = $obj->name;
|
||||||
|
$address_zip[$obj->rowid] = $obj->zip;
|
||||||
|
$address_town[$obj->rowid] = $obj->town;
|
||||||
|
$address_pays[$obj->rowid] = getCountry($obj->fk_pays);
|
||||||
$catotal+=$obj->amount_ttc;
|
$catotal+=$obj->amount_ttc;
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
@ -325,7 +345,7 @@ if ($subcat) {
|
|||||||
print ' checked';
|
print ' checked';
|
||||||
}
|
}
|
||||||
print'></td>';
|
print'></td>';
|
||||||
print '<td colspan="4" align="right">';
|
print '<td colspan="7" align="right">';
|
||||||
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
print '<input type="image" class="liste_titre" name="button_search" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
@ -340,6 +360,33 @@ print_liste_field_titre(
|
|||||||
"",
|
"",
|
||||||
$sortfield,$sortorder
|
$sortfield,$sortorder
|
||||||
);
|
);
|
||||||
|
print_liste_field_titre(
|
||||||
|
$langs->trans("Zip"),
|
||||||
|
$_SERVER["PHP_SELF"],
|
||||||
|
"zip",
|
||||||
|
"",
|
||||||
|
$paramslink,
|
||||||
|
"",
|
||||||
|
$sortfield,$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre(
|
||||||
|
$langs->trans("Town"),
|
||||||
|
$_SERVER["PHP_SELF"],
|
||||||
|
"town",
|
||||||
|
"",
|
||||||
|
$paramslink,
|
||||||
|
"",
|
||||||
|
$sortfield,$sortorder
|
||||||
|
);
|
||||||
|
print_liste_field_titre(
|
||||||
|
$langs->trans("Country"),
|
||||||
|
$_SERVER["PHP_SELF"],
|
||||||
|
"country",
|
||||||
|
"",
|
||||||
|
$paramslink,
|
||||||
|
"",
|
||||||
|
$sortfield,$sortorder
|
||||||
|
);
|
||||||
if ($modecompta == 'CREANCES-DETTES') {
|
if ($modecompta == 'CREANCES-DETTES') {
|
||||||
print_liste_field_titre(
|
print_liste_field_titre(
|
||||||
$langs->trans('AmountHT'),
|
$langs->trans('AmountHT'),
|
||||||
@ -383,6 +430,27 @@ print_liste_field_titre(
|
|||||||
'align="center" width="20%"'
|
'align="center" width="20%"'
|
||||||
);
|
);
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" size="6" type="text" name="search_societe" value="'.$search_societe.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" size="6" type="text" name="search_zip" value="'.$search_zip.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" size="6" type="text" name="search_town" value="'.$search_town.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print $form->select_country($search_country, 'search_country');
|
||||||
|
//print '<input class="flat" size="6" type="text" name="search_country" value="'.$search_country.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
$var=true;
|
$var=true;
|
||||||
|
|
||||||
if (count($amount)) {
|
if (count($amount)) {
|
||||||
@ -412,6 +480,30 @@ if (count($amount)) {
|
|||||||
arsort($amount);
|
arsort($amount);
|
||||||
$arrayforsort=$amount;
|
$arrayforsort=$amount;
|
||||||
}
|
}
|
||||||
|
if ($sortfield == 'zip' && $sortorder == 'asc') {
|
||||||
|
asort($address_zip);
|
||||||
|
$arrayforsort=$address_zip;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'zip' && $sortorder == 'desc') {
|
||||||
|
arsort($address_zip);
|
||||||
|
$arrayforsort=$address_zip;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'town' && $sortorder == 'asc') {
|
||||||
|
asort($address_town);
|
||||||
|
$arrayforsort=$address_town;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'town' && $sortorder == 'desc') {
|
||||||
|
arsort($address_town);
|
||||||
|
$arrayforsort=$address_town;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'country' && $sortorder == 'asc') {
|
||||||
|
asort($address_pays);
|
||||||
|
$arrayforsort=$address_town;
|
||||||
|
}
|
||||||
|
if ($sortfield == 'country' && $sortorder == 'desc') {
|
||||||
|
arsort($address_pays);
|
||||||
|
$arrayforsort=$address_town;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($arrayforsort as $key=>$value) {
|
foreach($arrayforsort as $key=>$value) {
|
||||||
$var=!$var;
|
$var=!$var;
|
||||||
@ -429,6 +521,18 @@ if (count($amount)) {
|
|||||||
}
|
}
|
||||||
print "<td>".$linkname."</td>\n";
|
print "<td>".$linkname."</td>\n";
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $address_zip[$key];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $address_town[$key];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td>';
|
||||||
|
print $address_pays[$key];
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
// Amount w/o VAT
|
// Amount w/o VAT
|
||||||
print '<td align="right">';
|
print '<td align="right">';
|
||||||
if ($modecompta != 'CREANCES-DETTES') {
|
if ($modecompta != 'CREANCES-DETTES') {
|
||||||
@ -488,6 +592,9 @@ if (count($amount)) {
|
|||||||
// Total
|
// Total
|
||||||
print '<tr class="liste_total">';
|
print '<tr class="liste_total">';
|
||||||
print '<td>'.$langs->trans("Total").'</td>';
|
print '<td>'.$langs->trans("Total").'</td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
|
print '<td> </td>';
|
||||||
if ($modecompta != 'CREANCES-DETTES') {
|
if ($modecompta != 'CREANCES-DETTES') {
|
||||||
print '<td colspan="1"></td>';
|
print '<td colspan="1"></td>';
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user