New: early development of multi-company module
This commit is contained in:
parent
88d0f1ede7
commit
929939d0bf
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
||||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -53,7 +53,7 @@ print_fiche_titre($langs->trans("NewProp"));
|
|||||||
|
|
||||||
$html=new Form($db);
|
$html=new Form($db);
|
||||||
|
|
||||||
// R<EFBFBD>cup<EFBFBD>ration de l'id de projet
|
// Recuperation de l'id de projet
|
||||||
$projetid = 0;
|
$projetid = 0;
|
||||||
if ($_GET["projetid"])
|
if ($_GET["projetid"])
|
||||||
{
|
{
|
||||||
@ -84,7 +84,11 @@ if ($_GET["action"] == 'create')
|
|||||||
|
|
||||||
// Fix pour modele numerotation qui deconne
|
// Fix pour modele numerotation qui deconne
|
||||||
// Si numero deja pris (ne devrait pas arriver), on incremente par .num+1
|
// Si numero deja pris (ne devrait pas arriver), on incremente par .num+1
|
||||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."propal WHERE ref like '$numpr%'";
|
$sql = "SELECT count(*) as nb";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."propal";
|
||||||
|
$sql.= " WHERE ref like '$numpr%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -146,7 +150,7 @@ if ($_GET["action"] == 'create')
|
|||||||
$html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
|
$html->select_conditions_paiements($soc->cond_reglement,'cond_reglement_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Mode de r<EFBFBD>glement
|
// Mode de reglement
|
||||||
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
print '<tr><td>'.$langs->trans('PaymentMode').'</td><td colspan="2">';
|
||||||
$html->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
|
$html->select_types_paiements($soc->mode_reglement,'mode_reglement_id');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
@ -227,9 +231,15 @@ if ($_GET["action"] == 'create')
|
|||||||
print '<td>';
|
print '<td>';
|
||||||
$liste_propal = array();
|
$liste_propal = array();
|
||||||
$liste_propal[0] = '';
|
$liste_propal[0] = '';
|
||||||
|
|
||||||
$sql ="SELECT p.rowid as id, p.ref, s.nom";
|
$sql ="SELECT p.rowid as id, p.ref, s.nom";
|
||||||
$sql.=" FROM ".MAIN_DB_PREFIX."propal p, ".MAIN_DB_PREFIX."societe s";
|
$sql.=" FROM ".MAIN_DB_PREFIX."propal p";
|
||||||
$sql.=" WHERE s.rowid = p.fk_soc AND fk_statut <> 0 ORDER BY Id";
|
$sql.= ", ".MAIN_DB_PREFIX."societe s";
|
||||||
|
$sql.= " WHERE s.rowid = p.fk_soc";
|
||||||
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND p.fk_statut <> 0";
|
||||||
|
$sql.= " ORDER BY Id";
|
||||||
|
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -58,10 +58,11 @@ class ModelePDFPropales extends FPDF
|
|||||||
|
|
||||||
$type='propal';
|
$type='propal';
|
||||||
$liste=array();
|
$liste=array();
|
||||||
|
|
||||||
$sql = "SELECT nom as id, nom as lib";
|
$sql = "SELECT nom as id, nom as lib";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
$sql.= " WHERE type = '".$type."'";
|
$sql.= " WHERE type = '".$type."'";
|
||||||
$sql.= " AND entity = ".$cont->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
dol_syslog("modules_propale::liste_modeles sql=".$sql, LOG_DEBUG);
|
dol_syslog("modules_propale::liste_modeles sql=".$sql, LOG_DEBUG);
|
||||||
$resql = $db->query($sql);
|
$resql = $db->query($sql);
|
||||||
|
|||||||
@ -527,21 +527,46 @@ class Propal extends CommonObject
|
|||||||
$this->fetch_client();
|
$this->fetch_client();
|
||||||
|
|
||||||
// Insertion dans la base
|
// Insertion dans la base
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (fk_soc, price";
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."propal (";
|
||||||
$sql.= ", remise, remise_percent, remise_absolue";
|
$sql.= "fk_soc";
|
||||||
$sql.= ", tva, total, datep, datec, ref, fk_user_author, note, note_public, model_pdf, fin_validite";
|
$sql.= ", price";
|
||||||
$sql.= ", fk_cond_reglement, fk_mode_reglement, ref_client";
|
$sql.= ", remise";
|
||||||
|
$sql.= ", remise_percent";
|
||||||
|
$sql.= ", remise_absolue";
|
||||||
|
$sql.= ", tva";
|
||||||
|
$sql.= ", total";
|
||||||
|
$sql.= ", datep";
|
||||||
|
$sql.= ", datec";
|
||||||
|
$sql.= ", ref";
|
||||||
|
$sql.= ", fk_user_author";
|
||||||
|
$sql.= ", note";
|
||||||
|
$sql.= ", note_public";
|
||||||
|
$sql.= ", model_pdf";
|
||||||
|
$sql.= ", fin_validite";
|
||||||
|
$sql.= ", fk_cond_reglement";
|
||||||
|
$sql.= ", fk_mode_reglement";
|
||||||
|
$sql.= ", ref_client";
|
||||||
$sql.= ", date_livraison";
|
$sql.= ", date_livraison";
|
||||||
$sql.= ", entity";
|
$sql.= ", entity";
|
||||||
$sql.= ") ";
|
$sql.= ") ";
|
||||||
$sql.= " VALUES (".$this->socid.", 0";
|
$sql.= " VALUES (";
|
||||||
$sql.= ", ".$this->remise.", ".($this->remise_percent?$this->remise_percent:'null').", ".($this->remise_absolue?$this->remise_absolue:'null');
|
$sql.= $this->socid;
|
||||||
$sql.= ", 0, 0,".$this->db->idate($this->datep).", ".$this->db->idate(mktime()).", '".$this->ref;
|
$sql.= ", 0";
|
||||||
|
$sql.= ", ".$this->remise;
|
||||||
|
$sql.= ", ".($this->remise_percent?$this->remise_percent:'null');
|
||||||
|
$sql.= ", ".($this->remise_absolue?$this->remise_absolue:'null');
|
||||||
|
$sql.= ", 0";
|
||||||
|
$sql.= ", 0";
|
||||||
|
$sql.= ", ".$this->db->idate($this->datep);
|
||||||
|
$sql.= ", ".$this->db->idate(mktime());
|
||||||
|
$sql.= ", '".$this->ref."'";
|
||||||
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
$sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null");
|
||||||
$sql.= ", '".addslashes($this->note)."'";
|
$sql.= ", '".addslashes($this->note)."'";
|
||||||
$sql.= ", '".addslashes($this->note_public)."'";
|
$sql.= ", '".addslashes($this->note_public)."'";
|
||||||
$sql.= ", '".$this->modelpdf."',".$this->db->idate($this->fin_validite)."'";
|
$sql.= ", '".$this->modelpdf."'";
|
||||||
$sql.= ", ".$this->cond_reglement_id.", ".$this->mode_reglement_id;
|
$sql.= ", ".$this->db->idate($this->fin_validite);
|
||||||
|
$sql.= ", ".$this->cond_reglement_id;
|
||||||
|
$sql.= ", ".$this->mode_reglement_id;
|
||||||
$sql.= ", '".addslashes($this->ref_client)."'";
|
$sql.= ", '".addslashes($this->ref_client)."'";
|
||||||
$sql.= ", ".($this->date_livraison!=''?$this->db->idate($this->date_livraison):'null');
|
$sql.= ", ".($this->date_livraison!=''?$this->db->idate($this->date_livraison):'null');
|
||||||
$sql.= ", ".$conf->entity;
|
$sql.= ", ".$conf->entity;
|
||||||
@ -586,6 +611,7 @@ class Propal extends CommonObject
|
|||||||
$sql.= " SET fk_projet=".$this->projetidp;
|
$sql.= " SET fk_projet=".$this->projetidp;
|
||||||
$sql.= " WHERE ref='".$this->ref."'";
|
$sql.= " WHERE ref='".$this->ref."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -596,6 +622,7 @@ class Propal extends CommonObject
|
|||||||
$sql.= " SET fk_adresse_livraison = ".$this->adresse_livraison_id;
|
$sql.= " SET fk_adresse_livraison = ".$this->adresse_livraison_id;
|
||||||
$sql.= " WHERE ref = '".$this->ref."'";
|
$sql.= " WHERE ref = '".$this->ref."'";
|
||||||
$sql.= " AND entity = ".$conf->entity;
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
$result=$this->db->query($sql);
|
$result=$this->db->query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user