forked from Wavyzz/dolibarr
[CORE] Avancement des replace (#new_ask_price).
This commit is contained in:
@@ -33,14 +33,14 @@
|
||||
require '../../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formpropal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formaskpricesupplier.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||
if (! empty($conf->projet->enabled))
|
||||
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
|
||||
|
||||
$langs->load('companies');
|
||||
$langs->load('propal');
|
||||
$langs->load('askpricesupplier');
|
||||
$langs->load('compta');
|
||||
$langs->load('bills');
|
||||
$langs->load('orders');
|
||||
@@ -57,7 +57,7 @@ $search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||
$search_author=GETPOST('search_author','alpha');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$viewstatut=$db->escape(GETPOST('viewstatut'));
|
||||
$object_statut=$db->escape(GETPOST('propal_statut'));
|
||||
$object_statut=$db->escape(GETPOST('askpricesupplier_statut'));
|
||||
|
||||
$sall=GETPOST("sall");
|
||||
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||
@@ -68,7 +68,7 @@ $month=GETPOST("month");
|
||||
$NBLINES=4;
|
||||
|
||||
// Security check
|
||||
$module='propal';
|
||||
$module='askpricesupplier';
|
||||
$dbtable='';
|
||||
$objectid='';
|
||||
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||
@@ -121,12 +121,12 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('',$langs->trans('Proposal'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
|
||||
llxHeader('',$langs->trans('CommRequest'),'EN:Commercial_Proposals|FR:Proposition_commerciale|ES:Presupuestos');
|
||||
|
||||
$form = new Form($db);
|
||||
$formother = new FormOther($db);
|
||||
$formfile = new FormFile($db);
|
||||
$formpropal = new FormPropal($db);
|
||||
$formpropal = new FormAskPriceSupplier($db);
|
||||
$companystatic=new Societe($db);
|
||||
|
||||
$now=dol_now();
|
||||
@@ -148,8 +148,8 @@ $sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||
$sql.= ' p.rowid as propalid, p.note_private, p.total_ht, p.ref, p.ref_client, p.fk_statut, p.fk_user_author, p.datep as dp, p.fin_validite as dfv,';
|
||||
if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
|
||||
$sql.= ' u.login';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'propal as p';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'propaldet as pd ON p.rowid=pd.fk_propal';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'askpricesupplier as p';
|
||||
if ($sall) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'askpricesupplierdet as pd ON p.rowid=pd.fk_askpricesupplier';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as u ON p.fk_user_author = u.rowid';
|
||||
// We'll need this table joined to the select in order to filter by sale
|
||||
if ($search_sale > 0 || (! $user->rights->societe->client->voir && ! $socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
@@ -208,7 +208,7 @@ else if ($year > 0)
|
||||
if ($search_sale > 0) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$search_sale;
|
||||
if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='propal' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
$sql.= " AND c.fk_c_type_contact = tc.rowid AND tc.element='askpricesupplier' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||
}
|
||||
|
||||
|
||||
@@ -227,7 +227,7 @@ $result=$db->query($sql);
|
||||
|
||||
if ($result)
|
||||
{
|
||||
$objectstatic=new Propal($db);
|
||||
$objectstatic=new AskPriceSupplier($db);
|
||||
$userstatic=new User($db);
|
||||
$num = $db->num_rows($result);
|
||||
|
||||
@@ -248,7 +248,7 @@ if ($result)
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_author) $param.='&search_author='.$search_author;
|
||||
if ($search_town) $param.='&search_town='.$search_town;
|
||||
print_barre_liste($langs->trans('ListOfProposals').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
print_barre_liste($langs->trans('ListOfAskPriceSupplier').' '.($socid?'- '.$soc->name:''), $page, $_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
// Lignes des champs de filtre
|
||||
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'">';
|
||||
@@ -344,7 +344,7 @@ if ($result)
|
||||
print '<tr '.$bc[$var].'>';
|
||||
print '<td class="nowrap">';
|
||||
|
||||
$objectstatic->id=$objp->propalid;
|
||||
$objectstatic->id=$objp->askpricesupplierid;
|
||||
$objectstatic->ref=$objp->ref;
|
||||
|
||||
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||
@@ -353,11 +353,11 @@ if ($result)
|
||||
print '</td>';
|
||||
|
||||
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->propal->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if ($objp->fk_statut == 1 && $db->jdate($objp->dfv) < ($now - $conf->askpricesupplier->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||
if (! empty($objp->note_private))
|
||||
{
|
||||
print ' <span class="note">';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$objp->propalid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '<a href="'.DOL_URL_ROOT.'/comm/propal/note.php?id='.$objp->askpricesupplierid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||
print '</span>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
104
htdocs/core/class/html.formaskpricesupplier.class.php
Normal file
104
htdocs/core/class/html.formaskpricesupplier.class.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* 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 3 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/core/class/html.formpropal.class.php
|
||||
* \ingroup core
|
||||
* \brief File of class with all html predefined components
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Class to manage generation of HTML components for proposal management
|
||||
*/
|
||||
class FormAskPriceSupplier
|
||||
{
|
||||
var $db;
|
||||
var $error;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return combo list of differents status of a proposal
|
||||
* Values are id of table c_propalst
|
||||
*
|
||||
* @param string $selected Preselected value
|
||||
* @param int $short Use short labels
|
||||
* @return void
|
||||
*/
|
||||
function selectAskPriceSupplierStatus($selected='',$short=0)
|
||||
{
|
||||
global $langs;
|
||||
|
||||
$sql = "SELECT id, code, label, active FROM ".MAIN_DB_PREFIX."c_propalst";
|
||||
$sql .= " WHERE active = 1";
|
||||
|
||||
dol_syslog(get_class($this)."::selectAskPriceSupplierStatus", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
print '<select class="flat" name="askpricesupplier_statut">';
|
||||
print '<option value=""> </option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
if ($selected == $obj->id)
|
||||
{
|
||||
print '<option value="'.$obj->id.'" selected="selected">';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<option value="'.$obj->id.'">';
|
||||
}
|
||||
$key=$obj->code;
|
||||
if ($langs->trans("PropalStatus".$key.($short?'Short':'')) != "PropalStatus".$key.($short?'Short':''))
|
||||
{
|
||||
print $langs->trans("PropalStatus".$key.($short?'Short':''));
|
||||
}
|
||||
else
|
||||
{
|
||||
$conv_to_new_code=array('PR_DRAFT'=>'Draft','PR_OPEN'=>'Opened','PR_CLOSED'=>'Closed','PR_SIGNED'=>'Signed','PR_NOTSIGNED'=>'NotSigned','PR_FAC'=>'Billed');
|
||||
if (! empty($conv_to_new_code[$obj->code])) $key=$conv_to_new_code[$obj->code];
|
||||
print ($langs->trans("PropalStatus".$key.($short?'Short':''))!="PropalStatus".$key.($short?'Short':''))?$langs->trans("PropalStatus".$key.($short?'Short':'')):$obj->label;
|
||||
}
|
||||
print '</option>';
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
print '</select>';
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ abstract class ModelePDFAskPriceSupplier extends CommonDocGenerator
|
||||
/**
|
||||
* Classe mere des modeles de numerotation des references de propales
|
||||
*/
|
||||
abstract class ModeleNumRefPropales
|
||||
abstract class ModeleNumRefAskPriceSupplier
|
||||
{
|
||||
var $error='';
|
||||
|
||||
@@ -158,7 +158,7 @@ abstract class ModeleNumRefPropales
|
||||
* @return int 0 if KO, 1 if OK
|
||||
* @deprecated Use the new function generateDocument of Propal class
|
||||
*/
|
||||
function propale_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
function askpricesupplier_pdf_create(DoliDB $db, Propal $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||
{
|
||||
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
}
|
||||
|
||||
@@ -250,6 +250,11 @@ class modAskPriceSupplier extends DolibarrModules
|
||||
|
||||
/*
|
||||
*
|
||||
DROP TABLE llx_askpricesupplier_extrafields;
|
||||
DROP TABLE llx_askpricesupplierdet_extrafields;
|
||||
DROP TABLE llx_askpricesupplierdet;
|
||||
DROP TABLE llx_askpricesupplier;
|
||||
*
|
||||
* CREATE TABLE IF NOT EXISTS llx_askpricesupplier (
|
||||
rowid INT AUTO_INCREMENT,
|
||||
fk_statut INT NOT NULL,
|
||||
|
||||
@@ -80,6 +80,7 @@ ConfirmReOpenAsk=Êtes-vous sûr de vouloir réouvrir la demande de prix <b>%s</
|
||||
SendAskByMail=Envoyer demande de prix par email
|
||||
SendAskRef=Envoi de la demande de prix %s
|
||||
|
||||
ListOfAskPriceSupplier=Liste des devis/propositions commerciales
|
||||
|
||||
##### Types de contacts #####
|
||||
TypeContact_askpricesupplier_internal_SALESREPFOLL=Commercial suivi demande
|
||||
@@ -89,7 +90,6 @@ TypeContact_askpricesupplier_external_CUSTOMER=Contact client suivi demande
|
||||
# #
|
||||
|
||||
|
||||
ListOfProposals=Liste des devis/propositions commerciales
|
||||
ActionsOnPropal=Événements sur la proposition
|
||||
NoOpenedPropals=Pas de proposition ouverte
|
||||
NoOtherOpenedPropals=Pas d'autre proposition brouillon
|
||||
|
||||
Reference in New Issue
Block a user