From 2aac1761e36c113bddaa69242de2a363e7930e3b Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 13 Jan 2010 18:20:21 +0000 Subject: [PATCH] Add numbering and pdf module in project --- .../install/mysql/migration/2.7.0-2.8.0.sql | 1 + htdocs/install/mysql/tables/llx_commande.sql | 12 ++----- htdocs/install/mysql/tables/llx_facture.sql | 12 ++----- htdocs/install/mysql/tables/llx_projet.sql | 3 +- htdocs/install/mysql/tables/llx_propal.sql | 10 +----- htdocs/project.class.php | 2 +- htdocs/projet/fiche.php | 36 ++++++++++++++++--- 7 files changed, 41 insertions(+), 35 deletions(-) diff --git a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql index 502fd90999b..1c029d56b3b 100755 --- a/htdocs/install/mysql/migration/2.7.0-2.8.0.sql +++ b/htdocs/install/mysql/migration/2.7.0-2.8.0.sql @@ -46,3 +46,4 @@ UPDATE llx_c_type_contact SET element='project' WHERE element='projet'; UPDATE llx_const set value='mail' where value='simplemail' and name='MAIN_MAIL_SENDMODE'; +ALTER TABLE llx_projet ADD COLUMN model_pdf varchar(50) AFTER note; diff --git a/htdocs/install/mysql/tables/llx_commande.sql b/htdocs/install/mysql/tables/llx_commande.sql index f29e8ea16bc..354c32f45f5 100644 --- a/htdocs/install/mysql/tables/llx_commande.sql +++ b/htdocs/install/mysql/tables/llx_commande.sql @@ -50,17 +50,9 @@ create table llx_commande model_pdf varchar(50), facture tinyint default 0, - fk_cond_reglement integer, -- condition de réglement - fk_mode_reglement integer, -- mode de réglement + fk_cond_reglement integer, -- condition de reglement + fk_mode_reglement integer, -- mode de reglement date_livraison date default NULL, fk_adresse_livraison integer, -- adresse de livraison import_key varchar(14) )type=innodb; - --- --- List of codes for the field entity --- --- 1 : first company order --- 2 : second company order --- 3 : etc... --- \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_facture.sql b/htdocs/install/mysql/tables/llx_facture.sql index 8dfa190f107..8f76ed9b16e 100644 --- a/htdocs/install/mysql/tables/llx_facture.sql +++ b/htdocs/install/mysql/tables/llx_facture.sql @@ -53,10 +53,10 @@ create table llx_facture fk_user_valid integer, -- valideur de la facture fk_facture_source integer, -- facture origine si facture avoir - fk_projet integer, -- projet auquel est associ�e la facture + fk_projet integer, -- projet auquel est associee la facture fk_cond_reglement integer DEFAULT 1 NOT NULL, -- condition de reglement (30 jours, fin de mois ...) - fk_mode_reglement integer, -- mode de reglement (Virement, Pr�l�vement) + fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) date_lim_reglement date, -- date limite de reglement note text, @@ -65,11 +65,3 @@ create table llx_facture import_key varchar(14) )type=innodb; - --- --- List of codes for the field entity --- --- 1 : first company invoice --- 2 : second company invoice --- 3 : etc... --- \ No newline at end of file diff --git a/htdocs/install/mysql/tables/llx_projet.sql b/htdocs/install/mysql/tables/llx_projet.sql index 506e115aea7..24d1ec2d324 100644 --- a/htdocs/install/mysql/tables/llx_projet.sql +++ b/htdocs/install/mysql/tables/llx_projet.sql @@ -32,5 +32,6 @@ create table llx_projet title varchar(255), fk_user_resp integer, -- responsable du projet fk_user_creat integer, -- createur du projet - note text + note text, + model_pdf varchar(50) )type=innodb; diff --git a/htdocs/install/mysql/tables/llx_propal.sql b/htdocs/install/mysql/tables/llx_propal.sql index 5250d140c71..16ae13288fc 100644 --- a/htdocs/install/mysql/tables/llx_propal.sql +++ b/htdocs/install/mysql/tables/llx_propal.sql @@ -46,7 +46,7 @@ create table llx_propal total double(24,8) DEFAULT 0, -- montant total ttc apres remise globale fk_cond_reglement integer, -- condition de reglement (30 jours, fin de mois ...) - fk_mode_reglement integer, -- mode de reglement (Virement, Prélèvement) + fk_mode_reglement integer, -- mode de reglement (Virement, Prelevement) note text, note_public text, @@ -54,11 +54,3 @@ create table llx_propal date_livraison date default NULL, fk_adresse_livraison integer -- adresse de livraison )type=innodb; - --- --- List of codes for the field entity --- --- 1 : first company propal --- 2 : second company propal --- 3 : etc... --- \ No newline at end of file diff --git a/htdocs/project.class.php b/htdocs/project.class.php index a31967a1918..e3711e9a7f7 100644 --- a/htdocs/project.class.php +++ b/htdocs/project.class.php @@ -648,7 +648,7 @@ class Project extends CommonObject if (is_object($userp)) $sql .= " AND (p.fk_user_resp = ".$userp->id." OR p.fk_user_resp IS NULL OR p.fk_user_resp = -1)"; } $sql.= " ORDER BY p.ref, t.title"; -print $sql; + dol_syslog("Project::getTasksArray sql=".$sql, LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) diff --git a/htdocs/projet/fiche.php b/htdocs/projet/fiche.php index abcaf46903a..c067c8d3ce3 100644 --- a/htdocs/projet/fiche.php +++ b/htdocs/projet/fiche.php @@ -1,7 +1,7 @@ * Copyright (C) 2004-2009 Laurent Destailleur - * Copyright (C) 2005-2009 Regis Houssin + * Copyright (C) 2005-2010 Regis Houssin * * 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 @@ -27,12 +27,11 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php"); +require_once(DOL_DOCUMENT_ROOT."/includes/modules/project/modules_project.php"); require_once(DOL_DOCUMENT_ROOT."/lib/project.lib.php"); -if ($conf->propal->enabled) require_once(DOL_DOCUMENT_ROOT."/propal.class.php"); -if ($conf->facture->enabled) require_once(DOL_DOCUMENT_ROOT."/facture.class.php"); -if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); $langs->load("projects"); +$langs->load('companies'); $projectid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:'')); $ref = (isset($_GET["ref"])?$_GET["ref"]:''); @@ -140,6 +139,35 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet- } } +// Build doc +if ($_REQUEST['action'] == 'builddoc' && $user->rights->projet->creer) +{ + $project = new Project($db); + $project->fetch($_GET['id']); + if ($_REQUEST['model']) + { + $project->setDocModel($user, $_REQUEST['model']); + } + + $outputlangs = $langs; + if (! empty($_REQUEST['lang_id'])) + { + $outputlangs = new Translate("",$conf); + $outputlangs->setDefaultLang($_REQUEST['lang_id']); + } + $result=project_pdf_create($db, $project->id, $project->modelpdf, $outputlangs); + if ($result <= 0) + { + dol_print_error($db,$result); + exit; + } + else + { + Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$project->id.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc')); + exit; + } +} + if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes') { $project = new Project($db);