Add numbering and pdf module in project
This commit is contained in:
parent
60843d28bf
commit
535e12ca63
@ -21,16 +21,16 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
\file htdocs/boutique/client/client.class.php
|
||||
\brief Classe permettant de gèrer des clients de la boutique online
|
||||
\author Rodolphe Quiedeville
|
||||
\version $Revision$
|
||||
*/
|
||||
* \file htdocs/boutique/client/client.class.php
|
||||
* \brief Classe permettant de gerer des clients de la boutique online
|
||||
* \author Rodolphe Quiedeville
|
||||
* \version $Revision$
|
||||
*/
|
||||
|
||||
/**
|
||||
\class Client
|
||||
\brief Classe permettant de gèrer des clients de la boutique online
|
||||
*/
|
||||
* \class Client
|
||||
* \brief Classe permettant de gerer des clients de la boutique online
|
||||
*/
|
||||
|
||||
class Client
|
||||
{
|
||||
@ -46,10 +46,9 @@ class Client
|
||||
}
|
||||
|
||||
/**
|
||||
\brief Fonction permettant de recupèrer les informations d'un clients de la boutique
|
||||
\param id Id du client
|
||||
*/
|
||||
|
||||
* \brief Fonction permettant de recuperer les informations d'un clients de la boutique
|
||||
* \param id Id du client
|
||||
*/
|
||||
function fetch ($id)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
/**
|
||||
\file htdocs/html.formactions.class.php
|
||||
\brief Fichier de la classe des fonctions pr<EFBFBD>d<EFBFBD>finie de composants html actions
|
||||
\brief Fichier de la classe des fonctions predefinie de composants html actions
|
||||
\version $Id$
|
||||
*/
|
||||
|
||||
@ -106,6 +106,7 @@ class FormActions
|
||||
if ($typeelement == 'invoice') $sql.= ' AND a.fk_facture = '.$object->id;
|
||||
if ($typeelement == 'propal') $sql.= ' AND a.propalrowid = '.$object->id;
|
||||
if ($typeelement == 'order') $sql.= ' AND a.fk_commande = '.$object->id;
|
||||
if ($typeelement == 'project') $sql.= ' AND a.fk_project = '.$object->id;
|
||||
|
||||
dol_syslog("FormActions::showactions sql=".$sql);
|
||||
$resql = $this->db->query($sql);
|
||||
@ -117,6 +118,8 @@ class FormActions
|
||||
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
||||
if ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
|
||||
if ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
if ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||
|
||||
print_titre($title);
|
||||
|
||||
$i = 0; $total = 0; $var=true;
|
||||
|
||||
@ -227,6 +227,16 @@ class FormFile
|
||||
$modellist=$model->liste_modeles($this->db);
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'project')
|
||||
{
|
||||
if (is_array($genallowed)) $modellist=$genallowed;
|
||||
else
|
||||
{
|
||||
include_once(DOL_DOCUMENT_ROOT.'/includes/modules/project/modules_project.php');
|
||||
$model=new ModelePDFProjects();
|
||||
$modellist=$model->liste_modeles($this->db);
|
||||
}
|
||||
}
|
||||
elseif ($modulepart == 'export')
|
||||
{
|
||||
if (is_array($genallowed)) $modellist=$genallowed;
|
||||
|
||||
@ -70,8 +70,6 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$this->option_tva = 1; // Gere option tva FACTURE_TVAOPTION
|
||||
$this->option_codeproduitservice = 1; // Affiche code produit-service
|
||||
|
||||
$this->franchise=!$mysoc->tva_assuj;
|
||||
|
||||
// Recupere emmetteur
|
||||
$this->emetteur=$mysoc;
|
||||
if (! $this->emetteur->pays_code) $this->emetteur->pays_code=substr($langs->defaultlang,-2); // Par defaut, si n'<27>tait pas d<>fini
|
||||
@ -79,15 +77,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
// Defini position des colonnes
|
||||
$this->posxdesc=$this->marge_gauche+1;
|
||||
$this->posxcomm=120;
|
||||
$this->posxtva=121;
|
||||
$this->posxup=132;
|
||||
$this->posxqty=168;
|
||||
$this->posxdiscount=162;
|
||||
$this->postotalht=177;
|
||||
|
||||
$this->tva=array();
|
||||
$this->atleastoneratenotnull=0;
|
||||
$this->atleastonediscount=0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,8 +157,8 @@ class pdf_baleine extends ModelePDFProjects
|
||||
}
|
||||
|
||||
// Complete object by loading several other informations
|
||||
$tasks = $object->getTasksArray(0,0,1);
|
||||
$task = new Task($this->db);
|
||||
$result = $task->fetch($object->id);
|
||||
|
||||
$pdf->Open();
|
||||
$pagenb=0;
|
||||
@ -193,9 +183,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$tab_top = 90;
|
||||
$tab_top_newpage = 50;
|
||||
$tab_height = 110;
|
||||
$tab_height_newpage = 150;
|
||||
$tab_height = 150;
|
||||
|
||||
// Affiche notes
|
||||
if (! empty($object->note_public))
|
||||
@ -258,27 +246,9 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$nblineFollowDesc = 0;
|
||||
}
|
||||
|
||||
// Test if a new page is required
|
||||
if ($pagenb == 1)
|
||||
if (($nexY+$nblineFollowDesc) > ($tab_top+$tab_height) && $i < ($nblignes - 1))
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top;
|
||||
$tab_height_in_current_page=$tab_height;
|
||||
}
|
||||
else
|
||||
{
|
||||
$tab_top_in_current_page=$tab_top_newpage;
|
||||
$tab_height_in_current_page=$tab_height_newpage;
|
||||
}
|
||||
if (($nexY+$nblineFollowDesc) > ($tab_top_in_current_page+$tab_height_in_current_page) && $i < ($nblignes - 1))
|
||||
{
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
}
|
||||
$this->_tableau($pdf, $tab_top, $tab_height + 20, $nexY, $outputlangs);
|
||||
|
||||
$this->_pagefoot($pdf, $object, $outputlangs);
|
||||
|
||||
@ -295,17 +265,8 @@ class pdf_baleine extends ModelePDFProjects
|
||||
}
|
||||
|
||||
// Show square
|
||||
if ($pagenb == 1)
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top + $tab_height + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->_tableau($pdf, $tab_top_newpage, $tab_height_newpage, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top_newpage + $tab_height_newpage + 1;
|
||||
}
|
||||
|
||||
$this->_tableau($pdf, $tab_top, $tab_height, $nexY, $outputlangs);
|
||||
$bottomlasttab=$tab_top + $tab_height + 1;
|
||||
|
||||
/*
|
||||
* Pied de page
|
||||
@ -357,28 +318,7 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$pdf->SetFont('Arial','',10);
|
||||
|
||||
$pdf->SetXY ($this->posxdesc-1, $tab_top+2);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Designation"),'','L');
|
||||
|
||||
// Modif SEB pour avoir une col en plus pour les commentaires clients
|
||||
$pdf->line($this->posxcomm, $tab_top, $this->posxcomm, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxcomm, $tab_top+2);
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Comments"),'','L');
|
||||
|
||||
// Qty
|
||||
$pdf->line($this->posxqty-1, $tab_top, $this->posxqty-1, $tab_top + $tab_height);
|
||||
$pdf->SetXY ($this->posxqty-1, $tab_top+2);
|
||||
$pdf->MultiCell(30, 2, $outputlangs->transnoentities("QtyShipped"),'','R');
|
||||
|
||||
// Modif Seb cadres signatures
|
||||
$pdf->SetFont('Arial','',10);
|
||||
$larg_sign = ($this->page_largeur-$this->marge_gauche-$this->marge_droite)/3;
|
||||
$pdf->Rect($this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25 );
|
||||
$pdf->SetXY ($this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("For").' '.$outputlangs->convToOutputCharset($mysoc->nom).":",'','L');
|
||||
|
||||
$pdf->Rect(2*$larg_sign+$this->marge_gauche, ($tab_top + $tab_height + 3), $larg_sign, 25 );
|
||||
$pdf->SetXY (2*$larg_sign+$this->marge_gauche + 2, $tab_top + $tab_height + 5);
|
||||
$pdf->MultiCell($larg_sign,2, $outputlangs->trans("ForCustomer").':','','L');
|
||||
$pdf->MultiCell(80,2, $outputlangs->transnoentities("Task"),'','L');
|
||||
|
||||
}
|
||||
|
||||
@ -422,22 +362,13 @@ class pdf_baleine extends ModelePDFProjects
|
||||
$pdf->SetFont('Arial','B',13);
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryOrder")." ".$outputlangs->convToOutputCharset($object->ref), '' , 'R');
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Project")." ".$outputlangs->convToOutputCharset($object->ref), '' , 'R');
|
||||
$pdf->SetFont('Arial','',12);
|
||||
|
||||
$posy+=6;
|
||||
$pdf->SetXY(100,$posy);
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
if ($object->date_valid)
|
||||
{
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->date_valid,"%d %b %Y",false,$outputlangs,true), '', 'R');
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->SetTextColor(255,0,0);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("DeliveryNotValidated"), '', 'R');
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
}
|
||||
$pdf->MultiCell(100, 4, $outputlangs->transnoentities("Date")." : " . dol_print_date($object->dateo,"%d %b %Y",false,$outputlangs,true), '', 'R');
|
||||
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
|
||||
@ -519,50 +450,26 @@ class pdf_baleine extends ModelePDFProjects
|
||||
|
||||
$object->fetch_client();
|
||||
|
||||
// If SHIPPING contact defined on invoice, we use it
|
||||
$usecontact=false;
|
||||
$arrayidcontact=$object->commande->getIdContact('external','SHIPPING');
|
||||
// Nom client
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
|
||||
|
||||
// Nom du contact facturation si c'est une societe
|
||||
$arrayidcontact = $object->getIdContact('external','PROJECTLEADER');
|
||||
if (sizeof($arrayidcontact) > 0)
|
||||
{
|
||||
$usecontact=true;
|
||||
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||
}
|
||||
|
||||
if ($usecontact)
|
||||
{
|
||||
$socname = $object->client->nom;
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($socname);
|
||||
|
||||
// Customer name
|
||||
$carac_client = $outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
||||
|
||||
// Customer properties
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->contact->cp) . " " . $outputlangs->convToOutputCharset($object->contact->ville)."\n";
|
||||
if ($object->contact->pays_code && $object->contact->pays_code != $this->emetteur->pays_code) $carac_client.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->contact->pays_code))."\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
// Nom client
|
||||
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
|
||||
|
||||
// Nom du contact facturation si c'est une societe
|
||||
$arrayidcontact = $object->getIdContact('external','SHIPPING');
|
||||
if (sizeof($arrayidcontact) > 0)
|
||||
$object->fetch_contact($arrayidcontact[0]);
|
||||
// On verifie si c'est une societe ou un particulier
|
||||
if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) )
|
||||
{
|
||||
$object->fetch_contact($arrayidcontact[0]);
|
||||
// On verifie si c'est une societe ou un particulier
|
||||
if( !preg_match('#'.$object->contact->getFullName($outputlangs,1).'#isU',$object->client->nom) )
|
||||
{
|
||||
$carac_client .= "\n".$outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
||||
}
|
||||
$carac_client .= "\n".$outputlangs->convToOutputCharset($object->contact->getFullName($outputlangs,1,1));
|
||||
}
|
||||
|
||||
// Caracteristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->cp) . " " . $outputlangs->convToOutputCharset($object->client->ville)."\n";
|
||||
if ($object->client->pays_code && $object->client->pays_code != $this->emetteur->pays_code) $carac_client.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->client->pays_code))."\n";
|
||||
}
|
||||
|
||||
// Caracteristiques client
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->address);
|
||||
$carac_client.="\n".$outputlangs->convToOutputCharset($object->client->cp) . " " . $outputlangs->convToOutputCharset($object->client->ville)."\n";
|
||||
if ($object->client->pays_code && $object->client->pays_code != $this->emetteur->pays_code) $carac_client.=$outputlangs->convToOutputCharset($outputlangs->transnoentitiesnoconv("Country".$object->client->pays_code))."\n";
|
||||
|
||||
// Numero TVA intracom
|
||||
if ($object->client->tva_intra) $carac_client.="\n".$outputlangs->transnoentities("VATIntraShort").': '.$outputlangs->convToOutputCharset($object->client->tva_intra);
|
||||
|
||||
|
||||
@ -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)
|
||||
@ -813,11 +813,10 @@ class Project extends CommonObject
|
||||
// Initialise parametres
|
||||
$this->id=0;
|
||||
$this->ref = 'SPECIMEN';
|
||||
$this->ref_client='NEMICEPS';
|
||||
$this->specimen=1;
|
||||
$socid = rand(1, $num_socs);
|
||||
$this->socid = $socids[$socid];
|
||||
$this->date = time();
|
||||
$this->dateo = time();
|
||||
$this->note_public='SPECIMEN';
|
||||
$nbp = rand(1, 9);
|
||||
$xnbp = 0;
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
*/
|
||||
|
||||
require("./pre.inc.php");
|
||||
require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.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");
|
||||
@ -33,13 +34,8 @@ if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT."/commande/commande
|
||||
|
||||
$langs->load("projects");
|
||||
|
||||
$projetid='';
|
||||
$ref='';
|
||||
if (isset($_GET["id"])) { $projetid=$_GET["id"]; }
|
||||
else $_GET["id"]=$_POST["id"];
|
||||
if (isset($_GET["ref"])) { $ref=$_GET["ref"]; }
|
||||
|
||||
//var_dump($_REQUEST);exit;
|
||||
$projectid = (isset($_GET["id"])?$_GET["id"]:(isset($_POST["id"])?$_POST["id"]:''));
|
||||
$ref = (isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
|
||||
// If socid provided by ajax company selector
|
||||
if (! empty($_REQUEST['socid_id']))
|
||||
@ -49,12 +45,11 @@ if (! empty($_REQUEST['socid_id']))
|
||||
$_REQUEST['socid'] = $_REQUEST['socid_id'];
|
||||
}
|
||||
|
||||
|
||||
if ($projetid == '' && $ref == '' && ($_GET['action'] != "create" && $_POST['action'] != "add" && $_POST["action"] != "update" && !$_POST["cancel"])) accessforbidden();
|
||||
if ($projectid == '' && $ref == '' && ($_GET['action'] != "create" && $_POST['action'] != "add" && $_POST["action"] != "update" && !$_POST["cancel"])) accessforbidden();
|
||||
|
||||
// Security check
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result = restrictedArea($user, 'projet', $projetid);
|
||||
$result = restrictedArea($user, 'projet', $projectid);
|
||||
|
||||
|
||||
/*
|
||||
@ -77,8 +72,8 @@ if ($_POST["action"] == 'add' && $user->rights->projet->creer)
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
//print $_POST["socid"];
|
||||
$project = new Project($db);
|
||||
|
||||
$project->ref = $_POST["ref"];
|
||||
$project->title = $_POST["title"];
|
||||
$project->socid = $_POST["socid"];
|
||||
@ -124,19 +119,19 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"] && $user->rights->projet-
|
||||
}
|
||||
if (! $error)
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_POST["id"]);
|
||||
$project = new Project($db);
|
||||
$project->fetch($_POST["id"]);
|
||||
|
||||
$projet->ref = $_POST["ref"];
|
||||
$projet->title = $_POST["title"];
|
||||
$projet->socid = $_POST["socid"];
|
||||
$projet->user_resp_id = $_POST["officer_project"];
|
||||
$projet->date_start = dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
||||
$projet->date_end = dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
|
||||
$project->ref = $_POST["ref"];
|
||||
$project->title = $_POST["title"];
|
||||
$project->socid = $_POST["socid"];
|
||||
$project->user_resp_id = $_POST["officer_project"];
|
||||
$project->date_start = dol_mktime(12,0,0,$_POST['projectmonth'],$_POST['projectday'],$_POST['projectyear']);
|
||||
$project->date_end = dol_mktime(12,0,0,$_POST['projectendmonth'],$_POST['projectendday'],$_POST['projectendyear']);
|
||||
|
||||
$result=$projet->update($user);
|
||||
$result=$project->update($user);
|
||||
|
||||
$_GET["id"]=$projet->id; // On retourne sur la fiche projet
|
||||
$_GET["id"]=$project->id; // On retourne sur la fiche projet
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -181,9 +176,9 @@ if ($_REQUEST['action'] == 'confirm_reopen' && $_REQUEST['confirm'] == 'yes')
|
||||
|
||||
if ($_REQUEST["action"] == 'confirm_delete' && $_REQUEST["confirm"] == "yes" && $user->rights->projet->supprimer)
|
||||
{
|
||||
$projet = new Project($db);
|
||||
$projet->id = $_GET["id"];
|
||||
$result=$projet->delete($user);
|
||||
$project = new Project($db);
|
||||
$project->id = $_GET["id"];
|
||||
$result=$project->delete($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
Header("Location: index.php");
|
||||
@ -204,6 +199,7 @@ $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos";
|
||||
llxHeader("",$langs->trans("Projects"),$help_url);
|
||||
|
||||
$html = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
{
|
||||
@ -216,7 +212,6 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
//if ($_REQUEST["socid"]) print '<input type="hidden" name="socid" value="'.$_REQUEST["socid"].'">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
|
||||
@ -226,17 +221,16 @@ if ($_GET["action"] == 'create' && $user->rights->projet->creer)
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'*</td><td><input size="30" type="text" name="title" value="'.$_POST["title"].'"></td></tr>';
|
||||
|
||||
// Client
|
||||
// Customer
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
//print $_REQUEST["socid"];
|
||||
print $html->select_societes($_REQUEST["socid"],'socid','',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Responsable du projet
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
if ($_REQUEST["mode"] != 'mine')
|
||||
{
|
||||
$html->select_users($projet->user_resp_id,'officer_project',1);
|
||||
$html->select_users($project->user_resp_id,'officer_project',1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -268,19 +262,19 @@ else
|
||||
|
||||
if ($mesg) print $mesg;
|
||||
|
||||
$projet = new Project($db);
|
||||
$projet->fetch($_GET["id"],$_GET["ref"]);
|
||||
$project = new Project($db);
|
||||
$project->fetch($_GET["id"],$_GET["ref"]);
|
||||
|
||||
if ($projet->societe->id > 0) $result=$projet->societe->fetch($projet->societe->id);
|
||||
if ($projet->user_resp_id > 0) $result=$projet->fetch_user($projet->user_resp_id);
|
||||
if ($project->societe->id > 0) $result=$project->societe->fetch($project->societe->id);
|
||||
if ($project->user_resp_id > 0) $result=$project->fetch_user($project->user_resp_id);
|
||||
|
||||
$head=project_prepare_head($projet);
|
||||
$head=project_prepare_head($project);
|
||||
dol_fiche_head($head, 'project', $langs->trans("Project"),0,'project');
|
||||
|
||||
// Confirmation validation
|
||||
if ($_GET['action'] == 'validate')
|
||||
{
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$projet->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
|
||||
$ret=$html->form_confirm($_SERVER["PHP_SELF"].'?id='.$project->id, $langs->trans('ValidateProject'), $langs->trans('ConfirmValidateProject'), 'confirm_validate','',0,1);
|
||||
if ($ret == 'html') print '<br>';
|
||||
}
|
||||
// Confirmation close
|
||||
@ -313,32 +307,32 @@ else
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$projet->ref.'"></td></tr>';
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td><input size="8" name="ref" value="'.$project->ref.'"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$projet->title.'"></td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td><input size="30" name="title" value="'.$project->title.'"></td></tr>';
|
||||
|
||||
// Customer
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
print $html->select_societes($projet->societe->id,'socid','',1,1);
|
||||
print $html->select_societes($project->societe->id,'socid','',1,1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Responsable du projet
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
$html->select_users($projet->user_resp_id,'officer_project',1);
|
||||
$html->select_users($project->user_resp_id,'officer_project',1);
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$projet->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print $html->select_date($projet->date_start,'project');
|
||||
print $html->select_date($project->date_start,'project');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print $html->select_date($projet->date_end?$projet->date_end:-1,'projectend');
|
||||
print $html->select_date($project->date_end?$project->date_end:-1,'projectend');
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td align="center" colspan="2"><input name="update" class="button" type="submit" value="'.$langs->trans("Modify").'"> <input type="submit" class="button" name="cancel" Value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
@ -351,35 +345,35 @@ else
|
||||
|
||||
// Ref
|
||||
print '<tr><td width="30%">'.$langs->trans("Ref").'</td><td>';
|
||||
print $html->showrefnav($projet,'ref','',1,'ref','ref');
|
||||
print $html->showrefnav($project,'ref','',1,'ref','ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$projet->title.'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Label").'</td><td>'.$project->title.'</td></tr>';
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Company").'</td><td>';
|
||||
if ($projet->societe->id > 0) print $projet->societe->getNomUrl(1);
|
||||
if ($project->societe->id > 0) print $project->societe->getNomUrl(1);
|
||||
else print' ';
|
||||
print '</td></tr>';
|
||||
|
||||
// Project leader
|
||||
print '<tr><td>'.$langs->trans("OfficerProject").'</td><td>';
|
||||
if ($projet->user->id) print $projet->user->getNomUrl(1);
|
||||
if ($project->user->id) print $project->user->getNomUrl(1);
|
||||
else print $langs->trans('SharedProject');
|
||||
print '</td></tr>';
|
||||
|
||||
// Statut
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$projet->getLibStatut(4).'</td></tr>';
|
||||
print '<tr><td>'.$langs->trans("Status").'</td><td>'.$project->getLibStatut(4).'</td></tr>';
|
||||
|
||||
// Date start
|
||||
print '<tr><td>'.$langs->trans("DateStart").'</td><td>';
|
||||
print dol_print_date($projet->date_start,'day');
|
||||
print dol_print_date($project->date_start,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
// Date end
|
||||
print '<tr><td>'.$langs->trans("DateEnd").'</td><td>';
|
||||
print dol_print_date($projet->date_end,'day');
|
||||
print dol_print_date($project->date_end,'day');
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
@ -395,38 +389,103 @@ else
|
||||
if ($_GET["action"] != "edit")
|
||||
{
|
||||
// Validate
|
||||
if ($projet->statut == 0 && $user->rights->projet->creer)
|
||||
if ($project->statut == 0 && $user->rights->projet->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$_GET["id"].'&action=validate"';
|
||||
print '>'.$langs->trans("Valid").'</a>';
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($projet->statut != 2 && $user->rights->projet->creer)
|
||||
if ($project->statut != 2 && $user->rights->projet->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$project->id.'&action=edit">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
// Close
|
||||
if ($projet->statut != 2 && $user->rights->projet->creer)
|
||||
if ($project->statut != 2 && $user->rights->projet->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$project->id.'&action=close">'.$langs->trans("Close").'</a>';
|
||||
}
|
||||
|
||||
// Reopen
|
||||
if ($projet->statut == 2 && $user->rights->projet->creer)
|
||||
if ($project->statut == 2 && $user->rights->projet->creer)
|
||||
{
|
||||
print '<a class="butAction" href="fiche.php?id='.$projet->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
print '<a class="butAction" href="fiche.php?id='.$project->id.'&action=reopen">'.$langs->trans("ReOpen").'</a>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->projet->supprimer)
|
||||
{
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$projet->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
print '<a class="butActionDelete" href="fiche.php?id='.$project->id.'&action=delete">'.$langs->trans("Delete").'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</div>";
|
||||
print "<br>\n";
|
||||
|
||||
if ($_GET['action'] != 'presend')
|
||||
{
|
||||
print '<table width="100%"><tr><td width="50%" valign="top">';
|
||||
print '<a name="builddoc"></a>'; // ancre
|
||||
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
$filename=dol_sanitizeFileName($project->ref);
|
||||
$filedir=$conf->projet->dir_output . "/" . dol_sanitizeFileName($project->ref);
|
||||
$urlsource=$_SERVER["PHP_SELF"]."?id=".$project->id;
|
||||
$genallowed=$user->rights->projet->creer;
|
||||
$delallowed=$user->rights->projet->supprimer;
|
||||
|
||||
$var=true;
|
||||
|
||||
$somethingshown=$formfile->show_documents('project',$filename,$filedir,$urlsource,$genallowed,$delallowed,$project->modelpdf);
|
||||
|
||||
|
||||
/*
|
||||
* Commandes rattachees
|
||||
*/
|
||||
/* if($conf->commande->enabled)
|
||||
{
|
||||
$propal->loadOrders();
|
||||
$coms = $propal->commandes;
|
||||
if (sizeof($coms) > 0)
|
||||
{
|
||||
if ($somethingshown) { print '<br>'; $somethingshown=1; }
|
||||
print_titre($langs->trans('RelatedOrders'));
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Ref").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Date").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Price").'</td>';
|
||||
print '<td align="right">'.$langs->trans("Status").'</td>';
|
||||
print '</tr>';
|
||||
$var=true;
|
||||
for ($i = 0 ; $i < sizeof($coms) ; $i++)
|
||||
{
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/commande/fiche.php?id='.$coms[$i]->id.'">'.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."</a></td>\n";
|
||||
print '<td align="center">'.dol_print_date($coms[$i]->date,'day').'</td>';
|
||||
print '<td align="right">'.price($coms[$i]->total_ttc).'</td>';
|
||||
print '<td align="right">'.$coms[$i]->getLibStatut(3).'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
*/
|
||||
print '</td><td valign="top" width="50%">';
|
||||
|
||||
// List of actions on element
|
||||
include_once(DOL_DOCUMENT_ROOT.'/html.formactions.class.php');
|
||||
$formactions=new FormActions($db);
|
||||
$somethingshown=$formactions->showactions($project,'project',$socid);
|
||||
|
||||
print '</td></tr></table>';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user