mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-14 08:54:21 +01:00
Merge remote-tracking branch 'Dolibarr/develop' into develop
This commit is contained in:
51
.travis.yml
51
.travis.yml
@@ -207,8 +207,7 @@ before_script:
|
||||
mysql -D travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
fi
|
||||
if [ "$DB" = 'postgresql' ]; then
|
||||
#pgsql travis < dev/initdemo/mysqldump_dolibarr_3.5.0.sql
|
||||
#pgloader mysql://root:pass@127.0.0.1/base postgresql://dolibarrowner@127.0.0.1/dolibarr
|
||||
#pgloader mysql://root:pass@127.0.0.1/dolibarr_35 postgresql://dolibarrowner:dolibarrownerpass@127.0.0.1/dolibarr_dev
|
||||
pgloader mysql://root@127.0.0.1/travis postgresql:///travis
|
||||
fi
|
||||
# TODO: SQLite
|
||||
@@ -238,8 +237,9 @@ before_script:
|
||||
- |
|
||||
echo "Create documents directory and set permissions"
|
||||
# and admin/temp subdirectory needed for unit tests
|
||||
mkdir -p documents/admin/temp
|
||||
echo "first line" > documents/dolibarr.log
|
||||
mkdir -p $TRAVIS_BUILD_DIR/documents/admin/temp
|
||||
sudo chmod -R a+rwx $TRAVIS_BUILD_DIR/documents
|
||||
echo "***** First line of dolibarr.log" > $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
echo
|
||||
|
||||
|
||||
@@ -334,32 +334,28 @@ script:
|
||||
php upgrade.php 7.0.0 8.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade700800.log
|
||||
php upgrade2.php 7.0.0 8.0.0 MAIN_MODULE_TICKETSUP > $TRAVIS_BUILD_DIR/upgrade700800-2.log
|
||||
php step5.php 7.0.0 8.0.0 > $TRAVIS_BUILD_DIR/upgrade700800-3.log
|
||||
php upgrade.php 8.0.0 9.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade800900.log
|
||||
php upgrade2.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-2.log
|
||||
php step5.php 8.0.0 9.0.0 > $TRAVIS_BUILD_DIR/upgrade800900-3.log
|
||||
cd -
|
||||
set +e
|
||||
echo
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade400500-2.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600-2.log
|
||||
#cat $TRAVIS_BUILD_DIR/upgrade500600-3.log
|
||||
#cat /tmp/dolibarr_install.log
|
||||
|
||||
|
||||
- |
|
||||
echo "Unit testing"
|
||||
# Ensure we catch errors. Set this to +e if you want to go to the end to see dolibarr.log file.
|
||||
set -e
|
||||
phpunit -d memory_limit=-1 -c test/phpunit/phpunittest.xml test/phpunit/AllTests.php
|
||||
phpunitresult=$?
|
||||
echo "Phpunit return code = $phpunitresult"
|
||||
set +e
|
||||
|
||||
- |
|
||||
#echo "Output dolibarr.log"
|
||||
#cat documents/dolibarr.log
|
||||
|
||||
after_script:
|
||||
- |
|
||||
# Dolibarr log file
|
||||
#echo "After script"
|
||||
#cat documents/dolibarr.log
|
||||
|
||||
echo "After script - Output 50 latest lines of dolibarr.log"
|
||||
ls $TRAVIS_BUILD_DIR/documents
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
|
||||
after_success:
|
||||
- |
|
||||
@@ -367,19 +363,24 @@ after_success:
|
||||
|
||||
after_failure:
|
||||
- |
|
||||
echo Failure
|
||||
# This part of code seems to be never executed, error or not ???
|
||||
echo "Debugging informations"
|
||||
echo Failure detected, so we show samples of log to help diagnose
|
||||
# This part of code is executed only if previous commande that fails are enclosed with set +e
|
||||
# Upgrade log files
|
||||
cat *.log
|
||||
echo "Debugging informations"
|
||||
for ficlog in `ls $TRAVIS_BUILD_DIR/*.log`
|
||||
do
|
||||
echo "Debugging informations for file $ficlog"
|
||||
#cat $ficlog
|
||||
done
|
||||
# Apache log file
|
||||
echo "Debugging informations for file apache error.log"
|
||||
sudo cat /var/log/apache2/error.log
|
||||
# Dolibarr log file
|
||||
cat documents/dolibarr.log
|
||||
if [ "$DEBUG" = true ]; then
|
||||
# Dolibarr log file
|
||||
echo "Debugging informations for file dolibarr.log (latest 50 lines)"
|
||||
tail -n 50 $TRAVIS_BUILD_DIR/documents/dolibarr.log
|
||||
# MariaDB log file
|
||||
sudo cat /var/log/mysql/error.log
|
||||
echo "Debugging informations for file mysql error.log"
|
||||
sudo tail -n 50 /var/log/mysql/error.log
|
||||
# TODO: PostgreSQL log file
|
||||
echo
|
||||
fi
|
||||
|
||||
47
ChangeLog
47
ChangeLog
@@ -2,6 +2,28 @@
|
||||
English Dolibarr ChangeLog
|
||||
--------------------------------------------------------------
|
||||
|
||||
***** ChangeLog for 8.0.0 compared to 7.0.3 *****
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Remove old deprecated hook 'insertExtraFields'. Triggers must be used for action on CRUD events.
|
||||
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
|
||||
'doaction' into 'sendMail'.
|
||||
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
|
||||
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
|
||||
* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
|
||||
a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
|
||||
* PHP 5.3 is no more supported. Minimum PHP is now 5.4+
|
||||
* Remove the old deprecated code of doActions and getInstanceDao in canvas. The doActions of standard hooks are
|
||||
already available and are better.
|
||||
* Removed method fetch_prods() and get_each_prod() not used, keep only get_arbo_each_prod() that is better.
|
||||
* The hook contaxt commcard has been renamed thirdpartycomm
|
||||
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
||||
* Remove method Categorie:get_nb_categories() that was not used.
|
||||
* Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip
|
||||
are now replaced with hook getNomUrl.
|
||||
|
||||
***** ChangeLog for 7.0.3 compared to 7.0.2 *****
|
||||
FIX: 7.0 task contact card without withproject parameters
|
||||
FIX: #8722
|
||||
@@ -40,29 +62,6 @@ FIX: supplier order: product supplier ref not saved on addline
|
||||
FIX: test is_erasable() must be done before call function delete() too to avoid delete invoice with &action=delete in url
|
||||
FIX: wrong var name $search_month_lim
|
||||
|
||||
***** ChangeLog for 8.0.0 compared to 7.0.0 *****
|
||||
|
||||
WARNING:
|
||||
|
||||
Following changes may create regressions for some external modules, but were necessary to make Dolibarr better:
|
||||
* Remove old deprecated hook 'insertExtraFields'. Triggers must be used for action on CRUD events.
|
||||
* Hook 'maildao' was renamed into 'mail' into the method sendfile that send emails, and method was renamed from
|
||||
'doaction' into 'sendMail'.
|
||||
* Rename trigger CONTRACT_SERVICE_ACTIVATE into LINECONTRACT_ACTIVATE and
|
||||
CONTRACT_SERVICE_CLOSE into LINECONTRACT_CLOSE
|
||||
* Remove triggers *_CLONE. The trigger CREATE with context 'createfromclone' is already called so this is
|
||||
a duplicated feature. Cloning is not a business event, the business event is CREATE, so no trigger required.
|
||||
* PHP 5.3 is no more supported. Minimum PHP is now 5.4+
|
||||
* Remove the old deprecated code of doActions and getInstanceDao in canvas. The doActions of standard hooks are
|
||||
already available and are better.
|
||||
* Removed method fetch_prods() and get_each_prod() not used, keep only get_arbo_each_prod() that is better.
|
||||
* The hook contaxt commcard has been renamed thirdpartycomm
|
||||
* The hook contaxt thirdpartycard has been renamed thirdpartycontact
|
||||
* Remove method Categorie:get_nb_categories() that was not used.
|
||||
* Hook getnomurltooltip provide a duplicate feature compared to hook getNomUrl so all hooks getnomurltooltip
|
||||
are now replaced with hook getNomUrl.
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.2 compared to 7.0.1 *****
|
||||
FIX: #8023
|
||||
FIX: #8259 can't update contact birthday with REST API
|
||||
@@ -220,7 +219,7 @@ FIX: Use of undefined constant _ROWS_2
|
||||
FIX: warning when adding ECM files using old photo path
|
||||
|
||||
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.5 *****
|
||||
***** ChangeLog for 7.0.0 compared to 6.0.7 *****
|
||||
For users:
|
||||
NEW: Add a preview icon after files that can be previewed (pdf + images)
|
||||
NEW: When payment is registered, PDF of invoices are also regenerated so payments
|
||||
|
||||
@@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -82,7 +82,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -261,7 +261,7 @@ $tabfield[10]= "country_id,country,code,taux,localtax1_type,localtax1,localtax2_
|
||||
$tabfield[11]= "element,source,code,libelle,position";
|
||||
$tabfield[12]= "code,libelle,libelle_facture,nbjour,type_cdr,decalage,sortorder,entity";
|
||||
$tabfield[13]= "code,libelle,type,entity";
|
||||
$tabfield[14]= "code,label,price,organization,country_id,country";
|
||||
$tabfield[14]= "code,label,price,organization,country";
|
||||
$tabfield[15]= "code,libelle,width,height,unit";
|
||||
$tabfield[16]= "code,libelle,sortorder";
|
||||
$tabfield[17]= "code,label,accountancy_code";
|
||||
|
||||
@@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -88,7 +88,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -83,7 +83,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
521
htdocs/admin/holiday.php
Normal file
521
htdocs/admin/holiday.php
Normal file
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/admin/contract.php
|
||||
* \ingroup contract
|
||||
* \brief Setup page of module Contracts
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/holiday.lib.php';
|
||||
|
||||
$langs->load("admin");
|
||||
$langs->load("errors");
|
||||
$langs->load("holiday");
|
||||
|
||||
if (!$user->admin) accessforbidden();
|
||||
|
||||
$action = GETPOST('action','alpha');
|
||||
$value = GETPOST('value','alpha');
|
||||
$label = GETPOST('label','alpha');
|
||||
$scandir = GETPOST('scan_dir','alpha');
|
||||
$type='contract';
|
||||
|
||||
if (empty($conf->global->HOLIDAY_ADDON))
|
||||
{
|
||||
$conf->global->HOLIDAY_ADDON='mod_holiday_madona';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask')
|
||||
{
|
||||
$maskconst = GETPOST('maskconstholidaty','alpha');
|
||||
$maskvalue = GETPOST('maskholiday','alpha');
|
||||
if ($maskconst) $res = dolibarr_set_const($db,$maskconst,$maskvalue,'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'specimen') // For contract
|
||||
{
|
||||
$modele= GETPOST('module','alpha');
|
||||
|
||||
$contract = new Contrat($db);
|
||||
$contract->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/holiday/doc/pdf_".$modele.".modules.php",0);
|
||||
if (file_exists($file))
|
||||
{
|
||||
$filefound=1;
|
||||
$classname = "pdf_".$modele;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($filefound)
|
||||
{
|
||||
require_once $file;
|
||||
|
||||
$module = new $classname($db);
|
||||
|
||||
if ($module->write_file($contract,$langs) > 0)
|
||||
{
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=holiday&file=SPECIMEN.pdf");
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($obj->error, $obj->errors, 'errors');
|
||||
dol_syslog($obj->error, LOG_ERR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
// Activate a model
|
||||
else if ($action == 'set')
|
||||
{
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
|
||||
else if ($action == 'del')
|
||||
{
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0)
|
||||
{
|
||||
if ($conf->global->HOLIDAY_ADDON_PDF == "$value") dolibarr_del_const($db, 'HOLIDAY_ADDON_PDF',$conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
// Set default model
|
||||
else if ($action == 'setdoc')
|
||||
{
|
||||
if (dolibarr_set_const($db, "HOLIDAY_ADDON_PDF",$value,'chaine',0,'',$conf->entity))
|
||||
{
|
||||
// La constante qui a ete lue en avant du nouveau set
|
||||
// on passe donc par une variable pour avoir un affichage coherent
|
||||
$conf->global->HOLIDAY_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, "HOLIDAY_ADDON",$value,'chaine',0,'',$conf->entity);
|
||||
}
|
||||
|
||||
else if ($action == 'set_other')
|
||||
{
|
||||
$freetext= GETPOST('HOLIDAY_FREE_TEXT','none'); // No alpha here, we want exact string
|
||||
$res1 = dolibarr_set_const($db, "HOLIDAY_FREE_TEXT",$freetext,'chaine',0,'',$conf->entity);
|
||||
|
||||
$draft= GETPOST('HOLIDAY_DRAFT_WATERMARK','alpha');
|
||||
$res2 = dolibarr_set_const($db, "HOLIDAY_DRAFT_WATERMARK",trim($draft),'chaine',0,'',$conf->entity);
|
||||
|
||||
if (! $res1 > 0 || ! $res2 > 0) $error++;
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
}
|
||||
else
|
||||
{
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$dirmodels=array_merge(array('/'),(array) $conf->modules_parts['models']);
|
||||
|
||||
llxHeader();
|
||||
|
||||
$form=new Form($db);
|
||||
|
||||
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
||||
print load_fiche_titre($langs->trans("HolidaySetup"),$linkback,'title_setup');
|
||||
|
||||
$head=holiday_admin_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'holiday', $langs->trans("Holidays"), -1, 'holiday');
|
||||
|
||||
/*
|
||||
* Holiday Numbering model
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("HolidaysNumberingModules"),'','');
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="100">'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td>'.$langs->trans("Example").'</td>';
|
||||
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/holiday/");
|
||||
|
||||
if (is_dir($dir))
|
||||
{
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
$var=true;
|
||||
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (substr($file, 0, 12) == 'mod_holiday_' && substr($file, dol_strlen($file)-3, 3) == 'php')
|
||||
{
|
||||
$file = substr($file, 0, dol_strlen($file)-4);
|
||||
|
||||
require_once $dir.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
|
||||
// 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())
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->nom."</td><td>\n";
|
||||
print $module->info();
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp=$module->getExample();
|
||||
if (preg_match('/^Error/',$tmp)) { $langs->load("errors"); 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->HOLIDAY_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>';
|
||||
|
||||
$holiday=new Holiday($db);
|
||||
$holiday->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip='';
|
||||
$htmltooltip.=''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
$nextval=$module->getNextValue($mysoc,$contract);
|
||||
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>';
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
/*
|
||||
* Documents models for Contracts
|
||||
*/
|
||||
|
||||
print load_fiche_titre($langs->trans("TemplatePDFHolidays"),'','');
|
||||
|
||||
// Defini tableau def des modeles
|
||||
$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%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td align="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td align="center" width="80">'.$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/holiday".$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 class="oddeven"><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.'&scan_dir='.$module->scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Defaut
|
||||
print '<td align="center">';
|
||||
if ($conf->global->HOLIDAY_ADDON_PDF == $name)
|
||||
{
|
||||
print img_picto($langs->trans("Default"),'on');
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&scan_dir='.$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("WatermarkOnDraftOrders").': '.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"),'contract').'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print img_object($langs->trans("PreviewNotAvailable"),'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
print "<br>";
|
||||
|
||||
/*
|
||||
* Other options
|
||||
*
|
||||
*/
|
||||
|
||||
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_other">';
|
||||
|
||||
print load_fiche_titre($langs->trans("OtherOptions"),'','');
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Parameter").'</td>';
|
||||
print '<td align="center" width="60">'.$langs->trans("Value").'</td>';
|
||||
print "</tr>\n";
|
||||
$var=true;
|
||||
|
||||
$substitutionarray=pdf_getSubstitutionArray($langs, array('objectamount'), null, 2);
|
||||
$substitutionarray['__(AnyTranslationKey)__']=$langs->trans("Translation");
|
||||
$htmltext = '<i>'.$langs->trans("AvailableVariables").':<br>';
|
||||
foreach($substitutionarray as $key => $val) $htmltext.=$key.'<br>';
|
||||
$htmltext.='</i>';
|
||||
|
||||
$var=! $var;
|
||||
print '<tr class="oddeven"><td colspan="2">';
|
||||
print $form->textwithpicto($langs->trans("FreeLegalTextOnHolidays"), $langs->trans("AddCRIfTooLong").'<br><br>'.$htmltext, 1, 'help', '', 0, 2, 'tooltiphelp');
|
||||
print '<br>';
|
||||
$variablename='HOLIDAY_FREE_TEXT';
|
||||
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
|
||||
{
|
||||
print '<textarea name="'.$variablename.'" class="flat" cols="120">'.$conf->global->$variablename.'</textarea>';
|
||||
}
|
||||
else
|
||||
{
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($variablename, $conf->global->$variablename,'',80,'dolibarr_notes');
|
||||
print $doleditor->Create();
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
//Use draft Watermark
|
||||
|
||||
print '<tr class="oddeven"><td>';
|
||||
print $form->textwithpicto($langs->trans("WatermarkOnDraftHolidayCards"), $htmltext, 1, 'help', '', 0, 2, 'watermarktooltip').'<br>';
|
||||
print '</td><td>';
|
||||
print '<input size="50" class="flat" type="text" name="HOLIDAY_DRAFT_WATERMARK" value="'.$conf->global->HOLIDAY_DRAFT_WATERMARK.'">';
|
||||
print '</td></tr>'."\n";
|
||||
|
||||
print '</table>';
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("Save").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -88,7 +88,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
*
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@@ -637,6 +638,7 @@ if ($mode == 'common')
|
||||
}
|
||||
|
||||
print '<tr class="oddeven">'."\n";
|
||||
if (!empty($conf->global->MAIN_MODULES_SHOW_LINENUMBERS)) print '<td width="20px">'.++$linenum.'</td>';
|
||||
|
||||
// Picto + Name of module
|
||||
print ' <td width="200px">';
|
||||
@@ -669,6 +671,17 @@ if ($mode == 'common')
|
||||
// Version
|
||||
print '<td class="center nowrap" width="120px">';
|
||||
print $versiontrans;
|
||||
if(!empty($conf->global->CHECKLASTVERSION_EXTERNALMODULE)){
|
||||
require_once(DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php');
|
||||
if (!empty($objMod->url_last_version)) {
|
||||
$newversion = getURLContent($objMod->url_last_version);
|
||||
if(isset($newversion['content'])){
|
||||
if (version_compare($newversion['content'], $versiontrans) > 0) {
|
||||
print " <span class='butAction' title='" . $langs->trans('LastStableVersion') . "'>".$newversion['content']."</span>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</td>\n";
|
||||
|
||||
// Activate/Disable and Setup (2 columns)
|
||||
|
||||
@@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -80,6 +80,16 @@ if ($action == "set")
|
||||
$res = dolibarr_set_const($db, "PRELEVEMENT_USER", GETPOST("PRELEVEMENT_USER"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_END_TO_END") || GETPOST("PRELEVEMENT_END_TO_END")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "END_TO_END", GETPOST("PRELEVEMENT_END_TO_END"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
if (GETPOST("PRELEVEMENT_USTRD") || GETPOST("PRELEVEMENT_USTRD")=="")
|
||||
{
|
||||
$res = dolibarr_set_const($db, "USTRD", GETPOST("PRELEVEMENT_USTRD"),'chaine',0,'',$conf->entity);
|
||||
if (! $res > 0) $error++;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@@ -221,6 +231,18 @@ print $form->select_dolusers($conf->global->PRELEVEMENT_USER, 'PRELEVEMENT_USER'
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
//EntToEnd
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("END_TO_END").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_END_TO_END" value="'.$conf->global->END_TO_END.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
//USTRD
|
||||
print '<tr class="pair"><td class="fieldrequired">'.$langs->trans("USTRD").'</td>';
|
||||
print '<td align="left">';
|
||||
print '<input type="text" name="PRELEVEMENT_USTRD" value="'.$conf->global->USTRD.'" size="15" ></td>';
|
||||
print '</td></tr>';
|
||||
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -91,7 +91,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -87,7 +87,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -85,7 +85,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -39,7 +39,7 @@ $action = GETPOST('action', 'alpha');
|
||||
*/
|
||||
if (preg_match('/set(.*)/',$action,$reg))
|
||||
{
|
||||
if (! dolibarr_set_const($db, $reg[1], 1, 'chaine', 0, '', $conf->entity) > 0)
|
||||
if (! dolibarr_set_const($db, $reg[1], '1', 'chaine', 0, '', $conf->entity) > 0)
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
@@ -75,14 +75,12 @@ $workflowcodes=array(
|
||||
'WORKFLOW_PROPAL_AUTOCREATE_ORDER'=>array('family'=>'create', 'position'=>10, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
'WORKFLOW_ORDER_AUTOCREATE_INVOICE'=>array('family'=>'create', 'position'=>20, 'enabled'=>'! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'bill'),
|
||||
'separator1'=>array('family'=>'separator', 'position'=>25),
|
||||
// Automatic classification proposal
|
||||
// Automatic classification of proposal
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>30, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
'WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL'=>array('family'=>'classify_proposal', 'position'=>31, 'enabled'=>'! empty($conf->propal->enabled) && ! empty($conf->facture->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
// Automatic classification invoice
|
||||
// Automatic classification of order
|
||||
'WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING'=>array('family'=>'classify_order', 'position'=>40, 'enabled'=>'! empty($conf->expedition->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order'),
|
||||
// For the following 2 options, if module invoice is disabled, they does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||
//Moved as hidden feature: 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>42, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''),
|
||||
'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER'=>array('family'=>'classify_order', 'position'=>41, 'enabled'=>'! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto'=>'order','warning'=>''), // For this option, if module invoice is disabled, it does not exists, so "Classify billed" for order must be done manually from order card.
|
||||
'separator2'=>array('family'=>'separator', 'position'=>50),
|
||||
// Automatic classification supplier proposal
|
||||
'WORKFLOW_ORDER_CLASSIFY_BILLED_SUPPLIER_PROPOSAL'=>array('family'=>'classify_supplier_proposal', 'position'=>60, 'enabled'=>'! empty($conf->supplier_proposal->enabled) && ! empty($conf->fournisseur->enabled)', 'picto'=>'propal','warning'=>''),
|
||||
|
||||
@@ -218,13 +218,6 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
|
||||
if ($action == 'xxx')
|
||||
{
|
||||
$formquestion=array();
|
||||
/*
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
// array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
}*/
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -86,7 +86,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -99,7 +99,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -108,9 +108,21 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||
$hookmanager->initHooks(array('propalcard','globalcard'));
|
||||
|
||||
$permissionnote = $user->rights->propale->creer; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink=$user->rights->propale->creer; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $user->rights->propale->creer; // Used by the include of actions_lineupdown.inc.php
|
||||
$usercanread = $user->rights->propal->lire;
|
||||
$usercancreate = $user->rights->propal->creer;
|
||||
$usercanclose = $user->rights->propal->cloturer;
|
||||
$usercandelete = $user->rights->propal->supprimer;
|
||||
$usercanvalidate = ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)));
|
||||
$usercansend = (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send);
|
||||
|
||||
$usercancreateorder = $user->rights->commande->creer;
|
||||
$usercancreateinvoice = $user->rights->facture->creer;
|
||||
$usercancreatecontract = $user->rights->contrat->creer;
|
||||
$usercancreateintervention = $user->rights->ficheinter->creer;
|
||||
|
||||
$permissionnote = $usercancreate; // Used by the include of actions_setnotes.inc.php
|
||||
$permissiondellink = $usercancreate; // Used by the include of actions_dellink.inc.php
|
||||
$permissiontoedit = $usercancreate; // Used by the include of actions_lineupdown.inc.php
|
||||
|
||||
|
||||
/*
|
||||
@@ -140,7 +152,7 @@ if (empty($reshook))
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once
|
||||
|
||||
// Action clone object
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes')
|
||||
if ($action == 'confirm_clone' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
if (! GETPOST('socid', 3))
|
||||
{
|
||||
@@ -191,7 +203,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Delete proposal
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->propal->supprimer)
|
||||
else if ($action == 'confirm_delete' && $confirm == 'yes' && $usercandelete)
|
||||
{
|
||||
$result = $object->delete($user);
|
||||
if ($result > 0) {
|
||||
@@ -204,7 +216,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Remove line
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $user->rights->propal->creer)
|
||||
else if ($action == 'confirm_deleteline' && $confirm == 'yes' && $usercancreate)
|
||||
{
|
||||
$result = $object->deleteline($lineid);
|
||||
// reorder lines
|
||||
@@ -228,10 +240,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Validation
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
)
|
||||
else if ($action == 'confirm_validate' && $confirm == 'yes' && $usercanvalidate)
|
||||
{
|
||||
$result = $object->valid($user);
|
||||
if ($result >= 0)
|
||||
@@ -258,7 +267,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'setdate' && $user->rights->propal->creer)
|
||||
else if ($action == 'setdate' && $usercancreate)
|
||||
{
|
||||
$datep = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
|
||||
|
||||
@@ -273,13 +282,13 @@ if (empty($reshook))
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
}
|
||||
else if ($action == 'setecheance' && $user->rights->propal->creer)
|
||||
else if ($action == 'setecheance' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_echeance($user, dol_mktime(12, 0, 0, $_POST['echmonth'], $_POST['echday'], $_POST['echyear']));
|
||||
if ($result < 0)
|
||||
dol_print_error($db, $object->error);
|
||||
}
|
||||
else if ($action == 'setdate_livraison' && $user->rights->propal->creer)
|
||||
else if ($action == 'setdate_livraison' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_date_livraison($user, dol_mktime(12, 0, 0, $_POST['date_livraisonmonth'], $_POST['date_livraisonday'], $_POST['date_livraisonyear']));
|
||||
if ($result < 0)
|
||||
@@ -287,7 +296,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Positionne ref client
|
||||
else if ($action == 'setref_client' && $user->rights->propal->creer)
|
||||
else if ($action == 'setref_client' && $usercancreate)
|
||||
{
|
||||
$result = $object->set_ref_client($user, GETPOST('ref_client'));
|
||||
if ($result < 0)
|
||||
@@ -297,13 +306,13 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Set incoterm
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled))
|
||||
elseif ($action == 'set_incoterms' && !empty($conf->incoterm->enabled) && $usercancreate)
|
||||
{
|
||||
$result = $object->setIncoterms(GETPOST('incoterm_id', 'int'), GETPOST('location_incoterms', 'alpha'));
|
||||
}
|
||||
|
||||
// Create proposal
|
||||
else if ($action == 'add' && $user->rights->propal->creer)
|
||||
else if ($action == 'add' && $usercancreate)
|
||||
{
|
||||
$object->socid = $socid;
|
||||
$object->fetch_thirdparty();
|
||||
@@ -597,7 +606,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Classify billed
|
||||
else if ($action == 'classifybilled' && $user->rights->propal->cloturer)
|
||||
else if ($action == 'classifybilled' && $usercanclose)
|
||||
{
|
||||
$result=$object->cloture($user, 4, '');
|
||||
if ($result < 0)
|
||||
@@ -608,7 +617,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Close proposal
|
||||
else if ($action == 'setstatut' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||
else if ($action == 'setstatut' && $usercanclose && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
if (! (GETPOST('statut','int') > 0)) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("CloseAs")), null, 'errors');
|
||||
@@ -628,7 +637,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Reopen proposal
|
||||
else if ($action == 'confirm_reopen' && $user->rights->propal->cloturer && ! GETPOST('cancel','alpha'))
|
||||
else if ($action == 'confirm_reopen' && $usercanclose && ! GETPOST('cancel','alpha'))
|
||||
{
|
||||
// prevent browser refresh from reopening proposal several times
|
||||
if ($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED)
|
||||
@@ -653,7 +662,7 @@ if (empty($reshook))
|
||||
|
||||
|
||||
// Go back to draft
|
||||
if ($action == 'modif' && $user->rights->propal->creer)
|
||||
if ($action == 'modif' && $usercancreate)
|
||||
{
|
||||
$object->set_draft($user);
|
||||
|
||||
@@ -671,7 +680,7 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == "setabsolutediscount" && $user->rights->propal->creer) {
|
||||
else if ($action == "setabsolutediscount" && $usercancreate) {
|
||||
if ($_POST["remise_id"]) {
|
||||
if ($object->id > 0) {
|
||||
$result = $object->insert_discount($_POST["remise_id"]);
|
||||
@@ -683,7 +692,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Add line
|
||||
else if ($action == 'addline' && $user->rights->propal->creer) {
|
||||
else if ($action == 'addline' && $usercancreate) {
|
||||
|
||||
// Set if we used free entry or predefined product
|
||||
$predef='';
|
||||
@@ -1046,7 +1055,7 @@ if (empty($reshook))
|
||||
}
|
||||
|
||||
// Update a line within proposal
|
||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('save'))
|
||||
else if ($action == 'updateligne' && $usercancreate && GETPOST('save'))
|
||||
{
|
||||
// Define info_bits
|
||||
$info_bits = 0;
|
||||
@@ -1183,62 +1192,62 @@ if (empty($reshook))
|
||||
}
|
||||
}
|
||||
|
||||
else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('cancel','alpha'))
|
||||
else if ($action == 'updateligne' && $usercancreate && GETPOST('cancel','alpha'))
|
||||
{
|
||||
header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition
|
||||
exit();
|
||||
}
|
||||
|
||||
// Set project
|
||||
else if ($action == 'classin' && $user->rights->propal->creer) {
|
||||
else if ($action == 'classin' && $usercancreate) {
|
||||
$object->setProject(GETPOST('projectid','int'));
|
||||
}
|
||||
|
||||
// Delai de livraison
|
||||
else if ($action == 'setavailability' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setavailability' && $usercancreate) {
|
||||
$result = $object->set_availability($user, GETPOST('availability_id','int'));
|
||||
}
|
||||
|
||||
// Origine de la propale
|
||||
else if ($action == 'setdemandreason' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setdemandreason' && $usercancreate) {
|
||||
$result = $object->set_demand_reason($user, GETPOST('demand_reason_id','int'));
|
||||
}
|
||||
|
||||
// Conditions de reglement
|
||||
else if ($action == 'setconditions' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setconditions' && $usercancreate) {
|
||||
$result = $object->setPaymentTerms(GETPOST('cond_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
else if ($action == 'setremisepercent' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setremisepercent' && $usercancreate) {
|
||||
$result = $object->set_remise_percent($user, $_POST['remise_percent']);
|
||||
}
|
||||
|
||||
else if ($action == 'setremiseabsolue' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setremiseabsolue' && $usercancreate) {
|
||||
$result = $object->set_remise_absolue($user, $_POST['remise_absolue']);
|
||||
}
|
||||
|
||||
// Mode de reglement
|
||||
else if ($action == 'setmode' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmode' && $usercancreate) {
|
||||
$result = $object->setPaymentMethods(GETPOST('mode_reglement_id', 'int'));
|
||||
}
|
||||
|
||||
// Multicurrency Code
|
||||
else if ($action == 'setmulticurrencycode' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmulticurrencycode' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyCode(GETPOST('multicurrency_code', 'alpha'));
|
||||
}
|
||||
|
||||
// Multicurrency rate
|
||||
else if ($action == 'setmulticurrencyrate' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setmulticurrencyrate' && $usercancreate) {
|
||||
$result = $object->setMulticurrencyRate(price2num(GETPOST('multicurrency_tx')));
|
||||
}
|
||||
|
||||
// bank account
|
||||
else if ($action == 'setbankaccount' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setbankaccount' && $usercancreate) {
|
||||
$result=$object->setBankAccount(GETPOST('fk_account', 'int'));
|
||||
}
|
||||
|
||||
// shipping method
|
||||
else if ($action == 'setshippingmethod' && $user->rights->propal->creer) {
|
||||
else if ($action == 'setshippingmethod' && $usercancreate) {
|
||||
$result=$object->setShippingMethod(GETPOST('shipping_method_id', 'int'));
|
||||
}
|
||||
|
||||
@@ -1261,7 +1270,7 @@ if (empty($reshook))
|
||||
if ($error) $action = 'edit_extras';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->propal->creer)
|
||||
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $usercancreate)
|
||||
{
|
||||
if ($action == 'addcontact')
|
||||
{
|
||||
@@ -1308,7 +1317,7 @@ if (empty($reshook))
|
||||
|
||||
// Actions to build doc
|
||||
$upload_dir = $conf->propal->multidir_output[$object->entity];
|
||||
$permissioncreate=$user->rights->propal->creer;
|
||||
$permissioncreate=$usercancreate;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
|
||||
|
||||
}
|
||||
@@ -1837,8 +1846,8 @@ if ($action == 'create')
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Ref customer
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->propal->creer, 'string', '', null, null, '', 1);
|
||||
$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', 0, 1);
|
||||
$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1);
|
||||
// Thirdparty
|
||||
$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer');
|
||||
if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' (<a href="'.DOL_URL_ROOT.'/comm/propal/list.php?socid='.$object->thirdparty->id.'">'.$langs->trans("OtherProposals").'</a>)';
|
||||
@@ -1847,7 +1856,7 @@ if ($action == 'create')
|
||||
{
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->propal->creer)
|
||||
if ($usercancreate)
|
||||
{
|
||||
if ($action != 'classify')
|
||||
$morehtmlref.='<a href="' . $_SERVER['PHP_SELF'] . '?action=classify&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
|
||||
@@ -1915,11 +1924,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Date');
|
||||
print '</td>';
|
||||
if ($action != 'editdate' && ! empty($object->brouillon))
|
||||
if ($action != 'editdate' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdate&id=' . $object->id . '">' . img_edit($langs->trans('SetDate'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if (! empty($object->brouillon) && $action == 'editdate') {
|
||||
if (! empty($object->brouillon) && $action == 'editdate' && $usercancreate) {
|
||||
print '<form name="editdate" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="setdate">';
|
||||
@@ -1941,11 +1950,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('DateEndPropal');
|
||||
print '</td>';
|
||||
if ($action != 'editecheance' && ! empty($object->brouillon))
|
||||
if ($action != 'editecheance' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editecheance&id=' . $object->id . '">' . img_edit($langs->trans('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if (! empty($object->brouillon) && $action == 'editecheance') {
|
||||
if (! empty($object->brouillon) && $action == 'editecheance' && $usercancreate) {
|
||||
print '<form name="editecheance" action="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '" method="post">';
|
||||
print '<input type="hidden" name="token" value="' . $_SESSION ['newtoken'] . '">';
|
||||
print '<input type="hidden" name="action" value="setecheance">';
|
||||
@@ -1969,11 +1978,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentConditionsShort');
|
||||
print '</td>';
|
||||
if ($action != 'editconditions' && ! empty($object->brouillon))
|
||||
if ($action != 'editconditions' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editconditions&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetConditions'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editconditions') {
|
||||
if (! empty($object->brouillon) && $action == 'editconditions' && $usercancreate) {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'cond_reglement_id');
|
||||
} else {
|
||||
$form->form_conditions_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->cond_reglement_id, 'none');
|
||||
@@ -1984,9 +1993,9 @@ if ($action == 'create')
|
||||
// Delivery date
|
||||
$langs->load('deliveries');
|
||||
print '<tr><td>';
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker');
|
||||
print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
|
||||
print '</td><td>';
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $user->rights->propal->creer, 'datepicker');
|
||||
print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -1997,11 +2006,11 @@ if ($action == 'create')
|
||||
if (! empty($conf->commande->enabled))
|
||||
print ' (' . $langs->trans('AfterOrder') . ')';
|
||||
print '</td>';
|
||||
if ($action != 'editavailability' && ! empty($object->brouillon))
|
||||
if ($action != 'editavailability' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editavailability&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetAvailability'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editavailability') {
|
||||
if (! empty($object->brouillon) && $action == 'editavailability' && $usercancreate) {
|
||||
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'availability_id', 1);
|
||||
} else {
|
||||
$form->form_availability($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->availability_id, 'none', 1);
|
||||
@@ -2016,11 +2025,11 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('SendingMethod');
|
||||
print '</td>';
|
||||
if ($action != 'editshippingmethod' && $user->rights->propal->creer)
|
||||
if ($action != 'editshippingmethod' && $usercancreate)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editshippingmethod&id='.$object->id.'">'.img_edit($langs->trans('SetShippingMode'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editshippingmethod') {
|
||||
if ($action == 'editshippingmethod' && $usercancreate) {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'shipping_method_id', 1);
|
||||
} else {
|
||||
$form->formSelectShippingMethod($_SERVER['PHP_SELF'].'?id='.$object->id, $object->shipping_method_id, 'none');
|
||||
@@ -2034,11 +2043,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Source');
|
||||
print '</td>';
|
||||
if ($action != 'editdemandreason' && ! empty($object->brouillon))
|
||||
if ($action != 'editdemandreason' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editdemandreason&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetDemandReason'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editdemandreason') {
|
||||
if (! empty($object->brouillon) && $action == 'editdemandreason' && $usercancreate) {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'demand_reason_id', 1);
|
||||
} else {
|
||||
$form->formInputReason($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->demand_reason_id, 'none');
|
||||
@@ -2052,11 +2061,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('PaymentMode');
|
||||
print '</td>';
|
||||
if ($action != 'editmode' && ! empty($object->brouillon))
|
||||
if ($action != 'editmode' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmode') {
|
||||
if (! empty($object->brouillon) && $action == 'editmode' && $usercancreate) {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'mode_reglement_id');
|
||||
} else {
|
||||
$form->form_modes_reglement($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->mode_reglement_id, 'none');
|
||||
@@ -2072,11 +2081,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('Currency','multicurrency_code');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon))
|
||||
if ($action != 'editmulticurrencycode' && ! empty($object->brouillon) && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencycode&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencycode') {
|
||||
if (! empty($object->brouillon) && $action == 'editmulticurrencycode' && $usercancreate) {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'multicurrency_code');
|
||||
} else {
|
||||
$form->form_multicurrency_code($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->multicurrency_code, 'none');
|
||||
@@ -2089,11 +2098,11 @@ if ($action == 'create')
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print fieldLabel('CurrencyRate','multicurrency_tx');
|
||||
print '</td>';
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency)
|
||||
if ($action != 'editmulticurrencyrate' && ! empty($object->brouillon) && $object->multicurrency_code && $object->multicurrency_code != $conf->currency && $usercancreate)
|
||||
print '<td align="right"><a href="' . $_SERVER["PHP_SELF"] . '?action=editmulticurrencyrate&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetMultiCurrencyCode'), 1) . '</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') {
|
||||
if (! empty($object->brouillon) && ($action == 'editmulticurrencyrate' || $action == 'actualizemulticurrencyrate') && $usercancreate) {
|
||||
if($action == 'actualizemulticurrencyrate') {
|
||||
list($object->fk_multicurrency, $object->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($object->db, $object->multicurrency_code);
|
||||
}
|
||||
@@ -2128,7 +2137,7 @@ if ($action == 'create')
|
||||
print '<table width="100%" class="nobordernopadding"><tr><td>';
|
||||
print $langs->trans('BankAccount');
|
||||
print '</td>';
|
||||
if ($action != 'editbankaccount' && $user->rights->propal->creer)
|
||||
if ($action != 'editbankaccount' && $usercancreate)
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editbankaccount&id='.$object->id.'">'.img_edit($langs->trans('SetBankAccount'),1).'</a></td>';
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
@@ -2164,7 +2173,7 @@ if ($action == 'create')
|
||||
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/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
if ($usercancreate) print '<a href="'.DOL_URL_ROOT.'/comm/propal/card.php?id='.$object->id.'&action=editincoterm">'.img_edit().'</a>';
|
||||
else print ' ';
|
||||
print '</td></tr></table>';
|
||||
print '</td>';
|
||||
@@ -2293,7 +2302,7 @@ if ($action == 'create')
|
||||
$ret = $object->printObjectLines($action, $mysoc, $soc, $lineid, 1);
|
||||
|
||||
// Form to add new line
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $user->rights->propal->creer && $action != 'selectlines')
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $usercancreate && $action != 'selectlines')
|
||||
{
|
||||
if ($action != 'editline')
|
||||
{
|
||||
@@ -2328,8 +2337,7 @@ if ($action == 'create')
|
||||
// Validate
|
||||
if ($object->statut == Propal::STATUS_DRAFT && $object->total_ttc >= 0 && count($object->lines) > 0)
|
||||
{
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->creer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->propal->propal_advance->validate)))
|
||||
if ($usercanvalidate)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=validate">' . $langs->trans('Validate') . '</a></div>';
|
||||
}
|
||||
@@ -2342,19 +2350,19 @@ if ($action == 'create')
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddAction") . '</a></div>';
|
||||
}*/
|
||||
// Edit
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->creer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=modif">' . $langs->trans('Modify') . '</a></div>';
|
||||
}
|
||||
|
||||
// ReOpen
|
||||
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $user->rights->propal->cloturer) {
|
||||
if (($object->statut == Propal::STATUS_SIGNED || $object->statut == Propal::STATUS_NOTSIGNED || $object->statut == Propal::STATUS_BILLED) && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=reopen' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#reopen') . '"';
|
||||
print '>' . $langs->trans('ReOpen') . '</a></div>';
|
||||
}
|
||||
|
||||
// Send
|
||||
if ($object->statut == Propal::STATUS_VALIDATED || $object->statut == Propal::STATUS_SIGNED) {
|
||||
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->propal->propal_advance->send) {
|
||||
if ($usercansend) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail') . '</a></div>';
|
||||
} else
|
||||
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendMail') . '</a></div>';
|
||||
@@ -2362,14 +2370,14 @@ if ($action == 'create')
|
||||
|
||||
// Create an order
|
||||
if (! empty($conf->commande->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||
if ($user->rights->commande->creer) {
|
||||
if ($usercancreateorder) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/commande/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddOrder") . '</a></div>';
|
||||
}
|
||||
}
|
||||
|
||||
// Create an intervention
|
||||
if (! empty($conf->service->enabled) && ! empty($conf->ficheinter->enabled) && $object->statut == Propal::STATUS_SIGNED) {
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if ($usercancreateintervention) {
|
||||
$langs->load("interventions");
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/fichinter/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddIntervention") . '</a></div>';
|
||||
}
|
||||
@@ -2379,7 +2387,7 @@ if ($action == 'create')
|
||||
if ($conf->contrat->enabled && $object->statut == Propal::STATUS_SIGNED) {
|
||||
$langs->load("contracts");
|
||||
|
||||
if ($user->rights->contrat->creer) {
|
||||
if ($usercancreatecontract) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/contrat/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans('AddContract') . '</a></div>';
|
||||
}
|
||||
}
|
||||
@@ -2387,7 +2395,7 @@ if ($action == 'create')
|
||||
// Create an invoice and classify billed
|
||||
if ($object->statut == Propal::STATUS_SIGNED)
|
||||
{
|
||||
if (! empty($conf->facture->enabled) && $user->rights->facture->creer)
|
||||
if (! empty($conf->facture->enabled) && $usercancreateinvoice)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . DOL_URL_ROOT . '/compta/facture/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '">' . $langs->trans("AddBill") . '</a></div>';
|
||||
}
|
||||
@@ -2400,18 +2408,18 @@ if ($action == 'create')
|
||||
}
|
||||
|
||||
// Set accepted/refused
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $user->rights->propal->cloturer) {
|
||||
if ($object->statut == Propal::STATUS_VALIDATED && $usercanclose) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=statut' . (empty($conf->global->MAIN_JUMP_TAG) ? '' : '#close') . '"';
|
||||
print '>' . $langs->trans('SetAcceptedRefused') . '</a></div>';
|
||||
}
|
||||
|
||||
// Clone
|
||||
if ($user->rights->propal->creer) {
|
||||
if ($usercancreate) {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?id=' . $object->id . '&socid=' . $object->socid . '&action=clone&object=' . $object->element . '">' . $langs->trans("ToClone") . '</a></div>';
|
||||
}
|
||||
|
||||
// Delete
|
||||
if ($user->rights->propal->supprimer) {
|
||||
if ($usercandelete) {
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=delete"';
|
||||
print '>' . $langs->trans('Delete') . '</a></div>';
|
||||
}
|
||||
@@ -2434,8 +2442,8 @@ if ($action == 'create')
|
||||
$filename = dol_sanitizeFileName($object->ref);
|
||||
$filedir = $conf->propal->multidir_output[$object->entity] . "/" . dol_sanitizeFileName($object->ref);
|
||||
$urlsource = $_SERVER["PHP_SELF"] . "?id=" . $object->id;
|
||||
$genallowed = $user->rights->propal->lire;
|
||||
$delallowed = $user->rights->propal->creer;
|
||||
$genallowed = $usercanread;
|
||||
$delallowed = $usercancreate;
|
||||
|
||||
print $formfile->showdocuments('propal', $filename, $filedir, $urlsource, $genallowed, $delallowed, $object->modelpdf, 1, 0, 0, 28, 0, '', 0, '', $soc->default_lang, '', $object);
|
||||
|
||||
|
||||
@@ -1328,15 +1328,19 @@ class Propal extends CommonObject
|
||||
$sql.= ", dr.code as demand_reason_code, dr.label as demand_reason";
|
||||
$sql.= ", cr.code as cond_reglement_code, cr.libelle as cond_reglement, cr.libelle_facture as cond_reglement_libelle_doc";
|
||||
$sql.= ", cp.code as mode_reglement_code, cp.libelle as mode_reglement";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."c_propalst as c, ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."propal as p";
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_propalst as c ON p.fk_statut = c.id';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as cp ON p.fk_mode_reglement = cp.id AND cp.entity IN ('.getEntity('c_paiement').')';
|
||||
$sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as cr ON p.fk_cond_reglement = cr.rowid AND cr.entity IN ('.getEntity('c_payment_term').')';
|
||||
$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 IN (".getEntity('propal').")";
|
||||
if ($ref) $sql.= " AND p.ref='".$ref."'";
|
||||
|
||||
if ($ref) {
|
||||
$sql.= " AND p.entity IN (".getEntity('propal').")"; // Dont't use entity if you use rowid
|
||||
$sql.= " AND p.ref='".$ref."'";
|
||||
}
|
||||
else $sql.= " AND p.rowid=".$rowid;
|
||||
|
||||
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
|
||||
@@ -3347,12 +3351,19 @@ class Propal extends CommonObject
|
||||
global $conf,$langs;
|
||||
$langs->load("propal");
|
||||
|
||||
if (! empty($conf->global->PROPALE_ADDON))
|
||||
$constant = 'PROPALE_ADDON_'.$this->entity;
|
||||
|
||||
if (! empty($conf->global->$constant)) {
|
||||
$classname = $conf->global->$constant; // for multicompany proposal sharing
|
||||
} else {
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
}
|
||||
|
||||
if (! empty($classname))
|
||||
{
|
||||
$mybool=false;
|
||||
|
||||
$file = $conf->global->PROPALE_ADDON.".php";
|
||||
$classname = $conf->global->PROPALE_ADDON;
|
||||
$file = $classname.".php";
|
||||
|
||||
// Include file with class
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
@@ -1858,13 +1858,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockDecrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int')?GETPOST('idwarehouse','int'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('ValidateOrder'), $text, 'confirm_validate', $formquestion, 0, 1, 220);
|
||||
@@ -1890,13 +1891,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('UnvalidateOrder'), $text, 'confirm_modif', $formquestion, "yes", 1, 220);
|
||||
@@ -1931,13 +1933,14 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value'
|
||||
// => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"),
|
||||
// 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1)));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $langs->trans("SelectWarehouseForStockIncrease"),'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
|
||||
$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('Cancel'), $text, 'confirm_cancel', $formquestion, 0, 1);
|
||||
|
||||
@@ -1591,8 +1591,10 @@ class Commande extends CommonOrder
|
||||
$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 IN (".getEntity('commande').")";
|
||||
if ($id) $sql.= " AND c.rowid=".$id;
|
||||
|
||||
if ($id) $sql.= " WHERE c.rowid=".$id;
|
||||
else $sql.= " WHERE c.entity IN (".getEntity('commande').")"; // Dont't use entity if you use rowid
|
||||
|
||||
if ($ref) $sql.= " AND c.ref='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND c.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND c.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
@@ -509,7 +509,7 @@ if ($resql)
|
||||
{
|
||||
print $form->selectyesno('valdate_invoices', 0, 1);
|
||||
}
|
||||
if (! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
|
||||
if (! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER)) print ' <span class="opacitymedium">'.$langs->trans("IfValidateInvoiceIsNoOrderStayUnbilled").'</span>';
|
||||
else print ' <span class="opacitymedium">'.$langs->trans("OptionToSetOrderBilledNotEnabled").'</span>';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
@@ -80,7 +80,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -3200,7 +3200,7 @@ if ($action == 'create')
|
||||
print '<input type="hidden" name="origin" value="' . $objectsrc->element . '">';
|
||||
print '<input type="hidden" name="originid" value="' . $objectsrc->id . '">';
|
||||
|
||||
switch ($classname) {
|
||||
switch (get_class($objectsrc)) {
|
||||
case 'Propal':
|
||||
$newclassname = 'CommercialProposal';
|
||||
break;
|
||||
@@ -3217,7 +3217,7 @@ if ($action == 'create')
|
||||
$newclassname = 'Intervention';
|
||||
break;
|
||||
default:
|
||||
$newclassname = $classname;
|
||||
$newclassname = get_class($objectsrc);
|
||||
}
|
||||
|
||||
print '<tr><td>' . $langs->trans($newclassname) . '</td><td colspan="2">' . $objectsrc->getNomUrl(1);
|
||||
@@ -3376,13 +3376,14 @@ else if ($id > 0 || ! empty($ref))
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/html.formproduct.class.php';
|
||||
$formproduct = new FormProduct($db);
|
||||
$label = $object->type == Facture::TYPE_CREDIT_NOTE ? $langs->trans("SelectWarehouseForStockDecrease") : $langs->trans("SelectWarehouseForStockIncrease");
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion = array(
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' =>
|
||||
// 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value'
|
||||
// => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"))));
|
||||
// 'text' => $langs->trans("ConfirmClone"),
|
||||
// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other','name' => 'idwarehouse','label' => $label,'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, $langs->trans("NoStockAction"), 0, $forcecombo))
|
||||
);
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', $formquestion, "yes", 1);
|
||||
} else {
|
||||
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('DeleteBill'), $text, 'confirm_delete', '', 'no', 1);
|
||||
@@ -4632,7 +4633,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
if ($objectidnext) {
|
||||
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
} else {
|
||||
//if ($resteapayer == 0) {
|
||||
//if ($resteapayer == 0) { // Sometimes we can receive more, so we accept to enter more and will offer a button to convert into discount (but it is not a credit note, just a prepayment done)
|
||||
// print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseRemainderToPayIsZero") . '">' . $langs->trans('DoPayment') . '</span></div>';
|
||||
//} else {
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'. DOL_URL_ROOT .'/compta/paiement.php?facid=' . $object->id . '&action=create&accountid='.$object->fk_account.'">' . $langs->trans('DoPayment') . '</a></div>';
|
||||
|
||||
@@ -1274,8 +1274,10 @@ class Facture extends CommonInvoice
|
||||
$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 IN ('.getEntity('facture').')';
|
||||
if ($rowid) $sql.= " AND f.rowid=".$rowid;
|
||||
|
||||
if ($rowid) $sql.= " WHERE f.rowid=".$rowid;
|
||||
else $sql.= ' WHERE f.entity IN ('.getEntity('facture').')'; // Dont't use entity if you use rowid
|
||||
|
||||
if ($ref) $sql.= " AND f.facnumber='".$this->db->escape($ref)."'";
|
||||
if ($ref_ext) $sql.= " AND f.ref_ext='".$this->db->escape($ref_ext)."'";
|
||||
if ($ref_int) $sql.= " AND f.ref_int='".$this->db->escape($ref_int)."'";
|
||||
|
||||
@@ -1575,7 +1575,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR ='';
|
||||
$XML_DEBITOR .=' <DrctDbtTxInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' <PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
// $XML_DEBITOR .=' <EndToEndId>'.('AS-'.dol_trunc($row_facnumber,20).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' <EndToEndId>'.(($conf->global->END_TO_END != "" ) ? $conf->global->END_TO_END : ('AS-'.dol_trunc($row_facnumber,20)).'-'.$Rowing).'</EndToEndId>'.$CrLf; // ISO20022 states that EndToEndId has a MaxLength of 35 characters
|
||||
$XML_DEBITOR .=' </PmtId>'.$CrLf;
|
||||
$XML_DEBITOR .=' <InstdAmt Ccy="EUR">'.round($row_somme, 2).'</InstdAmt>'.$CrLf;
|
||||
$XML_DEBITOR .=' <DrctDbtTx>'.$CrLf;
|
||||
@@ -1607,7 +1608,8 @@ class BonPrelevement extends CommonObject
|
||||
$XML_DEBITOR .=' </DbtrAcct>'.$CrLf;
|
||||
$XML_DEBITOR .=' <RmtInf>'.$CrLf;
|
||||
// $XML_DEBITOR .=' <Ustrd>'.($row_facnumber.'/'.$Rowing.'/'.$Rum).'</Ustrd>'.$CrLf;
|
||||
$XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
// $XML_DEBITOR .=' <Ustrd>'.dol_trunc($row_facnumber, 135).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' <Ustrd>'.(($conf->global->USTRD != "" ) ? $conf->global->USTRD : dol_trunc($row_facnumber, 135) ).'</Ustrd>'.$CrLf; // 140 max
|
||||
$XML_DEBITOR .=' </RmtInf>'.$CrLf;
|
||||
$XML_DEBITOR .=' </DrctDbtTxInf>'.$CrLf;
|
||||
return $XML_DEBITOR;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
|
||||
|
||||
// Load translation files required by the page
|
||||
@@ -76,6 +77,7 @@ $search_type=GETPOST('search_type','alpha');
|
||||
$search_zip=GETPOST('search_zip','alpha');
|
||||
$search_town=GETPOST('search_town','alpha');
|
||||
$search_import_key=GETPOST("search_import_key","alpha");
|
||||
$search_country=GETPOST("search_country",'intcomma');
|
||||
|
||||
if ($search_status=='') $search_status=1; // always display activ customer first
|
||||
|
||||
@@ -148,6 +150,7 @@ $arrayfields=array(
|
||||
'p.poste'=>array('label'=>"PostOrFunction", 'checked'=>1),
|
||||
'p.town'=>array('label'=>"Town", 'checked'=>0),
|
||||
'p.zip'=>array('label'=>"Zip", 'checked'=>0),
|
||||
'country.code_iso'=>array('label'=>"Country", 'checked'=>0),
|
||||
'p.phone'=>array('label'=>"Phone", 'checked'=>1),
|
||||
'p.phone_perso'=>array('label'=>"PhonePerso", 'checked'=>0),
|
||||
'p.phone_mobile'=>array('label'=>"PhoneMobile", 'checked'=>1),
|
||||
@@ -203,6 +206,9 @@ if (empty($reshook))
|
||||
$search_lastname="";
|
||||
$search_firstname="";
|
||||
$search_societe="";
|
||||
$search_town="";
|
||||
$search_zip="";
|
||||
$search_country="";
|
||||
$search_poste="";
|
||||
$search_phone="";
|
||||
$search_phone_perso="";
|
||||
@@ -298,6 +304,7 @@ if ($search_id > 0) $sql.= natural_search("p.rowid",$search_id,1
|
||||
if ($search_lastname) $sql.= natural_search('p.lastname', $search_lastname);
|
||||
if ($search_firstname) $sql.= natural_search('p.firstname', $search_firstname);
|
||||
if ($search_societe) $sql.= natural_search('s.nom', $search_societe);
|
||||
if ($search_country) $sql .= " AND p.fk_pays IN (".$search_country.')';
|
||||
if (strlen($search_poste)) $sql.= natural_search('p.poste', $search_poste);
|
||||
if (strlen($search_phone_perso)) $sql.= natural_search('p.phone_perso', $search_phone_perso);
|
||||
if (strlen($search_phone_pro)) $sql.= natural_search('p.phone', $search_phone);
|
||||
@@ -396,6 +403,7 @@ if ($search_firstname != '') $param.='&search_firstname='.urlencode($search_
|
||||
if ($search_societe != '') $param.='&search_societe='.urlencode($search_societe);
|
||||
if ($search_zip != '') $param.='&search_zip='.urlencode($search_zip);
|
||||
if ($search_town != '') $param.='&search_town='.urlencode($search_town);
|
||||
if ($search_country != '') $param.= "&search_country=".urlencode($search_country);
|
||||
if ($search_job != '') $param.='&search_job='.urlencode($search_job);
|
||||
if ($search_phone_pro != '') $param.='&search_phone_pro='.urlencode($search_phone_pro);
|
||||
if ($search_phone_perso != '') $param.='&search_phone_perso='.urlencode($search_phone_perso);
|
||||
@@ -518,6 +526,12 @@ if (! empty($arrayfields['p.firstname']['checked']))
|
||||
print '<input class="flat" type="text" name="search_firstname" size="6" value="'.dol_escape_htmltag($search_firstname).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
@@ -530,10 +544,25 @@ if (! empty($arrayfields['p.town']['checked']))
|
||||
print '<input class="flat" type="text" name="search_town" size="5" value="'.dol_escape_htmltag($search_town).'">';
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
// State
|
||||
/*if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_state" value="'.dol_escape_htmltag($search_state).'">';
|
||||
print '</td>';
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat searchstring" size="4" type="text" name="search_region" value="'.dol_escape_htmltag($search_region).'">';
|
||||
print '</td>';
|
||||
}*/
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td class="liste_titre">';
|
||||
print '<input class="flat" type="text" name="search_poste" size="5" value="'.dol_escape_htmltag($search_poste).'">';
|
||||
print '<td class="liste_titre" align="center">';
|
||||
print $form->select_country($search_country,'search_country','',0,'maxwidth100');
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($arrayfields['p.phone']['checked']))
|
||||
@@ -630,9 +659,12 @@ print '<tr class="liste_titre">';
|
||||
if (! empty($arrayfields['p.rowid']['checked'])) print_liste_field_titre($arrayfields['p.rowid']['label'], $_SERVER["PHP_SELF"],"p.rowid","",$param,"",$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.lastname']['checked'])) print_liste_field_titre($arrayfields['p.lastname']['label'],$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.firstname']['checked'])) print_liste_field_titre($arrayfields['p.firstname']['label'],$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.zip']['checked'])) print_liste_field_titre($arrayfields['p.zip']['label'],$_SERVER["PHP_SELF"],"p.zip", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.town']['checked'])) print_liste_field_titre($arrayfields['p.town']['label'],$_SERVER["PHP_SELF"],"p.town", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.poste']['checked'])) print_liste_field_titre($arrayfields['p.poste']['label'],$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder);
|
||||
//if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"co.code_iso","",$param,'align="center"',$sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone']['checked'])) print_liste_field_titre($arrayfields['p.phone']['label'],$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_perso']['checked'])) print_liste_field_titre($arrayfields['p.phone_perso']['label'],$_SERVER["PHP_SELF"],"p.phone_perso", $begin, $param, '', $sortfield,$sortorder);
|
||||
if (! empty($arrayfields['p.phone_mobile']['checked'])) print_liste_field_titre($arrayfields['p.phone_mobile']['label'],$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
|
||||
@@ -697,6 +729,12 @@ while ($i < min($num,$limit))
|
||||
print '<td>'.$obj->firstname.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Job position
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Zip
|
||||
if (! empty($arrayfields['p.zip']['checked']))
|
||||
{
|
||||
@@ -709,10 +747,25 @@ while ($i < min($num,$limit))
|
||||
print '<td>'.$obj->town.'</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Function
|
||||
if (! empty($arrayfields['p.poste']['checked']))
|
||||
// State
|
||||
/*if (! empty($arrayfields['state.nom']['checked']))
|
||||
{
|
||||
print '<td>'.dol_trunc($obj->poste,20).'</td>';
|
||||
print "<td>".$obj->state_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Region
|
||||
if (! empty($arrayfields['region.nom']['checked']))
|
||||
{
|
||||
print "<td>".$obj->region_name."</td>\n";
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}*/
|
||||
// Country
|
||||
if (! empty($arrayfields['country.code_iso']['checked']))
|
||||
{
|
||||
print '<td align="center">';
|
||||
$tmparray=getCountry($obj->fk_pays,'all');
|
||||
print $tmparray['label'];
|
||||
print '</td>';
|
||||
if (! $i) $totalarray['nbfield']++;
|
||||
}
|
||||
// Phone
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print '<div name="topofform"></div><br>';
|
||||
print '<br><div name="topofform" id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
@@ -628,6 +628,7 @@ class CMailFile
|
||||
|
||||
if (! $res)
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error="Failed to send mail with php mail";
|
||||
$linuxlike=1;
|
||||
if (preg_match('/^win/i',PHP_OS)) $linuxlike=0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
/* Copyright (C) 2010-2018 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -145,7 +145,7 @@ class Canvas
|
||||
{
|
||||
if (empty($this->template_dir)) return 0;
|
||||
|
||||
if (file_exists($this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
if (file_exists($this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php')) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class Canvas
|
||||
global $db, $conf, $langs, $user, $canvas;
|
||||
global $form, $formfile;
|
||||
|
||||
include $this->template_dir.($this->card?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
include $this->template_dir.(!empty($this->card)?$this->card.'_':'').$this->_cleanaction($action).'.tpl.php'; // Include native PHP template
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ abstract class CommonInvoice extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice
|
||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice
|
||||
*
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
|
||||
@@ -1500,7 +1500,7 @@ abstract class CommonObject
|
||||
*/
|
||||
function load_previous_next_ref($filter, $fieldid, $nodbprefix=0)
|
||||
{
|
||||
global $user;
|
||||
global $conf, $user;
|
||||
|
||||
if (! $this->table_element)
|
||||
{
|
||||
@@ -1520,6 +1520,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MAX(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@@ -1534,7 +1537,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@@ -1552,6 +1566,9 @@ abstract class CommonObject
|
||||
|
||||
$sql = "SELECT MIN(te.".$fieldid.")";
|
||||
$sql.= " FROM ".(empty($nodbprefix)?MAIN_DB_PREFIX:'').$this->table_element." as te";
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe as s"; // If we need to link to societe to limit select to socid
|
||||
else if ($this->restrictiononfksoc == 2 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON te.fk_soc = s.rowid"; // If we need to link to societe to limit select to socid
|
||||
@@ -1566,7 +1583,18 @@ abstract class CommonObject
|
||||
}
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 2) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to entity
|
||||
else if ($this->restrictiononfksoc == 1 && $this->element != 'societe' && !$user->rights->societe->client->voir && !$socid) $sql.= ' AND te.fk_soc = s.rowid'; // If we need to link to societe to limit select to socid
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) $sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
|
||||
if ($this->element == 'user' && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
|
||||
if (! empty($user->admin) && empty($user->entity) && $conf->entity == 1) {
|
||||
$sql.= " AND te.entity IS NOT NULL"; // Show all users
|
||||
} else {
|
||||
$sql.= " AND ug.fk_user = te.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity($this->element).")";
|
||||
}
|
||||
} else {
|
||||
$sql.= ' AND te.entity IN ('.getEntity($this->element).')';
|
||||
}
|
||||
}
|
||||
if ($this->restrictiononfksoc == 1 && $socid && $this->element != 'societe') $sql.= ' AND te.fk_soc = ' . $socid;
|
||||
if ($this->restrictiononfksoc == 2 && $socid && $this->element != 'societe') $sql.= ' AND (te.fk_soc = ' . $socid.' OR te.fk_soc IS NULL)';
|
||||
if ($this->restrictiononfksoc && $socid && $this->element == 'societe') $sql.= ' AND te.rowid = ' . $socid;
|
||||
@@ -3838,7 +3866,7 @@ abstract class CommonObject
|
||||
{
|
||||
global $conf,$langs,$user,$object,$hookmanager;
|
||||
global $form,$bc,$bcdd;
|
||||
global $object_rights, $disableedit, $disablemove; // TODO We should not use global var for this !
|
||||
global $object_rights, $disableedit, $disablemove, $disableremove; // TODO We should not use global var for this !
|
||||
|
||||
$object_rights = $this->getRights();
|
||||
|
||||
@@ -5082,10 +5110,10 @@ abstract class CommonObject
|
||||
* @param string $moreparam To add more parameters on html input tag
|
||||
* @param string $keysuffix Prefix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string $keyprefix Suffix string to add into name and id of field (can be used to avoid duplicate names)
|
||||
* @param string|int $showsize Value for css to define size. May also be a numeric.
|
||||
* @param string|int $morecss Value for css to define style/length of field. May also be a numeric.
|
||||
* @return string
|
||||
*/
|
||||
function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $showsize=0)
|
||||
function showInputField($val, $key, $value, $moreparam='', $keysuffix='', $keyprefix='', $morecss=0)
|
||||
{
|
||||
global $conf,$langs,$form;
|
||||
|
||||
@@ -5094,39 +5122,55 @@ abstract class CommonObject
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
$form=new Form($this->db);
|
||||
}
|
||||
|
||||
$val=$this->fields[$key];
|
||||
|
||||
$out='';
|
||||
$type='';
|
||||
$param['options']=array();
|
||||
$size =$this->fields[$key]['size'];
|
||||
// Because we work on extrafields
|
||||
if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
||||
$type ='link';
|
||||
}else if(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)){
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>'N');
|
||||
$type ='link';
|
||||
}else if(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){
|
||||
|
||||
$param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N');
|
||||
$type ='sellist';
|
||||
}else if(preg_match('/varchar\((\d+)\)/', $val['type'],$reg)){
|
||||
|
||||
$param['options']=array();
|
||||
$type ='varchar';
|
||||
$size=$reg[1];
|
||||
}else if(preg_match('/varchar/', $val['type'])){
|
||||
|
||||
$param['options']=array();
|
||||
$type ='varchar';
|
||||
}else if(is_array($this->fields[$key]['arrayofkeyval'])){
|
||||
|
||||
$param['options']=$this->fields[$key]['arrayofkeyval'];
|
||||
$type ='select';
|
||||
}else {
|
||||
$param['options']=array();
|
||||
$type =$this->fields[$key]['type'];
|
||||
}
|
||||
|
||||
$label=$this->fields[$key]['label'];
|
||||
//$elementtype=$this->fields[$key]['elementtype']; // Seems not used
|
||||
$default=$this->fields[$key]['default'];
|
||||
$computed=$this->fields[$key]['computed'];
|
||||
$unique=$this->fields[$key]['unique'];
|
||||
$required=$this->fields[$key]['required'];
|
||||
|
||||
$langfile=$this->fields[$key]['langfile'];
|
||||
$list=$this->fields[$key]['list'];
|
||||
$hidden=abs($this->fields[$key]['visible'])!=1?1:0;
|
||||
|
||||
$objectid = $this->id;
|
||||
|
||||
$label= $val['label'];
|
||||
$type = $val['type'];
|
||||
$size = $val['css'];
|
||||
|
||||
// Convert var to be able to share same code than showInputField of extrafields
|
||||
if (preg_match('/varchar\((\d+)\)/', $type, $reg))
|
||||
{
|
||||
$type = 'varchar'; // convert varchar(xx) int varchar
|
||||
$size = $reg[1];
|
||||
}
|
||||
elseif (preg_match('/varchar/', $type)) $type = 'varchar'; // convert varchar(xx) into varchar
|
||||
elseif (preg_match('/double/', $type)) $type = 'double'; // convert double(xx) into double
|
||||
if (is_array($val['arrayofkeyval'])) $type='select';
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)) $type='link';
|
||||
|
||||
$default=$val['default'];
|
||||
$computed=$val['computed'];
|
||||
$unique=$val['unique'];
|
||||
$required=$val['required'];
|
||||
$param=$val['param'];
|
||||
if (is_array($val['arrayofkeyval'])) $param['options'] = $val['arrayofkeyval'];
|
||||
if (preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg))
|
||||
{
|
||||
$type='link';
|
||||
$param['options']=array($reg[1].':'.$reg[2]=>$reg[1].':'.$reg[2]);
|
||||
}
|
||||
$langfile=$val['langfile'];
|
||||
$list=$val['list'];
|
||||
$hidden=(abs($val['visible'])!=1 ? 1 : 0);
|
||||
$help=$val['help'];
|
||||
|
||||
if ($computed)
|
||||
{
|
||||
@@ -5134,54 +5178,50 @@ abstract class CommonObject
|
||||
else return '';
|
||||
}
|
||||
|
||||
|
||||
// Use in priority showsize from parameters, then $val['css'] then autodefine
|
||||
if (empty($showsize) && ! empty($val['css']))
|
||||
if (empty($morecss) && ! empty($val['css']))
|
||||
{
|
||||
$showsize = $val['css'];
|
||||
}
|
||||
if (empty($showsize))
|
||||
if (empty($morecss))
|
||||
{
|
||||
if ($type == 'date')
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'minwidth100imp';
|
||||
$morecss = 'minwidth100imp';
|
||||
}
|
||||
elseif ($type == 'datetime')
|
||||
{
|
||||
//$showsize=19;
|
||||
$showsize = 'minwidth200imp';
|
||||
$morecss = 'minwidth200imp';
|
||||
}
|
||||
elseif (in_array($type,array('int','double','price')))
|
||||
elseif (in_array($type,array('int','integer','price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type))
|
||||
{
|
||||
//$showsize=10;
|
||||
$showsize = 'maxwidth75';
|
||||
}
|
||||
elseif ($type == 'url')
|
||||
$morecss = 'maxwidth75';
|
||||
}elseif ($type == 'url')
|
||||
{
|
||||
$showsize='minwidth400';
|
||||
$morecss='minwidth400';
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
$showsize='';
|
||||
$morecss='';
|
||||
}
|
||||
else
|
||||
{
|
||||
if (round($size) < 12)
|
||||
{
|
||||
$showsize = 'minwidth100';
|
||||
$morecss = 'minwidth100';
|
||||
}
|
||||
else if (round($size) <= 48)
|
||||
{
|
||||
$showsize = 'minwidth200';
|
||||
$morecss = 'minwidth200';
|
||||
}
|
||||
else
|
||||
{
|
||||
//$showsize=48;
|
||||
$showsize = 'minwidth400';
|
||||
$morecss = 'minwidth400';
|
||||
}
|
||||
}
|
||||
}
|
||||
//var_dump($showsize.' '.$size);
|
||||
|
||||
if (in_array($type,array('date','datetime')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
@@ -5193,33 +5233,47 @@ abstract class CommonObject
|
||||
if (!$required && $value == '') $value = '-1';
|
||||
|
||||
// TODO Must also support $moreparam
|
||||
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, ($keyprefix != 'search_' ? 1 : 0), 1, 0, 1);
|
||||
$out = $form->select_date($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0, 1);
|
||||
}
|
||||
elseif (in_array($type,array('int','integer')))
|
||||
{
|
||||
$tmp=explode(',',$size);
|
||||
$newsize=$tmp[0];
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.$value.'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$newsize.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif (preg_match('/varchar/', $type))
|
||||
{
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" maxlength="'.$size.'" value="'.dol_escape_htmltag($value).'"'.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif (in_array($type, array('mail', 'phone', 'url')))
|
||||
{
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'text')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,0,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,false,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'html')
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
if (! preg_match('/search_/', $keyprefix)) // If keyprefix is search_ or search_options_, we must just use a simple text field
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
|
||||
$doleditor=new DolEditor($keyprefix.$key.$keysuffix,$value,'',200,'dolibarr_notes','In',false,false,! empty($conf->fckeditor->enabled) && $conf->global->FCKEDITOR_ENABLE_SOCIETE,ROWS_5,'90%');
|
||||
$out=$doleditor->Create(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.dol_escape_htmltag($value).'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
}
|
||||
elseif ($type == 'boolean')
|
||||
{
|
||||
@@ -5229,21 +5283,21 @@ abstract class CommonObject
|
||||
} else {
|
||||
$checked=' value="1" ';
|
||||
}
|
||||
$out='<input type="checkbox" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="checkbox" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.$checked.' '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'price')
|
||||
{
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> '.$langs->getCurrencySymbol($conf->currency);
|
||||
}
|
||||
elseif ($type == 'double')
|
||||
elseif (preg_match('/^double(\([0-9],[0-9]\)){0,1}/',$type))
|
||||
{
|
||||
if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format.
|
||||
$value=price($value);
|
||||
}
|
||||
$out='<input type="text" class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
$out='<input type="text" class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'> ';
|
||||
}
|
||||
elseif ($type == 'select')
|
||||
{
|
||||
@@ -5254,8 +5308,8 @@ abstract class CommonObject
|
||||
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if ((! isset($val['default'])) || ($val['notnull'] != 1)) $out.='<option value="0"> </option>';
|
||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if((! isset($this->fields[$key]['default'])) ||($this->fields[$key]['notnull']!=1))$out.='<option value="0"> </option>';
|
||||
foreach ($param['options'] as $key => $val)
|
||||
{
|
||||
if ((string) $key == '') continue;
|
||||
@@ -5276,11 +5330,13 @@ abstract class CommonObject
|
||||
$out.= ajax_combobox($keyprefix.$key.$keysuffix, array(), 0);
|
||||
}
|
||||
|
||||
$out.='<select class="flat '.$showsize.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out.='<select class="flat '.$morecss.' maxwidthonsmartphone" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'').'>';
|
||||
if (is_array($param['options']))
|
||||
{
|
||||
$param_list=array_keys($param['options']);
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$parentName='';
|
||||
$parentField='';
|
||||
// 0 : tableName
|
||||
// 1 : label field name
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
@@ -5365,8 +5421,9 @@ abstract class CommonObject
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$notrans = false;
|
||||
$fields_label = explode('|',$InfoFieldList[1]);
|
||||
if(is_array($fields_label))
|
||||
if (is_array($fields_label))
|
||||
{
|
||||
$notrans = true;
|
||||
foreach ($fields_label as $field_toshow)
|
||||
@@ -5380,7 +5437,7 @@ abstract class CommonObject
|
||||
}
|
||||
$labeltoshow=dol_trunc($labeltoshow,45);
|
||||
|
||||
if ($value==$obj->rowid)
|
||||
if ($value == $obj->rowid)
|
||||
{
|
||||
foreach ($fields_label as $field_toshow)
|
||||
{
|
||||
@@ -5395,7 +5452,7 @@ abstract class CommonObject
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$notrans)
|
||||
if (! $notrans)
|
||||
{
|
||||
$translabel=$langs->trans($obj->{$InfoFieldList[1]});
|
||||
if ($translabel!=$obj->{$InfoFieldList[1]}) {
|
||||
@@ -5411,7 +5468,7 @@ abstract class CommonObject
|
||||
$out.='<option value="'.$obj->rowid.'" selected>'.$labeltoshow.'</option>';
|
||||
}
|
||||
|
||||
if (!empty($InfoFieldList[3]))
|
||||
if (!empty($InfoFieldList[3]) && $parentField)
|
||||
{
|
||||
$parent = $parentName.':'.$obj->{$parentField};
|
||||
}
|
||||
@@ -5442,7 +5499,7 @@ abstract class CommonObject
|
||||
$out='';
|
||||
foreach ($param['options'] as $keyopt => $val)
|
||||
{
|
||||
$out.='<input class="flat '.$showsize.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||
$out.='<input class="flat '.$morecss.'" type="radio" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" '.($moreparam?$moreparam:'');
|
||||
$out.=' value="'.$keyopt.'"';
|
||||
$out.=' id="'.$keyprefix.$key.$keysuffix.'_'.$keyopt.'"';
|
||||
$out.= ($value==$keyopt?'checked':'');
|
||||
@@ -5461,6 +5518,8 @@ abstract class CommonObject
|
||||
if (is_array($param['options'])) {
|
||||
$param_list = array_keys($param['options']);
|
||||
$InfoFieldList = explode(":", $param_list[0]);
|
||||
$parentName='';
|
||||
$parentField='';
|
||||
// 0 : tableName
|
||||
// 1 : label field name
|
||||
// 2 : key fields name (if differ of rowid)
|
||||
@@ -5534,6 +5593,7 @@ abstract class CommonObject
|
||||
$labeltoshow = '';
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
$notrans = false;
|
||||
// Several field into label (eq table:code|libelle:rowid)
|
||||
$fields_label = explode('|', $InfoFieldList[1]);
|
||||
if (is_array($fields_label)) {
|
||||
@@ -5574,7 +5634,7 @@ abstract class CommonObject
|
||||
$data[$obj->rowid]=$labeltoshow;
|
||||
}
|
||||
|
||||
if (! empty($InfoFieldList[3])) {
|
||||
if (! empty($InfoFieldList[3]) && $parentField) {
|
||||
$parent = $parentName . ':' . $obj->{$parentField};
|
||||
}
|
||||
|
||||
@@ -5591,18 +5651,17 @@ abstract class CommonObject
|
||||
print 'Error in request ' . $sql . ' ' . $this->db->lasterror() . '. Check setup of extra parameters.<br>';
|
||||
}
|
||||
}
|
||||
$out .= '</select>';
|
||||
}
|
||||
elseif ($type == 'link')
|
||||
{
|
||||
$param_list=array_keys($param['options']); // $param_list='ObjectName:classPath'
|
||||
$showempty=(($val['notnull'] == 1 && $val['default'] != '')?0:1);
|
||||
$showempty=(($required && $default != '')?0:1);
|
||||
$out=$form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty);
|
||||
}
|
||||
elseif ($type == 'password')
|
||||
{
|
||||
// If prefix is 'search_', field is used as a filter, we use a common text field.
|
||||
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$showsize.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
$out='<input type="'.($keyprefix=='search_'?'text':'password').'" class="flat '.$morecss.'" name="'.$keyprefix.$key.$keysuffix.'" id="'.$keyprefix.$key.$keysuffix.'" value="'.$value.'" '.($moreparam?$moreparam:'').'>';
|
||||
}
|
||||
elseif ($type == 'array')
|
||||
{
|
||||
@@ -5648,8 +5707,7 @@ abstract class CommonObject
|
||||
*/
|
||||
return $out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return HTML string to show a field into a page
|
||||
* Code very similar with showOutputField of extra fields
|
||||
|
||||
@@ -39,6 +39,8 @@ class Conf
|
||||
var $db;
|
||||
//! To store properties found into database
|
||||
var $global;
|
||||
//! To store browser info
|
||||
var $browser;
|
||||
|
||||
//! To store if javascript/ajax is enabked
|
||||
public $use_javascript_ajax;
|
||||
@@ -506,7 +508,7 @@ class Conf
|
||||
if (! isset($this->global->MAIN_SHOW_LOGO)) $this->global->MAIN_SHOW_LOGO=1;
|
||||
|
||||
// Default max file size for upload
|
||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||
$this->maxfilesize = (empty($this->global->MAIN_UPLOAD_DOC) ? 0 : (int) $this->global->MAIN_UPLOAD_DOC * 1024);
|
||||
|
||||
// By default, we propagate contacts
|
||||
if (! isset($this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN)) $this->global->MAIN_PROPAGATE_CONTACTS_FROM_ORIGIN='*'; // Can be also '*' or '^(BILLING|SHIPPING|CUSTOMER|.*)$' (regex not yet implemented)
|
||||
|
||||
@@ -509,11 +509,11 @@ class DiscountAbsolute
|
||||
}
|
||||
|
||||
/**
|
||||
* Return amount (with tax) of all credit notes and deposits invoices used by invoice as a payment
|
||||
* Return amount (with tax) of all credit notes invoices + excess received used by invoice as a payment
|
||||
*
|
||||
* @param CommonInvoice $invoice Object invoice
|
||||
* @param int $multicurrency Return multicurrency_amount instead of amount
|
||||
* @return int <0 if KO, Sum of credit notes and deposits amount otherwise
|
||||
* @return int <0 if KO, Sum of credit notes and excess received amount otherwise
|
||||
*/
|
||||
function getSumCreditNotesUsed($invoice, $multicurrency=0)
|
||||
{
|
||||
|
||||
@@ -156,14 +156,14 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param string $list Visibilty ('0'=never visible, '1'=visible on list+forms, '2'=list only, '3'=form only or 'eval string')
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $help Text with help tooltip
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields (for multicompany modules)
|
||||
* @param string $langfile Language file
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $computed='', $entity='', $langfile='', $enabled='1')
|
||||
function addExtraField($attrname, $label, $type, $pos, $size, $elementtype, $unique=0, $required=0, $default_value='', $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $computed='', $entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
if (empty($attrname)) return -1;
|
||||
if (empty($label)) return -1;
|
||||
@@ -174,13 +174,13 @@ class ExtraFields
|
||||
// Create field into database except for separator type which is not stored in database
|
||||
if ($type != 'separate')
|
||||
{
|
||||
$result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed);
|
||||
$result=$this->create($attrname, $type, $size, $elementtype, $unique, $required, $default_value, $param, $perms, $list, $computed, $help);
|
||||
}
|
||||
$err1=$this->errno;
|
||||
if ($result > 0 || $err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' || $type == 'separate')
|
||||
{
|
||||
// Add declaration of field into table
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $notused, $default_value, $computed, $entity, $langfile, $enabled);
|
||||
$result2=$this->create_label($attrname, $label, $type, $pos, $size, $elementtype, $unique, $required, $param, $alwayseditable, $perms, $list, $help, $default_value, $computed, $entity, $langfile, $enabled);
|
||||
$err2=$this->errno;
|
||||
if ($result2 > 0 || ($err1 == 'DB_ERROR_COLUMN_ALREADY_EXISTS' && $err2 == 'DB_ERROR_RECORD_ALREADY_EXISTS'))
|
||||
{
|
||||
@@ -300,7 +300,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param string $list Visibily
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $help Help on tooltip
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@@ -308,7 +308,7 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $notused=0, $default='', $computed='',$entity='', $langfile='', $enabled='1')
|
||||
private function create_label($attrname, $label='', $type='', $pos=0, $size=0, $elementtype='member', $unique=0, $required=0, $param='', $alwayseditable=0, $perms='', $list='-1', $help='', $default='', $computed='',$entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
@@ -357,7 +357,8 @@ class ExtraFields
|
||||
$sql.= " fk_user_author,";
|
||||
$sql.= " fk_user_modif,";
|
||||
$sql.= " datec,";
|
||||
$sql.= " enabled";
|
||||
$sql.= " enabled,";
|
||||
$sql.= " help";
|
||||
$sql.= " )";
|
||||
$sql.= " VALUES('".$attrname."',";
|
||||
$sql.= " '".$this->db->escape($label)."',";
|
||||
@@ -378,7 +379,8 @@ class ExtraFields
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= "'" . $this->db->idate(dol_now()) . "',";
|
||||
$sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1");
|
||||
$sql.= " ".($enabled?"'".$this->db->escape($enabled)."'":"1").",";
|
||||
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null");
|
||||
$sql.=')';
|
||||
|
||||
dol_syslog(get_class($this)."::create_label", LOG_DEBUG);
|
||||
@@ -508,7 +510,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param string $list Visibility
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $help Help on tooltip
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@@ -516,7 +518,7 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int >0 if OK, <=0 if KO
|
||||
*/
|
||||
function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $notused=0, $default='', $computed='', $entity='', $langfile='', $enabled='1')
|
||||
function update($attrname, $label, $type, $length, $elementtype, $unique=0, $required=0, $pos=0, $param='', $alwayseditable=0, $perms='', $list='', $help='', $default='', $computed='', $entity='', $langfile='', $enabled='1')
|
||||
{
|
||||
if ($elementtype == 'thirdparty') $elementtype='societe';
|
||||
if ($elementtype == 'contact') $elementtype='socpeople';
|
||||
@@ -566,7 +568,7 @@ class ExtraFields
|
||||
{
|
||||
if ($label)
|
||||
{
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$notused,$default,$computed,$entity,$langfile,$enabled);
|
||||
$result=$this->update_label($attrname,$label,$type,$length,$elementtype,$unique,$required,$pos,$param,$alwayseditable,$perms,$list,$help,$default,$computed,$entity,$langfile,$enabled);
|
||||
}
|
||||
if ($result > 0)
|
||||
{
|
||||
@@ -617,7 +619,7 @@ class ExtraFields
|
||||
* @param int $alwayseditable Is attribute always editable regardless of the document status
|
||||
* @param string $perms Permission to check
|
||||
* @param string $list Visiblity
|
||||
* @param int $notused Deprecated.
|
||||
* @param string $help Help on tooltip.
|
||||
* @param string $default Default value (in database. use the default_value feature for default value on screen).
|
||||
* @param string $computed Computed value
|
||||
* @param string $entity Entity of extrafields
|
||||
@@ -625,7 +627,7 @@ class ExtraFields
|
||||
* @param string $enabled Condition to have the field enabled or not
|
||||
* @return int <=0 if KO, >0 if OK
|
||||
*/
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$notused=0,$default='',$computed='',$entity='',$langfile='',$enabled='1')
|
||||
private function update_label($attrname,$label,$type,$size,$elementtype,$unique=0,$required=0,$pos=0,$param='',$alwayseditable=0,$perms='',$list='0',$help='',$default='',$computed='',$entity='',$langfile='',$enabled='1')
|
||||
{
|
||||
global $conf, $user;
|
||||
dol_syslog(get_class($this)."::update_label ".$attrname.", ".$label.", ".$type.", ".$size.", ".$elementtype.", ".$unique.", ".$required.", ".$pos.", ".$alwayseditable.", ".$perms.", ".$list.", ".$notused.", ".$default.", ".$computed.", ".$entity.", ".$langfile.", ".$enabled);
|
||||
@@ -684,7 +686,8 @@ class ExtraFields
|
||||
$sql.= " fk_user_author,";
|
||||
$sql.= " fk_user_modif,";
|
||||
$sql.= " datec,";
|
||||
$sql.= " enabled";
|
||||
$sql.= " enabled,";
|
||||
$sql.= " help";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= "'".$attrname."',";
|
||||
$sql.= " ".($entity===''?$conf->entity:$entity).",";
|
||||
@@ -705,7 +708,8 @@ class ExtraFields
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= " " . $user->id . ",";
|
||||
$sql .= "'" . $this->db->idate(dol_now()) . "',";
|
||||
$sql .= "'" . $this->db->escape($enabled). "'";
|
||||
$sql .= "'" . $this->db->escape($enabled). "',";
|
||||
$sql.= " ".($help?"'".$this->db->escape($help)."'":"null");
|
||||
$sql.= ")";
|
||||
|
||||
$resql2=$this->db->query($sql);
|
||||
@@ -769,7 +773,7 @@ class ExtraFields
|
||||
// We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management.
|
||||
dol_syslog("fetch_name_optionals_label elementtype=".$elementtype);
|
||||
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity,enabled";
|
||||
$sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity,enabled,help";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."extrafields";
|
||||
$sql.= " WHERE entity IN (0,".$conf->entity.")";
|
||||
if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; // Filed with object->table_element
|
||||
@@ -824,6 +828,7 @@ class ExtraFields
|
||||
$this->attributes[$tab->elementtype]['entityid'][$tab->name]=$tab->entity;
|
||||
$this->attributes[$tab->elementtype]['entitylabel'][$tab->name]=(empty($labelmulticompany[$tab->entity])?'Entity'.$tab->entity:$labelmulticompany[$tab->entity]);
|
||||
$this->attributes[$tab->elementtype]['enabled'][$tab->name]=$tab->enabled;
|
||||
$this->attributes[$tab->elementtype]['help'][$tab->name]=$tab->help;
|
||||
|
||||
$this->attributes[$tab->elementtype]['loaded']=1;
|
||||
}
|
||||
@@ -881,6 +886,7 @@ class ExtraFields
|
||||
$perms=dol_eval($this->attributes[$extrafieldsobjectkey]['perms'][$key], 1);
|
||||
$langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key];
|
||||
$list=dol_eval($this->attributes[$extrafieldsobjectkey]['list'][$key], 1);
|
||||
$help=$this->attributes[$extrafieldsobjectkey]['help'][$key];
|
||||
$hidden=(empty($list) ? 1 : 0); // If empty, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller)
|
||||
}
|
||||
else // Old usage
|
||||
|
||||
@@ -186,7 +186,8 @@ class HookManager
|
||||
'sendMail',
|
||||
'sendMailAfter',
|
||||
'showLinkToObjectBlock',
|
||||
'setContentSecurityPolicy'
|
||||
'setContentSecurityPolicy',
|
||||
'setHtmlTitle'
|
||||
)
|
||||
)) $hooktype='addreplace';
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ class Form
|
||||
$out='';
|
||||
|
||||
// Check parameters
|
||||
if ($inputType == 'textarea') $value = dol_nl2br($value);
|
||||
if (preg_match('/^text/',$inputType)) $value = dol_nl2br($value);
|
||||
else if (preg_match('/^numeric/',$inputType)) $value = price($value);
|
||||
else if ($inputType == 'day' || $inputType == 'datepicker') $value = dol_print_date($value, 'day');
|
||||
|
||||
@@ -1001,9 +1001,10 @@ class Form
|
||||
* @param string $selected_input_value Value of preselected input text (for use with ajax)
|
||||
* @param int $hidelabel Hide label (0=no, 1=yes, 2=show search icon (before) and placeholder, 3 search icon after)
|
||||
* @param array $ajaxoptions Options for ajax_autocompleter
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
|
||||
* @return string HTML string with select box for thirdparty.
|
||||
*/
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array())
|
||||
function select_company($selected='', $htmlname='socid', $filter='', $showempty='', $showtype=0, $forcecombo=0, $events=array(), $limit=0, $morecss='minwidth100', $moreparam='', $selected_input_value='', $hidelabel=1, $ajaxoptions=array(), $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -1040,7 +1041,7 @@ class Form
|
||||
else
|
||||
{
|
||||
// Immediate load of all database
|
||||
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam);
|
||||
$out.=$this->select_thirdparty_list($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events, '', 0, $limit, $morecss, $moreparam, $multiple);
|
||||
}
|
||||
|
||||
return $out;
|
||||
@@ -1062,16 +1063,20 @@ class Form
|
||||
* @param int $limit Limit number of answers
|
||||
* @param string $morecss Add more css styles to the SELECT component
|
||||
* @param string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return string HTML string with
|
||||
*/
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='')
|
||||
function select_thirdparty_list($selected='',$htmlname='socid',$filter='',$showempty='', $showtype=0, $forcecombo=0, $events=array(), $filterkey='', $outputmode=0, $limit=0, $morecss='minwidth100', $moreparam='', $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
$out='';
|
||||
$num=0;
|
||||
$outarray=array();
|
||||
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
// Clean $filter that may contains sql conditions so sql code
|
||||
if (function_exists('test_sql_and_script_inject')) $filter = test_sql_and_script_inject($filter, 3);
|
||||
|
||||
@@ -1120,7 +1125,7 @@ class Form
|
||||
}
|
||||
|
||||
// Construct $out and $outarray
|
||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.'">'."\n";
|
||||
$out.= '<select id="'.$htmlname.'" class="flat'.($morecss?' '.$morecss:'').'"'.($moreparam?' '.$moreparam:'').' name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').'>'."\n";
|
||||
|
||||
$textifempty='';
|
||||
// Do not use textifempty = ' ' or ' ' here, or search on key will search on ' key'.
|
||||
@@ -1169,7 +1174,7 @@ class Form
|
||||
|
||||
if (empty($outputmode))
|
||||
{
|
||||
if ($selected > 0 && $selected == $obj->rowid)
|
||||
if (in_array($obj->rowid,$selected))
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'" selected>'.$label.'</option>';
|
||||
}
|
||||
@@ -1320,15 +1325,19 @@ class Form
|
||||
* @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 string $moreparam Add more parameters onto the select tag. For example 'style="width: 95%"' to avoid select2 component to go over parent container
|
||||
* @param string $htmlid Html id to use instead of htmlname
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return int <0 if KO, Nb of contact in list if OK
|
||||
*/
|
||||
function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='')
|
||||
function selectcontacts($socid, $selected='', $htmlname='contactid', $showempty=0, $exclude='', $limitto='', $showfunction=0, $moreclass='', $options_only=false, $showsoc=0, $forcecombo=0, $events=array(), $moreparam='', $htmlid='', $multiple=false)
|
||||
{
|
||||
global $conf,$langs;
|
||||
|
||||
$langs->load('companies');
|
||||
|
||||
if (empty($htmlid)) $htmlid = $htmlname;
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
$out='';
|
||||
|
||||
// On recherche les societes
|
||||
@@ -1353,9 +1362,9 @@ class Form
|
||||
$out .= ajax_combobox($htmlid, $events, $conf->global->CONTACT_USE_SEARCH_TO_SELECT);
|
||||
}
|
||||
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.'" '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
if ($showempty == 1) $out.= '<option value="0"'.($selected=='0'?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.($selected=='0'?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
if ($htmlname != 'none' || $options_only) $out.= '<select class="flat'.($moreclass?' '.$moreclass:'').'" id="'.$htmlid.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.(!empty($moreparam) ? $moreparam : '').'>';
|
||||
if ($showempty == 1 && !$multiple) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'> </option>';
|
||||
if ($showempty == 2) $out.= '<option value="0"'.(in_array(0,$selected)?' selected':'').'>'.$langs->trans("Internal").'</option>';
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
@@ -1363,7 +1372,6 @@ class Form
|
||||
include_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
|
||||
$contactstatic=new Contact($this->db);
|
||||
|
||||
if (!is_array($selected)) $selected = array($selected);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@@ -1413,7 +1421,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.= '<option value="-1"'.($showempty==2?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
|
||||
$out.= '<option value="-1"'.($showempty==2 || $multiple?'':' selected').' disabled>'.$langs->trans($socid?"NoContactDefinedForThirdParty":"NoContactDefined").'</option>';
|
||||
}
|
||||
if ($htmlname != 'none' || $options_only)
|
||||
{
|
||||
@@ -1469,16 +1477,20 @@ class Form
|
||||
* @param string $morecss More css
|
||||
* @param int $noactive Show only active users (this will also happened whatever is this option if USER_HIDE_INACTIVE_IN_COMBOBOX is on).
|
||||
* @param int $outputmode 0=HTML select string, 1=Array
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut
|
||||
* @return string HTML select string
|
||||
* @see select_dolgroups
|
||||
*/
|
||||
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0)
|
||||
function select_dolusers($selected='', $htmlname='userid', $show_empty=0, $exclude=null, $disabled=0, $include='', $enableonly='', $force_entity='0', $maxlength=0, $showstatus=0, $morefilter='', $show_every=0, $enableonlytext='', $morecss='', $noactive=0, $outputmode=0, $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
|
||||
// If no preselected user defined, we take current user
|
||||
if ((is_numeric($selected) && ($selected < -2 || empty($selected))) && empty($conf->global->SOCIETE_DISABLE_DEFAULT_SALESREPRESENTATIVE)) $selected=$user->id;
|
||||
|
||||
if ($selected === '') $selected = array();
|
||||
else if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
$excludeUsers=null;
|
||||
$includeUsers=null;
|
||||
|
||||
@@ -1551,12 +1563,12 @@ class Form
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
// do not use maxwidthonsmartphone by default. Set it by caller so auto size to 100% will work when not defined
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||
if ($show_empty) $out.= '<option value="-1"'.((empty($selected) || $selected==-1)?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.(($selected==-2)?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
$out.= '<select class="flat'.($morecss?' minwidth100 '.$morecss:' minwidth200').'" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
if ($show_empty && !$multiple) $out.= '<option value="-1"'.((empty($selected) || in_array(-1,$selected))?' selected':'').'> </option>'."\n";
|
||||
if ($show_every) $out.= '<option value="-2"'.((in_array(-2,$selected))?' selected':'').'>-- '.$langs->trans("Everybody").' --</option>'."\n";
|
||||
|
||||
$userstatic=new User($this->db);
|
||||
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
@@ -1568,7 +1580,7 @@ class Form
|
||||
$disableline='';
|
||||
if (is_array($enableonly) && count($enableonly) && ! in_array($obj->rowid,$enableonly)) $disableline=($enableonlytext?$enableonlytext:'1');
|
||||
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && in_array($obj->rowid,$selected) ))
|
||||
{
|
||||
$out.= '<option value="'.$obj->rowid.'"';
|
||||
if ($disableline) $out.= ' disabled';
|
||||
@@ -6012,6 +6024,7 @@ class Form
|
||||
// Bypass the default method
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array(
|
||||
'morehtmlright' => $morehtmlright,
|
||||
'compatibleImportElementsList' =>& $compatibleImportElementsList,
|
||||
);
|
||||
$reshook=$hookmanager->executeHooks('showLinkedObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
@@ -6185,7 +6198,7 @@ class Form
|
||||
|
||||
// Can complete the possiblelink array
|
||||
$hookmanager->initHooks(array('commonobject'));
|
||||
$parameters=array();
|
||||
$parameters=array('listofidcompanytoscan' => $listofidcompanytoscan);
|
||||
$reshook=$hookmanager->executeHooks('showLinkToObjectBlock',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
@@ -6233,7 +6246,7 @@ class Form
|
||||
print '</tr>';
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($resqlorderlist);
|
||||
$objp = $this->db->fetch_object($resqllist);
|
||||
|
||||
$var = ! $var;
|
||||
print '<tr ' . $bc [$var] . '>';
|
||||
@@ -6727,10 +6740,11 @@ class Form
|
||||
* @param string $include Array list of groups id to include
|
||||
* @param int $enableonly Array list of groups id to be enabled. All other must be disabled
|
||||
* @param string $force_entity '0' or Ids of environment to force
|
||||
* @param bool $multiple add [] in the name of element and add 'multiple' attribut (not working with ajax_autocompleter)
|
||||
* @return string
|
||||
* @see select_dolusers
|
||||
*/
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0')
|
||||
function select_dolgroups($selected='', $htmlname='groupid', $show_empty=0, $exclude='', $disabled=0, $include='', $enableonly='', $force_entity='0', $multiple=false)
|
||||
{
|
||||
global $conf,$user,$langs;
|
||||
|
||||
@@ -6739,6 +6753,8 @@ class Form
|
||||
// Permettre l'inclusion de groupes
|
||||
if (is_array($include)) $includeGroups = implode("','",$include);
|
||||
|
||||
if (!is_array($selected)) $selected = array($selected);
|
||||
|
||||
$out='';
|
||||
|
||||
// On recherche les groupes
|
||||
@@ -6770,13 +6786,13 @@ class Form
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
|
||||
$out .= ajax_combobox($htmlname);
|
||||
|
||||
$out.= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.'"'.($disabled?' disabled':'').'>';
|
||||
$out.= '<select class="flat minwidth200" id="'.$htmlname.'" name="'.$htmlname.($multiple ? '[]' : '').'" '.($multiple ? 'multiple' : '').' '.($disabled?' disabled':'').'>';
|
||||
|
||||
$num = $this->db->num_rows($resql);
|
||||
$i = 0;
|
||||
if ($num)
|
||||
{
|
||||
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected':'').'> </option>'."\n";
|
||||
if ($show_empty && !$multiple) $out.= '<option value="-1"'.(in_array(-1,$selected)?' selected':'').'> </option>'."\n";
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
@@ -6786,7 +6802,7 @@ class Form
|
||||
|
||||
$out.= '<option value="'.$obj->rowid.'"';
|
||||
if ($disableline) $out.= ' disabled';
|
||||
if ((is_object($selected) && $selected->id == $obj->rowid) || (! is_object($selected) && $selected == $obj->rowid))
|
||||
if ((is_object($selected[0]) && $selected[0]->id == $obj->rowid) || (! is_object($selected[0]) && in_array($obj->rowid,$selected) ))
|
||||
{
|
||||
$out.= ' selected';
|
||||
}
|
||||
@@ -6804,7 +6820,7 @@ class Form
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($show_empty) $out.= '<option value="-1"'.($selected==-1?' selected':'').'></option>'."\n";
|
||||
if ($show_empty) $out.= '<option value="-1"'.(in_array(-1,$selected)?' selected':'').'></option>'."\n";
|
||||
$out.= '<option value="" disabled>'.$langs->trans("NoUserGroupDefined").'</option>';
|
||||
}
|
||||
$out.= '</select>';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/* Copyright (C) 2012-2013 Charles-Fr BENKE <charles.fr@benke.fr>
|
||||
/* Copyright (C) 2012-2018 Charlene BENKE <charlie@patas-monkey.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
|
||||
@@ -57,15 +57,25 @@ class FormContract
|
||||
global $db,$user,$conf,$langs;
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
// Search all contacts
|
||||
$sql = 'SELECT c.rowid, c.ref, c.fk_soc, c.statut';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX .'contrat as c';
|
||||
$sql.= " WHERE c.entity = ".$conf->entity;
|
||||
//if ($contratListId) $sql.= " AND c.rowid IN (".$contratListId.")";
|
||||
if ($socid > 0)
|
||||
{
|
||||
// CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY is 'all' or a list of ids separated by coma.
|
||||
if (empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY))
|
||||
$sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
|
||||
else if ($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY != 'all')
|
||||
{
|
||||
$sql.= " AND (c.fk_soc IN (".$socid.", ".$conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY.") ";
|
||||
$sql.= " OR c.fk_soc IS NULL)";
|
||||
}
|
||||
}
|
||||
if ($socid == 0) $sql.= " AND (c.fk_soc = 0 OR c.fk_soc IS NULL)";
|
||||
if ($socid > 0) $sql.= " AND (c.fk_soc=".$socid." OR c.fk_soc IS NULL)";
|
||||
$sql.= " ORDER BY c.ref ";
|
||||
|
||||
dol_syslog(get_class($this)."::select_contract", LOG_DEBUG);
|
||||
@@ -98,12 +108,12 @@ class FormContract
|
||||
else
|
||||
{
|
||||
$disabled=0;
|
||||
if (! $obj->statut > 0)
|
||||
if ( $obj->statut == 0)
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' ('.$langs->trans("Draft").')';
|
||||
}
|
||||
if ($socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
if ( empty($conf->global->CONTRACT_ALLOW_TO_LINK_FROM_OTHER_COMPANY) && $socid > 0 && (! empty($obj->fk_soc) && $obj->fk_soc != $socid))
|
||||
{
|
||||
$disabled=1;
|
||||
$labeltoshow.=' - '.$langs->trans("LinkedToAnotherCompany");
|
||||
|
||||
@@ -193,7 +193,7 @@ class FormOther
|
||||
print '<option value="'.$obj->rowid.'">';
|
||||
//print '<option onmouseover="showtip(\''.$obj->label.'\')" onMouseout="hidetip()" value="'.$obj->rowid.'">';
|
||||
}
|
||||
$selectOptionValue = $obj->code.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
|
||||
$selectOptionValue = $obj->code.' - '.$obj->label.' : '.price($obj->price).' '.$langs->trans("HT").' ('.$obj->organization.')';
|
||||
print $selectOptionValue;
|
||||
print '</option>';
|
||||
$i++;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (c) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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
|
||||
@@ -139,10 +140,10 @@ class FormProjets
|
||||
if (empty($htmlid)) $htmlid = $htmlname;
|
||||
|
||||
$out='';
|
||||
$outarray=array();
|
||||
$outarray=array();
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
$projectsListId = false;
|
||||
if (empty($user->rights->projet->all->lire))
|
||||
@@ -317,7 +318,7 @@ class FormProjets
|
||||
$out='';
|
||||
|
||||
$hideunselectables = false;
|
||||
if (! empty($conf->global->PROJECT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
if (! empty($conf->global->CONTRACT_HIDE_UNSELECTABLES)) $hideunselectables = true;
|
||||
|
||||
if (empty($projectsListId))
|
||||
{
|
||||
|
||||
@@ -124,61 +124,86 @@ class Menubase
|
||||
else dol_print_error($this->db);
|
||||
}
|
||||
|
||||
// TODO
|
||||
// Check that entry does not exists yet on key menu_handler-fk_menu-position-url-entity, to avoid errors with postgresql
|
||||
$sql = "SELECT count(*)";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."menu";
|
||||
$sql.= " WHERE menu_handler = '".$this->db->escape($this->menu_handler)."'";
|
||||
$sql.= " AND fk_menu = ".((int) $this->db->escape($this->fk_menu));
|
||||
$sql.= " AND position = ".((int) $this->position);
|
||||
$sql.= " AND url = '".$this->db->escape($this->url)."'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
|
||||
$sql.= "menu_handler,";
|
||||
$sql.= "entity,";
|
||||
$sql.= "module,";
|
||||
$sql.= "type,";
|
||||
$sql.= "mainmenu,";
|
||||
$sql.= "leftmenu,";
|
||||
$sql.= "fk_menu,";
|
||||
$sql.= "fk_mainmenu,";
|
||||
$sql.= "fk_leftmenu,";
|
||||
$sql.= "position,";
|
||||
$sql.= "url,";
|
||||
$sql.= "target,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "langs,";
|
||||
$sql.= "perms,";
|
||||
$sql.= "enabled,";
|
||||
$sql.= "usertype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->db->escape($this->menu_handler)."',";
|
||||
$sql.= " '".$this->db->escape($conf->entity)."',";
|
||||
$sql.= " '".$this->db->escape($this->module)."',";
|
||||
$sql.= " '".$this->db->escape($this->type)."',";
|
||||
$sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
|
||||
$sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
|
||||
$sql.= " '".$this->db->escape($this->fk_menu)."',";
|
||||
$sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
|
||||
$sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
|
||||
$sql.= " '".(int) $this->position."',";
|
||||
$sql.= " '".$this->db->escape($this->url)."',";
|
||||
$sql.= " '".$this->db->escape($this->target)."',";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
$sql.= " '".$this->db->escape($this->langs)."',";
|
||||
$sql.= " '".$this->db->escape($this->perms)."',";
|
||||
$sql.= " '".$this->db->escape($this->enabled)."',";
|
||||
$sql.= " '".$this->db->escape($this->user)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
$result=$this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
|
||||
dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
|
||||
$row = $this->db->fetch_row($result);
|
||||
|
||||
return $this->id;
|
||||
if ($row[0] == 0) // If not found
|
||||
{
|
||||
// Insert request
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."menu(";
|
||||
$sql.= "menu_handler,";
|
||||
$sql.= "entity,";
|
||||
$sql.= "module,";
|
||||
$sql.= "type,";
|
||||
$sql.= "mainmenu,";
|
||||
$sql.= "leftmenu,";
|
||||
$sql.= "fk_menu,";
|
||||
$sql.= "fk_mainmenu,";
|
||||
$sql.= "fk_leftmenu,";
|
||||
$sql.= "position,";
|
||||
$sql.= "url,";
|
||||
$sql.= "target,";
|
||||
$sql.= "titre,";
|
||||
$sql.= "langs,";
|
||||
$sql.= "perms,";
|
||||
$sql.= "enabled,";
|
||||
$sql.= "usertype";
|
||||
$sql.= ") VALUES (";
|
||||
$sql.= " '".$this->db->escape($this->menu_handler)."',";
|
||||
$sql.= " '".$this->db->escape($conf->entity)."',";
|
||||
$sql.= " '".$this->db->escape($this->module)."',";
|
||||
$sql.= " '".$this->db->escape($this->type)."',";
|
||||
$sql.= " ".($this->mainmenu?"'".$this->db->escape($this->mainmenu)."'":"''").","; // Can't be null
|
||||
$sql.= " ".($this->leftmenu?"'".$this->db->escape($this->leftmenu)."'":"null").",";
|
||||
$sql.= " ".((int) $this->fk_menu).",";
|
||||
$sql.= " ".($this->fk_mainmenu?"'".$this->db->escape($this->fk_mainmenu)."'":"null").",";
|
||||
$sql.= " ".($this->fk_leftmenu?"'".$this->db->escape($this->fk_leftmenu)."'":"null").",";
|
||||
$sql.= " ".((int) $this->position).",";
|
||||
$sql.= " '".$this->db->escape($this->url)."',";
|
||||
$sql.= " '".$this->db->escape($this->target)."',";
|
||||
$sql.= " '".$this->db->escape($this->titre)."',";
|
||||
$sql.= " '".$this->db->escape($this->langs)."',";
|
||||
$sql.= " '".$this->db->escape($this->perms)."',";
|
||||
$sql.= " '".$this->db->escape($this->enabled)."',";
|
||||
$sql.= " '".$this->db->escape($this->user)."'";
|
||||
$sql.= ")";
|
||||
|
||||
dol_syslog(get_class($this)."::create", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."menu");
|
||||
dol_syslog(get_class($this)."::create record added has rowid=".$this->id, LOG_DEBUG);
|
||||
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::create menu entry already exists", LOG_WARNING);
|
||||
$this->error = 'Error Menu entry already exists';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error="Error ".$this->db->lasterror();
|
||||
return -1;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
/* Copyright (C) 2006-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
|
||||
* Copyright (C) 2016 Gilles Poirier <glgpoirier@gmail.com>
|
||||
* Copyright (C) 2018 charlene Benke <charlie@patas-monkey.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
|
||||
@@ -162,4 +163,23 @@ function fichinter_admin_prepare_head()
|
||||
return $head;
|
||||
}
|
||||
|
||||
function fichinter_rec_prepare_head ($object)
|
||||
{
|
||||
global $langs, $conf; //, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id;
|
||||
$head[$h][1] = $langs->trans("CardFichinter");
|
||||
$head[$h][2] = 'card';
|
||||
$h++;
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h, 'intervention-rec');
|
||||
|
||||
complete_head_from_modules($conf, $langs, $object, $head, $h,'intervention-rec','remove');
|
||||
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
@@ -2782,6 +2782,35 @@ function isValidEmail($address, $acceptsupervisorkey=0)
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if the domain name has a valid MX record.
|
||||
* WARNING: This need function idn_to_ascii, checkdnsrr and getmxrr
|
||||
*
|
||||
* @param string $domain Domain name (Ex: "yahoo.com", "yhaoo.com", "dolibarr.fr")
|
||||
* @return int -1 if error (function not available), 0=Not valid, 1=Valid
|
||||
*/
|
||||
function isValidMXRecord($domain)
|
||||
{
|
||||
if (function_exists('idn_to_ascii') && function_exists('checkdnsrr'))
|
||||
{
|
||||
if (! checkdnsrr(idn_to_ascii($domain), 'MX'))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (function_exists('getmxrr'))
|
||||
{
|
||||
$mxhosts=array();
|
||||
$weight=array();
|
||||
getmxrr(idn_to_ascii($domain), $mxhosts, $weight);
|
||||
if (count($mxhosts) > 1) return 1;
|
||||
if (count($mxhosts) == 1 && ! empty($mxhosts[0])) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if phone number syntax is ok
|
||||
* TODO Decide what to do with this
|
||||
|
||||
@@ -708,9 +708,10 @@ function array2table($data,$tableMarkup=1,$tableoptions='',$troptions='',$tdopti
|
||||
* @param string $mode 'next' for next value or 'last' for last value
|
||||
* @param bool $bentityon Activate the entity filter. Default is true (for modules not compatible with multicompany)
|
||||
* @param User $objuser Object user we need data from.
|
||||
* @param int $forceentity Entity id to force
|
||||
* @return string New value (numeric) or error message
|
||||
*/
|
||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true, $objuser=null)
|
||||
function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$mode='next', $bentityon=true, $objuser=null, $forceentity=null)
|
||||
{
|
||||
global $conf,$user;
|
||||
|
||||
@@ -987,7 +988,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$sql.= " AND ".$field." NOT LIKE '(PROV%)'";
|
||||
if ($bentityon) // only if entity enable
|
||||
$sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||
|
||||
else if (! empty($forceentity))
|
||||
$sql.= " AND entity = ".(int) $forceentity;
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
@@ -1035,6 +1037,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$sql.= " AND ".$field." NOT LIKE '%PROV%'";
|
||||
if ($bentityon) // only if entity enable
|
||||
$sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||
else if (! empty($forceentity))
|
||||
$sql.= " AND entity = ".(int) $forceentity;
|
||||
if ($where) $sql.=$where;
|
||||
if ($sqlwhere) $sql.=' AND '.$sqlwhere;
|
||||
|
||||
@@ -1089,6 +1093,8 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m
|
||||
$maskrefclient_sql.= " WHERE ".$field." LIKE '".$maskrefclient_maskLike."'";
|
||||
if ($bentityon) // only if entity enable
|
||||
$maskrefclient_sql.= " AND entity IN (".getEntity($sharetable).")";
|
||||
else if (! empty($forceentity))
|
||||
$sql.= " AND entity = ".(int) $forceentity;
|
||||
if ($where) $maskrefclient_sql.=$where; //use the same optional where as general mask
|
||||
if ($sqlwhere) $maskrefclient_sql.=' AND '.$sqlwhere; //use the same sqlwhere as general mask
|
||||
$maskrefclient_sql.=' AND (SUBSTRING('.$field.', '.(strpos($maskwithnocode,$maskrefclient)+1).', '.dol_strlen($maskrefclient_maskclientcode).")='".$maskrefclient_clientcode."')";
|
||||
|
||||
@@ -61,3 +61,32 @@ function holiday_prepare_head($object)
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return array head with list of tabs to view object informations
|
||||
*
|
||||
* @return array head
|
||||
*/
|
||||
function holiday_admin_prepare_head()
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = DOL_URL_ROOT.'/admin/holiday.php';
|
||||
$head[$h][1] = $langs->trans("Setup");
|
||||
$head[$h][2] = 'holiday';
|
||||
$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,'holiday_admin');
|
||||
|
||||
complete_head_from_modules($conf,$langs,$object,$head,$h,'holiday_admin','remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,9 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv("Label")), null, 'errors');
|
||||
return -2;
|
||||
}
|
||||
if (! preg_match('/^(integer|date|timestamp|varchar|double|html|price)/', $addfieldentry['type']))
|
||||
|
||||
if (! preg_match('/^(price|boolean|sellist|integer|date|timestamp|varchar|double|text|html)/', $addfieldentry['type']))
|
||||
|
||||
{
|
||||
setEventMessages($langs->trans('BadFormatForType', $objectname), null, 'errors');
|
||||
return -2;
|
||||
@@ -256,11 +258,13 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
|
||||
$type = $val['type'];
|
||||
|
||||
$type = $val['type'];
|
||||
$type = preg_replace('/:.*$/', '', $type); // For case type = 'integer:Societe:societe/class/societe.class.php'
|
||||
|
||||
if ($type == 'html') $type = 'text'; // html modulebuilder type is a text type in database
|
||||
if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
|
||||
else if ($type == 'price') $type = 'double'; // html modulebuilder type is a text type in database
|
||||
else if ($type == 'link' || $type == 'sellist') $type = 'integer';
|
||||
$texttoinsert.= "\t".$key." ".$type;
|
||||
if ($key == 'rowid') $texttoinsert.= ' AUTO_INCREMENT PRIMARY KEY';
|
||||
if ($key == 'entity') $texttoinsert.= ' DEFAULT 1';
|
||||
@@ -269,7 +273,7 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
if ($val['default'] != '')
|
||||
{
|
||||
if (preg_match('/^null$/i', $val['default'])) $texttoinsert.= " DEFAULT NULL";
|
||||
else if (preg_match('/varchar/', $val['type'])) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'";
|
||||
else if (preg_match('/varchar/', $type )) $texttoinsert.= " DEFAULT '".$db->escape($val['default'])."'";
|
||||
else $texttoinsert.= (($val['default'] > 0)?' DEFAULT '.$val['default']:'');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1231,7 +1231,17 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
|
||||
{
|
||||
if ($idprod)
|
||||
{
|
||||
if (empty($hidedesc)) $libelleproduitservice.=$desc;
|
||||
if (empty($hidedesc))
|
||||
{
|
||||
if (!empty($conf->global->MAIN_DOCUMENTS_DESCRIPTION_FIRST))
|
||||
{
|
||||
$libelleproduitservice=$desc."\n".$libelleproduitservice;
|
||||
}
|
||||
else
|
||||
{
|
||||
$libelleproduitservice.=$desc;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -174,11 +174,10 @@ function dol_verifyHash($chain, $hash, $type='0')
|
||||
* @param string $feature2 Feature to check, second level of permission (optional). Can be a 'or' check with 'level1|level2'.
|
||||
* @param string $dbt_keyfield Field name for socid foreign key if not fk_soc. Not used if objectid is null (optional)
|
||||
* @param string $dbt_select Field name for select if not rowid. Not used if objectid is null (optional)
|
||||
* @param Canvas $objcanvas Object canvas
|
||||
* @return int Always 1, die process if not allowed
|
||||
* @see dol_check_secure_access_document
|
||||
*/
|
||||
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $objcanvas=null)
|
||||
function restrictedArea($user, $features, $objectid=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
|
||||
{
|
||||
global $db, $conf;
|
||||
global $hookmanager;
|
||||
@@ -470,13 +469,32 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
||||
{
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
if (($feature == 'user' || $feature == 'usergroup') && ! empty($conf->multicompany->enabled) && $conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
if (($feature == 'user' || $feature == 'usergroup') && ! empty($conf->multicompany->enabled))
|
||||
{
|
||||
$sql.= " AND dbt.entity IS NOT NULL";
|
||||
if (! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE))
|
||||
{
|
||||
if ($conf->entity == 1 && $user->admin && ! $user->entity)
|
||||
{
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND dbt.entity IS NOT NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= ",".MAIN_DB_PREFIX."usergroup_user as ug";
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND (ug.fk_user = dbt.rowid";
|
||||
$sql.= " AND ug.entity IN (".getEntity('user')."))";
|
||||
$sql.= " OR dbt.entity = 0"; // Show always superadmin
|
||||
}
|
||||
}
|
||||
else {
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND dbt.entity IN (".getEntity($sharedelement, 1).")";
|
||||
}
|
||||
}
|
||||
@@ -510,12 +528,12 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
||||
else if (in_array($feature,$checkother)) // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).
|
||||
{
|
||||
// If external user: Check permission for external users
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_select.") as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql.= " WHERE dbt.".$dbt_select." IN (".$objectid.")";
|
||||
$sql.= " AND dbt.fk_soc = ".$user->societe_id;
|
||||
$sql.= " AND dbt.fk_soc = ".$user->socid;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
|
||||
@@ -578,13 +596,13 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
|
||||
else if (! in_array($feature,$nocheck)) // By default (case of $checkdefault), we check on object entity + link to third party on field $dbt_keyfield
|
||||
{
|
||||
// If external user: Check permission for external users
|
||||
if ($user->societe_id > 0)
|
||||
if ($user->socid > 0)
|
||||
{
|
||||
if (empty($dbt_keyfield)) dol_print_error('','Param dbt_keyfield is required but not defined');
|
||||
$sql = "SELECT COUNT(dbt.".$dbt_keyfield.") as nb";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX.$dbtablename." as dbt";
|
||||
$sql.= " WHERE dbt.rowid IN (".$objectid.")";
|
||||
$sql.= " AND dbt.".$dbt_keyfield." = ".$user->societe_id;
|
||||
$sql.= " AND dbt.".$dbt_keyfield." = ".$user->socid;
|
||||
}
|
||||
// If internal user: Check permission for internal users that are restricted on their objects
|
||||
else if (! empty($conf->societe->enabled) && ($user->rights->societe->lire && ! $user->rights->societe->client->voir))
|
||||
|
||||
@@ -122,6 +122,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode
|
||||
if (! empty($conf->propal->enabled)) $menuqualified++;
|
||||
if (! empty($conf->commande->enabled)) $menuqualified++;
|
||||
if (! empty($conf->supplier_order->enabled)) $menuqualified++;
|
||||
if (! empty($conf->supplier_proposal->enabled)) $menuqualified++;
|
||||
if (! empty($conf->contrat->enabled)) $menuqualified++;
|
||||
if (! empty($conf->ficheinter->enabled)) $menuqualified++;
|
||||
$tmpentry=array(
|
||||
@@ -660,11 +661,11 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
}
|
||||
|
||||
// Suppliers
|
||||
if (! empty($conf->societe->enabled) && ! empty($conf->fournisseur->enabled))
|
||||
if (! empty($conf->societe->enabled) && (! empty($conf->fournisseur->enabled) || ! empty($conf->supplier_proposal->enabled)))
|
||||
{
|
||||
$langs->load("suppliers");
|
||||
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, $user->rights->fournisseur->lire, '', $mainmenu, 'suppliers');
|
||||
$newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && $user->rights->fournisseur->lire);
|
||||
$newmenu->add("/societe/list.php?type=f&leftmenu=suppliers", $langs->trans("ListSuppliersShort"), 1, ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire), '', $mainmenu, 'suppliers');
|
||||
$newmenu->add("/societe/card.php?leftmenu=suppliers&action=create&type=f",$langs->trans("MenuNewSupplier"), 2, $user->rights->societe->creer && ($user->rights->fournisseur->lire || $user->rights->supplier_proposal->lire));
|
||||
}
|
||||
|
||||
// Contacts
|
||||
@@ -785,7 +786,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
||||
$newmenu->add("/fichinter/index.php?leftmenu=ficheinter", $langs->trans("Interventions"), 0, $user->rights->ficheinter->lire, '', $mainmenu, 'ficheinter', 2200);
|
||||
$newmenu->add("/fichinter/card.php?action=create&leftmenu=ficheinter", $langs->trans("NewIntervention"), 1, $user->rights->ficheinter->creer, '', '', '', 201);
|
||||
$newmenu->add("/fichinter/list.php?leftmenu=ficheinter", $langs->trans("List"), 1, $user->rights->ficheinter->lire, '', '', '', 202);
|
||||
|
||||
$newmenu->add("/fichinter/card-red.php?leftmenu=ficheinter", $langs->trans("ModelList"), 1, $user->rights->ficheinter->lire, '', '', '', 203);
|
||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->fournisseur->commande->lire);
|
||||
}
|
||||
|
||||
|
||||
@@ -953,7 +953,7 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
$sql.= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($this->const_name)."'";
|
||||
$sql.= " AND entity IN (0, ".$entity.")";
|
||||
|
||||
dol_syslog(get_class($this)."::_active delect activation constant", LOG_DEBUG);
|
||||
dol_syslog(get_class($this)."::_active delete activation constant", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if (! $resql) $err++;
|
||||
|
||||
@@ -1671,55 +1671,58 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
// Search if perm already present
|
||||
$sql = "SELECT count(*) as nb FROM ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " WHERE id = ".$r_id." AND entity = ".$entity;
|
||||
$resqlselect=$this->db->query($sql);
|
||||
|
||||
$obj = $this->db->fetch_object($resqlselect);
|
||||
if ($obj->nb == 0)
|
||||
$resqlselect=$this->db->query($sql);
|
||||
if ($resqlselect)
|
||||
{
|
||||
if (dol_strlen($r_perms) )
|
||||
$objcount = $this->db->fetch_object($resqlselect);
|
||||
if ($objcount && $objcount->nb == 0)
|
||||
{
|
||||
if (dol_strlen($r_subperms) )
|
||||
if (dol_strlen($r_perms) )
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)";
|
||||
$sql.= " VALUES ";
|
||||
$sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')";
|
||||
if (dol_strlen($r_subperms) )
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " (id, entity, libelle, module, type, bydefault, perms, subperms)";
|
||||
$sql.= " VALUES ";
|
||||
$sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."','".$r_subperms."')";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " (id, entity, libelle, module, type, bydefault, perms)";
|
||||
$sql.= " VALUES ";
|
||||
$sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def";
|
||||
$sql.= " (id, entity, libelle, module, type, bydefault, perms)";
|
||||
$sql.= " VALUES ";
|
||||
$sql.= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.",'".$r_perms."')";
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def ";
|
||||
$sql .= " (id, entity, libelle, module, type, bydefault)";
|
||||
$sql .= " VALUES ";
|
||||
$sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."rights_def ";
|
||||
$sql .= " (id, entity, libelle, module, type, bydefault)";
|
||||
$sql .= " VALUES ";
|
||||
$sql .= "(".$r_id.",".$entity.",'".$this->db->escape($r_desc)."','".$r_modul."','".$r_type."',".$r_def.")";
|
||||
}
|
||||
|
||||
$resqlinsert=$this->db->query($sql,1);
|
||||
$resqlinsert=$this->db->query($sql,1);
|
||||
|
||||
if (! $resqlinsert)
|
||||
{
|
||||
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
|
||||
if (! $resqlinsert)
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$err++;
|
||||
break;
|
||||
}
|
||||
else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO);
|
||||
if ($this->db->errno() != "DB_ERROR_RECORD_ALREADY_EXISTS")
|
||||
{
|
||||
$this->error=$this->db->lasterror();
|
||||
$err++;
|
||||
break;
|
||||
}
|
||||
else dol_syslog(get_class($this)."::insert_permissions record already exists", LOG_INFO);
|
||||
|
||||
}
|
||||
|
||||
$this->db->free($resqlinsert);
|
||||
}
|
||||
|
||||
$this->db->free($resqlinsert);
|
||||
$this->db->free($resqlselect);
|
||||
}
|
||||
|
||||
$this->db->free($resqlselect);
|
||||
|
||||
// If we want to init permissions on admin users
|
||||
if ($reinitadminperms)
|
||||
{
|
||||
@@ -1737,23 +1740,33 @@ class DolibarrModules // Can not be abstract, because we need to insta
|
||||
{
|
||||
$obj2=$this->db->fetch_object($resqlseladmin);
|
||||
dol_syslog(get_class($this)."::insert_permissions Add permission to user id=".$obj2->rowid);
|
||||
|
||||
$tmpuser=new User($this->db);
|
||||
$tmpuser->fetch($obj2->rowid);
|
||||
if (!empty($tmpuser->id)) {
|
||||
$result = $tmpuser->fetch($obj2->rowid);
|
||||
if ($result > 0) {
|
||||
$tmpuser->addrights($r_id, '', '', 0, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_syslog(get_class($this)."::insert_permissions Failed to add the permission to user because fetch return an error", LOG_ERR);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
if (! empty($user->admin)) // Reload permission for current user if defined
|
||||
{
|
||||
// We reload permissions
|
||||
$user->clearrights();
|
||||
$user->getrights();
|
||||
}
|
||||
}
|
||||
else dol_print_error($this->db);
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($reinitadminperms && ! empty($user->admin)) // Reload permission for current user if defined
|
||||
{
|
||||
// We reload permissions
|
||||
$user->clearrights();
|
||||
$user->getrights();
|
||||
}
|
||||
|
||||
}
|
||||
$this->db->free($resql);
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetFont('','', $default_font_size - 4);
|
||||
|
||||
|
||||
// Loop on each deposits and credit notes included
|
||||
// Loop on each discount available (deposits and credit notes and excess of payment included)
|
||||
$sql = "SELECT re.rowid, re.amount_ht, re.multicurrency_amount_ht, re.amount_tva, re.multicurrency_amount_tva, re.amount_ttc, re.multicurrency_amount_ttc,";
|
||||
$sql.= " re.description, re.fk_facture_source,";
|
||||
$sql.= " f.type, f.datef";
|
||||
@@ -812,9 +812,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$y+=3;
|
||||
$obj = $this->db->fetch_object($resql);
|
||||
|
||||
if ($obj->type == 2) $text=$outputlangs->trans("CreditNote");
|
||||
elseif ($obj->type == 3) $text=$outputlangs->trans("Deposit");
|
||||
else $text=$outputlangs->trans("UnknownType");
|
||||
if ($obj->type == 2) $text=$outputlangs->transnoentities("CreditNote");
|
||||
elseif ($obj->type == 3) $text=$outputlangs->transnoentities("Deposit");
|
||||
elseif ($obj->type == 0) $text=$outputlangs->transnoentities("ExcessReceived");
|
||||
else $text=$outputlangs->transnoentities("UnknownType");
|
||||
|
||||
$invoice->fetch($obj->fk_facture_source);
|
||||
|
||||
@@ -1304,7 +1305,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
|
||||
$pdf->SetTextColor(0,0,0);
|
||||
|
||||
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
$creditnoteamount=$object->getSumCreditNotesUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0); // Warning, this also include excess received
|
||||
$depositsamount=$object->getSumDepositsUsed(($conf->multicurrency->enabled && $object->multicurrency_tx != 1) ? 1 : 0);
|
||||
//print "x".$creditnoteamount."-".$depositsamount;exit;
|
||||
$resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
|
||||
@@ -1322,9 +1323,10 @@ class pdf_crabe extends ModelePDFFactures
|
||||
// Credit note
|
||||
if ($creditnoteamount)
|
||||
{
|
||||
$labeltouse = ($outputlangs->transnoentities("CreditNotesOrExcessReceived") != "CreditNotesOrExcessReceived") ? $outputlangs->transnoentities("CreditNotesOrExcessReceived") : $outputlangs->transnoentities("CreditNotes");
|
||||
$index++;
|
||||
$pdf->SetXY($col1x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $outputlangs->transnoentities("CreditNotes"), 0, 'L', 0);
|
||||
$pdf->MultiCell($col2x-$col1x, $tab2_hl, $labeltouse, 0, 'L', 0);
|
||||
$pdf->SetXY($col2x, $tab2_top + $tab2_hl * $index);
|
||||
$pdf->MultiCell($largcol2, $tab2_hl, price($creditnoteamount, 0, $outputlangs), 0, 'R', 0);
|
||||
}
|
||||
|
||||
1
htdocs/core/modules/holiday/index.html
Normal file
1
htdocs/core/modules/holiday/index.html
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
132
htdocs/core/modules/holiday/mod_holiday_immaculate.php
Normal file
132
htdocs/core/modules/holiday/mod_holiday_immaculate.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/holiday/mod_holiday_immaculate.php
|
||||
* \ingroup contract
|
||||
* \brief File of class to manage contract numbering rules Magre
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php';
|
||||
|
||||
/**
|
||||
* Class to manage contract numbering rules Magre
|
||||
*/
|
||||
class mod_holiday_immaculate extends ModelNumRefHolidays
|
||||
{
|
||||
var $version='dolibarr';
|
||||
var $error = '';
|
||||
var $nom = 'Immaculate';
|
||||
var $code_auto=1;
|
||||
|
||||
/**
|
||||
* Return default description of numbering model
|
||||
*
|
||||
* @return string text description
|
||||
*/
|
||||
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="maskconstcontract" value="HOLIDAY_IMMACULATE_MASK">';
|
||||
$texte.= '<table class="nobordernopadding" width="100%">';
|
||||
|
||||
$tooltip=$langs->trans("GenericMaskCodes",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes2");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes3");
|
||||
$tooltip.=$langs->trans("GenericMaskCodes4a",$langs->transnoentities("Holiday"),$langs->transnoentities("Holiday"));
|
||||
$tooltip.=$langs->trans("GenericMaskCodes5");
|
||||
|
||||
$texte.= '<tr><td>'.$langs->trans("Mask").':</td>';
|
||||
$texte.= '<td align="right">'.$form->textwithpicto('<input type="text" class="flat" size="24" name="maskholiday" value="'.$conf->global->HOLIDAY_IMMACULATE_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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return numbering example
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $conf,$langs,$user;
|
||||
|
||||
$old_login=$user->login;
|
||||
$user->login='UUUUUUU';
|
||||
$numExample = $this->getNextValue($user, '');
|
||||
$user->login=$old_login;
|
||||
|
||||
if (! $numExample)
|
||||
{
|
||||
$numExample = $langs->trans('NotConfigured');
|
||||
}
|
||||
return $numExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $user user object
|
||||
* @param Object $holiday holiday object
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
function getNextValue($user, $holiday)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
$mask=$conf->global->HOLIDAY_IMMACULATE_MASK;
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
$this->error='NotConfigured';
|
||||
return 0;
|
||||
}
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'holiday','ref','', $user, $holiday->date_create);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param User $fuser User object
|
||||
* @param Object $objforref Holiday object
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
function holiday_get_num($fuser, $objforref)
|
||||
{
|
||||
return $this->getNextValue($fuser, $objforref);
|
||||
}
|
||||
}
|
||||
148
htdocs/core/modules/holiday/mod_holiday_madonna.php
Normal file
148
htdocs/core/modules/holiday/mod_holiday_madonna.php
Normal file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
/* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/holiday/mod_holiday_madonna.php
|
||||
* \ingroup contract
|
||||
* \brief File of class to manage contract numbering rules Serpis
|
||||
*/
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/modules/holiday/modules_holiday.php';
|
||||
|
||||
/**
|
||||
* Class to manage contract numbering rules madonna
|
||||
*/
|
||||
class mod_holiday_madonna extends ModelNumRefHolidays
|
||||
{
|
||||
var $version='dolibarr';
|
||||
var $prefix='HL';
|
||||
var $error='';
|
||||
var $nom='Madonna';
|
||||
var $code_auto=1;
|
||||
|
||||
|
||||
/**
|
||||
* Return default description of numbering model
|
||||
*
|
||||
* @return string text description
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("SimpleNumRefModelDesc",$this->prefix);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return numbering example
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
return $this->prefix."0501-0001";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if existing numbers make problems with numbering
|
||||
*
|
||||
* @return boolean false if conflit, true if ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
global $conf,$langs,$db;
|
||||
|
||||
$coyymm=''; $max='';
|
||||
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$row = $db->fetch_row($resql);
|
||||
if ($row) { $coyymm = substr($row[0],0,6); $max=$row[0]; }
|
||||
}
|
||||
if ($coyymm && ! preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i',$coyymm))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$this->error=$langs->trans('ErrorNumRefModel', $max);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc third party object
|
||||
* @param Object $contract contract object
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
function getNextValue($objsoc,$contract)
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
$posindice=8;
|
||||
$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."holiday";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($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("mod_holiday_madonna::getNextValue", LOG_DEBUG);
|
||||
return -1;
|
||||
}
|
||||
|
||||
$date=$contract->date_contrat;
|
||||
$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("mod_holiday_madonna::getNextValue return ".$this->prefix.$yymm."-".$num);
|
||||
return $this->prefix.$yymm."-".$num;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param User $fuser User object
|
||||
* @param Object $objforref Holiday object
|
||||
* @return string Value if OK, 0 if KO
|
||||
*/
|
||||
function holiday_get_num($fuser,$objforref)
|
||||
{
|
||||
return $this->getNextValue($fuser,$objforref);
|
||||
}
|
||||
|
||||
}
|
||||
146
htdocs/core/modules/holiday/modules_holiday.php
Normal file
146
htdocs/core/modules/holiday/modules_holiday.php
Normal file
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/holiday/modules_holiday.php
|
||||
* \ingroup contract
|
||||
* \brief File with parent class for generating holiday to PDF and File of class to manage contract numbering
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Parent class to manage intervention document templates
|
||||
*/
|
||||
abstract class ModelePDFHoliday 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='contract';
|
||||
$liste=array();
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
$liste=getListOfModels($db,$type,$maxfilenamelength);
|
||||
|
||||
return $liste;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parent class for all contract numbering modules
|
||||
*/
|
||||
class ModelNumRefHolidays
|
||||
{
|
||||
var $error='';
|
||||
|
||||
/**
|
||||
* Return if a module can be used or not
|
||||
*
|
||||
* @return boolean true if module can be used
|
||||
*/
|
||||
function isEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return default description of numbering model
|
||||
*
|
||||
* @return string text description
|
||||
*/
|
||||
function info()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("holidays");
|
||||
return $langs->trans("NoDescription");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return numbering example
|
||||
*
|
||||
* @return string Example
|
||||
*/
|
||||
function getExample()
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("holidays");
|
||||
return $langs->trans("NoExample");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if existing numbers make problems with numbering
|
||||
*
|
||||
* @return boolean false if conflict, true if ok
|
||||
*/
|
||||
function canBeActivated()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return next value
|
||||
*
|
||||
* @param Societe $objsoc third party object
|
||||
* @param Object $contract contract object
|
||||
* @return string Value
|
||||
*/
|
||||
function getNextValue($objsoc, $contract)
|
||||
{
|
||||
global $langs;
|
||||
return $langs->trans("NotAvailable");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return numbering version module
|
||||
*
|
||||
* @return string Value
|
||||
*/
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011 Dimitri Mouillard <dmouillard@teclib.com>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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
|
||||
@@ -69,9 +70,13 @@ class modHoliday extends DolibarrModules
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/mymodule/temp");
|
||||
$this->dirs = array();
|
||||
$this->dirs = array("/holiday/temp");
|
||||
$r=0;
|
||||
|
||||
// Config pages
|
||||
$this->config_page_url = array("holiday.php");
|
||||
|
||||
|
||||
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
|
||||
// $this->config_page_url = array("holiday.php?leftmenu=setup@holiday");
|
||||
|
||||
@@ -87,7 +92,29 @@ class modHoliday extends DolibarrModules
|
||||
// 1=>array('MYMODULE_MYNEWCONST2','chaine','myvalue','This is another constant to add',0) );
|
||||
// 2=>array('MAIN_MODULE_MYMODULE_NEEDSMARTY','chaine',1,'Constant to say module need smarty',0)
|
||||
$this->const = array(); // List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 0 or 'allentities')
|
||||
|
||||
$r=0;
|
||||
|
||||
$this->const[$r][0] = "HOLIDAY_ADDON";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "mod_holiday_madonna";
|
||||
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des congés';
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
$this->const[$r][0] = "HOLIDAY_ADDON_PDF";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "celebrate";
|
||||
$this->const[$r][3] = 'Name of PDF model of holiday';
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
$this->const[$r][0] = "HOLIDAY_ADDON_PDF_ODT_PATH";
|
||||
$this->const[$r][1] = "chaine";
|
||||
$this->const[$r][2] = "DOL_DATA_ROOT/doctemplates/holiday";
|
||||
$this->const[$r][3] = "";
|
||||
$this->const[$r][4] = 0;
|
||||
$r++;
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
$this->tabs[] = array('data'=>'user:+paidholidays:CPTitreMenu:holiday:$user->rights->holiday->read:/holiday/list.php?mainmenu=hrm&id=__ID__'); // To add a new tab identified by code tabname1
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2017 Laurent Destailleur <eldy@users.sourcefore.net>
|
||||
* Copyright (C) 2018 Nicolas ZABOURI <info@inovea-conseil.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
|
||||
@@ -59,7 +60,7 @@ class modModuleBuilder extends DolibarrModules
|
||||
|
||||
// Config pages
|
||||
//-------------
|
||||
$this->config_page_url = array();
|
||||
$this->config_page_url = array('setup@modulebuilder');
|
||||
|
||||
// Dependancies
|
||||
//-------------
|
||||
|
||||
@@ -32,7 +32,7 @@ include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Class to describe and enable module AskPriceSupllier
|
||||
* Class to describe and enable module SupplierProposal
|
||||
*/
|
||||
class modSupplierProposal extends DolibarrModules
|
||||
{
|
||||
@@ -246,7 +246,7 @@ class modSupplierProposal extends DolibarrModules
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array(
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."rights_def WHERE module = 'askpricesupplier'"
|
||||
"DELETE FROM ".MAIN_DB_PREFIX."rights_def WHERE module = 'askpricesupplier'" // To delete/clean deprecated entries
|
||||
);
|
||||
|
||||
return $this->_remove($sql, $options);
|
||||
|
||||
@@ -108,12 +108,15 @@ class mod_propale_marbre extends ModeleNumRefPropales
|
||||
{
|
||||
global $db,$conf;
|
||||
|
||||
// Use object entity ID
|
||||
$entity = ((isset($propal->entity) && is_numeric($propal->entity)) ? $propal->entity : $conf->entity);
|
||||
|
||||
// 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."propal";
|
||||
$sql.= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND entity = ".$entity;
|
||||
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
|
||||
@@ -115,8 +115,14 @@ class mod_propale_saphir extends ModeleNumRefPropales
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT .'/core/lib/functions2.lib.php';
|
||||
|
||||
$constant = 'PROPALE_SAPHIR_MASK_'.$propal->entity;
|
||||
|
||||
// On defini critere recherche compteur
|
||||
$mask=$conf->global->PROPALE_SAPHIR_MASK;
|
||||
if (! empty($conf->global->$constant)) {
|
||||
$mask = $conf->global->$constant; // for multicompany proposal sharing
|
||||
} else {
|
||||
$mask = $conf->global->PROPALE_SAPHIR_MASK;
|
||||
}
|
||||
|
||||
if (! $mask)
|
||||
{
|
||||
@@ -124,9 +130,12 @@ class mod_propale_saphir extends ModeleNumRefPropales
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Use object entity ID
|
||||
$entity = ((isset($propal->entity) && is_numeric($propal->entity)) ? $propal->entity : $conf->entity);
|
||||
|
||||
$date = $propal->date;
|
||||
|
||||
$numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc,$date);
|
||||
$numFinal=get_next_value($db,$mask,'propal','ref','',$objsoc,$date,'next',false,null,$entity);
|
||||
|
||||
return $numFinal;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ print '<script type="text/javascript" language="javascript">
|
||||
} else {
|
||||
$default_template = $advTarget->id;
|
||||
}
|
||||
print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template);
|
||||
print $formadvtargetemaling->selectAdvtargetemailingTemplate('template_id', $default_template,0,$advTarget->type_element);
|
||||
print '<input type="button" name="loadfilter" id="loadfilter" value="' . $langs->trans('AdvTgtLoadFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="deletefilter" id="deletefilter" value="' . $langs->trans('AdvTgtDeleteFilter') . '" class="butAction"/>';
|
||||
print '<input type="button" name="savefilter" id="savefilter" value="' . $langs->trans('AdvTgtSaveFilter') . '" class="butAction"/>';
|
||||
|
||||
@@ -98,7 +98,7 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]
|
||||
//var_dump($action);exit;
|
||||
if ((! empty($action) && ($action == 'create' || $action == 'edit')) && ! empty($extrafields->attributes[$object->table_element]['required'][$key])) print ' fieldrequired';
|
||||
print '">';
|
||||
if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $extrafields->attributes[$object->table_element]['help'][$key]);
|
||||
if (! empty($extrafields->attributes[$object->table_element]['help'][$key])) print $form->textwithpicto($langs->trans($label), $langs->trans($extrafields->attributes[$object->table_element]['help'][$key]));
|
||||
else print $langs->trans($label);
|
||||
print '</td>';
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ elseif ($module == 'shipping') { $permission=$user->rights->expedition->cr
|
||||
elseif ($module == 'product') { $permission=$user->rights->produit->creer;}
|
||||
//else dol_print_error('','Bad value '.$module.' for param module');
|
||||
|
||||
if (! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
if (! empty($conf->fckeditor->enabled) && ! empty($conf->global->FCKEDITOR_ENABLE_SOCIETE)) $typeofdata='ckeditor:dolibarr_notes:100%:200::1:12:95%'; // Rem: This var is for all notes, not only thirdparties note.
|
||||
else $typeofdata='textarea:12:95%';
|
||||
|
||||
print '<!-- BEGIN PHP TEMPLATE NOTES -->'."\n";
|
||||
|
||||
@@ -94,7 +94,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
if ($action == 'ORDER_CLASSIFY_BILLED')
|
||||
{
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
$object->fetchObjectLinked('','propal',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
@@ -123,7 +123,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
// First classify billed the order to allow the proposal classify process
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER))
|
||||
{
|
||||
$object->fetchObjectLinked('','commande',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
@@ -146,7 +146,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
}
|
||||
|
||||
// Second classify billed the proposal.
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
|
||||
if (! empty($conf->propal->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_INVOICE_CLASSIFY_BILLED_PROPAL))
|
||||
{
|
||||
$object->fetchObjectLinked('','propal',$object->id,$object->element);
|
||||
if (! empty($object->linkedObjects))
|
||||
@@ -253,7 +253,7 @@ class InterfaceWorkflowManager extends DolibarrTriggers
|
||||
{
|
||||
dol_syslog( "Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id );
|
||||
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
|
||||
if (! empty($conf->commande->enabled) && ! empty($conf->expedition->enabled) && ! empty($conf->workflow->enabled) && ! empty($conf->global->WORKFLOW_ORDER_CLASSIFY_SHIPPED_SHIPPING))
|
||||
{
|
||||
$qtyshipped=array();
|
||||
$qtyordred=array();
|
||||
|
||||
@@ -80,7 +80,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -93,8 +93,8 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ dol_fiche_end();
|
||||
if ($action != 'create' && $action != 'edit')
|
||||
{
|
||||
print '<div class="tabsAction">';
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "<a class=\"butAction\" href=\"".$_SERVER["PHP_SELF"]."?action=create#newattrib\">".$langs->trans("NewAttribute")."</a>";
|
||||
print "</div>";
|
||||
}
|
||||
|
||||
@@ -94,8 +94,8 @@ if ($action != 'create' && $action != 'edit')
|
||||
|
||||
if ($action == 'create')
|
||||
{
|
||||
print "<br>";
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
print '<br><div id="newattrib"></div>';
|
||||
print load_fiche_titre($langs->trans('NewAttribute'));
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
|
||||
}
|
||||
|
||||
976
htdocs/fichinter/card-rec.php
Normal file
976
htdocs/fichinter/card-rec.php
Normal file
@@ -0,0 +1,976 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
|
||||
* Copyright (C) 2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
|
||||
* Copyright (C) 2016-2018 Charlie Benke <charlie@patas-monkey.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 fichinter/card-rec.php
|
||||
* \ingroup fichinter
|
||||
* \brief Page to show predefined fichinter
|
||||
*/
|
||||
|
||||
$res=0;
|
||||
if (! $res && file_exists("../../main.inc.php"))
|
||||
$res=@include("../../main.inc.php"); // For root directory
|
||||
if (! $res && file_exists("../../../main.inc.php"))
|
||||
$res=@include("../../../main.inc.php"); // For "custom" directory
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinterrec.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/fichinter.lib.php';
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT . '/projet/class/project.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
|
||||
}
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formcontract.class.php';
|
||||
}
|
||||
|
||||
|
||||
$langs->load('bills');
|
||||
$langs->load('compta');
|
||||
$langs->load('admin');
|
||||
$langs->load("interventions");
|
||||
|
||||
// Security check
|
||||
$id=(GETPOST('fichinterid', 'int')?GETPOST('fichinterid', 'int'):GETPOST('id', 'int'));
|
||||
$action=GETPOST('action', 'alpha');
|
||||
if ($user->societe_id) $socid=$user->societe_id;
|
||||
$objecttype = 'fichinter_rec';
|
||||
if ($action == "create" || $action == "add") $objecttype = '';
|
||||
$result = restrictedArea($user, 'ficheinter', $id, $objecttype);
|
||||
|
||||
if ($page == -1)
|
||||
$page = 0 ;
|
||||
|
||||
$limit = GETPOST('limit')?GETPOST('limit', 'int'):$conf->liste_limit;
|
||||
$offset = $limit * $page ;
|
||||
|
||||
if ($sortorder == "")
|
||||
$sortorder="DESC";
|
||||
|
||||
if ($sortfield == "")
|
||||
$sortfield="f.datec";
|
||||
|
||||
$object = new FichinterRec($db);
|
||||
|
||||
|
||||
$arrayfields=array(
|
||||
'f.titre'=>array('label'=>$langs->trans("Ref"), 'checked'=>1),
|
||||
's.nom'=>array('label'=>$langs->trans("ThirdParty"), 'checked'=>1),
|
||||
'f.fk_contrat'=>array('label'=>$langs->trans("Contract"), 'checked'=>1),
|
||||
'f.duree'=>array('label'=>$langs->trans("Duration"), 'checked'=>1),
|
||||
'f.total_ttc'=>array('label'=>$langs->trans("AmountTTC"), 'checked'=>1),
|
||||
'f.frequency'=>array('label'=>$langs->trans("RecurringInvoiceTemplate"), 'checked'=>1),
|
||||
'f.nb_gen_done'=>array('label'=>$langs->trans("NbOfGenerationDone"), 'checked'=>1),
|
||||
'f.date_last_gen'=>array('label'=>$langs->trans("DateLastGeneration"), 'checked'=>1),
|
||||
'f.date_when'=>array('label'=>$langs->trans("NextDateToExecution"), 'checked'=>1),
|
||||
'f.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500),
|
||||
'f.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500),
|
||||
);
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
|
||||
// Create predefined intervention
|
||||
if ($action == 'add') {
|
||||
if (! GETPOST('titre')) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Title")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
if (! GETPOST('socid')) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Customer")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
|
||||
// gestion des fréquences et des échéances
|
||||
$frequency=GETPOST('frequency', 'int');
|
||||
$reyear=GETPOST('reyear');
|
||||
$remonth=GETPOST('remonth');
|
||||
$reday=GETPOST('reday');
|
||||
$rehour=GETPOST('rehour');
|
||||
$remin=GETPOST('remin');
|
||||
$nb_gen_max = (GETPOST('nb_gen_max', 'int')?GETPOST('nb_gen_max', 'int'):0);
|
||||
if (GETPOST('frequency')) {
|
||||
if (empty($reyear) || empty($remonth) || empty($reday)) {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("Date")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
if ($nb_gen_max === '') {
|
||||
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->trans("MaxPeriodNumber")), null, 'errors');
|
||||
$action = "create";
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error) {
|
||||
$object->id_origin = $id;
|
||||
$object->titre = GETPOST('titre', 'alpha');
|
||||
$object->description = GETPOST('description', 'alpha');
|
||||
$object->socid = GETPOST('socid', 'alpha');
|
||||
$object->fk_project = GETPOST('projectid', 'int');
|
||||
$object->fk_contract = GETPOST('contractid', 'int');
|
||||
|
||||
$object->frequency = $frequency;
|
||||
$object->unit_frequency = GETPOST('unit_frequency', 'alpha');
|
||||
$object->nb_gen_max = $nb_gen_max;
|
||||
$object->auto_validate = GETPOST('auto_validate', 'int');
|
||||
|
||||
$date_next_execution = dol_mktime($rehour, $remin, 0, $remonth, $reday, $reyear);
|
||||
$object->date_when = $date_next_execution;
|
||||
|
||||
if ($object->create($user) > 0) {
|
||||
$id = $object->id;
|
||||
$action = '';
|
||||
} else {
|
||||
setEventMessages($object->error, $object->errors, 'errors');
|
||||
$action = "create";
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'createfrommodel') {
|
||||
$newinter = new fichinter($db);
|
||||
|
||||
// on récupère les enregistrements
|
||||
$object->fetch($id);
|
||||
|
||||
|
||||
// on transfert les données de l'un vers l'autre
|
||||
if ($object->socid > 0) {
|
||||
$newinter->socid=$object->socid;
|
||||
$newinter->fk_projet=$object->fk_projet;
|
||||
$newinter->fk_contrat=$object->fk_contrat;
|
||||
} else
|
||||
$newinter->socid=GETPOST("socid");
|
||||
|
||||
$newinter->entity=$object->entity;
|
||||
$newinter->duree=$object->duree;
|
||||
|
||||
$newinter->description=$object->description;
|
||||
$newinter->note_private=$object->note_private;
|
||||
$newinter->note_public=$object->note_public;
|
||||
|
||||
// on créer un nouvelle intervention
|
||||
$extrafields = new ExtraFields($db);
|
||||
$extralabels = $extrafields->fetch_name_optionals_label($newinter->table_element);
|
||||
$array_options = $extrafields->getOptionalsFromPost($extralabels);
|
||||
$newinter->array_options = $array_options;
|
||||
|
||||
$newfichinterid = $newinter->create($user);
|
||||
|
||||
if ($newfichinterid > 0) {
|
||||
// on ajoute les lignes de détail ensuite
|
||||
foreach ($object->lines as $ficheinterligne)
|
||||
$newinter->addline($user, $newfichinterid, $ficheinterligne->desc, "", $ficheinterligne->duree, '');
|
||||
|
||||
// on update le nombre d'inter crée à partir du modèle
|
||||
$object->updateNbGenDone();
|
||||
//on redirige vers la fiche d'intervention nouvellement crée
|
||||
header('Location: '.DOL_URL_ROOT.'/fichinter/card.php?id='.$newfichinterid);
|
||||
exit;
|
||||
} else {
|
||||
setEventMessages($newinter->error, $newinter->errors, 'errors');
|
||||
$action='';
|
||||
}
|
||||
} elseif ($action == 'delete' && $user->rights->ficheinter->supprimer) {
|
||||
// delete modele
|
||||
$object->fetch($id);
|
||||
$object->delete();
|
||||
$id = 0 ;
|
||||
header('Location: '.$_SERVER["PHP_SELF"]);
|
||||
exit;
|
||||
} elseif ($action == 'setfrequency' && $user->rights->ficheinter->creer) {
|
||||
// Set frequency and unit frequency
|
||||
$object->fetch($id);
|
||||
$object->setFrequencyAndUnit(GETPOST('frequency', 'int'), GETPOST('unit_frequency', 'alpha'));
|
||||
} elseif ($action == 'setdate_when' && $user->rights->ficheinter->creer) {
|
||||
// Set next date of execution
|
||||
$object->fetch($id);
|
||||
$date = dol_mktime(
|
||||
GETPOST('date_whenhour'), GETPOST('date_whenmin'), 0,
|
||||
GETPOST('date_whenmonth'), GETPOST('date_whenday'), GETPOST('date_whenyear')
|
||||
);
|
||||
if (!empty($date)) $object->setNextDate($date);
|
||||
} elseif ($action == 'setnb_gen_max' && $user->rights->ficheinter->creer) {
|
||||
// Set max period
|
||||
$object->fetch($id);
|
||||
$object->setMaxPeriod(GETPOST('nb_gen_max', 'int'));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
llxHeader('', $langs->trans("RepeatableInterventional"), 'ch-fichinter.html#s-fac-fichinter-rec');
|
||||
|
||||
$form = new Form($db);
|
||||
$companystatic = new Societe($db);
|
||||
if (! empty($conf->contrat->enabled))
|
||||
$contratstatic = new Contrat($db);
|
||||
if (! empty($conf->projet->enabled))
|
||||
$projectstatic = new Project($db);
|
||||
|
||||
$now = dol_now();
|
||||
$tmparray=dol_getdate($now);
|
||||
$today = dol_mktime(
|
||||
23, 59, 59,
|
||||
$tmparray['mon'], $tmparray['mday'], $tmparray['year']
|
||||
); // Today is last second of current day
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Create mode
|
||||
*/
|
||||
if ($action == 'create') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png');
|
||||
|
||||
$object = new Fichinter($db); // Source invoice
|
||||
//$object = new Managementfichinter($db); // Source invoice
|
||||
|
||||
if ($object->fetch($id, $ref) > 0) {
|
||||
print '<form action="fiche-rec.php" method="post">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="action" value="add">';
|
||||
print '<input type="hidden" name="fichinterid" value="'.$object->id.'">';
|
||||
|
||||
dol_fiche_head();
|
||||
|
||||
$rowspan=4;
|
||||
if (! empty($conf->projet->enabled) && $object->fk_project > 0) $rowspan++;
|
||||
if (! empty($conf->contrat->enabled) && $object->fk_contrat > 0) $rowspan++;
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
// Third party
|
||||
print '<tr><td>'.$langs->trans("Customer").'</td><td>';
|
||||
print $form->select_company($object->thirdparty->id, 'socid', '', 0, 1);
|
||||
|
||||
// .$object->thirdparty->getNomUrl(1,'customer').
|
||||
print '</td><td>';
|
||||
print $langs->trans("Comment");
|
||||
print '</td></tr>';
|
||||
|
||||
// Title
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("Title").'</td><td>';
|
||||
print '<input class="flat" type="text" name="titre" size="24" value="'.$_POST["titre"].'">';
|
||||
print '</td>';
|
||||
|
||||
// Note
|
||||
print '<td rowspan="'.$rowspan.'" valign="top">';
|
||||
print '<textarea class="flat" name="description" wrap="soft" cols="60" rows="'.ROWS_4.'">';
|
||||
print $object->description.'</textarea>';
|
||||
print '</td></tr>';
|
||||
|
||||
// Author
|
||||
print "<tr><td>".$langs->trans("Author")."</td><td>".$user->getFullName($langs)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
||||
// Duration
|
||||
print '<tr><td>'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">'.convertSecondToTime(
|
||||
$object->duration, 'all',
|
||||
$conf->global->MAIN_DURATION_OF_WORKDAY
|
||||
).'</td>';
|
||||
print '</tr>';
|
||||
}
|
||||
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
print "<tr><td>".$langs->trans("Project")."</td><td>";
|
||||
$projectid = GETPOST('projectid')?GETPOST('projectid'):$object->fk_project;
|
||||
|
||||
$numprojet = $formproject->select_projects(
|
||||
$object->thirdparty->id, $projectid, 'projectid',
|
||||
0, 0, 1, 0, 0, 0, 0, '', 0, 0, ''
|
||||
);
|
||||
print ' <a href="'.DOL_URL_ROOT.'/projet/card.php?socid='.$object->thirdparty->id;
|
||||
print '&action=create&status=1&backtopage='.urlencode($_SERVER["PHP_SELF"]).'?action=create';
|
||||
print '&socid='.$object->thirdparty->id.(!empty($id)?'&id='.$id:'').'">';
|
||||
print $langs->trans("AddProject").'</a>';
|
||||
print "</td></tr>";
|
||||
}
|
||||
|
||||
// Contrat
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
$formcontract = new FormContract($db);
|
||||
print "<tr><td>".$langs->trans("Contract")."</td><td>";
|
||||
$contractid = GETPOST('contractid')?GETPOST('contractid'):$object->fk_contract;
|
||||
$numcontract = $formcontract->select_contract($object->thirdparty->id, $contractid, 'contracttid');
|
||||
print "</td></tr>";
|
||||
}
|
||||
print "</table>";
|
||||
|
||||
print '<br><br>';
|
||||
|
||||
/// frequency & duration
|
||||
// Autogeneration
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// Frequency
|
||||
print '<tr><td class="titlefieldcreate">';
|
||||
print $form->textwithpicto($langs->trans("Frequency"), $langs->transnoentitiesnoconv('toolTipFrequency'));
|
||||
print "</td><td>";
|
||||
print "<input type='text' name='frequency' value='".GETPOST('frequency', 'int')."' size='4' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
(GETPOST('unit_frequency')?GETPOST('unit_frequency'):'m')
|
||||
);
|
||||
print "</td></tr>";
|
||||
|
||||
// First date of execution for cron
|
||||
print "<tr><td>".$langs->trans('NextDateToExecution')."</td><td>";
|
||||
if ($date_next_execution != "")
|
||||
$date_next_execution = (GETPOST('remonth') ? dol_mktime(
|
||||
12, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear')
|
||||
) : -1);
|
||||
print $form->select_date($date_next_execution, '', 1, 1, '', "add", 1, 1, 1);
|
||||
print "</td></tr>";
|
||||
|
||||
// Number max of generation
|
||||
print "<tr><td>".$langs->trans("MaxPeriodNumber")."</td><td>";
|
||||
print '<input type="text" name="nb_gen_max" value="'.GETPOST('nb_gen_max').'" size="5" />';
|
||||
print "</td></tr>";
|
||||
|
||||
print "</table>";
|
||||
|
||||
print '<br>';
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
$title = $langs->trans("Products");
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title, '', '');
|
||||
|
||||
/*
|
||||
* Invoice lines
|
||||
*/
|
||||
print '<table class="notopnoleftnoright" width="100%">';
|
||||
print '<tr><td colspan="3">';
|
||||
|
||||
$sql = 'SELECT l.*';
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinterdet as l";
|
||||
$sql.= " WHERE l.fk_fichinter= ".$object->id;
|
||||
$sql.= " AND l.fk_product is null ";
|
||||
$sql.= " ORDER BY l.rang";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result) {
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0; $total = 0;
|
||||
|
||||
echo '<table class="noborder" width="100%">';
|
||||
if ($num) {
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Duration").'</td>';
|
||||
print "</tr>\n";
|
||||
}
|
||||
$var=true;
|
||||
while ($i < $num) {
|
||||
$objp = $db->fetch_object($result);
|
||||
$var=!$var;
|
||||
print "<tr ".$bc[$var].">";
|
||||
|
||||
// Show product and description
|
||||
|
||||
print '<td>';
|
||||
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne
|
||||
|
||||
$text = img_object($langs->trans('Service'), 'service');
|
||||
|
||||
print $text.' '.nl2br($objp->description);
|
||||
|
||||
// Qty
|
||||
print '<td align="center">'.convertSecondToTime($objp->duree).'</td>';
|
||||
print "</tr>";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
|
||||
} else
|
||||
print $db->error();
|
||||
print "</table>";
|
||||
|
||||
print '</td></tr>';
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'">';
|
||||
print ' ';
|
||||
print '<input type="button" class="button" value="'.$langs->trans("Cancel").'" onClick="javascript:history.go(-1)">';
|
||||
print '</div>';
|
||||
print "</form>\n";
|
||||
}
|
||||
else
|
||||
dol_print_error('', "Error, no invoice ".$object->id);
|
||||
|
||||
} elseif ($action == 'selsocforcreatefrommodel') {
|
||||
print load_fiche_titre($langs->trans("CreateRepeatableIntervention"), '', 'title_commercial.png');
|
||||
dol_fiche_head('');
|
||||
|
||||
print '<form name="fichinter" action="'.$_SERVER['PHP_SELF'].'" method="POST">';
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td class="fieldrequired">'.$langs->trans("ThirdParty").'</td><td>';
|
||||
print $form->select_company('', 'socid', '', 1, 1);
|
||||
print '</td></tr>';
|
||||
print '</table>';
|
||||
|
||||
dol_fiche_end();
|
||||
|
||||
print '<div class="center">';
|
||||
print '<input type="hidden" name="action" value="createfrommodel">';
|
||||
print '<input type="hidden" name="id" value="'.$id.'">';
|
||||
print '<input type="submit" class="button" value="'.$langs->trans("CreateDraftIntervention").'">';
|
||||
print '</div>';
|
||||
|
||||
print '</form>';
|
||||
} else {
|
||||
/*
|
||||
* View mode
|
||||
*
|
||||
*/
|
||||
if ($id > 0) {
|
||||
if ($object->fetch($id) > 0) {
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$author = new User($db);
|
||||
$author->fetch($object->user_author);
|
||||
|
||||
$head = fichinter_rec_prepare_head($object);
|
||||
|
||||
dol_fiche_head($head, 'card', $langs->trans("PredefinedInterventional"), 0, 'intervention');
|
||||
|
||||
// Intervention card
|
||||
$linkback = '<a href="card-rec.php">'.$langs->trans("BackToList").'</a>';
|
||||
|
||||
$morehtmlref='<div class="refidno">';
|
||||
// Thirdparty
|
||||
|
||||
$morehtmlref.=$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
|
||||
// Project
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
$formproject = new FormProjets($db);
|
||||
$langs->load("projects");
|
||||
$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if ($action != 'classify') {
|
||||
$morehtmlref.='<a href="'.$_SERVER['PHP_SELF'].'?action=classify&id='.$object->id.'">';
|
||||
$morehtmlref.=img_edit($langs->transnoentitiesnoconv('SetProject')).'</a> : ';
|
||||
}
|
||||
if ($action == 'classify') {
|
||||
|
||||
$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
|
||||
$morehtmlref.='<input type="hidden" name="action" value="classin">';
|
||||
$morehtmlref.='<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
$morehtmlref.=$formproject->select_projects(
|
||||
$object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1
|
||||
);
|
||||
$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
|
||||
$morehtmlref.='</form>';
|
||||
} else {
|
||||
$morehtmlref.=$form->form_project(
|
||||
$_SERVER['PHP_SELF'].'?id='.$object->id,
|
||||
$object->socid, $object->fk_project,
|
||||
'none', 0, 0, 0, 1
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (! empty($object->fk_project)) {
|
||||
$proj = new Project($db);
|
||||
$proj->fetch($object->fk_project);
|
||||
$morehtmlref.='<a href="'.DOL_URL_ROOT.'/projet/card.php?id='.$object->fk_project.'"';
|
||||
$morehtmlref.='title="'.$langs->trans('ShowProject').'">';
|
||||
$morehtmlref.=$proj->ref;
|
||||
$morehtmlref.='</a>';
|
||||
} else {
|
||||
$morehtmlref.='';
|
||||
}
|
||||
}
|
||||
}
|
||||
$morehtmlref.='</div>';
|
||||
|
||||
dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
print '<div class="fichehalfleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
print "<tr><td>".$langs->trans("Author").'</td><td colspan="3">'.$author->getFullName($langs)."</td></tr>";
|
||||
|
||||
if (empty($conf->global->FICHINTER_DISABLE_DETAILS)) {
|
||||
// Duration
|
||||
print '<tr><td class="titlefield">'.$langs->trans("TotalDuration").'</td>';
|
||||
print '<td colspan="3">';
|
||||
print convertSecondToTime($object->duration, 'all', $conf->global->MAIN_DURATION_OF_WORKDAY);
|
||||
print '</td></tr>';
|
||||
}
|
||||
|
||||
print '<tr><td>'.$langs->trans("Description").'</td><td colspan="3">'.nl2br($object->description)."</td></tr>";
|
||||
|
||||
// Contrat
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
$langs->load('contrat');
|
||||
print '<tr>';
|
||||
print '<td>';
|
||||
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Contract');
|
||||
print '</td>';
|
||||
if ($action != 'contrat') {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=contrat&id='.$object->id.'">';
|
||||
print img_edit($langs->trans('SetContract'), 1);
|
||||
print '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'contrat') {
|
||||
$formcontract= new Formcontract($db);
|
||||
$formcontract->formSelectContract(
|
||||
$_SERVER["PHP_SELF"].'?id='.$object->id, $object->socid,
|
||||
$object->fk_contrat, 'contratid', 0, 1
|
||||
);
|
||||
} else {
|
||||
if ($object->fk_contrat) {
|
||||
$contratstatic = new Contrat($db);
|
||||
$contratstatic->fetch($object->fk_contrat);
|
||||
print $contratstatic->getNomUrl(0, '', 1);
|
||||
} else
|
||||
print " ";
|
||||
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
}
|
||||
print "</table>";
|
||||
print '</div>';
|
||||
|
||||
print '<div class="fichehalfright">';
|
||||
print '<div class="ficheaddleft">';
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
$title = $langs->trans("Recurrence");
|
||||
print load_fiche_titre($title, '', 'calendar');
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
// if "frequency" is empty or = 0, the reccurence is disabled
|
||||
print '<tr><td style="width: 50%">';
|
||||
print '<table class="nobordernopadding" width="100%"><tr><td>';
|
||||
print $langs->trans('Frequency');
|
||||
print '</td>';
|
||||
if ($action != 'editfrequency' && $user->rights->ficheinter->creer) {
|
||||
print '<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=editfrequency&id='.$id.'">';
|
||||
print img_edit($langs->trans('Edit'), 1) . '</a></td>';
|
||||
}
|
||||
print '</tr></table>';
|
||||
print '</td><td>';
|
||||
if ($action == 'editfrequency') {
|
||||
print '<form method="post" action="'.$_SERVER["PHP_SELF"] . '?id=' . $object->id.'">';
|
||||
print '<input type="hidden" name="action" value="setfrequency">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<table class="nobordernopadding" cellpadding="0" cellspacing="0">';
|
||||
print '<tr><td>';
|
||||
print "<input type='text' name='frequency' value='".$object->frequency."' size='5' /> ";
|
||||
print $form->selectarray(
|
||||
'unit_frequency',
|
||||
array('d'=>$langs->trans('Day'), 'm'=>$langs->trans('Month'), 'y'=>$langs->trans('Year')),
|
||||
($object->unit_frequency?$object->unit_frequency:'m')
|
||||
);
|
||||
print '</td>';
|
||||
print '<td align="left"><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td>';
|
||||
print '</tr></table></form>';
|
||||
} else {
|
||||
if ($object->frequency > 0)
|
||||
print $langs->trans('FrequencyPer_'.$object->unit_frequency, $object->frequency);
|
||||
else
|
||||
print $langs->trans("NotARecurringInterventionalTemplate");
|
||||
}
|
||||
print '</td></tr>';
|
||||
|
||||
// Date when
|
||||
print '<tr><td>';
|
||||
if ( $user->rights->ficheinter->creer && ($action == 'date_when' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
} else {
|
||||
print $langs->trans("NextDateToExecution");
|
||||
}
|
||||
print '</td><td>';
|
||||
if ($action == 'date_when' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("NextDateToExecution"), 'date_when', $object->date_when,
|
||||
$object, $user->rights->facture->creer, 'day'
|
||||
);
|
||||
}
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Max period / Rest period
|
||||
print '<tr><td>';
|
||||
if ($user->rights->ficheinter->creer && ($action == 'nb_gen_max' || $object->frequency > 0)) {
|
||||
print $form->editfieldkey(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max,
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
} else
|
||||
print $langs->trans("MaxPeriodNumber");
|
||||
|
||||
print '</td><td>';
|
||||
if ($action == 'nb_gen_max' || $object->frequency > 0) {
|
||||
print $form->editfieldval(
|
||||
$langs->trans("MaxPeriodNumber"), 'nb_gen_max', $object->nb_gen_max?$object->nb_gen_max:'',
|
||||
$object, $user->rights->facture->creer
|
||||
);
|
||||
}
|
||||
else
|
||||
print '';
|
||||
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
print '</table>';
|
||||
|
||||
// Frequencry/Recurring section
|
||||
if ($object->frequency > 0) {
|
||||
print '<br>';
|
||||
if (empty($conf->cron->enabled)) {
|
||||
$txtinfoadmin=$langs->trans(
|
||||
"EnableAndSetupModuleCron",
|
||||
$langs->transnoentitiesnoconv("Module2300Name")
|
||||
);
|
||||
print info_admin($txtinfoadmin);
|
||||
}
|
||||
print '<div class="underbanner clearboth"></div>';
|
||||
print '<table class="border centpercent">';
|
||||
|
||||
// Nb of generation already done
|
||||
print '<tr><td style="width: 50%">'.$langs->trans("NbOfGenerationDone").'</td>';
|
||||
print '<td>';
|
||||
print $object->nb_gen_done?$object->nb_gen_done:'0';
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
|
||||
// Date last
|
||||
print '<tr><td>';
|
||||
print $langs->trans("DateLastGeneration");
|
||||
print '</td><td>';
|
||||
print dol_print_date($object->date_last_gen, 'dayhour');
|
||||
print '</td>';
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
print '</div>';
|
||||
|
||||
print '<div class="clearboth"></div><br>';
|
||||
|
||||
/*
|
||||
* Lines
|
||||
*/
|
||||
|
||||
$title = $langs->trans("ProductsAndServices");
|
||||
if (empty($conf->service->enabled))
|
||||
$title = $langs->trans("Products");
|
||||
else if (empty($conf->product->enabled))
|
||||
$title = $langs->trans("Services");
|
||||
|
||||
print load_fiche_titre($title);
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td align="center">'.$langs->trans("Duration").'</td>';
|
||||
print '</tr>';
|
||||
|
||||
$num = count($object->lines);
|
||||
$i = 0;
|
||||
$var=true;
|
||||
while ($i < $num) {
|
||||
$var=!$var;
|
||||
|
||||
// Show product and description
|
||||
if (isset($object->lines[$i]->product_type))
|
||||
$type=$object->lines[$i]->product_type;
|
||||
else
|
||||
$object->lines[$i]->fk_product_type;
|
||||
// Try to enhance type detection using date_start and date_end for free lines when type
|
||||
// was not saved.
|
||||
if (! empty($objp->date_start)) $type=1;
|
||||
if (! empty($objp->date_end)) $type=1;
|
||||
|
||||
// Show line
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td>';
|
||||
$text = img_object($langs->trans('Service'), 'service');
|
||||
print $text.' '.nl2br($object->lines[$i]->desc);
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">'.convertSecondToTime($object->lines[$i]->duree).'</td>';
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
print '</table>';
|
||||
|
||||
/**
|
||||
* Barre d'actions
|
||||
*/
|
||||
print '<div class="tabsAction">';
|
||||
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel';
|
||||
print '&socid='.$object->thirdparty->id.'&id='.$object->id.'">';
|
||||
print $langs->trans("CreateFichInter").'</a></div>';
|
||||
}
|
||||
|
||||
if ($user->rights->ficheinter->supprimer) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?action=delete&id='.$object->id.'">';
|
||||
print $langs->trans('Delete').'</a></div>';
|
||||
}
|
||||
print '</div>';
|
||||
} else
|
||||
print $langs->trans("ErrorRecordNotFound");
|
||||
|
||||
} else {
|
||||
/*
|
||||
* List mode
|
||||
*/
|
||||
$sql = "SELECT f.rowid as fich_rec, s.nom as name, s.rowid as socid, f.rowid as facid, f.titre, ";
|
||||
$sql.= " f.duree, f.fk_contrat, f.fk_projet, f.frequency, f.nb_gen_done, f.nb_gen_max,";
|
||||
$sql.= " f.date_last_gen, f.date_when, f.datec";
|
||||
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."fichinter_rec as f";
|
||||
$sql.= " , ".MAIN_DB_PREFIX."societe as s ";
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " , ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
}
|
||||
$sql.= " WHERE f.fk_soc = s.rowid";
|
||||
$sql.= " AND f.entity = ".$conf->entity;
|
||||
if ($socid) $sql .= " AND s.rowid = ".$socid;
|
||||
if (! $user->rights->societe->client->voir && ! $socid) {
|
||||
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id;
|
||||
}
|
||||
if ($search_ref) $sql .= natural_search('f.titre', $search_ref);
|
||||
if ($search_societe) $sql .= natural_search('s.nom', $search_societe);
|
||||
if ($search_frequency == '1') $sql.= ' AND f.frequency > 0';
|
||||
if ($search_frequency == '0') $sql.= ' AND (f.frequency IS NULL or f.frequency = 0)';
|
||||
|
||||
|
||||
//$sql .= " ORDER BY $sortfield $sortorder, rowid DESC ";
|
||||
// $sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$num = $db->num_rows($resql);
|
||||
print_barre_liste(
|
||||
$langs->trans("RepeatableInterventional"), $page,
|
||||
$_SERVER['PHP_SELF'], "&socid=$socid", $sortfield, $sortorder,
|
||||
'', $num, '', 'title_commercial.png'
|
||||
);
|
||||
|
||||
print $langs->trans("ToCreateAPredefinedInterventional").'<br><br>';
|
||||
|
||||
$i = 0;
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Ref"), $_SERVER['PHP_SELF'], "f.titre", "", "",
|
||||
'width="200px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Company"), $_SERVER['PHP_SELF'], "s.nom", "", "",
|
||||
'width="200px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
if (! empty($conf->contrat->enabled))
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Contract"), $_SERVER['PHP_SELF'],
|
||||
"f.fk_contrat", "", "",
|
||||
'width="100px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
if (! empty($conf->projet->enabled))
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Project"), $_SERVER['PHP_SELF'],
|
||||
"f.fk_project", "", "",
|
||||
'width="100px" align="left"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Duration"), $_SERVER['PHP_SELF'],
|
||||
'f.duree', '', '',
|
||||
'width="50px" align="right"', $sortfiled, $sortorder
|
||||
);
|
||||
// Recurring or not
|
||||
print_liste_field_titre(
|
||||
$langs->trans("Frequency"), $_SERVER['PHP_SELF'],
|
||||
"f.frequency", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("NbOfGenerationDone"), $_SERVER['PHP_SELF'],
|
||||
"f.nb_gen_done", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
|
||||
print_liste_field_titre(
|
||||
$langs->trans("DateLastGeneration"), $_SERVER['PHP_SELF'],
|
||||
"f.date_last_gen", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print_liste_field_titre(
|
||||
$langs->trans("NextDateToIntervention"), $_SERVER['PHP_SELF'],
|
||||
"f.date_when", "", "",
|
||||
'width="100px" align="center"', $sortfiled, $sortorder
|
||||
);
|
||||
print '<th width="100px"></th>';
|
||||
print "</tr>\n";
|
||||
|
||||
|
||||
// les filtres à faire ensuite
|
||||
|
||||
if ($num > 0) {
|
||||
$var=true;
|
||||
while ($i < min($num, $limit)) {
|
||||
$objp = $db->fetch_object($resql);
|
||||
$var=!$var;
|
||||
|
||||
print "<tr ".$bc[$var].">";
|
||||
print '<td><a href="'.$_SERVER['PHP_SELF'].'?id='.$objp->fich_rec.'">';
|
||||
print img_object($langs->trans("ShowIntervention"), "intervention").' '.$objp->titre;
|
||||
print "</a></td>\n";
|
||||
if ($objp->socid) {
|
||||
$companystatic->id=$objp->socid;
|
||||
$companystatic->name=$objp->name;
|
||||
print '<td>'.$companystatic->getNomUrl(1, 'customer').'</td>';
|
||||
} else
|
||||
print '<td>'.$langs->trans("None").'</td>';
|
||||
|
||||
if (! empty($conf->contrat->enabled)) {
|
||||
print '<td>';
|
||||
if ($objp->fk_contrat >0) {
|
||||
$contratstatic->fetch($objp->fk_contrat);
|
||||
print $contratstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
if (! empty($conf->projet->enabled)) {
|
||||
print '<td>';
|
||||
if ($objp->fk_project >0) {
|
||||
$projectstatic->fecth($objp->fk_projet);
|
||||
print $projectstatic->getNomUrl(1);
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
print '<td align=right>'.convertSecondToTime($objp->duree).'</td>';
|
||||
|
||||
print '<td align="center">'.yn($objp->frequency?1:0).'</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
if ($objp->frequency) {
|
||||
print $objp->nb_gen_done.($objp->nb_gen_max>0?' / '. $objp->nb_gen_max:'') ;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_last_gen), 'day') ;
|
||||
print '</td>';
|
||||
|
||||
print '<td align="center">';
|
||||
print dol_print_date($db->jdate($objp->date_when), 'day');
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
print '<td align="center">';
|
||||
print '<span class="opacitymedium">'.$langs->trans('NA').'</span>';
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
// Action column
|
||||
print '<td align="center">';
|
||||
if ($user->rights->ficheinter->creer) {
|
||||
if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today) {
|
||||
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?action=createfrommodel';
|
||||
print '&socid='.$objp->socid.'&id='.$objp->fich_rec.'">';
|
||||
print $langs->trans("CreateFichInter").'</a>';
|
||||
} else
|
||||
print $langs->trans("DateIsNotEnough");
|
||||
} else
|
||||
print " ";
|
||||
|
||||
print "</td>";
|
||||
|
||||
print "</tr>\n";
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
} else
|
||||
print '<tr '.$bc[false].'><td colspan="6">'.$langs->trans("NoneF").'</td></tr>';
|
||||
|
||||
print "</table>";
|
||||
$db->free($resql);
|
||||
} else
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
llxFooter();
|
||||
$db->close();
|
||||
@@ -1,11 +1,11 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2015 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2005-2018 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2011-2017 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
* Copyright (C) 2014-2018 Ferran Marcet <fmarcet@2byte.es>
|
||||
* Copyright (C) 2014-2015 Charlie Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2014-2018 Charlene Benke <charlies@patas-monkey.com>
|
||||
* Copyright (C) 2015-2016 Abbes Bahfir <bafbes@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -1643,6 +1643,13 @@ else if ($id > 0 || ! empty($ref))
|
||||
else print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
// create interventional model
|
||||
if ($object->statut == Fichinter::STATUS_DRAFT && $user->rights->ficheinter->creer && (count($object->lines) > 0)) {
|
||||
print '<div class="inline-block divButAction">';
|
||||
print '<a class="butAction" href="'.DOL_URL_ROOT.'/fichinter/card-rec.php?id='.$object->id.'&action=create">'.$langs->trans("ChangeIntoRepeatableInterventional").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
|
||||
// Proposal
|
||||
if ($conf->service->enabled && ! empty($conf->propal->enabled) && $object->statut > Fichinter::STATUS_DRAFT)
|
||||
{
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr');
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','8.0.0-beta'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
if (! defined('DOL_VERSION')) define('DOL_VERSION','9.0.0-alpha'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c
|
||||
|
||||
if (! defined('EURO')) define('EURO',chr(128));
|
||||
|
||||
|
||||
@@ -1761,11 +1761,13 @@ elseif (! empty($object->id))
|
||||
$langs->load("stocks");
|
||||
require_once DOL_DOCUMENT_ROOT.'/product/class/html.formproduct.class.php';
|
||||
$formproduct=new FormProduct($db);
|
||||
$forcecombo=0;
|
||||
if ($conf->browser->name == 'ie') $forcecombo = 1; // There is a bug in IE10 that make combo inside popup crazy
|
||||
$formquestion=array(
|
||||
//'text' => $langs->trans("ConfirmClone"),
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse'),'idwarehouse','',1))
|
||||
//'text' => $langs->trans("ConfirmClone"),
|
||||
//array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
|
||||
//array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
|
||||
array('type' => 'other', 'name' => 'idwarehouse', 'label' => $langs->trans("SelectWarehouseForStockIncrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse','int'), 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
|
||||
);
|
||||
}
|
||||
$text=$langs->trans("ConfirmApproveThisOrder",$object->ref);
|
||||
|
||||
@@ -492,7 +492,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, SUM(l.qty) as qty,";
|
||||
$sql = "SELECT l.rowid, l.fk_product, l.subprice, l.remise_percent, l.ref AS sref, SUM(l.qty) as qty,";
|
||||
$sql .= " p.ref, p.label, p.tobatch, p.fk_default_warehouse";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "commande_fournisseurdet as l";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "product as p ON l.fk_product=p.rowid";
|
||||
@@ -514,6 +514,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td></td>';
|
||||
print '<td align="right">' . $langs->trans("SupplierRef") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyOrdered") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyDispatchedShort") . '</td>';
|
||||
print '<td align="right">' . $langs->trans("QtyToDispatchShort") . '</td>';
|
||||
@@ -590,6 +591,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
if (! empty($objp->remise_percent) && empty($conf->global->STOCK_EXCLUDE_DISCOUNT_FOR_PMP))
|
||||
$up_ht_disc = price2num($up_ht_disc * (100 - $objp->remise_percent) / 100, 'MU');
|
||||
|
||||
// Supplier ref
|
||||
print '<td align="right">'.$objp->sref.'</td>';
|
||||
|
||||
// Qty ordered
|
||||
print '<td align="right">' . $objp->qty . '</td>';
|
||||
|
||||
|
||||
@@ -39,34 +39,33 @@ require_once DOL_DOCUMENT_ROOT.'/holiday/class/holiday.class.php';
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array('users', 'holidays', 'trips'));
|
||||
|
||||
$socid=GETPOST("socid");
|
||||
$socid=GETPOST("socid","int");
|
||||
|
||||
// Protection if external user
|
||||
if ($user->societe_id > 0) accessforbidden();
|
||||
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled) && ! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$holiday = new Holiday($db);
|
||||
$holidaystatic=new Holiday($db);
|
||||
|
||||
// Update sold
|
||||
if (! empty($conf->holiday->enabled))
|
||||
{
|
||||
$result = $holiday->updateBalance();
|
||||
}
|
||||
|
||||
$childids = $user->getAllChildIds();
|
||||
$childids[]=$user->id;
|
||||
|
||||
@@ -75,13 +74,13 @@ llxHeader('', $langs->trans('HRMArea'));
|
||||
print load_fiche_titre($langs->trans("HRMArea"),'', 'title_hrm.png');
|
||||
|
||||
|
||||
if (empty($conf->global->MAIN_INFO_SOCIETE_NOM) || empty($conf->global->MAIN_INFO_SOCIETE_COUNTRY)) $setupcompanynotcomplete=1;
|
||||
if (! empty($setupcompanynotcomplete))
|
||||
{
|
||||
$langs->load("errors");
|
||||
$warnpicto=img_warning($langs->trans("WarningMandatorySetupNotComplete"));
|
||||
print '<br><div class="warning"><a href="'.DOL_URL_ROOT.'/admin/company.php?mainmenu=home'.(empty($setupcompanynotcomplete)?'':'&action=edit').'">'.$warnpicto.' '.$langs->trans("WarningMandatorySetupNotComplete").'</a></div>';
|
||||
|
||||
llxFooter();
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ foreach($valid_dashboardlines as $board)
|
||||
}
|
||||
}
|
||||
//var_dump($totallate, $totaltodo);
|
||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||
if(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) && !empty($totaltodo)) $totallate = round($totallate / $totaltodo * 100, 2);
|
||||
//var_dump($totallate);
|
||||
$boxwork='';
|
||||
$boxwork.='<div class="box">';
|
||||
@@ -539,7 +539,8 @@ if ($showweather)
|
||||
$boxwork.='<td class="nohover hideonsmartphone center valignmiddle">';
|
||||
$text='';
|
||||
if ($totallate > 0) $text=$langs->transnoentitiesnoconv("WarningYouHaveAtLeastOneTaskLate").' ('.$langs->transnoentitiesnoconv("NActionsLate",$totallate.(!empty($conf->global->MAIN_USE_METEO_WITH_PERCENTAGE) ? '%' : '')).')';
|
||||
$text.='. '.$langs->trans("LateDesc");
|
||||
else $text=$langs->transnoentitiesnoconv("NoItemLate");
|
||||
$text.='. '.$langs->transnoentitiesnoconv("LateDesc");
|
||||
//$text.=$form->textwithpicto('',$langs->trans("LateDesc"));
|
||||
$options='height="64px"';
|
||||
$boxwork.=showWeather($totallate,$text,$options);
|
||||
|
||||
@@ -436,7 +436,8 @@ else
|
||||
array('from'=>'4.0.0', 'to'=>'5.0.0'),
|
||||
array('from'=>'5.0.0', 'to'=>'6.0.0'),
|
||||
array('from'=>'6.0.0', 'to'=>'7.0.0'),
|
||||
array('from'=>'7.0.0', 'to'=>'8.0.0')
|
||||
array('from'=>'7.0.0', 'to'=>'8.0.0'),
|
||||
array('from'=>'8.0.0', 'to'=>'9.0.0')
|
||||
);
|
||||
|
||||
$count=0;
|
||||
|
||||
@@ -174,7 +174,7 @@ if (preg_match('/install\.lock/i',$_SERVER["SCRIPT_FILENAME"]))
|
||||
{
|
||||
if (! is_object($langs))
|
||||
{
|
||||
$langs = new Translate('..');
|
||||
$langs = new Translate('..', $conf);
|
||||
$langs->setDefaultLang('auto');
|
||||
}
|
||||
$langs->load("install");
|
||||
@@ -198,7 +198,7 @@ if (@file_exists($lockfile))
|
||||
{
|
||||
if (! is_object($langs))
|
||||
{
|
||||
$langs = new Translate('..');
|
||||
$langs = new Translate('..', $conf);
|
||||
$langs->setDefaultLang('auto');
|
||||
}
|
||||
$langs->load("install");
|
||||
|
||||
@@ -298,6 +298,7 @@ ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website);
|
||||
|
||||
ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
|
||||
|
||||
@@ -466,15 +467,18 @@ ALTER TABLE llx_extrafields ADD COLUMN enabled varchar(255) DEFAULT '1';
|
||||
ALTER TABLE llx_extrafields ADD COLUMN tms timestamp;
|
||||
|
||||
-- We fix value of 'list' from 0 to 1 for all extrafields created before this migration
|
||||
UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||
UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list != 3;
|
||||
--VMYSQL4.1 UPDATE llx_extrafields SET list = 1 WHERE list = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||
--VMYSQL4.1 UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list <> 3;
|
||||
--VPGSQL8.2 UPDATE llx_extrafields SET list = 1 WHERE list::integer = 0 AND fk_user_author IS NULL and fk_user_modif IS NULL and datec IS NULL;
|
||||
--VPGSQL8.2 UPDATE llx_extrafields SET list = 3 WHERE type = 'separate' AND list::integer <> 3;
|
||||
|
||||
ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
|
||||
--VMYSQL4.1 ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1;
|
||||
--VPGSQL8.2 ALTER TABLE llx_extrafields MODIFY COLUMN list integer DEFAULT 1 USING list::integer;
|
||||
--VPGSQL8.2 ALTER TABLE llx_extrafields ALTER COLUMN list SET DEFAULT 1;
|
||||
|
||||
ALTER TABLE llx_extrafields MODIFY COLUMN langs varchar(64);
|
||||
|
||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128);
|
||||
ALTER TABLE llx_holiday_config MODIFY COLUMN name varchar(128) NOT NULL;
|
||||
ALTER TABLE llx_holiday_config ADD UNIQUE INDEX idx_holiday_config (name);
|
||||
|
||||
ALTER TABLE llx_societe MODIFY COLUMN ref_ext varchar(255);
|
||||
@@ -670,9 +674,9 @@ ALTER TABLE llx_blockedlog ADD COLUMN user_fullname varchar(255);
|
||||
ALTER TABLE llx_blockedlog MODIFY COLUMN ref_object varchar(255);
|
||||
|
||||
-- SPEC : use database type 'double' to store monetary values
|
||||
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8);
|
||||
ALTER TABLE llx_blockedlog MODIFY COLUMN amounts double(24,8) NOT NULL;
|
||||
ALTER TABLE llx_chargessociales MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8);
|
||||
ALTER TABLE llx_commande MODIFY COLUMN amount_ht double(24,8) default 0;
|
||||
ALTER TABLE llx_commande_fournisseur MODIFY COLUMN amount_ht double(24,8);
|
||||
ALTER TABLE llx_don MODIFY COLUMN amount double(24,8);
|
||||
ALTER TABLE llx_expensereport_rules MODIFY COLUMN amount double(24,8);
|
||||
|
||||
39
htdocs/install/mysql/migration/8.0.0-9.0.0.sql
Normal file
39
htdocs/install/mysql/migration/8.0.0-9.0.0.sql
Normal file
@@ -0,0 +1,39 @@
|
||||
--
|
||||
-- Be carefull to requests order.
|
||||
-- This file must be loaded by calling /install/index.php page
|
||||
-- when current version is 8.0.0 or higher.
|
||||
--
|
||||
-- To restrict request to Mysql version x.y minimum use -- VMYSQLx.y
|
||||
-- To restrict request to Pgsql version x.y minimum use -- VPGSQLx.y
|
||||
-- To rename a table: ALTER TABLE llx_table RENAME TO llx_table_new;
|
||||
-- To add a column: ALTER TABLE llx_table ADD COLUMN newcol varchar(60) NOT NULL DEFAULT '0' AFTER existingcol;
|
||||
-- To rename a column: ALTER TABLE llx_table CHANGE COLUMN oldname newname varchar(60);
|
||||
-- To drop a column: ALTER TABLE llx_table DROP COLUMN oldname;
|
||||
-- To change type of field: ALTER TABLE llx_table MODIFY COLUMN name varchar(60);
|
||||
-- To drop a foreign key: ALTER TABLE llx_table DROP FOREIGN KEY fk_name;
|
||||
-- To create a unique index ALTER TABLE llx_table ADD UNIQUE INDEX uk_table_field (field);
|
||||
-- To drop an index: -- VMYSQL4.1 DROP INDEX nomindex on llx_table
|
||||
-- To drop an index: -- VPGSQL8.2 DROP INDEX nomindex
|
||||
-- To make pk to be auto increment (mysql): -- VMYSQL4.3 ALTER TABLE llx_table CHANGE COLUMN rowid rowid INTEGER NOT NULL AUTO_INCREMENT;
|
||||
-- To make pk to be auto increment (postgres):
|
||||
-- -- VPGSQL8.2 CREATE SEQUENCE llx_table_rowid_seq OWNED BY llx_table.rowid;
|
||||
-- -- VPGSQL8.2 ALTER TABLE llx_table ADD PRIMARY KEY (rowid);
|
||||
-- -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN rowid SET DEFAULT nextval('llx_table_rowid_seq');
|
||||
-- -- VPGSQL8.2 SELECT setval('llx_table_rowid_seq', MAX(rowid)) FROM llx_table;
|
||||
-- To set a field as NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NULL;
|
||||
-- To set a field as NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name DROP NOT NULL;
|
||||
-- To set a field as NOT NULL: -- VMYSQL4.3 ALTER TABLE llx_table MODIFY COLUMN name varchar(60) NOT NULL;
|
||||
-- To set a field as NOT NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET NOT NULL;
|
||||
-- To set a field as default NULL: -- VPGSQL8.2 ALTER TABLE llx_table ALTER COLUMN name SET DEFAULT NULL;
|
||||
-- Note: fields with type BLOB/TEXT can't have default value.
|
||||
|
||||
|
||||
|
||||
ALTER TABLE llx_extrafields ADD COLUMN help text NULL;
|
||||
|
||||
|
||||
ALTER TABLE llx_user ADD COLUMN dateemploymentend date after dateemployment;
|
||||
|
||||
|
||||
ALTER TABLE llx_c_field_list ADD COLUMN visible tinyint DEFAULT 1 NOT NULL AFTER search;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- ========================================================================
|
||||
-- Copyright (C) 2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2010-2018 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
|
||||
@@ -33,6 +33,7 @@ create table llx_c_field_list
|
||||
align varchar(6) DEFAULT 'left', -- align (left,center,right)
|
||||
sort tinyint DEFAULT 1 NOT NULL, -- add sort field
|
||||
search tinyint DEFAULT 0 NOT NULL, -- add search field
|
||||
visible tinyint DEFAULT 1 NOT NULL, -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only
|
||||
enabled varchar(255) DEFAULT 1, -- Condition to show or hide
|
||||
rang integer DEFAULT 0
|
||||
|
||||
|
||||
@@ -37,6 +37,7 @@ create table llx_extrafields
|
||||
param text, -- extra parameters to define possible values of field
|
||||
list varchar(255) DEFAULT '1', -- visibility of field. 0=Never visible, 1=Visible on list and forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing
|
||||
langs varchar(64), -- example: fileofmymodule@mymodule
|
||||
help text, -- to store help tooltip
|
||||
fk_user_author integer, -- user making creation
|
||||
fk_user_modif integer, -- user making last change
|
||||
datec datetime, -- date de creation
|
||||
|
||||
30
htdocs/install/mysql/tables/llx_fichinter_rec.key.sql
Normal file
30
htdocs/install/mysql/tables/llx_fichinter_rec.key.sql
Normal file
@@ -0,0 +1,30 @@
|
||||
-- ============================================================================
|
||||
-- Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/>.
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD UNIQUE INDEX idx_fichinter_rec_uk_titre (titre, entity);
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_user_author (fk_user_author);
|
||||
ALTER TABLE llx_fichinter_rec ADD INDEX idx_fichinter_rec_fk_projet (fk_projet);
|
||||
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_user_author FOREIGN KEY (fk_user_author) REFERENCES llx_user (rowid);
|
||||
ALTER TABLE llx_fichinter_rec ADD CONSTRAINT fk_fichinter_rec_fk_projet FOREIGN KEY (fk_projet) REFERENCES llx_projet (rowid);
|
||||
48
htdocs/install/mysql/tables/llx_fichinter_rec.sql
Normal file
48
htdocs/install/mysql/tables/llx_fichinter_rec.sql
Normal file
@@ -0,0 +1,48 @@
|
||||
-- ===========================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2012-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2018 Charlene Benke <charlie@patas-monkey.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/>.
|
||||
--
|
||||
-- ===========================================================================
|
||||
|
||||
create table llx_fichinter_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
titre varchar(50) NOT NULL,
|
||||
entity integer DEFAULT 1 NOT NULL, -- multi company id
|
||||
fk_soc integer DEFAULT NULL,
|
||||
datec datetime, -- date de creation
|
||||
|
||||
fk_contrat integer DEFAULT 0, -- contrat auquel est rattache la fiche
|
||||
fk_user_author integer, -- createur
|
||||
fk_projet integer, -- projet auquel est associe la facture
|
||||
duree real, -- duree totale de l'intervention
|
||||
description text,
|
||||
modelpdf varchar(50),
|
||||
note_private text,
|
||||
note_public text,
|
||||
|
||||
frequency integer, -- frequency (for example: 3 for every 3 month)
|
||||
unit_frequency varchar(2) DEFAULT 'm', -- 'm' for month (date_when must be a day <= 28), 'y' for year, ...
|
||||
date_when datetime DEFAULT NULL, -- date for next gen (when an invoice is generated, this field must be updated with next date)
|
||||
date_last_gen datetime DEFAULT NULL, -- date for last gen (date with last successfull generation of invoice)
|
||||
nb_gen_done integer DEFAULT NULL, -- nb of generation done (when an invoice is generated, this field must incremented)
|
||||
nb_gen_max integer DEFAULT NULL, -- maximum number of generation
|
||||
auto_validate integer NULL DEFAULT NULL -- statut of the generated intervention
|
||||
|
||||
)ENGINE=innodb;
|
||||
63
htdocs/install/mysql/tables/llx_fichinterdet_rec.sql
Normal file
63
htdocs/install/mysql/tables/llx_fichinterdet_rec.sql
Normal file
@@ -0,0 +1,63 @@
|
||||
-- ===================================================================
|
||||
-- Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
-- Copyright (C) 2009-2014 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
-- Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
|
||||
-- Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
-- Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
|
||||
-- Copyright (C) 2016-2018 Charlene Benke <charlie@patas-monkey.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/>.
|
||||
--
|
||||
-- ===================================================================
|
||||
|
||||
create table llx_fichinterdet_rec
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_fichinter integer NOT NULL,
|
||||
date datetime, -- date de la ligne d'intervention
|
||||
description text, -- description de la ligne d'intervention
|
||||
duree integer, -- duree de la ligne d'intervention
|
||||
rang integer DEFAULT 0, -- ordre affichage sur la fiche
|
||||
total_ht DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
subprice DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
fk_parent_line integer NULL DEFAULT NULL,
|
||||
fk_product integer NULL DEFAULT NULL,
|
||||
label varchar(255) NULL DEFAULT NULL,
|
||||
tva_tx DOUBLE(6, 3) NULL DEFAULT NULL,
|
||||
localtax1_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax1_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
localtax2_tx DOUBLE(6, 3) NULL DEFAULT 0,
|
||||
localtax2_type VARCHAR(1) NULL DEFAULT NULL,
|
||||
qty double NULL DEFAULT NULL,
|
||||
remise_percent double NULL DEFAULT 0,
|
||||
remise double NULL DEFAULT 0,
|
||||
fk_remise_except integer NULL DEFAULT NULL,
|
||||
price DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_tva DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
total_localtax1 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_localtax2 DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
total_ttc DOUBLE(24, 8) NULL DEFAULT NULL,
|
||||
product_type INTEGER NULL DEFAULT 0,
|
||||
date_start datetime NULL DEFAULT NULL,
|
||||
date_end datetime NULL DEFAULT NULL,
|
||||
info_bits INTEGER NULL DEFAULT 0,
|
||||
buy_price_ht DOUBLE(24, 8) NULL DEFAULT 0,
|
||||
fk_product_fournisseur_price integer NULL DEFAULT NULL,
|
||||
fk_code_ventilation integer NOT NULL DEFAULT 0,
|
||||
fk_export_commpta integer NOT NULL DEFAULT 0,
|
||||
special_code integer UNSIGNED NULL DEFAULT 0,
|
||||
fk_unit integer NULL DEFAULT NULL,
|
||||
import_key varchar(14) NULL DEFAULT NULL
|
||||
|
||||
)ENGINE=innodb;
|
||||
@@ -51,6 +51,6 @@ create table llx_product_fournisseur_price
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
multicurrency_price double(24,8) DEFAULT NULL,
|
||||
multicurrency_price_ttc double(24,8) DEFAULT NULL
|
||||
multicurrency_unitprice double(24,8) DEFAULT NULL, -- unit price without tax
|
||||
multicurrency_price double(24,8) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@@ -26,9 +26,9 @@ create table llx_product_fournisseur_price_log
|
||||
quantity double,
|
||||
fk_user integer,
|
||||
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
fk_multicurrency integer,
|
||||
multicurrency_code varchar(255),
|
||||
multicurrency_tx double(24,8) DEFAULT 1,
|
||||
multicurrency_price double(24,8) DEFAULT NULL,
|
||||
multicurrency_price_ttc double(24,8) DEFAULT NULL
|
||||
multicurrency_unitprice double(24,8) DEFAULT NULL, -- unit price without tax
|
||||
multicurrency_price double(24,8) DEFAULT NULL
|
||||
)ENGINE=innodb;
|
||||
|
||||
@@ -84,6 +84,7 @@ create table llx_user
|
||||
salary double(24,8), -- denormalized value coming from llx_user_employment
|
||||
salaryextra double(24,8), -- denormalized value coming from llx_user_employment
|
||||
dateemployment date, -- denormalized value coming from llx_user_employment
|
||||
dateemploymentend date, -- denormalized value coming from llx_user_employment
|
||||
weeklyhours double(16,8), -- denormalized value coming from llx_user_employment
|
||||
|
||||
import_key varchar(14), -- import key
|
||||
|
||||
29
htdocs/install/mysql/tables/llx_website_account.key.sql
Normal file
29
htdocs/install/mysql/tables/llx_website_account.key.sql
Normal file
@@ -0,0 +1,29 @@
|
||||
-- Copyright (C) 2016 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/.
|
||||
|
||||
|
||||
-- BEGIN MODULEBUILDER INDEXES
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_rowid (rowid);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_login (login);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_import_key (import_key);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_status (status);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_soc (fk_soc);
|
||||
ALTER TABLE llx_website_account ADD INDEX idx_website_account_fk_website (fk_website);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
ALTER TABLE llx_website_account ADD UNIQUE INDEX uk_website_account_login_website_soc(login, fk_website, fk_soc);
|
||||
|
||||
ALTER TABLE llx_website_account ADD CONSTRAINT llx_website_account_fk_website FOREIGN KEY (fk_website) REFERENCES llx_website(rowid);
|
||||
|
||||
36
htdocs/install/mysql/tables/llx_website_account.sql
Normal file
36
htdocs/install/mysql/tables/llx_website_account.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- Copyright (C) 2016 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/.
|
||||
|
||||
|
||||
CREATE TABLE llx_website_account(
|
||||
-- BEGIN MODULEBUILDER FIELDS
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL,
|
||||
login varchar(64) NOT NULL,
|
||||
pass_encoding varchar(24) NOT NULL,
|
||||
pass_crypted varchar(128),
|
||||
pass_temp varchar(128), -- temporary password when asked for forget password
|
||||
fk_soc integer,
|
||||
fk_website integer NOT NULL,
|
||||
note_private text,
|
||||
date_last_login datetime,
|
||||
date_previous_login datetime,
|
||||
date_creation datetime NOT NULL,
|
||||
tms timestamp NOT NULL,
|
||||
fk_user_creat integer NOT NULL,
|
||||
fk_user_modif integer,
|
||||
import_key varchar(14),
|
||||
status integer
|
||||
-- END MODULEBUILDER FIELDS
|
||||
) ENGINE=innodb;
|
||||
@@ -648,7 +648,6 @@ if ($ok && GETPOST('clean_orphelin_dir','alpha'))
|
||||
$object_instance=new ChargeSociales($db);
|
||||
}
|
||||
|
||||
$var=true;
|
||||
foreach($filearray as $key => $file)
|
||||
{
|
||||
if (!is_dir($file['name'])
|
||||
|
||||
@@ -47,16 +47,16 @@ $main_data_dir = GETPOST('main_data_dir') ? GETPOST('main_data_dir') : (empty($a
|
||||
// Dolibarr root URL
|
||||
$main_url = GETPOST('main_url')?GETPOST('main_url'):(empty($argv[5])?'':$argv[5]);
|
||||
// Database login informations
|
||||
$userroot=GETPOST('db_user_root')?GETPOST('db_user_root'):(empty($argv[6])?'':$argv[6]);
|
||||
$passroot=GETPOST('db_pass_root')?GETPOST('db_pass_root'):(empty($argv[7])?'':$argv[7]);
|
||||
$userroot=GETPOST('db_user_root','alpha')?GETPOST('db_user_root','alpha'):(empty($argv[6])?'':$argv[6]);
|
||||
$passroot=GETPOST('db_pass_root','none')?GETPOST('db_pass_root','none'):(empty($argv[7])?'':$argv[7]);
|
||||
// Database server
|
||||
$db_type=GETPOST('db_type','alpha')?GETPOST('db_type','alpha'):(empty($argv[8])?'':$argv[8]);
|
||||
$db_type=GETPOST('db_type','aZ09')?GETPOST('db_type','aZ09'):(empty($argv[8])?'':$argv[8]);
|
||||
$db_host=GETPOST('db_host','alpha')?GETPOST('db_host','alpha'):(empty($argv[9])?'':$argv[9]);
|
||||
$db_name=GETPOST('db_name','alpha')?GETPOST('db_name','alpha'):(empty($argv[10])?'':$argv[10]);
|
||||
$db_name=GETPOST('db_name','aZ09')?GETPOST('db_name','aZ09'):(empty($argv[10])?'':$argv[10]);
|
||||
$db_user=GETPOST('db_user','alpha')?GETPOST('db_user','alpha'):(empty($argv[11])?'':$argv[11]);
|
||||
$db_pass=GETPOST('db_pass')?GETPOST('db_pass'):(empty($argv[12])?'':$argv[12]);
|
||||
$db_pass=GETPOST('db_pass','none')?GETPOST('db_pass','none'):(empty($argv[12])?'':$argv[12]);
|
||||
$db_port=GETPOST('db_port','int')?GETPOST('db_port','int'):(empty($argv[13])?'':$argv[13]);
|
||||
$db_prefix=GETPOST('db_prefix','alpha')?GETPOST('db_prefix','alpha'):(empty($argv[14])?'':$argv[14]);
|
||||
$db_prefix=GETPOST('db_prefix','aZ09')?GETPOST('db_prefix','aZ09'):(empty($argv[14])?'':$argv[14]);
|
||||
$db_create_database = GETPOST('db_create_database','none')?GETPOST('db_create_database','none'):(empty($argv[15])?'':$argv[15]);
|
||||
$db_create_user = GETPOST('db_create_user','none')?GETPOST('db_create_user','none'):(empty($argv[16])?'':$argv[16]);
|
||||
// Force https
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user