From d579c0f405147707a7f1b64c20a9d325857b8c3b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 20 Sep 2011 22:45:39 +0000 Subject: [PATCH] Doxygen --- .../commande/class/boutiquecommande.class.php | 163 +++++++++--------- htdocs/compta/class/comptacompte.class.php | 115 ++++++++++++ htdocs/compta/param/comptes/fiche.php | 103 +++++++++++ htdocs/compta/param/comptes/index.php | 78 +++++++++ htdocs/compta/param/comptes/liste.php | 126 ++++++++++++++ htdocs/compta/param/index.php | 75 ++++++++ .../modules/cheque/pdf/pdf_blochet.class.php | 9 +- 7 files changed, 578 insertions(+), 91 deletions(-) create mode 100644 htdocs/compta/class/comptacompte.class.php create mode 100644 htdocs/compta/param/comptes/fiche.php create mode 100644 htdocs/compta/param/comptes/index.php create mode 100644 htdocs/compta/param/comptes/liste.php create mode 100644 htdocs/compta/param/index.php diff --git a/htdocs/boutique/commande/class/boutiquecommande.class.php b/htdocs/boutique/commande/class/boutiquecommande.class.php index 4b2d41e5221..25ee3b0fad1 100644 --- a/htdocs/boutique/commande/class/boutiquecommande.class.php +++ b/htdocs/boutique/commande/class/boutiquecommande.class.php @@ -32,109 +32,102 @@ include_once(DOL_DOCUMENT_ROOT.'/boutique/commande/class/boutiquecommande.class. */ class BoutiqueCommande { - var $db; + var $db ; - var $id; - var $nom; + var $id ; + var $nom; + function BoutiqueCommande($DB, $id=0) + { + $this->db = $DB; + $this->id = $id ; - /** - * Constructor - * - * @param DoliDB $DB Database handler - */ - function BoutiqueCommande($DB) - { - $this->db = $DB; - $this->id = $id; + $this->billing_adr = new Address(); + $this->delivry_adr = new Address(); - $this->billing_adr = new Address(); - $this->delivry_adr = new Address(); + $this->total_ot_subtotal = 0; + $this->total_ot_shipping = 0; + } - $this->total_ot_subtotal = 0; - $this->total_ot_shipping = 0; - } + /** + * \brief Get object and lines from database + * \param rowid id of object to load + * \param ref Ref of order + * \return int >0 si ok, <0 si ko + */ + function fetch ($id,$ref='') + { + global $conf; - /** - * Get object and lines from database - * - * @param int $id id of object to load - * @param string $ref Ref of order - * @return int >0 if OK, <0 if KO - */ - function fetch($id,$ref='') - { - global $conf; + $sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value"; + $sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders"; + $sql.= " WHERE orders_id = ".$id; - $sql = "SELECT orders_id, customers_id, customers_name, customers_company, customers_street_address, customers_suburb, customers_city, customers_postcode, customers_state, customers_country, customers_telephone, customers_email_address, customers_address_format_id, delivery_name, delivery_company, delivery_street_address, delivery_suburb, delivery_city, delivery_postcode, delivery_state, delivery_country, delivery_address_format_id, billing_name, billing_company, billing_street_address, billing_suburb, billing_city, billing_postcode, billing_state, billing_country, billing_address_format_id, payment_method, cc_type, cc_owner, cc_number, cc_expires, last_modified, date_purchased, orders_status, orders_date_finished, currency, currency_value"; - $sql.= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders"; - $sql.= " WHERE orders_id = ".$id; + $result = $this->db->query($sql); + if ( $result ) + { + $array = $this->db->fetch_array($result); - $result = $this->db->query($sql); - if ( $result ) - { - $array = $this->db->fetch_array($result); + $this->id = $array["orders_id"]; + $this->client_id = stripslashes($array["customers_id"]); + $this->client_name = stripslashes($array["customers_name"]); - $this->id = $array["orders_id"]; - $this->client_id = stripslashes($array["customers_id"]); - $this->client_name = stripslashes($array["customers_name"]); + $this->payment_method = stripslashes($array["payment_method"]); - $this->payment_method = stripslashes($array["payment_method"]); + $this->date = $this->db->jdate($array["date_purchased"]); - $this->date = $this->db->jdate($array["date_purchased"]); + $this->delivery_adr->name = stripslashes($array["delivery_name"]); + $this->delivery_adr->street = stripslashes($array["delivery_street_address"]); + $this->delivery_adr->cp = stripslashes($array["delivery_postcode"]); + $this->delivery_adr->city = stripslashes($array["delivery_city"]); + $this->delivery_adr->country = stripslashes($array["delivery_country"]); - $this->delivery_adr->name = stripslashes($array["delivery_name"]); - $this->delivery_adr->street = stripslashes($array["delivery_street_address"]); - $this->delivery_adr->cp = stripslashes($array["delivery_postcode"]); - $this->delivery_adr->city = stripslashes($array["delivery_city"]); - $this->delivery_adr->country = stripslashes($array["delivery_country"]); + $this->billing_adr->name = stripslashes($array["billing_name"]); + $this->billing_adr->street = stripslashes($array["billing_street_address"]); + $this->billing_adr->cp = stripslashes($array["billing_postcode"]); + $this->billing_adr->city = stripslashes($array["billing_city"]); + $this->billing_adr->country = stripslashes($array["billing_country"]); - $this->billing_adr->name = stripslashes($array["billing_name"]); - $this->billing_adr->street = stripslashes($array["billing_street_address"]); - $this->billing_adr->cp = stripslashes($array["billing_postcode"]); - $this->billing_adr->city = stripslashes($array["billing_city"]); - $this->billing_adr->country = stripslashes($array["billing_country"]); + $this->db->free(); - $this->db->free(); + /* + * Totaux + */ + $sql = "SELECT value, class "; + $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id"; - /* - * Totaux - */ - $sql = "SELECT value, class "; - $sql .= " FROM ".$conf->global->OSC_DB_NAME.".".$conf->global->OSC_DB_TABLE_PREFIX."orders_total WHERE orders_id = $id"; + $result = $this->db->query($sql); + if ( $result ) + { + $num = $this->db->num_rows($result); - $result = $this->db->query($sql); - if ( $result ) - { - $num = $this->db->num_rows($result); + while ($i < $num) + { + $array = $this->db->fetch_array($result); + if ($array["class"] == 'ot_total') + { + $this->total_ot_total = $array["value"]; + } + if ($array["class"] == 'ot_shipping') + { + $this->total_ot_shipping = $array["value"]; + } + $i++; + } + } + else + { + print $this->db->error(); + } - while ($i < $num) - { - $array = $this->db->fetch_array($result); - if ($array["class"] == 'ot_total') - { - $this->total_ot_total = $array["value"]; - } - if ($array["class"] == 'ot_shipping') - { - $this->total_ot_shipping = $array["value"]; - } - $i++; - } - } - else - { - print $this->db->error(); - } + } + else + { + print $this->db->error(); + } - } - else - { - print $this->db->error(); - } - - return $result; - } + return $result; + } } ?> diff --git a/htdocs/compta/class/comptacompte.class.php b/htdocs/compta/class/comptacompte.class.php new file mode 100644 index 00000000000..d0e55c29561 --- /dev/null +++ b/htdocs/compta/class/comptacompte.class.php @@ -0,0 +1,115 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/class/comptacompte.class.php + * \ingroup compta + * \brief Fichier de la classe des comptes comptable + */ + + +/** \class ComptaCompte + * \brief Classe permettant la gestion des comptes generaux de compta + */ + +class ComptaCompte +{ + var $db ; + + var $id ; + var $num; + var $intitule; + + /** + * \brief Constructeur de la classe + * \param DB handler acces base de donnees + * \param id id compte (0 par defaut) + */ + + function ComptaCompte($DB, $id=0) + { + $this->db = $DB; + $this->id = $id ; + } + + /** + * \brief Insere le produit en base + * \param user utilisateur qui effectue l'insertion + */ + + function create($user) + { + if (dol_strlen(trim($this->numero)) && dol_strlen(trim($this->intitule))) + { + $sql = "SELECT count(*)"; + $sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux "; + $sql .= " WHERE numero = '" .trim($this->numero)."'"; + + $resql = $this->db->query($sql); + + if ( $resql ) + { + $row = $this->db->fetch_array($resql); + if ($row[0] == 0) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."compta_compte_generaux (date_creation, fk_user_author, numero,intitule)"; + $sql .= " VALUES (".$this->db->idate(mktime()).",".$user->id.",'".$this->numero."','".$this->intitule."')"; + + $resql = $this->db->query($sql); + if ( $resql ) + { + $id = $this->db->last_insert_id(MAIN_DB_PREFIX."compta_compte_generaux"); + + if ($id > 0) + { + $this->id = $id; + $result = 0; + } + else + { + $result = -2; + dol_syslog("ComptaCompte::Create Erreur $result lecture ID"); + } + } + else + { + $result = -1; + dol_syslog("ComptaCompte::Create Erreur $result INSERT Mysql"); + } + } + else + { + $result = -3; + dol_syslog("ComptaCompte::Create Erreur $result SELECT Mysql"); + } + } + else + { + $result = -5; + dol_syslog("ComptaCompte::Create Erreur $result SELECT Mysql"); + } + } + else + { + $result = -4; + dol_syslog("ComptaCompte::Create Erreur $result Valeur Manquante"); + } + + return $result; + } +} +?> diff --git a/htdocs/compta/param/comptes/fiche.php b/htdocs/compta/param/comptes/fiche.php new file mode 100644 index 00000000000..4fb01370324 --- /dev/null +++ b/htdocs/compta/param/comptes/fiche.php @@ -0,0 +1,103 @@ + + * Copyright (C) 2004-2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + + +/** + * \file htdocs/compta/param/comptes/fiche.php + * \ingroup compta + * \brief Page de la fiche des comptes comptables + */ + +require("../../../main.inc.php"); + +$mesg = ''; + +if ($_POST["action"] == 'add' && $user->rights->compta->ventilation->parametrer) +{ + $compte = new ComptaCompte($db); + + $compte->numero = $_POST["numero"]; + $compte->intitule = $_POST["intitule"]; + + $e_compte = $compte; + + $res = $compte->create($user); + + if ($res == 0) + { + Header("Location: liste.php"); + } + else + { + if ($res == -3) + { + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + if ($res == -4) + { + $_error = 2; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + } +} + +llxHeader("","Nouveau compte"); + +/* + * Creation d'un compte + * + */ +if ($_GET["action"] == 'create' && $user->rights->compta->ventilation->parametrer) +{ + $html = new Form($db); + $nbligne=0; + + print_fiche_titre($langs->trans("NewAccount")); + + print '
'; + print ''; + print ''; + print ''."\n"; + + print ''; + print ''; + print ''; + print ''; + + print ''; + print '
'.$langs->trans("AccountNumber").''; + if ($_error == 1) + { + print "Ce numéro de compte existe déjà"; + } + if ($_error == 2) + { + print "Valeur(s) manquante(s)"; + } + print '
'.$langs->trans("Label").'
 
'; + print '
'; +} + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/compta/param/comptes/index.php b/htdocs/compta/param/comptes/index.php new file mode 100644 index 00000000000..59e1fd33bf6 --- /dev/null +++ b/htdocs/compta/param/comptes/index.php @@ -0,0 +1,78 @@ + + * Copyright (C) 2004-2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * \file htdocs/compta/param/comptes/index.php + * \ingroup compta + * \brief Page acceuil zone parametrages + */ + +require("../../../main.inc.php"); + +$langs->load("compta"); +$langs->load("bills"); + +/* + * Securite acces client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + +llxHeader("","Accueil Compta"); + +/* + * Affichage page + * + */ +print_fiche_titre($langs->trans("AccountancySetup")); + +print ''; + +print ''; + +print '
'; + +/* + * Zone recherche facture + */ +print '
'; +print ''; + +print ''; +print ""; +print ''; +print ""; +print ''; +print "
'.$langs->trans("SearchABill").'
'.$langs->trans("Ref").':

"; + + + +print '
'; + + + +print '
'; + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/compta/param/comptes/liste.php b/htdocs/compta/param/comptes/liste.php new file mode 100644 index 00000000000..36a317d20cc --- /dev/null +++ b/htdocs/compta/param/comptes/liste.php @@ -0,0 +1,126 @@ + + * Copyright (C) 2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + */ + +/** + * \file htdocs/compta/param/comptes/liste.php + * \ingroup compta + * \brief Onglet de gestion de parametrages des ventilations + */ + +require("../../../main.inc.php"); + + +llxHeader('','Compta - Liste des comptes'); + +$page = $_GET["page"]; +$sortorder = $_GET["sortorder"]; +$sortfield = $_GET["sortfield"]; +if ($sortorder == "") $sortorder="ASC"; +if ($sortfield == "") $sortfield="cg.numero"; + +$offset = $conf->liste_limit * $page ; + +/* + * Mode Liste + * + * + * + */ + +$sql = "SELECT cg.rowid, cg.numero, cg.intitule, cg.date_creation as dc"; + +$sql .= " FROM ".MAIN_DB_PREFIX."compta_compte_generaux as cg"; + +if (dol_strlen(trim($_GET["search_numero"])) ) +{ + + $sql .= " WHERE cg.numero LIKE '%".$_GET["search_numero"]."%'"; + + if ( dol_strlen(trim($_GET["search_intitule"]))) + { + $sql .= " AND cg.intitule LIKE '%".$_GET["search_intitule"]."%'"; + } + +} +else +{ + if ( dol_strlen(trim($_GET["search_intitule"]))) + { + $sql .= " WHERE cg.intitule LIKE '%".$_GET["search_intitule"]."%'"; + } +} + + +$sql .= " ORDER BY $sortfield $sortorder " . $db->plimit($conf->liste_limit+1, $offset); + +$resql = $db->query($sql); +if ($resql) +{ + $num = $db->num_rows($resql); + $i = 0; + + print_barre_liste("Comptes généraux", $page, "liste.php", "", $sortfield, $sortorder, '', $num); + + print ''; + print ''; + print_liste_field_titre($langs->trans("AccountNumberShort"),"liste.php","cg.numero"); + print_liste_field_titre($langs->trans("Label"),"liste.php","cg.intitule"); + print_liste_field_titre($langs->trans("DateCreation"),"liste.php","cg.date_creation"); + print "\n"; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + $var=True; + + while ($i < min($num,$conf->liste_limit)) + { + $obj = $db->fetch_object($resql); + $var=!$var; + + print ""; + + print ''."\n"; + print ''; + print ''; + print "\n"; + $i++; + } + print "
'; + print ''; + print '
'.$obj->numero.''.$obj->intitule.''; + print dol_print_date($db->jdate($obj->dc)); + + print '
"; + $db->free($resql); +} +else +{ + dol_print_error($db); +} + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/compta/param/index.php b/htdocs/compta/param/index.php new file mode 100644 index 00000000000..28be77fe418 --- /dev/null +++ b/htdocs/compta/param/index.php @@ -0,0 +1,75 @@ + + * Copyright (C) 2004-2005 Laurent Destailleur + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/** + * \file htdocs/compta/param/index.php + * \ingroup compta + * \brief Page acceuil zone parametrage comptabilite + */ + +require("../../main.inc.php"); + +$langs->load("compta"); +$langs->load("bills"); + +/* + * S�curit� acc�s client + */ +if ($user->societe_id > 0) +{ + $action = ''; + $socid = $user->societe_id; +} + +llxHeader("",$langs->trans("AccountancySetup")); + +/* + * Affichage page + * + */ +print_fiche_titre($langs->trans("AccountancySetup")); + +print ''; + +print ''; + +print '
'; + +/* + * Zone recherche facture + */ +print '
'; +print ''; +print ""; +print ''; +print "'; +print "
'.$langs->trans("SearchABill").'
"; +print $langs->trans("Ref").':

"; + + + +print '
'; + + + +print '
'; + +$db->close(); + +llxFooter(); +?> diff --git a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php index 3acd5771307..21c0460bfca 100644 --- a/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php +++ b/htdocs/includes/modules/cheque/pdf/pdf_blochet.class.php @@ -173,12 +173,9 @@ class BordereauChequeBlochet extends ModeleChequeReceipts /** * Generate Header - * - * @param PDF &$pdf Pdf object - * @param int $page Current page number - * @param int $pages Total number of pages - * @param Translate $outputlangs Object language for output - * @return void + * @param pdf Pdf object + * @param page Current page number + * @param pages Total number of pages */ function Header(&$pdf, $page, $pages, $outputlangs) {