Qual: Start to clean the simple accountancy moule.

This commit is contained in:
Laurent Destailleur 2013-03-20 21:41:16 +01:00
parent 257f6da8f4
commit a2763df9e7
14 changed files with 28 additions and 42 deletions

View File

@ -336,7 +336,6 @@ class FactureRec extends Facture
$line->total_ht = $objp->total_ht;
$line->total_tva = $objp->total_tva;
$line->total_ttc = $objp->total_ttc;
$line->export_compta = $objp->fk_export_compta;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->rang = $objp->rang;
$line->special_code = $objp->special_code;

View File

@ -455,7 +455,7 @@ class Facture extends CommonInvoice
}
}
else if ($reshook < 0) $error++;
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
@ -866,7 +866,7 @@ class Facture extends CommonInvoice
$this->extraparams = (array) json_decode($obj->extraparams, true);
if ($this->statut == 0) $this->brouillon = 1;
// Retreive all extrafield for invoice
// fetch optionals attributes and labels
if(!class_exists('Extrafields'))
@ -925,7 +925,7 @@ class Facture extends CommonInvoice
$sql.= ' l.localtax1_tx, l.localtax2_tx, l.remise, l.remise_percent, l.fk_remise_except, l.subprice,';
$sql.= ' l.rang, l.special_code,';
$sql.= ' l.date_start as date_start, l.date_end as date_end,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_export_compta, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' l.info_bits, l.total_ht, l.total_tva, l.total_localtax1, l.total_localtax2, l.total_ttc, l.fk_code_ventilation, l.fk_product_fournisseur_price as fk_fournprice, l.buy_price_ht as pa_ht,';
$sql.= ' p.ref as product_ref, p.fk_product_type as fk_product_type, p.label as product_label, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as l';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON l.fk_product = p.rowid';
@ -970,7 +970,6 @@ class Facture extends CommonInvoice
$line->total_localtax1 = $objp->total_localtax1;
$line->total_localtax2 = $objp->total_localtax2;
$line->total_ttc = $objp->total_ttc;
$line->export_compta = $objp->fk_export_compta;
$line->code_ventilation = $objp->fk_code_ventilation;
$line->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $line->fk_fournprice, $objp->pa_ht);
@ -1860,7 +1859,7 @@ class Facture extends CommonInvoice
}
}
}
if ($error == 0)
{
$old_statut=$this->statut;
@ -1870,8 +1869,8 @@ class Facture extends CommonInvoice
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('BILL_UNVALIDATE',$this,$user,$langs,$conf);
if ($result < 0) {
$error++;
if ($result < 0) {
$error++;
$this->errors=$interface->errors;
$this->statut=$old_statut;
$this->brouillon=0;
@ -1881,7 +1880,7 @@ class Facture extends CommonInvoice
$this->db->rollback();
return -1;
}
if ($error == 0)
{
$this->db->commit();
@ -3196,7 +3195,6 @@ class FactureLigne
var $total_ttc;
var $fk_code_ventilation = 0;
var $fk_export_compta = 0;
var $date_start;
var $date_end;
@ -3237,7 +3235,7 @@ class FactureLigne
$sql.= ' fd.localtax1_tx, fd. localtax2_tx, fd.remise, fd.remise_percent, fd.fk_remise_except, fd.subprice,';
$sql.= ' fd.date_start as date_start, fd.date_end as date_end, fd.fk_product_fournisseur_price as fk_fournprice, fd.buy_price_ht as pa_ht,';
$sql.= ' fd.info_bits, fd.total_ht, fd.total_tva, fd.total_ttc, fd.total_localtax1, fd.total_localtax2, fd.rang,';
$sql.= ' fd.fk_code_ventilation, fd.fk_export_compta,';
$sql.= ' fd.fk_code_ventilation,';
$sql.= ' p.ref as product_ref, p.label as product_libelle, p.description as product_desc';
$sql.= ' FROM '.MAIN_DB_PREFIX.'facturedet as fd';
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON fd.fk_product = p.rowid';
@ -3271,7 +3269,6 @@ class FactureLigne
$this->total_localtax2 = $objp->total_localtax2;
$this->total_ttc = $objp->total_ttc;
$this->fk_code_ventilation = $objp->fk_code_ventilation;
$this->fk_export_compta = $objp->fk_export_compta;
$this->rang = $objp->rang;
$this->fk_fournprice = $objp->fk_fournprice;
$marginInfos = getMarginInfos($objp->subprice, $objp->remise_percent, $objp->tva_tx, $objp->localtax1_tx, $objp->localtax2_tx, $this->fk_fournprice, $objp->pa_ht);
@ -3338,7 +3335,7 @@ class FactureLigne
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facturedet';
$sql.= ' (fk_facture, fk_parent_line, label, description, qty, tva_tx, localtax1_tx, localtax2_tx,';
$sql.= ' fk_product, product_type, remise_percent, subprice, fk_remise_except,';
$sql.= ' date_start, date_end, fk_code_ventilation, fk_export_compta, ';
$sql.= ' date_start, date_end, fk_code_ventilation, ';
$sql.= ' rang, special_code, fk_product_fournisseur_price, buy_price_ht,';
$sql.= ' info_bits, total_ht, total_tva, total_ttc, total_localtax1, total_localtax2)';
$sql.= " VALUES (".$this->fk_facture.",";
@ -3357,7 +3354,6 @@ class FactureLigne
$sql.= " ".(! empty($this->date_start)?"'".$this->db->idate($this->date_start)."'":"null").",";
$sql.= " ".(! empty($this->date_end)?"'".$this->db->idate($this->date_end)."'":"null").",";
$sql.= ' '.$this->fk_code_ventilation.',';
$sql.= ' '.$this->fk_export_compta.',';
$sql.= ' '.$this->rang.',';
$sql.= ' '.$this->special_code.',';
$sql.= ' '.(! empty($this->fk_fournprice)?$this->fk_fournprice:"null").',';

View File

@ -39,7 +39,7 @@ print '<tr><td valign="top" width="30%">';
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facturedet";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
{
@ -50,7 +50,7 @@ if ($result)
}
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiement";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
@ -62,7 +62,7 @@ if ($result)
}
$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."facture_fourn_det";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)
{
@ -73,7 +73,7 @@ if ($result)
}
/*$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."paiementfourn";
$sql .= " WHERE fk_export_compta = 0";
$sql .= " WHERE fk_code_ventilation = 0";
$result = $db->query($sql);
if ($result)

View File

@ -48,7 +48,7 @@ if ($page < 0) $page = 0;
$limit = $conf->liste_limit;
$offset = $limit * $page ;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total_ttc as price, l.qty, l.rowid, l.tva_tx, l.fk_code_ventilation, c.intitule, c.numero,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."compta_compte_generaux as c";
@ -72,7 +72,7 @@ if ($result)
$num_lignes = $db->num_rows($result);
$i = 0;
print_barre_liste("Lignes de facture ventil<69>es",$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
print_barre_liste($langs->trans("InvoiceDispatched"),$page,"lignes.php","",$sortfield,$sortorder,'',$num_lignes);
print '<form method="GET" action="lignes.php">';
print '<table class="noborder" width="100%">';
@ -136,7 +136,7 @@ else
print "</table></form>";
$db->close();
llxFooter();
$db->close();
?>

View File

@ -54,7 +54,7 @@ $pageprev = $page - 1;
$pagenext = $page + 1;
$limit = $conf->liste_limit;
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, l.price, l.rowid, l.fk_code_ventilation,";
$sql = "SELECT f.facnumber, f.rowid as facid, l.fk_product, l.description, f.total as price, l.rowid, l.fk_code_ventilation,";
$sql.= " p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.fk_product_type as type";
$sql.= " FROM ".MAIN_DB_PREFIX."facture as f";
$sql.= " , ".MAIN_DB_PREFIX."facturedet as l";

View File

@ -799,17 +799,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
// Compta simple
if (! empty($conf->comptabilite->enabled) && ! empty($conf->global->FACTURE_VENTILATION))
if (! empty($conf->comptabilite->enabled) && ($conf->global->MAIN_FEATURES_LEVEL >= 2))
{
$newmenu->add("/compta/ventilation/index.php?leftmenu=ventil",$langs->trans("Dispatch"),0,$user->rights->compta->ventilation->lire, '', $mainmenu, 'ventil');
if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/liste.php",$langs->trans("ToDispatch"),1,$user->rights->compta->ventilation->lire);
if ($leftmenu=="ventil") $newmenu->add("/compta/ventilation/lignes.php",$langs->trans("Dispatched"),1,$user->rights->compta->ventilation->lire);
if ($leftmenu=="ventil") $newmenu->add("/compta/param/",$langs->trans("Setup"),1,$user->rights->compta->ventilation->parametrer);
if ($leftmenu=="ventil") $newmenu->add("/compta/param/comptes/fiche.php?action=create",$langs->trans("New"),2,$user->rights->compta->ventilation->parametrer);
if ($leftmenu=="ventil") $newmenu->add("/compta/param/comptes/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->parametrer);
if ($leftmenu=="ventil") $newmenu->add("/compta/export/",$langs->trans("Export"),1,$user->rights->compta->ventilation->lire);
if ($leftmenu=="ventil") $newmenu->add("/compta/export/index.php?action=export",$langs->trans("New"),2,$user->rights->compta->ventilation->lire);
if ($leftmenu=="ventil") $newmenu->add("/compta/export/liste.php",$langs->trans("List"),2,$user->rights->compta->ventilation->lire);
}
// Compta expert

View File

@ -158,4 +158,4 @@ ALTER TABLE llx_c_action_trigger ADD INDEX idx_action_trigger_rang (rang)
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_code_ventilation integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_facture_fourn_det ADD COLUMN fk_export_compta integer DEFAULT 0 NOT NULL;
ALTER TABLE llx_facturedet DROP COLUMN fk_export_compta;

View File

@ -44,6 +44,5 @@ create table llx_facture_fourn_det
date_start datetime DEFAULT NULL, -- date debut si service
date_end datetime DEFAULT NULL, -- date fin si service
fk_code_ventilation integer DEFAULT 0 NOT NULL,
fk_export_compta integer DEFAULT 0 NOT NULL,
import_key varchar(14)
)ENGINE=innodb;

View File

@ -51,7 +51,6 @@ create table llx_facturedet
buy_price_ht double(24,8) DEFAULT 0, -- prix d'achat HT
fk_product_fournisseur_price integer DEFAULT NULL, -- reference prix fournisseur
fk_code_ventilation integer DEFAULT 0 NOT NULL,
fk_export_compta integer DEFAULT 0 NOT NULL,
special_code integer UNSIGNED DEFAULT 0, -- code pour les lignes speciales
rang integer DEFAULT 0, -- ordre d'affichage
import_key varchar(14)

View File

@ -18,10 +18,6 @@
--
-- ===================================================================
-- Satut, 0 ou 1, 1 n'est plus supprimable
-- fk_export_compta 0 pas exporte
create table llx_paiement
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
@ -36,7 +32,6 @@ create table llx_paiement
fk_bank integer NOT NULL DEFAULT 0,
fk_user_creat integer, -- utilisateur qui a cree l'info
fk_user_modif integer, -- utilisateur qui a modifie l'info
statut smallint DEFAULT 0 NOT NULL,
fk_export_compta integer DEFAULT 0 NOT NULL
statut smallint DEFAULT 0 NOT NULL, -- Satut, 0 ou 1, 1 n'est plus supprimable
fk_export_compta integer DEFAULT 0 NOT NULL -- fk_export_compta 0 pas exporte
)ENGINE=innodb;

View File

@ -369,7 +369,7 @@ Module1Desc=Companies and contact management (customers, prospects...)
Module2Name=Commercial
Module2Desc=Commercial management
Module10Name=Accounting
Module10Desc=Simple accounting management (invoice and payment dispatching)
Module10Desc=Simple accounting reports (journals, turnover) based onto database content. No dispatching.
Module20Name=Proposals
Module20Desc=Commercial proposal management
Module22Name=Mass E-mailings

View File

@ -149,4 +149,6 @@ WarningDepositsNotIncluded=Deposits invoices are not included in this version wi
DatePaymentTermCantBeLowerThanObjectDate=Payment term date can't be lower than object date.
Pcg_version=Pcg version
Pcg_type=Pcg type
Pcg_subtype=Pcg subtype
Pcg_subtype=Pcg subtype
InvoiceLinesToDispatch=Invoice lines to dispatch
InvoiceDispatched=Dispatched invoices

View File

@ -368,7 +368,7 @@ Module1Desc= Gestion des tiers (sociétés, particuliers) et contacts
Module2Name= Commercial
Module2Desc= Gestion commerciale
Module10Name= Comptabilité
Module10Desc= Gestion simpliste de comptabilité (ventilation de factures et paiements uniquement)
Module10Desc= Activation de rapports simplistes de comptabilité (ca, journaux) basé sur la base. Pas de ventilation.
Module20Name= Propositions commerciales
Module20Desc= Gestion des devis/propositions commerciales
Module22Name= EMailings

View File

@ -161,3 +161,5 @@ DatePaymentTermCantBeLowerThanObjectDate=La date limite de règlement ne peut ê
Pcg_version=Version du plan
Pcg_type=Classe de compte
Pcg_subtype=Sous classe de compte
InvoiceLinesToDispatch=Lignes de factures à ventiler
InvoiceDispatched=Factures ventilées