[CORE] avancement du mercredi matin (#new_ask_price).

This commit is contained in:
phf
2015-01-28 10:33:15 +01:00
parent 49fa0056c8
commit 903f739449
14 changed files with 384 additions and 67 deletions

View File

@@ -0,0 +1,157 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* 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/comm/admin/propal_extrafields.php
* \ingroup propal
* \brief Page to setup extra fields of third party
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$langs->load("companies");
$langs->load("admin");
$langs->load('askpricesupplier');
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='askpricesupplier'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject=$langs->transnoentitiesnoconv("Proposals");
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
$head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributes', $langs->trans("CommRequests"), 0, 'askpricesupplier');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td align="center">'.$langs->trans("Position").'</td>';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_pos[$key]."</td>\n";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
// $i++;
}
print "</table>";
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a></div>';
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();

View File

@@ -0,0 +1,159 @@
<?php
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
*
* 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/comm/admin/propaldet_extrafields.php
* \ingroup order
* \brief Page to setup extra fields of order
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
if (!$user->admin)
accessforbidden();
$langs->load("admin");
$langs->load("other");
$langs->load("askpricesupplier");
$extrafields = new ExtraFields($db);
$form = new Form($db);
// List of supported format
$tmptype2label=ExtraFields::$type2label;
$type2label=array('');
foreach ($tmptype2label as $key => $val) $type2label[$key]=$langs->trans($val);
$action=GETPOST('action', 'alpha');
$attrname=GETPOST('attrname', 'alpha');
$elementtype='askpricesupplierdet'; //Must be the $table_element of the class that manage extrafield
if (!$user->admin) accessforbidden();
/*
* Actions
*/
require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
/*
* View
*/
$textobject=$langs->transnoentitiesnoconv("CommRequests");
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
$head = propal_admin_prepare_head();
dol_fiche_head($head, 'attributeslines', $langs->trans("CommRequests"), 0, 'askpricesupplier');
print $langs->trans("DefineHereComplementaryAttributes",$textobject).'<br>'."\n";
print '<br>';
// Load attribute_label
$extrafields->fetch_name_optionals_label($elementtype);
print "<table summary=\"listofattributes\" class=\"noborder\" width=\"100%\">";
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Label").'</td>';
print '<td>'.$langs->trans("AttributeCode").'</td>';
print '<td>'.$langs->trans("Type").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="center">'.$langs->trans("Unique").'</td>';
print '<td align="center">'.$langs->trans("Required").'</td>';
print '<td width="80">&nbsp;</td>';
print "</tr>\n";
$var=True;
foreach($extrafields->attribute_type as $key => $value)
{
$var=!$var;
print "<tr ".$bc[$var].">";
print "<td>".$extrafields->attribute_label[$key]."</td>\n";
print "<td>".$key."</td>\n";
print "<td>".$type2label[$extrafields->attribute_type[$key]]."</td>\n";
print '<td align="right">'.$extrafields->attribute_size[$key]."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_unique[$key])."</td>\n";
print '<td align="center">'.yn($extrafields->attribute_required[$key])."</td>\n";
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit&attrname='.$key.'">'.img_edit().'</a>';
print "&nbsp; <a href=\"".$_SERVER["PHP_SELF"]."?action=delete&attrname=$key\">".img_delete()."</a></td>\n";
print "</tr>";
}
print "</table>";
dol_fiche_end();
// Buttons
if ($action != 'create' && $action != 'edit')
{
print '<div class="tabsAction">';
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
print "</div>";
}
/* ************************************************************************** */
/* */
/* Creation d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'create')
{
print "<br>";
print_titre($langs->trans('NewAttribute'));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
}
/* ************************************************************************** */
/* */
/* Edition d'un champ optionnel */
/* */
/* ************************************************************************** */
if ($action == 'edit' && ! empty($attrname))
{
print "<br>";
print_titre($langs->trans("FieldEdition", $attrname));
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
}
llxFooter();
$db->close();

View File

@@ -1190,7 +1190,7 @@ llxHeader('', $langs->trans('CommRequests'), 'EN:Commercial_Proposals|FR:Proposi
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formpropal = new FormPropal($db); $formaskpricesupplier = new FormAskPriceSupplier($db);
$companystatic = new Societe($db); $companystatic = new Societe($db);
$now = dol_now(); $now = dol_now();

View File

@@ -27,11 +27,11 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$langs->load('propal'); $langs->load('askpricesupplier');
$langs->load("bills"); $langs->load("bills");
$langs->load('compta'); $langs->load('compta');
@@ -40,7 +40,7 @@ $socid=0;
$id = GETPOST('id','int'); $id = GETPOST('id','int');
$ref = GETPOST("ref"); $ref = GETPOST("ref");
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propal', $id); $result = restrictedArea($user, 'askpricesupplier', $id);
/* /*
@@ -52,7 +52,7 @@ llxHeader();
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
{ {
$object = new Propal($db); $object = new AskPriceSupplier($db);
if ($object->fetch($id,$ref) > 0) if ($object->fetch($id,$ref) > 0)
{ {
@@ -60,7 +60,7 @@ if ($id > 0 || ! empty($ref))
$soc->fetch($object->socid); $soc->fetch($object->socid);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'preview', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'preview', $langs->trans('CommRequest'), 0, 'askpricesupplier');
/* /*

View File

@@ -25,9 +25,9 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
@@ -43,9 +43,9 @@ $action=GETPOST('action','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propal', $id); $result = restrictedArea($user, 'askpricesupplier', $id);
$object = new Propal($db); $object = new AskPriceSupplier($db);
// Load object // Load object
if ($id > 0 || ! empty($ref)) if ($id > 0 || ! empty($ref))
@@ -69,7 +69,7 @@ if (! $error)
} }
else else
{ {
header('Location: '.DOL_URL_ROOT.'/comm/propal/list.php'); header('Location: '.DOL_URL_ROOT.'/comm/askpricesupplier/list.php');
exit; exit;
} }
@@ -78,7 +78,7 @@ else
* Ajout d'un nouveau contact * Ajout d'un nouveau contact
*/ */
if ($action == 'addcontact' && $user->rights->propale->creer) if ($action == 'addcontact' && $user->rights->askpricesupplier->creer)
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
@@ -106,7 +106,7 @@ if ($action == 'addcontact' && $user->rights->propale->creer)
} }
// Bascule du statut d'un contact // Bascule du statut d'un contact
else if ($action == 'swapstatut' && $user->rights->propale->creer) else if ($action == 'swapstatut' && $user->rights->askpricesupplier->creer)
{ {
if ($object->id > 0) if ($object->id > 0)
{ {
@@ -115,7 +115,7 @@ else if ($action == 'swapstatut' && $user->rights->propale->creer)
} }
// Efface un contact // Efface un contact
else if ($action == 'deletecontact' && $user->rights->propale->creer) else if ($action == 'deletecontact' && $user->rights->askpricesupplier->creer)
{ {
$result = $object->delete_contact($lineid); $result = $object->delete_contact($lineid);
@@ -130,7 +130,7 @@ else if ($action == 'deletecontact' && $user->rights->propale->creer)
} }
} }
else if ($action == 'setaddress' && $user->rights->propale->creer) else if ($action == 'setaddress' && $user->rights->askpricesupplier->creer)
{ {
$result=$object->setDeliveryAddress($_POST['fk_address']); $result=$object->setDeliveryAddress($_POST['fk_address']);
if ($result < 0) dol_print_error($db,$object->error); if ($result < 0) dol_print_error($db,$object->error);
@@ -141,7 +141,7 @@ else if ($action == 'setaddress' && $user->rights->propale->creer)
* View * 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); $form = new Form($db);
$formcompany= new FormCompany($db); $formcompany= new FormCompany($db);
@@ -150,14 +150,14 @@ $formother = new FormOther($db);
if ($object->id > 0) if ($object->id > 0)
{ {
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'contact', $langs->trans("Proposal"), 0, 'propal'); dol_fiche_head($head, 'contact', $langs->trans("CommRequest"), 0, 'askpricesupplier');
/* /*
* Propal synthese pour rappel * Propal synthese pour rappel
*/ */
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
@@ -194,7 +194,7 @@ if ($object->id > 0)
if ($action == 'editdelivery_address') if ($action == 'editdelivery_address')
{ {
$formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','propal',$object->id); $formother->form_address($_SERVER['PHP_SELF'].'?id='.$object->id,$object->fk_delivery_address,$object->socid,'fk_address','askpricesupplier',$object->id);
} }
else else
{ {

View File

@@ -26,8 +26,8 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
@@ -47,7 +47,7 @@ if (! empty($user->societe_id))
$action=''; $action='';
$socid = $user->societe_id; $socid = $user->societe_id;
} }
$result = restrictedArea($user, 'propal', $id); $result = restrictedArea($user, 'askpricesupplier', $id);
// Get parameters // Get parameters
$sortfield = GETPOST("sortfield",'alpha'); $sortfield = GETPOST("sortfield",'alpha');
@@ -60,12 +60,12 @@ $pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC"; if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="name"; if (! $sortfield) $sortfield="name";
$object = new Propal($db); $object = new AskPriceSupplier($db);
$object->fetch($id,$ref); $object->fetch($id,$ref);
if ($object->id > 0) if ($object->id > 0)
{ {
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->askpricesupplier->dir_output.'/'.dol_sanitizeFileName($object->ref);
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
} }
@@ -79,7 +79,7 @@ if ($object->id > 0)
* View * 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); $form = new Form($db);
@@ -88,7 +88,7 @@ if ($object->id > 0)
$upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->dir_output.'/'.dol_sanitizeFileName($object->ref);
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'document', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'document', $langs->trans('CommRequest'), 0, 'askpricesupplier');
// Construit liste des fichiers // Construit liste des fichiers
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1); $filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
@@ -101,7 +101,7 @@ if ($object->id > 0)
print '<table class="border"width="100%">'; print '<table class="border"width="100%">';
$linkback='<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
@@ -130,8 +130,8 @@ if ($object->id > 0)
print '</div>'; print '</div>';
$modulepart = 'propal'; $modulepart = 'askpricesupplier';
$permission = $user->rights->propal->creer; $permission = $user->rights->askpricesupplier->creer;
$param = '&id=' . $object->id; $param = '&id=' . $object->id;
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php'; include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
} }

View File

@@ -25,10 +25,10 @@
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
$langs->load('propal'); $langs->load('askpricesupplier');
$langs->load('compta'); $langs->load('compta');
$id=GETPOST('id','int'); $id=GETPOST('id','int');
@@ -36,21 +36,21 @@ $socid=GETPOST('socid','int');
// Security check // Security check
if (! empty($user->societe_id)) $socid=$user->societe_id; if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'propal', $id); $result = restrictedArea($user, 'askpricesupplier', $id);
/* /*
* View * 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');
$object = new Propal($db); $object = new AskPriceSupplier($db);
$object->fetch($id); $object->fetch($id);
$object->fetch_thirdparty(); $object->fetch_thirdparty();
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'info', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'askpricesupplier');
$object->info($object->id); $object->info($object->id);

View File

@@ -126,7 +126,7 @@ llxHeader('',$langs->trans('CommRequest'),'EN:Commercial_Proposals|FR:Propositio
$form = new Form($db); $form = new Form($db);
$formother = new FormOther($db); $formother = new FormOther($db);
$formfile = new FormFile($db); $formfile = new FormFile($db);
$formpropal = new FormAskPriceSupplier($db); $formaskpricesupplier = new FormAskPriceSupplier($db);
$companystatic=new Societe($db); $companystatic=new Societe($db);
$now=dol_now(); $now=dol_now();
@@ -145,7 +145,7 @@ $limit = $conf->liste_limit;
$sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,'; $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,'; $sql.= ' p.rowid as askpricesupplierid, 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,"; if (! $user->rights->societe->client->voir && ! $socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= ' u.login'; $sql.= ' u.login';
$sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'askpricesupplier as p'; $sql.= ' FROM '.MAIN_DB_PREFIX.'societe as s, '.MAIN_DB_PREFIX.'askpricesupplier as p';
@@ -322,7 +322,7 @@ if ($result)
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">'; print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
$formpropal->selectProposalStatus($viewstatut,1); $formaskpricesupplier->selectAskPriceSupplierStatus($viewstatut,1);
print '</td>'; print '</td>';
print '<td class="liste_titre" align="right">'; print '<td class="liste_titre" align="right">';
@@ -366,7 +366,7 @@ if ($result)
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">'; print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
$filename=dol_sanitizeFileName($objp->ref); $filename=dol_sanitizeFileName($objp->ref);
$filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref); $filedir=$conf->propal->dir_output . '/' . dol_sanitizeFileName($objp->ref);
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->propalid; $urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->askpricesupplierid;
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir); print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
print '</td></tr></table>'; print '</td></tr></table>';

View File

@@ -26,10 +26,10 @@
*/ */
require '../../main.inc.php'; require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/propal.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
$langs->load('propal'); $langs->load('askpricesupplier');
$langs->load('compta'); $langs->load('compta');
$langs->load('bills'); $langs->load('bills');
@@ -39,7 +39,7 @@ $action=GETPOST('action','alpha');
// Security check // Security check
if ($user->societe_id) $socid=$user->societe_id; if ($user->societe_id) $socid=$user->societe_id;
$result = restrictedArea($user, 'propale', $id, 'propal'); $result = restrictedArea($user, 'askpricesupplier', $id, 'askpricesupplier');
$object = new Propal($db); $object = new Propal($db);
@@ -59,7 +59,7 @@ include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include,
/* Affichage fiche */ /* Affichage fiche */
/******************************************************************************/ /******************************************************************************/
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); $form = new Form($db);
@@ -75,11 +75,11 @@ if ($id > 0 || ! empty($ref))
if ( $societe->fetch($object->socid) ) if ( $societe->fetch($object->socid) )
{ {
$head = propal_prepare_head($object); $head = propal_prepare_head($object);
dol_fiche_head($head, 'note', $langs->trans('Proposal'), 0, 'propal'); dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'askpricesupplier');
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/propal/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>'; $linkback = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
// Ref // Ref
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">'; print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
@@ -122,7 +122,7 @@ if ($id > 0 || ! empty($ref))
// Date fin propal // Date fin propal
print '<tr>'; print '<tr>';
print '<td>'.$langs->trans('DateEndPropal').'</td><td colspan="3">'; print '<td>'.$langs->trans('DateEndAsk').'</td><td colspan="3">';
if ($object->fin_validite) if ($object->fin_validite)
{ {
print dol_print_date($object->fin_validite,'daytext'); print dol_print_date($object->fin_validite,'daytext');

View File

@@ -32,13 +32,13 @@
function propal_prepare_head($object) function propal_prepare_head($object)
{ {
global $langs, $conf, $user; global $langs, $conf, $user;
$langs->load("propal"); $langs->load("askpricesupplier");
$langs->load("compta"); $langs->load("compta");
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/comm/propal.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier.php?id='.$object->id;
$head[$h][1] = $langs->trans('ProposalCard'); $head[$h][1] = $langs->trans('ProposalCard');
$head[$h][2] = 'comm'; $head[$h][2] = 'comm';
$h++; $h++;
@@ -47,7 +47,7 @@ function propal_prepare_head($object)
|| (! empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire)))) || (! empty($conf->livraison_bon->enabled) && $user->rights->expedition->livraison->lire))))
{ {
$langs->load("sendings"); $langs->load("sendings");
$head[$h][0] = DOL_URL_ROOT.'/expedition/propal.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/expedition/askpricesupplier.php?id='.$object->id;
if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment"); if ($conf->expedition_bon->enabled) $text=$langs->trans("Shipment");
if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings"); if ($conf->livraison_bon->enabled) $text.='/'.$langs->trans("Receivings");
$head[$h][1] = $text; $head[$h][1] = $text;
@@ -56,7 +56,7 @@ function propal_prepare_head($object)
} }
if (! empty($conf->global->MAIN_USE_PREVIEW_TABS)) if (! empty($conf->global->MAIN_USE_PREVIEW_TABS))
{ {
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/apercu.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/apercu.php?id='.$object->id;
$head[$h][1] = $langs->trans("Preview"); $head[$h][1] = $langs->trans("Preview");
$head[$h][2] = 'preview'; $head[$h][2] = 'preview';
$h++; $h++;
@@ -64,7 +64,7 @@ function propal_prepare_head($object)
if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB)) if (empty($conf->global->MAIN_DISABLE_CONTACTS_TAB))
{ {
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/contact.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/contact.php?id='.$object->id;
$head[$h][1] = $langs->trans('ContactsAddresses'); $head[$h][1] = $langs->trans('ContactsAddresses');
$head[$h][2] = 'contact'; $head[$h][2] = 'contact';
$h++; $h++;
@@ -74,14 +74,14 @@ function propal_prepare_head($object)
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname); to remove a tab // $this->tabs = array('entity:-tabname); to remove a tab
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal'); complete_head_from_modules($conf,$langs,$object,$head,$h,'askpricesupplier');
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB)) if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
{ {
$nbNote = 0; $nbNote = 0;
if(!empty($object->note_private)) $nbNote++; if(!empty($object->note_private)) $nbNote++;
if(!empty($object->note_public)) $nbNote++; if(!empty($object->note_public)) $nbNote++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/note.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/note.php?id='.$object->id;
$head[$h][1] = $langs->trans('Notes'); $head[$h][1] = $langs->trans('Notes');
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>'; if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
$head[$h][2] = 'note'; $head[$h][2] = 'note';
@@ -91,18 +91,18 @@ function propal_prepare_head($object)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref); $upload_dir = $conf->propal->dir_output . "/" . dol_sanitizeFileName($object->ref);
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$')); $nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/document.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$object->id;
$head[$h][1] = $langs->trans('Documents'); $head[$h][1] = $langs->trans('Documents');
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>'; if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
$head[$h][2] = 'document'; $head[$h][2] = 'document';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/propal/info.php?id='.$object->id; $head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/info.php?id='.$object->id;
$head[$h][1] = $langs->trans('Info'); $head[$h][1] = $langs->trans('Info');
$head[$h][2] = 'info'; $head[$h][2] = 'info';
$h++; $h++;
complete_head_from_modules($conf,$langs,$object,$head,$h,'propal','remove'); complete_head_from_modules($conf,$langs,$object,$head,$h,'askpricesupplier','remove');
return $head; return $head;
} }
@@ -119,7 +119,7 @@ function propal_admin_prepare_head()
$h = 0; $h = 0;
$head = array(); $head = array();
$head[$h][0] = DOL_URL_ROOT.'/admin/propal.php'; $head[$h][0] = DOL_URL_ROOT.'/admin/askpricesupplier.php';
$head[$h][1] = $langs->trans("Miscellaneous"); $head[$h][1] = $langs->trans("Miscellaneous");
$head[$h][2] = 'general'; $head[$h][2] = 'general';
$h++; $h++;
@@ -128,19 +128,19 @@ function propal_admin_prepare_head()
// Entries must be declared in modules descriptor with line // Entries must be declared in modules descriptor with line
// $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab
// $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab // $this->tabs = array('entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to remove a tab
complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin'); complete_head_from_modules($conf,$langs,null,$head,$h,'askpricesupplier_admin');
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propal_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/comm/admin/askpricesupplier_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFields"); $head[$h][1] = $langs->trans("ExtraFields");
$head[$h][2] = 'attributes'; $head[$h][2] = 'attributes';
$h++; $h++;
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/propaldet_extrafields.php'; $head[$h][0] = DOL_URL_ROOT.'/comm/admin/askpricesupplierdet_extrafields.php';
$head[$h][1] = $langs->trans("ExtraFieldsLines"); $head[$h][1] = $langs->trans("ExtraFieldsLines");
$head[$h][2] = 'attributeslines'; $head[$h][2] = 'attributeslines';
$h++; $h++;
complete_head_from_modules($conf,$langs,null,$head,$h,'propal_admin','remove'); complete_head_from_modules($conf,$langs,null,$head,$h,'askpricesupplier_admin','remove');
return $head; return $head;
} }

View File

@@ -46,7 +46,7 @@ $savingdocmask='';
if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX)) if (empty($conf->global->MAIN_DISABLE_SUGGEST_REF_AS_PREFIX))
{ {
//var_dump($modulepart); //var_dump($modulepart);
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','ficheinter','contract','project','project_task'))) if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal', 'askpricesupplier','ficheinter','contract','project','project_task')))
{ {
$savingdocmask=$object->ref.'___file__'; $savingdocmask=$object->ref.'___file__';
} }

View File

@@ -50,6 +50,7 @@ if (! empty($conf->global->MAIN_AUTO_TIMESTAMP_IN_PRIVATE_NOTES))
// Special cases // Special cases
if ($module == 'propal') { $permission=$user->rights->propale->creer;} if ($module == 'propal') { $permission=$user->rights->propale->creer;}
elseif ($module == 'askpricesupplier') { $permission=$user->rights->askpricesupplier->creer;}
elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;} elseif ($module == 'fichinter') { $permission=$user->rights->ficheinter->creer;}
elseif ($module == 'project') { $permission=$user->rights->projet->creer;} elseif ($module == 'project') { $permission=$user->rights->projet->creer;}
elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;} elseif ($module == 'project_task') { $permission=$user->rights->projet->creer;}

View File

@@ -42,7 +42,7 @@ class Societe extends CommonObject
public $element='societe'; public $element='societe';
public $table_element = 'societe'; public $table_element = 'societe';
public $fk_element='fk_soc'; public $fk_element='fk_soc';
protected $childtables=array("propal","commande","facture","contrat","facture_fourn","commande_fournisseur"); // To test if we can delete object protected $childtables=array("askpricesupplier", "propal","commande","facture","contrat","facture_fourn","commande_fournisseur"); // To test if we can delete object
/** /**
* 0=No test on entity, 1=Test with field entity, 2=Test with link by societe * 0=No test on entity, 1=Test with field entity, 2=Test with link by societe