Merge branch 'develop' into refactor-1
Conflicts: htdocs/fourn/class/fournisseur.commande.class.php htdocs/includes/tcpdi/fpdf_tpl.php
This commit is contained in:
commit
efb9f7f4fd
@ -47,8 +47,8 @@ Long description (Can span accross multiple lines).
|
||||
|
||||
Where KEYWORD is one of:
|
||||
|
||||
- "FIXED:" for bug fixes (May be followed by the bug number i.e: #456)
|
||||
- "NEW:" for new features (May be followed by the task number i.e: #123)
|
||||
- "FIXED:" for bug fixes. In upper case to appear into ChangeLog. (May be followed by the bug number i.e: #456)
|
||||
- "NEW:" for new features. In upper case to appear into ChangeLog. (May be followed by the task number i.e: #123)
|
||||
- void, don't put a keyword if the commit is not introducing feature or closing a bug.
|
||||
|
||||
### Resources
|
||||
|
||||
13
ChangeLog
13
ChangeLog
@ -14,8 +14,10 @@ For users:
|
||||
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.
|
||||
- Add extrafields on bank account cards.
|
||||
- Added delay between mails in Newsletter module
|
||||
- [ task #1793 ] Create new permission to restrict commercial agent margin to logged user
|
||||
- Added delay between mails in Newsletter module.
|
||||
- [ 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:
|
||||
- Update language files.
|
||||
@ -25,6 +27,12 @@ For developers:
|
||||
- New: Function yn can show a visual checkbox.
|
||||
- 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.* *****
|
||||
For users:
|
||||
@ -223,6 +231,7 @@ Dolibarr better:
|
||||
- Fix: [ bug #1825 ] External agenda: hide/show checkbox doesn't work
|
||||
- Fix: [ bug #1790 ] Email form behaves in an unexpected way when pressing Enter key
|
||||
- Fix: Bad SEPA xml file creation
|
||||
- Fix: [ bug #1892 ] PHP Fatal error when using USER_UPDATE_SESSION trigger and adding a supplier invoice payment
|
||||
|
||||
***** ChangeLog for 3.6.2 compared to 3.6.1 *****
|
||||
- Fix: fix ErrorBadValueForParamNotAString error message in price customer multiprice.
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
dolibarr (3.7.0-3) UNRELEASED; urgency=low
|
||||
dolibarr (3.8.0-3) UNRELEASED; urgency=low
|
||||
|
||||
[ Laurent Destailleur (eldy) ]
|
||||
* New upstream release.
|
||||
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 21 Oct 2014 12:00:00 +0100
|
||||
-- Laurent Destailleur (eldy) <eldy@users.sourceforge.net> Tue, 3 Mar 2015 12:00:00 +0100
|
||||
|
||||
@ -451,15 +451,18 @@ if ($nboftargetok) {
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/document`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/documents`;
|
||||
# Removed known external modules to avoir any error when packaging on test env
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/ancotec*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/bootstrap*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/factory*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/management*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/multicompany*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/nltechno*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/pos*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/public/test`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/teclib*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/timesheet*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/oblyon*`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/themes/eldy/*.new`;
|
||||
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||
|
||||
@ -174,6 +174,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
|
||||
@ -254,6 +254,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
|
||||
@ -171,6 +171,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
|
||||
@ -182,6 +182,7 @@ done >>%{name}.lang
|
||||
%_datadir/dolibarr/htdocs/cron
|
||||
%_datadir/dolibarr/htdocs/ecm
|
||||
%_datadir/dolibarr/htdocs/expedition
|
||||
%_datadir/dolibarr/htdocs/expensereport
|
||||
%_datadir/dolibarr/htdocs/exports
|
||||
%_datadir/dolibarr/htdocs/externalsite
|
||||
%_datadir/dolibarr/htdocs/fichinter
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
# Syntax
|
||||
if [ "x$1" != "xlist" -a "x$1" != "xfix" ]
|
||||
then
|
||||
echo "This script clean files with CR+LF into files with LF only. All source files are included, also files into includes."
|
||||
echo "Usage: fixdosfiles.sh [list|fix]"
|
||||
fi
|
||||
|
||||
|
||||
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();
|
||||
@ -221,7 +221,7 @@ else if ($action == 'set_FICHINTER_DRAFT_WATERMARK')
|
||||
elseif ($action == 'set_FICHINTER_PRINT_PRODUCTS')
|
||||
{
|
||||
$val = GETPOST('FICHINTER_PRINT_PRODUCTS','alpha');
|
||||
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS",($val == 'on'),'bool',0,'',$conf->entity);
|
||||
$res = dolibarr_set_const($db, "FICHINTER_PRINT_PRODUCTS",($val == 'on' ? 1 : 0),'bool',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
|
||||
@ -208,7 +208,7 @@ $formfile->form_attach_new_file($_SERVER['PHP_SELF'], $langs->trans("FormToTestF
|
||||
|
||||
// List of document
|
||||
$filearray=dol_dir_list($upload_dir, "files", 0, '', '', 'name', SORT_ASC, 1);
|
||||
$formfile->list_of_documents($filearray, '', 'admin_temp', '');
|
||||
$formfile->list_of_documents($filearray, null, 'admin_temp', '');
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
|
||||
@ -108,7 +108,7 @@ $db->close();
|
||||
/**
|
||||
* Function to get list of updated or modified files
|
||||
*
|
||||
* @param object $dir SimpleXMLElement of files to test
|
||||
* @param SimpleXMLElement $dir SimpleXMLElement of files to test
|
||||
* @param string $path Path of file
|
||||
* @return array Array of filenames
|
||||
*/
|
||||
|
||||
@ -1330,17 +1330,23 @@ class Categorie extends CommonObject
|
||||
* Build thumb
|
||||
*
|
||||
* @param string $file Chemin du fichier d'origine
|
||||
* @param int $maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||
* @param int $maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||
* @return void
|
||||
*/
|
||||
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
|
||||
function add_thumb($file)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php';
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini, $quality;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/images.lib.php'; // This define also $maxwidthsmall, $quality, ...
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
vignette($file,$maxWidth,$maxHeight);
|
||||
// Create small thumbs for company (Ratio is near 16/9)
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($file, $maxwidthsmall, $maxheightsmall, '_small', $quality);
|
||||
|
||||
// Create mini thumbs for company (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($file, $maxwidthmini, $maxheightmini, '_mini', $quality);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -363,17 +363,16 @@ if (! empty($conf->use_javascript_ajax))
|
||||
{
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$htmlname = dol_string_nospecial($htmlname,'_',array("\.","#"));
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' jQuery("#check_ext' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' jQuery(".family_ext' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_birthday" name="check_birthday"> '.$langs->trans("AgendaShowBirthdayEvents").' </div>';
|
||||
@ -1174,7 +1173,7 @@ function show_day_events($db, $day, $month, $year, $monthshown, $style, &$eventa
|
||||
$numicals[dol_string_nospecial($event->icalname)]++;
|
||||
}
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unmovable');
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unmovable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
|
||||
@ -305,16 +305,16 @@ if ($conf->use_javascript_ajax)
|
||||
{
|
||||
foreach ($showextcals as $val)
|
||||
{
|
||||
$htmlname = dol_string_nospecial($val['name']);
|
||||
$htmlname = md5($val['name']);
|
||||
$s.='<script type="text/javascript">' . "\n";
|
||||
$s.='jQuery(document).ready(function () {' . "\n";
|
||||
$s.=' jQuery("#check_' . $htmlname . '").click(function() {';
|
||||
$s.=' jQuery("#check_ext' . $htmlname . '").click(function() {';
|
||||
$s.=' /* alert("'.$htmlname.'"); */';
|
||||
$s.=' jQuery(".family_' . $htmlname . '").toggle();';
|
||||
$s.=' jQuery(".family_ext' . $htmlname . '").toggle();';
|
||||
$s.=' });' . "\n";
|
||||
$s.='});' . "\n";
|
||||
$s.='</script>' . "\n";
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_' . $htmlname . '" name="check_' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
$s.='<div class="nowrap float"><input type="checkbox" id="check_ext' . $htmlname . '" name="check_ext' . $htmlname . '" checked="true"> ' . $val ['name'] . ' </div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -869,7 +869,7 @@ function show_day_events2($username, $day, $month, $year, $monthshown, $style, &
|
||||
}
|
||||
|
||||
$color=$event->icalcolor;
|
||||
$cssclass=(! empty($event->icalname)?'family_'.dol_string_nospecial($event->icalname):'family_other unsortable');
|
||||
$cssclass=(! empty($event->icalname)?'family_ext'.md5($event->icalname):'family_other unsortable');
|
||||
}
|
||||
else if ($event->type_code == 'BIRTHDAY')
|
||||
{
|
||||
|
||||
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 -->
|
||||
@ -400,7 +400,7 @@ if ($id > 0)
|
||||
// display amount and link to unpaid bill
|
||||
$outstandigBills = $object->get_OutstandingBill();
|
||||
if ($outstandigBills != 0)
|
||||
print " / <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills).'</a>';
|
||||
print " (".$langs->trans("CurrentOutstandingBill")." <a href='".DOL_URL_ROOT."/compta/facture/list.php?socid=".$object->id."&search_status=1'>".price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency).'</a>)';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ $langs->load('orders');
|
||||
$langs->load('products');
|
||||
$langs->load("deliveries");
|
||||
$langs->load('sendings');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -241,6 +242,12 @@ if (empty($reshook))
|
||||
$object->set_ref_client($user, $_POST['ref_client']);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
{
|
||||
@ -296,6 +303,8 @@ if (empty($reshook))
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->statut = 0;
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$id = $object->create_from($user);
|
||||
} else {
|
||||
@ -319,6 +328,8 @@ if (empty($reshook))
|
||||
$object->modelpdf = GETPOST('model');
|
||||
$object->author = $user->id; // deprecated
|
||||
$object->note = GETPOST('note');
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
$object->origin = GETPOST('origin');
|
||||
$object->origin_id = GETPOST('originid');
|
||||
@ -1393,6 +1404,16 @@ if ($action == 'create')
|
||||
print $form->selectarray('model', $liste, ($conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT ? $conf->global->PROPALE_ADDON_PDF_ODT_DEFAULT : $conf->global->PROPALE_ADDON_PDF));
|
||||
print "</td></tr>";
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $soc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled) && $socid > 0)
|
||||
{
|
||||
@ -1953,6 +1974,29 @@ if ($action == 'create')
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->propal->creer) print '<a href="'.DOL_URL_ROOT.'/comm/propal.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -120,6 +120,11 @@ class Propal extends CommonObject
|
||||
var $labelstatut_short=array();
|
||||
|
||||
var $specimen;
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
|
||||
/**
|
||||
@ -751,6 +756,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", fk_availability";
|
||||
$sql.= ", fk_input_reason";
|
||||
$sql.= ", fk_projet";
|
||||
$sql.= ", fk_incoterms";
|
||||
$sql.= ", location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ") ";
|
||||
$sql.= " VALUES (";
|
||||
@ -778,6 +785,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", ".$this->availability_id;
|
||||
$sql.= ", ".$this->demand_reason_id;
|
||||
$sql.= ", ".($this->fk_project?$this->fk_project:"null");
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -1098,6 +1107,8 @@ class Propal extends CommonObject
|
||||
$sql.= ", p.fk_mode_reglement";
|
||||
$sql.= ', p.fk_account';
|
||||
$sql.= ", p.fk_shipping_method";
|
||||
$sql.= ", p.fk_incoterms, p.location_incoterms";
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ", c.label as statut_label";
|
||||
$sql.= ", ca.code as availability_code, ca.label as availability";
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
@ -1108,6 +1119,7 @@ class Propal extends CommonObject
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON p.fk_availability = ca.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON p.fk_input_reason = dr.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON p.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE p.fk_statut = c.id";
|
||||
$sql.= " AND p.entity = ".$conf->entity;
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
@ -1175,6 +1187,11 @@ class Propal extends CommonObject
|
||||
$this->user_valid_id = $obj->fk_user_valid;
|
||||
$this->user_close_id = $obj->fk_user_cloture;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($obj->fk_statut == 0)
|
||||
{
|
||||
$this->brouillon = 1;
|
||||
@ -1206,6 +1223,11 @@ class Propal extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafieldsline=new ExtraFields($this->db);
|
||||
$line = new PropaleLigne($this->db);
|
||||
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
|
||||
|
||||
$num = $this->db->num_rows($result);
|
||||
$i = 0;
|
||||
|
||||
@ -1215,7 +1237,8 @@ class Propal extends CommonObject
|
||||
|
||||
$line = new PropaleLigne($this->db);
|
||||
|
||||
$line->rowid = $objp->rowid;
|
||||
$line->rowid = $objp->rowid; //Deprecated
|
||||
$line->id = $objp->rowid;
|
||||
$line->fk_propal = $objp->fk_propal;
|
||||
$line->fk_parent_line = $objp->fk_parent_line;
|
||||
$line->product_type = $objp->product_type;
|
||||
@ -1256,6 +1279,8 @@ class Propal extends CommonObject
|
||||
$line->date_start = $objp->date_start;
|
||||
$line->date_end = $objp->date_end;
|
||||
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
$this->lines[$i] = $line;
|
||||
//dol_syslog("1 ".$line->fk_product);
|
||||
//print "xx $i ".$this->lines[$i]->fk_product;
|
||||
@ -1269,12 +1294,6 @@ class Propal extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Retreive all extrafield for propal
|
||||
// fetch optionals attributes and labels
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -182,9 +182,9 @@ if ($search_author)
|
||||
{
|
||||
$sql.= " AND u.login LIKE '%".$db->escape(trim($search_author))."%'";
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= " AND p.total_ht='".$db->escape(price2num(trim($search_montant_ht)))."'";
|
||||
$sql.= natural_search("p.total_ht", $search_montant_ht, 1);
|
||||
}
|
||||
if ($sall) {
|
||||
$sql .= natural_search(array('s.nom', 'p.note_private', 'p.note_public', 'pd.description'), $sall);
|
||||
@ -316,12 +316,12 @@ if ($result)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" colspan="1"> </td>';
|
||||
// Amount
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print '<input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'">';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" 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 '<input class="flat" size="6" type="text" name="search_author" value="'.$search_author.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
$formpropal->selectProposalStatus($viewstatut,1);
|
||||
|
||||
@ -55,6 +55,7 @@ $langs->load('propal');
|
||||
$langs->load('deliveries');
|
||||
$langs->load('sendings');
|
||||
$langs->load('products');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -84,10 +85,7 @@ $extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
|
||||
|
||||
// Load object
|
||||
if ($id > 0 || ! empty($ref)) {
|
||||
$ret = $object->fetch($id, $ref);
|
||||
$ret = $object->fetch_thirdparty();
|
||||
}
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not includ_once
|
||||
|
||||
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
|
||||
$hookmanager->initHooks(array('ordercard','globalcard'));
|
||||
@ -222,13 +220,13 @@ if (empty($reshook))
|
||||
if ($datecommande == '') {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentities('Date')), 'errors');
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($socid < 1) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Customer")), 'errors');
|
||||
$action = 'create';
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
@ -253,7 +251,9 @@ if (empty($reshook))
|
||||
$object->shipping_method_id = GETPOST('shipping_method_id', 'int');
|
||||
$object->fk_delivery_address = GETPOST('fk_address');
|
||||
$object->contactid = GETPOST('contactid');
|
||||
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// If creation from another object of another module (Example: origin=propal, originid=1)
|
||||
if (! empty($origin) && ! empty($originid))
|
||||
{
|
||||
@ -350,7 +350,7 @@ if (empty($reshook))
|
||||
$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, $lines[$i]->remise_percent, $lines[$i]->info_bits, $lines[$i]->fk_remise_except, 'HT', 0, $date_start, $date_end, $product_type, $lines[$i]->rang, $lines[$i]->special_code, $fk_parent_line, $lines[$i]->fk_fournprice, $lines[$i]->pa_ht, $label, $array_options);
|
||||
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -365,14 +365,14 @@ if (empty($reshook))
|
||||
$reshook = $hookmanager->executeHooks('createFrom', $parameters, $object, $action); // Note that $action and $object may have been
|
||||
// modified by hook
|
||||
if ($reshook < 0)
|
||||
$error ++;
|
||||
$error++;
|
||||
} else {
|
||||
setEventMessage($srcobject->error, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
setEventMessage($object->error, 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// Required extrafield left blank, error message already defined by setOptionalsFromPost()
|
||||
@ -408,7 +408,7 @@ if (empty($reshook))
|
||||
$result = $object->add_contact(GETPOST('contactid'), 'CUSTOMER', 'external');
|
||||
if ($result < 0) {
|
||||
setEventMessage($langs->trans("ErrorFailedToAddContact"), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,6 +518,12 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->commande->creer) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
@ -573,24 +579,24 @@ if (empty($reshook))
|
||||
|
||||
if (empty($idprod) && ($price_ht < 0) && ($qty < 0)) {
|
||||
setEventMessage($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '')) // Unit price can be 0 but not ''
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if ($qty == '') {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
|
||||
setEventMessage($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
|
||||
@ -846,7 +852,7 @@ if (empty($reshook))
|
||||
|
||||
if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) {
|
||||
setEventMessage($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
$type = GETPOST('type');
|
||||
@ -855,7 +861,7 @@ if (empty($reshook))
|
||||
// Check parameters
|
||||
if (GETPOST('type') < 0) {
|
||||
setEventMessage($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), 'errors');
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1119,10 +1125,10 @@ if (empty($reshook))
|
||||
if (empty($reshook)) {
|
||||
$result = $object->insertExtraFields();
|
||||
if ($result < 0) {
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
} else if ($reshook < 0)
|
||||
$error ++;
|
||||
$error++;
|
||||
}
|
||||
|
||||
if ($error)
|
||||
@ -1413,6 +1419,16 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="3"', 'socid'=>$socid);
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -1972,7 +1988,30 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->commande->creer) print '<a href="'.DOL_URL_ROOT.'/commande/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 3;
|
||||
include DOL_DOCUMENT_ROOT . '/core/tpl/extrafields_view.tpl.php';
|
||||
|
||||
@ -109,6 +109,11 @@ class Commande extends CommonOrder
|
||||
*/
|
||||
var $lines = array();
|
||||
|
||||
//Incorterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -675,6 +680,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ", model_pdf, fk_cond_reglement, fk_mode_reglement, fk_account, fk_availability, fk_input_reason, date_livraison, fk_delivery_address";
|
||||
$sql.= ", fk_shipping_method";
|
||||
$sql.= ", remise_absolue, remise_percent";
|
||||
$sql.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ", entity";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES ('(PROV)',".$this->socid.", '".$this->db->idate($now)."', ".$user->id;
|
||||
@ -697,6 +703,8 @@ class Commande extends CommonOrder
|
||||
$sql.= ", ".($this->shipping_method_id>0?$this->shipping_method_id:'NULL');
|
||||
$sql.= ", ".($this->remise_absolue>0?$this->remise_absolue:'NULL');
|
||||
$sql.= ", ".($this->remise_percent>0?$this->remise_percent:0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ")";
|
||||
|
||||
@ -1392,6 +1400,8 @@ class Commande extends CommonOrder
|
||||
$sql.= ', c.fk_shipping_method';
|
||||
$sql.= ', c.fk_projet, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed';
|
||||
$sql.= ', c.note_private, c.note_public, c.ref_client, c.ref_ext, c.ref_int, c.model_pdf, c.fk_delivery_address, c.extraparams';
|
||||
$sql.= ', c.fk_incoterms, c.location_incoterms';
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', ca.code as availability_code';
|
||||
@ -1401,6 +1411,7 @@ class Commande extends CommonOrder
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON (c.fk_mode_reglement = p.id)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_availability as ca ON (c.fk_availability = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_input_reason as dr ON (c.fk_input_reason = ca.rowid)';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON c.fk_incoterms = i.rowid';
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
@ -1456,6 +1467,11 @@ class Commande extends CommonOrder
|
||||
$this->shipping_method_id = ($obj->fk_shipping_method>0)?$obj->fk_shipping_method:null;
|
||||
$this->fk_delivery_address = $obj->fk_delivery_address;
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
$this->lines = array();
|
||||
|
||||
@ -51,6 +51,7 @@ $sall=GETPOST('sall');
|
||||
$socid=GETPOST('socid','int');
|
||||
$search_user=GETPOST('search_user','int');
|
||||
$search_sale=GETPOST('search_sale','int');
|
||||
$search_total_ht=GETPOST('search_total_ht','alpha');
|
||||
|
||||
// Security check
|
||||
$id = (GETPOST('orderid')?GETPOST('orderid'):GETPOST('id','int'));
|
||||
@ -79,6 +80,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both
|
||||
$search_ref='';
|
||||
$search_ref_customer='';
|
||||
$search_company='';
|
||||
$search_total_ht='';
|
||||
$orderyear='';
|
||||
$ordermonth='';
|
||||
$deliverymonth='';
|
||||
@ -96,6 +98,7 @@ $parameters=array('socid'=>$socid);
|
||||
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hook
|
||||
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
@ -198,7 +201,10 @@ if ($search_user > 0)
|
||||
{
|
||||
$sql.= " AND ec.fk_c_type_contact = tc.rowid AND tc.element='commande' AND tc.source='internal' AND ec.element_id = c.rowid AND ec.fk_socpeople = ".$search_user;
|
||||
}
|
||||
|
||||
if ($search_total_ht != '')
|
||||
{
|
||||
$sql.= natural_search('c.total_ht', $search_total_ht, 1);
|
||||
}
|
||||
$sql.= ' ORDER BY '.$sortfield.' '.$sortorder;
|
||||
|
||||
$nbtotalofrecords = 0;
|
||||
@ -252,7 +258,8 @@ if ($resql)
|
||||
if ($search_ref_customer) $param.='&search_ref_customer='.$search_ref_customer;
|
||||
if ($search_user > 0) $param.='&search_user='.$search_user;
|
||||
if ($search_sale > 0) $param.='&search_sale='.$search_sale;
|
||||
|
||||
if ($search_total_ht != '') $param.='&search_total_ht='.$search_total_ht;
|
||||
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste($title, $page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
$i = 0;
|
||||
@ -316,7 +323,9 @@ if ($resql)
|
||||
print '<input class="flat" type="text" size="1" maxlength="2" name="deliverymonth" value="'.$deliverymonth.'">';
|
||||
$formother->select_year($deliveryyear?$deliveryyear:-1,'deliveryyear',1, 20, 5);
|
||||
print '</td>';
|
||||
print '<td class="liste_titre"> </td>';
|
||||
print '<td class="liste_titre" align="right">';
|
||||
print '<input class="flat" type="text" size="6" name="search_total_ht" value="'.$search_total_ht.'">';
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" 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" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
print "</td></tr>\n";
|
||||
@ -328,7 +337,8 @@ if ($resql)
|
||||
|
||||
$generic_commande = new Commande($db);
|
||||
$generic_product = new Product($db);
|
||||
while ($i < min($num,$limit)) {
|
||||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'>';
|
||||
|
||||
@ -1,477 +0,0 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 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/compta/bank/bankid_fr.php
|
||||
* \ingroup banque
|
||||
* \brief Fiche creation compte bancaire
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("categories");
|
||||
$langs->load("bills");
|
||||
|
||||
$action=GETPOST('action');
|
||||
$id=GETPOST('id','int');
|
||||
$ref=GETPOST('ref');
|
||||
|
||||
// Security check
|
||||
if (isset($_GET["id"]) || isset($_GET["ref"]))
|
||||
{
|
||||
$id = isset($_GET["id"])?$_GET["id"]:(isset($_GET["ref"])?$_GET["ref"]:'');
|
||||
}
|
||||
$fieldid = isset($_GET["ref"])?'ref':'rowid';
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fieldid);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'update' && ! $_POST["cancel"])
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban = trim($_POST["iban"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
$account->state_id = trim($_POST["state_id"]);
|
||||
//$account->country_id = trim($_POST["country_id"]); // We do not change this.
|
||||
|
||||
if ($account->id)
|
||||
{
|
||||
$result = $account->update_bban($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
$_GET["id"]=$_POST["id"]; // Force chargement page en mode visu
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessage($account->error, 'errors');
|
||||
$action='edit'; // Force chargement page edition
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'confirm_delete' && $_POST["confirm"] == "yes" && $user->rights->banque->configurer)
|
||||
{
|
||||
// Modification
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
$account->delete();
|
||||
|
||||
header("Location: ".DOL_URL_ROOT."/compta/bank/index.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Affichage page en mode creation */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if (($_GET["id"] || $_GET["ref"]) && $action != 'edit')
|
||||
{
|
||||
$account = new Account($db);
|
||||
if ($_GET["id"])
|
||||
{
|
||||
$result=$account->fetch($id);
|
||||
}
|
||||
if ($_GET["ref"])
|
||||
{
|
||||
$result=$account->fetch(0,$_GET["ref"]);
|
||||
$_GET["id"]=$account->id;
|
||||
}
|
||||
|
||||
// Onglets
|
||||
$head=bank_prepare_head($account);
|
||||
dol_fiche_head($head, 'bankid', $langs->trans("FinancialAccount"),0,'account');
|
||||
|
||||
// Confirmation de la suppression
|
||||
if ($action == 'delete')
|
||||
{
|
||||
print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$account->id,$langs->trans("DeleteAccount"),$langs->trans("ConfirmDeleteAccount"),"confirm_delete");
|
||||
|
||||
}
|
||||
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$linkback = '<a href="'.DOL_URL_ROOT.'/compta/bank/index.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->showrefnav($account, 'ref', $linkback, 1, 'ref');
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label.'</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type].'</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4).'</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
// Country
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(), 0, $db);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3">'.$account->iban.' ';
|
||||
if (! empty($account->iban)) {
|
||||
if (! checkIbanForAccount($account)) {
|
||||
print img_picto($langs->trans("IbanNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3">'.$account->bic.' ';
|
||||
if (! empty($account->bic)) {
|
||||
if (! checkSwiftForAccount($account)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->owner_address);
|
||||
print "</td></tr>\n";
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
|
||||
// Check BBAN
|
||||
if (! checkBanForAccount($account))
|
||||
{
|
||||
print '<div class="warning">'.$langs->trans("RIBControlError").'</div>';
|
||||
}
|
||||
|
||||
print "\n</div>\n";
|
||||
|
||||
|
||||
/*
|
||||
* Barre d'actions
|
||||
*/
|
||||
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->banque->configurer)
|
||||
{
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&id='.$account->id.'">'.$langs->trans("Modify").'</a>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
|
||||
}
|
||||
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* Edition */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
if ($_GET["id"] && $action == 'edit' && $user->rights->banque->configurer)
|
||||
{
|
||||
$account = new Account($db);
|
||||
$account->fetch($id);
|
||||
|
||||
print_fiche_titre($langs->trans("EditFinancialAccount"));
|
||||
print "<br>";
|
||||
|
||||
print '<form action="'.$_SERVER["PHP_SELF"].'?id='.$account->id.'" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="update">';
|
||||
print '<input type="hidden" name="id" value="'.$_GET["id"].'">'."\n\n";
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3">'.$account->ref;
|
||||
print '</td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top">'.$langs->trans("Label").'</td>';
|
||||
print '<td colspan="3">'.$account->label;
|
||||
print '</td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountType").'</td>';
|
||||
print '<td colspan="3">'.$account->type_lib[$account->type];
|
||||
print '</td></tr>';
|
||||
|
||||
// Currency
|
||||
print '<tr><td valign="top">'.$langs->trans("Currency").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->account_currency_code;
|
||||
if (! $selectedcode) $selectedcode=$conf->currency;
|
||||
print $langs->trans("Currency".$selectedcode);
|
||||
print '</td></tr>';
|
||||
|
||||
// Status
|
||||
print '<tr><td valign="top">'.$langs->trans("Status").'</td>';
|
||||
print '<td colspan="3">'.$account->getLibStatut(4);
|
||||
print '</td></tr>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountCountry").'</td><td colspan="3">';
|
||||
$img=picto_from_langcode($account->country_code);
|
||||
print $img?$img.' ':'';
|
||||
print getCountry($account->getCountryCode(), 0, $db);
|
||||
print "</td></tr>\n";
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
print '<div align="center">';
|
||||
print '<input value="'.$langs->trans("Save").'" type="submit" class="button">';
|
||||
print ' <input name="cancel" value="'.$langs->trans("Cancel").'" type="submit" class="button">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
}
|
||||
|
||||
|
||||
llxFooter();
|
||||
|
||||
$db->close();
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2009 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
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2014-2015 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -21,19 +21,20 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/card.php
|
||||
* \ingroup banque
|
||||
* \ingroup bank
|
||||
* \brief Page to create/view a bank account
|
||||
*/
|
||||
|
||||
require('../../main.inc.php');
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formbank.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/bank.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcompany.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbank.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/compta/bank/class/account.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
|
||||
|
||||
$langs->load("banks");
|
||||
$langs->load("bills");
|
||||
$langs->load("categories");
|
||||
$langs->load("companies");
|
||||
$langs->load("compta");
|
||||
@ -71,6 +72,18 @@ if ($_POST["action"] == 'add')
|
||||
$account->rappro = (isset($_POST["norappro"]) && $_POST["norappro"])?0:1;
|
||||
$account->url = $_POST["url"];
|
||||
|
||||
$account->bank = trim($_POST["bank"]);
|
||||
$account->code_banque = trim($_POST["code_banque"]);
|
||||
$account->code_guichet = trim($_POST["code_guichet"]);
|
||||
$account->number = trim($_POST["number"]);
|
||||
$account->cle_rib = trim($_POST["cle_rib"]);
|
||||
$account->bic = trim($_POST["bic"]);
|
||||
$account->iban = trim($_POST["iban"]);
|
||||
$account->domiciliation = trim($_POST["domiciliation"]);
|
||||
|
||||
$account->proprio = trim($_POST["proprio"]);
|
||||
$account->owner_address = trim($_POST["owner_address"]);
|
||||
|
||||
$account->account_number = trim($_POST["account_number"]);
|
||||
$account->accountancy_journal = trim($_POST["accountancy_journal"]);
|
||||
|
||||
@ -82,8 +95,8 @@ if ($_POST["action"] == 'add')
|
||||
$account->state_id = $_POST["account_state_id"];
|
||||
$account->country_id = $_POST["account_country_id"];
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
@ -157,8 +170,8 @@ if ($_POST["action"] == 'update' && ! $_POST["cancel"])
|
||||
$account->state_id = $_POST["account_state_id"];
|
||||
$account->country_id = $_POST["account_country_id"];
|
||||
|
||||
$account->min_allowed = $_POST["account_min_allowed"];
|
||||
$account->min_desired = $_POST["account_min_desired"];
|
||||
$account->min_allowed = GETPOST("account_min_allowed",'int');
|
||||
$account->min_desired = GETPOST("account_min_desired",'int');
|
||||
$account->comment = trim($_POST["account_comment"]);
|
||||
|
||||
if ($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED && empty($account->account_number))
|
||||
@ -233,8 +246,12 @@ if ($action == 'create')
|
||||
|
||||
if ($conf->use_javascript_ajax)
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
jQuery("#selectaccount_country_id").change(function() {
|
||||
document.formsoc.action.value="create";
|
||||
document.formsoc.submit();
|
||||
@ -251,12 +268,12 @@ if ($action == 'create')
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Ref
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("Ref").'</td>';
|
||||
print '<td colspan="3"><input size="8" type="text" class="flat" name="ref" value="'.($_POST["ref"]?$_POST["ref"]:$account->ref).'" maxlength="12"></td></tr>';
|
||||
|
||||
// Label
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("LabelBankCashAccount").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.$_POST["label"].'"></td></tr>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="label" value="'.GETPOST("label").'"></td></tr>';
|
||||
|
||||
// Type
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("AccountType").'</td>';
|
||||
@ -280,15 +297,17 @@ if ($action == 'create')
|
||||
print $form->selectarray("clos",array(0=>$account->status[0],1=>$account->status[1]),(isset($_POST["clos"])?$_POST["clos"]:$account->clos));
|
||||
print '</td></tr>';
|
||||
|
||||
// Country
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td colspan="3">';
|
||||
// Country
|
||||
$selectedcode='';
|
||||
if (isset($_POST["account_country_id"]))
|
||||
{
|
||||
$selectedcode=$_POST["account_country_id"]?$_POST["account_country_id"]:$account->country_code;
|
||||
}
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("BankAccountCountry").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
@ -314,10 +333,10 @@ if ($action == 'create')
|
||||
print '<td colspan="3">';
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',$account->comment,'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => 3);
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$account,$action); // Note that $action and $object may have been modified by hook
|
||||
@ -326,7 +345,6 @@ if ($action == 'create')
|
||||
print $account->showOptionals($extrafields,'edit',$parameters);
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
@ -335,7 +353,7 @@ if ($action == 'create')
|
||||
|
||||
// Sold
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("InitialBankBalance").'</td>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.($_POST["solde"]?$_POST["solde"]:price2num($account->solde)).'"></td></tr>';
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="solde" value="'.(GETPOST("solde")?GETPOST("solde"):price2num($account->solde)).'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Date").'</td>';
|
||||
print '<td colspan="3">';
|
||||
@ -349,27 +367,126 @@ if ($action == 'create')
|
||||
print '<td colspan="3"><input size="12" type="text" class="flat" name="account_min_desired" value="'.($_POST["account_min_desired"]?$_POST["account_min_desired"]:$account->account_min_desired).'"></td></tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td>'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td>'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
if (! empty($conf->global->MAIN_BANK_ACCOUNTANCY_CODE_ALWAYS_REQUIRED))
|
||||
{
|
||||
print '<tr><td valign="top" class="fieldrequired" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.$account->account_number.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="account_number" value="'.(GETPOST("account_number")?GETPOST('account_number'):$account->account_number).'"></td></tr>';
|
||||
}
|
||||
|
||||
// Accountancy journal
|
||||
if (! empty($conf->accounting->enabled))
|
||||
{
|
||||
print '<tr><td valign="top">'.$langs->trans("AccountancyJournal").'</td>';
|
||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.$account->accountancy_journal.'"></td></tr>';
|
||||
print '<td colspan="3"><input type="text" name="accountancy_journal" value="'.(GETPOST("accountancy_journal")?GETPOST('accountancy_journal'):$account->accountancy_journal).'"></td></tr>';
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
@ -482,7 +599,7 @@ else
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">'.$account->comment.'</td></tr>';
|
||||
print '<td colspan="3">'.dol_htmlentitiesbr($account->comment).'</td></tr>';
|
||||
|
||||
// Other attributes
|
||||
$parameters=array('colspan' => 3);
|
||||
@ -495,6 +612,118 @@ else
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($account->type == 0 || $account->type == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3">'.$account->bank.'</td></tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_guichet.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td colspan="3">'.$account->code_banque.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td colspan="3">'.$account->number.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td colspan="3">'.$account->cle_rib.'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3">'.$account->iban.' ';
|
||||
if (! empty($account->iban)) {
|
||||
if (! checkIbanForAccount($account)) {
|
||||
print img_picto($langs->trans("IbanNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("IbanValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3">'.$account->bic.' ';
|
||||
if (! empty($account->bic)) {
|
||||
if (! checkSwiftForAccount($account)) {
|
||||
print img_picto($langs->trans("SwiftNotValid"),'warning');
|
||||
} else {
|
||||
print img_picto($langs->trans("SwiftValid"),'info');
|
||||
}
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print nl2br($account->domiciliation);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td><td colspan="3">';
|
||||
print $account->proprio;
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print nl2br($account->owner_address);
|
||||
print "</td></tr>\n";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
// Accountancy code
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("AccountancyCode").'</td>';
|
||||
@ -549,6 +778,13 @@ else
|
||||
{
|
||||
print "\n".'<script type="text/javascript" language="javascript">';
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selecttype").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
});
|
||||
})'."\n";
|
||||
|
||||
print 'jQuery(document).ready(function () {
|
||||
jQuery("#selectaccount_country_id").change(function() {
|
||||
document.formsoc.action.value="edit";
|
||||
document.formsoc.submit();
|
||||
@ -598,11 +834,13 @@ else
|
||||
|
||||
// Country
|
||||
$account->country_id=$account->country_id?$account->country_id:$mysoc->country_id;
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="3">';
|
||||
$selectedcode=$account->country_code;
|
||||
if (isset($_POST["account_country_id"])) $selectedcode=$_POST["account_country_id"];
|
||||
else if (empty($selectedcode)) $selectedcode=$mysoc->country_code;
|
||||
$account->country_code = getCountry($selectedcode, 2); // Force country code on account to have following field on bank fields matching country rules
|
||||
|
||||
print '<tr><td valign="top" class="fieldrequired">'.$langs->trans("Country").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print $form->select_country($selectedcode,'account_country_id');
|
||||
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionarySetup"),1);
|
||||
print '</td></tr>';
|
||||
@ -643,9 +881,9 @@ else
|
||||
// Comment
|
||||
print '<tr><td valign="top">'.$langs->trans("Comment").'</td>';
|
||||
print '<td colspan="3">';
|
||||
// Editor wysiwyg
|
||||
// Editor wysiwyg
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor('account_comment',(isset($_POST["account_comment"])?$_POST["account_comment"]:$account->comment),'',200,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,10,70);
|
||||
$doleditor=new DolEditor('account_comment',(GETPOST("account_comment")?GETPOST("account_comment"):$account->comment),'',90,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_SOCIETE,4,70);
|
||||
$doleditor->Create();
|
||||
print '</td></tr>';
|
||||
|
||||
@ -656,11 +894,110 @@ else
|
||||
{
|
||||
print $account->showOptionals($extrafields,'edit');
|
||||
}
|
||||
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<br>';
|
||||
|
||||
if ($_POST["type"] == 0 || $_POST["type"] == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// If bank account
|
||||
print '<tr><td valign="top" width="25%">'.$langs->trans("BankName").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="bank" value="'.$account->bank.'"></td>';
|
||||
print '</tr>';
|
||||
|
||||
// Show fields of bank account
|
||||
$fieldlists='BankCode DeskCode AccountNumber BankAccountNumberKey';
|
||||
if (! empty($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if (is_numeric($conf->global->BANK_SHOW_ORDER_OPTION))
|
||||
{
|
||||
if ($conf->global->BANK_SHOW_ORDER_OPTION == '1') $fieldlists='BankCode DeskCode BankAccountNumberKey AccountNumber';
|
||||
}
|
||||
else $fieldlists=$conf->global->BANK_SHOW_ORDER_OPTION;
|
||||
}
|
||||
$fieldlistsarray=explode(' ',$fieldlists);
|
||||
|
||||
foreach($fieldlistsarray as $val)
|
||||
{
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'DeskCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("DeskCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_guichet" value="'.$account->code_guichet.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'BankCode')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 2)
|
||||
{
|
||||
print '<tr><td>'.$langs->trans("BankCode").'</td>';
|
||||
print '<td><input size="8" type="text" class="flat" name="code_banque" value="'.$account->code_banque.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
|
||||
if ($val == 'AccountNumber')
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumber").'</td>';
|
||||
print '<td><input size="18" type="text" class="flat" name="number" value="'.$account->number.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
if ($val == 'BankAccountNumberKey')
|
||||
{
|
||||
if ($account->useDetailedBBAN() == 1)
|
||||
{
|
||||
print '<td>'.$langs->trans("BankAccountNumberKey").'</td>';
|
||||
print '<td><input size="3" type="text" class="flat" name="cle_rib" value="'.$account->cle_rib.'"></td>';
|
||||
print '</tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ibankey="IBANNumber";
|
||||
$bickey="BICNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
if ($account->getCountryCode() == 'IN') $bickey="SWIFT";
|
||||
|
||||
// IBAN
|
||||
print '<tr><td valign="top">'.$langs->trans($ibankey).'</td>';
|
||||
print '<td colspan="3"><input size="34" maxlength="34" type="text" class="flat" name="iban" value="'.$account->iban.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans($bickey).'</td>';
|
||||
print '<td colspan="3"><input size="11" maxlength="11" type="text" class="flat" name="bic" value="'.$account->bic.'"></td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountDomiciliation").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"domiciliation\" rows=\"2\" cols=\"40\">";
|
||||
print $account->domiciliation;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwner").'</td>';
|
||||
print '<td colspan="3"><input size="30" type="text" class="flat" name="proprio" value="'.$account->proprio.'">';
|
||||
print '</td></tr>';
|
||||
|
||||
print '<tr><td valign="top">'.$langs->trans("BankAccountOwnerAddress").'</td><td colspan="3">';
|
||||
print "<textarea class=\"flat\" name=\"owner_address\" rows=\"2\" cols=\"40\">";
|
||||
print $account->owner_address;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Accountancy code
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Charles-Fr BENKE <charles.fr@benke.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
|
||||
|
||||
@ -1,11 +1,12 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -23,7 +24,7 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/compta/bank/class/account.class.php
|
||||
* \ingroup banque
|
||||
* \ingroup bank
|
||||
* \brief File of class to manage bank accounts
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php';
|
||||
@ -389,7 +390,17 @@ class Account extends CommonObject
|
||||
$sql.= ", entity";
|
||||
$sql.= ", account_number";
|
||||
$sql.= ", accountancy_journal";
|
||||
$sql.= ", currency_code";
|
||||
$sql.= ", bank";
|
||||
$sql.= ", code_banque";
|
||||
$sql.= ", code_guichet";
|
||||
$sql.= ", number";
|
||||
$sql.= ", cle_rib";
|
||||
$sql.= ", bic";
|
||||
$sql.= ", iban_prefix";
|
||||
$sql.= ", domiciliation";
|
||||
$sql.= ", proprio";
|
||||
$sql.= ", owner_address";
|
||||
$sql.= ", currency_code";
|
||||
$sql.= ", rappro";
|
||||
$sql.= ", min_allowed";
|
||||
$sql.= ", min_desired";
|
||||
@ -403,6 +414,16 @@ class Account extends CommonObject
|
||||
$sql.= ", ".$conf->entity;
|
||||
$sql.= ", '".$this->db->escape($this->account_number)."'";
|
||||
$sql.= ", '".$this->db->escape($this->accountancy_journal)."'";
|
||||
$sql.= ", '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ", '".$this->code_banque."'";
|
||||
$sql.= ", '".$this->code_guichet."'";
|
||||
$sql.= ", '".$this->number."'";
|
||||
$sql.= ", '".$this->cle_rib."'";
|
||||
$sql.= ", '".$this->bic."'";
|
||||
$sql.= ", '".$this->iban."'";
|
||||
$sql.= ", '".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ", '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ", '".$this->db->escape($this->owner_address)."'";
|
||||
$sql.= ", '".$this->currency_code."'";
|
||||
$sql.= ", ".$this->rappro;
|
||||
$sql.= ", ".price2num($this->min_allowed);
|
||||
@ -447,7 +468,7 @@ class Account extends CommonObject
|
||||
$this->error=$this->db->lasterror();
|
||||
return -3;
|
||||
}
|
||||
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('bankdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
@ -492,8 +513,6 @@ class Account extends CommonObject
|
||||
global $langs,$conf, $hookmanager;
|
||||
|
||||
// Clean parameters
|
||||
if (! $this->min_allowed) $this->min_allowed=0;
|
||||
if (! $this->min_desired) $this->min_desired=0;
|
||||
$this->state_id = ($this->state_id?$this->state_id:$this->state_id);
|
||||
$this->country_id = ($this->country_id?$this->country_id:$this->country_id);
|
||||
|
||||
@ -524,10 +543,21 @@ class Account extends CommonObject
|
||||
$sql.= ",account_number = '".$this->account_number."'";
|
||||
$sql.= ",accountancy_journal = '".$this->accountancy_journal."'";
|
||||
|
||||
$sql.= ",bank = '".$this->db->escape($this->bank)."'";
|
||||
$sql.= ",code_banque='".$this->code_banque."'";
|
||||
$sql.= ",code_guichet='".$this->code_guichet."'";
|
||||
$sql.= ",number='".$this->number."'";
|
||||
$sql.= ",cle_rib='".$this->cle_rib."'";
|
||||
$sql.= ",bic='".$this->bic."'";
|
||||
$sql.= ",iban_prefix = '".$this->iban."'";
|
||||
$sql.= ",domiciliation='".$this->db->escape($this->domiciliation)."'";
|
||||
$sql.= ",proprio = '".$this->db->escape($this->proprio)."'";
|
||||
$sql.= ",owner_address = '".$this->db->escape($this->owner_address)."'";
|
||||
|
||||
$sql.= ",currency_code = '".$this->currency_code."'";
|
||||
|
||||
$sql.= ",min_allowed = '".price2num($this->min_allowed)."'";
|
||||
$sql.= ",min_desired = '".price2num($this->min_desired)."'";
|
||||
$sql.= ",min_allowed = ".($this->min_allowed != '' ? price2num($this->min_allowed) : "null");
|
||||
$sql.= ",min_desired = ".($this->min_desired != '' ? price2num($this->min_desired) : "null");
|
||||
$sql.= ",comment = '".$this->db->escape($this->comment)."'";
|
||||
|
||||
$sql.= ",state_id = ".($this->state_id>0?"'".$this->state_id."'":"null");
|
||||
@ -540,7 +570,7 @@ class Account extends CommonObject
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
|
||||
|
||||
// Actions on extra fields (by external module or standard code)
|
||||
$hookmanager->initHooks(array('bankdao'));
|
||||
$parameters=array('id'=>$this->id);
|
||||
@ -557,8 +587,8 @@ class Account extends CommonObject
|
||||
}
|
||||
}
|
||||
else if ($reshook < 0) return -1;
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -704,15 +734,15 @@ class Account extends CommonObject
|
||||
$this->min_allowed = $obj->min_allowed;
|
||||
$this->min_desired = $obj->min_desired;
|
||||
$this->comment = $obj->comment;
|
||||
|
||||
|
||||
// Retreive all extrafield for thirdparty
|
||||
// fetch optionals attributes and labels
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||
$extrafields=new ExtraFields($this->db);
|
||||
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||
$this->fetch_optionals($this->id,$extralabels);
|
||||
|
||||
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
@ -744,7 +774,7 @@ class Account extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$result = $this->db->query($sql);
|
||||
if ($result) {
|
||||
|
||||
|
||||
// Remove extrafields
|
||||
if ((empty($conf->global->MAIN_EXTRAFIELDS_DISABLED))) // For avoid conflicts if trigger used
|
||||
{
|
||||
@ -755,7 +785,7 @@ class Account extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete error -4 ".$this->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
@ -1044,7 +1074,7 @@ class Account extends CommonObject
|
||||
*
|
||||
* @return int 0=No bank code need + Account number is enough
|
||||
* 1=Need 2 fields for bank code: Bank, Desk (France, Spain, ...) + Account number and key
|
||||
* 2=Neek 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
||||
* 2=Need 1 field for bank code: Bank only (Sort code for Great Britain, BSB for Australia) + Account number
|
||||
*/
|
||||
function useDetailedBBAN()
|
||||
{
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* 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
|
||||
@ -174,7 +174,11 @@ foreach ($accounts as $key=>$type)
|
||||
$total[$acc->currency_code] += $solde;
|
||||
}
|
||||
}
|
||||
if (! $found) print '<tr '.$bc[$var].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
if (! $found)
|
||||
{
|
||||
$var = !$var;
|
||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
// Total
|
||||
foreach ($total as $key=>$solde)
|
||||
{
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2008-2009 Laurent Destailleur (Eldy) <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
|
||||
*
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copytight (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copytight (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2005-2009 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
|
||||
|
||||
@ -93,9 +93,10 @@ if ($conf->salaries->enabled)
|
||||
|
||||
print_fiche_titre($langs->trans("SalariesPayments").($year?' ('.$langs->trans("Year").' '.$year.')':''), '', '');
|
||||
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " WHERE s.entity = ".$conf->entity;
|
||||
$sql = "SELECT s.rowid, s.amount, s.label, s.datev as dm, s.salary, u.salary as current_salary";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s, ".MAIN_DB_PREFIX."user as u";
|
||||
$sql.= " WHERE s.entity IN (".getEntity('user',1).")";
|
||||
$sql.= " AND u.rowid = s.fk_user";
|
||||
if ($year > 0)
|
||||
{
|
||||
// Si period renseignee on l'utilise comme critere de date, sinon on prend date echeance,
|
||||
@ -132,11 +133,11 @@ if ($conf->salaries->enabled)
|
||||
|
||||
print "<td>".$obj->label."</td>\n";
|
||||
|
||||
print '<td align="right">'.price($obj->amount)."</td>";
|
||||
print '<td align="right">'.($obj->salary?price($obj->salary):'')."</td>";
|
||||
|
||||
// Ref payment
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
$sal_static->id=$obj->rowid;
|
||||
$sal_static->ref=$obj->rowid;
|
||||
print '<td align="left">'.$sal_static->getNomUrl(1)."</td>\n";
|
||||
|
||||
print '<td align="center">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
@ -146,7 +147,7 @@ if ($conf->salaries->enabled)
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").'</td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
print '<td align="right">'."</td>";
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="right">'.price($total)."</td>";
|
||||
|
||||
@ -58,6 +58,7 @@ $langs->load('compta');
|
||||
$langs->load('products');
|
||||
$langs->load('banks');
|
||||
$langs->load('main');
|
||||
if (!empty($conf->incoterm->enabled)) $langs->load('incoterm');
|
||||
if (! empty($conf->margin->enabled))
|
||||
$langs->load('margins');
|
||||
|
||||
@ -318,6 +319,12 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->facture->creer)
|
||||
{
|
||||
@ -680,6 +687,8 @@ if (empty($reshook))
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture de remplacement
|
||||
$object->fk_facture_source = $_POST['fac_replacement'];
|
||||
@ -724,6 +733,8 @@ if (empty($reshook))
|
||||
$object->fk_account = GETPOST('fk_account', 'int');
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
// Proprietes particulieres a facture avoir
|
||||
$object->fk_facture_source = $_POST['fac_avoir'];
|
||||
@ -852,6 +863,8 @@ if (empty($reshook))
|
||||
$object->amount = $_POST['amount'];
|
||||
$object->remise_absolue = $_POST['remise_absolue'];
|
||||
$object->remise_percent = $_POST['remise_percent'];
|
||||
$object->fk_incoterms = GETPOST('incoterm_id', 'int');
|
||||
$object->location_incoterms = GETPOST('location_incoterms', 'alpha');
|
||||
|
||||
if (GETPOST('type') == Facture::TYPE_SITUATION)
|
||||
{
|
||||
@ -1949,11 +1962,11 @@ if ($action == 'create')
|
||||
// Outstanding Bill
|
||||
$outstandigBills = $soc->get_OutstandingBill();
|
||||
print ' (' . $langs->trans('CurrentOutstandingBill') . ': ';
|
||||
print price($outstandigBills, '', $langs, 0, 0, - 1, $conf->currency);
|
||||
print price($outstandigBills, '', $langs, 0, 0, -1, $conf->currency);
|
||||
if ($soc->outstanding_limit != '')
|
||||
{
|
||||
if ($outstandigBills > $soc->outstanding_limit) print img_warning($langs->trans("OutstandingBillReached"));
|
||||
print ' / ' . price($soc->outstanding_limit);
|
||||
print ' / ' . price($soc->outstanding_limit, '', $langs, 0, 0, -1, $conf->currency);
|
||||
}
|
||||
print ')';
|
||||
print '</td>';
|
||||
@ -2267,6 +2280,16 @@ if ($action == 'create')
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr>';
|
||||
print '<td><label for="incoterm_id">'.$form->textwithpicto($langs->trans("IncotermLabel"), $objectsrc->libelle_incoterms, 1).'</label></td>';
|
||||
print '<td colspan="3" class="maxwidthonsmartphone">';
|
||||
print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:''));
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$parameters = array('objectsrc' => $objectsrc,'colspan' => ' colspan="3"');
|
||||
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by
|
||||
@ -3366,6 +3389,29 @@ if ($action == 'create')
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Incoterms
|
||||
if (!empty($conf->incoterm->enabled))
|
||||
{
|
||||
print '<tr><td>';
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('IncotermLabel');
|
||||
print '<td><td align="right">';
|
||||
if ($user->rights->facture->creer) print '<a href="'.DOL_URL_ROOT.'/compta/facture.php?facid='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
print '<td colspan="3">';
|
||||
if ($action != 'editincoterm')
|
||||
{
|
||||
print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:''), $_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||
}
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
// Other attributes
|
||||
$cols = 5;
|
||||
|
||||
@ -131,6 +131,11 @@ class Facture extends CommonInvoice
|
||||
var $specimen;
|
||||
|
||||
var $fac_rec;
|
||||
|
||||
//Incoterms
|
||||
var $fk_incoterms;
|
||||
var $location_incoterms;
|
||||
var $libelle_incoterms; //Used into tooltip
|
||||
|
||||
/**
|
||||
* @var int Situation cycle reference number
|
||||
@ -245,6 +250,8 @@ class Facture extends CommonInvoice
|
||||
$this->mode_reglement_id = $_facrec->mode_reglement_id;
|
||||
$this->remise_absolue = $_facrec->remise_absolue;
|
||||
$this->remise_percent = $_facrec->remise_percent;
|
||||
$this->fk_incoterms = $_facrec->fk_incoterms;
|
||||
$this->location_incoterms= $_facrec->location_incoterms;
|
||||
|
||||
// Clean parametres
|
||||
if (! $this->type) $this->type = self::TYPE_STANDARD;
|
||||
@ -279,6 +286,7 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", fk_facture_source, fk_user_author, fk_projet";
|
||||
$sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf";
|
||||
$sql.= ", situation_cycle_ref, situation_counter, situation_final";
|
||||
$sql.= ", fk_incoterms, location_incoterms";
|
||||
$sql.= ")";
|
||||
$sql.= " VALUES (";
|
||||
$sql.= "'(PROV)'";
|
||||
@ -304,6 +312,8 @@ class Facture extends CommonInvoice
|
||||
$sql.= ", ".($this->situation_cycle_ref?"'".$this->db->escape($this->situation_cycle_ref)."'":"null");
|
||||
$sql.= ", ".($this->situation_counter?"'".$this->db->escape($this->situation_counter)."'":"null");
|
||||
$sql.= ", ".($this->situation_final?$this->situation_final:0);
|
||||
$sql.= ", ".(int) $this->fk_incoterms;
|
||||
$sql.= ", '".$this->db->escape($this->location_incoterms)."'";
|
||||
$sql.=")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
@ -925,9 +935,12 @@ class Facture extends CommonInvoice
|
||||
$sql.= ', f.fk_account';
|
||||
$sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle';
|
||||
$sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc';
|
||||
$sql.= ', f.fk_incoterms, f.location_incoterms';
|
||||
$sql.= ", i.libelle as libelle_incoterms";
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON f.fk_incoterms = i.rowid';
|
||||
$sql.= ' WHERE f.entity = '.$conf->entity;
|
||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
|
||||
@ -987,6 +1000,11 @@ class Facture extends CommonInvoice
|
||||
$this->situation_final = $obj->situation_final;
|
||||
$this->extraparams = (array) json_decode($obj->extraparams, true);
|
||||
|
||||
//Incoterms
|
||||
$this->fk_incoterms = $obj->fk_incoterms;
|
||||
$this->location_incoterms = $obj->location_incoterms;
|
||||
$this->libelle_incoterms = $obj->libelle_incoterms;
|
||||
|
||||
if ($this->statut == 0) $this->brouillon = 1;
|
||||
|
||||
// Retreive all extrafield for invoice
|
||||
@ -3231,6 +3249,8 @@ class Facture extends CommonInvoice
|
||||
$this->note_public='This is a comment (public)';
|
||||
$this->note_private='This is a comment (private)';
|
||||
$this->note='This is a comment (private)';
|
||||
$this->fk_incoterms=0;
|
||||
$this->location_incoterms='';
|
||||
|
||||
if (empty($option) || $option != 'nolines')
|
||||
{
|
||||
|
||||
@ -187,13 +187,13 @@ if ($search_societe)
|
||||
{
|
||||
$sql .= natural_search('s.nom', $search_societe);
|
||||
}
|
||||
if ($search_montant_ht)
|
||||
if ($search_montant_ht != '')
|
||||
{
|
||||
$sql.= ' AND f.total = \''.$db->escape(price2num(trim($search_montant_ht))).'\'';
|
||||
$sql.= natural_search('f.total', $search_montant_ht, 1);
|
||||
}
|
||||
if ($search_montant_ttc)
|
||||
if ($search_montant_ttc != '')
|
||||
{
|
||||
$sql.= ' AND f.total_ttc = \''.$db->escape(price2num(trim($search_montant_ttc))).'\'';
|
||||
$sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
|
||||
}
|
||||
if ($search_status != '')
|
||||
{
|
||||
@ -263,8 +263,8 @@ if ($resql)
|
||||
if ($search_societe) $param.='&search_societe=' .$search_societe;
|
||||
if ($search_sale > 0) $param.='&search_sale=' .$search_sale;
|
||||
if ($search_user > 0) $param.='&search_user=' .$search_user;
|
||||
if ($search_montant_ht) $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc) $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
if ($search_montant_ht != '') $param.='&search_montant_ht='.$search_montant_ht;
|
||||
if ($search_montant_ttc != '') $param.='&search_montant_ttc='.$search_montant_ttc;
|
||||
print_barre_liste($langs->trans('BillsCustomers').' '.($socid?' '.$soc->name:''),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords);
|
||||
|
||||
$i = 0;
|
||||
@ -323,9 +323,9 @@ if ($resql)
|
||||
print '</td>';
|
||||
print '<td class="liste_titre" align="left"> </td>';
|
||||
print '<td class="liste_titre" align="left"><input class="flat" type="text" name="search_societe" value="'.$search_societe.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ht" value="'.$search_montant_ht.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="10" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"><input class="flat" type="text" size="6" name="search_montant_ttc" value="'.$search_montant_ttc.'"></td>';
|
||||
print '<td class="liste_titre" align="right"> </td>';
|
||||
print '<td class="liste_titre" align="right"><input type="image" class="liste_titre" name="button_search" 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" class="liste_titre" name="button_removefilter" src="'.img_picto($langs->trans("Search"),'searchclear.png','','',1).'" value="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'" title="'.dol_escape_htmltag($langs->trans("RemoveFilter")).'">';
|
||||
|
||||
@ -67,8 +67,8 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$datesp=dol_mktime(12,0,0, $_POST["datespmonth"], $_POST["datespday"], $_POST["datespyear"]);
|
||||
$dateep=dol_mktime(12,0,0, $_POST["dateepmonth"], $_POST["dateepday"], $_POST["dateepyear"]);
|
||||
|
||||
$sal->accountid=GETPOST("accountid");
|
||||
$sal->fk_user=GETPOST("fk_user");
|
||||
$sal->accountid=GETPOST("accountid","int");
|
||||
$sal->fk_user=GETPOST("fk_user","int");
|
||||
$sal->datev=$datev;
|
||||
$sal->datep=$datep;
|
||||
$sal->amount=price2num(GETPOST("amount"));
|
||||
@ -80,6 +80,11 @@ if ($action == 'add' && $_POST["cancel"] <> $langs->trans("Cancel"))
|
||||
$sal->num_payment=GETPOST("num_payment");
|
||||
$sal->fk_user_creat=$user->id;
|
||||
|
||||
// Set user current salary as ref salaray for the payment
|
||||
$fuser=new User($db);
|
||||
$fuser->fetch(GETPOST("fk_user","int"));
|
||||
$sal->salary=$fuser->salary;
|
||||
|
||||
if (empty($datep) || empty($datev) || empty($datesp) || empty($dateep))
|
||||
{
|
||||
setEventMessage($langs->trans("ErrorFieldRequired",$langs->transnoentitiesnoconv("Date")),'errors');
|
||||
|
||||
@ -324,6 +324,7 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= ", datep";
|
||||
$sql.= ", datev";
|
||||
$sql.= ", amount";
|
||||
$sql.= ", salary";
|
||||
$sql.= ", fk_typepayment";
|
||||
$sql.= ", num_payment";
|
||||
if ($this->note) $sql.= ", note";
|
||||
@ -338,7 +339,8 @@ class PaymentSalary extends CommonObject
|
||||
$sql.= "'".$this->fk_user."'";
|
||||
$sql.= ", '".$this->db->idate($this->datep)."'";
|
||||
$sql.= ", '".$this->db->idate($this->datev)."'";
|
||||
$sql.= ", '".$this->amount."'";
|
||||
$sql.= ", ".$this->amount;
|
||||
$sql.= ", ".($this->salary > 0 ? $this->salary : "null");
|
||||
$sql.= ", '".$this->type_payment."'";
|
||||
$sql.= ", '".$this->num_payment."'";
|
||||
if ($this->note) $sql.= ", '".$this->db->escape($this->note)."'";
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
/* Copyright (C) 2011-2014 Alexandre Spangaro <alexandre.spangaro@gmail.com>
|
||||
* Copyright (C) 2015 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
|
||||
@ -82,7 +83,8 @@ $form = new Form($db);
|
||||
$salstatic = new PaymentSalary($db);
|
||||
$userstatic = new User($db);
|
||||
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, s.rowid, s.fk_user, s.amount, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
|
||||
$sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.login, u.email, u.admin, u.salary as current_salary, u.fk_societe as fk_soc,";
|
||||
$sql.= " s.rowid, s.fk_user, s.amount, s.salary, s.label, s.datev as dm, s.fk_typepayment as type, s.num_payment,";
|
||||
$sql.= " pst.code as payment_code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."payment_salary as s";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as pst ON s.fk_typepayment = pst.id,";
|
||||
@ -93,7 +95,7 @@ $sql.= " AND s.entity = ".$conf->entity;
|
||||
// Search criteria
|
||||
if ($search_ref) $sql.=" AND s.rowid=".$search_ref;
|
||||
if ($search_label) $sql.=" AND s.label LIKE '%".$db->escape($search_label)."%'";
|
||||
if ($search_amount) $sql.=" AND s.amount='".$db->escape(price2num(trim($search_amount)))."'";
|
||||
if ($search_amount) $sql.=natural_search("s.amount", $search_amount, 1);
|
||||
if ($filtre) {
|
||||
$filtre=str_replace(":","=",$filtre);
|
||||
$sql .= " AND ".$filtre;
|
||||
@ -124,9 +126,10 @@ if ($result)
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Person"),$_SERVER["PHP_SELF"],"u.rowid","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("ExpectedToPay"),$_SERVER["PHP_SELF"],"s.salary","",$param,"",$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Label"),$_SERVER["PHP_SELF"],"s.label","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("DatePayment"),$_SERVER["PHP_SELF"],"s.datev","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("Type"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PaymentMode"),$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder);
|
||||
print_liste_field_titre($langs->trans("PayedByThisPayment"),$_SERVER["PHP_SELF"],"s.amount","",$param,'align="right"',$sortfield,$sortorder);
|
||||
print_liste_field_titre("");
|
||||
print "</tr>\n";
|
||||
@ -136,6 +139,9 @@ if ($result)
|
||||
print '<td class="liste_titre" align="left">';
|
||||
print '<input class="flat" type="text" size="3" name="search_ref" value="'.$search_ref.'">';
|
||||
print '</td>';
|
||||
// People
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Current salary
|
||||
print '<td class="liste_titre"> </td>';
|
||||
// Label
|
||||
print '<td class="liste_titre"><input type="text" class="flat" size="14" name="search_label" value="'.$search_label.'"></td>';
|
||||
@ -159,10 +165,19 @@ if ($result)
|
||||
$userstatic->id=$obj->uid;
|
||||
$userstatic->lastname=$obj->lastname;
|
||||
$userstatic->firstname=$obj->firstname;
|
||||
$userstatic->admin=$obj->admin;
|
||||
$userstatic->login=$obj->login;
|
||||
$userstatic->email=$obj->email;
|
||||
$userstatic->societe_id=$obj->fk_soc;
|
||||
$salstatic->id=$obj->rowid;
|
||||
$salstatic->ref=$obj->rowid;
|
||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||
// Ref
|
||||
print "<td>".$salstatic->getNomUrl(1)."</td>\n";
|
||||
// User name
|
||||
print "<td>".$userstatic->getNomUrl(1)."</td>\n";
|
||||
// Current salary
|
||||
print "<td>".($obj->salary?price($obj->salary):'')."</td>\n";
|
||||
// Label payment
|
||||
print "<td>".dol_trunc($obj->label,40)."</td>\n";
|
||||
print '<td align="left">'.dol_print_date($db->jdate($obj->dm),'day')."</td>\n";
|
||||
// Type
|
||||
@ -176,7 +191,7 @@ if ($result)
|
||||
|
||||
$i++;
|
||||
}
|
||||
print '<tr class="liste_total"><td colspan="5" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<tr class="liste_total"><td colspan="6" class="liste_total">'.$langs->trans("Total").'</td>';
|
||||
print '<td class="liste_total" align="right">'.price($total,0,$outputlangs,1,-1,-1,$conf->currency)."</td>";
|
||||
print "<td> </td></tr>";
|
||||
|
||||
|
||||
@ -1120,7 +1120,7 @@ else
|
||||
$ref = substr($object->ref, 1, 4);
|
||||
if ($ref == 'PROV' && !empty($modCodeContract->code_auto))
|
||||
{
|
||||
$numref = $object->getNextNumRef($soc);
|
||||
$numref = $object->getNextNumRef($object->thirdparty);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -640,6 +640,11 @@ class Contrat extends CommonObject
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
$extrafieldsline=new ExtraFields($this->db);
|
||||
$line = new ContratLigne($this->db);
|
||||
$extralabelsline=$extrafieldsline->fetch_name_optionals_label($line->table_element,true);
|
||||
|
||||
$this->lines=array();
|
||||
|
||||
// Selectionne les lignes contrats liees a un produit
|
||||
@ -718,6 +723,10 @@ class Contrat extends CommonObject
|
||||
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
|
||||
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
|
||||
|
||||
// Retreive all extrafield for propal
|
||||
// fetch optionals attributes and labels
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
//dol_syslog("1 ".$line->desc);
|
||||
@ -813,6 +822,13 @@ class Contrat extends CommonObject
|
||||
if ($line->statut == 4 && (! empty($line->date_fin_prevue) && $line->date_fin_prevue < $now)) $this->nbofservicesexpired++;
|
||||
if ($line->statut == 5) $this->nbofservicesclosed++;
|
||||
|
||||
|
||||
// Retreive all extrafield for propal
|
||||
// fetch optionals attributes and labels
|
||||
|
||||
$line->fetch_optionals($line->id,$extralabelsline);
|
||||
|
||||
|
||||
$this->lines[] = $line;
|
||||
|
||||
$total_ttc+=$objp->total_ttc;
|
||||
|
||||
@ -91,7 +91,7 @@ llxHeader();
|
||||
|
||||
if ($object->id)
|
||||
{
|
||||
$head=contract_prepare_head($object, $user);
|
||||
$head=contract_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'documents', $langs->trans("Contract"), 0, 'contract');
|
||||
|
||||
|
||||
40
htdocs/core/actions_fetchobject.inc.php
Normal file
40
htdocs/core/actions_fetchobject.inc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/* Copyright (C) 2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Frederic France <frederic.france@free.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/actions_fetchobject.inc.php
|
||||
* \brief Code for actions on fetching object page
|
||||
*/
|
||||
|
||||
|
||||
// $action must be defined
|
||||
// $object must be defined (object is loaded in this file with fetch)
|
||||
// $id or $ref must be defined (object is loaded in this file with fetch)
|
||||
|
||||
if ($id > 0 || ! empty($ref))
|
||||
{
|
||||
$ret = $object->fetch($id,$ref);
|
||||
if ($ret > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
$id=$object->id;
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
}
|
||||
@ -206,7 +206,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* Define array with couple subtitution key => subtitution value
|
||||
*
|
||||
* @param Object $object contact
|
||||
* @param Contact $object contact
|
||||
* @param Translate $outputlangs object for output
|
||||
* @param array_key $array_key Name of the key for return array
|
||||
* @return array of substitution key->code
|
||||
@ -442,7 +442,7 @@ abstract class CommonDocGenerator
|
||||
/**
|
||||
* Define array with couple substitution key => substitution value
|
||||
*
|
||||
* @param Object $object Main object to use as data source
|
||||
* @param Expedition $object Main object to use as data source
|
||||
* @param Translate $outputlangs Lang object to use for output
|
||||
* @param array_key $array_key Name of the key for return array
|
||||
* @return array Array of substitution
|
||||
|
||||
@ -888,7 +888,7 @@ abstract class CommonObject
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined", LOG_ERR);
|
||||
dol_print_error('',get_class($this)."::load_previous_next_ref was called on objet with property table_element not defined");
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1776,6 +1776,7 @@ abstract class CommonObject
|
||||
if ($this->element == 'facture_fourn' || $this->element == 'invoice_supplier') $fieldtva='total_tva';
|
||||
if ($this->element == 'propal') $fieldttc='total';
|
||||
if ($this->element == 'expensereport') $fieldtva='total_tva';
|
||||
if ($this->element == 'askpricesupplier') $fieldttc='total';
|
||||
|
||||
if (empty($nodatabaseupdate))
|
||||
{
|
||||
@ -1966,6 +1967,9 @@ abstract class CommonObject
|
||||
else if ($objecttype == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
else if ($objecttype == 'askpricesupplier') {
|
||||
$classpath = 'comm/askpricesupplier/class';
|
||||
}
|
||||
else if ($objecttype == 'shipping') {
|
||||
$classpath = 'expedition/class'; $subelement = 'expedition'; $module = 'expedition_bon';
|
||||
}
|
||||
@ -2137,7 +2141,8 @@ abstract class CommonObject
|
||||
$fieldstatus="fk_statut";
|
||||
if ($elementTable == 'user') $fieldstatus="statut";
|
||||
if ($elementTable == 'expensereport') $fieldstatus="fk_c_expensereport_statuts";
|
||||
|
||||
if ($elementTable == 'commande_fournisseur_dispatch') $fieldstatus="status";
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$elementTable;
|
||||
$sql.= " SET ".$fieldstatus." = ".$status;
|
||||
// If status = 1 = validated, update also fk_user_valid
|
||||
@ -2387,6 +2392,91 @@ abstract class CommonObject
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return incoterms informations
|
||||
*
|
||||
* @return string incoterms info
|
||||
*/
|
||||
function display_incoterms()
|
||||
{
|
||||
$out = '';
|
||||
$this->incoterms_libelle = '';
|
||||
if (!empty($this->fk_incoterms))
|
||||
{
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$res = $this->db->fetch_object($result);
|
||||
$out .= $res->code;
|
||||
}
|
||||
}
|
||||
|
||||
$out .= ' - '.$this->location_incoterms;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return incoterms informations for pdf display
|
||||
*
|
||||
* @return string incoterms info
|
||||
*/
|
||||
function getIncotermsForPDF()
|
||||
{
|
||||
$sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$res = $this->db->fetch_object($resql);
|
||||
return 'Incoterm : '.$res->code.' - '.$this->location_incoterms;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Define incoterms values of current object
|
||||
*
|
||||
* @param int $id_incoterm Id of incoterm to set or '' to remove
|
||||
* @param string $location location of incoterm
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
function setIncoterms($id_incoterm, $location)
|
||||
{
|
||||
if ($this->id && $this->table_element)
|
||||
{
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
|
||||
$sql.= " SET fk_incoterms = ".($id_incoterm > 0 ? $id_incoterm : "null");
|
||||
$sql.= ", location_incoterms = '".($id_incoterm > 0 ? $this->db->escape($location) : "null")."'";
|
||||
$sql.= " WHERE rowid = " . $this->id;
|
||||
dol_syslog(get_class($this).'::setIncoterms', LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->fk_incoterms = $id_incoterm;
|
||||
$this->location_incoterms = $location;
|
||||
|
||||
$sql = 'SELECT libelle FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms;
|
||||
$res = $this->db->query($sql);
|
||||
if ($res)
|
||||
{
|
||||
$obj = $this->db->fetch_object($res);
|
||||
$this->libelle_incoterms = $obj->libelle;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else return -1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return if a country is inside the EEC (European Economic Community)
|
||||
*
|
||||
@ -2484,6 +2574,10 @@ abstract class CommonObject
|
||||
$tplpath = 'comm/'.$element;
|
||||
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') {
|
||||
$tplpath = 'expedition';
|
||||
if (empty($conf->expedition->enabled)) continue; // Do not show if module disabled
|
||||
@ -2586,6 +2680,11 @@ abstract class CommonObject
|
||||
// Description
|
||||
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
|
||||
print '<td align="right" width="50">'.$langs->trans('VAT').'</td>';
|
||||
|
||||
|
||||
@ -452,7 +452,7 @@ class Conf
|
||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||
|
||||
// Define list of limited modules
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
if (! isset($this->global->MAIN_MODULES_FOR_EXTERNAL)) $this->global->MAIN_MODULES_FOR_EXTERNAL='user,askpricesupplier,facture,categorie,commande,fournisseur,contact,propal,projet,contrat,societe,ficheinter,expedition,agenda,adherent'; // '' means 'all'. Note that contact is added here as it should be a module later.
|
||||
|
||||
// Enable select2
|
||||
if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)) $conf->global->MAIN_USE_JQUERY_MULTISELECT='select2';
|
||||
|
||||
@ -109,7 +109,7 @@ class DolCookie
|
||||
*
|
||||
* @param string $cookie Cookie name
|
||||
* @param string $value Cookie value
|
||||
* @param string $expire Expiration
|
||||
* @param integer $expire Expiration
|
||||
* @param string $path Path of cookie
|
||||
* @param string $domain Domain name
|
||||
* @param int $secure 0 or 1
|
||||
|
||||
@ -480,7 +480,7 @@ class Form
|
||||
* @param string $selected Id or Code or Label of preselected country
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption Options html on select object
|
||||
* @param string $maxlength Max length for labels (0=no limit)
|
||||
* @param integer $maxlength Max length for labels (0=no limit)
|
||||
* @return string HTML string with select
|
||||
*/
|
||||
function select_country($selected='',$htmlname='country_id',$htmloption='',$maxlength=0)
|
||||
@ -558,6 +558,98 @@ class Form
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return select list of incoterms
|
||||
*
|
||||
* @param string $selected Id or Code of preselected incoterm
|
||||
* @param string $location_incoterms Value of input location
|
||||
* @param string $page Defined the form action
|
||||
* @param string $htmlname Name of html select object
|
||||
* @param string $htmloption Options html on select object
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Event options to run on change. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @return string HTML string with select and input
|
||||
*/
|
||||
function select_incoterms($selected='', $location_incoterms='', $page='',$htmlname='incoterm_id',$htmloption='', $forcecombo=0, $events=array())
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load("dict");
|
||||
|
||||
$out='';
|
||||
$incotermArray=array();
|
||||
|
||||
$sql = "SELECT rowid, code";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_incoterms";
|
||||
$sql.= " WHERE active = 1";
|
||||
$sql.= " ORDER BY code ASC";
|
||||
|
||||
dol_syslog(get_class($this)."::select_incoterm", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
if (!$forcecombo)
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname, $events);
|
||||
}
|
||||
|
||||
if (!empty($page))
|
||||
{
|
||||
$out .= '<form method="post" action="'.$page.'">';
|
||||
$out .= '<input type="hidden" name="action" value="set_incoterms">';
|
||||
$out .= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
}
|
||||
|
||||
$out.= '<select id="'.$htmlname.'" class="flat selectincoterm" name="'.$htmlname.'" '.$htmloption.'>';
|
||||
$out.= '<option value=""></option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
$foundselected=false;
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
$incotermArray[$i]['rowid'] = $obj->rowid;
|
||||
$incotermArray[$i]['code'] = $obj->code;
|
||||
$i++;
|
||||
}
|
||||
|
||||
foreach ($incotermArray as $row)
|
||||
{
|
||||
if ($selected && ($selected == $row['rowid'] || $selected == $row['code']))
|
||||
{
|
||||
$out.= '<option value="'.$row['rowid'].'" selected="selected">';
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="'.$row['rowid'].'">';
|
||||
}
|
||||
|
||||
if ($row['code']) $out.= $row['code'];
|
||||
|
||||
$out.= '</option>';
|
||||
}
|
||||
}
|
||||
$out.= '</select>';
|
||||
|
||||
$out .= '<input id="location_incoterms" name="location_incoterms" size="14" value="'.$location_incoterms.'">';
|
||||
|
||||
if (!empty($page))
|
||||
{
|
||||
$out .= '<input type="submit" class="button" value="'.$langs->trans("Modify").'"></form>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return list of types of lines (product or service)
|
||||
* Example: 0=product, 1=service, 9=other (for external module)
|
||||
@ -566,7 +658,7 @@ class Form
|
||||
* @param string $htmlname Name of field in html form
|
||||
* @param int $showempty Add an empty field
|
||||
* @param int $hidetext Do not show label 'Type' before combo box (used only if there is at least 2 choices to select)
|
||||
* @param string $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service')
|
||||
* @param integer $forceall 1=Force to show products and services in combo list, whatever are activated modules, 0=No force, -1=Force none (and set hidden field to 'service')
|
||||
* @return void
|
||||
*/
|
||||
function select_type_of_lines($selected='',$htmlname='type',$showempty=0,$hidetext=0,$forceall=0)
|
||||
@ -980,9 +1072,9 @@ class Form
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param integer $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @param string $showsoc Add company into label
|
||||
* @param integer $showsoc Add company into label
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @param bool $options_only Return options only (for ajax treatment)
|
||||
@ -1003,10 +1095,10 @@ class Form
|
||||
* @param int $showempty 0=no empty value, 1=add an empty value, 2=add line 'Internal' (used by user edit)
|
||||
* @param string $exclude List of contacts id to exclude
|
||||
* @param string $limitto Disable answers that are not id in this array list
|
||||
* @param string $showfunction Add function into label
|
||||
* @param integer $showfunction Add function into label
|
||||
* @param string $moreclass Add more class to class style
|
||||
* @param bool $options_only Return options only (for ajax treatment)
|
||||
* @param string $showsoc Add company into label
|
||||
* @param integer $showsoc Add company into label
|
||||
* @param int $forcecombo Force to use combo box
|
||||
* @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled')))
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
|
||||
@ -171,6 +171,7 @@ class FormActions
|
||||
if ($typeelement == '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 == 'askpricesupplier') $title=$langs->trans('ActionsOnAskPriceSupplier');
|
||||
elseif ($typeelement == 'order') $title=$langs->trans('ActionsOnOrder');
|
||||
elseif ($typeelement == 'order_supplier' || $typeelement == 'supplier_order') $title=$langs->trans('ActionsOnOrder');
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
/* Copyright (C) 2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -44,7 +45,7 @@ class FormBank
|
||||
/**
|
||||
* Retourne la liste des types de comptes financiers
|
||||
*
|
||||
* @param string $selected Type pre-selectionne
|
||||
* @param integer $selected Type pre-selectionne
|
||||
* @param string $htmlname Nom champ formulaire
|
||||
* @return void
|
||||
*/
|
||||
@ -55,7 +56,7 @@ class FormBank
|
||||
|
||||
$type_available=array(0,1,2);
|
||||
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
print '<select id="select'.$htmlname.'" class="flat" name="'.$htmlname.'">';
|
||||
$num = count($type_available);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
|
||||
@ -47,8 +47,8 @@ class FormCron extends Form
|
||||
* Display On Off selector
|
||||
*
|
||||
* @param string $htmlname Html control name
|
||||
* @param string $selected selected value
|
||||
* @param string $readonly Select is read only or not
|
||||
* @param integer $selected selected value
|
||||
* @param integer $readonly Select is read only or not
|
||||
* @return string HTML select field
|
||||
*/
|
||||
function select_typejob($htmlname,$selected=0,$readonly=0)
|
||||
|
||||
@ -273,7 +273,7 @@ class FormFile
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
@ -316,6 +316,15 @@ class FormFile
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/propale/modules_propale.php';
|
||||
$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')
|
||||
{
|
||||
@ -671,7 +680,7 @@ class FormFile
|
||||
|
||||
$out='';
|
||||
$this->numoffiles=0;
|
||||
|
||||
|
||||
$file_list=dol_dir_list($filedir, 'files', 0, preg_quote(basename($modulesubdir).'.pdf','/'), '\.meta$|\.png$');
|
||||
|
||||
// For ajax treatment
|
||||
@ -921,6 +930,11 @@ class FormFile
|
||||
include_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php';
|
||||
$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')
|
||||
{
|
||||
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_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 == '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_supplier') { 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='';
|
||||
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_INVOICE_TO) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $showinfobcc=$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO;
|
||||
if ($showinfobcc) $out.=' + '.$showinfobcc;
|
||||
@ -498,6 +499,7 @@ class FormMail
|
||||
{
|
||||
$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_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_INVOICE) && ! empty($this->param['models']) && $this->param['models'] == 'facture_send') $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"); }
|
||||
elseif ($type_template=='facture_relance') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendInvoiceReminder"); }
|
||||
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_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierOrder"); }
|
||||
elseif ($type_template=='invoice_supplier_send') { $defaultmessage=$outputlangs->transnoentities("PredefinedMailContentSendSupplierInvoice"); }
|
||||
|
||||
@ -48,7 +48,7 @@ class FormMailing extends Form
|
||||
*
|
||||
* @param string $selectedid the selected id
|
||||
* @param string $htmlname name of controm
|
||||
* @param number $show_empty show empty option
|
||||
* @param integer $show_empty show empty option
|
||||
* @return string HTML select
|
||||
*/
|
||||
public function selectDestinariesStatus($selectedid='',$htmlname='dest_status', $show_empty=0) {
|
||||
|
||||
@ -57,11 +57,11 @@ class FormOrder
|
||||
{
|
||||
print '<select class="flat" name="'.$hmlname.'">';
|
||||
print '<option value="-1"> </option>';
|
||||
$statustohow=array(0,1,2,3,4,5,6,9); // 7 is same label than 6. 8 does not exist.
|
||||
$statustohow=array('0'=>'0','1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6,7','9'=>'9'); // 7 is same label than 6. 8 does not exist.
|
||||
|
||||
foreach($statustohow as $key)
|
||||
foreach($statustohow as $key => $value)
|
||||
{
|
||||
print '<option value="'.$key.'"'.($selected == $key?' selected="selected"':'').'>';
|
||||
print '<option value="'.$value.'"'.(($selected == $key || $selected == $value)?' selected="selected"':'').'>';
|
||||
print CommandeFournisseur::LibStatut($key,$short);
|
||||
print '</option>';
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ class FormOther
|
||||
*
|
||||
* @param string $selected Preselected ecotaxes
|
||||
* @param string $htmlname Name of combo list
|
||||
* @return void
|
||||
* @return integer
|
||||
*/
|
||||
function select_ecotaxes($selected='',$htmlname='ecotaxe_id')
|
||||
{
|
||||
@ -268,7 +268,7 @@ class FormOther
|
||||
/**
|
||||
* Return a HTML select list to select a percent
|
||||
*
|
||||
* @param string $selected pourcentage pre-selectionne
|
||||
* @param integer $selected pourcentage pre-selectionne
|
||||
* @param string $htmlname nom de la liste deroulante
|
||||
* @param int $disabled Disabled or not
|
||||
* @param int $increment increment value
|
||||
@ -303,7 +303,7 @@ class FormOther
|
||||
* Return select list for categories (to use in form search selectors)
|
||||
*
|
||||
* @param int $type Type of categories (0=product, 1=suppliers, 2=customers, 3=members)
|
||||
* @param string $selected Preselected value
|
||||
* @param integer $selected Preselected value
|
||||
* @param string $htmlname Name of combo list
|
||||
* @param int $nocateg Show also an entry "Not categorized"
|
||||
* @return string Html combo list code
|
||||
@ -834,7 +834,7 @@ class FormOther
|
||||
* @param int $offset Offset
|
||||
* @param int $invert Invert
|
||||
* @param string $option Option
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function selectyear($selected='',$htmlname='yearid',$useempty=0, $min_year=10, $max_year=5, $offset=0, $invert=0, $option='')
|
||||
{
|
||||
|
||||
@ -53,7 +53,7 @@ class Menu
|
||||
*
|
||||
* @param string $url Url to follow on click
|
||||
* @param string $titre Label of menu to add
|
||||
* @param string $level Level of menu to add
|
||||
* @param integer $level Level of menu to add
|
||||
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
|
||||
* @param string $target Target lien
|
||||
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
||||
@ -71,7 +71,7 @@ class Menu
|
||||
* @param int $idafter Array key after which inserting new entry
|
||||
* @param string $url Url to follow on click
|
||||
* @param string $titre Label of menu to add
|
||||
* @param string $level Level of menu to add
|
||||
* @param integer $level Level of menu to add
|
||||
* @param int $enabled Menu active or not
|
||||
* @param string $target Target lien
|
||||
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
||||
|
||||
@ -687,7 +687,7 @@ class MobileDetect
|
||||
/**
|
||||
* Retrieve the User-Agent.
|
||||
*
|
||||
* @return string|null The user agent if it's set.
|
||||
* @return string The user agent if it's set.
|
||||
*/
|
||||
public function getUserAgent()
|
||||
{
|
||||
@ -879,7 +879,7 @@ class MobileDetect
|
||||
*
|
||||
* @param string $name Name
|
||||
* @param array $arguments Arguments
|
||||
* @return mixed
|
||||
* @return null|boolean
|
||||
*
|
||||
* @throws BadMethodCallException when the method doesn't exist and doesn't start with 'is'
|
||||
* @method boolean is[...]()
|
||||
@ -926,7 +926,7 @@ class MobileDetect
|
||||
*
|
||||
* @param string $key Key
|
||||
* @param string $userAgent deprecated
|
||||
* @return mixed
|
||||
* @return null|boolean
|
||||
*/
|
||||
protected function matchUAAgainstKey($key, $userAgent = null)
|
||||
{
|
||||
@ -1009,7 +1009,7 @@ class MobileDetect
|
||||
* @param string $key key
|
||||
* @param string $userAgent deprecated
|
||||
* @param string $httpHeaders deprecated
|
||||
* @return bool|int|null
|
||||
* @return null|boolean
|
||||
*
|
||||
* @todo: The httpHeaders part is not yet used.
|
||||
*/
|
||||
|
||||
@ -150,7 +150,7 @@ class SimpleOpenID
|
||||
/**
|
||||
* GetIdentity
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function GetIdentity()
|
||||
{ // Get Identity
|
||||
@ -187,7 +187,7 @@ class SimpleOpenID
|
||||
/**
|
||||
* IsError
|
||||
*
|
||||
* @return void
|
||||
* @return boolean
|
||||
*/
|
||||
function IsError()
|
||||
{
|
||||
@ -225,7 +225,7 @@ class SimpleOpenID
|
||||
* OpenID_Standarize
|
||||
*
|
||||
* @param string $openid_identity Server
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function OpenID_Standarize($openid_identity = null)
|
||||
{
|
||||
@ -251,7 +251,7 @@ class SimpleOpenID
|
||||
* array2url
|
||||
*
|
||||
* @param array $arr An array
|
||||
* @return boolean|string false if KO, string of url if OK
|
||||
* @return false|string false if KO, string of url if OK
|
||||
*/
|
||||
function array2url($arr)
|
||||
{ // converts associated array to URL Query String
|
||||
@ -303,7 +303,7 @@ class SimpleOpenID
|
||||
* @param string $url URL
|
||||
* @param string $method Method
|
||||
* @param string $params Params
|
||||
* @return boolean|unknown
|
||||
* @return string
|
||||
*/
|
||||
function CURL_Request($url, $method="GET", $params = "")
|
||||
{ // Remember, SSL MUST BE SUPPORTED
|
||||
@ -384,7 +384,7 @@ class SimpleOpenID
|
||||
/**
|
||||
* GetRedirectURL
|
||||
*
|
||||
* @return void
|
||||
* @return string
|
||||
*/
|
||||
function GetRedirectURL()
|
||||
{
|
||||
@ -428,7 +428,7 @@ class SimpleOpenID
|
||||
/**
|
||||
* ValidateWithServer
|
||||
*
|
||||
* @return void
|
||||
* @return boolean
|
||||
*/
|
||||
function ValidateWithServer()
|
||||
{
|
||||
|
||||
@ -153,7 +153,7 @@ class Translate
|
||||
* If $domain is "file@module" instead of "file" then we look for module lang file
|
||||
* in htdocs/custom/modules/mymodule/langs/code_CODE/file.lang
|
||||
* then in htdocs/module/langs/code_CODE/file.lang instead of htdocs/langs/code_CODE/file.lang
|
||||
* @param string $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US)
|
||||
* @param integer $alt 0 (try xx_ZZ then 1), 1 (try xx_XX then 2), 2 (try en_US)
|
||||
* @param int $stopafterdirection Stop when the DIRECTION tag is found (optimize speed)
|
||||
* @param int $forcelangdir To force a different lang directory
|
||||
* @return int <0 if KO, 0 if already loaded or loading not required, >0 if OK
|
||||
@ -548,7 +548,7 @@ class Translate
|
||||
* Return list of all available languages
|
||||
*
|
||||
* @param string $langdir Directory to scan
|
||||
* @param string $maxlength Max length for each value in combo box (will be truncated)
|
||||
* @param integer $maxlength Max length for each value in combo box (will be truncated)
|
||||
* @param int $usecode Show code instead of country name for language variant
|
||||
* @return array List of languages
|
||||
*/
|
||||
@ -583,7 +583,7 @@ class Translate
|
||||
* Return if a filename $filename exists for current language (or alternate language)
|
||||
*
|
||||
* @param string $filename Language filename to search
|
||||
* @param string $searchalt Search also alernate language file
|
||||
* @param integer $searchalt Search also alernate language file
|
||||
* @return boolean true if exists and readable
|
||||
*/
|
||||
function file_exists($filename,$searchalt=0)
|
||||
@ -720,7 +720,7 @@ class Translate
|
||||
* Return a currency code into its symbol
|
||||
*
|
||||
* @param string $currency_code Currency code
|
||||
* @param string $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
|
||||
* @param integer $forceloadall 1=Force to load all currencies into cache. We know we need to use all of them. By default read and cache only required currency.
|
||||
* @return string Currency symbol encoded into UTF8
|
||||
*/
|
||||
function getCurrencySymbol($currency_code, $forceloadall=0)
|
||||
|
||||
@ -122,7 +122,7 @@ print '</body></html>'."\n";
|
||||
* Convert date to timestamp
|
||||
*
|
||||
* @param string $mysqldate Date YYYMMDD
|
||||
* @return timestamp Timestamp
|
||||
* @return integer Timestamp
|
||||
*/
|
||||
function xyzToUnixTimestamp($mysqldate)
|
||||
{
|
||||
|
||||
@ -237,10 +237,10 @@ class DoliDBMssql extends DoliDB
|
||||
|
||||
$res=mssql_query('select @@TRANCOUNT');
|
||||
$this->transaction_opened=mssql_result($res, 0, 0);
|
||||
|
||||
|
||||
if ($this->transaction_opened == 0)
|
||||
{
|
||||
//return 1; //There is a mess with auto_commit and 'SET IMPLICIT_TRANSACTIONS ON' generate also a mess
|
||||
//return 1; //There is a mess with auto_commit and 'SET IMPLICIT_TRANSACTIONS ON' generate also a mess
|
||||
$ret=mssql_query("SET IMPLICIT_TRANSACTIONS OFF;BEGIN TRANSACTION;",$this->db);
|
||||
if ($ret)
|
||||
{
|
||||
@ -264,7 +264,7 @@ class DoliDBMssql extends DoliDB
|
||||
{
|
||||
$res=mssql_query('select @@TRANCOUNT');
|
||||
$this->transaction_opened=mssql_result($res, 0, 0);
|
||||
|
||||
|
||||
if ($this->transaction_opened == 1)
|
||||
{
|
||||
//return 1; //There is a mess with auto_commit and 'SET IMPLICIT_TRANSACTION ON' generate also a mess
|
||||
@ -296,7 +296,7 @@ class DoliDBMssql extends DoliDB
|
||||
{
|
||||
$res=mssql_query('select @@TRANCOUNT');
|
||||
$this->transaction_opened=mssql_result($res, 0, 0);
|
||||
|
||||
|
||||
if ($this->transaction_opened == 1)
|
||||
{
|
||||
$ret=mssql_query("ROLLBACK TRANSACTION",$this->db);
|
||||
@ -322,7 +322,7 @@ class DoliDBMssql extends DoliDB
|
||||
function query($query,$usesavepoint=0,$type='auto')
|
||||
{
|
||||
$query = trim($query);
|
||||
|
||||
|
||||
if (preg_match('/^--/',$query)) return true;
|
||||
|
||||
// Conversion syntaxe MySql vers MSDE.
|
||||
@ -331,7 +331,7 @@ class DoliDBMssql extends DoliDB
|
||||
$query = str_ireplace(", tms = tms", "", $query);
|
||||
|
||||
$query=preg_replace("/([. ,\t(])(percent|file|public)([. ,=\t)])/","$1[$2]$3",$query);
|
||||
|
||||
|
||||
if ($type=="auto" || $type='dml')
|
||||
{
|
||||
$query=preg_replace('/AUTO_INCREMENT/i','IDENTITY',$query);
|
||||
@ -339,7 +339,7 @@ class DoliDBMssql extends DoliDB
|
||||
$query=preg_replace('/float\((.*)\)/','numeric($1)',$query);
|
||||
$query=preg_replace('/([ \t])unsigned|IF NOT EXISTS[ \t]/i','$1',$query);
|
||||
$query=preg_replace('/([ \t])(MEDIUM|TINY|LONG){0,1}TEXT([ \t,])/i',"$1VARCHAR(MAX)$3",$query);
|
||||
|
||||
|
||||
$matches=array();
|
||||
$original_query='';
|
||||
if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+(?:(UNIQUE)|INDEX)\h+(?:INDEX)?\h*(\w+?)\h*\((.+)\)/is', $query,$matches))
|
||||
@ -360,7 +360,7 @@ class DoliDBMssql extends DoliDB
|
||||
if ($query_comp)
|
||||
$query.=" WHERE ".implode(" AND ",$query_comp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (preg_match('/ALTER TABLE\h+(\w+?)\h+ADD\h+PRIMARY\h+KEY\h+(\w+?)\h*\((.+)\)/is', $query, $matches))
|
||||
@ -369,7 +369,7 @@ class DoliDBMssql extends DoliDB
|
||||
$query="ALTER TABLE [".$matches[1]."] ADD CONSTRAINT [".$matches[2]."] PRIMARY KEY CLUSTERED (".$matches[3].")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if ($type=="auto" || $type='ddl')
|
||||
@ -384,13 +384,13 @@ class DoliDBMssql extends DoliDB
|
||||
// Supprimer l'instruction MySql
|
||||
$query = str_ireplace(" limit ".$number, "", $query);
|
||||
}
|
||||
|
||||
|
||||
$itemfound = stripos($query, " week(");
|
||||
if ($itemfound !== false) {
|
||||
// Recreer une requete sans instruction Mysql
|
||||
$positionMySql = stripos($query, " week(");
|
||||
$newquery = substr($query, 0, $positionMySql);
|
||||
|
||||
|
||||
// Recuperer la date passee en parametre
|
||||
$extractvalue = stristr($query, " week(");
|
||||
$extractvalue = substr($extractvalue, 6);
|
||||
@ -398,7 +398,7 @@ class DoliDBMssql extends DoliDB
|
||||
// Conserver la fin de la requete
|
||||
$endofquery = substr($extractvalue, $positionMySql);
|
||||
$extractvalue = substr($extractvalue, 0, $positionMySql);
|
||||
|
||||
|
||||
// Remplacer l'instruction MySql en Sql Server
|
||||
// Inserer la date en parametre et le reste de la requete
|
||||
$query = $newquery." DATEPART(week, ".$extractvalue.$endofquery;
|
||||
@ -407,11 +407,11 @@ class DoliDBMssql extends DoliDB
|
||||
{
|
||||
//var_dump($query);
|
||||
//var_dump($matches);
|
||||
if (stripos($query,'llx_c_departements') !== false) var_dump($query);
|
||||
//if (stripos($query,'llx_c_departements') !== false) var_dump($query);
|
||||
$sql='SET IDENTITY_INSERT ['.trim($matches[1]).'] ON;';
|
||||
@mssql_query($sql, $this->db);
|
||||
$post_query='SET IDENTITY_INSERT ['.trim($matches[1]).'] OFF;';
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//print "<!--".$query."-->";
|
||||
@ -427,7 +427,7 @@ class DoliDBMssql extends DoliDB
|
||||
{
|
||||
$ret = mssql_query($query, $this->db);
|
||||
}
|
||||
|
||||
|
||||
if (!empty($post_query))
|
||||
{
|
||||
@mssql_query($post_query, $this->db);
|
||||
@ -732,13 +732,13 @@ class DoliDBMssql extends DoliDB
|
||||
//TODO: Check if we need to force a charset
|
||||
//$sql.= ' DEFAULT CHARACTER SET '.$charset.' DEFAULT COLLATE '.$collation;
|
||||
$ret=$this->query($sql);
|
||||
|
||||
|
||||
$this->select_db($database);
|
||||
$sql="CREATE USER [$owner] FOR LOGIN [$owner]";
|
||||
mssql_query($sql,$this->db);
|
||||
$sql="ALTER ROLE [db_owner] ADD MEMBER [$owner]";
|
||||
mssql_query($sql,$this->db);
|
||||
|
||||
|
||||
$sql="ALTER DATABASE [$database] SET ANSI_NULL_DEFAULT ON;";
|
||||
@mssql_query($sql,$this->db);
|
||||
$sql="ALTER DATABASE [$database] SET ANSI_NULL ON;";
|
||||
@ -976,12 +976,12 @@ class DoliDBMssql extends DoliDB
|
||||
}
|
||||
$sql="SELECT name from sys.databases where name='".$dolibarr_main_db_name."'";
|
||||
$ressql=$this->query($sql);
|
||||
if (! $ressql)
|
||||
if (! $ressql)
|
||||
{
|
||||
dol_syslog(get_class($this)."::DDLCreateUser sql=".$sql, LOG_WARNING);
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($num)
|
||||
{
|
||||
@ -1106,7 +1106,7 @@ class DoliDBMssql extends DoliDB
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Escape a field name according to escape's syntax
|
||||
*
|
||||
@ -1116,18 +1116,18 @@ class DoliDBMssql extends DoliDB
|
||||
function EscapeFieldName($fieldname) {
|
||||
return "[".$fieldname."]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get information on field
|
||||
*
|
||||
*
|
||||
* @param string $table Table name which contains fields
|
||||
* @param mixed $fields String for one field or array of string for multiple field
|
||||
* @return boolean|multitype:object
|
||||
*/
|
||||
function GetFieldInformation($table,$fields) {
|
||||
$sql="SELECT * from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='".$this->escape($table)."' AND COLUMN_NAME";
|
||||
if (is_array($fields))
|
||||
if (is_array($fields))
|
||||
{
|
||||
$where=" IN ('".implode("','",$fields)."')";
|
||||
}
|
||||
@ -1144,7 +1144,7 @@ class DoliDBMssql extends DoliDB
|
||||
$result[]=$obj;
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
return false;
|
||||
|
||||
return $result;
|
||||
|
||||
@ -183,7 +183,7 @@ class DoliDBMysql extends DoliDB
|
||||
* @param string $login login
|
||||
* @param string $passwd password
|
||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @param integer $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
*/
|
||||
@ -314,7 +314,7 @@ class DoliDBMysql extends DoliDB
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param Resultset $resultset Resultset of request
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_row($resultset)
|
||||
|
||||
@ -186,7 +186,7 @@ class DoliDBMysqli extends DoliDB
|
||||
* @param string $login login
|
||||
* @param string $passwd password
|
||||
* @param string $name name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @param integer $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
*/
|
||||
@ -317,7 +317,7 @@ class DoliDBMysqli extends DoliDB
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param Resultset $resultset Resultset of request
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_row($resultset)
|
||||
@ -716,7 +716,7 @@ class DoliDBMysqli extends DoliDB
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resultset Resultset x (x->Field, x->Type, ...)
|
||||
* @return resource Resultset x (x->Field, x->Type, ...)
|
||||
*/
|
||||
function DDLDescTable($table,$field="")
|
||||
{
|
||||
|
||||
@ -368,7 +368,7 @@ class DoliDBPgsql extends DoliDB
|
||||
* @param string $login Login
|
||||
* @param string $passwd Password
|
||||
* @param string $name Name of database (not used for mysql, used for pgsql)
|
||||
* @param string $port Port of database server
|
||||
* @param integer $port Port of database server
|
||||
* @return resource Database access handler
|
||||
* @see close
|
||||
*/
|
||||
@ -546,7 +546,7 @@ class DoliDBPgsql extends DoliDB
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param Resultset $resultset Resultset of request
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_array($resultset)
|
||||
@ -559,7 +559,7 @@ class DoliDBPgsql extends DoliDB
|
||||
/**
|
||||
* Return datas as an array
|
||||
*
|
||||
* @param Resultset $resultset Resultset of request
|
||||
* @param resource $resultset Resultset of request
|
||||
* @return array Array
|
||||
*/
|
||||
function fetch_row($resultset)
|
||||
@ -771,7 +771,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*
|
||||
* @param string $fieldorvalue Field name or value to encrypt
|
||||
* @param int $withQuotes Return string with quotes
|
||||
* @return return XXX(field) or XXX('value') or field or 'value'
|
||||
* @return string XXX(field) or XXX('value') or field or 'value'
|
||||
*/
|
||||
function encrypt($fieldorvalue, $withQuotes=0)
|
||||
{
|
||||
@ -1010,7 +1010,7 @@ class DoliDBPgsql extends DoliDB
|
||||
*
|
||||
* @param string $table Name of table
|
||||
* @param string $field Optionnel : Name of field if we want description of field
|
||||
* @return resultset Resultset x (x->attname)
|
||||
* @return resource Resultset x (x->attname)
|
||||
*/
|
||||
function DDLDescTable($table,$field="")
|
||||
{
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <alexandre.spangaro@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
|
||||
@ -20,8 +20,8 @@
|
||||
|
||||
/**
|
||||
* \file htdocs/core/lib/bank.lib.php
|
||||
* \ingroup bank
|
||||
* \brief Ensemble de fonctions de base pour le module banque
|
||||
* \ingroup banque
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -41,13 +41,6 @@ function bank_prepare_head(Account $object)
|
||||
$head[$h][2] = 'bankname';
|
||||
$h++;
|
||||
|
||||
if ($object->type == 0 || $object->type == 1) {
|
||||
$head[$h][0] = DOL_URL_ROOT . '/compta/bank/bankid_fr.php?id=' . $object->id;
|
||||
$head[$h][1] = $langs->trans("RIB");
|
||||
$head[$h][2] = 'bankid';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT . "/compta/bank/account.php?id=" . $object->id;
|
||||
$head[$h][1] = $langs->trans("Transactions");
|
||||
$head[$h][2] = 'journal';
|
||||
|
||||
@ -3926,9 +3926,7 @@ function dol_htmlcleanlastbr($stringtodecode)
|
||||
*/
|
||||
function dol_html_entity_decode($a,$b,$c='UTF-8')
|
||||
{
|
||||
// We use @ to avoid warning on PHP4 that does not support entity decoding to UTF8;
|
||||
$ret=@html_entity_decode($a,$b,$c);
|
||||
return $ret;
|
||||
return html_entity_decode($a,$b,$c);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -4946,34 +4944,64 @@ function dol_getmypid()
|
||||
|
||||
|
||||
/**
|
||||
* Natural search
|
||||
* Generate natural SQL search string
|
||||
*
|
||||
* @param mixed $fields String or array of strings filled with the fields names in the SQL query
|
||||
* @param string $value The value to look for (example: "keyword1 keyword2")
|
||||
* @return string $res The statement to append to the SQL query
|
||||
* @param string|string[] $fields String or array of strings, filled with the name of fields in the SQL query
|
||||
* @param string $value The value to look for.
|
||||
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
|
||||
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
|
||||
* @param string $number 0=value is list of keywords, 1=value is a numeric test
|
||||
* @return string $res The statement to append to the SQL query
|
||||
*/
|
||||
function natural_search($fields, $value)
|
||||
function natural_search($fields, $value, $numeric=0)
|
||||
{
|
||||
global $db;
|
||||
global $db,$langs;
|
||||
|
||||
if ($numeric)
|
||||
{
|
||||
$value=preg_replace('/([<>=]+)\s+([0-9'.preg_quote($langs->trans("DecimalSeparator"),'/').'\-])/','\1\2',$value); // Clean string '< 10' into '<10' so we can the explode on space to get all tests to do
|
||||
}
|
||||
$crits = explode(' ', $value);
|
||||
$res = '';
|
||||
if (! is_array($fields)) $fields = array($fields);
|
||||
|
||||
$end = count($fields);
|
||||
$nboffields = count($fields);
|
||||
$end2 = count($crits);
|
||||
$j = 0;
|
||||
foreach ($crits as $crit) {
|
||||
$i = 0;
|
||||
foreach ($fields as $field) {
|
||||
if ( $i > 0 && $i < $end) $res .= " OR ";
|
||||
$res .= $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
|
||||
foreach ($crits as $crit)
|
||||
{
|
||||
$i = 0; $i2 = 0;
|
||||
$newres = '';
|
||||
foreach ($fields as $field)
|
||||
{
|
||||
if ($numeric)
|
||||
{
|
||||
$operator='=';
|
||||
$newcrit = preg_replace('/([<>=]+)/','',trim($crit));
|
||||
|
||||
preg_match('/([<>=]+)/',trim($crit), $reg);
|
||||
if ($reg[1])
|
||||
{
|
||||
$operator = $reg[1];
|
||||
}
|
||||
if ($newcrit != '')
|
||||
{
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . ' '.$operator.' '.price2num($newcrit);
|
||||
$i2++; // a criteria was added to string
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$newres .= ($i2 > 0 ? ' OR ' : '') . $field . " LIKE '%" . $db->escape(trim($crit)) . "%'";
|
||||
$i2++; // a criteria was added to string
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if ($end > 1) $res .= ')';
|
||||
if ($j < $end2 - 1) $res .= " AND ";
|
||||
if ($end > 1 && $j < $end2 - 1) $res .= '(';
|
||||
if ($newres) $res = $res . ($res ? ' AND ' : '') . ($i2 > 1 ? '(' : '') .$newres . ($i2 > 1 ? ')' : '');
|
||||
$j++;
|
||||
}
|
||||
return " AND " . ($end > 1? '(' : '') . $res;
|
||||
$res = " AND (" . $res . ")";
|
||||
//print 'xx'.$res.'yy';
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
||||
@ -1549,6 +1549,9 @@ function dolGetElementUrl($objectid,$objecttype,$withpicto=0,$option='')
|
||||
if ($objecttype == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($objecttype == 'askpricesupplier') {
|
||||
$classpath = 'comm/askpricesupplier/class';
|
||||
}
|
||||
if ($objecttype == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
@ -1780,6 +1783,9 @@ function getElementProperties($element_type)
|
||||
if ($element_type == 'propal') {
|
||||
$classpath = 'comm/propal/class';
|
||||
}
|
||||
if ($element_type == 'askpricesupplier') {
|
||||
$classpath = 'comm/askpricesupplier/class';
|
||||
}
|
||||
if ($element_type == 'shipping') {
|
||||
$classpath = 'expedition/class';
|
||||
$subelement = 'expedition';
|
||||
|
||||
@ -269,7 +269,7 @@ function dol_json_decode($json, $assoc=false)
|
||||
/**
|
||||
* Return text according to type
|
||||
*
|
||||
* @param mixed $val Value to decode
|
||||
* @param string $val Value to decode
|
||||
* @return string Formated value
|
||||
*/
|
||||
function _unval($val)
|
||||
|
||||
@ -615,12 +615,12 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
$pdf->SetXY($curx, $cury);
|
||||
$pdf->MultiCell(100, 3, $outputlangs->transnoentities("BankAccountNumber").': ' . $outputlangs->convToOutputCharset($account->number), 0, 'L', 0);
|
||||
$cury+=3;
|
||||
|
||||
|
||||
if ($diffsizecontent <= 2) $cury+=1;
|
||||
}
|
||||
|
||||
$pdf->SetFont('','',$default_font_size - $diffsizecontent);
|
||||
|
||||
|
||||
if (empty($onlynumber) && ! empty($account->domiciliation))
|
||||
{
|
||||
$pdf->SetXY($curx, $cury);
|
||||
@ -631,8 +631,18 @@ function pdf_bank(&$pdf,$outputlangs,$curx,$cury,$account,$onlynumber=0,$default
|
||||
$tmpy=$pdf->getStringHeight(100, $val);
|
||||
$cury+=$tmpy;
|
||||
}
|
||||
|
||||
if (! empty($account->proprio))
|
||||
{
|
||||
$pdf->SetXY($curx, $cury);
|
||||
$val=$outputlangs->transnoentities("BankAccountOwner").': ' . $outputlangs->convToOutputCharset($account->proprio);
|
||||
$pdf->MultiCell(100, 3, $val, 0, 'L', 0);
|
||||
$tmpy=$pdf->getStringHeight(100, $val);
|
||||
$cury+=$tmpy;
|
||||
}
|
||||
|
||||
else if (! $usedetailedbban) $cury+=1;
|
||||
|
||||
|
||||
// Use correct name of bank id according to country
|
||||
$ibankey="IBANNumber";
|
||||
if ($account->getCountryCode() == 'IN') $ibankey="IFSC";
|
||||
|
||||
@ -177,15 +177,21 @@ function project_timesheet_prepare_head($mode)
|
||||
|
||||
$h = 0;
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerDay");
|
||||
$head[$h][2] = 'inputperday';
|
||||
$h++;
|
||||
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERDAY))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/perday.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerDay");
|
||||
$head[$h][2] = 'inputperday';
|
||||
$h++;
|
||||
}
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/pertime.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerTime");
|
||||
$head[$h][2] = 'inputpertime';
|
||||
$h++;
|
||||
if (empty($conf->global->PROJECT_DISABLE_TIMESHEET_PERTIME))
|
||||
{
|
||||
$head[$h][0] = DOL_URL_ROOT."/projet/activity/pertime.php".($mode?'?mode='.$mode:'');
|
||||
$head[$h][1] = $langs->trans("InputPerTime");
|
||||
$head[$h][2] = 'inputpertime';
|
||||
$h++;
|
||||
}
|
||||
|
||||
complete_head_from_modules($conf,$langs,null,$head,$h,'project_timesheet');
|
||||
|
||||
@ -234,10 +240,10 @@ function project_admin_prepare_head()
|
||||
/**
|
||||
* Show task lines with a particular parent
|
||||
*
|
||||
* @param string $inc Counter that count number of lines legitimate to show (for return)
|
||||
* @param int $parent Id of parent task to start
|
||||
* @param array $lines Array of all tasks
|
||||
* @param int $level Level of task
|
||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||
* @param string $parent Id of parent project to show (0 to show all)
|
||||
* @param Task[] $lines Array of lines
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||
* @param string $var Color
|
||||
* @param int $showproject Show project columns
|
||||
* @param int $taskrole Array of roles of user for each tasks
|
||||
@ -482,12 +488,12 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t
|
||||
/**
|
||||
* Output a task line into a pertime intput mode
|
||||
*
|
||||
* @param string $inc ?
|
||||
* @param string $parent ?
|
||||
* @param Task[] $lines ?
|
||||
* @param int $level ?
|
||||
* @param string $projectsrole ?
|
||||
* @param string $tasksrole ?
|
||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||
* @param string $parent Id of parent project to show (0 to show all)
|
||||
* @param Task[] $lines Array of lines
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||
* @param string $projectsrole Array of roles user has on project
|
||||
* @param string $tasksrole Array of roles user has on task
|
||||
* @param string $mine Show only task lines I am assigned to
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @return $inc
|
||||
@ -524,20 +530,22 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
// If we want all or we have a role on task, we show it
|
||||
if (empty($mine) || ! empty($tasksrole[$lines[$i]->id]))
|
||||
{
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
// Project
|
||||
print "<td>";
|
||||
$projectstatic->id=$lines[$i]->fk_project;
|
||||
$projectstatic->ref=$lines[$i]->projectref;
|
||||
$projectstatic->public=$lines[$i]->public;
|
||||
$projectstatic->label=$langs->transnoentitiesnoconv("YourRole").': '.$projectsrole[$lines[$i]->fk_project];
|
||||
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
|
||||
print "<tr ".$bc[$var].">\n";
|
||||
|
||||
// Project
|
||||
print "<td>";
|
||||
print $projectstatic->getNomUrl(1);
|
||||
print "</td>";
|
||||
|
||||
// Ref
|
||||
print '<td>';
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=($lines[$i]->ref?$lines[$i]->ref:$lines[$i]->id);
|
||||
print $taskstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
@ -547,10 +555,12 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
print $taskstatic->getNomUrl(0);
|
||||
print "<br>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
//print "<br>";
|
||||
//for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
print "</td>\n";
|
||||
|
||||
// Planned Workload
|
||||
@ -564,8 +574,9 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
// Time spent by everybody
|
||||
print '<td align="right">';
|
||||
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
|
||||
if ($lines[$i]->duration)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
|
||||
@ -575,6 +586,13 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
// Time spent by user
|
||||
print '<td align="right">';
|
||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
|
||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
$disabledproject=1;$disabledtask=1;
|
||||
//print "x".$lines[$i]->fk_project;
|
||||
//var_dump($lines[$i]);
|
||||
@ -592,11 +610,13 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
}
|
||||
|
||||
// Form to add new time
|
||||
print '<td class="nowrap" align="right">';
|
||||
print '<td class="nowrap" align="center">';
|
||||
$s='';
|
||||
$s.=$form->select_date('',$lines[$i]->id,0,0,2,"addtime",1,0,1,$disabledtask);
|
||||
$s.=' ';
|
||||
$s.=$form->select_duration($lines[$i]->id,'',$disabledtask,'text',0,1);
|
||||
$s.=$form->select_date('',$lines[$i]->id,1,1,2,"addtime",1,0,1,$disabledtask);
|
||||
print $s;
|
||||
print '</td><td align="right">';
|
||||
//$s.=' ';
|
||||
$s=$form->select_duration($lines[$i]->id.'duration','',$disabledtask,'text',0,1);
|
||||
$s.=' <input type="submit" class="button"'.($disabledtask?' disabled="disabled"':'').' value="'.$langs->trans("Add").'">';
|
||||
print $s;
|
||||
print '</td>';
|
||||
@ -628,12 +648,12 @@ function projectLinesPerTime(&$inc, $parent, $lines, &$level, &$projectsrole, &$
|
||||
/**
|
||||
* Output a task line into a perday intput mode
|
||||
*
|
||||
* @param string $inc ?
|
||||
* @param string $parent ?
|
||||
* @param Task[] $lines ?
|
||||
* @param int $level ?
|
||||
* @param string $projectsrole ?
|
||||
* @param string $tasksrole ?
|
||||
* @param string $inc Line number (start to 0, then increased by recursive call)
|
||||
* @param string $parent Id of parent project to show (0 to show all)
|
||||
* @param Task[] $lines Array of lines
|
||||
* @param int $level Level (start to 0, then increased/decrease by recursive call)
|
||||
* @param string $projectsrole Array of roles user has on project
|
||||
* @param string $tasksrole Array of roles user has on task
|
||||
* @param string $mine Show only task lines I am assigned to
|
||||
* @param int $restricteditformytask 0=No restriction, 1=Enable add time only if task is a task i am affected to
|
||||
* @return $inc
|
||||
@ -696,10 +716,12 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
$taskstatic->id=$lines[$i]->id;
|
||||
$taskstatic->ref=$lines[$i]->label;
|
||||
$taskstatic->date_start=$lines[$i]->date_start;
|
||||
$taskstatic->date_end=$lines[$i]->date_end;
|
||||
print $taskstatic->getNomUrl(0);
|
||||
print "<br>";
|
||||
for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
//print "<br>";
|
||||
//for ($k = 0 ; $k < $level ; $k++) print " ";
|
||||
//print get_date_range($lines[$i]->date_start,$lines[$i]->date_end,'',$langs,0);
|
||||
print "</td>\n";
|
||||
|
||||
// Planned Workload
|
||||
@ -713,9 +735,9 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
||||
print $formother->select_percent($lines[$i]->progress, $lines[$i]->id . 'progress');
|
||||
print '</td>';
|
||||
|
||||
// Time spent
|
||||
/*
|
||||
// Time spent by everybody
|
||||
print '<td align="right">';
|
||||
// $lines[$i]->duration is a denormalised field = summ of time spent by everybody for task. What we need is time consummed by user
|
||||
if ($lines[$i]->duration)
|
||||
{
|
||||
print '<a href="'.DOL_URL_ROOT.'/projet/tasks/time.php?id='.$lines[$i]->id.'">';
|
||||
@ -724,7 +746,13 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
||||
}
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
*/
|
||||
|
||||
// Time spent by user
|
||||
print '<td align="right">';
|
||||
$tmptimespent=$taskstatic->getSummaryOfTimeSpent();
|
||||
if ($tmptimespent['total_duration']) print convertSecondToTime($tmptimespent['total_duration'],'allhourmin');
|
||||
else print '--:--';
|
||||
print "</td>\n";
|
||||
|
||||
$disabledproject=1;$disabledtask=1;
|
||||
//print "x".$lines[$i]->fk_project;
|
||||
@ -750,7 +778,7 @@ function projectLinesPerDay(&$inc, $parent, $lines, &$level, &$projectsrole, &$t
|
||||
{
|
||||
$dayWorkLoad = 0;
|
||||
$tableCell ='<td align="center">';
|
||||
$tableCell.='<input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'">+';
|
||||
$tableCell.='<span class="timesheetalreadyrecorded"><input type="text" class="center" size="2" disabled="disabled" value="'.convertSecondToTime($dayWorkLoad,'allhourmin').'"></span>+';
|
||||
$tableCell.='<input type="text" class="center" size="2" id="task['.$inc.']['.$idw.']" name="task['.$lines[$i]->id.']['.$idw.']" value="" cols="2" maxlength="5"';
|
||||
$tableCell.=' onkeypress="return regexEvent(this,event,\'timeChar\')"';
|
||||
$tableCell.= 'onblur="regexEvent(this,event,\''.$modeinput.'\');updateTotal('.$idw.',\''.$modeinput.'\')" />';
|
||||
@ -927,7 +955,8 @@ function print_projecttasks_array($db, $socid, $projectsListId, $mytasks=0, $sta
|
||||
|
||||
print "</table>";
|
||||
|
||||
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE)) {
|
||||
if (!empty($conf->global->PROJECT_LIMIT_YEAR_RANGE))
|
||||
{
|
||||
//Add the year filter input
|
||||
print '<table width="100%">';
|
||||
print '<tr>';
|
||||
|
||||
@ -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 integer $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 AskPriceSupplier $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);
|
||||
}
|
||||
|
||||
@ -264,6 +264,29 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
if ($desc_incoterms)
|
||||
{
|
||||
$tab_top = 88;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_incoterms=$nexY-$tab_top;
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
|
||||
|
||||
$tab_top = $nexY+6;
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
}
|
||||
|
||||
// Affiche notes
|
||||
$notetoshow=empty($object->note_public)?'':$object->note_public;
|
||||
if (! empty($conf->global->MAIN_ADD_SALE_REP_SIGNATURE_IN_NOTE))
|
||||
@ -279,7 +302,7 @@ class pdf_einstein extends ModelePDFCommandes
|
||||
}
|
||||
if ($notetoshow)
|
||||
{
|
||||
$tab_top = 88;
|
||||
$tab_top = 88 + $height_incoterms;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top, dol_htmlentitiesbr($notetoshow), 0, 1);
|
||||
|
||||
@ -121,7 +121,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc->code_client,$object->date);
|
||||
$numFinal=get_next_value($db,$mask,'commande','ref','',$objsoc,$object->date);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ abstract class ModelePDFCommandes extends CommonDocGenerator
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
@ -153,7 +153,7 @@ abstract class ModeleNumRefCommandes
|
||||
* Create a document onto disk accordign to template module.
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Object $object Object order
|
||||
* @param Commande $object Object order
|
||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||
* @param int $hidedetails Hide details of lines
|
||||
|
||||
@ -112,7 +112,7 @@ class mod_contract_magre extends ModelNumRefContracts
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'contrat','ref','',$objsoc->code_client,$contract->date_contrat);
|
||||
$numFinal=get_next_value($db,$mask,'contrat','ref','',$objsoc,$contract->date_contrat);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ abstract class ModelePDFContract extends CommonDocGenerator
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
@ -148,7 +148,7 @@ class ModelNumRefContracts
|
||||
* Create a contract document on disk using template defined into CONTRACT_ADDON_PDF
|
||||
*
|
||||
* @param DoliDB $db objet base de donnee
|
||||
* @param Object $object Object contract
|
||||
* @param Contrat $object Object contract
|
||||
* @param string $modele force le modele a utiliser ('' par defaut)
|
||||
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||
* @param int $hidedetails Hide details of lines
|
||||
|
||||
@ -40,7 +40,7 @@ abstract class ModeleDon extends CommonDocGenerator
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
|
||||
@ -191,9 +191,32 @@ class pdf_rouget extends ModelePdfExpedition
|
||||
$tab_height = 130;
|
||||
$tab_height_newpage = 150;
|
||||
|
||||
// Incoterm
|
||||
$height_incoterms = 0;
|
||||
if ($conf->incoterm->enabled)
|
||||
{
|
||||
$desc_incoterms = $object->getIncotermsForPDF();
|
||||
if ($desc_incoterms)
|
||||
{
|
||||
$tab_top = 88;
|
||||
|
||||
$pdf->SetFont('','', $default_font_size - 1);
|
||||
$pdf->writeHTMLCell(190, 3, $this->posxdesc-1, $tab_top-1, dol_htmlentitiesbr($desc_incoterms), 0, 1);
|
||||
$nexY = $pdf->GetY();
|
||||
$height_incoterms=$nexY-$tab_top;
|
||||
|
||||
// Rect prend une longueur en 3eme param
|
||||
$pdf->SetDrawColor(192,192,192);
|
||||
$pdf->Rect($this->marge_gauche, $tab_top-1, $this->page_largeur-$this->marge_gauche-$this->marge_droite, $height_incoterms+1);
|
||||
|
||||
$tab_top = $nexY+6;
|
||||
$height_incoterms += 4;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($object->note_public) || ! empty($object->tracking_number))
|
||||
{
|
||||
$tab_top = 88;
|
||||
$tab_top = 88 + $height_incoterms;
|
||||
$tab_top_alt = $tab_top;
|
||||
|
||||
$pdf->SetFont('','B', $default_font_size - 2);
|
||||
|
||||
@ -43,7 +43,7 @@ abstract class ModelePdfExpedition extends CommonDocGenerator
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
@ -146,7 +146,7 @@ abstract class ModelNumRefExpedition
|
||||
* Cree un bon d'expedition sur disque
|
||||
*
|
||||
* @param DoliDB $db Objet base de donnee
|
||||
* @param Object $object Object expedition
|
||||
* @param Expedition $object Object expedition
|
||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||
* @param Translate $outputlangs Objet lang a utiliser pour traduction
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
|
||||
@ -30,7 +30,7 @@ class ModeleExpenseReport extends CommonDocGenerator
|
||||
* Return list of active generation modules
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param string $maxfilenamelength Max length of value to show
|
||||
* @param integer $maxfilenamelength Max length of value to show
|
||||
* @return array List of templates
|
||||
*/
|
||||
static function liste_modeles($db,$maxfilenamelength=0)
|
||||
@ -52,7 +52,7 @@ class ModeleExpenseReport extends CommonDocGenerator
|
||||
* expensereport_pdf_create
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
* @param Object $object Object order
|
||||
* @param ExpenseReport $object Object order
|
||||
* @param string $message Message
|
||||
* @param string $modele Force le modele a utiliser ('' to not force)
|
||||
* @param Translate $outputlangs objet lang a utiliser pour traduction
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user