forked from Wavyzz/dolibarr
NEW: Add module "Supplier commercial proposals" to requests
quotation/price to suppliers. Merge branch 'new_ask_price' of https://github.com/atm-ph/dolibarr into atm-ph-new_ask_price Conflicts: htdocs/core/class/commonobject.class.php htdocs/core/class/html.formfile.class.php htdocs/core/tpl/document_actions_post_headers.tpl.php htdocs/core/tpl/objectline_edit.tpl.php htdocs/core/tpl/objectline_view.tpl.php htdocs/fourn/class/fournisseur.commande.class.php htdocs/fourn/commande/card.php htdocs/install/mysql/migration/3.7.0-3.8.0.sql
This commit is contained in:
12
ChangeLog
12
ChangeLog
@@ -14,8 +14,10 @@ For users:
|
|||||||
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
MARGIN_PMP_AS_DEFAULT_BUY_PRICE to replace with first supplier price.
|
||||||
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
- Introduce option MAIN_HTML_TITLE to start to control format of html title content.
|
||||||
- Add extrafields on bank account cards.
|
- Add extrafields on bank account cards.
|
||||||
- Added delay between mails in Newsletter module
|
- Added delay between mails in Newsletter module.
|
||||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user
|
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user.
|
||||||
|
- Add experimental module ask supplier price to request supplier quotation.
|
||||||
|
- Add experimental module batch management.
|
||||||
|
|
||||||
For translators:
|
For translators:
|
||||||
- Update language files.
|
- Update language files.
|
||||||
@@ -25,6 +27,12 @@ For developers:
|
|||||||
- New: Function yn can show a visual checkbox.
|
- New: Function yn can show a visual checkbox.
|
||||||
- New: Introduced select2 jquery plugin.
|
- New: Introduced select2 jquery plugin.
|
||||||
|
|
||||||
|
WARNING: Following changes may create regression for some external modules, but was necessary to make
|
||||||
|
Dolibarr better:
|
||||||
|
- Removed hoo supplierorderdao into supplier order creation. This is a business event, so we must use the
|
||||||
|
trigger ORDER_SUPPLIER_CREATE instead.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
***** ChangeLog for 3.7 compared to 3.6.* *****
|
***** ChangeLog for 3.7 compared to 3.6.* *****
|
||||||
For users:
|
For users:
|
||||||
|
|||||||
599
htdocs/admin/askpricesupplier.php
Normal file
599
htdocs/admin/askpricesupplier.php
Normal file
@@ -0,0 +1,599 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||||
|
* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("errors");
|
||||||
|
$langs->load('other');
|
||||||
|
$langs->load('askpricesupplier');
|
||||||
|
|
||||||
|
if (! $user->admin) accessforbidden();
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$value = GETPOST('value','alpha');
|
||||||
|
$label = GETPOST('label','alpha');
|
||||||
|
$scandir = GETPOST('scandir','alpha');
|
||||||
|
$type='askpricesupplier';
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
$error=0;
|
||||||
|
if ($action == 'updateMask')
|
||||||
|
{
|
||||||
|
$maskconstaskpricesupplier=GETPOST('maskconstaskpricesupplier','alpha');
|
||||||
|
$maskaskpricesupplier=GETPOST('maskaskpricesupplier','alpha');
|
||||||
|
if ($maskconstaskpricesupplier) $res = dolibarr_set_const($db,$maskconstaskpricesupplier,$maskaskpricesupplier,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'specimen')
|
||||||
|
{
|
||||||
|
$modele=GETPOST('module','alpha');
|
||||||
|
|
||||||
|
$askpricesupplier = new AskPriceSupplier($db);
|
||||||
|
$askpricesupplier->initAsSpecimen();
|
||||||
|
|
||||||
|
// Search template files
|
||||||
|
$file=''; $classname=''; $filefound=0;
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
foreach($dirmodels as $reldir)
|
||||||
|
{
|
||||||
|
$file=dol_buildpath($reldir."core/modules/askpricesupplier/doc/pdf_".$modele.".modules.php");
|
||||||
|
if (file_exists($file))
|
||||||
|
{
|
||||||
|
$filefound=1;
|
||||||
|
$classname = "pdf_".$modele;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($filefound)
|
||||||
|
{
|
||||||
|
require_once $file;
|
||||||
|
|
||||||
|
$module = new $classname($db);
|
||||||
|
|
||||||
|
if ($module->write_file($askpricesupplier,$langs) > 0)
|
||||||
|
{
|
||||||
|
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=askpricesupplier&file=SPECIMEN.pdf");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($module->error,'errors');
|
||||||
|
dol_syslog($module->error, LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("ErrorModuleNotFound"),'errors');
|
||||||
|
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'set_ASKPRICESUPPLIER_DRAFT_WATERMARK')
|
||||||
|
{
|
||||||
|
$draft = GETPOST('ASKPRICESUPPLIER_DRAFT_WATERMARK','alpha');
|
||||||
|
|
||||||
|
$res = dolibarr_set_const($db, "ASKPRICESUPPLIER_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'set_ASKPRICESUPPLIER_FREE_TEXT')
|
||||||
|
{
|
||||||
|
$freetext = GETPOST('ASKPRICESUPPLIER_FREE_TEXT'); // No alpha here, we want exact string
|
||||||
|
|
||||||
|
$res = dolibarr_set_const($db, "ASKPRICESUPPLIER_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($action == 'set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER')
|
||||||
|
{
|
||||||
|
$res = dolibarr_set_const($db, "BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER",$value,'chaine',0,'',$conf->entity);
|
||||||
|
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Define constants for submodules that contains parameters (forms with param1, param2, ... and value1, value2, ...)
|
||||||
|
if ($action == 'setModuleOptions')
|
||||||
|
{
|
||||||
|
$post_size=count($_POST);
|
||||||
|
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
for($i=0;$i < $post_size;$i++)
|
||||||
|
{
|
||||||
|
if (array_key_exists('param'.$i,$_POST))
|
||||||
|
{
|
||||||
|
$param=GETPOST("param".$i,'alpha');
|
||||||
|
$value=GETPOST("value".$i,'alpha');
|
||||||
|
if ($param) $res = dolibarr_set_const($db,$param,$value,'chaine',0,'',$conf->entity);
|
||||||
|
if (! $res > 0) $error++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (! $error)
|
||||||
|
{
|
||||||
|
$db->commit();
|
||||||
|
setEventMessage($langs->trans("SetupSaved"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$db->rollback();
|
||||||
|
setEventMessage($langs->trans("Error"),'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate a model
|
||||||
|
if ($action == 'set')
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ($action == 'del')
|
||||||
|
{
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
if ($conf->global->ASKPRICESUPPLIER_ADDON_PDF == "$value") dolibarr_del_const($db, 'ASKPRICESUPPLIER_ADDON_PDF',$conf->entity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ($action == 'setdoc')
|
||||||
|
{
|
||||||
|
if (dolibarr_set_const($db, "ASKPRICESUPPLIER_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||||
|
{
|
||||||
|
$conf->global->ASKPRICESUPPLIER_ADDON_PDF = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// On active le modele
|
||||||
|
$ret = delDocumentModel($value, $type);
|
||||||
|
if ($ret > 0)
|
||||||
|
{
|
||||||
|
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ($action == 'setmod')
|
||||||
|
{
|
||||||
|
// TODO Verifier si module numerotation choisi peut etre active
|
||||||
|
// par appel methode canBeActivated
|
||||||
|
|
||||||
|
dolibarr_set_const($db, "ASKPRICESUPPLIER_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Affiche page
|
||||||
|
*/
|
||||||
|
|
||||||
|
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans("AskPriceSupplierSetup"));
|
||||||
|
|
||||||
|
$form=new Form($db);
|
||||||
|
|
||||||
|
//if ($mesg) print $mesg;
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
print_fiche_titre($langs->trans("AskPriceSupplierSetup"),$linkback,'setup');
|
||||||
|
|
||||||
|
$head = askpricesupplier_admin_prepare_head();
|
||||||
|
|
||||||
|
dol_fiche_head($head, 'general', $langs->trans("CommRequests"), 0, 'askpricesupplier');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Module numerotation
|
||||||
|
*/
|
||||||
|
print_titre($langs->trans("AskPriceSupplierNumberingModules"));
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td>'.$langs->trans("Name")."</td>\n";
|
||||||
|
print '<td>'.$langs->trans("Description")."</td>\n";
|
||||||
|
print '<td class="nowrap">'.$langs->trans("Example")."</td>\n";
|
||||||
|
print '<td align="center" width="60">'.$langs->trans("Status").'</td>';
|
||||||
|
print '<td align="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||||
|
print '</tr>'."\n";
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
foreach ($dirmodels as $reldir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/askpricesupplier/");
|
||||||
|
|
||||||
|
if (is_dir($dir))
|
||||||
|
{
|
||||||
|
$handle = opendir($dir);
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
if (substr($file, 0, 21) == 'mod_askpricesupplier_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||||
|
{
|
||||||
|
$file = substr($file, 0, dol_strlen($file)-4);
|
||||||
|
|
||||||
|
require_once $dir.$file.'.php';
|
||||||
|
|
||||||
|
$module = new $file;
|
||||||
|
|
||||||
|
// Show modules according to features level
|
||||||
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
|
||||||
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
|
||||||
|
|
||||||
|
if ($module->isEnabled())
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>'.$module->nom."</td><td>\n";
|
||||||
|
print $module->info();
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Show example of numbering module
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
$tmp=$module->getExample();
|
||||||
|
if (preg_match('/^Error/',$tmp)) print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||||
|
elseif ($tmp=='NotConfigured') print $langs->trans($tmp);
|
||||||
|
else print $tmp;
|
||||||
|
print '</td>'."\n";
|
||||||
|
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($conf->global->ASKPRICESUPPLIER_ADDON == "$file")
|
||||||
|
{
|
||||||
|
print img_picto($langs->trans("Activated"),'switch_on');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&value='.$file.'">';
|
||||||
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
||||||
|
print '</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
$askpricesupplier=new AskPriceSupplier($db);
|
||||||
|
$askpricesupplier->initAsSpecimen();
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip='';
|
||||||
|
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||||
|
$askpricesupplier->type=0;
|
||||||
|
$nextval=$module->getNextValue($mysoc,$askpricesupplier);
|
||||||
|
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||||
|
$htmltooltip.=''.$langs->trans("NextValue").': ';
|
||||||
|
if ($nextval) {
|
||||||
|
if (preg_match('/^Error/',$nextval) || $nextval=='NotConfigured')
|
||||||
|
$nextval = $langs->trans($nextval);
|
||||||
|
$htmltooltip.=$nextval.'<br>';
|
||||||
|
} else {
|
||||||
|
$htmltooltip.=$langs->trans($module->error).'<br>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<td align="center">';
|
||||||
|
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</table><br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Document templates generators
|
||||||
|
*/
|
||||||
|
|
||||||
|
print_titre($langs->trans("AskPriceSupplierPDFModules"));
|
||||||
|
|
||||||
|
// Load array def with activated templates
|
||||||
|
$def = array();
|
||||||
|
$sql = "SELECT nom";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
|
||||||
|
$sql.= " WHERE type = '".$type."'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$num_rows=$db->num_rows($resql);
|
||||||
|
while ($i < $num_rows)
|
||||||
|
{
|
||||||
|
$array = $db->fetch_array($resql);
|
||||||
|
array_push($def, $array[0]);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||||
|
print "<tr class=\"liste_titre\">\n";
|
||||||
|
print " <td>".$langs->trans("Name")."</td>\n";
|
||||||
|
print " <td>".$langs->trans("Description")."</td>\n";
|
||||||
|
print '<td align="center" width="40">'.$langs->trans("Status")."</td>\n";
|
||||||
|
print '<td align="center" width="40">'.$langs->trans("Default")."</td>\n";
|
||||||
|
print '<td align="center" width="40">'.$langs->trans("ShortInfo").'</td>';
|
||||||
|
print '<td align="center" width="40">'.$langs->trans("Preview").'</td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
clearstatcache();
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
foreach ($dirmodels as $reldir)
|
||||||
|
{
|
||||||
|
foreach (array('','/doc') as $valdir)
|
||||||
|
{
|
||||||
|
$dir = dol_buildpath($reldir."core/modules/askpricesupplier".$valdir);
|
||||||
|
|
||||||
|
if (is_dir($dir))
|
||||||
|
{
|
||||||
|
$handle=opendir($dir);
|
||||||
|
if (is_resource($handle))
|
||||||
|
{
|
||||||
|
while (($file = readdir($handle))!==false)
|
||||||
|
{
|
||||||
|
$filelist[]=$file;
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
arsort($filelist);
|
||||||
|
|
||||||
|
foreach($filelist as $file)
|
||||||
|
{
|
||||||
|
if (preg_match('/\.modules\.php$/i',$file) && preg_match('/^(pdf_|doc_)/',$file))
|
||||||
|
{
|
||||||
|
if (file_exists($dir.'/'.$file))
|
||||||
|
{
|
||||||
|
$name = substr($file, 4, dol_strlen($file) -16);
|
||||||
|
$classname = substr($file, 0, dol_strlen($file) -12);
|
||||||
|
|
||||||
|
require_once $dir.'/'.$file;
|
||||||
|
$module = new $classname($db);
|
||||||
|
|
||||||
|
$modulequalified=1;
|
||||||
|
if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) $modulequalified=0;
|
||||||
|
if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) $modulequalified=0;
|
||||||
|
|
||||||
|
if ($modulequalified)
|
||||||
|
{
|
||||||
|
$var = !$var;
|
||||||
|
print '<tr '.$bc[$var].'><td width="100">';
|
||||||
|
print (empty($module->name)?$name:$module->name);
|
||||||
|
print "</td><td>\n";
|
||||||
|
if (method_exists($module,'info')) print $module->info($langs);
|
||||||
|
else print $module->description;
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Active
|
||||||
|
if (in_array($name, $def))
|
||||||
|
{
|
||||||
|
print '<td align="center">'."\n";
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&value='.$name.'">';
|
||||||
|
print img_picto($langs->trans("Enabled"),'switch_on');
|
||||||
|
print '</a>';
|
||||||
|
print '</td>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print "<td align=\"center\">\n";
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defaut
|
||||||
|
print "<td align=\"center\">";
|
||||||
|
if ($conf->global->ASKPRICESUPPLIER_ADDON_PDF == "$name")
|
||||||
|
{
|
||||||
|
print img_picto($langs->trans("Default"),'on');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scandir='.$module->scandir.'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"),'off').'</a>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Info
|
||||||
|
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||||
|
}
|
||||||
|
$htmltooltip.='<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("Logo").': '.yn($module->option_logo,1,1);
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("PaymentMode").': '.yn($module->option_modereg,1,1);
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg,1,1);
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang,1,1);
|
||||||
|
//$htmltooltip.='<br>'.$langs->trans("Discounts").': '.yn($module->option_escompte,1,1);
|
||||||
|
//$htmltooltip.='<br>'.$langs->trans("CreditNote").': '.yn($module->option_credit_note,1,1);
|
||||||
|
$htmltooltip.='<br>'.$langs->trans("WatermarkOnDraftProposal").': '.yn($module->option_draft_watermark,1,1);
|
||||||
|
|
||||||
|
|
||||||
|
print '<td align="center">';
|
||||||
|
print $form->textwithpicto('',$htmltooltip,1,0);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Preview
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($module->type == 'pdf')
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'">'.img_object($langs->trans("Preview"),'bill').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Other options
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
print_titre($langs->trans("OtherOptions"));
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">";
|
||||||
|
print "<tr class=\"liste_titre\">";
|
||||||
|
print "<td>".$langs->trans("Parameter")."</td>\n";
|
||||||
|
print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
|
||||||
|
print "<td> </td>\n";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
$var=! $var;
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="set_ASKPRICESUPPLIER_FREE_TEXT">';
|
||||||
|
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||||
|
print $langs->trans("FreeLegalTextOnAskPriceSupplier").' ('.$langs->trans("AddCRIfTooLong").')<br>';
|
||||||
|
print '<textarea name="ASKPRICESUPPLIER_FREE_TEXT" class="flat" cols="120">'.$conf->global->ASKPRICESUPPLIER_FREE_TEXT.'</textarea>';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print "</td></tr>\n";
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
$var=!$var;
|
||||||
|
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print "<input type=\"hidden\" name=\"action\" value=\"set_ASKPRICESUPPLIER_DRAFT_WATERMARK\">";
|
||||||
|
print '<tr '.$bc[$var].'><td colspan="2">';
|
||||||
|
print $langs->trans("WatermarkOnDraftAskPriceSupplier").'<br>';
|
||||||
|
print '<input size="50" class="flat" type="text" name="ASKPRICESUPPLIER_DRAFT_WATERMARK" value="'.$conf->global->ASKPRICESUPPLIER_DRAFT_WATERMARK.'">';
|
||||||
|
print '</td><td align="right">';
|
||||||
|
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
|
||||||
|
print "</td></tr>\n";
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
if ($conf->banque->enabled)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").'</td><td> </td><td align="right">';
|
||||||
|
if (! empty($conf->use_javascript_ajax))
|
||||||
|
{
|
||||||
|
print ajax_constantonoff('BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER))
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER&value=1">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER&value=0">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER").'</td><td> </td><td align="center">'.$langs->trans('NotAvailable').'</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Directory
|
||||||
|
*/
|
||||||
|
print '<br>';
|
||||||
|
print_titre($langs->trans("PathToDocuments"));
|
||||||
|
|
||||||
|
print "<table class=\"noborder\" width=\"100%\">\n";
|
||||||
|
print "<tr class=\"liste_titre\">\n";
|
||||||
|
print " <td>".$langs->trans("Name")."</td>\n";
|
||||||
|
print " <td>".$langs->trans("Value")."</td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
print "<tr ".$bc[false].">\n <td width=\"140\">".$langs->trans("PathDirectory")."</td>\n <td>".$conf->askpricesupplier->dir_output."</td>\n</tr>\n";
|
||||||
|
print "</table>\n<br>";
|
||||||
|
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
151
htdocs/comm/admin/askpricesupplier_extrafields.php
Normal file
151
htdocs/comm/admin/askpricesupplier_extrafields.php
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
<?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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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("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 = askpricesupplier_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"> </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 " <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();
|
||||||
153
htdocs/comm/admin/askpricesupplierdet_extrafields.php
Normal file
153
htdocs/comm/admin/askpricesupplierdet_extrafields.php
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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 = askpricesupplier_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"> </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 " <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();
|
||||||
1821
htdocs/comm/askpricesupplier/card.php
Normal file
1821
htdocs/comm/askpricesupplier/card.php
Normal file
File diff suppressed because it is too large
Load Diff
2872
htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
Normal file
2872
htdocs/comm/askpricesupplier/class/askpricesupplier.class.php
Normal file
File diff suppressed because it is too large
Load Diff
0
htdocs/comm/askpricesupplier/class/index.html
Normal file
0
htdocs/comm/askpricesupplier/class/index.html
Normal file
127
htdocs/comm/askpricesupplier/document.php
Normal file
127
htdocs/comm/askpricesupplier/document.php
Normal file
@@ -0,0 +1,127 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.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
|
||||||
|
* 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/propal/document.php
|
||||||
|
* \ingroup propal
|
||||||
|
* \brief Management page of documents attached to a business proposal
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.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/images.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
|
|
||||||
|
$langs->load('compta');
|
||||||
|
$langs->load('other');
|
||||||
|
|
||||||
|
$action = GETPOST('action','alpha');
|
||||||
|
$confirm = GETPOST('confirm','alpha');
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
$ref = GETPOST('ref','alpha');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid='';
|
||||||
|
if (! empty($user->societe_id))
|
||||||
|
{
|
||||||
|
$action='';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, 'askpricesupplier', $id);
|
||||||
|
|
||||||
|
// Get parameters
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if ($page == -1) { $page = 0; }
|
||||||
|
$offset = $conf->liste_limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
if (! $sortorder) $sortorder="ASC";
|
||||||
|
if (! $sortfield) $sortfield="name";
|
||||||
|
|
||||||
|
$object = new AskPriceSupplier($db);
|
||||||
|
$object->fetch($id,$ref);
|
||||||
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
$upload_dir = $conf->askpricesupplier->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_pre_headers.tpl.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
if ($object->id > 0)
|
||||||
|
{
|
||||||
|
$upload_dir = $conf->askpricesupplier->dir_output.'/'.dol_sanitizeFileName($object->ref);
|
||||||
|
|
||||||
|
$head = askpricesupplier_prepare_head($object);
|
||||||
|
dol_fiche_head($head, 'document', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||||
|
|
||||||
|
// Construit liste des fichiers
|
||||||
|
$filearray=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$',$sortfield,(strtolower($sortorder)=='desc'?SORT_DESC:SORT_ASC),1);
|
||||||
|
$totalsize=0;
|
||||||
|
foreach($filearray as $key => $file)
|
||||||
|
{
|
||||||
|
$totalsize+=$file['size'];
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<table class="border"width="100%">';
|
||||||
|
|
||||||
|
$linkback='<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans("BackToList").'</a>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
|
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Supplier
|
||||||
|
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||||
|
print '<td colspan="3">'.$object->thirdparty->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
|
||||||
|
print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
$modulepart = 'askpricesupplier';
|
||||||
|
$permission = $user->rights->askpricesupplier->creer;
|
||||||
|
$param = '&id=' . $object->id;
|
||||||
|
include_once DOL_DOCUMENT_ROOT . '/core/tpl/document_actions_post_headers.tpl.php';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print $langs->trans("ErrorUnknown");
|
||||||
|
}
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
377
htdocs/comm/askpricesupplier/index.php
Normal file
377
htdocs/comm/askpricesupplier/index.php
Normal file
@@ -0,0 +1,377 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-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/propal/index.php
|
||||||
|
* \ingroup propal
|
||||||
|
* \brief Home page of proposal area
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
|
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$socid=GETPOST('socid','int');
|
||||||
|
if (isset($user->societe_id) && $user->societe_id > 0)
|
||||||
|
{
|
||||||
|
$action = '';
|
||||||
|
$socid = $user->societe_id;
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, 'askpricesupplier');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
$now=dol_now();
|
||||||
|
$askpricesupplierstatic=new AskPriceSupplier($db);
|
||||||
|
$companystatic=new Societe($db);
|
||||||
|
$form = new Form($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
$help_url="EN:Module_Ask_Price_Supplier|FR:Module_Demande_de_prix_fournisseur";
|
||||||
|
|
||||||
|
llxHeader("",$langs->trans("AskPriceSupplierArea"),$help_url);
|
||||||
|
|
||||||
|
print_fiche_titre($langs->trans("AskPriceSupplierArea"));
|
||||||
|
|
||||||
|
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Search form
|
||||||
|
*/
|
||||||
|
$var=false;
|
||||||
|
print '<table class="noborder nohover" width="100%">';
|
||||||
|
print '<form method="post" action="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<tr class="liste_titre"><td colspan="3">'.$langs->trans("SearchRequest").'</td></tr>';
|
||||||
|
print '<tr '.$bc[$var].'><td>';
|
||||||
|
print $langs->trans("Ref").':</td><td><input type="text" class="flat" name="sref" size=18></td><td rowspan="2"><input type="submit" value="'.$langs->trans("Search").'" class="button"></td></tr>';
|
||||||
|
print '<tr '.$bc[$var].'><td class="nowrap">'.$langs->trans("Other").':</td><td><input type="text" class="flat" name="sall" size="18"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
print "</form></table><br>\n";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Statistics
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT count(p.rowid), p.fk_statut";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."askpricesupplier as p";
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
|
if ($user->societe_id) $sql.=' AND p.fk_soc = '.$user->societe_id;
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
$sql.= " AND p.fk_statut IN (0,1,2,3,4)";
|
||||||
|
$sql.= " GROUP BY p.fk_statut";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
$total=0;
|
||||||
|
$totalinprocess=0;
|
||||||
|
$dataseries=array();
|
||||||
|
$vals=array();
|
||||||
|
// -1=Canceled, 0=Draft, 1=Validated, (2=Accepted/On process not managed for customer orders), 3=Closed (Sent/Received, billed or not)
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row)
|
||||||
|
{
|
||||||
|
//if ($row[1]!=-1 && ($row[1]!=3 || $row[2]!=1))
|
||||||
|
{
|
||||||
|
$vals[$row[1]]=$row[0];
|
||||||
|
$totalinprocess+=$row[0];
|
||||||
|
}
|
||||||
|
$total+=$row[0];
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$db->free($resql);
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Statistics").' - '.$langs->trans("CommRequests").'</td></tr>'."\n";
|
||||||
|
$var=true;
|
||||||
|
$listofstatus=array(0,1,2,3,4);
|
||||||
|
foreach ($listofstatus as $status)
|
||||||
|
{
|
||||||
|
$dataseries[]=array('label'=>$askpricesupplierstatic->LibStatut($status,1),'data'=>(isset($vals[$status])?(int) $vals[$status]:0));
|
||||||
|
if (! $conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td>'.$askpricesupplierstatic->LibStatut($status,0).'</td>';
|
||||||
|
print '<td align="right"><a href="list.php?statut='.$status.'">'.(isset($vals[$status])?$vals[$status]:0).'</a></td>';
|
||||||
|
print "</tr>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($conf->use_javascript_ajax)
|
||||||
|
{
|
||||||
|
print '<tr><td align="center" colspan="2">';
|
||||||
|
$data=array('series'=>$dataseries);
|
||||||
|
dol_print_graph('stats',300,180,$data,1,'pie',1);
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td align="right">'.$total.'</td></tr>';
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Draft askprice
|
||||||
|
*/
|
||||||
|
if (! empty($conf->askpricesupplier->enabled))
|
||||||
|
{
|
||||||
|
$sql = "SELECT c.rowid, c.ref, s.nom as socname, s.rowid as socid, s.canvas, s.client";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as c";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND c.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND c.fk_statut = 0";
|
||||||
|
if ($socid) $sql.= " AND c.fk_soc = ".$socid;
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td colspan="2">'.$langs->trans("DraftRequests").'</td></tr>';
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$var = True;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
|
||||||
|
$askpricesupplierstatic->id=$obj->rowid;
|
||||||
|
$askpricesupplierstatic->ref=$obj->ref;
|
||||||
|
print '<td class="nowrap">'.$askpricesupplierstatic->getNomUrl(1).'</td>';
|
||||||
|
|
||||||
|
$companystatic->id=$obj->socid;
|
||||||
|
$companystatic->name=$obj->socname;
|
||||||
|
$companystatic->client=$obj->client;
|
||||||
|
$companystatic->canvas=$obj->canvas;
|
||||||
|
print '<td>'.$companystatic->getNomUrl(1,'customer',24).'</td>';
|
||||||
|
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div><div class="fichetwothirdright"><div class="ficheaddleft">';
|
||||||
|
|
||||||
|
|
||||||
|
$max=5;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Last modified askprice
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sql = "SELECT c.rowid, c.ref, c.fk_statut, s.nom as socname, s.rowid as socid, s.canvas, s.client,";
|
||||||
|
$sql.= " date_cloture as datec";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier as c";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND c.entity = ".$conf->entity;
|
||||||
|
//$sql.= " AND c.fk_statut > 2";
|
||||||
|
if ($socid) $sql .= " AND c.fk_soc = ".$socid;
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
$sql.= " ORDER BY c.tms DESC";
|
||||||
|
$sql.= $db->plimit($max, 0);
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td colspan="4">'.$langs->trans("LastModifiedRequests",$max).'</td></tr>';
|
||||||
|
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
if ($num)
|
||||||
|
{
|
||||||
|
$i = 0;
|
||||||
|
$var = True;
|
||||||
|
while ($i < $num)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
|
||||||
|
print "<tr ".$bc[$var].">";
|
||||||
|
print '<td width="20%" class="nowrap">';
|
||||||
|
|
||||||
|
$askpricesupplierstatic->id=$obj->rowid;
|
||||||
|
$askpricesupplierstatic->ref=$obj->ref;
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
print '<td width="96" class="nobordernopadding nowrap">';
|
||||||
|
print $askpricesupplierstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td width="16" class="nobordernopadding nowrap">';
|
||||||
|
print ' ';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td width="16" align="right" class="nobordernopadding">';
|
||||||
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
|
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||||
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->rowid;
|
||||||
|
print $formfile->getDocumentsLink($askpricesupplierstatic->element, $filename, $filedir);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
$companystatic->id=$obj->socid;
|
||||||
|
$companystatic->name=$obj->socname;
|
||||||
|
$companystatic->client=$obj->client;
|
||||||
|
$companystatic->canvas=$obj->canvas;
|
||||||
|
print '<td>'.$companystatic->getNomUrl(1,'customer').'</td>';
|
||||||
|
|
||||||
|
print '<td>'.dol_print_date($db->jdate($obj->datec),'day').'</td>';
|
||||||
|
print '<td align="right">'.$askpricesupplierstatic->LibStatut($obj->fk_statut,5).'</td>';
|
||||||
|
print '</tr>';
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
|
else dol_print_error($db);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Opened askprice
|
||||||
|
*/
|
||||||
|
if (! empty($conf->askpricesupplier->enabled) && $user->rights->askpricesupplier->lire)
|
||||||
|
{
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
$sql = "SELECT s.nom as socname, s.rowid as socid, s.canvas, s.client, p.rowid as askpricesupplierid, p.total as total_ttc, p.total_ht, p.ref, p.fk_statut, p.datec as dp";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
|
||||||
|
$sql.= ", ".MAIN_DB_PREFIX."askpricesupplier as p";
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||||
|
$sql.= " WHERE p.fk_soc = s.rowid";
|
||||||
|
$sql.= " AND p.entity = ".$conf->entity;
|
||||||
|
$sql.= " AND p.fk_statut = 1";
|
||||||
|
if (!$user->rights->societe->client->voir && !$socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
if ($socid) $sql.= " AND s.rowid = ".$socid;
|
||||||
|
$sql.= " ORDER BY p.rowid DESC";
|
||||||
|
|
||||||
|
$result=$db->query($sql);
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$total = 0;
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
$i = 0;
|
||||||
|
if ($num > 0)
|
||||||
|
{
|
||||||
|
$var=true;
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
print '<tr class="liste_titre"><td colspan="5">'.$langs->trans("RequestsOpened").' <a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php?viewstatut=1"><span class="badge">'.$num.'</span></a></td></tr>';
|
||||||
|
|
||||||
|
$nbofloop=min($num, (empty($conf->global->MAIN_MAXLIST_OVERLOAD)?500:$conf->global->MAIN_MAXLIST_OVERLOAD));
|
||||||
|
while ($i < $nbofloop)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($result);
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<td class="nowrap" width="140">';
|
||||||
|
|
||||||
|
$askpricesupplierstatic->id=$obj->askpricesupplierid;
|
||||||
|
$askpricesupplierstatic->ref=$obj->ref;
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
print '<td class="nobordernopadding nowrap">';
|
||||||
|
print $askpricesupplierstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
print '<td width="18" class="nobordernopadding nowrap">';
|
||||||
|
if ($db->jdate($obj->dfv) < ($now - $conf->askpricesupplier->cloture->warning_delay)) print img_warning($langs->trans("Late"));
|
||||||
|
print '</td>';
|
||||||
|
print '<td width="16" align="center" class="nobordernopadding">';
|
||||||
|
$filename=dol_sanitizeFileName($obj->ref);
|
||||||
|
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($obj->ref);
|
||||||
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->askpricesupplierid;
|
||||||
|
print $formfile->getDocumentsLink($askpricesupplierstatic->element, $filename, $filedir);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print "</td>";
|
||||||
|
|
||||||
|
$companystatic->id=$obj->socid;
|
||||||
|
$companystatic->name=$obj->socname;
|
||||||
|
$companystatic->client=$obj->client;
|
||||||
|
$companystatic->canvas=$obj->canvas;
|
||||||
|
print '<td align="left">'.$companystatic->getNomUrl(1,'customer',44).'</td>'."\n";
|
||||||
|
|
||||||
|
print '<td align="right">';
|
||||||
|
print dol_print_date($db->jdate($obj->dp),'day').'</td>'."\n";
|
||||||
|
print '<td align="right">'.price($obj->total_ttc).'</td>';
|
||||||
|
print '<td align="center" width="14">'.$askpricesupplierstatic->LibStatut($obj->fk_statut,3).'</td>'."\n";
|
||||||
|
print '</tr>'."\n";
|
||||||
|
$i++;
|
||||||
|
$total += $obj->total_ttc;
|
||||||
|
}
|
||||||
|
if ($num > $nbofloop)
|
||||||
|
{
|
||||||
|
print '<tr class="liste_total"><td colspan="5">'.$langs->trans("XMoreLines", ($num - $nbofloop))."</td></tr>";
|
||||||
|
}
|
||||||
|
else if ($total>0)
|
||||||
|
{
|
||||||
|
print '<tr class="liste_total"><td colspan="3">'.$langs->trans("Total")."</td><td align=\"right\">".price($total)."</td><td> </td></tr>";
|
||||||
|
}
|
||||||
|
print "</table><br>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</div></div></div>';
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
65
htdocs/comm/askpricesupplier/info.php
Normal file
65
htdocs/comm/askpricesupplier/info.php
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-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/propal/info.php
|
||||||
|
* \ingroup propal
|
||||||
|
* \brief Page d'affichage des infos d'une proposition commerciale
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||||
|
|
||||||
|
$langs->load('askpricesupplier');
|
||||||
|
$langs->load('compta');
|
||||||
|
|
||||||
|
$id=GETPOST('id','int');
|
||||||
|
$socid=GETPOST('socid','int');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
|
$result = restrictedArea($user, 'askpricesupplier', $id);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||||
|
|
||||||
|
$object = new AskPriceSupplier($db);
|
||||||
|
$object->fetch($id);
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
|
||||||
|
$head = askpricesupplier_prepare_head($object);
|
||||||
|
dol_fiche_head($head, 'info', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||||
|
|
||||||
|
$object->info($object->id);
|
||||||
|
|
||||||
|
print '<table width="100%"><tr><td>';
|
||||||
|
dol_print_object_info($object);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print '</div>';
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
425
htdocs/comm/askpricesupplier/list.php
Normal file
425
htdocs/comm/askpricesupplier/list.php
Normal file
@@ -0,0 +1,425 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
|
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
|
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2010-2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||||
|
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||||
|
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.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
|
||||||
|
* 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/propal/list.php
|
||||||
|
* \ingroup propal
|
||||||
|
* \brief Page of commercial proposals card and list
|
||||||
|
*/
|
||||||
|
|
||||||
|
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.formaskpricesupplier.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.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('askpricesupplier');
|
||||||
|
$langs->load('compta');
|
||||||
|
$langs->load('bills');
|
||||||
|
$langs->load('orders');
|
||||||
|
$langs->load('products');
|
||||||
|
|
||||||
|
$socid=GETPOST('socid','int');
|
||||||
|
|
||||||
|
$search_user=GETPOST('search_user','int');
|
||||||
|
$search_sale=GETPOST('search_sale','int');
|
||||||
|
$search_ref=GETPOST('sf_ref')?GETPOST('sf_ref','alpha'):GETPOST('search_ref','alpha');
|
||||||
|
$search_societe=GETPOST('search_societe','alpha');
|
||||||
|
$search_montant_ht=GETPOST('search_montant_ht','alpha');
|
||||||
|
$search_author=GETPOST('search_author','alpha');
|
||||||
|
$viewstatut=$db->escape(GETPOST('viewstatut'));
|
||||||
|
$object_statut=$db->escape(GETPOST('askpricesupplier_statut'));
|
||||||
|
|
||||||
|
$sall=GETPOST("sall");
|
||||||
|
$mesg=(GETPOST("msg") ? GETPOST("msg") : GETPOST("mesg"));
|
||||||
|
$year=GETPOST("year");
|
||||||
|
$month=GETPOST("month");
|
||||||
|
|
||||||
|
// Nombre de ligne pour choix de produit/service predefinis
|
||||||
|
$NBLINES=4;
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
$module='askpricesupplier';
|
||||||
|
$dbtable='';
|
||||||
|
$objectid='';
|
||||||
|
if (! empty($user->societe_id)) $socid=$user->societe_id;
|
||||||
|
if (! empty($socid))
|
||||||
|
{
|
||||||
|
$objectid=$socid;
|
||||||
|
$module='societe';
|
||||||
|
$dbtable='&societe';
|
||||||
|
}
|
||||||
|
$result = restrictedArea($user, $module, $objectid, $dbtable);
|
||||||
|
|
||||||
|
if (GETPOST("button_removefilter") || GETPOST("button_removefilter_x")) // Both tests are required to be compatible with all browsers
|
||||||
|
{
|
||||||
|
$search_categ='';
|
||||||
|
$search_user='';
|
||||||
|
$search_sale='';
|
||||||
|
$search_ref='';
|
||||||
|
$search_societe='';
|
||||||
|
$search_montant_ht='';
|
||||||
|
$search_author='';
|
||||||
|
$year='';
|
||||||
|
$month='';
|
||||||
|
$viewstatut='';
|
||||||
|
$object_statut='';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($object_statut != '')
|
||||||
|
$viewstatut=$object_statut;
|
||||||
|
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||||
|
$hookmanager->initHooks(array('askpricesupplierlist'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
$parameters=array('socid'=>$socid);
|
||||||
|
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
$formother = new FormOther($db);
|
||||||
|
$formfile = new FormFile($db);
|
||||||
|
$formaskpricesupplier = new FormAskPriceSupplier($db);
|
||||||
|
$companystatic=new Societe($db);
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
$sortfield = GETPOST("sortfield",'alpha');
|
||||||
|
$sortorder = GETPOST("sortorder",'alpha');
|
||||||
|
$page = GETPOST("page",'int');
|
||||||
|
if ($page == -1) { $page = 0; }
|
||||||
|
$offset = $conf->liste_limit * $page;
|
||||||
|
$pageprev = $page - 1;
|
||||||
|
$pagenext = $page + 1;
|
||||||
|
|
||||||
|
if (! $sortfield) $sortfield='p.date_livraison';
|
||||||
|
if (! $sortorder) $sortorder='DESC';
|
||||||
|
$limit = $conf->liste_limit;
|
||||||
|
|
||||||
|
|
||||||
|
$sql = 'SELECT s.rowid, s.nom as name, s.town, s.client, s.code_client,';
|
||||||
|
$sql.= ' p.rowid as askpricesupplierid, p.note_private, p.total_ht, p.ref, p.fk_statut, p.fk_user_author, p.date_livraison as dp,';
|
||||||
|
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.'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";
|
||||||
|
if ($search_user > 0)
|
||||||
|
{
|
||||||
|
$sql.=", ".MAIN_DB_PREFIX."element_contact as c";
|
||||||
|
$sql.=", ".MAIN_DB_PREFIX."c_type_contact as tc";
|
||||||
|
}
|
||||||
|
$sql.= ' WHERE p.fk_soc = s.rowid';
|
||||||
|
$sql.= ' AND p.entity = '.$conf->entity;
|
||||||
|
if (! $user->rights->societe->client->voir && ! $socid) //restriction
|
||||||
|
{
|
||||||
|
$sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||||
|
}
|
||||||
|
if ($search_ref) {
|
||||||
|
$sql .= natural_search('p.ref', $search_ref);
|
||||||
|
}
|
||||||
|
if ($search_societe) {
|
||||||
|
$sql .= natural_search('s.nom', $search_societe);
|
||||||
|
}
|
||||||
|
if ($search_author)
|
||||||
|
{
|
||||||
|
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||||
|
}
|
||||||
|
if ($search_montant_ht)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||||
|
}
|
||||||
|
if ($sall) {
|
||||||
|
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||||
|
}
|
||||||
|
if ($socid) $sql.= ' AND s.rowid = '.$socid;
|
||||||
|
if ($viewstatut <> '')
|
||||||
|
{
|
||||||
|
$sql.= ' AND p.fk_statut IN ('.$viewstatut.')';
|
||||||
|
}
|
||||||
|
if ($month > 0)
|
||||||
|
{
|
||||||
|
if ($year > 0 && empty($day))
|
||||||
|
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,$month,false))."' AND '".$db->idate(dol_get_last_day($year,$month,false))."'";
|
||||||
|
else if ($year > 0 && ! empty($day))
|
||||||
|
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_mktime(0, 0, 0, $month, $day, $year))."' AND '".$db->idate(dol_mktime(23, 59, 59, $month, $day, $year))."'";
|
||||||
|
else
|
||||||
|
$sql.= " AND date_format(p.date_livraison, '%m') = '".$month."'";
|
||||||
|
}
|
||||||
|
else if ($year > 0)
|
||||||
|
{
|
||||||
|
$sql.= " AND p.date_livraison BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'";
|
||||||
|
}
|
||||||
|
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='askpricesupplier' AND tc.source='internal' AND c.element_id = p.rowid AND c.fk_socpeople = ".$search_user;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder.', p.ref DESC';
|
||||||
|
|
||||||
|
$nbtotalofrecords = 0;
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
|
||||||
|
{
|
||||||
|
$result = $db->query($sql);
|
||||||
|
$nbtotalofrecords = $db->num_rows($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$sql.= $db->plimit($limit + 1,$offset);
|
||||||
|
$result=$db->query($sql);
|
||||||
|
|
||||||
|
if ($result)
|
||||||
|
{
|
||||||
|
$objectstatic=new AskPriceSupplier($db);
|
||||||
|
$userstatic=new User($db);
|
||||||
|
$num = $db->num_rows($result);
|
||||||
|
|
||||||
|
if ($socid)
|
||||||
|
{
|
||||||
|
$soc = new Societe($db);
|
||||||
|
$soc->fetch($socid);
|
||||||
|
}
|
||||||
|
|
||||||
|
$param='&socid='.$socid.'&viewstatut='.$viewstatut;
|
||||||
|
if ($month) $param.='&month='.$month;
|
||||||
|
if ($year) $param.='&year='.$year;
|
||||||
|
if ($search_ref) $param.='&search_ref=' .$search_ref;
|
||||||
|
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||||
|
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||||
|
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||||
|
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||||
|
if ($search_author) $param.='&search_author='.$search_author;
|
||||||
|
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"].'">';
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
print '<table class="liste" width="100%">';
|
||||||
|
|
||||||
|
$moreforfilter='';
|
||||||
|
|
||||||
|
// If the user can view prospects other than his'
|
||||||
|
if ($user->rights->societe->client->voir || $socid)
|
||||||
|
{
|
||||||
|
$langs->load("commercial");
|
||||||
|
$moreforfilter.=$langs->trans('ThirdPartiesOfSaleRepresentative'). ': ';
|
||||||
|
$moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user);
|
||||||
|
$moreforfilter.=' ';
|
||||||
|
}
|
||||||
|
// If the user can view prospects other than his'
|
||||||
|
if ($user->rights->societe->client->voir || $socid)
|
||||||
|
{
|
||||||
|
$moreforfilter.=$langs->trans('LinkedToSpecificUsers'). ': ';
|
||||||
|
$moreforfilter.=$form->select_dolusers($search_user,'search_user',1);
|
||||||
|
}
|
||||||
|
if (! empty($moreforfilter))
|
||||||
|
{
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre" colspan="10">';
|
||||||
|
print $moreforfilter;
|
||||||
|
print '</td></tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print_liste_field_titre($langs->trans('Ref'),$_SERVER["PHP_SELF"],'p.ref','',$param,'',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('Company'),$_SERVER["PHP_SELF"],'s.nom','',$param,'',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('AskPriceSupplierDate'),$_SERVER["PHP_SELF"],'p.date_livraison','',$param, 'align="center"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('AmountHT'),$_SERVER["PHP_SELF"],'p.total_ht','',$param, 'align="right"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('Author'),$_SERVER["PHP_SELF"],'u.login','',$param,'align="center"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre($langs->trans('Status'),$_SERVER["PHP_SELF"],'p.fk_statut','',$param,'align="right"',$sortfield,$sortorder);
|
||||||
|
print_liste_field_titre('');
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
print '<tr class="liste_titre">';
|
||||||
|
print '<td class="liste_titre">';
|
||||||
|
print '<input class="flat" size="6" type="text" name="search_ref" value="'.$search_ref.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="left">';
|
||||||
|
print '<input class="flat" type="text" size="12" name="search_societe" value="'.$search_societe.'">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Date
|
||||||
|
print '<td class="liste_titre" colspan="1" align="center">';
|
||||||
|
//print $langs->trans('Month').': ';
|
||||||
|
print '<input class="flat" type="text" size="1" maxlength="2" name="month" value="'.$month.'">';
|
||||||
|
//print ' '.$langs->trans('Year').': ';
|
||||||
|
$syear = $year;
|
||||||
|
$formother->select_year($syear,'year',1, 20, 5);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Amount
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||||
|
print '</td>';
|
||||||
|
// Author
|
||||||
|
print '<td class="liste_titre" align="center">';
|
||||||
|
print '<input class="flat" size="10" type="text" name="search_author" value="'.$search_author.'">';
|
||||||
|
print '</td>';
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
$formaskpricesupplier->selectAskPriceSupplierStatus($viewstatut,1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td class="liste_titre" align="right">';
|
||||||
|
print '<input type="image" name="button_search" class="liste_titre" src="'.img_picto($langs->trans("Search"),'search.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
|
||||||
|
print '<input type="image" name="button_removefilter" class="liste_titre" src="'.img_picto($langs->trans("RemoveFilter"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$var=true;
|
||||||
|
$total=0;
|
||||||
|
$subtotal=0;
|
||||||
|
|
||||||
|
while ($i < min($num,$limit))
|
||||||
|
{
|
||||||
|
$objp = $db->fetch_object($result);
|
||||||
|
$now = dol_now();
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr '.$bc[$var].'>';
|
||||||
|
print '<td class="nowrap">';
|
||||||
|
|
||||||
|
$objectstatic->id=$objp->askpricesupplierid;
|
||||||
|
$objectstatic->ref=$objp->ref;
|
||||||
|
|
||||||
|
print '<table class="nobordernopadding"><tr class="nocellnopadd">';
|
||||||
|
print '<td class="nobordernopadding nowrap">';
|
||||||
|
print $objectstatic->getNomUrl(1);
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
print '<td style="min-width: 20px" class="nobordernopadding nowrap">';
|
||||||
|
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/askpricesupplier/note.php?id='.$objp->askpricesupplierid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
|
||||||
|
print '</span>';
|
||||||
|
}
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<td width="16" align="right" class="nobordernopadding hideonsmartphone">';
|
||||||
|
$filename=dol_sanitizeFileName($objp->ref);
|
||||||
|
$filedir=$conf->askpricesupplier->dir_output . '/' . dol_sanitizeFileName($objp->ref);
|
||||||
|
$urlsource=$_SERVER['PHP_SELF'].'?id='.$objp->askpricesupplierid;
|
||||||
|
print $formfile->getDocumentsLink($objectstatic->element, $filename, $filedir);
|
||||||
|
print '</td></tr></table>';
|
||||||
|
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
$url = DOL_URL_ROOT.'/comm/card.php?socid='.$objp->rowid;
|
||||||
|
|
||||||
|
// Company
|
||||||
|
$companystatic->id=$objp->rowid;
|
||||||
|
$companystatic->name=$objp->name;
|
||||||
|
$companystatic->client=$objp->client;
|
||||||
|
$companystatic->code_client=$objp->code_client;
|
||||||
|
print '<td>';
|
||||||
|
print $companystatic->getNomUrl(1,'customer');
|
||||||
|
print '</td>';
|
||||||
|
|
||||||
|
// Date askprice
|
||||||
|
print '<td align="center">';
|
||||||
|
print dol_print_date($db->jdate($objp->dp), 'day');
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
print '<td align="right">'.price($objp->total_ht)."</td>\n";
|
||||||
|
|
||||||
|
$userstatic->id=$objp->fk_user_author;
|
||||||
|
$userstatic->login=$objp->login;
|
||||||
|
print '<td align="center">';
|
||||||
|
if ($userstatic->id) print $userstatic->getLoginUrl(1);
|
||||||
|
else print ' ';
|
||||||
|
print "</td>\n";
|
||||||
|
|
||||||
|
print '<td align="right">'.$objectstatic->LibStatut($objp->fk_statut,5)."</td>\n";
|
||||||
|
|
||||||
|
print '<td> </td>';
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
|
$total += $objp->total_ht;
|
||||||
|
$subtotal += $objp->total_ht;
|
||||||
|
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($total>0)
|
||||||
|
{
|
||||||
|
if($num<$limit){
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHT").'</td>';
|
||||||
|
print '<td colspan="3" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
print '<tr class="liste_total"><td align="left">'.$langs->trans("TotalHTforthispage").'</td>';
|
||||||
|
print '<td colspan="3" align="right">'.price($total).'</td><td colspan="3"></td>';
|
||||||
|
print '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
|
||||||
|
print '</form>';
|
||||||
|
|
||||||
|
$db->free($result);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
113
htdocs/comm/askpricesupplier/note.php
Normal file
113
htdocs/comm/askpricesupplier/note.php
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.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/propal/note.php
|
||||||
|
* \ingroup propal
|
||||||
|
* \brief Fiche d'information sur une proposition commerciale
|
||||||
|
*/
|
||||||
|
|
||||||
|
require '../../main.inc.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/askpricesupplier.lib.php';
|
||||||
|
|
||||||
|
$langs->load('askpricesupplier');
|
||||||
|
$langs->load('compta');
|
||||||
|
$langs->load('bills');
|
||||||
|
|
||||||
|
$id = GETPOST('id','int');
|
||||||
|
$ref=GETPOST('ref','alpha');
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
|
||||||
|
// Security check
|
||||||
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
|
$result = restrictedArea($user, 'askpricesupplier', $id, 'askpricesupplier');
|
||||||
|
|
||||||
|
$object = new AskPriceSupplier($db);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Actions */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
$permissionnote=$user->rights->askpricesupplier->creer; // Used by the include of actions_setnotes.inc.php
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not includ_once
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/******************************************************************************/
|
||||||
|
/* Affichage fiche */
|
||||||
|
/******************************************************************************/
|
||||||
|
|
||||||
|
llxHeader('',$langs->trans('CommRequest'),'EN:Ask_Price_Supplier|FR:Demande_de_prix_fournisseur');
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
if ($id > 0 || ! empty($ref))
|
||||||
|
{
|
||||||
|
if ($mesg) print $mesg;
|
||||||
|
|
||||||
|
$now=dol_now();
|
||||||
|
|
||||||
|
if ($object->fetch($id, $ref))
|
||||||
|
{
|
||||||
|
$societe = new Societe($db);
|
||||||
|
if ( $societe->fetch($object->socid) )
|
||||||
|
{
|
||||||
|
$head = askpricesupplier_prepare_head($object);
|
||||||
|
dol_fiche_head($head, 'note', $langs->trans('CommRequest'), 0, 'askpricesupplier');
|
||||||
|
|
||||||
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
|
$linkback = '<a href="'.DOL_URL_ROOT.'/comm/askpricesupplier/list.php'.(! empty($socid)?'?socid='.$socid:'').'">'.$langs->trans('BackToList').'</a>';
|
||||||
|
|
||||||
|
// Ref
|
||||||
|
print '<tr><td width="25%">'.$langs->trans('Ref').'</td><td colspan="3">';
|
||||||
|
print $form->showrefnav($object,'ref',$linkback,1,'ref','ref','');
|
||||||
|
print '</td></tr>';
|
||||||
|
|
||||||
|
// Customer
|
||||||
|
if ( is_null($object->client) )
|
||||||
|
$object->fetch_thirdparty();
|
||||||
|
print "<tr><td>".$langs->trans("Supplier")."</td>";
|
||||||
|
print '<td colspan="3">'.$object->client->getNomUrl(1).'</td></tr>';
|
||||||
|
|
||||||
|
print '<tr><td>'.$langs->trans('AskPriceSupplierDate').'</td><td colspan="3">';
|
||||||
|
print dol_print_date($object->date_livraison,'daytext');
|
||||||
|
print '</td>';
|
||||||
|
print '</tr>';
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
|
||||||
|
|
||||||
|
dol_fiche_end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
0
htdocs/comm/askpricesupplier/tpl/index.html
Normal file
0
htdocs/comm/askpricesupplier/tpl/index.html
Normal file
74
htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php
Normal file
74
htdocs/comm/askpricesupplier/tpl/linkedobjectblock.tpl.php
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<!-- BEGIN PHP TEMPLATE -->
|
||||||
|
|
||||||
|
<?php
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
|
||||||
|
$langs = $GLOBALS['langs'];
|
||||||
|
$linkedObjectBlock = $GLOBALS['linkedObjectBlock'];
|
||||||
|
|
||||||
|
echo '<br>';
|
||||||
|
print_titre($langs->trans('RelatedAskPriceSupplier'));
|
||||||
|
?>
|
||||||
|
<table class="noborder allwidth">
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<td><?php echo $langs->trans("Ref"); ?></td>
|
||||||
|
<td></td>
|
||||||
|
<td align="center"><?php echo $langs->trans("Date"); ?></td>
|
||||||
|
<td align="right"><?php echo $langs->trans("AmountHTShort"); ?></td>
|
||||||
|
<td align="right"><?php echo $langs->trans("Status"); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
$var=true;
|
||||||
|
$total=0;
|
||||||
|
foreach($linkedObjectBlock as $object)
|
||||||
|
{
|
||||||
|
$var=!$var;
|
||||||
|
?>
|
||||||
|
<tr <?php echo $bc[$var]; ?> ><td>
|
||||||
|
<a href="<?php echo DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$object->id ?>"><?php echo img_object($langs->trans("ShowAskPriceSupplier"),"askpricesupplier").' '.$object->ref; ?></a></td>
|
||||||
|
<td></td>
|
||||||
|
<td align="center"><?php echo dol_print_date($object->datec,'day'); ?></td>
|
||||||
|
<td align="right"><?php
|
||||||
|
if ($user->rights->askpricesupplier->lire) {
|
||||||
|
$total = $total + $object->total_ht;
|
||||||
|
echo price($object->total_ht);
|
||||||
|
} ?></td>
|
||||||
|
<td align="right"><?php echo $object->getLibStatut(3); ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<tr class="liste_total">
|
||||||
|
<td align="left" colspan="3"><?php echo $langs->trans('TotalHT'); ?></td>
|
||||||
|
<td align="right"><?php
|
||||||
|
if ($user->rights->askpricesupplier->lire) {
|
||||||
|
echo price($total);
|
||||||
|
} ?></td>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<!-- END PHP TEMPLATE -->
|
||||||
@@ -1776,6 +1776,7 @@ abstract class CommonObject
|
|||||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
||||||
if ($this->element == 'propal') $fieldttc='total';
|
if ($this->element == 'propal') $fieldttc='total';
|
||||||
if ($this->element == 'expensereport') $fieldtva='total_tva';
|
if ($this->element == 'expensereport') $fieldtva='total_tva';
|
||||||
|
if ($this->element == 'askpricesupplier') $fieldttc='total';
|
||||||
|
|
||||||
if (empty($nodatabaseupdate))
|
if (empty($nodatabaseupdate))
|
||||||
{
|
{
|
||||||
@@ -1966,6 +1967,9 @@ abstract class CommonObject
|
|||||||
else if ($objecttype == 'propal') {
|
else if ($objecttype == 'propal') {
|
||||||
$classpath = 'comm/propal/class';
|
$classpath = 'comm/propal/class';
|
||||||
}
|
}
|
||||||
|
else if ($objecttype == 'askpricesupplier') {
|
||||||
|
$classpath = 'comm/askpricesupplier/class';
|
||||||
|
}
|
||||||
else if ($objecttype == 'shipping') {
|
else if ($objecttype == 'shipping') {
|
||||||
$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
|
$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
|
||||||
}
|
}
|
||||||
@@ -2484,6 +2488,10 @@ abstract class CommonObject
|
|||||||
$tplpath = 'comm/'.$element;
|
$tplpath = 'comm/'.$element;
|
||||||
if (empty($conf->propal->enabled)) continue; // Do not show if module disabled
|
if (empty($conf->propal->enabled)) continue; // Do not show if module disabled
|
||||||
}
|
}
|
||||||
|
else if ($objecttype == 'askpricesupplier') {
|
||||||
|
$tplpath = 'comm/'.$element;
|
||||||
|
if (empty($conf->askpricesupplier->enabled)) continue; // Do not show if module disabled
|
||||||
|
}
|
||||||
else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
|
else if ($objecttype == 'shipping' || $objecttype == 'shipment') {
|
||||||
$tplpath = 'expedition';
|
$tplpath = 'expedition';
|
||||||
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
|
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
|
||||||
@@ -2586,6 +2594,11 @@ abstract class CommonObject
|
|||||||
// Description
|
// Description
|
||||||
print '<td>'.$langs->trans('Description').'</td>';
|
print '<td>'.$langs->trans('Description').'</td>';
|
||||||
|
|
||||||
|
if ($this->element == 'askpricesupplier')
|
||||||
|
{
|
||||||
|
print '<td align="right"><span id="title_fourn_ref">'.$langs->trans("AskPriceSupplierRefFourn").'</span></td>';
|
||||||
|
}
|
||||||
|
|
||||||
// VAT
|
// VAT
|
||||||
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||||
|
|
||||||
|
|||||||
@@ -171,6 +171,7 @@ class FormActions
|
|||||||
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
if ($typeelement == 'invoice') $title=$langs->trans('ActionsOnBill');
|
||||||
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
|
elseif ($typeelement == 'invoice_supplier' || $typeelement == 'supplier_invoice') $title=$langs->trans('ActionsOnBill');
|
||||||
elseif ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
|
elseif ($typeelement == 'propal') $title=$langs->trans('ActionsOnPropal');
|
||||||
|
elseif ($typeelement == 'askpricesupplier') $title=$langs->trans('ActionsOnAskPriceSupplier');
|
||||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||||
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
elseif ($typeelement == 'project') $title=$langs->trans('ActionsOnProject');
|
||||||
|
|||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ class FormFile
|
|||||||
}
|
}
|
||||||
|
|
||||||
$printer=0;
|
$printer=0;
|
||||||
if (in_array($modulepart,array('facture','propal','proposal','order','commande','expedition'))) // The direct print feature is implemented only for such elements
|
if (in_array($modulepart,array('facture','askpricesupplier','propal','proposal','order','commande','expedition'))) // The direct print feature is implemented only for such elements
|
||||||
{
|
{
|
||||||
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false;
|
$printer = (!empty($user->rights->printing->read) && !empty($conf->printing->enabled))?true:false;
|
||||||
}
|
}
|
||||||
@@ -316,6 +316,15 @@ class FormFile
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
|
||||||
$modellist=ModelePDFPropales::liste_modeles($this->db);
|
$modellist=ModelePDFPropales::liste_modeles($this->db);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if ($modulepart == 'askpricesupplier')
|
||||||
|
{
|
||||||
|
if (is_array($genallowed)) $modellist=$genallowed;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/modules/askpricesupplier/modules_askpricesupplier.php';
|
||||||
|
$modellist=ModelePDFAskPriceSupplier::liste_modeles($this->db);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($modulepart == 'commande')
|
else if ($modulepart == 'commande')
|
||||||
{
|
{
|
||||||
@@ -921,6 +930,11 @@ class FormFile
|
|||||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||||
$object_instance=new Propal($this->db);
|
$object_instance=new Propal($this->db);
|
||||||
}
|
}
|
||||||
|
else if ($modulepart == 'askpricesupplier')
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
|
$object_instance=new AskPriceSupplier($this->db);
|
||||||
|
}
|
||||||
else if ($modulepart == 'order')
|
else if ($modulepart == 'order')
|
||||||
{
|
{
|
||||||
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
include_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||||
@@ -982,6 +996,7 @@ class FormFile
|
|||||||
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
if ($modulepart == 'invoice') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
|
if ($modulepart == 'invoice_supplier') { preg_match('/([^\/]+)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); if (is_numeric($ref)) { $id=$ref; $ref=''; } } // $ref may be also id with old supplier invoices
|
||||||
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
if ($modulepart == 'propal') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
|
if ($modulepart == 'askpricesupplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
if ($modulepart == 'order') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
if ($modulepart == 'order_supplier') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
if ($modulepart == 'contract') { preg_match('/(.*)\/[^\/]+$/',$relativefile,$reg); $ref=(isset($reg[1])?$reg[1]:''); }
|
||||||
|
|||||||
@@ -479,6 +479,7 @@ class FormMail
|
|||||||
|
|
||||||
$showinfobcc='';
|
$showinfobcc='';
|
||||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
|
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO;
|
||||||
|
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ASKPRICESUPPLIER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'askpricesupplier_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ASKPRICESUPPLIER_TO;
|
||||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
|
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO;
|
||||||
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
|
if (! empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
|
||||||
if ($showinfobcc) $out.=' + '.$showinfobcc;
|
if ($showinfobcc) $out.=' + '.$showinfobcc;
|
||||||
@@ -498,6 +499,7 @@ class FormMail
|
|||||||
{
|
{
|
||||||
$defaultvaluefordeliveryreceipt=0;
|
$defaultvaluefordeliveryreceipt=0;
|
||||||
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $defaultvaluefordeliveryreceipt=1;
|
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_PROPAL) && ! empty($this->param['models']) && $this->param['models'] == 'propal_send') $defaultvaluefordeliveryreceipt=1;
|
||||||
|
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ASKPRICESUPPLIER) && ! empty($this->param['models']) && $this->param['models'] == 'askpricesupplier_send') $defaultvaluefordeliveryreceipt=1;
|
||||||
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $defaultvaluefordeliveryreceipt=1;
|
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_ORDER) && ! empty($this->param['models']) && $this->param['models'] == 'order_send') $defaultvaluefordeliveryreceipt=1;
|
||||||
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $defaultvaluefordeliveryreceipt=1;
|
if (! empty($conf->global->MAIL_FORCE_DELIVERY_RECEIPT_INVOICE) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $defaultvaluefordeliveryreceipt=1;
|
||||||
$out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:$defaultvaluefordeliveryreceipt), 1);
|
$out.= $form->selectyesno('deliveryreceipt', (isset($_POST["deliveryreceipt"])?$_POST["deliveryreceipt"]:$defaultvaluefordeliveryreceipt), 1);
|
||||||
@@ -720,6 +722,7 @@ class FormMail
|
|||||||
if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
|
if ($type_template=='facture_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoice"); }
|
||||||
elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||||
elseif ($type_template=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); }
|
elseif ($type_template=='propal_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendProposal"); }
|
||||||
|
elseif ($type_template=='askpricesupplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendAskPriceSupplier"); }
|
||||||
elseif ($type_template=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); }
|
elseif ($type_template=='order_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendOrder"); }
|
||||||
elseif ($type_template=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
elseif ($type_template=='order_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||||
elseif ($type_template=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
elseif ($type_template=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||||
|
|||||||
122
htdocs/core/lib/askpricesupplier.lib.php
Normal file
122
htdocs/core/lib/askpricesupplier.lib.php
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2006-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/lib/propal.lib.php
|
||||||
|
* \brief Ensemble de fonctions de base pour le module propal
|
||||||
|
* \ingroup propal
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare array with list of tabs
|
||||||
|
*
|
||||||
|
* @param object $object Object related to tabs
|
||||||
|
* @return array Array of tabs to show
|
||||||
|
*/
|
||||||
|
function askpricesupplier_prepare_head($object)
|
||||||
|
{
|
||||||
|
global $langs, $conf, $user;
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
$langs->load("compta");
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/card.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('AskPriceSupplierCard');
|
||||||
|
$head[$h][2] = 'comm';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// 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); to remove a tab
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'askpricesupplier');
|
||||||
|
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_NOTES_TAB))
|
||||||
|
{
|
||||||
|
$nbNote = 0;
|
||||||
|
if(!empty($object->note_private)) $nbNote++;
|
||||||
|
if(!empty($object->note_public)) $nbNote++;
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/note.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('Notes');
|
||||||
|
if ($nbNote > 0) $head[$h][1].= ' <span class="badge">'.$nbNote.'</span>';
|
||||||
|
$head[$h][2] = 'note';
|
||||||
|
$h++;
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
$upload_dir = $conf->askpricesupplier->dir_output . "/" . dol_sanitizeFileName($object->ref);
|
||||||
|
$nbFiles = count(dol_dir_list($upload_dir,'files',0,'','(\.meta|_preview\.png)$'));
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/document.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('Documents');
|
||||||
|
if($nbFiles > 0) $head[$h][1].= ' <span class="badge">'.$nbFiles.'</span>';
|
||||||
|
$head[$h][2] = 'document';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/askpricesupplier/info.php?id='.$object->id;
|
||||||
|
$head[$h][1] = $langs->trans('Info');
|
||||||
|
$head[$h][2] = 'info';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,$object,$head,$h,'askpricesupplier','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return array head with list of tabs to view object informations.
|
||||||
|
*
|
||||||
|
* @return array head array with tabs
|
||||||
|
*/
|
||||||
|
function askpricesupplier_admin_prepare_head()
|
||||||
|
{
|
||||||
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/admin/askpricesupplier.php';
|
||||||
|
$head[$h][1] = $langs->trans("Miscellaneous");
|
||||||
|
$head[$h][2] = 'general';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// 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 remove a tab
|
||||||
|
complete_head_from_modules($conf,$langs,null,$head,$h,'askpricesupplier_admin');
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/askpricesupplier_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
|
$head[$h][2] = 'attributes';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
$head[$h][0] = DOL_URL_ROOT.'/comm/admin/askpricesupplierdet_extrafields.php';
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||||
|
$head[$h][2] = 'attributeslines';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
complete_head_from_modules($conf,$langs,null,$head,$h,'askpricesupplier_admin','remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1549,6 +1549,9 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
|
|||||||
if ($objecttype == 'propal') {
|
if ($objecttype == 'propal') {
|
||||||
$classpath = 'comm/propal/class';
|
$classpath = 'comm/propal/class';
|
||||||
}
|
}
|
||||||
|
if ($objecttype == 'askpricesupplier') {
|
||||||
|
$classpath = 'comm/askpricesupplier/class';
|
||||||
|
}
|
||||||
if ($objecttype == 'shipping') {
|
if ($objecttype == 'shipping') {
|
||||||
$classpath = 'expedition/class';
|
$classpath = 'expedition/class';
|
||||||
$subelement = 'expedition';
|
$subelement = 'expedition';
|
||||||
@@ -1780,6 +1783,9 @@ function getElementProperties($element_type)
|
|||||||
if ($element_type == 'propal') {
|
if ($element_type == 'propal') {
|
||||||
$classpath = 'comm/propal/class';
|
$classpath = 'comm/propal/class';
|
||||||
}
|
}
|
||||||
|
if ($element_type == 'askpricesupplier') {
|
||||||
|
$classpath = 'comm/askpricesupplier/class';
|
||||||
|
}
|
||||||
if ($element_type == 'shipping') {
|
if ($element_type == 'shipping') {
|
||||||
$classpath = 'expedition/class';
|
$classpath = 'expedition/class';
|
||||||
$subelement = 'expedition';
|
$subelement = 'expedition';
|
||||||
|
|||||||
@@ -0,0 +1,484 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2010-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/propale/doc/doc_generic_proposal_odt.modules.php
|
||||||
|
* \ingroup societe
|
||||||
|
* \brief File of class to build ODT documents for third parties
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/modules/askpricesupplier/modules_askpricesupplier.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/doc.lib.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to build documents using ODF templates generator
|
||||||
|
*/
|
||||||
|
class doc_generic_askpricesupplier_odt extends ModelePDFAskPriceSupplier
|
||||||
|
{
|
||||||
|
var $emetteur; // Objet societe qui emet
|
||||||
|
|
||||||
|
var $phpmin = array(5,2,0); // Minimum version of PHP required by module
|
||||||
|
var $version = 'dolibarr';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
|
$langs->load("main");
|
||||||
|
$langs->load("companies");
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
$this->name = "ODT templates";
|
||||||
|
$this->description = $langs->trans("DocumentModelOdt");
|
||||||
|
$this->scandir = 'ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH'; // Name of constant that is used to save list of directories to scan
|
||||||
|
|
||||||
|
// Dimension page pour format A4
|
||||||
|
$this->type = 'odt';
|
||||||
|
$this->page_largeur = 0;
|
||||||
|
$this->page_hauteur = 0;
|
||||||
|
$this->format = array($this->page_largeur,$this->page_hauteur);
|
||||||
|
$this->marge_gauche=0;
|
||||||
|
$this->marge_droite=0;
|
||||||
|
$this->marge_haute=0;
|
||||||
|
$this->marge_basse=0;
|
||||||
|
|
||||||
|
$this->option_logo = 1; // Affiche logo
|
||||||
|
$this->option_tva = 0; // Gere option tva PROPALE_TVAOPTION
|
||||||
|
$this->option_modereg = 0; // Affiche mode reglement
|
||||||
|
$this->option_condreg = 0; // Affiche conditions reglement
|
||||||
|
$this->option_codeproduitservice = 0; // Affiche code produit-service
|
||||||
|
$this->option_multilang = 1; // Dispo en plusieurs langues
|
||||||
|
$this->option_escompte = 0; // Affiche si il y a eu escompte
|
||||||
|
$this->option_credit_note = 0; // Support credit notes
|
||||||
|
$this->option_freetext = 1; // Support add of a personalised text
|
||||||
|
$this->option_draft_watermark = 0; // Support add of a watermark on drafts
|
||||||
|
|
||||||
|
// Recupere emetteur
|
||||||
|
$this->emetteur=$mysoc;
|
||||||
|
if (! $this->emetteur->country_code) $this->emetteur->country_code=substr($langs->defaultlang,-2); // By default if not defined
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return description of a module
|
||||||
|
*
|
||||||
|
* @param Translate $langs Lang object to use for output
|
||||||
|
* @return string Description
|
||||||
|
*/
|
||||||
|
function info($langs)
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load("companies");
|
||||||
|
$langs->load("errors");
|
||||||
|
|
||||||
|
$form = new Form($this->db);
|
||||||
|
|
||||||
|
$texte = $this->description.".<br>\n";
|
||||||
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$texte.= '<input type="hidden" name="action" value="setModuleOptions">';
|
||||||
|
$texte.= '<input type="hidden" name="param1" value="ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH">';
|
||||||
|
if ($conf->global->MAIN_ASKPRICESUPPLIER_CHOOSE_ODT_DOCUMENT > 0)
|
||||||
|
{
|
||||||
|
$texte.= '<input type="hidden" name="param2" value="ASKPRICESUPPLIER_ADDON_PDF_ODT_DEFAULT">';
|
||||||
|
$texte.= '<input type="hidden" name="param3" value="ASKPRICESUPPLIER_ADDON_PDF_ODT_TOBILL">';
|
||||||
|
$texte.= '<input type="hidden" name="param4" value="ASKPRICESUPPLIER_ADDON_PDF_ODT_CLOSED">';
|
||||||
|
}
|
||||||
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
// List of directories area
|
||||||
|
$texte.= '<tr><td>';
|
||||||
|
$texttitle=$langs->trans("ListOfDirectories");
|
||||||
|
$listofdir=explode(',',preg_replace('/[\r\n]+/',',',trim($conf->global->ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH)));
|
||||||
|
$listoffiles=array();
|
||||||
|
foreach($listofdir as $key=>$tmpdir)
|
||||||
|
{
|
||||||
|
$tmpdir=trim($tmpdir);
|
||||||
|
$tmpdir=preg_replace('/DOL_DATA_ROOT/',DOL_DATA_ROOT,$tmpdir);
|
||||||
|
if (! $tmpdir) {
|
||||||
|
unset($listofdir[$key]); continue;
|
||||||
|
}
|
||||||
|
if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
|
||||||
|
if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$texthelp=$langs->trans("ListOfDirectoriesForModelGenODT");
|
||||||
|
// Add list of substitution keys
|
||||||
|
$texthelp.='<br>'.$langs->trans("FollowingSubstitutionKeysCanBeUsed").'<br>';
|
||||||
|
$texthelp.=$langs->transnoentitiesnoconv("FullListOnOnlineDocumentation"); // This contains an url, we don't modify it
|
||||||
|
|
||||||
|
$texte.= $form->textwithpicto($texttitle,$texthelp,1,'help','',1);
|
||||||
|
$texte.= '<div><div style="display: inline-block; min-width: 100px; vertical-align: middle;">';
|
||||||
|
$texte.= '<textarea class="flat" cols="60" name="value1">';
|
||||||
|
$texte.=$conf->global->ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH;
|
||||||
|
$texte.= '</textarea>';
|
||||||
|
$texte.= '</div><div style="display: inline-block; vertical-align: middle;">';
|
||||||
|
$texte.= '<input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button">';
|
||||||
|
$texte.= '<br></div></div>';
|
||||||
|
|
||||||
|
// Scan directories
|
||||||
|
if (count($listofdir))
|
||||||
|
{
|
||||||
|
$texte.=$langs->trans("NumberOfModelFilesFound").': <b>'.count($listoffiles).'</b>';
|
||||||
|
|
||||||
|
if ($conf->global->MAIN_ASKPRICESUPPLIER_CHOOSE_ODT_DOCUMENT > 0)
|
||||||
|
{
|
||||||
|
// Model for creation
|
||||||
|
$liste=ModelePDFAskPriceSupplier::liste_modeles($this->db);
|
||||||
|
$texte.= '<table width="50%;">';
|
||||||
|
$texte.= '<tr>';
|
||||||
|
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelAskPriceSupplierCreate").'</td>';
|
||||||
|
$texte.= '<td colspan="">';
|
||||||
|
$texte.= $form->selectarray('value2',$liste,$conf->global->ASKPRICESUPPLIER_ADDON_PDF_ODT_DEFAULT);
|
||||||
|
$texte.= "</td></tr>";
|
||||||
|
|
||||||
|
$texte.= '<tr>';
|
||||||
|
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelAskPriceSupplierToBill").'</td>';
|
||||||
|
$texte.= '<td colspan="">';
|
||||||
|
$texte.= $form->selectarray('value3',$liste,$conf->global->ASKPRICESUPPLIER_ADDON_PDF_ODT_TOBILL);
|
||||||
|
$texte.= "</td></tr>";
|
||||||
|
$texte.= '<tr>';
|
||||||
|
|
||||||
|
$texte.= '<td width="60%;">'.$langs->trans("DefaultModelAskPriceSupplierClosed").'</td>';
|
||||||
|
$texte.= '<td colspan="">';
|
||||||
|
$texte.= $form->selectarray('value4',$liste,$conf->global->ASKPRICESUPPLIER_ADDON_PDF_ODT_CLOSED);
|
||||||
|
$texte.= "</td></tr>";
|
||||||
|
$texte.= '</table>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$texte.= '</td>';
|
||||||
|
|
||||||
|
$texte.= '<td valign="top" rowspan="2" class="hideonsmartphone">';
|
||||||
|
$texte.= $langs->trans("ExampleOfDirectoriesForModelGen");
|
||||||
|
$texte.= '</td>';
|
||||||
|
$texte.= '</tr>';
|
||||||
|
|
||||||
|
$texte.= '</table>';
|
||||||
|
$texte.= '</form>';
|
||||||
|
|
||||||
|
return $texte;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function to build a document on disk using the generic odt module.
|
||||||
|
*
|
||||||
|
* @param Propale $object Object source to build document
|
||||||
|
* @param Translate $outputlangs Lang output object
|
||||||
|
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||||
|
* @param int $hidedetails Do not show line details
|
||||||
|
* @param int $hidedesc Do not show desc
|
||||||
|
* @param int $hideref Do not show ref
|
||||||
|
* @return int 1 if OK, <=0 if KO
|
||||||
|
*/
|
||||||
|
function write_file($object,$outputlangs,$srctemplatepath,$hidedetails=0,$hidedesc=0,$hideref=0)
|
||||||
|
{
|
||||||
|
global $user,$langs,$conf,$mysoc,$hookmanager;
|
||||||
|
|
||||||
|
if (empty($srctemplatepath))
|
||||||
|
{
|
||||||
|
dol_syslog("doc_generic_odt::write_file parameter srctemplatepath empty", LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add odtgeneration hook
|
||||||
|
if (! is_object($hookmanager))
|
||||||
|
{
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
|
||||||
|
$hookmanager=new HookManager($this->db);
|
||||||
|
}
|
||||||
|
$hookmanager->initHooks(array('odtgeneration'));
|
||||||
|
global $action;
|
||||||
|
|
||||||
|
if (! is_object($outputlangs)) $outputlangs=$langs;
|
||||||
|
$sav_charset_output=$outputlangs->charset_output;
|
||||||
|
$outputlangs->charset_output='UTF-8';
|
||||||
|
|
||||||
|
$outputlangs->load("main");
|
||||||
|
$outputlangs->load("dict");
|
||||||
|
$outputlangs->load("companies");
|
||||||
|
$outputlangs->load("bills");
|
||||||
|
|
||||||
|
if ($conf->askpricesupplier->dir_output)
|
||||||
|
{
|
||||||
|
// If $object is id instead of object
|
||||||
|
if (! is_object($object))
|
||||||
|
{
|
||||||
|
$id = $object;
|
||||||
|
$object = new AskPriceSupplier($this->db);
|
||||||
|
$result=$object->fetch($id);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
dol_print_error($this->db,$object->error);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$dir = $conf->askpricesupplier->dir_output;
|
||||||
|
$objectref = dol_sanitizeFileName($object->ref);
|
||||||
|
if (! preg_match('/specimen/i',$objectref)) $dir.= "/" . $objectref;
|
||||||
|
$file = $dir . "/" . $objectref . ".odt";
|
||||||
|
|
||||||
|
if (! file_exists($dir))
|
||||||
|
{
|
||||||
|
if (dol_mkdir($dir) < 0)
|
||||||
|
{
|
||||||
|
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file_exists($dir))
|
||||||
|
{
|
||||||
|
//print "srctemplatepath=".$srctemplatepath; // Src filename
|
||||||
|
$newfile=basename($srctemplatepath);
|
||||||
|
$newfiletmp=preg_replace('/\.od(t|s)/i','',$newfile);
|
||||||
|
$newfiletmp=preg_replace('/template_/i','',$newfiletmp);
|
||||||
|
$newfiletmp=preg_replace('/modele_/i','',$newfiletmp);
|
||||||
|
|
||||||
|
$newfiletmp=$objectref.'_'.$newfiletmp;
|
||||||
|
|
||||||
|
// Get extension (ods or odt)
|
||||||
|
$newfileformat=substr($newfile, strrpos($newfile, '.')+1);
|
||||||
|
if ( ! empty($conf->global->MAIN_DOC_USE_TIMING))
|
||||||
|
{
|
||||||
|
$filename=$newfiletmp.'.'.dol_print_date(dol_now(),'%Y%m%d%H%M%S').'.'.$newfileformat;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$filename=$newfiletmp.'.'.$newfileformat;
|
||||||
|
}
|
||||||
|
$file=$dir.'/'.$filename;
|
||||||
|
//print "newdir=".$dir;
|
||||||
|
//print "newfile=".$newfile;
|
||||||
|
//print "file=".$file;
|
||||||
|
//print "conf->propal->dir_temp=".$conf->propal->dir_temp;
|
||||||
|
|
||||||
|
dol_mkdir($conf->askpricesupplier->dir_temp);
|
||||||
|
|
||||||
|
|
||||||
|
// If BILLING contact defined on invoice, we use it
|
||||||
|
$usecontact=false;
|
||||||
|
$arrayidcontact=$object->getIdContact('external','BILLING');
|
||||||
|
if (count($arrayidcontact) > 0)
|
||||||
|
{
|
||||||
|
$usecontact=true;
|
||||||
|
$result=$object->fetch_contact($arrayidcontact[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recipient name
|
||||||
|
if (! empty($usecontact))
|
||||||
|
{
|
||||||
|
// On peut utiliser le nom de la societe du contact
|
||||||
|
if (! empty($conf->global->MAIN_USE_COMPANY_NAME_OF_CONTACT)) $socobject = $object->contact;
|
||||||
|
else $socobject = $object->client;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$socobject=$object->client;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make substitution
|
||||||
|
$substitutionarray=array(
|
||||||
|
'__FROM_NAME__' => $this->emetteur->name,
|
||||||
|
'__FROM_EMAIL__' => $this->emetteur->email,
|
||||||
|
'__TOTAL_TTC__' => $object->total_ttc,
|
||||||
|
'__TOTAL_HT__' => $object->total_ht,
|
||||||
|
'__TOTAL_VAT__' => $object->total_vat
|
||||||
|
);
|
||||||
|
complete_substitutions_array($substitutionarray, $langs, $object);
|
||||||
|
// Call the ODTSubstitution hook
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$substitutionarray);
|
||||||
|
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
// Line of free text
|
||||||
|
$newfreetext='';
|
||||||
|
$paramfreetext='ASKPRICESUPPLIER_FREE_TEXT';
|
||||||
|
if (! empty($conf->global->$paramfreetext))
|
||||||
|
{
|
||||||
|
$newfreetext=make_substitutions($conf->global->$paramfreetext,$substitutionarray);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Open and load template
|
||||||
|
require_once ODTPHP_PATH.'odf.php';
|
||||||
|
try {
|
||||||
|
$odfHandler = new odf(
|
||||||
|
$srctemplatepath,
|
||||||
|
array(
|
||||||
|
'PATH_TO_TMP' => $conf->askpricesupplier->dir_temp,
|
||||||
|
'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy.
|
||||||
|
'DELIMITER_LEFT' => '{',
|
||||||
|
'DELIMITER_RIGHT' => '}'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch(Exception $e)
|
||||||
|
{
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
// After construction $odfHandler->contentXml contains content and
|
||||||
|
// [!-- BEGIN row.lines --]*[!-- END row.lines --] has been replaced by
|
||||||
|
// [!-- BEGIN lines --]*[!-- END lines --]
|
||||||
|
//print html_entity_decode($odfHandler->__toString());
|
||||||
|
//print exit;
|
||||||
|
|
||||||
|
|
||||||
|
// Make substitutions into odt of freetext
|
||||||
|
try {
|
||||||
|
$odfHandler->setVars('free_text', $newfreetext, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make substitutions into odt
|
||||||
|
$array_user=$this->get_substitutionarray_user($user,$outputlangs);
|
||||||
|
$array_soc=$this->get_substitutionarray_mysoc($mysoc,$outputlangs);
|
||||||
|
$array_thirdparty=$this->get_substitutionarray_thirdparty($socobject,$outputlangs);
|
||||||
|
$array_objet=$this->get_substitutionarray_object($object,$outputlangs);
|
||||||
|
$array_other=$this->get_substitutionarray_other($outputlangs);
|
||||||
|
|
||||||
|
$tmparray = array_merge($array_user,$array_soc,$array_thirdparty,$array_objet,$array_other);
|
||||||
|
complete_substitutions_array($tmparray, $outputlangs, $object);
|
||||||
|
// Call the ODTSubstitution hook
|
||||||
|
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray);
|
||||||
|
$reshook=$hookmanager->executeHooks('ODTSubstitution',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
foreach($tmparray as $key=>$value)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (preg_match('/logo$/',$key)) // Image
|
||||||
|
{
|
||||||
|
if (file_exists($value)) $odfHandler->setImage($key, $value);
|
||||||
|
else $odfHandler->setVars($key, 'ErrorFileNotFound', true, 'UTF-8');
|
||||||
|
}
|
||||||
|
else // Text
|
||||||
|
{
|
||||||
|
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Replace tags of lines
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines = $odfHandler->setSegment('lines');
|
||||||
|
foreach ($object->lines as $line)
|
||||||
|
{
|
||||||
|
$tmparray=$this->get_substitutionarray_lines($line,$outputlangs);
|
||||||
|
complete_substitutions_array($tmparray, $outputlangs, $object, $line, "completesubstitutionarray_lines");
|
||||||
|
// Call the ODTSubstitutionLine hook
|
||||||
|
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs,'substitutionarray'=>&$tmparray,'line'=>$line);
|
||||||
|
$reshook=$hookmanager->executeHooks('ODTSubstitutionLine',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
foreach($tmparray as $key => $val)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$listlines->setVars($key, $val, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
catch(SegmentException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$listlines->merge();
|
||||||
|
}
|
||||||
|
$odfHandler->mergeSegment($listlines);
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
dol_syslog($this->error, LOG_WARNING);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace labels translated
|
||||||
|
$tmparray=$outputlangs->get_translations_for_substitutions();
|
||||||
|
foreach($tmparray as $key=>$value)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$odfHandler->setVars($key, $value, true, 'UTF-8');
|
||||||
|
}
|
||||||
|
catch(OdfException $e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Call the beforeODTSave hook
|
||||||
|
$parameters=array('odfHandler'=>&$odfHandler,'file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
|
||||||
|
$reshook=$hookmanager->executeHooks('beforeODTSave',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
// Write new file
|
||||||
|
if (!empty($conf->global->MAIN_ODT_AS_PDF)) {
|
||||||
|
try {
|
||||||
|
$odfHandler->exportAsAttachedPDF($file);
|
||||||
|
}catch (Exception $e){
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
try {
|
||||||
|
$odfHandler->saveToDisk($file);
|
||||||
|
}catch (Exception $e){
|
||||||
|
$this->error=$e->getMessage();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$reshook=$hookmanager->executeHooks('afterODTCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_UMASK))
|
||||||
|
@chmod($file, octdec($conf->global->MAIN_UMASK));
|
||||||
|
|
||||||
|
$odfHandler=null; // Destroy object
|
||||||
|
|
||||||
|
return 1; // Success
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
0
htdocs/core/modules/askpricesupplier/doc/index.html
Normal file
0
htdocs/core/modules/askpricesupplier/doc/index.html
Normal file
1396
htdocs/core/modules/askpricesupplier/doc/pdf_aurore.modules.php
Normal file
1396
htdocs/core/modules/askpricesupplier/doc/pdf_aurore.modules.php
Normal file
File diff suppressed because it is too large
Load Diff
0
htdocs/core/modules/askpricesupplier/index.html
Normal file
0
htdocs/core/modules/askpricesupplier/index.html
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/propale/mod_propale_marbre.php
|
||||||
|
* \ingroup propale
|
||||||
|
* \brief File of class to manage commercial proposal numbering rules Marbre
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/askpricesupplier/modules_askpricesupplier.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage customer order numbering rules Marbre
|
||||||
|
*/
|
||||||
|
class mod_askpricesupplier_marbre extends ModeleNumRefAskPriceSupplier
|
||||||
|
{
|
||||||
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
var $prefix='DF';
|
||||||
|
var $error='';
|
||||||
|
var $nom = "Marbre";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return description of numbering module
|
||||||
|
*
|
||||||
|
* @return string Text with description
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an example of numbering module values
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
return $this->prefix."0501-0001";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test si les numeros deje en vigueur dans la base ne provoquent pas de
|
||||||
|
* de conflits qui empechera cette numerotation de fonctionner.
|
||||||
|
*
|
||||||
|
* @return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
|
$pryymm=''; $max='';
|
||||||
|
|
||||||
|
$posindice=8;
|
||||||
|
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier";
|
||||||
|
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$row = $db->fetch_row($resql);
|
||||||
|
if ($row) { $pryymm = substr($row[0],0,6); $max=$row[0]; }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $pryymm || preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$pryymm))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorNumRefModel',$max);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next value
|
||||||
|
*
|
||||||
|
* @param Societe $objsoc Object third party
|
||||||
|
* @param Propal $askpricesupplier Object commercial proposal
|
||||||
|
* @return string Next value
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc,$askpricesupplier)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
// D'abord on recupere la valeur max
|
||||||
|
$posindice=8;
|
||||||
|
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max"; // This is standard SQL
|
||||||
|
$sql.= " FROM ".MAIN_DB_PREFIX."askpricesupplier";
|
||||||
|
$sql.= " WHERE ref LIKE '".$this->prefix."____-%'";
|
||||||
|
$sql.= " AND entity = ".$conf->entity;
|
||||||
|
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) $max = intval($obj->max);
|
||||||
|
else $max=0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dol_syslog(get_class($this)."::getNextValue", LOG_DEBUG);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$date = time();
|
||||||
|
$yymm = strftime("%y%m",$date);
|
||||||
|
|
||||||
|
if ($max >= (pow(10, 4) - 1)) $num=$max+1; // If counter > 9999, we do not format on 4 chars, we take number as it is
|
||||||
|
else $num = sprintf("%04s",$max+1);
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||||
|
return $this->prefix.$yymm."-".$num;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next free value
|
||||||
|
*
|
||||||
|
* @param Societe $objsoc Object third party
|
||||||
|
* @param Object $objforref Object for number to search
|
||||||
|
* @return string Next free value
|
||||||
|
*/
|
||||||
|
function getNumRef($objsoc,$objforref)
|
||||||
|
{
|
||||||
|
return $this->getNextValue($objsoc,$objforref);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2007 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.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
|
||||||
|
* 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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/propale/mod_propale_saphir.php
|
||||||
|
* \ingroup propale
|
||||||
|
* \brief File that contains the numbering module rules Saphir
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/modules/askpricesupplier/modules_askpricesupplier.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class of file that contains the numbering module rules Saphir
|
||||||
|
*/
|
||||||
|
class mod_askpricesupplier_saphir extends ModeleNumRefAskPriceSupplier
|
||||||
|
{
|
||||||
|
var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
|
||||||
|
var $error = '';
|
||||||
|
var $nom = 'Saphir';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return description of module
|
||||||
|
*
|
||||||
|
* @return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
$langs->load("bills");
|
||||||
|
|
||||||
|
$form = new Form($this->db);
|
||||||
|
|
||||||
|
$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
|
||||||
|
$texte.= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
$texte.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
$texte.= '<input type="hidden" name="action" value="updateMask">';
|
||||||
|
$texte.= '<input type="hidden" name="maskconstaskpricesupplier" value="ASKPRICESUPPLIER_SAPHIR_MASK">';
|
||||||
|
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||||
|
|
||||||
|
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest"));
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("CommRequest"),$langs->transnoentities("CommRequest"));
|
||||||
|
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||||
|
|
||||||
|
// Parametrage du prefix
|
||||||
|
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||||
|
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskaskpricesupplier" value="'.$conf->global->ASKPRICESUPPLIER_SAPHIR_MASK.'">',$tooltip,1,1).'</td>';
|
||||||
|
|
||||||
|
$texte.= '<td align="left" rowspan="2"> <input type="submit" class="button" value="'.$langs->trans("Modify").'" name="Button"></td>';
|
||||||
|
|
||||||
|
$texte.= '</tr>';
|
||||||
|
|
||||||
|
$texte.= '</table>';
|
||||||
|
$texte.= '</form>';
|
||||||
|
|
||||||
|
return $texte;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi un exemple de numerotation
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
global $conf,$langs,$mysoc;
|
||||||
|
|
||||||
|
$old_code_client=$mysoc->code_client;
|
||||||
|
$mysoc->code_client='CCCCCCCCCC';
|
||||||
|
$numExample = $this->getNextValue($mysoc,'');
|
||||||
|
$mysoc->code_client=$old_code_client;
|
||||||
|
|
||||||
|
if (! $numExample)
|
||||||
|
{
|
||||||
|
$numExample = 'NotConfigured';
|
||||||
|
}
|
||||||
|
return $numExample;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return next value
|
||||||
|
*
|
||||||
|
* @param Societe $objsoc Object third party
|
||||||
|
* @param Propal $askpricesupplier Object askpricesupplier
|
||||||
|
* @return string Value if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc,$askpricesupplier)
|
||||||
|
{
|
||||||
|
global $db,$conf;
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||||
|
|
||||||
|
// On defini critere recherche compteur
|
||||||
|
$mask=$conf->global->ASKPRICESUPPLIER_SAPHIR_MASK;
|
||||||
|
|
||||||
|
if (! $mask)
|
||||||
|
{
|
||||||
|
$this->error='NotConfigured';
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$date=$askpricesupplier->datep;
|
||||||
|
$customercode=$objsoc->code_client;
|
||||||
|
$numFinal=get_next_value($db,$mask,'askpricesupplier','ref','',$customercode,$date);
|
||||||
|
|
||||||
|
return $numFinal;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.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/>.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/core/modules/propale/modules_propale.php
|
||||||
|
* \ingroup propale
|
||||||
|
* \brief Fichier contenant la classe mere de generation des propales en PDF
|
||||||
|
* et la classe mere de numerotation des propales
|
||||||
|
*/
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Requis car utilise dans les classes qui heritent
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe mere des modeles de propale
|
||||||
|
*/
|
||||||
|
abstract class ModelePDFAskPriceSupplier extends CommonDocGenerator
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return list of active generation modules
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param string $maxfilenamelength Max length of value to show
|
||||||
|
* @return array List of templates
|
||||||
|
*/
|
||||||
|
static function liste_modeles($db,$maxfilenamelength=0)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$type='askpricesupplier';
|
||||||
|
$liste=array();
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||||
|
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe mere des modeles de numerotation des references de propales
|
||||||
|
*/
|
||||||
|
abstract class ModeleNumRefAskPriceSupplier
|
||||||
|
{
|
||||||
|
var $error='';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return if a module can be used or not
|
||||||
|
*
|
||||||
|
* @return boolean true if module can be used
|
||||||
|
*/
|
||||||
|
function isEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi la description par defaut du modele de numerotation
|
||||||
|
*
|
||||||
|
* @return string Texte descripif
|
||||||
|
*/
|
||||||
|
function info()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
return $langs->trans("NoDescription");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi un exemple de numerotation
|
||||||
|
*
|
||||||
|
* @return string Example
|
||||||
|
*/
|
||||||
|
function getExample()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
return $langs->trans("NoExample");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test si les numeros deja en vigueur dans la base ne provoquent pas de
|
||||||
|
* de conflits qui empechera cette numerotation de fonctionner.
|
||||||
|
*
|
||||||
|
* @return boolean false si conflit, true si ok
|
||||||
|
*/
|
||||||
|
function canBeActivated()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi prochaine valeur attribuee
|
||||||
|
*
|
||||||
|
* @param Societe $objsoc Object third party
|
||||||
|
* @param Propal $propal Object commercial proposal
|
||||||
|
* @return string Valeur
|
||||||
|
*/
|
||||||
|
function getNextValue($objsoc,$propal)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
return $langs->trans("NotAvailable");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renvoi version du module numerotation
|
||||||
|
*
|
||||||
|
* @return string Valeur
|
||||||
|
*/
|
||||||
|
function getVersion()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
|
if ($this->version == 'development') return $langs->trans("VersionDevelopment");
|
||||||
|
if ($this->version == 'experimental') return $langs->trans("VersionExperimental");
|
||||||
|
if ($this->version == 'dolibarr') return DOL_VERSION;
|
||||||
|
if ($this->version) return $this->version;
|
||||||
|
return $langs->trans("NotAvailable");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a document onto disk according to template module.
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param object $object Object askpricesupplier
|
||||||
|
* @param string $modele Force model to use ('' to not force)
|
||||||
|
* @param Translate $outputlangs Object langs to use for output
|
||||||
|
* @param int $hidedetails Hide details of lines
|
||||||
|
* @param int $hidedesc Hide description
|
||||||
|
* @param int $hideref Hide ref
|
||||||
|
* @return int 0 if KO, 1 if OK
|
||||||
|
* @deprecated Use the new function generateDocument of Propal class
|
||||||
|
*/
|
||||||
|
function askpricesupplier_pdf_create(DoliDB $db, AskPriceSupplier $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
|
||||||
|
{
|
||||||
|
return $object->generateDocument($modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||||
|
}
|
||||||
|
|
||||||
238
htdocs/core/modules/modAskPriceSupplier.class.php
Normal file
238
htdocs/core/modules/modAskPriceSupplier.class.php
Normal file
@@ -0,0 +1,238 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
|
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||||
|
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||||
|
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
|
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||||
|
*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup askpricesupplier Module de demandes de prix fournisseurs
|
||||||
|
* \brief Module pour gerer la tenue des demandes fournisseurs
|
||||||
|
* \file htdocs/core/modules/modAskPriceSupplier.class.php
|
||||||
|
* \ingroup askpricesupplier
|
||||||
|
* \brief Fichier de description et activation du module AskPriceSupplier
|
||||||
|
*/
|
||||||
|
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe de description et activation du module AskPriceSupllier
|
||||||
|
*/
|
||||||
|
class modAskPriceSupplier extends DolibarrModules
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
function __construct($db)
|
||||||
|
{
|
||||||
|
global $conf;
|
||||||
|
|
||||||
|
$this->db = $db;
|
||||||
|
$this->numero = 1120;
|
||||||
|
|
||||||
|
$this->family = "products";
|
||||||
|
$this->name = preg_replace('/^mod/i','',get_class($this));
|
||||||
|
$this->description = "askpricesupplierDESC";
|
||||||
|
|
||||||
|
$this->version = 'experimental';
|
||||||
|
|
||||||
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||||
|
$this->special = 0;
|
||||||
|
$this->picto='askpricesupplier';
|
||||||
|
|
||||||
|
$this->dirs = array();
|
||||||
|
|
||||||
|
// Dependancies
|
||||||
|
$this->depends = array('modFournisseur');
|
||||||
|
$this->requiredby = array();
|
||||||
|
$this->config_page_url = array("askpricesupplier.php");
|
||||||
|
$this->langfiles = array("askpricesupplier");
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
$this->const = array();
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
$this->const[$r][0] = "ASKPRICESUPPLIER_ADDON_PDF";
|
||||||
|
$this->const[$r][1] = "chaine";
|
||||||
|
$this->const[$r][2] = "aurore";
|
||||||
|
$this->const[$r][3] = 'Name of submodule to generate PDF for supplier quotation request';
|
||||||
|
$this->const[$r][4] = 0;
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->const[$r][0] = "ASKPRICESUPPLIER_ADDON";
|
||||||
|
$this->const[$r][1] = "chaine";
|
||||||
|
$this->const[$r][2] = "mod_askpricesupplier_marbre";
|
||||||
|
$this->const[$r][3] = 'Name of submodule to number supplier quotation request';
|
||||||
|
$this->const[$r][4] = 0;
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->const[$r][0] = "ASKPRICESUPPLIER_ADDON_PDF_ODT_PATH";
|
||||||
|
$this->const[$r][1] = "chaine";
|
||||||
|
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/askpricesupplier";
|
||||||
|
$this->const[$r][3] = "";
|
||||||
|
$this->const[$r][4] = 0;
|
||||||
|
|
||||||
|
// Boxes
|
||||||
|
$this->boxes = array();
|
||||||
|
|
||||||
|
// Permissions
|
||||||
|
$this->rights = array();
|
||||||
|
$this->rights_class = 'askpricesupplier';
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Read supplier proposals'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'lire';
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Create/modify supplier proposals'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'creer';
|
||||||
|
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Validate supplier proposals'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = '';
|
||||||
|
$this->rights[$r][5] = 'validate';
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Envoyer les demandes fournisseurs'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = '';
|
||||||
|
$this->rights[$r][5] = 'send_advance';
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Delete supplier proposals'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'supprimer';
|
||||||
|
|
||||||
|
$r++;
|
||||||
|
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||||
|
$this->rights[$r][1] = 'Close supplier price requests'; // libelle de la permission
|
||||||
|
$this->rights[$r][3] = 0; // La permission est-elle une permission par defaut
|
||||||
|
$this->rights[$r][4] = 'cloturer';
|
||||||
|
|
||||||
|
// Main menu entries
|
||||||
|
$this->menu = array(); // List of menus to add
|
||||||
|
$r=0;
|
||||||
|
$this->menu[$r]=array(
|
||||||
|
'fk_menu'=>'fk_mainmenu=commercial', // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
|
||||||
|
'type'=>'left', // This is a Left menu entry
|
||||||
|
'titre'=>'askpricesupplierMENU_LEFT_TITLE',
|
||||||
|
'leftmenu'=>'askpricesuppliersubmenu',
|
||||||
|
'url'=>'/comm/askpricesupplier/index.php',
|
||||||
|
'langs'=>'askpricesupplier', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
|
||||||
|
'enabled'=>'$conf->askpricesupplier->enabled', // Define condition to show or hide menu entry. Use '$conf->mymodule->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
|
'perms'=>'$user->rights->askpricesupplier->lire', // Use 'perms'=>'$user->rights->mymodule->level1->level2' if you want your menu with a permission rules
|
||||||
|
'user'=>2 // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
);
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r]=array(
|
||||||
|
'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=askpricesuppliersubmenu',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'askpricesupplierMENU_LEFT_TITLE_NEW',
|
||||||
|
'url'=>'/comm/askpricesupplier/card.php?action=create',
|
||||||
|
'langs'=>'askpricesupplier',
|
||||||
|
'enabled'=>'$conf->askpricesupplier->enabled',
|
||||||
|
'perms'=>'$user->rights->askpricesupplier->creer',
|
||||||
|
'user'=>2
|
||||||
|
);
|
||||||
|
$r++;
|
||||||
|
|
||||||
|
$this->menu[$r]=array(
|
||||||
|
'fk_menu'=>'fk_mainmenu=commercial,fk_leftmenu=askpricesuppliersubmenu',
|
||||||
|
'type'=>'left',
|
||||||
|
'titre'=>'askpricesupplierMENU_LEFT_TITLE_LIST',
|
||||||
|
'url'=>'/comm/askpricesupplier/list.php',
|
||||||
|
'langs'=>'askpricesupplier',
|
||||||
|
'enabled'=>'$conf->askpricesupplier->enabled',
|
||||||
|
'perms'=>'$user->rights->askpricesupplier->lire',
|
||||||
|
'user'=>2
|
||||||
|
);
|
||||||
|
$r++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is enabled.
|
||||||
|
* The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
|
||||||
|
* It also creates data directories
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function init($options='')
|
||||||
|
{
|
||||||
|
global $conf,$langs;
|
||||||
|
|
||||||
|
// Remove permissions and default values
|
||||||
|
$this->remove($options);
|
||||||
|
|
||||||
|
//ODT template
|
||||||
|
$src=DOL_DOCUMENT_ROOT.'/install/doctemplates/askpricesupplier/template_askpricesupplier.odt';
|
||||||
|
$dirodt=DOL_DATA_ROOT.'/doctemplates/askpricesupplier';
|
||||||
|
$dest=$dirodt.'/template_askpricesupplier.odt';
|
||||||
|
|
||||||
|
if (file_exists($src) && ! file_exists($dest))
|
||||||
|
{
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
dol_mkdir($dirodt);
|
||||||
|
$result=dol_copy($src,$dest,0,0);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
$this->error=$langs->trans('ErrorFailToCopyFile',$src,$dest);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql = array(
|
||||||
|
"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = '".$this->const[0][2]."' AND entity = ".$conf->entity,
|
||||||
|
"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('".$this->const[0][2]."','askpricesupplier',".$conf->entity.")",
|
||||||
|
);
|
||||||
|
|
||||||
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is disabled.
|
||||||
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
function remove($options='')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_remove($sql,$options);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,7 +47,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','expensereport')))
|
if (in_array($modulepart,array('facture_fournisseur','commande_fournisseur','facture','commande','propal','askpricesupplier','ficheinter','contract','project','project_task','expensereport')))
|
||||||
{
|
{
|
||||||
$savingdocmask=$object->ref.'___file__';
|
$savingdocmask=$object->ref.'___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;}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
$usemargins=0;
|
$usemargins=0;
|
||||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal', 'askpricesupplier','commande'))) $usemargins=1;
|
||||||
|
|
||||||
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||||
if (empty($dateSelector)) $dateSelector=0;
|
if (empty($dateSelector)) $dateSelector=0;
|
||||||
@@ -43,7 +43,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
|||||||
// Define colspan for button Add
|
// Define colspan for button Add
|
||||||
$colspan = 3; // Col total ht + col edit + col delete
|
$colspan = 3; // Col total ht + col edit + col delete
|
||||||
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
||||||
if (in_array($object->element,array('propal','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button
|
if (in_array($object->element,array('propal', 'askpricesupplier','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
|
||||||
@@ -52,6 +52,9 @@ if (in_array($object->element,array('propal','facture','invoice','commande','ord
|
|||||||
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
<td<?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
|
||||||
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
|
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php if ($object->element == 'askpricesupplier') { ?>
|
||||||
|
<td align="right"><span id="title_fourn_ref"><?php echo $langs->trans('AskPriceSupplierRefFourn'); ?></span></td>
|
||||||
|
<?php } ?>
|
||||||
<td align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
|
<td align="right"><span id="title_vat"><?php echo $langs->trans('VAT'); ?></span></td>
|
||||||
<td align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
|
<td align="right"><span id="title_up_ht"><?php echo $langs->trans('PriceUHT'); ?></span></td>
|
||||||
<?php if (! empty($inputalsopricewithtax)) { ?>
|
<?php if (! empty($inputalsopricewithtax)) { ?>
|
||||||
@@ -196,6 +199,10 @@ else {
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<?php if ($object->element == 'askpricesupplier') { ?>
|
||||||
|
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="" size="12"></td>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<td align="right"><?php
|
<td align="right"><?php
|
||||||
if (GETPOST('prod_entry_mode') != 'predef')
|
if (GETPOST('prod_entry_mode') != 'predef')
|
||||||
{
|
{
|
||||||
@@ -211,7 +218,7 @@ else {
|
|||||||
</td>
|
</td>
|
||||||
<?php if (! empty($inputalsopricewithtax)) { ?>
|
<?php if (! empty($inputalsopricewithtax)) { ?>
|
||||||
<td align="right">
|
<td align="right">
|
||||||
<?php if (GETPOST('prod_entry_mode') != 'predef') { ?>
|
<?php if ($object->element == 'askpricesupplier' || GETPOST('prod_entry_mode') != 'predef') { ?>
|
||||||
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?$_POST["price_ttc"]:''); ?>">
|
<input type="text" size="5" name="price_ttc" id="price_ttc" class="flat" value="<?php echo (isset($_POST["price_ttc"])?$_POST["price_ttc"]:''); ?>">
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
</td>
|
</td>
|
||||||
@@ -271,6 +278,9 @@ else {
|
|||||||
elseif ($this->table_element_line=='propaldet') {
|
elseif ($this->table_element_line=='propaldet') {
|
||||||
$newline = new PropaleLigne($this->db);
|
$newline = new PropaleLigne($this->db);
|
||||||
}
|
}
|
||||||
|
elseif ($this->table_element_line=='askpricesupplierdet') {
|
||||||
|
$newline = new AskPriceSupplierLigne($this->db);
|
||||||
|
}
|
||||||
elseif ($this->table_element_line=='facturedet') {
|
elseif ($this->table_element_line=='facturedet') {
|
||||||
$newline = new FactureLigne($this->db);
|
$newline = new FactureLigne($this->db);
|
||||||
}
|
}
|
||||||
@@ -297,7 +307,7 @@ if (! empty($conf->service->enabled) && $dateSelector && GETPOST('type') != '0')
|
|||||||
else $colspan = 9;
|
else $colspan = 9;
|
||||||
if($this->situation_cycle_ref) $colspan++;
|
if($this->situation_cycle_ref) $colspan++;
|
||||||
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
||||||
if (in_array($object->element,array('propal','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button
|
if (in_array($object->element,array('propal', 'askpricesupplier','facture','invoice','commande','order'))) $colspan++; // With this, there is a column move button
|
||||||
|
|
||||||
if (! empty($usemargins))
|
if (! empty($usemargins))
|
||||||
{
|
{
|
||||||
@@ -572,12 +582,14 @@ function setforpredef() {
|
|||||||
jQuery("#select_type").val(-1);
|
jQuery("#select_type").val(-1);
|
||||||
jQuery("#prod_entry_mode_free").attr('checked',false);
|
jQuery("#prod_entry_mode_free").attr('checked',false);
|
||||||
jQuery("#prod_entry_mode_predef").attr('checked',true);
|
jQuery("#prod_entry_mode_predef").attr('checked',true);
|
||||||
|
<?php if ($object->element != 'askpricesupplier') { ?>
|
||||||
jQuery("#price_ht").hide();
|
jQuery("#price_ht").hide();
|
||||||
|
jQuery("#title_up_ht").hide();
|
||||||
|
<?php } ?>
|
||||||
jQuery("#price_ttc").hide(); // May no exists
|
jQuery("#price_ttc").hide(); // May no exists
|
||||||
jQuery("#tva_tx").hide();
|
jQuery("#tva_tx").hide();
|
||||||
jQuery("#buying_price").show();
|
jQuery("#buying_price").show();
|
||||||
jQuery("#title_vat").hide();
|
jQuery("#title_vat").hide();
|
||||||
jQuery("#title_up_ht").hide();
|
|
||||||
jQuery("#title_up_ttc").hide();
|
jQuery("#title_up_ttc").hide();
|
||||||
jQuery("#np_marginRate").hide(); // May no exists
|
jQuery("#np_marginRate").hide(); // May no exists
|
||||||
jQuery("#np_markRate").hide(); // May no exists
|
jQuery("#np_markRate").hide(); // May no exists
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
$usemargins=0;
|
$usemargins=0;
|
||||||
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal','commande'))) $usemargins=1;
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal', 'askpricesupplier','commande'))) $usemargins=1;
|
||||||
|
|
||||||
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
global $forceall, $senderissupplier, $inputalsopricewithtax;
|
||||||
if (empty($dateSelector)) $dateSelector=0;
|
if (empty($dateSelector)) $dateSelector=0;
|
||||||
@@ -43,7 +43,7 @@ if (empty($inputalsopricewithtax)) $inputalsopricewithtax=0;
|
|||||||
// Define colspan for button Add
|
// Define colspan for button Add
|
||||||
$colspan = 3; // Col total ht + col edit + col delete
|
$colspan = 3; // Col total ht + col edit + col delete
|
||||||
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
if (! empty($inputalsopricewithtax)) $colspan++; // We add 1 if col total ttc
|
||||||
if (in_array($object->element,array('propal','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
|
if (in_array($object->element,array('propal','askpricesupplier','facture','invoice','commande','order','order_supplier','invoice_supplier'))) $colspan++; // With this, there is a column move button
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
|
<!-- BEGIN PHP TEMPLATE objectline_edit.tpl.php -->
|
||||||
@@ -100,6 +100,10 @@ $coldisplay=-1; // We remove first td
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
<?php if ($object->element == 'askpricesupplier') { ?>
|
||||||
|
<td align="right"><input id="fourn_ref" name="fourn_ref" class="flat" value="<?php echo $line->ref_fourn; ?>" size="12"></td>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$coldisplay++;
|
$coldisplay++;
|
||||||
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
|
if ($this->situation_counter == 1 || !$this->situation_cycle_ref) {
|
||||||
|
|||||||
@@ -35,6 +35,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins;
|
global $forceall, $senderissupplier, $inputalsopricewithtax, $usemargins;
|
||||||
|
|
||||||
|
$usemargins=0;
|
||||||
|
if (! empty($conf->margin->enabled) && ! empty($object->element) && in_array($object->element,array('facture','propal', 'askpricesupplier','commande'))) $usemargins=1;
|
||||||
|
|
||||||
if (empty($dateSelector)) $dateSelector=0;
|
if (empty($dateSelector)) $dateSelector=0;
|
||||||
if (empty($forceall)) $forceall=0;
|
if (empty($forceall)) $forceall=0;
|
||||||
if (empty($senderissupplier)) $senderissupplier=0;
|
if (empty($senderissupplier)) $senderissupplier=0;
|
||||||
@@ -119,7 +123,9 @@ if (empty($usemargins)) $usemargins=0;
|
|||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
<?php if ($object->element == 'askpricesupplier') { ?>
|
||||||
|
<td align="right"><?php echo $line->ref_fourn; ?></td>
|
||||||
|
<?php } ?>
|
||||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo vatrate($line->tva_tx,'%',$line->info_bits); ?></td>
|
||||||
|
|
||||||
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ht)?price($line->pu_ht):price($line->subprice)); ?></td>
|
<td align="right" class="nowrap"><?php $coldisplay++; ?><?php echo (isset($line->pu_ht)?price($line->pu_ht):price($line->subprice)); ?></td>
|
||||||
|
|||||||
@@ -151,6 +151,19 @@ class InterfaceDemo extends DolibarrTriggers
|
|||||||
case 'LINEPROPAL_UPDATE':
|
case 'LINEPROPAL_UPDATE':
|
||||||
case 'LINEPROPAL_DELETE':
|
case 'LINEPROPAL_DELETE':
|
||||||
|
|
||||||
|
// Askpricesupplier
|
||||||
|
case 'ASKPRICESUPPLIER_CREATE':
|
||||||
|
case 'ASKPRICESUPPLIER_CLONE':
|
||||||
|
case 'ASKPRICESUPPLIER_MODIFY':
|
||||||
|
case 'ASKPRICESUPPLIER_VALIDATE':
|
||||||
|
case 'ASKPRICESUPPLIER_SENTBYMAIL':
|
||||||
|
case 'ASKPRICESUPPLIER_CLOSE_SIGNED':
|
||||||
|
case 'ASKPRICESUPPLIER_CLOSE_REFUSED':
|
||||||
|
case 'ASKPRICESUPPLIER_DELETE':
|
||||||
|
case 'LINEASKPRICESUPPLIER_INSERT':
|
||||||
|
case 'LINEASKPRICESUPPLIER_UPDATE':
|
||||||
|
case 'LINEASKPRICESUPPLIER_DELETE':
|
||||||
|
|
||||||
// Contracts
|
// Contracts
|
||||||
case 'CONTRACT_CREATE':
|
case 'CONTRACT_CREATE':
|
||||||
case 'CONTRACT_ACTIVATE':
|
case 'CONTRACT_ACTIVATE':
|
||||||
|
|||||||
@@ -499,6 +499,12 @@ if ($object->id > 0)
|
|||||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fourn/facture/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddBill").'</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($conf->askpricesupplier->enabled && $user->rights->askpricesupplier->creer)
|
||||||
|
{
|
||||||
|
$langs->load("askpricesupplier");
|
||||||
|
print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/askpricesupplier/card.php?action=create&socid='.$object->id.'">'.$langs->trans("AddAskPriceSupplier").'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
if ($user->rights->fournisseur->facture->creer)
|
if ($user->rights->fournisseur->facture->creer)
|
||||||
{
|
{
|
||||||
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
if (! empty($orders2invoice) && $orders2invoice > 0) print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/fourn/commande/orderstoinvoice.php?socid='.$object->id.'">'.$langs->trans("CreateInvoiceForThisCustomer").'</a></div>';
|
||||||
|
|||||||
@@ -88,6 +88,11 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
|
|
||||||
var $extraparams=array();
|
var $extraparams=array();
|
||||||
|
|
||||||
|
//Ajout pour askpricesupplier
|
||||||
|
var $origin;
|
||||||
|
var $origin_id;
|
||||||
|
var $linked_objects=array();
|
||||||
|
var $lines = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@@ -984,30 +989,27 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
// Add entry into log
|
// Add entry into log
|
||||||
$this->log($user, 0, $now);
|
$this->log($user, 0, $now);
|
||||||
|
|
||||||
if (! $error)
|
// Add link with price request and supplier order
|
||||||
|
if ($this->id)
|
||||||
{
|
{
|
||||||
$action='create';
|
$this->ref="(PROV".$this->id.")";
|
||||||
|
|
||||||
// Actions on extra fields (by external module or standard code)
|
// Add object linked
|
||||||
// FIXME le hook fait double emploi avec le trigger !!
|
if (is_array($this->linked_objects) && ! empty($this->linked_objects))
|
||||||
$hookmanager->initHooks(array('supplierorderdao'));
|
|
||||||
$parameters=array('socid'=>$this->id);
|
|
||||||
$reshook=$hookmanager->executeHooks('insertExtraFields',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
|
|
||||||
if (empty($reshook))
|
|
||||||
{
|
{
|
||||||
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used
|
foreach($this->linked_objects as $origin => $origin_id)
|
||||||
{
|
{
|
||||||
$result=$this->insertExtraFields();
|
$ret = $this->add_object_linked($origin, $origin_id);
|
||||||
if ($result < 0)
|
if (! $ret)
|
||||||
{
|
{
|
||||||
|
dol_print_error($this->db);
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($reshook < 0) $error++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('ORDER_SUPPLIER_CREATE',$user);
|
$result=$this->call_trigger('ORDER_SUPPLIER_CREATE',$user);
|
||||||
@@ -1024,7 +1026,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
@@ -1032,7 +1034,7 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this->error=$this->db->error();
|
$this->error=$this->db->lasterror();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -1521,6 +1523,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete linked object
|
||||||
|
$res = $this->deleteObjectLinked();
|
||||||
|
if ($res < 0) $error++;
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// We remove directory
|
// We remove directory
|
||||||
@@ -1691,6 +1697,40 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the id projet
|
||||||
|
*
|
||||||
|
* @param User $user Objet utilisateur qui modifie
|
||||||
|
* @param int $id_projet Date de livraison
|
||||||
|
* @return int <0 si ko, >0 si ok
|
||||||
|
*/
|
||||||
|
function set_id_projet($user, $id_projet)
|
||||||
|
{
|
||||||
|
if ($user->rights->fournisseur->commande->creer)
|
||||||
|
{
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur";
|
||||||
|
$sql.= " SET fk_projet = ".($id_projet > 0 ? (int) $id_projet : 'null');
|
||||||
|
$sql.= " WHERE rowid = ".$this->id;
|
||||||
|
|
||||||
|
dol_syslog(get_class($this)."::set_id_projet", LOG_DEBUG);
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
$this->fk_projet = $id_projet;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a supplier order from a customer order
|
* Update a supplier order from a customer order
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.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.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||||
|
if (! empty($conf->askpricesupplier->enabled))
|
||||||
|
require DOL_DOCUMENT_ROOT . '/comm/askpricesupplier/class/askpricesupplier.class.php';
|
||||||
if (!empty($conf->produit->enabled))
|
if (!empty($conf->produit->enabled))
|
||||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||||
if (!empty($conf->projet->enabled))
|
if (!empty($conf->projet->enabled))
|
||||||
@@ -52,6 +54,7 @@ $langs->load('sendings');
|
|||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
$langs->load('bills');
|
$langs->load('bills');
|
||||||
$langs->load('propal');
|
$langs->load('propal');
|
||||||
|
$langs->load('askpricesupplier');
|
||||||
$langs->load('deliveries');
|
$langs->load('deliveries');
|
||||||
$langs->load('products');
|
$langs->load('products');
|
||||||
$langs->load('stocks');
|
$langs->load('stocks');
|
||||||
@@ -66,6 +69,10 @@ $projectid = GETPOST('projectid','int');
|
|||||||
$cancel = GETPOST('cancel','alpha');
|
$cancel = GETPOST('cancel','alpha');
|
||||||
$lineid = GETPOST('lineid', 'int');
|
$lineid = GETPOST('lineid', 'int');
|
||||||
|
|
||||||
|
$lineid = GETPOST('lineid', 'int');
|
||||||
|
$origin = GETPOST('origin', 'alpha');
|
||||||
|
$originid = (GETPOST('originid', 'int') ? GETPOST('originid', 'int') : GETPOST('origin_id', 'int')); // For backward compatibility
|
||||||
|
|
||||||
//PDF
|
//PDF
|
||||||
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
$hidedetails = (GETPOST('hidedetails','int') ? GETPOST('hidedetails','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS) ? 1 : 0));
|
||||||
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
$hidedesc = (GETPOST('hidedesc','int') ? GETPOST('hidedesc','int') : (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC) ? 1 : 0));
|
||||||
@@ -832,6 +839,7 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create an order
|
* Create an order
|
||||||
*/
|
*/
|
||||||
@@ -868,6 +876,125 @@ if (empty($reshook))
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
{
|
||||||
|
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||||
|
if (! empty($origin) && ! empty($originid))
|
||||||
|
{
|
||||||
|
$element = 'comm/askpricesupplier';
|
||||||
|
$subelement = 'askpricesupplier';
|
||||||
|
|
||||||
|
$object->origin = $origin;
|
||||||
|
$object->origin_id = $originid;
|
||||||
|
|
||||||
|
// Possibility to add external linked objects with hooks
|
||||||
|
$object->linked_objects [$object->origin] = $object->origin_id;
|
||||||
|
$other_linked_objects = GETPOST('other_linked_objects', 'array');
|
||||||
|
if (! empty($other_linked_objects)) {
|
||||||
|
$object->linked_objects = array_merge($object->linked_objects, $other_linked_objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
$object_id = $object->create($user);
|
||||||
|
|
||||||
|
if ($object_id > 0)
|
||||||
|
{
|
||||||
|
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||||
|
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
|
$srcobject = new $classname($db);
|
||||||
|
$srcobject->fetch($object->origin_id);
|
||||||
|
|
||||||
|
$object->set_date_livraison($user, $srcobject->date_livraison);
|
||||||
|
$object->set_id_projet($user, $srcobject->fk_project);
|
||||||
|
|
||||||
|
dol_syslog("Try to find source object origin=" . $object->origin . " originid=" . $object->origin_id . " to add lines");
|
||||||
|
$result = $srcobject->fetch($object->origin_id);
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
$lines = $srcobject->lines;
|
||||||
|
if (empty($lines) && method_exists($srcobject, 'fetch_lines'))
|
||||||
|
{
|
||||||
|
$srcobject->fetch_lines();
|
||||||
|
$lines = $srcobject->lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
$fk_parent_line = 0;
|
||||||
|
$num = count($lines);
|
||||||
|
|
||||||
|
$productsupplier = new ProductFournisseur($db);
|
||||||
|
|
||||||
|
for($i = 0; $i < $num; $i ++)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (empty($lines[$i]->subprice) || $lines[$i]->qty <= 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
$label = (! empty($lines [$i]->label) ? $lines [$i]->label : '');
|
||||||
|
$desc = (! empty($lines [$i]->desc) ? $lines [$i]->desc : $lines [$i]->libelle);
|
||||||
|
$product_type = (! empty($lines [$i]->product_type) ? $lines [$i]->product_type : 0);
|
||||||
|
|
||||||
|
// Reset fk_parent_line for no child products and special product
|
||||||
|
if (($lines [$i]->product_type != 9 && empty($lines [$i]->fk_parent_line)) || $lines [$i]->product_type == 9) {
|
||||||
|
$fk_parent_line = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extrafields
|
||||||
|
if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines [$i], 'fetch_optionals')) // For avoid conflicts if
|
||||||
|
// trigger used
|
||||||
|
{
|
||||||
|
$lines [$i]->fetch_optionals($lines [$i]->rowid);
|
||||||
|
$array_option = $lines [$i]->array_options;
|
||||||
|
}
|
||||||
|
|
||||||
|
$idprod = $productsupplier->find_min_price_product_fournisseur($lines [$i]->fk_product, $lines [$i]->qty);
|
||||||
|
$res = $productsupplier->fetch($idProductFourn);
|
||||||
|
|
||||||
|
$result = $object->addline(
|
||||||
|
$desc,
|
||||||
|
$lines [$i]->subprice,
|
||||||
|
$lines [$i]->qty,
|
||||||
|
$lines [$i]->tva_tx,
|
||||||
|
$lines [$i]->localtax1_tx,
|
||||||
|
$lines [$i]->localtax2_tx,
|
||||||
|
$lines [$i]->fk_product,
|
||||||
|
$productsupplier->product_fourn_price_id,
|
||||||
|
$productsupplier->ref_fourn,
|
||||||
|
$lines [$i]->remise_percent,
|
||||||
|
'HT',
|
||||||
|
0,
|
||||||
|
$lines [$i]->product_type,
|
||||||
|
'',
|
||||||
|
'',
|
||||||
|
null,
|
||||||
|
null
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($result < 0) {
|
||||||
|
$error ++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Defined the new fk_parent_line
|
||||||
|
if ($result > 0 && $lines [$i]->product_type == 9) {
|
||||||
|
$fk_parent_line = $result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hooks
|
||||||
|
$parameters = array('objFrom' => $srcobject);
|
||||||
|
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||||
|
// modified by hook
|
||||||
|
if ($reshook < 0)
|
||||||
|
$error ++;
|
||||||
|
} else {
|
||||||
|
setEventMessage($srcobject->error, 'errors');
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
setEventMessage($object->error, 'errors');
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
$id = $object->create($user);
|
$id = $object->create($user);
|
||||||
if ($id < 0)
|
if ($id < 0)
|
||||||
@@ -876,6 +1003,7 @@ if (empty($reshook))
|
|||||||
setEventMessage($langs->trans($object->error), 'errors');
|
setEventMessage($langs->trans($object->error), 'errors');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($error)
|
if ($error)
|
||||||
{
|
{
|
||||||
@@ -1243,7 +1371,7 @@ $productstatic = new Product($db);
|
|||||||
/* *************************************************************************** */
|
/* *************************************************************************** */
|
||||||
|
|
||||||
$now=dol_now();
|
$now=dol_now();
|
||||||
if ($action=="create")
|
if ($action=='create')
|
||||||
{
|
{
|
||||||
print_fiche_titre($langs->trans('NewOrder'));
|
print_fiche_titre($langs->trans('NewOrder'));
|
||||||
|
|
||||||
@@ -1256,12 +1384,68 @@ if ($action=="create")
|
|||||||
$societe->fetch($socid);
|
$societe->fetch($socid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($origin) && ! empty($originid))
|
||||||
|
{
|
||||||
|
// Parse element/subelement (ex: project_task)
|
||||||
|
$element = $subelement = $origin;
|
||||||
|
if (preg_match('/^([^_]+)_([^_]+)/i', $origin, $regs)) {
|
||||||
|
$element = $regs [1];
|
||||||
|
$subelement = $regs [2];
|
||||||
|
}
|
||||||
|
|
||||||
|
$element = 'comm/askpricesupplier';
|
||||||
|
$subelement = 'askpricesupplier';
|
||||||
|
|
||||||
|
dol_include_once('/' . $element . '/class/' . $subelement . '.class.php');
|
||||||
|
|
||||||
|
$classname = ucfirst($subelement);
|
||||||
|
$objectsrc = new $classname($db);
|
||||||
|
$objectsrc->fetch($originid);
|
||||||
|
if (empty($objectsrc->lines) && method_exists($objectsrc, 'fetch_lines'))
|
||||||
|
$objectsrc->fetch_lines();
|
||||||
|
$objectsrc->fetch_thirdparty();
|
||||||
|
|
||||||
|
// Replicate extrafields
|
||||||
|
$objectsrc->fetch_optionals($originid);
|
||||||
|
$object->array_options = $objectsrc->array_options;
|
||||||
|
|
||||||
|
$projectid = (! empty($objectsrc->fk_project) ? $objectsrc->fk_project : '');
|
||||||
|
$ref_client = (! empty($objectsrc->ref_client) ? $objectsrc->ref_client : '');
|
||||||
|
|
||||||
|
$soc = $objectsrc->client;
|
||||||
|
$cond_reglement_id = (!empty($objectsrc->cond_reglement_id)?$objectsrc->cond_reglement_id:(!empty($soc->cond_reglement_id)?$soc->cond_reglement_id:1));
|
||||||
|
$mode_reglement_id = (!empty($objectsrc->mode_reglement_id)?$objectsrc->mode_reglement_id:(!empty($soc->mode_reglement_id)?$soc->mode_reglement_id:0));
|
||||||
|
$fk_account = (! empty($objectsrc->fk_account)?$objectsrc->fk_account:(! empty($soc->fk_account)?$soc->fk_account:0));
|
||||||
|
$availability_id = (!empty($objectsrc->availability_id)?$objectsrc->availability_id:(!empty($soc->availability_id)?$soc->availability_id:0));
|
||||||
|
$shipping_method_id = (! empty($objectsrc->shipping_method_id)?$objectsrc->shipping_method_id:(! empty($soc->shipping_method_id)?$soc->shipping_method_id:0));
|
||||||
|
$demand_reason_id = (!empty($objectsrc->demand_reason_id)?$objectsrc->demand_reason_id:(!empty($soc->demand_reason_id)?$soc->demand_reason_id:0));
|
||||||
|
$remise_percent = (!empty($objectsrc->remise_percent)?$objectsrc->remise_percent:(!empty($soc->remise_percent)?$soc->remise_percent:0));
|
||||||
|
$remise_absolue = (!empty($objectsrc->remise_absolue)?$objectsrc->remise_absolue:(!empty($soc->remise_absolue)?$soc->remise_absolue:0));
|
||||||
|
$dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE)?-1:'';
|
||||||
|
|
||||||
|
$datedelivery = (! empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : '');
|
||||||
|
|
||||||
|
$note_private = (! empty($objectsrc->note_private) ? $objectsrc->note_private : (! empty($objectsrc->note_private) ? $objectsrc->note_private : ''));
|
||||||
|
$note_public = (! empty($objectsrc->note_public) ? $objectsrc->note_public : '');
|
||||||
|
|
||||||
|
// Object source contacts list
|
||||||
|
$srccontactslist = $objectsrc->liste_contact(- 1, 'external', 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
$cond_reglement_id = $societe->cond_reglement_supplier_id;
|
||||||
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
$mode_reglement_id = $societe->mode_reglement_supplier_id;
|
||||||
|
}
|
||||||
|
|
||||||
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="add">';
|
print '<input type="hidden" name="action" value="add">';
|
||||||
|
print '<input type="hidden" name="socid" value="' . $soc->id . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="remise_percent" value="' . $soc->remise_percent . '">';
|
||||||
|
print '<input type="hidden" name="origin" value="' . $origin . '">';
|
||||||
|
print '<input type="hidden" name="originid" value="' . $originid . '">';
|
||||||
|
|
||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
@@ -1319,7 +1503,7 @@ if ($action=="create")
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
print '<tr><td>'.$langs->trans('NotePublic').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$doleditor = new DolEditor('note_public', GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
$doleditor = new DolEditor('note_public', isset($note_public) ? $note_public : GETPOST('note_public'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>';
|
//print '<textarea name="note_public" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea>';
|
||||||
@@ -1327,13 +1511,40 @@ if ($action=="create")
|
|||||||
|
|
||||||
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
|
print '<tr><td>'.$langs->trans('NotePrivate').'</td>';
|
||||||
print '<td>';
|
print '<td>';
|
||||||
$doleditor = new DolEditor('note_private', GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
$doleditor = new DolEditor('note_private', isset($note_private) ? $note_private : GETPOST('note_private'), '', 80, 'dolibarr_notes', 'In', 0, false, true, ROWS_3, 70);
|
||||||
print $doleditor->Create(1);
|
print $doleditor->Create(1);
|
||||||
print '</td>';
|
print '</td>';
|
||||||
//print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
//print '<td><textarea name="note_private" wrap="soft" cols="60" rows="'.ROWS_5.'"></textarea></td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
|
||||||
|
|
||||||
|
print "\n<!-- " . $classname . " info -->";
|
||||||
|
print "\n";
|
||||||
|
print '<input type="hidden" name="amount" value="' . $objectsrc->total_ht . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="total" value="' . $objectsrc->total_ttc . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="tva" value="' . $objectsrc->total_tva . '">' . "\n";
|
||||||
|
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||||
|
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||||
|
|
||||||
|
$newclassname = $classname;
|
||||||
|
if ($newclassname == 'AskPriceSupplier')
|
||||||
|
$newclassname = 'CommercialAskPriceSupplier';
|
||||||
|
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1) . '</td></tr>';
|
||||||
|
print '<tr><td>' . $langs->trans('TotalHT') . '</td><td colspan="2">' . price($objectsrc->total_ht) . '</td></tr>';
|
||||||
|
print '<tr><td>' . $langs->trans('TotalVAT') . '</td><td colspan="2">' . price($objectsrc->total_tva) . "</td></tr>";
|
||||||
|
if ($mysoc->localtax1_assuj == "1" || $objectsrc->total_localtax1 != 0) // Localtax1 RE
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT1", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax1) . "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($mysoc->localtax2_assuj == "1" || $objectsrc->total_localtax2 != 0) // Localtax2 IRPF
|
||||||
|
{
|
||||||
|
print '<tr><td>' . $langs->transcountry("AmountLT2", $mysoc->country_code) . '</td><td colspan="2">' . price($objectsrc->total_localtax2) . "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
|
print '<tr><td>' . $langs->trans('TotalTTC') . '</td><td colspan="2">' . price($objectsrc->total_ttc) . "</td></tr>";
|
||||||
|
}
|
||||||
|
|
||||||
// Other options
|
// Other options
|
||||||
$parameters=array();
|
$parameters=array();
|
||||||
@@ -1350,6 +1561,18 @@ if ($action=="create")
|
|||||||
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
|
print '<br><div class="center"><input type="submit" class="button" name="bouton" value="'.$langs->trans('CreateDraft').'"></div>';
|
||||||
|
|
||||||
print "</form>\n";
|
print "</form>\n";
|
||||||
|
|
||||||
|
// Show origin lines
|
||||||
|
if (! empty($origin) && ! empty($originid) && is_object($objectsrc)) {
|
||||||
|
$title = $langs->trans('ProductsAndServices');
|
||||||
|
print_titre($title);
|
||||||
|
|
||||||
|
print '<table class="noborder" width="100%">';
|
||||||
|
|
||||||
|
$objectsrc->printOriginLinesList();
|
||||||
|
|
||||||
|
print '</table>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
elseif (! empty($object->id))
|
elseif (! empty($object->id))
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -112,6 +112,7 @@ ALTER TABLE llx_contratdet_extrafields ADD INDEX idx_contratdet_extrafields (fk_
|
|||||||
|
|
||||||
ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer;
|
ALTER TABLE llx_product_fournisseur_price ADD COLUMN delivery_time_days integer;
|
||||||
|
|
||||||
|
|
||||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN comment varchar(255);
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN comment varchar(255);
|
||||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN status integer;
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN status integer;
|
||||||
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp;
|
ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN tms timestamp;
|
||||||
@@ -232,3 +233,89 @@ ALTER TABLE llx_projet ADD COLUMN fk_user_close integer DEFAULT NULL;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- Module AskPriceSupplier --
|
||||||
|
CREATE TABLE llx_askpricesupplier (
|
||||||
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
ref varchar(30) NOT NULL,
|
||||||
|
entity integer NOT NULL DEFAULT '1',
|
||||||
|
ref_ext varchar(255) DEFAULT NULL,
|
||||||
|
ref_int varchar(255) DEFAULT NULL,
|
||||||
|
fk_soc integer DEFAULT NULL,
|
||||||
|
fk_projet integer DEFAULT NULL,
|
||||||
|
tms timestamp,
|
||||||
|
datec datetime DEFAULT NULL,
|
||||||
|
date_valid datetime DEFAULT NULL,
|
||||||
|
date_cloture datetime DEFAULT NULL,
|
||||||
|
fk_user_author integer DEFAULT NULL,
|
||||||
|
fk_user_modif integer DEFAULT NULL,
|
||||||
|
fk_user_valid integer DEFAULT NULL,
|
||||||
|
fk_user_cloture integer DEFAULT NULL,
|
||||||
|
fk_statut smallint NOT NULL DEFAULT '0',
|
||||||
|
price double DEFAULT '0',
|
||||||
|
remise_percent double DEFAULT '0',
|
||||||
|
remise_absolue double DEFAULT '0',
|
||||||
|
remise double DEFAULT '0',
|
||||||
|
total_ht double(24,8) DEFAULT 0,
|
||||||
|
tva double(24,8) DEFAULT 0,
|
||||||
|
localtax1 double(24,8) DEFAULT 0,
|
||||||
|
localtax2 double(24,8) DEFAULT 0,
|
||||||
|
total double(24,8) DEFAULT 0,
|
||||||
|
fk_account integer DEFAULT NULL,
|
||||||
|
fk_currency varchar(3) DEFAULT NULL,
|
||||||
|
fk_cond_reglement integer DEFAULT NULL,
|
||||||
|
fk_mode_reglement integer DEFAULT NULL,
|
||||||
|
note_private text,
|
||||||
|
note_public text,
|
||||||
|
model_pdf varchar(255) DEFAULT NULL,
|
||||||
|
date_livraison date DEFAULT NULL,
|
||||||
|
fk_shipping_method integer DEFAULT NULL,
|
||||||
|
import_key varchar(14) DEFAULT NULL,
|
||||||
|
extraparams varchar(255) DEFAULT NULL
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
CREATE TABLE llx_askpricesupplierdet (
|
||||||
|
rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
fk_askpricesupplier integer NOT NULL,
|
||||||
|
fk_parent_line integer DEFAULT NULL,
|
||||||
|
fk_product integer DEFAULT NULL,
|
||||||
|
label varchar(255) DEFAULT NULL,
|
||||||
|
description text,
|
||||||
|
fk_remise_except integer DEFAULT NULL,
|
||||||
|
tva_tx double(6,3) DEFAULT 0,
|
||||||
|
localtax1_tx double(6,3) DEFAULT 0,
|
||||||
|
localtax1_type varchar(10) DEFAULT NULL,
|
||||||
|
localtax2_tx double(6,3) DEFAULT 0,
|
||||||
|
localtax2_type varchar(10) DEFAULT NULL,
|
||||||
|
qty double DEFAULT NULL,
|
||||||
|
remise_percent double DEFAULT '0',
|
||||||
|
remise double DEFAULT '0',
|
||||||
|
price double DEFAULT NULL,
|
||||||
|
subprice double(24,8) DEFAULT 0,
|
||||||
|
total_ht double(24,8) DEFAULT 0,
|
||||||
|
total_tva double(24,8) DEFAULT 0,
|
||||||
|
total_localtax1 double(24,8) DEFAULT 0,
|
||||||
|
total_localtax2 double(24,8) DEFAULT 0,
|
||||||
|
total_ttc double(24,8) DEFAULT 0,
|
||||||
|
product_type integer DEFAULT 0,
|
||||||
|
info_bits integer DEFAULT 0,
|
||||||
|
buy_price_ht double(24,8) DEFAULT 0,
|
||||||
|
fk_product_fournisseur_price integer DEFAULT NULL,
|
||||||
|
special_code integer DEFAULT 0,
|
||||||
|
rang integer DEFAULT 0,
|
||||||
|
ref_fourn varchar(30) DEFAULT NULL
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
CREATE TABLE llx_askpricesupplier_extrafields (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) DEFAULT NULL
|
||||||
|
) ENGINE=innodb;
|
||||||
|
|
||||||
|
CREATE TABLE llx_askpricesupplierdet_extrafields (
|
||||||
|
rowid integer AUTO_INCREMENT PRIMAR KEY,
|
||||||
|
tms timestamp,
|
||||||
|
fk_object integer NOT NULL,
|
||||||
|
import_key varchar(14) DEFAULT NULL
|
||||||
|
) ENGINE=innodb;
|
||||||
|
-- End Module AskPriceSupplier --
|
||||||
|
|||||||
@@ -1170,6 +1170,13 @@ UseOptionLineIfNoQuantity=A line of product/service with a zero amount is consid
|
|||||||
FreeLegalTextOnProposal=Free text on commercial proposals
|
FreeLegalTextOnProposal=Free text on commercial proposals
|
||||||
WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty)
|
WatermarkOnDraftProposal=Watermark on draft commercial proposals (none if empty)
|
||||||
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal
|
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Ask for bank account destination of proposal
|
||||||
|
##### AskPriceSupplier #####
|
||||||
|
AskPriceSupplierSetup=Price requests suppliers module setup
|
||||||
|
AskPriceSupplierNumberingModules=Price requests suppliers numbering models
|
||||||
|
AskPriceSupplierPDFModules=Price requests suppliers documents models
|
||||||
|
FreeLegalTextOnAskPriceSupplier=Free text on price requests suppliers
|
||||||
|
WatermarkOnDraftAskPriceSupplier=Watermark on draft price requests suppliers (none if empty)
|
||||||
|
BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER=Ask for bank account destination of price request
|
||||||
##### Orders #####
|
##### Orders #####
|
||||||
OrdersSetup=Order management setup
|
OrdersSetup=Order management setup
|
||||||
OrdersNumberingModules=Orders numbering models
|
OrdersNumberingModules=Orders numbering models
|
||||||
|
|||||||
57
htdocs/langs/en_US/askpricesupplier.lang
Normal file
57
htdocs/langs/en_US/askpricesupplier.lang
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Dolibarr language file - Source file is en_US - askpricesupplier
|
||||||
|
AskPriceSupplier=Supplier commercial proposals
|
||||||
|
askpricesupplierDESC=Manage price requests to suppliers
|
||||||
|
askpricesupplierMENU_LEFT_TITLE=Price request supplier
|
||||||
|
askpricesupplierMENU_LEFT_TITLE_NEW=New request
|
||||||
|
askpricesupplierMENU_LEFT_TITLE_LIST=List
|
||||||
|
CommRequest=Price request
|
||||||
|
CommRequests=Price requests
|
||||||
|
SearchRequest=Find a request
|
||||||
|
DraftRequests=Draft requests
|
||||||
|
LastModifiedRequests=Last %s modified price requests
|
||||||
|
RequestsOpened=Opened price requests
|
||||||
|
AskPriceSupplierArea=Area price requests suppliers
|
||||||
|
Askpricesupplier=Price request supplier
|
||||||
|
NewAskPrice=New price request
|
||||||
|
NewAsk=New request
|
||||||
|
ShowAskpricesupplier=Show price request
|
||||||
|
AddAskPriceSupplier=Create a price request
|
||||||
|
AskPriceSupplierRefFourn=Supplier ref
|
||||||
|
AskPriceSupplierDate=Delivery date
|
||||||
|
AskPriceSupplierRefFournNotice=Before closing to "Accepted", think to grasp suppliers references.
|
||||||
|
RelatedAskPriceSupplier=Related price requests suppliers
|
||||||
|
ConfirmValidateAsk=Are you sure you want to validate this price request under name <b>%s</b> ?
|
||||||
|
DateAsk=Date of request
|
||||||
|
DeleteAsk=Delete request
|
||||||
|
ValidateAsk=Validate request
|
||||||
|
AddAsk=Create a request
|
||||||
|
AskpricesupplierDraft=Drafts
|
||||||
|
AskpricesupplierOpened=Opened
|
||||||
|
AskpricesupplierStatusDraft=Draft (needs to be validated)
|
||||||
|
AskpricesupplierStatusValidated=Validated (request is open)
|
||||||
|
AskpricesupplierStatusOpened=Validated (request is open)
|
||||||
|
AskpricesupplierStatusClosed=Closed
|
||||||
|
AskpricesupplierStatusSigned=Accepted
|
||||||
|
AskpricesupplierStatusNotSigned=Refused
|
||||||
|
AskpricesupplierStatusDraftShort=Draft
|
||||||
|
AskpricesupplierStatusValidatedShort=Validated
|
||||||
|
AskpricesupplierStatusOpenedShort=Opened
|
||||||
|
AskpricesupplierStatusClosedShort=Closed
|
||||||
|
AskpricesupplierStatusSignedShort=Accepted
|
||||||
|
AskpricesupplierStatusNotSignedShort=Refused
|
||||||
|
CopyAskFrom=Create price request by copying existing a request
|
||||||
|
CreateEmptyAsk=Create blank request
|
||||||
|
CloneAsk=Clone price request
|
||||||
|
ConfirmCloneAsk=Are you sure you want to clone the price request <b>%s</b> ?
|
||||||
|
ConfirmReOpenAsk=Are you sure you want to open back the price request <b>%s</b> ?
|
||||||
|
SendAskByMail=Send price request by mail
|
||||||
|
SendAskRef=Sending the price request %s
|
||||||
|
AskPriceSupplierCard=Request card
|
||||||
|
ConfirmDeleteAsk=Are you sure you want to delete this price request ?
|
||||||
|
ActionsOnAskPriceSupplier=Events on price request
|
||||||
|
DocModelAuroreDescription=A complete request model (logo...)
|
||||||
|
CommercialAsk=Price request
|
||||||
|
DefaultModelAskPriceSupplierCreate=Default model creation
|
||||||
|
DefaultModelAskPriceSupplierToBill=Default template when closing a price request (accepted)
|
||||||
|
DefaultModelAskPriceSupplierClosed=Default template when closing a price request (refused)
|
||||||
|
ListOfAskPriceSupplier=Liste des demandes de prix fournisseurs
|
||||||
@@ -296,6 +296,7 @@ UnitPriceHT=Unit price (net)
|
|||||||
UnitPriceTTC=Unit price
|
UnitPriceTTC=Unit price
|
||||||
PriceU=U.P.
|
PriceU=U.P.
|
||||||
PriceUHT=U.P. (net)
|
PriceUHT=U.P. (net)
|
||||||
|
AskPriceSupplierUHT=P.U. HT Requested
|
||||||
PriceUTTC=U.P.
|
PriceUTTC=U.P.
|
||||||
Amount=Amount
|
Amount=Amount
|
||||||
AmountInvoice=Invoice amount
|
AmountInvoice=Invoice amount
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ PredefinedMailTestHtml=This is a <b>test</b> mail (the word test must be in bold
|
|||||||
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__\n\nWe would like to warn you that the invoice __FACREF__ seems to not being payed. So this is the invoice in attachment again, as a reminder.\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__\n\nWe would like to warn you that the invoice __FACREF__ seems to not being payed. So this is the invoice in attachment again, as a reminder.\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nYou will find here the commercial proposal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nYou will find here the commercial proposal __PROPREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
|
PredefinedMailContentSendAskPriceSupplier=__CONTACTCIVNAME__\n\nYou will find here the price request __ASKREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nYou will find here the order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nYou will find here the order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here our order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nYou will find here our order __ORDERREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nYou will find here the invoice __FACREF__\n\n__PERSONALIZED__Sincerely\n\n__SIGNATURE__
|
||||||
|
|||||||
@@ -264,6 +264,7 @@ MAIN_MAIL_EMAIL_FROM=Adresse email de l'émetteur pour l'envoi d'emails automati
|
|||||||
MAIN_MAIL_ERRORS_TO=Adresse email utilisée pour les retours d'erreurs des emails envoyés
|
MAIN_MAIL_ERRORS_TO=Adresse email utilisée pour les retours d'erreurs des emails envoyés
|
||||||
MAIN_MAIL_AUTOCOPY_TO= Envoyer systématiquement une copie cachée des emails envoyés à
|
MAIN_MAIL_AUTOCOPY_TO= Envoyer systématiquement une copie cachée des emails envoyés à
|
||||||
MAIN_MAIL_AUTOCOPY_PROPOSAL_TO= Envoyer systématiquement une copie cachée des propositions envoyées par email à
|
MAIN_MAIL_AUTOCOPY_PROPOSAL_TO= Envoyer systématiquement une copie cachée des propositions envoyées par email à
|
||||||
|
MAIN_MAIL_AUTOCOPY_ASKPRICESUPPLIER_TO= Envoyer systématiquement une copie cachée des demandes de prix envoyées par email à
|
||||||
MAIN_MAIL_AUTOCOPY_ORDER_TO= Envoyer systématiquement une copie cachée des commandes envoyées par emails à
|
MAIN_MAIL_AUTOCOPY_ORDER_TO= Envoyer systématiquement une copie cachée des commandes envoyées par emails à
|
||||||
MAIN_MAIL_AUTOCOPY_INVOICE_TO= Envoyer systématiquement une copie cachée des factures envoyées par email à
|
MAIN_MAIL_AUTOCOPY_INVOICE_TO= Envoyer systématiquement une copie cachée des factures envoyées par email à
|
||||||
MAIN_DISABLE_ALL_MAILS=Désactiver globalement tout envoi d'emails (pour mode test ou démos)
|
MAIN_DISABLE_ALL_MAILS=Désactiver globalement tout envoi d'emails (pour mode test ou démos)
|
||||||
@@ -1152,6 +1153,14 @@ UseOptionLineIfNoQuantity=Une ligne de produit/service ayant une quantité nulle
|
|||||||
FreeLegalTextOnProposal=Mention complémentaire sur les propositions commerciales
|
FreeLegalTextOnProposal=Mention complémentaire sur les propositions commerciales
|
||||||
WatermarkOnDraftProposal=Filigrane sur les brouillons de propositions commerciales (aucun si vide)
|
WatermarkOnDraftProposal=Filigrane sur les brouillons de propositions commerciales (aucun si vide)
|
||||||
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Saisir le compte bancaire cible lors de la proposition commerciale
|
BANK_ASK_PAYMENT_BANK_DURING_PROPOSAL=Saisir le compte bancaire cible lors de la proposition commerciale
|
||||||
|
##### AskPriceSupplier #####
|
||||||
|
AskPriceSupplierSetup=Configuration du module Demandes de Prix Fournisseurs
|
||||||
|
AskPriceSupplierNumberingModules=Modèles de numérotation des demandes de prix fournisseurs
|
||||||
|
AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseurs
|
||||||
|
AskPriceSupplierPDFModules=Modèles de documents de demandes de prix fournisseurs
|
||||||
|
FreeLegalTextOnAskPriceSupplier=Mention complémentaire sur les demandes de prix fournisseurs
|
||||||
|
WatermarkOnDraftAskPriceSupplier=Filigrane sur les brouillons de demandes de prix (aucun si vide)
|
||||||
|
BANK_ASK_PAYMENT_BANK_DURING_ASKPRICESUPPLIER=Saisir le compte bancaire cible lors de la demande de prix
|
||||||
##### Orders #####
|
##### Orders #####
|
||||||
OrdersSetup=Configuration du module Commandes
|
OrdersSetup=Configuration du module Commandes
|
||||||
OrdersNumberingModules=Modèles de numérotation des commandes
|
OrdersNumberingModules=Modèles de numérotation des commandes
|
||||||
|
|||||||
57
htdocs/langs/fr_FR/askpricesupplier.lang
Normal file
57
htdocs/langs/fr_FR/askpricesupplier.lang
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Dolibarr language file - Source file is en_US - askpricesupplier
|
||||||
|
AskPriceSupplier=Proposition commerciales fournisseurs
|
||||||
|
askpricesupplierDESC=Gestion des demandes de prix aux fournisseurs
|
||||||
|
askpricesupplierMENU_LEFT_TITLE=Demandes de prix fourn.
|
||||||
|
askpricesupplierMENU_LEFT_TITLE_NEW=Nouvelle demande
|
||||||
|
askpricesupplierMENU_LEFT_TITLE_LIST=Liste
|
||||||
|
CommRequest=Demande de prix
|
||||||
|
CommRequests=Demandes de prix
|
||||||
|
SearchRequest=Rechercher une demande
|
||||||
|
DraftRequests=Demandes brouillons
|
||||||
|
LastModifiedRequests=Les %s dernières demandes de prix modifiées
|
||||||
|
RequestsOpened=Demandes de prix ouvertes
|
||||||
|
AskPriceSupplierArea=Espace des demandes de prix fournisseurs
|
||||||
|
Askpricesupplier=Demande de prix fournisseur
|
||||||
|
NewAskPrice=Nouvelle demande de prix
|
||||||
|
NewAsk=Nouvelle demande
|
||||||
|
ShowAskpricesupplier=Afficher la demande de prix
|
||||||
|
AddAskPriceSupplier=Créer une demande de prix
|
||||||
|
AskPriceSupplierRefFourn=Réf. fournisseur
|
||||||
|
AskPriceSupplierDate=Date de livraison
|
||||||
|
AskPriceSupplierRefFournNotice=Avant de clôturer à "Acceptée", pensez à saisir les références fournisseurs.
|
||||||
|
RelatedAskPriceSupplier=Demandes de prix fournisseurs associées
|
||||||
|
ConfirmValidateAsk=Êtes-vous sûr de vouloir valider cette demande de prix sous la référence <b>%s</b> ?
|
||||||
|
DateAsk=Date de demande
|
||||||
|
DeleteAsk=Supprimer demande
|
||||||
|
ValidateAsk=Valider demande
|
||||||
|
AddAsk=Créer une demande
|
||||||
|
AskpricesupplierDraft=Brouillons
|
||||||
|
AskpricesupplierOpened=Ouvertes
|
||||||
|
AskpricesupplierStatusDraft=Brouillon (à valider)
|
||||||
|
AskpricesupplierStatusValidated=Validée (demande ouverte)
|
||||||
|
AskpricesupplierStatusOpened=Validée (demande ouverte)
|
||||||
|
AskpricesupplierStatusClosed=Fermée
|
||||||
|
AskpricesupplierStatusSigned=Acceptée
|
||||||
|
AskpricesupplierStatusNotSigned=Refusée
|
||||||
|
AskpricesupplierStatusDraftShort=Brouillon
|
||||||
|
AskpricesupplierStatusValidatedShort=Validée
|
||||||
|
AskpricesupplierStatusOpenedShort=Ouverte
|
||||||
|
AskpricesupplierStatusClosedShort=Fermée
|
||||||
|
AskpricesupplierStatusSignedShort=Acceptée
|
||||||
|
AskpricesupplierStatusNotSignedShort=Refusée
|
||||||
|
CopyAskFrom=Créer demande/devis par recopie d'une demande existante
|
||||||
|
CreateEmptyAsk=Créer demande/devis vierge
|
||||||
|
CloneAsk=Cloner demande de prix
|
||||||
|
ConfirmCloneAsk=Êtes-vous sûr de vouloir cloner la demande de prix <b>%s</b> ?
|
||||||
|
ConfirmReOpenAsk=Êtes-vous sûr de vouloir réouvrir la demande de prix <b>%s</b> ?
|
||||||
|
SendAskByMail=Envoyer demande de prix par email
|
||||||
|
SendAskRef=Envoi de la demande de prix %s
|
||||||
|
AskPriceSupplierCard=Fiche demande
|
||||||
|
ConfirmDeleteAsk=Êtes-vous sûr de vouloir effacer cette demande de prix <b>%s</b> ?
|
||||||
|
ActionsOnAskPriceSupplier=Événements sur la demande
|
||||||
|
DocModelAuroreDescription=Modèle de demande de prix fournisseur complet (logo…)
|
||||||
|
CommercialAsk=Demande de prix
|
||||||
|
DefaultModelAskPriceSupplierCreate=Modèle par défaut à la création
|
||||||
|
DefaultModelAskPriceSupplierToBill=Modèle par défaut lors de la clôture d'une demande de prix (à accéptée)
|
||||||
|
DefaultModelAskPriceSupplierClosed=Modèle par défaut lors de la clôture d'une demande de prix (refusée)
|
||||||
|
ListOfAskPriceSupplier=Liste des demandes de prix fournisseurs
|
||||||
@@ -295,6 +295,7 @@ UnitPriceHT=Prix unitaire HT
|
|||||||
UnitPriceTTC=Prix unitaire TTC
|
UnitPriceTTC=Prix unitaire TTC
|
||||||
PriceU=P.U.
|
PriceU=P.U.
|
||||||
PriceUHT=P.U. HT
|
PriceUHT=P.U. HT
|
||||||
|
AskPriceSupplierUHT=P.U. HT Demandé
|
||||||
PriceUTTC=P.U. TTC
|
PriceUTTC=P.U. TTC
|
||||||
Amount=Montant
|
Amount=Montant
|
||||||
AmountInvoice=Montant facture
|
AmountInvoice=Montant facture
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ PredefinedMailTestHtml=Ceci est un message de <b>test</b> (le mot test doit êtr
|
|||||||
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__ \n\nNous voudrions porter à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendInvoiceReminder=__CONTACTCIVNAME__ \n\nNous voudrions porter à votre connaissance que la facture __FACREF__ ne semble pas avoir été réglée. La voici donc, pour rappel, en pièce jointe.\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la proposition commerciale __PROPREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendProposal=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la proposition commerciale __PROPREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
|
PredefinedMailContentSendAskPriceSupplier=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la demande de prix __ASKREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint notre commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendSupplierOrder=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint notre commande __ORDERREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
PredefinedMailContentSendSupplierInvoice=__CONTACTCIVNAME__\n\nVeuillez trouver ci-joint la facture __FACREF__\n\n__PERSONALIZED__Cordialement\n\n__SIGNATURE__
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class Product extends CommonObject
|
|||||||
public $element='product';
|
public $element='product';
|
||||||
public $table_element='product';
|
public $table_element='product';
|
||||||
public $fk_element='fk_product';
|
public $fk_element='fk_product';
|
||||||
protected $childtables=array('propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
|
protected $childtables=array('askpricesupplierdet', 'propaldet','commandedet','facturedet','contratdet','facture_fourn_det','commande_fournisseurdet'); // To test if we can delete object
|
||||||
protected $isnolinkedbythird = 1; // No field fk_soc
|
protected $isnolinkedbythird = 1; // No field fk_soc
|
||||||
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
BIN
htdocs/theme/eldy/img/object_askpricesupplier.png
Normal file
BIN
htdocs/theme/eldy/img/object_askpricesupplier.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 284 B |
Reference in New Issue
Block a user