Fix lettering function

This commit is contained in:
Alexandre SPANGARO 2018-10-16 22:27:34 +02:00
parent eb4ffcf1a7
commit a5ebcff2ee
7 changed files with 67 additions and 125 deletions

View File

@ -1,8 +1,8 @@
<?php
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2013-2016 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2016 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2016-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2018 Frédéric France <frederic.france@netlogic.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -79,6 +79,7 @@ $search_direction = GETPOST('search_direction', 'alpha');
$search_debit = GETPOST('search_debit', 'alpha');
$search_credit = GETPOST('search_credit', 'alpha');
$search_ledger_code = GETPOST('search_ledger_code', 'alpha');
$search_lettering_code = GETPOST('search_lettering_code', 'alpha');
// Load variable for pagination
$limit = GETPOST('limit','int')?GETPOST('limit', 'int'):(empty($conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION)?$conf->liste_limit:$conf->global->ACCOUNTING_LIMIT_LIST_VENTILATION);
@ -138,6 +139,7 @@ $arrayfields=array(
't.label_operation'=>array('label'=>$langs->trans("Label"), 'checked'=>1),
't.debit'=>array('label'=>$langs->trans("Debit"), 'checked'=>1),
't.credit'=>array('label'=>$langs->trans("Credit"), 'checked'=>1),
't.lettering_code'=>array('label'=>$langs->trans("LetteringCode"), 'checked'=>1),
't.code_journal'=>array('label'=>$langs->trans("Codejournal"), 'checked'=>1),
't.date_creation'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0),
't.tms'=>array('label'=>$langs->trans("DateModification"), 'checked'=>0),
@ -176,6 +178,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x',
$search_date_modification_end = '';
$search_debit = '';
$search_credit = '';
$search_lettering_code = '';
}
// Must be after the remove filter action, before the export.
@ -272,6 +275,10 @@ if (! empty($search_credit)) {
$filter['t.credit'] = $search_credit;
$param .= '&search_credit=' . urlencode($search_credit);
}
if (! empty($search_lettering_code)) {
$filter['t.lettering_code'] = $search_lettering_code;
$param .= '&search_lettering_code=' . urlencode($search_lettering_code);
}
if ($action == 'delbookkeeping') {
@ -546,6 +553,13 @@ if (! empty($arrayfields['t.credit']['checked']))
print '<input type="text" class="flat" name="search_credit" size="4" value="'.dol_escape_htmltag($search_credit).'">';
print '</td>';
}
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td class="liste_titre center">';
print '<input type="text" size="3" class="flat" name="search_lettering_code" value="' . $search_lettering_code . '"/>';
print '</td>';
}
// Code journal
if (! empty($arrayfields['t.code_journal']['checked']))
{
@ -595,6 +609,7 @@ if (! empty($arrayfields['t.subledger_account']['checked'])) print_liste_field_t
if (! empty($arrayfields['t.label_operation']['checked'])) print_liste_field_titre($arrayfields['t.label_operation']['label'], $_SERVER['PHP_SELF'], "t.label_operation", "", $param, "", $sortfield, $sortorder);
if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arrayfields['t.debit']['label'], $_SERVER['PHP_SELF'], "t.debit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, 'align="right"', $sortfield, $sortorder);
if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, 'align="center"', $sortfield, $sortorder);
if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, 'align="center"', $sortfield, $sortorder);
@ -680,6 +695,13 @@ if ($num > 0)
$totalarray['totalcredit'] += $line->credit;
}
// Lettering code
if (! empty($arrayfields['t.lettering_code']['checked']))
{
print '<td align="center">' . $line->lettering_code . '</td>';
if (! $i) $totalarray['nbfield']++;
}
// Journal code
if (! empty($arrayfields['t.code_journal']['checked']))
{

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
*
* 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
@ -21,9 +21,9 @@
*/
/**
* \file accountancy/bookkeeping/thirdparty_lettrage.php
* \ingroup Advanced accountancy
* \brief Onglet de gestion de parametrages des ventilations
* \file accountancy/bookkeeping/thirdparty_lettering_customer.php
* \ingroup Advanced accountancy
* \brief Onglet de gestion de parametrages des ventilations
*/
require '../../main.inc.php';
@ -107,7 +107,7 @@ if ($action == 'lettering') {
if ($action == 'autolettrage') {
$result = $BookKeeping->lettrageTiers($socid);
$result = $BookKeeping->lettering_thirdparty($socid);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
@ -124,55 +124,15 @@ $head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
dol_fiche_head($head, 'accounting', $langs->trans("ThirdParty"), 0, 'company');
dol_fiche_head($head, 'lettering_customer', $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%" class="border">';
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
$object->next_prev_filter = "te.fournisseur = 1";
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
print '</td></tr>';
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
}
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
print '<tr>';
print '<td class="nowrap">' . $langs->trans("CustomerCode") . '</td><td colspan="3">';
print $object->code_client;
if ($object->check_codeclient() != 0)
print ' <font class="error">(' . $langs->trans("WrongCustomerCode") . ')</font>';
print '</td>';
print '</tr>';
dol_fiche_end();
print '<tr>';
print '<td>';
print $form->editfieldkey("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
print '</td><td colspan="3">';
print $form->editfieldval("CustomerAccountancyCode", 'customeraccountancycode', $object->code_compta, $object, $user->rights->societe->creer);
print '</td>';
print '</tr>';
// Address
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
print '</tr>';
// Country
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
// $img=picto_from_langcode($object->country_code);
$img = '';
if ($object->isInEEC())
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
else
print ($img ? $img . ' ' : '') . $object->country;
print '</td></tr>';
print '</table>';
print '<br>';
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";
@ -209,7 +169,7 @@ while ( $obj = $db->fetch_object($resql) ) {
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
$resql = $db->query($sql);
if (! $resql) {
dol_print_error($db);
@ -218,7 +178,7 @@ if (! $resql) {
$num = $db->num_rows($resql);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettrage.php", LOG_DEBUG);
dol_syslog("/accountancy/bookkeeping/thirdparty_lettering_customer.php", LOG_DEBUG);
if ($resql) {
$i = 0;
@ -317,4 +277,3 @@ if ($resql) {
// End of page
llxFooter();
$db->close();

View File

@ -111,7 +111,7 @@ if ($action == 'lettering') {
if ($action == 'autolettrage') {
$result = $BookKeeping->lettrageTiers($socid);
$result = $BookKeeping->lettering_thirdparty($socid);
if ($result < 0) {
setEventMessages('', $BookKeeping->errors, 'errors');
@ -140,55 +140,13 @@ $head = societe_prepare_head($object);
dol_htmloutput_mesg(is_numeric($error) ? '' : $error, $errors, 'error');
dol_fiche_head($head, 'accounting_supplier', $langs->trans("ThirdParty"), 0, 'company');
dol_fiche_head($head, 'lettering_supplier', $langs->trans("ThirdParty"), 0, 'company');
print '<table width="100%" class="border">';
print '<tr><td width="30%">' . $langs->trans("ThirdPartyName") . '</td><td width="70%" colspan="3">';
$object->next_prev_filter = "te.fournisseur = 1";
print $form->showrefnav($object, 'socid', '', ($user->societe_id ? 0 : 1), 'rowid', 'nom', '', '');
print '</td></tr>';
$linkback = '<a href="'.DOL_URL_ROOT.'/societe/list.php?restore_lastsearch_values=1">'.$langs->trans("BackToList").'</a>';
if (! empty($conf->global->SOCIETE_USEPREFIX)) // Old not used prefix field
{
print '<tr><td>' . $langs->trans('Prefix') . '</td><td colspan="3">' . $object->prefix_comm . '</td></tr>';
}
dol_banner_tab($object, 'socid', $linkback, ($user->societe_id?0:1), 'rowid', 'nom', '', '', 0, '', '', 'arearefnobottom');
print '<tr>';
print '<td class="nowrap">' . $langs->trans("SupplierCode") . '</td><td colspan="3">';
print $object->code_fournisseur;
if ($object->check_codefournisseur() != 0)
print ' <font class="error">(' . $langs->trans("WrongSupplierCode") . ')</font>';
print '</td>';
print '</tr>';
print '<tr>';
print '<td>';
print $form->editfieldkey("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print '</td><td colspan="3">';
print $form->editfieldval("SupplierAccountancyCode", 'supplieraccountancycode', $object->code_compta_fournisseur, $object, $user->rights->societe->creer);
print '</td>';
print '</tr>';
// Address
print '<tr><td valign="top">' . $langs->trans("Address") . '</td><td colspan="3">';
dol_print_address($object->address, 'gmap', 'thirdparty', $object->id);
print '</td></tr>';
// Zip / Town
print '<tr><td class="nowrap">' . $langs->trans("Zip") . ' / ' . $langs->trans("Town") . '</td><td colspan="3">' . $object->zip . (($object->zip && $object->town) ? ' / ' : '') . $object->town . '</td>';
print '</tr>';
// Country
print '<tr><td>' . $langs->trans("Country") . '</td><td colspan="3">';
// $img=picto_from_langcode($object->country_code);
$img = '';
if ($object->isInEEC())
print $form->textwithpicto(($img ? $img . ' ' : '') . $object->country, $langs->trans("CountryIsInEEC"), 1, 0);
else
print ($img ? $img . ' ' : '') . $object->country;
print '</td></tr>';
print '</table>';
dol_fiche_end();
$sql = "SELECT bk.rowid, bk.doc_date, bk.doc_type, bk.doc_ref, ";
$sql .= " bk.subledger_account, bk.numero_compte , bk.label_compte, bk.debit, ";

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
/* Copyright (C) 2004-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2013 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
*
* 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
@ -18,9 +18,9 @@
*/
/**
* \file accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy
* \brief File of class for lettering
* \file accountancy/class/bookkeeping.class.php
* \ingroup Advanced accountancy
* \brief File of class for lettering
*/
include_once DOL_DOCUMENT_ROOT . "/accountancy/class/bookkeeping.class.php";
include_once DOL_DOCUMENT_ROOT . "/societe/class/societe.class.php";
@ -32,12 +32,12 @@ include_once DOL_DOCUMENT_ROOT . "/core/lib/date.lib.php";
class lettering extends BookKeeping
{
/**
* lettrageTiers
* lettering_thirdparty
*
* @param int $socid Thirdparty id
* @return int 1 OK, <0 error
*/
public function lettrageTiers($socid)
public function lettering_thirdparty($socid)
{
global $conf;

View File

@ -6,11 +6,11 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2013-2018 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2015-2018 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2017 Rui Strecht <rui.strecht@aliartalentos.com>
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
*
* 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
@ -154,18 +154,18 @@ function societe_prepare_head(Societe $object)
// Tab to accountancy
if (! empty($conf->accounting->enabled) && $object->client>0)
{
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettrage.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabAccountingCustomer");
$head[$h][2] = 'accounting';
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_customer.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabLetteringCustomer");
$head[$h][2] = 'lettering_customer';
$h++;
}
// Tab to accountancy
if (! empty($conf->accounting->enabled) && $object->fournisseur>0)
{
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettrage_supplier.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabAccountingSupplier");
$head[$h][2] = 'accounting_supplier';
$head[$h][0] = DOL_URL_ROOT.'/accountancy/bookkeeping/thirdparty_lettering_supplier.php?socid='.$object->id;
$head[$h][1] = $langs->trans("TabLetteringSupplier");
$head[$h][2] = 'lettering_supplier';
$h++;
}
}

View File

@ -160,6 +160,7 @@ Docref=Reference
LabelAccount=Label account
LabelOperation=Label operation
Sens=Sens
LetteringCode=Lettering code
Codejournal=Journal
NumPiece=Piece number
TransactionNumShort=Num. transaction

View File

@ -870,6 +870,8 @@ NewLeadOrProject=New lead or project
Rights=Permissions
LineNb=Line no.
IncotermLabel=Incoterms
TabLetteringCustomer=Customer lettering
TabLetteringSupplier=Supplier lettering
# Week day
Monday=Monday
Tuesday=Tuesday