Add numbering and pdf module in project

This commit is contained in:
Regis Houssin 2010-01-13 18:20:21 +00:00
parent 535e12ca63
commit 2aac1761e3
7 changed files with 41 additions and 35 deletions

View File

@ -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;

View File

@ -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...
--

View File

@ -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<EFBFBD>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<EFBFBD>l<EFBFBD>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...
--

View File

@ -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;

View File

@ -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...
--

View File

@ -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)

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2005-2010 Regis Houssin <regis@dolibarr.fr>
*
* 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);