Merge branch 'develop' of local repository into dev_replace_extrefield_checkboxByMultiSelect

This commit is contained in:
florian HENRY 2017-02-15 09:10:49 +01:00
commit a26081d352
365 changed files with 13037 additions and 1859 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env php
<?php
/* Copyright (C) 2015 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2015-2017 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
@ -40,55 +40,113 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/files.lib.php");
* Main
*/
$includeconstants=array();
if (empty($argv[1]))
{
print "Usage: ".$script_file." release=x.y.z\n";
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1] [includeconstant=CC:MY_CONF_NAME:value]\n";
print "Example: ".$script_file." release=6.0.0 includecustom=1 includeconstant=FR:INVOICE_CAN_ALWAYS_BE_REMOVED:0 includeconstant=all:MAILING_NO_USING_PHPMAIL:1\n";
exit -1;
}
parse_str($argv[1]);
if ($release != DOL_VERSION)
$i=0;
while ($i < $argc)
{
print 'Error: release is not version declared into filefunc.in.php.'."\n";
exit -1;
if (! empty($argv[$i])) parse_str($argv[$i]);
if (preg_match('/includeconstant=/',$argv[$i]))
{
$tmp=explode(':', $includeconstant, 3);
if (count($tmp) != 3)
{
print "Error: Bad parameter includeconstant ".$includeconstant."\n";
exit -1;
}
$includeconstants[$tmp[0]][$tmp[1]] = $tmp[2];
}
$i++;
}
if (empty($includecustom))
{
$includecustom=0;
if (DOL_VERSION != $release)
{
print 'Error: When parameter "includecustom" is not set, version declared into filefunc.in.php ('.DOL_VERSION.') must be exact same value than "release" parameter ('.$release.')'."\n";
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
exit -1;
}
}
else
{
if (! preg_match('/'.preg_quote(DOL_VERSION,'/').'-/',$release))
{
print 'Error: When parameter "includecustom" is not set, version declared into ('.DOL_VERSION.') must be used with a suffix into "release" parmater (ex: '.DOL_VERSION.'-mydistrib).'."\n";
print "Usage: ".$script_file." release=x.y.z[-...] [includecustom=1]\n";
exit -1;
}
}
print "Release : ".$release."\n";
print "Include custom : ".$includecustom."\n";
print "Include constants: ";
foreach ($includeconstants as $countrycode => $tmp)
{
foreach($tmp as $constname => $constvalue)
{
print $constname.'='.$constvalue." ";
}
}
print "\n";
//$outputfile=dirname(__FILE__).'/../htdocs/install/filelist-'.$release.'.xml';
$outputdir=dirname(__FILE__).'/../htdocs/install';
print 'Delete current files '.$outputdir.'/filelist*.xml'."\n";
dol_delete_file($outputdir.'/filelist*.xml',0,1,1);
print 'Delete current files '.$outputdir.'/filelist-'.$release.'.xml'."\n";
dol_delete_file($outputdir.'/filelist-'.$release.'.xml',0,1,1);
$checksumconcat=array();
$outputfile=$outputdir.'/filelist-'.$release.'.xml';
$fp = fopen($outputfile,'w');
fputs($fp, '<?xml version="1.0" encoding="UTF-8" ?>'."\n");
fputs($fp, '<checksum_list version="'.$release.'">'."\n");
fputs($fp, '<checksum_list version="'.$release.'" date="'.dol_print_date(dol_now(), 'dayhourrfc').'" generator="'.$script_file.'">'."\n");
fputs($fp, '<dolibarr_htdocs_dir>'."\n");
foreach ($includeconstants as $countrycode => $tmp)
{
fputs($fp, '<dolibarr_constants country="'.$countrycode.'">'."\n");
foreach($tmp as $constname => $constvalue)
{
$valueforchecksum=(empty($constvalue)?'0':$constvalue);
$checksumconcat[]=$valueforchecksum;
fputs($fp, ' <constant name="'.$constname.'">'.$valueforchecksum.'</constant>'."\n");
}
fputs($fp, '</dolibarr_constants>'."\n");
}
$checksumconcat=array();
fputs($fp, '<dolibarr_htdocs_dir includecustom="'.$includecustom.'">'."\n");
// TODO Replace RecursiveDirectoryIterator with dol_dir_list
$dir_iterator1 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../htdocs/');
$iterator1 = new RecursiveIteratorIterator($dir_iterator1);
// need to ignore document custom etc
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
// Need to ignore document custom etc. Note: this also ignore natively symbolic links.
$files = new RegexIterator($iterator1, '#^(?:[A-Z]:)?(?:/(?!(?:'.($includecustom?'':'custom\/|').'documents\/|conf\/|install\/))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
$dir='';
$needtoclose=0;
foreach ($files as $file) {
$newdir = str_replace(dirname(__FILE__).'/../htdocs', '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose)
fputs($fp, '</dir>'."\n");
fputs($fp, '<dir name="'.$newdir.'" >'."\n");
fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, '<md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
}
}
fputs($fp, '</dir>'."\n");
fputs($fp, ' </dir>'."\n");
fputs($fp, '</dolibarr_htdocs_dir>'."\n");
asort($checksumconcat); // Sort list of checksum
@ -102,28 +160,29 @@ $checksumconcat=array();
fputs($fp, '<dolibarr_script_dir version="'.$release.'">'."\n");
// TODO Replace RecursiveDirectoryIterator with dol_dir_list
$dir_iterator2 = new RecursiveDirectoryIterator(dirname(__FILE__).'/../scripts/');
$iterator2 = new RecursiveIteratorIterator($dir_iterator2);
// need to ignore document custom etc
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install|nltechno))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
// Need to ignore document custom etc. Note: this also ignore natively symbolic links.
$files = new RegexIterator($iterator2, '#^(?:[A-Z]:)?(?:/(?!(?:custom|documents|conf|install))[^/]+)+/[^/]+\.(?:php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$#i');
$dir='';
$needtoclose=0;
foreach ($files as $file) {
$newdir = str_replace(dirname(__FILE__).'/../scripts', '', dirname($file));
if ($newdir!=$dir) {
if ($needtoclose)
fputs($fp, '</dir>'."\n");
fputs($fp, '<dir name="'.$newdir.'" >'."\n");
fputs($fp, ' </dir>'."\n");
fputs($fp, ' <dir name="'.$newdir.'" >'."\n");
$dir = $newdir;
$needtoclose=1;
}
if (filetype($file)=="file") {
$md5=md5_file($file);
$checksumconcat[]=$md5;
fputs($fp, '<md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
fputs($fp, ' <md5file name="'.basename($file).'">'.$md5.'</md5file>'."\n");
}
}
fputs($fp, '</dir>'."\n");
fputs($fp, ' </dir>'."\n");
fputs($fp, '</dolibarr_script_dir>'."\n");
asort($checksumconcat); // Sort list of checksum

View File

@ -7,20 +7,20 @@
</MASTER_PAD_VERSION_INFO>
<Company_Info>
<Company_Name>Dolibarr team</Company_Name>
<Address_1>11 rue raymond Queneau</Address_1>
<Address_1>20 rue camponac</Address_1>
<Address_2 />
<City_Town>Rueil Malmaison</City_Town>
<City_Town>Pessac</City_Town>
<State_Province />
<Zip_Postal_Code>92500</Zip_Postal_Code>
<Zip_Postal_Code>33600</Zip_Postal_Code>
<Country>FRANCE</Country>
<Company_WebSite_URL>http://www.dolibarr.org</Company_WebSite_URL>
<Company_WebSite_URL>https://www.dolibarr.org</Company_WebSite_URL>
<Contact_Info>
<Author_First_Name>Dolibarr team</Author_First_Name>
<Author_Last_Name>Dolibarr team</Author_Last_Name>
<Author_Email>dolibarr-dev@nongnu.org</Author_Email>
<Author_Email>contact@dolibarr.org</Author_Email>
<Contact_First_Name>Dolibarr team</Contact_First_Name>
<Contact_Last_Name>Dolibarr team</Contact_Last_Name>
<Contact_Email>dolibarr-dev@nongnu.org</Contact_Email>
<Contact_Email>contact@dolibarr.org</Contact_Email>
</Contact_Info>
<Support_Info>
<Sales_Email>dolibarr-dev@nongnu.org</Sales_Email>
@ -34,10 +34,10 @@
</Company_Info>
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>3.5</Program_Version>
<Program_Release_Month>01</Program_Release_Month>
<Program_Version>5.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2014</Program_Release_Year>
<Program_Release_Year>2017</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />
@ -71,8 +71,8 @@
<Char_Desc_45>Dolibarr ERP &amp; CRM</Char_Desc_45>
<Char_Desc_80>Dolibarr ERP &amp; CRM, the easy to use open source software to manage your activity</Char_Desc_80>
<Char_Desc_250>Dolibarr ERP &amp; CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage.</Char_Desc_250>
<Char_Desc_450>Dolibarr ERP &amp; CRM is a software built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this.</Char_Desc_450>
<Char_Desc_2000>Dolibarr ERP &amp; CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple:
<Char_Desc_450>Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this.</Char_Desc_450>
<Char_Desc_2000>Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, Odoo, Neogia, Compiere, etc) because everything was made to be more simple:
Simple to install
Simple to use
Simple to develop
@ -101,14 +101,14 @@ Dolibarr intègre en effet sa propre architecture (design patterns) permettant
</Program_Descriptions>
<Web_Info>
<Application_URLs>
<Application_Info_URL>http://www.dolibarr.org</Application_Info_URL>
<Application_Order_URL>http://www.dolibarr.org</Application_Order_URL>
<Application_Screenshot_URL>http://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>http://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>http://www.dolibarr.org/files/pad_dolibarr.xml</Application_XML_File_URL>
<Application_Info_URL>https://www.dolibarr.org</Application_Info_URL>
<Application_Order_URL>https://www.dolibarr.org</Application_Order_URL>
<Application_Screenshot_URL>https://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>https://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>https://www.dolibarr.org/files/pad_dolibarr.xml</Application_XML_File_URL>
</Application_URLs>
<Download_URLs>
<Primary_Download_URL>http://www.dolibarr.org/files/dolibarr.tgz</Primary_Download_URL>
<Primary_Download_URL>https://www.dolibarr.org/files/dolibarr.tgz</Primary_Download_URL>
<Secondary_Download_URL>http://www.dolibarr.org/files/dolibarr.tgz</Secondary_Download_URL>
<Additional_Download_URL_1 />
<Additional_Download_URL_2 />

View File

@ -0,0 +1,232 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XML_DIZ_INFO>
<MASTER_PAD_VERSION_INFO>
<MASTER_PAD_VERSION>3.11</MASTER_PAD_VERSION>
<MASTER_PAD_EDITOR>PADGen 3.1.1.47 http://www.padgen.org</MASTER_PAD_EDITOR>
<MASTER_PAD_INFO>Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org</MASTER_PAD_INFO>
</MASTER_PAD_VERSION_INFO>
<Company_Info>
<Company_Name>Dolibarr team</Company_Name>
<Address_1>20 rue camponac</Address_1>
<Address_2 />
<City_Town>Pessac</City_Town>
<State_Province />
<Zip_Postal_Code>33600</Zip_Postal_Code>
<Country>FRANCE</Country>
<Company_WebSite_URL>https://www.dolibarr.org</Company_WebSite_URL>
<Contact_Info>
<Author_First_Name>Dolibarr team</Author_First_Name>
<Author_Last_Name>Dolibarr team</Author_Last_Name>
<Author_Email>contact@dolibarr.org</Author_Email>
<Contact_First_Name>Dolibarr team</Contact_First_Name>
<Contact_Last_Name>Dolibarr team</Contact_Last_Name>
<Contact_Email>contact@dolibarr.org</Contact_Email>
</Contact_Info>
<Support_Info>
<Sales_Email>dolibarr-dev@nongnu.org</Sales_Email>
<Support_Email>dolibarr-dev@nongnu.org</Support_Email>
<General_Email>dolibarr-dev@nongnu.org</General_Email>
<Sales_Phone />
<Support_Phone />
<General_Phone />
<Fax_Phone />
</Support_Info>
</Company_Info>
<Program_Info>
<Program_Name>Dolibarr</Program_Name>
<Program_Version>5.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2017</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />
<Program_Type>Freeware</Program_Type>
<Program_Release_Status>Major Update</Program_Release_Status>
<Program_Install_Support>No Install Support</Program_Install_Support>
<Program_OS_Support>Linux,Mac OS X,Mac Other,Unix,Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other</Program_OS_Support>
<Program_Language>English,Arabic,Catalan,Chinese,Danish,Dutch,Finnish,French,German,Greek,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish</Program_Language>
<Program_Change_Info>Increase performances, Setup process is easier, Reduce number of clicks required to use software</Program_Change_Info>
<Program_Specific_Category>Business</Program_Specific_Category>
<Program_Category_Class>Business::Accounting &amp; Finance</Program_Category_Class>
<Program_System_Requirements>None</Program_System_Requirements>
<File_Info>
<File_Size_Bytes>18037439</File_Size_Bytes>
<File_Size_K>18037</File_Size_K>
<File_Size_MB>18.03</File_Size_MB>
</File_Info>
<Expire_Info>
<Has_Expire_Info>N</Has_Expire_Info>
<Expire_Count />
<Expire_Based_On>Days</Expire_Based_On>
<Expire_Other_Info />
<Expire_Month />
<Expire_Day />
<Expire_Year />
</Expire_Info>
</Program_Info>
<Program_Descriptions>
<English>
<Keywords>dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp</Keywords>
<Char_Desc_45>Dolibarr ERP &amp; CRM</Char_Desc_45>
<Char_Desc_80>Dolibarr ERP &amp; CRM, the easy to use open source software to manage your activity</Char_Desc_80>
<Char_Desc_250>Dolibarr ERP &amp; CRM, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs to manage.</Char_Desc_250>
<Char_Desc_450>Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or medium companies, freelancers or foundations. We can say Dolibarr is an ERP or CRM. Dolibarr is also available with an auto-installer for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. See DoliWamp software for this.</Char_Desc_450>
<Char_Desc_2000>Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations. We can say Dolibarr is an ERP or CRM (or both depending on activated modules). It's an OpenSource project base on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems). Dolibarr differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple:
Simple to install
Simple to use
Simple to develop
Note that Dolibarr is also available with an auto-installer for Windows or Ubuntu users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. This version is called DoliWamp (for Windows) or DoliBuntu (for Ubuntu/Debian).</Char_Desc_2000>
</English>
<French>
<Keywords>dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management, sme, doliwamp</Keywords>
<Char_Desc_45>Dolibarr ERP &amp; CRM</Char_Desc_45>
<Char_Desc_80>Dolibarr ERP &amp; CRM, le gestionnaire simple pour gérer votre activité</Char_Desc_80>
<Char_Desc_250>Dolibarr ERP &amp; CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations)</Char_Desc_250>
<Char_Desc_450>Dolibarr ERP &amp; CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP).</Char_Desc_450>
<Char_Desc_2000>Dolibarr ERP &amp; CRM est un logiciel modulaire (on n'active que les fonctions que l'on désire) de gestions de TPE/PME, d'indépendants, d'entrepreneurs ou d'associations. En terme plus techniques, c'est un ERP et CRM. C'est un projet OpenSource qui s'exécute au sein d'un serveur Web et peut donc être accessible depuis n'importe quel lieu disposant d'une connexion Internet (Projet basé sur un serveur WAMP, MAMP ou LAMP: Apache, MySQL, PHP). Dolibarr vient compléter les offres déjà nombreuses de logiciels de cette catégorie (comme OpenBravo, OpenERP, SugarCRM, Neogia, Compiere, etc.) mais se démarque par le fait qu'ici tout est fait pour offrir de la simplicité (règle des 3 S):
Simple pour l'installation (avec au choix des installeurs clé en main pour ceux qui ignorent comment installer un serveur Web, ou une installation manuelle)
Simple pour l'utilisation (fonctions modulaires pour ne pas surcharger les menus, informations claires à la saisie)
Simple pour le développement (pas de frameworks lourds).
Dolibarr intègre en effet sa propre architecture (design patterns) permettant à tout développeur d'être tout de suite opérationnel sans connaissances particulières autre que le PHP. </Char_Desc_2000>
</French>
<Italian>
<Keywords>erp, crm, gestionale, medie imprese, fondazioni</Keywords>
<Char_Desc_45>Gestionale open source e gratuito</Char_Desc_45>
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
</Italian>
</Program_Descriptions>
<Web_Info>
<Application_URLs>
<Application_Info_URL>https://www.dolibarr.org</Application_Info_URL>
<Application_Order_URL>https://www.dolibarr.org</Application_Order_URL>
<Application_Screenshot_URL>http://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>http://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>https://www.dolibarr.org/files/pad_dolibarr.xml</Application_XML_File_URL>
</Application_URLs>
<Download_URLs>
<Primary_Download_URL>https://www.dolibarr.org/files/dolibarr.zip</Primary_Download_URL>
<Secondary_Download_URL>http://www.dolibarr.org/files/dolibarr.zip</Secondary_Download_URL>
<Additional_Download_URL_1 />
<Additional_Download_URL_2 />
</Download_URLs>
</Web_Info>
<Permissions>
<Distribution_Permissions>GNU GPL</Distribution_Permissions>
<EULA>GNU GPL</EULA>
</Permissions>
<Affiliates>
<Affiliates_FORM>Y</Affiliates_FORM>
<Affiliates_VERSION>1.4</Affiliates_VERSION>
<Affiliates_URL>http://pad.asp-software.org/extensions/Affiliates.htm</Affiliates_URL>
<Affiliates_Information_Page />
<Affiliates_Avangate_Order_Page />
<Affiliates_Avangate_Vendor_ID />
<Affiliates_Avangate_Product_ID />
<Affiliates_Avangate_Maximum_Commission_Rate />
<Affiliates_BMTMicro_Order_Page />
<Affiliates_BMTMicro_Vendor_ID />
<Affiliates_BMTMicro_Product_ID />
<Affiliates_BMTMicro_Maximum_Commission_Rate />
<Affiliates_Cleverbridge_Order_Page />
<Affiliates_Cleverbridge_Vendor_ID />
<Affiliates_Cleverbridge_Product_ID />
<Affiliates_Cleverbridge_Maximum_Commission_Rate />
<Affiliates_clixGalore_Order_Page />
<Affiliates_clixGalore_Vendor_ID />
<Affiliates_clixGalore_Product_ID />
<Affiliates_clixGalore_Maximum_Commission_Rate />
<Affiliates_CommissionJunction_Order_Page />
<Affiliates_CommissionJunction_Vendor_ID />
<Affiliates_CommissionJunction_Product_ID />
<Affiliates_CommissionJunction_Maximum_Commission_Rate />
<Affiliates_DigiBuy_Order_Page />
<Affiliates_DigiBuy_Vendor_ID />
<Affiliates_DigiBuy_Product_ID />
<Affiliates_DigiBuy_Maximum_Commission_Rate />
<Affiliates_DigitalCandle_Order_Page />
<Affiliates_DigitalCandle_Vendor_ID />
<Affiliates_DigitalCandle_Product_ID />
<Affiliates_DigitalCandle_Maximum_Commission_Rate />
<Affiliates_Emetrix_Order_Page />
<Affiliates_Emetrix_Vendor_ID />
<Affiliates_Emetrix_Product_ID />
<Affiliates_Emetrix_Maximum_Commission_Rate />
<Affiliates_eSellerate_Order_Page />
<Affiliates_eSellerate_Vendor_ID />
<Affiliates_eSellerate_Product_ID />
<Affiliates_eSellerate_Maximum_Commission_Rate />
<Affiliates_Kagi_Order_Page />
<Affiliates_Kagi_Vendor_ID />
<Affiliates_Kagi_Product_ID />
<Affiliates_Kagi_Maximum_Commission_Rate />
<Affiliates_LinkShare_Order_Page />
<Affiliates_LinkShare_Vendor_ID />
<Affiliates_LinkShare_Product_ID />
<Affiliates_LinkShare_Maximum_Commission_Rate />
<Affiliates_NorthStarSol_Order_Page />
<Affiliates_NorthStarSol_Vendor_ID />
<Affiliates_NorthStarSol_Product_ID />
<Affiliates_NorthStarSol_Maximum_Commission_Rate />
<Affiliates_OneNetworkDirect_Order_Page />
<Affiliates_OneNetworkDirect_Vendor_ID />
<Affiliates_OneNetworkDirect_Product_ID />
<Affiliates_OneNetworkDirect_Maximum_Commission_Rate />
<Affiliates_Order1_Order_Page />
<Affiliates_Order1_Vendor_ID />
<Affiliates_Order1_Product_ID />
<Affiliates_Order1_Maximum_Commission_Rate />
<Affiliates_Osolis_Order_Page />
<Affiliates_Osolis_Vendor_ID />
<Affiliates_Osolis_Product_ID />
<Affiliates_Osolis_Maximum_Commission_Rate />
<Affiliates_Plimus_Order_Page />
<Affiliates_Plimus_Vendor_ID />
<Affiliates_Plimus_Product_ID />
<Affiliates_Plimus_Maximum_Commission_Rate />
<Affiliates_Regnet_Order_Page />
<Affiliates_Regnet_Vendor_ID />
<Affiliates_Regnet_Product_ID />
<Affiliates_Regnet_Maximum_Commission_Rate />
<Affiliates_Regnow_Order_Page />
<Affiliates_Regnow_Vendor_ID />
<Affiliates_Regnow_Product_ID />
<Affiliates_Regnow_Maximum_Commission_Rate />
<Affiliates_Regsoft_Order_Page />
<Affiliates_Regsoft_Vendor_ID />
<Affiliates_Regsoft_Product_ID />
<Affiliates_Regsoft_Maximum_Commission_Rate />
<Affiliates_ShareIt_Order_Page />
<Affiliates_ShareIt_Vendor_ID />
<Affiliates_ShareIt_Product_ID />
<Affiliates_ShareIt_Maximum_Commission_Rate />
<Affiliates_Shareasale_Order_Page />
<Affiliates_Shareasale_Vendor_ID />
<Affiliates_Shareasale_Product_ID />
<Affiliates_Shareasale_Maximum_Commission_Rate />
<Affiliates_SWReg_Order_Page />
<Affiliates_SWReg_Vendor_ID />
<Affiliates_SWReg_Product_ID />
<Affiliates_SWReg_Maximum_Commission_Rate />
<Affiliates_V-Share_Order_Page />
<Affiliates_V-Share_Vendor_ID />
<Affiliates_V-Share_Product_ID />
<Affiliates_V-Share_Maximum_Commission_Rate />
<Affiliates_VFree_Order_Page />
<Affiliates_VFree_Vendor_ID />
<Affiliates_VFree_Product_ID />
<Affiliates_VFree_Maximum_Commission_Rate />
<Affiliates_Yaskifo_Order_Page />
<Affiliates_Yaskifo_Vendor_ID />
<Affiliates_Yaskifo_Product_ID />
<Affiliates_Yaskifo_Maximum_Commission_Rate />
</Affiliates>
<ASP>
<ASP_FORM>Y</ASP_FORM>
<ASP_Member>N</ASP_Member>
<ASP_Member_Number />
</ASP>
</XML_DIZ_INFO>

View File

@ -7,13 +7,13 @@
</MASTER_PAD_VERSION_INFO>
<Company_Info>
<Company_Name>NLTechno</Company_Name>
<Address_1>11 Rue raymond Queneau</Address_1>
<Address_1>20 Rue Camponac</Address_1>
<Address_2 />
<City_Town>Rueil Malmaison</City_Town>
<City_Town>Pessac</City_Town>
<State_Province />
<Zip_Postal_Code>92500</Zip_Postal_Code>
<Zip_Postal_Code>33600</Zip_Postal_Code>
<Country>FRANCE</Country>
<Company_WebSite_URL>http://www.nltechno.com</Company_WebSite_URL>
<Company_WebSite_URL>https://www.dolibarr.org</Company_WebSite_URL>
<Contact_Info>
<Author_First_Name>NLTechno</Author_First_Name>
<Author_Last_Name>NLTechno</Author_Last_Name>
@ -34,10 +34,10 @@
</Company_Info>
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>3.5</Program_Version>
<Program_Release_Month>01</Program_Release_Month>
<Program_Version>5.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2014</Program_Release_Year>
<Program_Release_Year>2017</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />
@ -53,7 +53,7 @@
<File_Info>
<File_Size_Bytes>26048004</File_Size_Bytes>
<File_Size_K>25437</File_Size_K>
<File_Size_MB>24.84</File_Size_MB>
<File_Size_MB>45.84</File_Size_MB>
</File_Info>
<Expire_Info>
<Has_Expire_Info>N</Has_Expire_Info>
@ -72,7 +72,7 @@
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP &amp; CRM is a software built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
</English>
<French>
@ -96,12 +96,12 @@ DoliWamp is the auto-installer for Windows users with no technical knowledge to
<Application_URLs>
<Application_Info_URL>http://www.nltechno.com/doliwamp/</Application_Info_URL>
<Application_Order_URL>http://www.nltechno.com/doliwamp/</Application_Order_URL>
<Application_Screenshot_URL>http://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>http://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>http://www.dolibarr.org/files/pad_doliwamp.xml</Application_XML_File_URL>
<Application_Screenshot_URL>https://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>https://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>https://www.dolibarr.org/files/pad_doliwamp.xml</Application_XML_File_URL>
</Application_URLs>
<Download_URLs>
<Primary_Download_URL>http://www.dolibarr.org/files/doliwamp.exe</Primary_Download_URL>
<Primary_Download_URL>https://www.dolibarr.org/files/doliwamp.exe</Primary_Download_URL>
<Secondary_Download_URL>http://www.dolibarr.org/files/doliwamp.exe</Secondary_Download_URL>
<Additional_Download_URL_1 />
<Additional_Download_URL_2 />

View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XML_DIZ_INFO>
<MASTER_PAD_VERSION_INFO>
<MASTER_PAD_VERSION>3.11</MASTER_PAD_VERSION>
<MASTER_PAD_EDITOR>PADGen 3.1.1.47 http://www.padgen.org</MASTER_PAD_EDITOR>
<MASTER_PAD_INFO>Portable Application Description, or PAD for short, is a data set that is used by shareware authors to disseminate information to anyone interested in their software products. To find out more go to http://pad.asp-software.org</MASTER_PAD_INFO>
</MASTER_PAD_VERSION_INFO>
<Company_Info>
<Company_Name>NLTechno</Company_Name>
<Address_1>20 Rue Camponac</Address_1>
<Address_2 />
<City_Town>Pessac</City_Town>
<State_Province />
<Zip_Postal_Code>33600</Zip_Postal_Code>
<Country>FRANCE</Country>
<Company_WebSite_URL>https://www.dolibarr.org</Company_WebSite_URL>
<Contact_Info>
<Author_First_Name>NLTechno</Author_First_Name>
<Author_Last_Name>NLTechno</Author_Last_Name>
<Author_Email>contact@nltechno.com</Author_Email>
<Contact_First_Name>NLTechno</Contact_First_Name>
<Contact_Last_Name>NLTechno</Contact_Last_Name>
<Contact_Email>contact@nltechno.com</Contact_Email>
</Contact_Info>
<Support_Info>
<Sales_Email>support@nltechno.com</Sales_Email>
<Support_Email>support@nltechno.com</Support_Email>
<General_Email>support@nltechno.com</General_Email>
<Sales_Phone />
<Support_Phone />
<General_Phone />
<Fax_Phone />
</Support_Info>
</Company_Info>
<Program_Info>
<Program_Name>DoliWamp</Program_Name>
<Program_Version>5.0</Program_Version>
<Program_Release_Month>02</Program_Release_Month>
<Program_Release_Day>01</Program_Release_Day>
<Program_Release_Year>2017</Program_Release_Year>
<Program_Cost_Dollars />
<Program_Cost_Other_Code />
<Program_Cost_Other />
<Program_Type>Freeware</Program_Type>
<Program_Release_Status>Major Update</Program_Release_Status>
<Program_Install_Support>Install and Uninstall</Program_Install_Support>
<Program_OS_Support>Win2000,Win7 x32,Win7 x64,Win98,WinOther,WinServer,WinVista,WinVista x64,WinXP,Other</Program_OS_Support>
<Program_Language>English,Arabic,Catalan,Chinese,Dutch,Finnish,French,German,Icelandic,Italian,Norwegian,Polish,Portuguese,Romanian,Russian,Slovenian,Spanish,Swedish,Turkish</Program_Language>
<Program_Change_Info>Increase performances, Setup process is easier, Reduce number of clicks required to use software</Program_Change_Info>
<Program_Specific_Category>Business</Program_Specific_Category>
<Program_Category_Class>Business::Accounting &amp; Finance</Program_Category_Class>
<Program_System_Requirements>None</Program_System_Requirements>
<File_Info>
<File_Size_Bytes>26048004</File_Size_Bytes>
<File_Size_K>25437</File_Size_K>
<File_Size_MB>45.84</File_Size_MB>
</File_Info>
<Expire_Info>
<Has_Expire_Info>N</Has_Expire_Info>
<Expire_Count />
<Expire_Based_On>Days</Expire_Based_On>
<Expire_Other_Info />
<Expire_Month />
<Expire_Day />
<Expire_Year />
</Expire_Info>
</Program_Info>
<Program_Descriptions>
<English>
<Keywords>doliwamp, dolibarr, erp, crm, invoices, commercial proposals, orders, accounting, stock, products, agenda, bank, business, company, foundation, management</Keywords>
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM for Windows</Char_Desc_45>
<Char_Desc_80>DoliWamp, the easy to use Dolibarr for Windows to manage your company,foundation</Char_Desc_80>
<Char_Desc_250>DoliWamp is the Dolibarr ERP/CRM for Windows, the easy to use open source software to manage your activity (invoices, customers, suppliers, contracts, agenda, emailings...) and any other things a small or mid-sized business or a foundation needs.</Char_Desc_250>
<Char_Desc_450>DoliWamp is the Dolibarr ERP/CRM autoinstaller for Windows users with no technical knowledge to install Dolibarr and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file. Dolibarr ERP/CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations.</Char_Desc_450>
<Char_Desc_2000>DoliWamp is the Dolibarr ERP/CRM for Windows. Dolibarr ERP &amp; CRM is a software package built by modules addition (you enable only features you need), to manage small or mid-sized businesses, freelancers or foundations (You can manage or follow contacts, invoices, orders, commercial proposals, products, stock management, agenda, mass emailings, members of a foundation, bank accounts...). Based on a WAMP, MAMP or LAMP server (Apache, Mysql, PHP for all Operating Systems), you can install it as a standalone program or use it from anywhere with any web browser. Dolibarr is an OpenSource project. It differs from other ERP or CRM softwares (like OpenAguila, OpenBravo, OpenERP, Neogia, Compiere, etc) because everything was made to be more simple: Simple to install, Simple to use, Simple to develop.
DoliWamp is the auto-installer for Windows users with no technical knowledge to install Dolibarr ERP/CRM and all its prerequisites (Apache, Mysql, PHP) with just one auto-exe file.</Char_Desc_2000>
</English>
<French>
<Keywords>doliwamp, dolibarr, erp, crm, factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations, entreprises, PME, TPE</Keywords>
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM pour Windows</Char_Desc_45>
<Char_Desc_80>DoliWamp, la distribution de Dolibarr pour gérer votre entreprise ou association</Char_Desc_80>
<Char_Desc_250>DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations)</Char_Desc_250>
<Char_Desc_450>DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations)</Char_Desc_450>
<Char_Desc_2000>DoliWamp est la version spécialisée pour Windows de Dolibarr ERP-CRM, le logiciel simple et OpenSource pour gérer votre activité (factures, devis, facturation, commandes, compta, trésorerie, stocks, produits, agenda, comptes bancaires, associations)</Char_Desc_2000>
</French>
<Italian>
<Keywords>doliwamp, dolibarr, erp, crm, gestionale, medie imprese, fondazioni</Keywords>
<Char_Desc_45>DoliWamp, Dolibarr ERP/CRM per Windows</Char_Desc_45>
<Char_Desc_80>Gestionale open source e gratuito per piccole e medie imprese, fondazioni</Char_Desc_80>
<Char_Desc_250>Dolibarr è un a gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività.</Char_Desc_250>
<Char_Desc_450>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_450>
<Char_Desc_2000>Dolibarr è un programma gestionale open source e gratuito per piccole e medie imprese, fondazioni e liberi professionisti. Include varie funzionalità per Enterprise Resource Planning e gestione dei clienti (CRM), ma anche ulteriori attività. Dolibar è progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare. Dolibar è completamente web-based, progettato per poter fornire solo ciò di cui hai bisogno ed essere facile da usare.</Char_Desc_2000>
</Italian>
</Program_Descriptions>
<Web_Info>
<Application_URLs>
<Application_Info_URL>http://www.nltechno.com/doliwamp/</Application_Info_URL>
<Application_Order_URL>http://www.nltechno.com/doliwamp/</Application_Order_URL>
<Application_Screenshot_URL>http://www.dolibarr.org/images/dolibarr_screenshot1.png</Application_Screenshot_URL>
<Application_Icon_URL>http://www.dolibarr.org/images/dolibarr.gif</Application_Icon_URL>
<Application_XML_File_URL>https://www.dolibarr.org/files/pad_doliwamp.xml</Application_XML_File_URL>
</Application_URLs>
<Download_URLs>
<Primary_Download_URL>https://www.dolibarr.org/files/doliwamp.exe</Primary_Download_URL>
<Secondary_Download_URL>http://www.dolibarr.org/files/doliwamp.exe</Secondary_Download_URL>
<Additional_Download_URL_1 />
<Additional_Download_URL_2 />
</Download_URLs>
</Web_Info>
<Permissions>
<Distribution_Permissions>GNU GPL</Distribution_Permissions>
<EULA>GNU GPL</EULA>
</Permissions>
<Affiliates>
<Affiliates_FORM>Y</Affiliates_FORM>
<Affiliates_VERSION>1.4</Affiliates_VERSION>
<Affiliates_URL>http://pad.asp-software.org/extensions/Affiliates.htm</Affiliates_URL>
<Affiliates_Information_Page />
<Affiliates_Avangate_Order_Page />
<Affiliates_Avangate_Vendor_ID />
<Affiliates_Avangate_Product_ID />
<Affiliates_Avangate_Maximum_Commission_Rate />
<Affiliates_BMTMicro_Order_Page />
<Affiliates_BMTMicro_Vendor_ID />
<Affiliates_BMTMicro_Product_ID />
<Affiliates_BMTMicro_Maximum_Commission_Rate />
<Affiliates_Cleverbridge_Order_Page />
<Affiliates_Cleverbridge_Vendor_ID />
<Affiliates_Cleverbridge_Product_ID />
<Affiliates_Cleverbridge_Maximum_Commission_Rate />
<Affiliates_clixGalore_Order_Page />
<Affiliates_clixGalore_Vendor_ID />
<Affiliates_clixGalore_Product_ID />
<Affiliates_clixGalore_Maximum_Commission_Rate />
<Affiliates_CommissionJunction_Order_Page />
<Affiliates_CommissionJunction_Vendor_ID />
<Affiliates_CommissionJunction_Product_ID />
<Affiliates_CommissionJunction_Maximum_Commission_Rate />
<Affiliates_DigiBuy_Order_Page />
<Affiliates_DigiBuy_Vendor_ID />
<Affiliates_DigiBuy_Product_ID />
<Affiliates_DigiBuy_Maximum_Commission_Rate />
<Affiliates_DigitalCandle_Order_Page />
<Affiliates_DigitalCandle_Vendor_ID />
<Affiliates_DigitalCandle_Product_ID />
<Affiliates_DigitalCandle_Maximum_Commission_Rate />
<Affiliates_Emetrix_Order_Page />
<Affiliates_Emetrix_Vendor_ID />
<Affiliates_Emetrix_Product_ID />
<Affiliates_Emetrix_Maximum_Commission_Rate />
<Affiliates_eSellerate_Order_Page />
<Affiliates_eSellerate_Vendor_ID />
<Affiliates_eSellerate_Product_ID />
<Affiliates_eSellerate_Maximum_Commission_Rate />
<Affiliates_Kagi_Order_Page />
<Affiliates_Kagi_Vendor_ID />
<Affiliates_Kagi_Product_ID />
<Affiliates_Kagi_Maximum_Commission_Rate />
<Affiliates_LinkShare_Order_Page />
<Affiliates_LinkShare_Vendor_ID />
<Affiliates_LinkShare_Product_ID />
<Affiliates_LinkShare_Maximum_Commission_Rate />
<Affiliates_NorthStarSol_Order_Page />
<Affiliates_NorthStarSol_Vendor_ID />
<Affiliates_NorthStarSol_Product_ID />
<Affiliates_NorthStarSol_Maximum_Commission_Rate />
<Affiliates_OneNetworkDirect_Order_Page />
<Affiliates_OneNetworkDirect_Vendor_ID />
<Affiliates_OneNetworkDirect_Product_ID />
<Affiliates_OneNetworkDirect_Maximum_Commission_Rate />
<Affiliates_Order1_Order_Page />
<Affiliates_Order1_Vendor_ID />
<Affiliates_Order1_Product_ID />
<Affiliates_Order1_Maximum_Commission_Rate />
<Affiliates_Osolis_Order_Page />
<Affiliates_Osolis_Vendor_ID />
<Affiliates_Osolis_Product_ID />
<Affiliates_Osolis_Maximum_Commission_Rate />
<Affiliates_Plimus_Order_Page />
<Affiliates_Plimus_Vendor_ID />
<Affiliates_Plimus_Product_ID />
<Affiliates_Plimus_Maximum_Commission_Rate />
<Affiliates_Regnet_Order_Page />
<Affiliates_Regnet_Vendor_ID />
<Affiliates_Regnet_Product_ID />
<Affiliates_Regnet_Maximum_Commission_Rate />
<Affiliates_Regnow_Order_Page />
<Affiliates_Regnow_Vendor_ID />
<Affiliates_Regnow_Product_ID />
<Affiliates_Regnow_Maximum_Commission_Rate />
<Affiliates_Regsoft_Order_Page />
<Affiliates_Regsoft_Vendor_ID />
<Affiliates_Regsoft_Product_ID />
<Affiliates_Regsoft_Maximum_Commission_Rate />
<Affiliates_ShareIt_Order_Page />
<Affiliates_ShareIt_Vendor_ID />
<Affiliates_ShareIt_Product_ID />
<Affiliates_ShareIt_Maximum_Commission_Rate />
<Affiliates_Shareasale_Order_Page />
<Affiliates_Shareasale_Vendor_ID />
<Affiliates_Shareasale_Product_ID />
<Affiliates_Shareasale_Maximum_Commission_Rate />
<Affiliates_SWReg_Order_Page />
<Affiliates_SWReg_Vendor_ID />
<Affiliates_SWReg_Product_ID />
<Affiliates_SWReg_Maximum_Commission_Rate />
<Affiliates_V-Share_Order_Page />
<Affiliates_V-Share_Vendor_ID />
<Affiliates_V-Share_Product_ID />
<Affiliates_V-Share_Maximum_Commission_Rate />
<Affiliates_VFree_Order_Page />
<Affiliates_VFree_Vendor_ID />
<Affiliates_VFree_Product_ID />
<Affiliates_VFree_Maximum_Commission_Rate />
<Affiliates_Yaskifo_Order_Page />
<Affiliates_Yaskifo_Vendor_ID />
<Affiliates_Yaskifo_Product_ID />
<Affiliates_Yaskifo_Maximum_Commission_Rate />
</Affiliates>
<ASP>
<ASP_FORM>Y</ASP_FORM>
<ASP_Member>N</ASP_Member>
<ASP_Member_Number />
</ASP>
</XML_DIZ_INFO>

View File

@ -636,7 +636,8 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td><input class=\"flat\" type=\"text\" name=\"".$prop['field']."\" value=\"'.\$object->".$prop['field'].".'\"></td></tr>';\n";
$baseString = 'print "<tr><td class=\"fieldrequired\">".\$langs->trans("Field%s")."</td><td><input class=\"flat\" type=\"text\" name=\"%s\" value=\"".$object->%s."\"></td></tr>";';
$varprop.= sprintf("\t ".$baseString." \n", $prop['field'], $prop['field'], $prop['field']);
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_EDIT/', $varprop, $targetcontent);
@ -648,7 +649,7 @@ foreach ($skeletonfiles as $skeletonfile => $outfile)
{
if ($prop['field'] != 'rowid' && $prop['field'] != 'id' && ! $prop['istime'])
{
$varprop.="print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field".$prop['field']."\").'</td><td>\$object->".$prop['field']."</td></tr>';\n";
$varprop.=sprintf("\t print '<tr><td class=\"fieldrequired\">'.\$langs->trans(\"Field%s\").'</td><td>'.\$object->%s.'</td></tr>';\n",$prop['field'],$prop['field']);
}
}
$targetcontent=preg_replace('/LIST_OF_TD_LABEL_FIELDS_VIEW/', $varprop, $targetcontent);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2013-2016 Alexandre Spangaro <aspangaro@zendsi.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

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-2016 Alexandre Spangaro <aspangaro@zendsi.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
@ -176,13 +176,15 @@ if ($action == 'create')
print $form->select_date(($date_end ? $date_end : - 1), 'fiscalyearend');
print '</td></tr>';
/*
// Statut
print '<tr>';
print '<td class="fieldrequired">' . $langs->trans("Status") . '</td>';
print '<td class="valeur">';
print $form->selectarray('statut', $statut2label, GETPOST('statut'));
print '</td></tr>';
*/
print '</table>';
dol_fiche_end();
@ -232,7 +234,8 @@ if ($action == 'create')
// Statut
print '<tr><td>' . $langs->trans("Statut") . '</td><td>';
print $form->selectarray('statut', $statut2label, $object->statut);
// print $form->selectarray('statut', $statut2label, $object->statut);
print $object->getLibStatut(4);
print '</td></tr>';
print '</table>';
@ -304,7 +307,7 @@ if ($action == 'create')
print '<a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?action=edit&id=' . $id . '">' . $langs->trans('Modify') . '</a>';
print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
// print '<a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?action=delete&id=' . $id . '">' . $langs->trans('Delete') . '</a>';
print '</div>';
}

View File

@ -1,26 +1,26 @@
<?php
/* Copyright (C) 2013-2014 Olivier Geffroy <jeff@jeffinfo.com>
* Copyright (C) 2013-2015 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* 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/>.
*
*/
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
* 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/>.
*
*/
/**
* \file htdocs/accountancy/admin/journal.php
@ -121,7 +121,7 @@ dol_fiche_head($head, 'journal', $langs->trans("Configuration"), 0, 'cron');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('Journaux') . '</td>';
print '<td colspan="2">' . $langs->trans('Journaux') . '</td>';
print "</tr>\n";
foreach ( $list as $key ) {
@ -145,11 +145,11 @@ print '<br>';
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td colspan="3">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
print '<td colspan="2">' . $langs->trans('JournalFinancial') . ' ('.$langs->trans('Opened').')</td>';
print "</tr>\n";
// Bank account
$sql = "SELECT rowid, label, number, accountancy_journal";
$sql = "SELECT rowid, ref, label, number, account_number, accountancy_journal";
$sql .= " FROM " . MAIN_DB_PREFIX . "bank_account";
$sql .= " WHERE entity = " . $conf->entity;
$sql .= " AND clos = 0";
@ -162,30 +162,33 @@ if ($resql) {
if ($numr > 0)
$bankaccountstatic=new Account($db);
$bankaccountstatic = new Account($db);
while ( $i < $numr ) {
$objp = $db->fetch_object($resql);
$var = ! $var;
$bankaccountstatic->rowid = $objp->rowid;
$bankaccountstatic->id = $objp->rowid;
$bankaccountstatic->ref = $objp->ref;
$bankaccountstatic->label = $objp->label;
$bankaccountstatic->number = $objp->number;
$bankaccountstatic->account_number = $objp->account_number;
$bankaccountstatic->accountancy_journal = $objp->accountancy_journal;
print '<tr ' . $bc[$var] . ' class="value">';
// Param
print '<td width="50%"><label for="' . $objp->rowid . '">' . $langs->trans("Journal");
print ' - '.$bankaccountstatic->getNomUrl(1);
print '</label></td>';
// Value
print '<td>';
print '<input type="text" size="20" id="' . $objp->rowid . '" name="bank_account['.$objp->rowid.']" value="' . $objp->accountancy_journal . '">';
print '</td></tr>';
$i ++;
}
$db->free($resql);

View File

@ -749,7 +749,8 @@ while ($i < min($num, $limit))
print '<td align="center" class="nowrap">';
print dol_print_date($datefin,'day');
if ($memberstatic->hasDelay()) {
print " ".img_warning($langs->trans("SubscriptionLate"));
$textlate .= ' ('.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($conf->adherent->subscription->warning_delay/60/60/24) >= 0 ? '+' : '').ceil($conf->adherent->subscription->warning_delay/60/60/24).' '.$langs->trans("days").')';
print " ".img_warning($langs->trans("SubscriptionLate").$textlate);
}
print '</td>';
}

View File

@ -44,11 +44,12 @@ $search_email = GETPOST('search_email','alpha');
$type = GETPOST('type','alpha');
$status = GETPOST('status','alpha');
$sortfield = GETPOST('sortfield','alpha');
$sortorder = GETPOST('sortorder','alpha');
$page = GETPOST('page','int');
if ($page == -1) { $page = 0 ; }
$offset = $conf->liste_limit * $page ;
$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0; }
$offset = $limit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) { $sortorder="DESC"; }
@ -166,9 +167,6 @@ $form=new Form($db);
// List of members type
if (! $rowid && $action != 'create' && $action != 'edit')
{
print load_fiche_titre($langs->trans("MembersTypes"));
//dol_fiche_head('');
$sql = "SELECT d.rowid, d.libelle, d.subscription, d.vote";
@ -179,8 +177,22 @@ if (! $rowid && $action != 'create' && $action != 'edit')
if ($result)
{
$num = $db->num_rows($result);
$nbtotalofrecords = $num;
$i = 0;
$param = '';
print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
if ($optioncss != '') print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
print '<input type="hidden" name="action" value="list">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print_barre_liste($langs->trans("MembersTypes"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit);
$moreforfilter = '';
print '<div class="div-table-responsive">';
@ -213,6 +225,8 @@ if (! $rowid && $action != 'create' && $action != 'edit')
}
print "</table>";
print '</div>';
print '</form>';
}
else
{

View File

@ -570,7 +570,7 @@ 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_ORDER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -592,8 +592,8 @@ $var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_COMMANDE_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftOrders").'<br>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftOrders").'</td><td>';
print '<input size="50" class="flat" type="text" name="COMMANDE_DRAFT_WATERMARK" value="'.$conf->global->COMMANDE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -504,7 +504,7 @@ $var=true;
$var=! $var;
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnContracts").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnContracts").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='CONTRACT_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -520,8 +520,8 @@ print '</td></tr>'."\n";
//Use draft Watermark
$var=!$var;
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftContractCards").'<br>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftContractCards").'</td><td>';
print '<input size="50" class="flat" type="text" name="CONTRACT_DRAFT_WATERMARK" value="'.$conf->global->CONTRACT_DRAFT_WATERMARK.'">';
print '</td></tr>'."\n";

View File

@ -86,7 +86,7 @@ $hookmanager->initHooks(array('admin'));
// Put here declaration of dictionaries properties
// Sort order to show dictionary (0 is space). All other dictionaries (added by modules) will be at end of this.
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,25,0,26,0,32,0);
$taborder=array(9,0,4,3,2,0,1,8,19,16,27,0,5,11,0,33,34,0,6,0,29,0,7,17,24,28,0,10,23,12,13,0,14,0,22,20,18,21,0,15,30,0,26,0,32,0);
// Name of SQL tables of dictionaries
$tabname=array();
@ -114,7 +114,7 @@ $tabname[21]= MAIN_DB_PREFIX."c_availability";
$tabname[22]= MAIN_DB_PREFIX."c_input_reason";
$tabname[23]= MAIN_DB_PREFIX."c_revenuestamp";
$tabname[24]= MAIN_DB_PREFIX."c_type_resource";
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
//$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
$tabname[26]= MAIN_DB_PREFIX."c_units";
$tabname[27]= MAIN_DB_PREFIX."c_stcomm";
$tabname[28]= MAIN_DB_PREFIX."c_holiday_types";
@ -151,7 +151,7 @@ $tablib[21]= "DictionaryAvailability";
$tablib[22]= "DictionarySource";
$tablib[23]= "DictionaryRevenueStamp";
$tablib[24]= "DictionaryResourceType";
$tablib[25]= "DictionaryEMailTemplates";
//$tablib[25]= "DictionaryEMailTemplates";
$tablib[26]= "DictionaryUnits";
$tablib[27]= "DictionaryProspectStatus";
$tablib[28]= "DictionaryHolidayTypes";
@ -188,7 +188,7 @@ $tabsql[21]= "SELECT c.rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX
$tabsql[22]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_input_reason";
$tabsql[23]= "SELECT t.rowid as rowid, t.taux, c.label as country, c.code as country_code, t.fk_pays as country_id, t.note, t.active, t.accountancy_code_sell, t.accountancy_code_buy FROM ".MAIN_DB_PREFIX."c_revenuestamp as t, ".MAIN_DB_PREFIX."c_country as c WHERE t.fk_pays=c.rowid";
$tabsql[24]= "SELECT rowid as rowid, code, label, active FROM ".MAIN_DB_PREFIX."c_type_resource";
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
//$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
$tabsql[26]= "SELECT rowid as rowid, code, label, short_label, active FROM ".MAIN_DB_PREFIX."c_units";
$tabsql[27]= "SELECT id as rowid, code, libelle, active FROM ".MAIN_DB_PREFIX."c_stcomm";
$tabsql[28]= "SELECT h.rowid as rowid, h.code, h.label, h.affect, h.delay, h.newbymonth, h.fk_country as country_id, c.code as country_code, c.label as country, h.active FROM ".MAIN_DB_PREFIX."c_holiday_types as h LEFT JOIN ".MAIN_DB_PREFIX."c_country as c ON h.fk_country=c.rowid";
@ -225,7 +225,7 @@ $tabsqlsort[21]="code ASC, label ASC";
$tabsqlsort[22]="code ASC, label ASC";
$tabsqlsort[23]="country ASC, taux ASC";
$tabsqlsort[24]="code ASC,label ASC";
$tabsqlsort[25]="label ASC";
//$tabsqlsort[25]="label ASC";
$tabsqlsort[26]="code ASC";
$tabsqlsort[27]="code ASC";
$tabsqlsort[28]="country ASC, code ASC";
@ -262,7 +262,7 @@ $tabfield[21]= "code,label";
$tabfield[22]= "code,label";
$tabfield[23]= "country_id,country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfield[24]= "code,label";
$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
//$tabfield[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfield[26]= "code,label,short_label";
$tabfield[27]= "code,libelle";
$tabfield[28]= "code,label,affect,delay,newbymonth,country_id,country";
@ -299,7 +299,7 @@ $tabfieldvalue[21]= "code,label";
$tabfieldvalue[22]= "code,label";
$tabfieldvalue[23]= "country,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldvalue[24]= "code,label";
$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
//$tabfieldvalue[25]= "label,type_template,private,position,topic,content_lines,content";
$tabfieldvalue[26]= "code,label,short_label";
$tabfieldvalue[27]= "code,libelle";
$tabfieldvalue[28]= "code,label,affect,delay,newbymonth,country";
@ -336,7 +336,7 @@ $tabfieldinsert[21]= "code,label";
$tabfieldinsert[22]= "code,label";
$tabfieldinsert[23]= "fk_pays,taux,accountancy_code_sell,accountancy_code_buy,note";
$tabfieldinsert[24]= "code,label";
$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
//$tabfieldinsert[25]= "label,type_template,private,position,topic,content_lines,content,entity";
$tabfieldinsert[26]= "code,label,short_label";
$tabfieldinsert[27]= "code,libelle";
$tabfieldinsert[28]= "code,label,affect,delay,newbymonth,fk_country";
@ -375,7 +375,7 @@ $tabrowid[21]= "rowid";
$tabrowid[22]= "rowid";
$tabrowid[23]= "";
$tabrowid[24]= "";
$tabrowid[25]= "";
//$tabrowid[25]= "";
$tabrowid[26]= "";
$tabrowid[27]= "id";
$tabrowid[28]= "";
@ -412,7 +412,7 @@ $tabcond[21]= ! empty($conf->propal->enabled);
$tabcond[22]= (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled));
$tabcond[23]= true;
$tabcond[24]= ! empty($conf->resource->enabled);
$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
//$tabcond[25]= true; // && ! empty($conf->global->MAIN_EMAIL_EDIT_TEMPLATE_FROM_DIC);
$tabcond[26]= ! empty($conf->product->enabled);
$tabcond[27]= ! empty($conf->societe->enabled);
$tabcond[28]= ! empty($conf->holiday->enabled);
@ -449,7 +449,7 @@ $tabhelp[21] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[22] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[23] = array();
$tabhelp[24] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
//$tabhelp[25] = array('topic'=>$langs->trans('SeeSubstitutionVars'),'content'=>$langs->trans('SeeSubstitutionVars'),'content_lines'=>$langs->trans('SeeSubstitutionVars'),'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
$tabhelp[26] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[27] = array('code'=>$langs->trans("EnterAnyCode"));
$tabhelp[28] = array('affect'=>$langs->trans("FollowedByACounter"),'delay'=>$langs->trans("MinimumNoticePeriod"), 'newbymonth'=>$langs->trans("NbAddedAutomatically"));
@ -486,7 +486,7 @@ $tabfieldcheck[21] = array();
$tabfieldcheck[22] = array();
$tabfieldcheck[23] = array();
$tabfieldcheck[24] = array();
$tabfieldcheck[25] = array();
//$tabfieldcheck[25] = array();
$tabfieldcheck[26] = array();
$tabfieldcheck[27] = array();
$tabfieldcheck[28] = array();
@ -544,29 +544,6 @@ if ($id == 11)
'external' => $langs->trans('External')
);
}
if ($id == 25)
{
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array();
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
foreach ($hookmanager->resArray as $item => $value) {
$elementList[$item] = $value;
}
}
}
// Define localtax_typeList (used for dictionary "llx_c_tva")
$localtax_typeList = array();
@ -1048,7 +1025,6 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
@ -1062,8 +1038,6 @@ if ($id)
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
@ -1117,35 +1091,18 @@ if ($id)
if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
if ($id == 4) print '<td></td>';
print '<td colspan="3" align="right">';
if ($tabname[$id] != MAIN_DB_PREFIX.'c_email_templates' || $action != 'edit')
if ($action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
print "</tr>";
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates')
{
print '<tr><td colspan="8">* '.$langs->trans("AvailableVariables").": ";
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
$tmp=$formmail->getAvailableSubstitKey('form');
print implode(', ', $tmp);
print '</td></tr>';
}
$colspan=count($fieldlist)+3;
if ($id == 4) $colspan++;
@ -1240,7 +1197,6 @@ if ($id)
if ($fieldlist[$field]=='pcg_subtype') { $valuetoshow=$langs->trans("Pcg_subtype"); }
if ($fieldlist[$field]=='sortorder') { $valuetoshow=$langs->trans("SortOrder"); }
if ($fieldlist[$field]=='short_label') { $valuetoshow=$langs->trans("ShortLabel"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='range_account') { $valuetoshow=$langs->trans("Range"); }
if ($fieldlist[$field]=='sens') { $valuetoshow=$langs->trans("Sens"); }
if ($fieldlist[$field]=='category_type') { $valuetoshow=$langs->trans("Calculated"); }
@ -1254,8 +1210,6 @@ if ($id)
if ($fieldlist[$field]=='font_size') { $valuetoshow=$langs->trans("FontSize"); }
if ($fieldlist[$field]=='custom_x') { $valuetoshow=$langs->trans("CustomX"); }
if ($fieldlist[$field]=='custom_y') { $valuetoshow=$langs->trans("CustomY"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); }
if ($fieldlist[$field]=='percent') { $valuetoshow=$langs->trans("Percentage"); }
if ($fieldlist[$field]=='affect') { $valuetoshow=$langs->trans("Info"); }
if ($fieldlist[$field]=='delay') { $valuetoshow=$langs->trans("NoticePeriod"); }
@ -1354,10 +1308,6 @@ if ($id)
$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
if ($value == 'element')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
@ -1537,7 +1487,8 @@ if ($id)
$canbemodified=$iserasable;
if ($obj->code == 'RECEP') $canbemodified=1;
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
$rowidcol=$tabrowid[$id];
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->{$rowidcol})?$obj->{$rowidcol}:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param;
$url.='&';
@ -1726,13 +1677,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
// Le type de l'element (pour les type de contact)
elseif ($fieldlist[$field] == 'element')
{
@ -1773,42 +1717,6 @@ function fieldList($fieldlist, $obj='', $tabname='', $context='')
elseif (in_array($fieldlist[$field], array('libelle_facture'))) {
print '<td><textarea cols="30" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea></td>';
}
elseif (in_array($fieldlist[$field], array('content_lines')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<input type="text" size="100" class="flat" value="'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 100, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_1, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif (in_array($fieldlist[$field], array('content')))
{
if ($tabname == MAIN_DB_PREFIX.'c_email_templates')
{
print '<td colspan="4"></td></tr><tr class="pair nohover"><td colspan="5">'; // To create an artificial CR for the current tr we are on
}
else print '<td>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if ($tabname == MAIN_DB_PREFIX.'c_email_templates' && empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_8, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
}
elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) {
print '<td><input type="text" class="flat minwidth75" value="'.price((! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')).'" name="'.$fieldlist[$field].'"></td>';
}

View File

@ -46,14 +46,17 @@ $action=GETPOST('action');
*/
// positionne la variable pour le nombre de rss externes
$sql ="SELECT MAX(".$db->decrypt('name').") as name FROM ".MAIN_DB_PREFIX."const";
$sql ="SELECT ".$db->decrypt('name')." as name FROM ".MAIN_DB_PREFIX."const";
$sql.=" WHERE ".$db->decrypt('name')." LIKE 'EXTERNAL_RSS_URLRSS_%'";
$result=$db->query($sql);
//print $sql;
$result=$db->query($sql); // We can't use SELECT MAX() because EXTERNAL_RSS_URLRSS_10 is lower than EXTERNAL_RSS_URLRSS_9
if ($result)
{
$obj = $db->fetch_object($result);
preg_match('/([0-9]+)$/i',$obj->name,$reg);
if ($reg[1]) $lastexternalrss = $reg[1];
while ($obj = $db->fetch_object($result))
{
preg_match('/([0-9]+)$/i',$obj->name,$reg);
if ($reg[1] && $reg[1] > $lastexternalrss) $lastexternalrss = $reg[1];
}
}
else
{

View File

@ -738,7 +738,7 @@ 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_INVOICE_FREE_TEXT" />';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -759,9 +759,9 @@ $var=!$var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FACTURE_DRAFT_WATERMARK" />';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftBill").'<br>';
print '<input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftBill").'</td>';
print '<td><input size="50" class="flat" type="text" name="FACTURE_DRAFT_WATERMARK" value="'.$conf->global->FACTURE_DRAFT_WATERMARK.'" />';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";

View File

@ -539,7 +539,7 @@ 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_FICHINTER_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInterventions").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnInterventions").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='FICHINTER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -561,8 +561,8 @@ $var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_FICHINTER_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftInterventionCards").'<br>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftInterventionCards").'</td><td>';
print '<input size="50" class="flat" type="text" name="FICHINTER_DRAFT_WATERMARK" value="'.$conf->global->FICHINTER_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -114,17 +114,24 @@ $server=! empty($conf->global->MAIN_MAIL_SMTP_SERVER)?$conf->global->MAIN_MAIL_S
if (! $server) $server='127.0.0.1';
/*
* View
*/
$wikihelp='EN:Setup EMails|FR:Paramétrage EMails|ES:Configuración EMails';
llxHeader('',$langs->trans("Setup"),$wikihelp);
print load_fiche_titre($langs->trans("EMailsSetup"),'','title_setup');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
$h++;
// List of sending methods
$listofmethods=array();
@ -221,6 +228,12 @@ if ($action == 'edit')
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="update">';
dol_fiche_head($head, 'common', '');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
clearstatcache();
$var=true;
@ -428,6 +441,8 @@ if ($action == 'edit')
print '</table>';
dol_fiche_end();
print '<br><div class="center">';
print '<input class="button" type="submit" name="save" value="'.$langs->trans("Save").'">';
print '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
@ -438,6 +453,12 @@ if ($action == 'edit')
}
else
{
dol_fiche_head($head, 'common', '');
print $langs->trans("EMailsDesc")."<br>\n";
print "<br>\n";
$var=true;
print '<table class="noborder" width="100%">';
@ -570,10 +591,12 @@ else
print '&nbsp;';
}
print '</td></tr>';
print '</table>';
dol_fiche_end();
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && empty($conf->global->MAIN_FIX_FOR_BUGGED_MTA))
{
print '<br>';
@ -619,7 +642,7 @@ else
print '</div>';
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail')
if ($conf->global->MAIN_MAIL_SENDMODE == 'mail' && ! in_array($action, array('testconnect', 'test', 'testhtml')))
{
$text = $langs->trans("WarningPHPMail");
print info_admin($text);

View File

@ -0,0 +1,868 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Remy Younes <ryounes@gmail.com>
* Copyright (C) 2012-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@ltairis.fr>
* Copyright (C) 2011-2016 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/admin/dict.php
* \ingroup setup
* \brief Page to administer data tables
*/
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php';
if (! empty($conf->accounting->enabled)) require_once DOL_DOCUMENT_ROOT . '/accountancy/class/html.formventilation.class.php';
$langs->load("errors");
$langs->load("admin");
$langs->load("main");
$langs->load("mails");
$action=GETPOST('action','alpha')?GETPOST('action','alpha'):'view';
$confirm=GETPOST('confirm','alpha');
$id=GETPOST('id','int');
$rowid=GETPOST('rowid','alpha');
$allowed=$user->admin;
if (! $allowed) accessforbidden();
$acts[0] = "activate";
$acts[1] = "disable";
$actl[0] = img_picto($langs->trans("Disabled"),'switch_off');
$actl[1] = img_picto($langs->trans("Activated"),'switch_on');
$listoffset=GETPOST('listoffset');
$listlimit=GETPOST('listlimit')>0?GETPOST('listlimit'):1000;
$active = 1;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
if ($page == -1) { $page = 0 ; }
$offset = $listlimit * $page ;
$pageprev = $page - 1;
$pagenext = $page + 1;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('emailtemplates'));
// Name of SQL tables of dictionaries
$tabname=array();
$tabname[25]= MAIN_DB_PREFIX."c_email_templates";
// Requests to extract data
$tabsql=array();
$tabsql[25]= "SELECT rowid as rowid, label, type_template, private, position, topic, content_lines, content, active FROM ".MAIN_DB_PREFIX."c_email_templates WHERE entity IN (".getEntity('email_template',1).")";
// Criteria to sort dictionaries
$tabsqlsort=array();
$tabsqlsort[25]="label ASC";
// Nom des champs en resultat de select pour affichage du dictionnaire
$tabfield=array();
$tabfield[25]= "label,type_template,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfield[25].=',content_lines';
// Nom des champs d'edition pour modification d'un enregistrement
$tabfieldvalue=array();
$tabfieldvalue[25]= "label,type_template,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldvalue[25].=',content_lines';
// Nom des champs dans la table pour insertion d'un enregistrement
$tabfieldinsert=array();
$tabfieldinsert[25]= "label,type_template,private,position,topic,content";
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) $tabfieldinsert[25].=',content_lines';
$tabfieldinsert[25].=',entity'; // Must be at end because not into other arrays
// Nom du rowid si le champ n'est pas de type autoincrement
// Example: "" if id field is "rowid" and has autoincrement on
// "nameoffield" if id field is not "rowid" or has not autoincrement on
$tabrowid=array();
$tabrowid[25]= "";
// Condition to show dictionary in setup page
$tabcond=array();
$tabcond[25]= true;
// List of help for fields
// Set MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES to allow edit of template for lines
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php';
$formmail=new FormMail($db);
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$tmp=$formmail->getAvailableSubstitKey('form');
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
}
else
{
$tmp=$formmail->getAvailableSubstitKey('formwithlines');
$helpsubstit = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
$tmp=$formmail->getAvailableSubstitKey('formforlines');
$helpsubstitforlines = $langs->trans("AvailableVariables").':<br>'.implode('<br>', $tmp);
}
$tabhelp=array();
$tabhelp[25] = array('topic'=>$helpsubstit,'content'=>$helpsubstit,'content_lines'=>$helpsubstitforlines,'type_template'=>$langs->trans("TemplateForElement"),'private'=>$langs->trans("TemplateIsVisibleByOwnerOnly"), 'position'=>$langs->trans("PositionIntoComboList"));
// List of check for fields (NOT USED YET)
$tabfieldcheck=array();
$tabfieldcheck[25] = array();
// Define elementList and sourceList (used for dictionary type of contacts "llx_c_type_contact")
$elementList = array();
$sourceList=array();
// We save list of template email Dolibarr can manage. This list can found by a grep into code on "->param['models']"
$elementList = array();
if ($conf->propal->enabled) $elementList['propal_send']=$langs->trans('MailToSendProposal');
if ($conf->commande->enabled) $elementList['order_send']=$langs->trans('MailToSendOrder');
if ($conf->facture->enabled) $elementList['facture_send']=$langs->trans('MailToSendInvoice');
if ($conf->expedition->enabled) $elementList['shipping_send']=$langs->trans('MailToSendShipment');
if ($conf->ficheinter->enabled) $elementList['fichinter_send']=$langs->trans('MailToSendIntervention');
if ($conf->supplier_proposal->enabled) $elementList['supplier_proposal_send']=$langs->trans('MailToSendSupplierRequestForQuotation');
if ($conf->fournisseur->enabled) $elementList['order_supplier_send']=$langs->trans('MailToSendSupplierOrder');
if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$langs->trans('MailToSendSupplierInvoice');
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
$parameters=array('elementList'=>$elementList);
$reshook=$hookmanager->executeHooks('emailElementlist',$parameters); // Note that $action and $object may have been modified by some hooks
if ($reshook == 0) {
foreach ($hookmanager->resArray as $item => $value) {
$elementList[$item] = $value;
}
}
$id = 25;
/*
* Actions
*/
if (GETPOST('button_removefilter') || GETPOST('button_removefilter.x') || GETPOST('button_removefilter_x'))
{
//$search_country_id = '';
}
// Actions add or modify an entry into a dictionary
if (GETPOST('actionadd') || GETPOST('actionmodify'))
{
$listfield=explode(',', str_replace(' ', '',$tabfield[$id]));
$listfieldinsert=explode(',',$tabfieldinsert[$id]);
$listfieldmodify=explode(',',$tabfieldinsert[$id]);
$listfieldvalue=explode(',',$tabfieldvalue[$id]);
// Check that all fields are filled
$ok=1;
foreach ($listfield as $f => $value)
{
if ($value == 'content') continue;
if ($value == 'content_lines') continue;
if ($value == 'content') $value='content-'.$rowid;
if ($value == 'content_lines') $value='content_lines-'.$rowid;
if (! isset($_POST[$value]) || $_POST[$value]=='')
{
$ok=0;
$fieldnamekey=$listfield[$f];
// We take translate key of field
if ($fieldnamekey == 'libelle' || ($fieldnamekey == 'label')) $fieldnamekey='Label';
if ($fieldnamekey == 'libelle_facture') $fieldnamekey = 'LabelOnDocuments';
if ($fieldnamekey == 'code') $fieldnamekey = 'Code';
if ($fieldnamekey == 'note') $fieldnamekey = 'Note';
if ($fieldnamekey == 'type') $fieldnamekey = 'Type';
setEventMessages($langs->transnoentities("ErrorFieldRequired", $langs->transnoentities($fieldnamekey)), null, 'errors');
}
}
// Si verif ok et action add, on ajoute la ligne
if ($ok && GETPOST('actionadd'))
{
if ($tabrowid[$id])
{
// Recupere id libre pour insertion
$newid=0;
$sql = "SELECT max(".$tabrowid[$id].") newid from ".$tabname[$id];
$result = $db->query($sql);
if ($result)
{
$obj = $db->fetch_object($result);
$newid=($obj->newid + 1);
} else {
dol_print_error($db);
}
}
// Add new entry
$sql = "INSERT INTO ".$tabname[$id]." (";
// List of fields
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $tabrowid[$id].",";
$sql.= $tabfieldinsert[$id];
$sql.=",active)";
$sql.= " VALUES(";
// List of values
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldinsert))
$sql.= $newid.",";
$i=0;
foreach ($listfieldinsert as $f => $value)
{
//var_dump($i.' - '.$listfieldvalue[$i].' - '.$_POST[$listfieldvalue[$i]].' - '.$value);
if ($value == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
if ($value == 'private' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='0';
if ($value == 'position' && ! is_numeric($_POST[$listfieldvalue[$i]])) $_POST[$listfieldvalue[$i]]='1';
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.=",1)";
dol_syslog("actionadd", LOG_DEBUG);
$result = $db->query($sql);
if ($result) // Add is ok
{
setEventMessages($langs->transnoentities("RecordSaved"), null, 'mesgs');
$_POST=array('id'=>$id); // Clean $_POST array, we keep only
}
else
{
if ($db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
setEventMessages($langs->transnoentities("ErrorRecordAlreadyExists"), null, 'errors');
}
else {
dol_print_error($db);
}
}
}
// Si verif ok et action modify, on modifie la ligne
if ($ok && GETPOST('actionmodify'))
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
// Modify entry
$sql = "UPDATE ".$tabname[$id]." SET ";
// Modifie valeur des champs
if ($tabrowid[$id] && ! in_array($tabrowid[$id],$listfieldmodify))
{
$sql.= $tabrowid[$id]."=";
$sql.= "'".$db->escape($rowid)."', ";
}
$i = 0;
foreach ($listfieldmodify as $field)
{
if ($field == 'content') $_POST['content']=$_POST['content-'.$rowid];
if ($field == 'content_lines') $_POST['content_lines']=$_POST['content_lines-'.$rowid];
if ($field == 'entity') {
$_POST[$listfieldvalue[$i]] = $conf->entity;
}
if ($i) $sql.=",";
$sql.= $field."=";
if ($_POST[$listfieldvalue[$i]] == '') $sql.="null"; // For vat, we want/accept code = ''
else $sql.="'".$db->escape($_POST[$listfieldvalue[$i]])."'";
$i++;
}
$sql.= " WHERE ".$rowidcol." = '".$rowid."'";
dol_syslog("actionmodify", LOG_DEBUG);
//print $sql;
$resql = $db->query($sql);
if (! $resql)
{
setEventMessages($db->error(), null, 'errors');
}
}
}
if ($action == 'confirm_delete' && $confirm == 'yes') // delete
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
$sql = "DELETE from ".$tabname[$id]." WHERE ".$rowidcol."='".$rowid."'";
dol_syslog("delete", LOG_DEBUG);
$result = $db->query($sql);
if (! $result)
{
if ($db->errno() == 'DB_ERROR_CHILD_EXISTS')
{
setEventMessages($langs->transnoentities("ErrorRecordIsUsedByChild"), null, 'errors');
}
else
{
dol_print_error($db);
}
}
}
// activate
if ($action == $acts[0])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET active = 1 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
// disable
if ($action == $acts[1])
{
if ($tabrowid[$id]) { $rowidcol=$tabrowid[$id]; }
else { $rowidcol="rowid"; }
if ($rowid) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE ".$rowidcol."='".$rowid."'";
}
elseif ($_GET["code"]) {
$sql = "UPDATE ".$tabname[$id]." SET active = 0 WHERE code='".$_GET["code"]."'";
}
$result = $db->query($sql);
if (!$result)
{
dol_print_error($db);
}
}
/*
* View
*/
$form = new Form($db);
$formadmin=new FormAdmin($db);
llxHeader();
$titre=$langs->trans("EMailsSetup");
$linkback='';
$titlepicto='title_setup';
print load_fiche_titre($titre,$linkback,$titlepicto);
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/mails.php";
$head[$h][1] = $langs->trans("OutGoingEmailSetup");
$head[$h][2] = 'common';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/mails_templates.php";
$head[$h][1] = $langs->trans("DictionaryEMailTemplates");
$head[$h][2] = 'templates';
$h++;
dol_fiche_head($head, 'templates', '');
// Confirmation de la suppression de la ligne
if ($action == 'delete')
{
print $form->formconfirm($_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.$rowid.'&code='.$_GET["code"].'&id='.$id, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_delete','',0,1);
}
//var_dump($elementList);
// Complete requete recherche valeurs avec critere de tri
$sql=$tabsql[$id];
if ($search_country_id > 0)
{
if (preg_match('/ WHERE /',$sql)) $sql.= " AND ";
else $sql.=" WHERE ";
$sql.= " c.rowid = ".$search_country_id;
}
if ($sortfield)
{
// If sort order is "country", we use country_code instead
if ($sortfield == 'country') $sortfield='country_code';
$sql.= " ORDER BY ".$sortfield;
if ($sortorder)
{
$sql.=" ".strtoupper($sortorder);
}
$sql.=", ";
// Clear the required sort criteria for the tabsqlsort to be able to force it with selected value
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.' '.$sortorder.',/i','',$tabsqlsort[$id]);
$tabsqlsort[$id]=preg_replace('/([a-z]+\.)?'.$sortfield.',/i','',$tabsqlsort[$id]);
}
else {
$sql.=" ORDER BY ";
}
$sql.=$tabsqlsort[$id];
$sql.=$db->plimit($listlimit+1,$offset);
//print $sql;
$fieldlist=explode(',',$tabfield[$id]);
print '<form action="'.$_SERVER['PHP_SELF'].'?id='.$id.'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="from" value="'.dol_escape_htmltag(GETPOST('from','alpha')).'">';
print '<table class="noborder" width="100%">';
// Form to add a new line
$alabelisused=0;
$var=false;
$fieldlist=explode(',',$tabfield[$id]);
if ($action != 'edit')
{
// Line for title
print '<tr class="liste_titre">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$valuetoshow=ucfirst($fieldlist[$field]); // Par defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
$align="left";
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='content') { $valuetoshow=''; }
if ($fieldlist[$field]=='content_lines') { $valuetoshow=''; }
if ($valuetoshow != '')
{
print '<td align="'.$align.'">';
if (! empty($tabhelp[$id][$value]) && preg_match('/^http(s*):/i',$tabhelp[$id][$value])) print '<a href="'.$tabhelp[$id][$value].'" target="_blank">'.$valuetoshow.' '.img_help(1,$valuetoshow).'</a>';
else if (! empty($tabhelp[$id][$value])) print $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
else print $valuetoshow;
print '</td>';
}
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') $alabelisused=1;
}
print '<td colspan="3">';
print '<input type="hidden" name="id" value="'.$id.'">';
print '</td>';
print '</tr>';
// Line to enter new values
print "<tr ".$bcnd[$var].">";
$obj = new stdClass();
// If data was already input, we define them in obj to populate input fields.
if (GETPOST('actionadd'))
{
foreach ($fieldlist as $key=>$val)
{
if (GETPOST($val) != '')
$obj->$val=GETPOST($val);
}
}
$tmpaction = 'create';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('createDictionaryFieldlist',$parameters, $obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook))
{
if ($tabname[$id] == MAIN_DB_PREFIX.'c_email_templates' && $action == 'edit')
{
fieldList($fieldlist,$obj,$tabname[$id],'hide');
}
else
{
fieldList($fieldlist,$obj,$tabname[$id],'add');
}
}
print '<td align="right" colspan="3">';
print '</td>';
print "</tr>";
$fieldsforcontent = array('content');
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$fieldsforcontent = array('content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist)
{
print '<tr class="impair nodrag nodrop nohover"><td colspan="5">';
if ($tmpfieldlist == 'content') print '<strong>'.$form->textwithpicto($langs->trans("Content"),$tabhelp[$id][$tmpfieldlist]).'</strong><br>';
if ($tmpfieldlist == 'content_lines') print '<strong>'.$form->textwithpicto($langs->trans("ContentForLines"),$tabhelp[$id][$tmpfieldlist]).'</strong><br>';
if ($context != 'hide')
{
//print '<textarea cols="3" rows="'.ROWS_2.'" class="flat" name="'.$fieldlist[$field].'">'.(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'</textarea>';
$okforextended=true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL)) $okforextended=false;
$doleditor = new DolEditor($tmpfieldlist, (! empty($obj->{$tmpfieldlist})?$obj->{$tmpfieldlist}:''), '', 120, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_4, '90%');
print $doleditor->Create(1);
}
else print '&nbsp;';
print '</td>';
if ($tmpfieldlist == 'content')
{
print '<td align="center" colspan="3" rowspan="'.(count($fieldsforcontent)).'">';
if ($action != 'edit')
{
print '<input type="submit" class="button" name="actionadd" value="'.$langs->trans("Add").'">';
}
print '</td>';
}
//else print '<td></td>';
print '</tr>';
}
$colspan=count($fieldlist)+1;
print '<tr><td colspan="'.$colspan.'">&nbsp;</td></tr>'; // Keep &nbsp; to have a line with enough height
}
// List of available record in database
dol_syslog("htdocs/admin/dict", LOG_DEBUG);
$resql=$db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=true;
$param = '&id='.$id;
$paramwithsearch = $param;
if ($sortorder) $paramwithsearch.= '&sortorder='.$sortorder;
if ($sortfield) $paramwithsearch.= '&sortfield='.$sortfield;
if (GETPOST('from')) $paramwithsearch.= '&from='.GETPOST('from','alpha');
// There is several pages
if ($num > $listlimit)
{
print '<tr class="none"><td align="right" colspan="'.(3+count($fieldlist)).'">';
print_fleche_navigation($page, $_SERVER["PHP_SELF"], $paramwithsearch, ($num > $listlimit), '<li class="pagination"><span>'.$langs->trans("Page").' '.($page+1).'</span></li>');
print '</td></tr>';
}
// Title of lines
print '<tr class="liste_titre'.($action != 'edit' ? ' liste_titre_add' : '').'">';
foreach ($fieldlist as $field => $value)
{
// Determine le nom du champ par rapport aux noms possibles
// dans les dictionnaires de donnees
$showfield=1; // By defaut
$align="left";
$sortable=1;
$valuetoshow='';
/*
$tmparray=getLabelOfField($fieldlist[$field]);
$showfield=$tmp['showfield'];
$valuetoshow=$tmp['valuetoshow'];
$align=$tmp['align'];
$sortable=$tmp['sortable'];
*/
$valuetoshow=ucfirst($fieldlist[$field]); // By defaut
$valuetoshow=$langs->trans($valuetoshow); // try to translate
if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); }
if ($fieldlist[$field]=='type') { $valuetoshow=$langs->trans("Type"); }
if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); }
if ($fieldlist[$field]=='type_template') { $valuetoshow=$langs->trans("TypeOfTemplate"); }
if ($fieldlist[$field]=='content') { $valuetoshow=$langs->trans("Content"); $showfield=0;}
if ($fieldlist[$field]=='content_lines') { $valuetoshow=$langs->trans("ContentLines"); $showfield=0; }
// Affiche nom du champ
if ($showfield)
{
if (! empty($tabhelp[$id][$value])) $valuetoshow = $form->textwithpicto($valuetoshow,$tabhelp[$id][$value]);
print getTitleFieldOfList($valuetoshow, 0, $_SERVER["PHP_SELF"], ($sortable?$fieldlist[$field]:''), ($page?'page='.$page.'&':''), $param, "align=".$align, $sortfield, $sortorder);
}
}
print getTitleFieldOfList($langs->trans("Status"), 0, $_SERVER["PHP_SELF"], "active", ($page?'page='.$page.'&':''), $param, 'align="center"', $sortfield, $sortorder);
print getTitleFieldOfList('');
print getTitleFieldOfList('');
print '</tr>';
// Title line with search boxes
print '<tr class="liste_titre">';
$filterfound=0;
foreach ($fieldlist as $field => $value)
{
if (! in_array($field, array('content', 'content_lines'))) print '<td class="liste_titre"></td>';
}
if (empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES)) print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '<td class="liste_titre"></td>';
print '</tr>';
if ($num)
{
// Lines with values
while ($i < $num)
{
$var = ! $var;
$obj = $db->fetch_object($resql);
//print_r($obj);
print '<tr '.$bc[$var].' id="rowid-'.$obj->rowid.'">';
if ($action == 'edit' && ($rowid == (! empty($obj->rowid)?$obj->rowid:$obj->code)))
{
$tmpaction='edit';
$parameters=array('fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('editDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
// Show fields
if (empty($reshook)) fieldList($fieldlist,$obj,$tabname[$id],'edit');
print '<td colspan="3" align="center">';
print '<input type="hidden" name="page" value="'.$page.'">';
print '<input type="hidden" name="rowid" value="'.$rowid.'">';
print '<input type="submit" class="button" name="actionmodify" value="'.$langs->trans("Modify").'">';
print '<div name="'.(! empty($obj->rowid)?$obj->rowid:$obj->code).'"></div>';
print '<input type="submit" class="button" name="actioncancel" value="'.$langs->trans("Cancel").'">';
print '</td>';
$fieldsforcontent = array('content');
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$fieldsforcontent = array('content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist)
{
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$tmpfieldlist};
$class = 'tddict';
// Show value for field
if ($showfield) {
print '</tr><tr '.$bc[$var].' nohover tr-'.$tmpfieldlist.'-'.$rowid.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%');
print $doleditor->Create(1);
print '</td>';
print '<td></td><td></td><td></td>';
}
}
}
else
{
$tmpaction = 'view';
$parameters=array('var'=>$var, 'fieldlist'=>$fieldlist, 'tabname'=>$tabname[$id]);
$reshook=$hookmanager->executeHooks('viewDictionaryFieldlist',$parameters,$obj, $tmpaction); // Note that $action and $object may have been modified by some hooks
$error=$hookmanager->error; $errors=$hookmanager->errors;
if (empty($reshook))
{
foreach ($fieldlist as $field => $value)
{
if (in_array($fieldlist[$field], array('content','content_lines'))) continue;
$showfield=1;
$align="left";
$valuetoshow=$obj->{$fieldlist[$field]};
if ($value == 'type_template')
{
$valuetoshow = isset($elementList[$valuetoshow])?$elementList[$valuetoshow]:$valuetoshow;
}
$class='tddict';
// Show value for field
if ($showfield)
{
print '<!-- '.$fieldlist[$field].' --><td align="'.$align.'" class="'.$class.'">'.$valuetoshow.'</td>';
}
}
}
// Can an entry be erased or disabled ?
$iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default
$canbemodified=$iserasable;
$url = $_SERVER["PHP_SELF"].'?'.($page?'page='.$page.'&':'').'sortfield='.$sortfield.'&sortorder='.$sortorder.'&rowid='.(! empty($obj->rowid)?$obj->rowid:(! empty($obj->code)?$obj->code:'')).'&code='.(! empty($obj->code)?urlencode($obj->code):'');
if ($param) $url .= '&'.$param;
$url.='&';
// Active
print '<td align="center" class="nowrap">';
if ($canbedisabled) print '<a href="'.$url.'action='.$acts[$obj->active].'">'.$actl[$obj->active].'</a>';
else
{
if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO'))) print $langs->trans("AlwaysActive");
else if (isset($obj->type) && in_array($obj->type, array('systemauto')) && empty($obj->active)) print $langs->trans("Deprecated");
else if (isset($obj->type) && in_array($obj->type, array('system')) && ! empty($obj->active) && $obj->code != 'AC_OTH') print $langs->trans("UsedOnlyWithTypeOption");
else print $langs->trans("AlwaysActive");
}
print "</td>";
// Modify link
if ($canbemodified) print '<td align="center"><a class="reposition" href="'.$url.'action=edit">'.img_edit().'</a></td>';
else print '<td>&nbsp;</td>';
// Delete link
if ($iserasable)
{
print '<td align="center">';
if ($user->admin) print '<a href="'.$url.'action=delete">'.img_delete().'</a>';
//else print '<a href="#">'.img_delete().'</a>'; // Some dictionnary can be edited by other profile than admin
print '</td>';
}
else print '<td>&nbsp;</td>';
/*
$fieldsforcontent = array('content');
if (! empty($conf->global->MAIN_EMAIL_TEMPLATES_FOR_OBJECT_LINES))
{
$fieldsforcontent = array('content', 'content_lines');
}
foreach ($fieldsforcontent as $tmpfieldlist)
{
$showfield = 1;
$align = "left";
$valuetoshow = $obj->{$tmpfieldlist};
$class = 'tddict';
// Show value for field
if ($showfield) {
print '</tr><tr '.$bc[$var].' nohover tr-'.$tmpfieldlist.'-'.$i.' "><td colspan="5">'; // To create an artificial CR for the current tr we are on
$okforextended = true;
if (empty($conf->global->FCKEDITOR_ENABLE_MAIL))
$okforextended = false;
$doleditor = new DolEditor($tmpfieldlist.'-'.$i, (! empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_6, '90%', 1);
print $doleditor->Create(1);
print '</td>';
print '<td></td><td></td><td></td>';
}
}*/
}
print "</tr>\n";
$i++;
}
}
}
else {
dol_print_error($db);
}
print '</table>';
print '</form>';
dol_fiche_end();
llxFooter();
$db->close();
/**
* Show fields in insert/edit mode
*
* @param array $fieldlist Array of fields
* @param Object $obj If we show a particular record, obj is filled with record fields
* @param string $tabname Name of SQL table
* @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we dont want it to be rendered
* @return void
*/
function fieldList($fieldlist, $obj='', $tabname='', $context='')
{
global $conf,$langs,$db;
global $form;
global $region_id;
global $elementList,$sourceList,$localtax_typeList;
global $bc;
$formadmin = new FormAdmin($db);
$formcompany = new FormCompany($db);
if (! empty($conf->accounting->enabled)) $formaccountancy = new FormVentilation($db);
foreach ($fieldlist as $field => $value)
{
if ($fieldlist[$field] == 'lang')
{
print '<td>';
print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang');
print '</td>';
}
// Le type de template
elseif ($fieldlist[$field] == 'type_template')
{
print '<td>';
print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''));
print '</td>';
}
elseif (in_array($fieldlist[$field], array('content','content_lines'))) continue;
else
{
print '<td>';
$size=''; $class='';
if ($fieldlist[$field]=='code') $class='maxwidth100';
if ($fieldlist[$field]=='private') $class='maxwidth50';
if ($fieldlist[$field]=='position') $class='maxwidth50';
if ($fieldlist[$field]=='libelle') $class='quatrevingtpercent';
if ($fieldlist[$field]=='topic') $class='quatrevingtpercent';
if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" ';
print '<input type="text" '.$size.'class="flat'.($class?' '.$class:'').'" value="'.(isset($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'').'" name="'.$fieldlist[$field].'">';
print '</td>';
}
}
}

490
htdocs/admin/modulehelp.php Normal file
View File

@ -0,0 +1,490 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 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>
*
* 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/modules.php
* \brief Page to activate/disable all modules
*/
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); // Do not check anti CSRF attack test
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1'); // Do not check style html tag into posted data
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); // Do not check anti POST attack test
if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); // If there is no need to load and show top and left menu
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); // If we don't need to load the html.form.class.php
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
//if (! defined("NOLOGIN")) define("NOLOGIN",'1'); // If this page is public (can be called outside logged session)
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$langs->load("errors");
$langs->load("admin");
$mode=GETPOST('mode', 'alpha');
$action=GETPOST('action','alpha');
$id = GETPOST('id', 'int');
if (empty($mode)) $mode='desc';
if (! $user->admin)
accessforbidden();
/*
* Actions
*/
// Nothing
/*
* View
*/
$form = new Form($db);
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
llxHeader('',$langs->trans("Setup"),$help_url);
print '<!-- Force style container -->'."\n".'<style>
.id-container {
width: 100%;
}
</style>';
$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers"));
// Search modules dirs
$modulesdir = dolGetModulesDirs();
$filename = array();
$modules = array();
$orders = array();
$categ = array();
$dirmod = array();
$i = 0; // is a sequencer of modules found
$j = 0; // j is module number. Automatically affected if module number not defined.
$modNameLoaded=array();
foreach ($modulesdir as $dir)
{
// Load modules attributes in arrays (name, numero, orders) from dir directory
//print $dir."\n<br>";
dol_syslog("Scan directory ".$dir." for module descriptor files (modXXX.class.php)");
$handle=@opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
//print "$i ".$file."\n<br>";
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
{
$modName = substr($file, 0, dol_strlen($file) - 10);
if ($modName)
{
if (! empty($modNameLoaded[$modName]))
{
$mesg="Error: Module ".$modName." was found twice: Into ".$modNameLoaded[$modName]." and ".$dir.". You probably have an old file on your disk.<br>";
setEventMessages($mesg, null, 'warnings');
dol_syslog($mesg, LOG_ERR);
continue;
}
try
{
$res=include_once $dir.$file;
if (class_exists($modName))
{
try {
$objMod = new $modName($db);
$modNameLoaded[$modName]=$dir;
if (! $objMod->numero > 0 && $modName != 'modUser')
{
dol_syslog('The module descriptor '.$modName.' must have a numero property', LOG_ERR);
}
$j = $objMod->numero;
$modulequalified=1;
// We discard modules according to features level (PS: if module is activated we always show it)
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
if ($objMod->version == 'development' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 2))) $modulequalified=0;
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
if (preg_match('/deprecated/', $objMod->version) && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL >= 0))) $modulequalified=0;
// We discard modules according to property disabled
if (! empty($objMod->hidden)) $modulequalified=0;
if ($modulequalified > 0)
{
$publisher=dol_escape_htmltag($objMod->getPublisher());
$external=($objMod->isCoreOrExternalModule() == 'external');
if ($external)
{
if ($publisher)
{
$arrayofnatures['external_'.$publisher]=$langs->trans("External").' - '.$publisher;
}
else
{
$arrayofnatures['external_']=$langs->trans("External").' - '.$langs->trans("UnknownPublishers");
}
}
ksort($arrayofnatures);
}
// Define array $categ with categ with at least one qualified module
if ($modulequalified > 0)
{
$modules[$i] = $objMod;
$filename[$i]= $modName;
$special = $objMod->special;
// Gives the possibility to the module, to provide his own family info and position of this family
if (is_array($objMod->familyinfo) && !empty($objMod->familyinfo)) {
$familyinfo = array_merge($familyinfo, $objMod->familyinfo);
$familykey = key($objMod->familyinfo);
} else {
$familykey = $objMod->family;
}
$moduleposition = ($objMod->module_position?$objMod->module_position:'500');
if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external'))
{
$moduleposition = 800;
}
if ($special == 1) $familykey='interface';
$orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number
$dirmod[$i] = $dir;
//print $i.'-'.$dirmod[$i].'<br>';
// Set categ[$i]
$specialstring = isset($specialtostring[$special])?$specialtostring[$special]:'unknown';
if ($objMod->version == 'development' || $objMod->version == 'experimental') $specialstring='expdev';
if (isset($categ[$specialstring])) $categ[$specialstring]++; // Array of all different modules categories
else $categ[$specialstring]=1;
$j++;
$i++;
}
else dol_syslog("Module ".get_class($objMod)." not qualified");
}
catch(Exception $e)
{
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
}
}
else
{
print "Warning bad descriptor file : ".$dir.$file." (Class ".$modName." not found into file)<br>";
}
}
catch(Exception $e)
{
dol_syslog("Failed to load ".$dir.$file." ".$e->getMessage(), LOG_ERR);
}
}
}
}
closedir($handle);
}
else
{
dol_syslog("htdocs/admin/modulehelp.php: Failed to open directory ".$dir.". See permission and open_basedir option.", LOG_WARNING);
}
}
asort($orders);
//var_dump($orders);
//var_dump($categ);
//var_dump($modules);
$h = 0;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=desc';
$head[$h][1] = $langs->trans("Description");
$head[$h][2] = 'desc';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modulehelp.php?id=".$id.'&mode=feature';
$head[$h][1] = $langs->trans("Features");
$head[$h][2] = 'feature';
$h++;
$i=0;
foreach($orders as $tmpkey => $tmpvalue)
{
$objMod = $modules[$tmpkey];
if ($objMod->numero == $id)
{
$key = $i;
break;
}
$i++;
}
$value = $orders[$key];
print '<div class="centpercent">';
print load_fiche_titre($objMod->getDesc(),$moreinfo,'object_'.$objMod->picto);
print '<br>';
dol_fiche_head($head, $mode, $title);
$tab=explode('_',$value);
$familyposition=$tab[0]; $familykey=$tab[1]; $module_position=$tab[2]; $numero=$tab[3];
$modName = $filename[$key];
$objMod = $modules[$key];
$dirofmodule = $dirmod[$key];
$special = $objMod->special;
if (! $objMod->getName())
{
dol_syslog("Error for module ".$key." - Property name of module looks empty", LOG_WARNING);
}
$const_name = 'MAIN_MODULE_'.strtoupper(preg_replace('/^mod/i','',get_class($objMod)));
// Check filters
$modulename=$objMod->getName();
$moduledesc=$objMod->getDesc();
$moduledesclong=$objMod->getDescLong();
$moduleauthor=$objMod->getPublisher();
// Load all lang files of module
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
{
foreach($objMod->langfiles as $domain)
{
$langs->load($domain);
}
}
$var=!$var;
// Version (with picto warning or not)
$version=$objMod->getVersion(0);
$versiontrans='';
if (preg_match('/development/i', $version)) $versiontrans.=img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) $versiontrans.=img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) $versiontrans.=img_warning($langs->trans("Deprecated"), 'style="float: left"');
$versiontrans.=$objMod->getVersion(1);
// Define imginfo
$imginfo="info";
if ($objMod->isCoreOrExternalModule() == 'external')
{
$imginfo="info_black";
}
// Define text of description of module
$text='';
if ($mode == 'desc')
{
$text.='<strong>'.$langs->trans("Version").':</strong> '.$version;
$textexternal='';
if ($objMod->isCoreOrExternalModule() == 'external')
{
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
$text.=$textexternal;
$text.='<br>';
}
else
{
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
}
$text.='<br><strong>'.$langs->trans("LastActivationDate").':</strong> ';
if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour');
else $text.=$langs->trans("Disabled");
$text.='<br>';
if ($objMod->getDescLong()) $text.=$objMod->getDesc().'<br>';
}
if ($mode == 'feature')
{
$text.='<strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i=0;
foreach($objMod->tabs as $val)
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
$i=0;
foreach($objMod->dictionaries['tablib'] as $val)
{
$text.=($i?', ':'').$val;
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i=0;
foreach($objMod->boxes as $val)
{
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
$i=0;
foreach($objMod->cronjobs as $val)
{
$text.=($i?', ':'').($val['label']);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
$i=0;
foreach($objMod->module_parts['hooks'] as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i=0;
foreach($objMod->rights as $val)
{
$text.=($i?', ':'').($val[1]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
$i=0;
foreach($objMod->export_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
$i=0;
foreach($objMod->import_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text.=$langs->trans("DetectionNotPossible");
}
print $text;
dol_fiche_end();
print '</div>';
llxFooter();
$db->close();

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2003-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2016 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
@ -29,12 +29,15 @@
require '../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
$langs->load("errors");
$langs->load("admin");
$mode=GETPOST('mode', 'alpha')?GETPOST('mode', 'alpha'):0;
$mode=GETPOST('mode', 'alpha');
if (empty($mode)) $mode='common';
$action=GETPOST('action','alpha');
$value=GETPOST('value', 'alpha');
$page_y=GETPOST('page_y','int');
@ -69,13 +72,14 @@ if ($search_status) $param.='&search_status='.urlencode($search_status);
if ($search_nature) $param.='&search_nature='.urlencode($search_nature);
if ($search_version) $param.='&search_version='.urlencode($search_version);
$dirins=DOL_DOCUMENT_ROOT.'/custom';
$urldolibarrmodules='https://www.dolistore.com/';
/*
* Actions
*/
if (GETPOST('buttonreset'))
{
$search_keyword='';
@ -84,6 +88,109 @@ if (GETPOST('buttonreset'))
$search_version='';
}
if ($action=='install')
{
$error=0;
// $original_file should match format module_modulename-x.y[.z].zip
$original_file=basename($_FILES["fileinstall"]["name"]);
$newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
if (! $original_file)
{
$langs->load("Error");
setEventMessages($langs->trans("ErrorModuleFileRequired"), null, 'warnings');
$error++;
}
else
{
if (! preg_match('/\.zip$/i',$original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
$error++;
}
if (! preg_match('/module_.*\-[\d]+\.[\d]+.*$/i',$original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
$error++;
}
}
if (! $error)
{
if ($original_file)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
}
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
if ($tmpdir)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
}
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0)
{
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
if (! empty($result['error']))
{
$langs->load("errors");
setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
$error++;
}
else
{
// Now we move the dir of the module
$modulename=preg_replace('/module_/', '', $original_file);
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
// Search dir $modulename
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat").'<br>Dir not found: '.$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename.'<br>'.$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename, null, 'errors');
$error++;
}
}
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulename);
dol_syslog("Uncompress of module file is a success. We copy it from ".$modulenamedir." into target dir ".$dirins.'/'.$modulename);
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
{
dol_syslog('Failed to call dolCopyDir result='.$result." with param ".$modulenamedir." and ".$dirins.'/'.$modulename, LOG_WARNING);
$langs->load("errors");
setEventMessages($langs->trans("ErrorFailToCopyDir", $modulenamedir, $dirins.'/'.$modulename), null, 'errors');
$error++;
}
}
}
}
else
{
$error++;
}
}
if (! $error)
{
setEventMessages($langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules")), null, 'warnings');
}
}
if ($action == 'set' && $user->admin)
{
$resarray = activateModule($value);
@ -115,6 +222,13 @@ if ($action == 'reset' && $user->admin)
* View
*/
// Set dir where external modules are installed
if (! dol_is_dir($dirins))
{
dol_mkdir($dirins);
}
$dirins_ok=(dol_is_dir($dirins));
$form = new Form($db);
$help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones';
@ -277,33 +391,35 @@ if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouM
print load_fiche_titre($langs->trans("ModulesSetup"),$moreinfo,'title_setup');
// Start to show page
if (empty($mode)) $mode='common';
if ($mode==='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode==='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode==='expdev') print $langs->trans("ModuleFamilyExperimental")."<br>\n";
if ($mode=='common') print $langs->trans("ModulesDesc")."<br>\n";
if ($mode=='marketplace') print $langs->trans("ModulesMarketPlaceDesc")."<br>\n";
if ($mode=='deploy') print $langs->trans("ModulesDeployDesc", $langs->transnoentitiesnoconv("AvailableModules"))."<br>\n";
$h = 0;
$categidx='common'; // Main
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=common";
$head[$h][1] = $langs->trans("AvailableModules");
$head[$h][2] = 'common';
$h++;
$categidx='marketplace';
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=".$categidx;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=marketplace";
$head[$h][1] = $langs->trans("ModulesMarketPlaces");
$head[$h][2] = 'marketplace';
$h++;
$head[$h][0] = DOL_URL_ROOT."/admin/modules.php?mode=deploy";
$head[$h][1] = $langs->trans("AddExtensionThemeModuleOrOther");
$head[$h][2] = 'deploy';
$h++;
print "<br>\n";
$var=true;
if ($mode != 'marketplace')
if ($mode == 'common')
{
print '<form method="GET" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">';
@ -313,7 +429,7 @@ if ($mode != 'marketplace')
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
dol_fiche_head($head, $mode, '');
$moreforfilter = '';
$moreforfilter.='<div class="divsearchfield">';
$moreforfilter.= $langs->trans('Keyword') . ': <input type="text" name="search_keyword" value="'.dol_escape_htmltag($search_keyword).'">';
@ -351,10 +467,8 @@ if ($mode != 'marketplace')
//print '</div>';
}
//dol_fiche_end();
print '<div class="clearboth"></div><br>';
//print '<br><br><br><br>';
$moreforfilter='';
@ -440,8 +554,6 @@ if ($mode != 'marketplace')
}
// Print a separator if we change family
//print "<tr><td>xx".$oldfamily."-".$familykey."-".$atleastoneforfamily."<br></td><tr>";
//if ($oldfamily && $familykey!=$oldfamily && $atleastoneforfamily) {
if ($familykey!=$oldfamily)
{
print '<tr class="liste_titre">'."\n";
@ -452,7 +564,6 @@ if ($mode != 'marketplace')
print '<td colspan="2" align="right">'.$langs->trans("SetupShort").'</td>'."\n";
print "</tr>\n";
$atleastoneforfamily=0;
//print "<tr><td>yy".$oldfamily."-".$familykey."-".$atleastoneforfamily."<br></td><tr>";
}
$atleastoneforfamily++;
@ -465,7 +576,22 @@ if ($mode != 'marketplace')
$var=!$var;
//print "\n<!-- Module ".$objMod->numero." ".$objMod->getName()." found into ".$dirmod[$key]." -->\n";
// Version (with picto warning or not)
$version=$objMod->getVersion(0);
$versiontrans='';
if (preg_match('/development/i', $version)) $versiontrans.=img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) $versiontrans.=img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) $versiontrans.=img_warning($langs->trans("Deprecated"), 'style="float: left"');
$versiontrans.=$objMod->getVersion(1);
// Define imginfo
$imginfo="info";
if ($objMod->isCoreOrExternalModule() == 'external')
{
$imginfo="info_black";
}
print '<tr '.$bc[$var].">\n";
// Picto
@ -495,177 +621,15 @@ if ($mode != 'marketplace')
// Help
print '<td align="center" valign="top" class="nowrap" style="width: 82px;">';
$text='';
if ($objMod->getDescLong()) $text.='<div class="titre">'.$objMod->getDesc().'</div><br>'.$objMod->getDescLong().'<br>';
else $text.='<div class="titre">'.$objMod->getDesc().'</div><br>';
$textexternal='';
$imginfo="info";
if ($objMod->isCoreOrExternalModule() == 'external')
{
$imginfo="info_black";
$textexternal.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("ExternalModule",$dirofmodule);
if ($objMod->editor_name != 'dolibarr') $textexternal.='<br><strong>'.$langs->trans("Publisher").':</strong> '.(empty($objMod->editor_name)?$langs->trans("Unknown"):$objMod->editor_name);
if (! empty($objMod->editor_url) && ! preg_match('/dolibarr\.org/i',$objMod->editor_url)) $textexternal.='<br><strong>'.$langs->trans("Url").':</strong> '.$objMod->editor_url;
$text.=$textexternal;
$text.='<br>';
}
else
{
$text.='<br><strong>'.$langs->trans("Origin").':</strong> '.$langs->trans("Core").'<br>';
}
$text.='<br><strong>'.$langs->trans("LastActivationDate").':</strong> ';
if (! empty($conf->global->$const_name)) $text.=dol_print_date($objMod->getLastActivationDate(), 'dayhour');
else $text.=$langs->trans("Disabled");
$text.='<br>';
$text.='<br><strong>'.$langs->trans("AddRemoveTabs").':</strong> ';
if (isset($objMod->tabs) && is_array($objMod->tabs) && count($objMod->tabs))
{
$i=0;
foreach($objMod->tabs as $val)
{
$tmp=explode(':',$val,3);
$text.=($i?', ':'').$tmp[0].':'.$tmp[1];
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddDictionaries").':</strong> ';
if (isset($objMod->dictionaries) && isset($objMod->dictionaries['tablib']) && is_array($objMod->dictionaries['tablib']) && count($objMod->dictionaries['tablib']))
{
$i=0;
foreach($objMod->dictionaries['tablib'] as $val)
{
$text.=($i?', ':'').$val;
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddBoxes").':</strong> ';
if (isset($objMod->boxes) && is_array($objMod->boxes) && count($objMod->boxes))
{
$i=0;
foreach($objMod->boxes as $val)
{
$text.=($i?', ':'').($val['file']?$val['file']:$val[0]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddModels").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['models']) && $objMod->module_parts['models'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSubstitutions").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['substitutions']) && $objMod->module_parts['substitutions'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddSheduledJobs").':</strong> ';
if (isset($objMod->cronjobs) && is_array($objMod->cronjobs) && count($objMod->cronjobs))
{
$i=0;
foreach($objMod->cronjobs as $val)
{
$text.=($i?', ':'').($val['label']);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddTriggers").':</strong> ';
if (isset($objMod->module_parts) && isset($objMod->module_parts['triggers']) && $objMod->module_parts['triggers'])
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddHooks").':</strong> ';
if (isset($objMod->module_parts) && is_array($objMod->module_parts['hooks']) && count($objMod->module_parts['hooks']))
{
$i=0;
foreach($objMod->module_parts['hooks'] as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddPermissions").':</strong> ';
if (isset($objMod->rights) && is_array($objMod->rights) && count($objMod->rights))
{
$i=0;
foreach($objMod->rights as $val)
{
$text.=($i?', ':'').($val[1]);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddMenus").':</strong> ';
if (isset($objMod->menu) && ! empty($objMod->menu)) // objMod can be an array or just an int 1
{
$text.=$langs->trans("Yes");
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddExportProfiles").':</strong> ';
if (isset($objMod->export_label) && is_array($objMod->export_label) && count($objMod->export_label))
{
$i=0;
foreach($objMod->export_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddImportProfiles").':</strong> ';
if (isset($objMod->import_label) && is_array($objMod->import_label) && count($objMod->import_label))
{
$i=0;
foreach($objMod->import_label as $val)
{
$text.=($i?', ':'').($val);
$i++;
}
}
else $text.=$langs->trans("No");
$text.='<br><strong>'.$langs->trans("AddOtherPagesOrServices").':</strong> ';
$text.=$langs->trans("DetectionNotPossible");
print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20');
//print $form->textwithpicto('', $text, 1, $imginfo, 'minheight20', 0, 2, 1);
print '<a href="javascript:document_preview(\''.DOL_URL_ROOT.'/admin/modulehelp.php?id='.$objMod->numero.'\',\'text/html\',\''.dol_escape_js($langs->trans("Module")).'\')">'.img_picto($langs->trans("ClickToShowDescription"), $imginfo).'</a>';
print '</td>';
// Version
print '<td align="center" valign="top" class="nowrap">';
// Picto warning
$version=$objMod->getVersion(0);
$versiontrans=$objMod->getVersion(1);
if (preg_match('/development/i', $version)) print img_warning($langs->trans("Development"), 'style="float: left"');
if (preg_match('/experimental/i', $version)) print img_warning($langs->trans("Experimental"), 'style="float: left"');
if (preg_match('/deprecated/i', $version)) print img_warning($langs->trans("Deprecated"), 'style="float: left"');
print $versiontrans;
print "</td>\n";
// Activate/Disable and Setup (2 columns)
@ -762,8 +726,11 @@ if ($mode != 'marketplace')
}
print "</table>\n";
print '</div>';
dol_fiche_end();
}
else
if ($mode == 'marketplace')
{
dol_fiche_head($head, $mode, '');
@ -793,13 +760,115 @@ else
print "</table>\n";
//dol_fiche_end();
dol_fiche_end();
}
// Install external module
if ($mode == 'deploy')
{
dol_fiche_head($head, $mode, '');
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$message='';
if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
if ($allowfromweb < 1)
{
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
print $message;
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
print '<br>';
}
if ($allowfromweb >= 0)
{
if ($allowfromweb == 1)
{
//print $langs->trans("ThisIsProcessToFollow").'<br>';
}
else
{
print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
}
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print '<input type="hidden" name="mode" value="deploy">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
}
else
{
print $langs->trans("UnpackPackageInModulesRoot",$dirins).'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
if (! empty($result['return']))
{
print '<br>';
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
dol_fiche_end();
}
dol_fiche_end();
// Show warning about external users
if ($mode != 'marketplace') print info_admin(showModulesExludedForExternal($modules))."\n";
if ($mode == 'common') print info_admin(showModulesExludedForExternal($modules))."\n";
llxFooter();

View File

@ -577,7 +577,7 @@ 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_PROPOSAL_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnProposal").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -598,8 +598,8 @@ $var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_PROPALE_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftProposal").'<br>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftProposal").'</td><td>';
print '<input size="50" class="flat" type="text" name="PROPALE_DRAFT_WATERMARK" value="'.$conf->global->PROPALE_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -472,7 +472,7 @@ print '<td width="80">&nbsp;</td>';
print "</tr>\n";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnInvoices").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnInvoices").' '.img_info($langs->trans("AddCRIfTooLong")).'</br>';
$variablename='SUPPLIER_INVOICE_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{

View File

@ -537,7 +537,7 @@ else
*/
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnOrders").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnOrders").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
$variablename='SUPPLIER_ORDER_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{

View File

@ -528,7 +528,7 @@ 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_SUPPLIER_PROPOSAL_FREE_TEXT">';
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeLegalTextOnSupplierProposal").' ('.$langs->trans("AddCRIfTooLong").')<br>';
print $langs->trans("FreeLegalTextOnSupplierProposal").' '.img_info($langs->trans("AddCRIfTooLong")).'</br>';
$variablename='SUPPLIER_PROPOSAL_FREE_TEXT';
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT))
{
@ -549,8 +549,8 @@ $var=!$var;
print "<form method=\"post\" action=\"".$_SERVER["PHP_SELF"]."\">";
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print "<input type=\"hidden\" name=\"action\" value=\"set_SUPPLIER_PROPOSAL_DRAFT_WATERMARK\">";
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("WatermarkOnDraftSupplierProposal").'<br>';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("WatermarkOnDraftSupplierProposal").'</td><td>';
print '<input size="50" class="flat" type="text" name="SUPPLIER_PROPOSAL_DRAFT_WATERMARK" value="'.$conf->global->SUPPLIER_PROPOSAL_DRAFT_WATERMARK.'">';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';

View File

@ -73,11 +73,15 @@ print '<br>';
// Modified or missing files
$file_list = array('missing' => array(), 'updated' => array());
// File to analyze
//$xmlfile = DOL_DOCUMENT_ROOT.'/install/filelist-'.DOL_VERSION.'.xml';
// Local file to compare to
$xmlshortfile = GETPOST('xmlshortfile')?GETPOST('xmlshortfile'):'/install/filelist-'.DOL_VERSION.'.xml';
$xmlfile = DOL_DOCUMENT_ROOT.$xmlshortfile;
$xmlremote = GETPOST('xmlremote')?GETPOST('xmlremote'):'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
// Remote file to compare to
$xmlremote = GETPOST('xmlremote');
if (empty($xmlremote) && ! empty($conf->global->MAIN_FILECHECK_URL)) $xmlremote = $conf->global->MAIN_FILECHECK_URL;
$param='MAIN_FILECHECK_URL_'.DOL_VERSION;
if (empty($xmlremote) && ! empty($conf->global->$param)) $xmlremote = $conf->global->$param;
if (empty($xmlremote)) $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
// Test if remote test is ok
@ -90,19 +94,22 @@ print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
print '<!-- for a local check target=local&xmlshortfile=... -->'."\n";
if (dol_is_file($xmlfile))
{
print '<input type="radio" name="target" value="local"'.((! GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"':'').'"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile.'<br>';
print '<input type="radio" name="target" value="local"'.((! GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"':'').'"> '.$langs->trans("LocalSignature").' = ';
print '<input name="xmlshortfile" class="flat minwidth200" value="'.dol_escape_htmltag($xmlshortfile).'">';
print '<br>';
}
else
{
print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = '.$xmlshortfile;
if (! GETPOST('xmlshortfile')) print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>';
print '<input type="radio" name="target" value="local"> '.$langs->trans("LocalSignature").' = ';
print '<input name="xmlshortfile" class="flat minwidth200" value="'.dol_escape_htmltag($xmlshortfile).'">';
print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span>';
print '<br>';
}
print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
if ($enableremotecheck)
{
print '<input type="radio" name="target" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"':'').'> '.$langs->trans("RemoteSignature").' = ';
print '<input name="xmlremote" class="flat quatrevingtpercent" value="'.$xmlremote.'"><br>';
print '<input name="xmlremote" class="flat quatrevingtpercent" value="'.dol_escape_htmltag($xmlremote).'"><br>';
}
else
{
@ -150,21 +157,88 @@ if (GETPOST('target') == 'remote')
if ($xml)
{
$checksumconcat = array();
$file_list = array();
$out = '';
// Forced constants
if (is_object($xml->dolibarr_constants[0]))
{
$out.=load_fiche_titre($langs->trans("ForcedConstants"));
$out.='<table class="noborder">';
$out.='<tr class="liste_titre">';
$out.='<td>#</td>';
$out.='<td>' . $langs->trans("Constant") . '</td>';
$out.='<td align="center">' . $langs->trans("ExpectedValue") . '</td>';
$out.='<td align="center">' . $langs->trans("Value") . '</td>';
$out.='</tr>'."\n";
$var = true;
$i = 0;
foreach ($xml->dolibarr_constants[0]->constant as $constant) // $constant is a simpleXMLElement
{
$constname=$constant['name'];
$constvalue=(string) $constant;
$constvalue = (empty($constvalue)?'0':$constvalue);
// Value found
$value='';
if ($constname && $conf->global->$constname != '') $value=$conf->global->$constname;
$valueforchecksum=(empty($value)?'0':$value);
$checksumconcat[]=$valueforchecksum;
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$constname.'</td>' . "\n";
$out.='<td align="center">'.$constvalue.'</td>' . "\n";
$out.='<td align="center">'.$valueforchecksum.'</td>' . "\n";
$out.="</tr>\n";
}
if ($i==0)
{
$out.='<tr ' . $bc[false] . '><td colspan="4" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';
$out.='<br>';
}
// Scan htdocs
if (is_object($xml->dolibarr_htdocs_dir[0]))
{
$file_list = array();
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
print_fiche_titre($langs->trans("FilesMissing"));
//var_dump($xml->dolibarr_htdocs_dir[0]['includecustom']);exit;
$includecustom=(empty($xml->dolibarr_htdocs_dir[0]['includecustom'])?0:$xml->dolibarr_htdocs_dir[0]['includecustom']);
// Defined qualified files (must be same than into generate_filelist_xml.php)
$regextoinclude='\.(php|css|html|js|json|tpl|jpg|png|gif|sql|lang)$';
$regextoexclude='('.($includecustom?'':'custom|').'documents|conf|install)$'; // Exclude dirs
$scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
// Fill file_list with files in signature, new files, modified files
$ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat, $scanfiles); // Fill array $file_list
// Complete with list of new files
foreach ($scanfiles as $keyfile => $valfile)
{
$tmprelativefilename=preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT,'/').'/','', $valfile['fullname']);
if (! in_array($tmprelativefilename, $file_list['insignature']))
{
$md5newfile=@md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
$file_list['added'][]=array('filename'=>$tmprelativefilename, 'md5'=>$md5newfile);
}
}
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>#</td>';
print '<td>' . $langs->trans("Filename") . '</td>';
print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
print '</tr>'."\n";
// Files missings
$out.=load_fiche_titre($langs->trans("FilesMissing"));
$out.='<table class="noborder">';
$out.='<tr class="liste_titre">';
$out.='<td>#</td>';
$out.='<td>' . $langs->trans("Filename") . '</td>';
$out.='<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
if (is_array($tmpfilelist) && count($tmpfilelist))
@ -174,32 +248,34 @@ if ($xml)
{
$i++;
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>'.$i.'</td>' . "\n";
print '<td>'.$file['filename'].'</td>' . "\n";
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
print "</tr>\n";
$out.='<tr ' . $bc[$var] . '>';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
$out.="</tr>\n";
}
}
else
{
print '<tr ' . $bc[false] . '><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr ' . $bc[false] . '><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
$out.='</table>';
print '<br>';
$out.='<br>';
print_fiche_titre($langs->trans("FilesUpdated"));
// Files modified
$out.=load_fiche_titre($langs->trans("FilesModified"));
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>#</td>';
print '<td>' . $langs->trans("Filename") . '</td>';
print '<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
print '<td align="center">' . $langs->trans("CurrentChecksum") . '</td>';
print '<td align="right">' . $langs->trans("Size") . '</td>';
print '<td align="right">' . $langs->trans("DateModification") . '</td>';
print '</tr>'."\n";
$totalsize=0;
$out.='<table class="noborder">';
$out.='<tr class="liste_titre">';
$out.='<td>#</td>';
$out.='<td>' . $langs->trans("Filename") . '</td>';
$out.='<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
$out.='<td align="center">' . $langs->trans("CurrentChecksum") . '</td>';
$out.='<td align="right">' . $langs->trans("Size") . '</td>';
$out.='<td align="right">' . $langs->trans("DateModification") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
if (is_array($tmpfilelist2) && count($tmpfilelist2))
@ -209,30 +285,92 @@ if ($xml)
{
$i++;
$var = !$var;
print '<tr ' . $bc[$var] . '>';
print '<td>'.$i.'</td>' . "\n";
print '<td>'.$file['filename'].'</td>' . "\n";
print '<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
print '<td align="center">'.$file['md5'].'</td>' . "\n";
print '<td align="right">'.dol_print_size(dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename'])).'</td>' . "\n";
print '<td align="right">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'</td>' . "\n";
print "</tr>\n";
$out.='<tr ' . $bc[$var] . '>';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
$out.='<td align="center">'.$file['md5'].'</td>' . "\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$totalsize += $size;
$out.='<td align="right">'.dol_print_size($size).'</td>' . "\n";
$out.='<td align="right">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'</td>' . "\n";
$out.="</tr>\n";
}
$out.='<tr class="liste_total">';
$out.='<td></td>' . "\n";
$out.='<td>'.$langs->trans("Total").'</td>' . "\n";
$out.='<td align="center"></td>' . "\n";
$out.='<td align="center"></td>' . "\n";
$out.='<td align="right">'.dol_print_size($totalsize).'</td>' . "\n";
$out.='<td align="right"></td>' . "\n";
$out.="</tr>\n";
}
else
{
print '<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
$out.='<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
print '</table>';
$out.='</table>';
if (empty($tmpfilelist) && empty($tmpfilelist2))
$out.='<br>';
// Files added
$out.=load_fiche_titre($langs->trans("FilesAdded"));
$totalsize = 0;
$out.='<table class="noborder">';
$out.='<tr class="liste_titre">';
$out.='<td>#</td>';
$out.='<td>' . $langs->trans("Filename") . '</td>';
$out.='<td align="center">' . $langs->trans("ExpectedChecksum") . '</td>';
$out.='<td align="center">' . $langs->trans("CurrentChecksum") . '</td>';
$out.='<td align="right">' . $langs->trans("Size") . '</td>';
$out.='<td align="right">' . $langs->trans("DateModification") . '</td>';
$out.='</tr>'."\n";
$var = true;
$tmpfilelist3 = dol_sort_array($file_list['added'], 'filename');
if (is_array($tmpfilelist3) && count($tmpfilelist3))
{
$i = 0;
foreach ($tmpfilelist3 as $file)
{
$i++;
$var = !$var;
$out.='<tr ' . $bc[$var] . '>';
$out.='<td>'.$i.'</td>' . "\n";
$out.='<td>'.$file['filename'].'</td>' . "\n";
$out.='<td align="center">'.$file['expectedmd5'].'</td>' . "\n";
$out.='<td align="center">'.$file['md5'].'</td>' . "\n";
$size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
$totalsize += $size;
$out.='<td align="right">'.dol_print_size($size).'</td>' . "\n";
$out.='<td align="right">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']),'dayhour').'</td>' . "\n";
$out.="</tr>\n";
}
$out.='<tr class="liste_total">';
$out.='<td></td>' . "\n";
$out.='<td>'.$langs->trans("Total").'</td>' . "\n";
$out.='<td align="center"></td>' . "\n";
$out.='<td align="center"></td>' . "\n";
$out.='<td align="right">'.dol_print_size($totalsize).'</td>' . "\n";
$out.='<td align="right"></td>' . "\n";
$out.="</tr>\n";
}
else
{
$out.='<tr ' . $bc[false] . '><td colspan="5" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
$out.='</table>';
// Show warning
if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3))
{
setEventMessage($langs->trans("FileIntegrityIsStrictlyConformedWithReference"));
}
else
{
setEventMessage($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), 'warnings');
}
}
}
else
{
@ -253,13 +391,30 @@ if ($xml)
asort($checksumconcat); // Sort list of checksum
//var_dump($checksumconcat);
$checksumget = md5(join(',',$checksumconcat));
$checksumtoget = $xml->dolibarr_htdocs_dir_checksum;
print '<br>';
$checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
/*var_dump(count($file_list['added']));
var_dump($checksumget);
var_dump($checksumtoget);
var_dump($checksumget == $checksumtoget);*/
print_fiche_titre($langs->trans("GlobalChecksum")).'<br>';
print $langs->trans("ExpectedChecksum").' = '. ($checksumtoget ? $checksumtoget : $langs->trans("Unknown")) .'<br>';
print $langs->trans("CurrentChecksum").' = '.$checksumget;
print $langs->trans("CurrentChecksum").' = ';
if ($checksumget == $checksumtoget)
{
if (count($file_list['added'])) print $checksumget.' - <span class="warning">'.$langs->trans("FileIntegrityIsOkButFilesWereAdded").'</span>';
else print '<span class="ok">'.$checksumget.'</span>';
}
else
{
print '<span class="error">'.$checksumget.'</span>';
}
print '<br>';
print '<br>';
// Output detail
print $out;
}
@ -287,10 +442,11 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
{
$exclude = 'install';
foreach ($dir->md5file as $file)
foreach ($dir->md5file as $file) // $file is a simpleXMLElement
{
$filename = $path.$file['name'];
$file_list['insignature'][] = $filename;
//if (preg_match('#'.$exclude.'#', $filename)) continue;
if (!file_exists($pathref.'/'.$filename))
@ -309,3 +465,4 @@ function getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path = '', $pathre
return $file_list;
}

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2007-2012 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2007-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
*
@ -23,9 +23,9 @@
*/
require '../../main.inc.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
include_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT . '/core/lib/geturl.lib.php';
$langs->load("admin");
$langs->load("other");
@ -40,111 +40,23 @@ if (GETPOST('msg','alpha')) {
$urldolibarr='https://www.dolibarr.org/downloads/';
$urldolibarrmodules='https://www.dolistore.com/';
$urldolibarrthemes='https://www.dolistore.com/';
$dolibarrroot=preg_replace('/([\\/]+)$/i','',DOL_DOCUMENT_ROOT);
$dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
$dolibarrdataroot=preg_replace('/([\\/]+)$/i','',DOL_DATA_ROOT);
$dirins=DOL_DOCUMENT_ROOT.'/custom';
$sfurl = '';
$version='0.0';
/*
* Actions
*/
if ($action=='install')
if ($action == 'getlastversion')
{
$error=0;
// $original_file should match format module_modulename-x.y[.z].zip
$original_file=basename($_FILES["fileinstall"]["name"]);
$newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
if (! $original_file)
{
$langs->load("Error");
setEventMessages($langs->trans("ErrorFileRequired"), null, 'warnings');
$error++;
}
else
{
if (! preg_match('/\.zip/i',$original_file))
{
$langs->load("errors");
setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage",$original_file), null, 'errors');
$error++;
}
}
if (! $error)
{
if ($original_file)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
}
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
if ($tmpdir)
{
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
}
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
if ($result > 0)
{
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
if (! empty($result['error']))
{
$langs->load("errors");
setEventMessages($langs->trans($result['error'],$original_file), null, 'errors');
$error++;
}
else
{
// Now we move the dir of the module
$modulename=preg_replace('/module_/', '', $original_file);
$modulename=preg_replace('/\-[\d]+\.[\d]+.*$/', '', $modulename);
// Search dir $modulename
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
$modulenamedir=$conf->admin->dir_temp.'/'.$tmpdir.'/htdocs/'.$modulename;
//var_dump($modulenamedir);
if (! dol_is_dir($modulenamedir))
{
setEventMessages($langs->trans("ErrorModuleFileSeemsToHaveAWrongFormat"), null, 'errors');
$error++;
}
}
if (! $error)
{
//var_dump($dirins);
@dol_delete_dir_recursive($dirins.'/'.$modulename);
$result=dolCopyDir($modulenamedir, $dirins.'/'.$modulename, '0444', 1);
if ($result <= 0)
{
setEventMessages($langs->trans("ErrorFailedToCopy"), null, 'errors');
$error++;
}
}
}
}
else
{
$error++;
}
}
if (! $error)
{
setEventMessages($langs->trans("SetupIsReadyForUse"), null, 'mesgs');
}
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
}
@ -152,15 +64,6 @@ if ($action=='install')
* View
*/
// Set dir where external modules are installed
if (! dol_is_dir($dirins))
{
dol_mkdir($dirins);
}
$dirins_ok=(dol_is_dir($dirins));
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalación_-_Actualización';
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
@ -170,36 +73,42 @@ print $langs->trans("CurrentVersion").' : <b>'.DOL_VERSION.'</b><br>';
if (function_exists('curl_init'))
{
$result = getURLContent('http://sourceforge.net/projects/dolibarr/rss');
//var_dump($result['content']);
$sfurl = simplexml_load_string($result['content']);
if ($sfurl)
$conf->global->MAIN_USE_RESPONSE_TIMEOUT = 10;
if ($action == 'getlastversion')
{
$i=0;
$version='0.0';
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
if ($sfurl)
{
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
$i=0;
while (! empty($sfurl->channel[0]->item[$i]->title) && $i < 10000)
{
$newversion=$reg[1];
$newversionarray=explode('.',$newversion);
$versionarray=explode('.',$version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
$title=$sfurl->channel[0]->item[$i]->title;
if (preg_match('/([0-9]+\.([0-9\.]+))/', $title, $reg))
{
$newversion=$reg[1];
$newversionarray=explode('.',$newversion);
$versionarray=explode('.',$version);
//var_dump($newversionarray);var_dump($versionarray);
if (versioncompare($newversionarray, $versionarray) > 0) $version=$newversion;
}
$i++;
}
$i++;
// Show version
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
}
// Show version
print $langs->trans("LastStableVersion").' : <b>'. (($version != '0.0')?$version:$langs->trans("Unknown")) .'</b><br>';
}
else
{
print $langs->trans("LastStableVersion").' : <b>' .$langs->trans("UpdateServerOffline").'</b><br>';
print $langs->trans("LastStableVersion").' : <a href="'.$_SERVER["PHP_SELF"].'?action=getlastversion" class="button">' .$langs->trans("Check").'</a><br>';
}
}
print '<br>';
print '<br>';
// Upgrade
@ -223,100 +132,15 @@ print '<br>';
print '<br>';
// Install external module
$allowonlineinstall=true;
$allowfromweb=1;
if (dol_is_file($dolibarrdataroot.'/installmodules.lock')) $allowonlineinstall=false;
$fullurl='<a href="'.$urldolibarrmodules.'" target="_blank">'.$urldolibarrmodules.'</a>';
$message='';
if (! empty($allowonlineinstall))
{
if (! in_array('/custom',explode(',',$dolibarr_main_url_root_alt)))
{
$message=info_admin($langs->trans("ConfFileMuseContainCustom", DOL_DOCUMENT_ROOT.'/custom', DOL_DOCUMENT_ROOT));
$allowfromweb=-1;
}
else
{
if ($dirins_ok)
{
if (! is_writable(dol_osencode($dirins)))
{
$langs->load("errors");
$message=info_admin($langs->trans("ErrorFailedToWriteInDir",$dirins));
$allowfromweb=0;
}
}
else
{
$message=info_admin($langs->trans("NotExistsDirect",$dirins).$langs->trans("InfDirAlt").$langs->trans("InfDirExample"));
$allowfromweb=0;
}
}
}
else
{
$message=info_admin($langs->trans("InstallModuleFromWebHasBeenDisabledByFile",$dolibarrdataroot.'/installmodules.lock'));
$allowfromweb=0;
}
print $langs->trans("AddExtensionThemeModuleOrOther").'<br>';
print '<hr>';
if ($allowfromweb < 1)
{
print $langs->trans("SomethingMakeInstallFromWebNotPossible");
print $message;
//print $langs->trans("SomethingMakeInstallFromWebNotPossible2");
print '<br>';
}
print $langs->trans("GoModuleSetupArea", DOL_URL_ROOT.'/admin/modules.php?mode=deploy', $langs->transnoentities("Home").' - '.$langs->transnoentities("Setup").' - '.$langs->transnoentities("Modules"));
if ($allowfromweb >= 0)
{
if ($allowfromweb == 1) print $langs->trans("ThisIsProcessToFollow").'<br>';
else print $langs->trans("ThisIsAlternativeProcessToFollow").'<br>';
print '<b>'.$langs->trans("StepNb",1).'</b>: ';
print $langs->trans("FindPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",2).'</b>: ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'<br>';
print '<b>'.$langs->trans("StepNb",3).'</b>: ';
if ($allowfromweb == 1)
{
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
print '<input type="hidden" name="action" value="install">';
print $langs->trans("YouCanSubmitFile").' <input type="file" name="fileinstall"> ';
print '<input type="submit" name="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
print '</form>';
}
else
{
print $langs->trans("UnpackPackageInDolibarrRoot",$dirins).'<br>';
print '<b>'.$langs->trans("StepNb",4).'</b>: ';
print $langs->trans("SetupIsReadyForUse").'<br>';
}
}
if (! empty($result['return']))
{
print '<br>';
foreach($result['return'] as $value)
{
echo $value.'<br>';
}
}
llxFooter();
$db->close();

View File

@ -170,7 +170,7 @@ class DolibarrApi
* @throws RestException
*/
static function _checkAccessToResource($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid') {
// Features/modules to check
$featuresarray = array($resource);
if (preg_match('/&/', $resource)) {
@ -185,7 +185,7 @@ class DolibarrApi
$feature2 = explode("|", $feature2);
}
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray,$resource_id,$dbtablename,$feature2,$dbt_keyfield,$dbt_select);
return checkUserAccessToObject(DolibarrApiAccess::$user, $featuresarray, $resource_id, $dbtablename, $feature2, $dbt_keyfield, $dbt_select);
}
/**

View File

@ -22,14 +22,14 @@
*/
class Auth
{
var $db;
protected $db;
var $login;
var $passwd;
private $login;
private $passwd;
var $reponse;
private $reponse;
var $sqlQuery;
public $sqlQuery;
/**
* Enter description here ...
@ -37,7 +37,7 @@ class Auth
* @param DoliDB $db Database handler
* @return void
*/
function __construct($db)
public function __construct($db)
{
$this->db = $db;
$this->reponse(null);
@ -49,7 +49,7 @@ class Auth
* @param string $aLogin Login
* @return void
*/
function login($aLogin)
public function login($aLogin)
{
$this->login = $aLogin;
}
@ -71,7 +71,7 @@ class Auth
* @param string $aReponse Response
* @return void
*/
function reponse($aReponse)
public function reponse($aReponse)
{
$this->reponse = $aReponse;
}
@ -83,7 +83,7 @@ class Auth
* @param string $aPasswd Password
* @return int 0 or 1
*/
function verif($aLogin, $aPasswd)
public function verif($aLogin, $aPasswd)
{
global $conf,$langs;
global $dolibarr_main_authentication,$dolibarr_auto_user;

View File

@ -29,15 +29,15 @@ $langs->load("bills");
<script type="text/javascript">
function popupTicket()
function popupTicket(id,name)
{
largeur = 600;
hauteur = 500;
opt = 'width='+largeur+', height='+hauteur+', left='+(screen.width - largeur)/2+', top='+(screen.height-hauteur)/2+'';
window.open('validation_ticket.php?facid=<?php echo GETPOST('facid','int'); ?>', '<?php echo $langs->trans('PrintTicket') ?>', opt);
window.open('validation_ticket.php?facid='+id,name, opt);
}
popupTicket();
popupTicket(<?php echo GETPOST('facid','int'); ?>,'<?php echo $langs->trans('PrintTicket') ?>');
</script>

View File

@ -57,14 +57,29 @@ switch ($action)
$invoice->date=dol_now();
$invoice->type= Facture::TYPE_STANDARD;
// TODO
// To use a specific numbering module for POS, reset $conf->global->FACTURE_ADDON and other vars here
// and restore after values just after
// and restore values just after
$sav_FACTURE_ADDON='';
if (! empty($conf->global->POS_ADDON))
{
$sav_FACTURE_ADDON = $conf->global->FACTURE_ADDON;
$conf->global->FACTURE_ADDON = $conf->global->POS_ADDON;
// To force prefix only for POS with terre module
if (! empty($conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX = $conf->global->POS_NUMBERING_TERRE_FORCE_PREFIX;
// To force prefix only for POS with mars module
if (! empty($conf->global->POS_NUMBERING_MARS_FORCE_PREFIX)) $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX = $conf->global->POS_NUMBERING_MARS_FORCE_PREFIX;
// To force rule only for POS with mercure
//...
}
$num=$invoice->getNextNumRef($company);
// TODO Restore save values
// Restore save values
if (! empty($sav_FACTURE_ADDON))
{
$conf->global->FACTURE_ADDON = $sav_FACTURE_ADDON;
}
$obj_facturation->numInvoice($num);

View File

@ -11,6 +11,7 @@
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -50,6 +51,10 @@ if (! empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formprojet.class.php';
}
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('companies');
$langs->load('propal');
$langs->load('compta');
@ -682,7 +687,8 @@ if (empty($reshook))
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$price_ht_devise = GETPOST('multicurrency_price_ht');
if (GETPOST('prod_entry_mode') == 'free')
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free')
{
$idprod=0;
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
@ -708,21 +714,35 @@ if (empty($reshook))
}
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
if ($prod_entry_mode == 'free' && empty($idprod) && $price_ht == '' && $price_ht_devise == '') // Unit price can be 0 but not ''. Also price can be negative for proposal.
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Description")), null, 'errors');
$error ++;
}
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination
$prodcomb = new ProductCombination($db);
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child;
} else {
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
$error ++;
}
}
}
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
$pu_ht = 0;
$pu_ttc = 0;
@ -961,7 +981,7 @@ if (empty($reshook))
// Add buying price
$fournprice = price2num(GETPOST('fournprice') ? GETPOST('fournprice') : '');
$buyingprice = price2num(GETPOST('buying_price') != '' ? GETPOST('buying_price') : ''); // If buying_price is '0', we muste keep this value
$pu_ht_devise = GETPOST('multicurrency_subprice');
$date_start = dol_mktime(GETPOST('date_starthour'), GETPOST('date_startmin'), GETPOST('date_startsec'), GETPOST('date_startmonth'), GETPOST('date_startday'), GETPOST('date_startyear'));
@ -2398,7 +2418,7 @@ if ($action == 'create')
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
/*
* Documents generes
*/

View File

@ -2764,6 +2764,8 @@ class Propal extends CommonObject
*/
function availability($availability_id, $notrigger=0)
{
global $user;
if ($this->statut >= self::STATUS_DRAFT)
{
$error=0;
@ -3035,6 +3037,7 @@ class Propal extends CommonObject
$response->warning_delay = $delay_warning/60/60/24;
$response->label = $label;
$response->url = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals';
$response->url_late = DOL_URL_ROOT.'/comm/propal/list.php?viewstatut='.$statut.'&mainmenu=commercial&leftmenu=propals&sortfield=p.datep&sortorder=asc';
$response->img = img_object($langs->trans("Propals"),"propal");
// This assignment in condition is not a bug. It allows walking the results.

View File

@ -114,7 +114,7 @@ if ($action == 'confirm_split' && GETPOST("confirm") == 'yes')
$newdiscount2->amount_ttc=price2num($discount->amount_ttc-$newdiscount1->amount_ttc);
$newdiscount1->amount_ht=price2num($newdiscount1->amount_ttc/(1+$newdiscount1->tva_tx/100),'MT');
$newdiscount2->amount_ht=price2num($newdiscount2->amount_ttc/(1+$newdiscount2->tva_tx/100),'MT');
$newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount2->amount_ht);
$newdiscount1->amount_tva=price2num($newdiscount1->amount_ttc-$newdiscount1->amount_ht);
$newdiscount2->amount_tva=price2num($newdiscount2->amount_ttc-$newdiscount2->amount_ht);
$db->begin();
@ -381,6 +381,15 @@ if ($socid > 0)
print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
}
elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
{
print '<td class="nowrap">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
}
else
{
print '<td>';
@ -540,6 +549,15 @@ if ($socid > 0)
print preg_replace('/\(DEPOSIT\)/',$langs->trans("InvoiceDeposit"),$obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
}
elseif (preg_match('/\(EXCESS RECEIVED\)/',$obj->description))
{
print '<td class="nowrap">';
$facturestatic->id=$obj->fk_facture_source;
$facturestatic->ref=$obj->ref;
$facturestatic->type=$obj->type;
print preg_replace('/\(EXCESS RECEIVED\)/',$langs->trans("Invoice"),$obj->description).' '.$facturestatic->getNomURl(1);
print '</td>';
}
else
{
print '<td>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2016 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012-2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
@ -51,6 +51,10 @@ if (! empty($conf->projet->enabled)) {
}
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('orders');
$langs->load('sendings');
$langs->load('companies');
@ -640,7 +644,8 @@ if (empty($reshook))
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$price_ht_devise = GETPOST('multicurrency_price_ht');
if (GETPOST('prod_entry_mode') == 'free')
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free')
{
$idprod=0;
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
@ -670,11 +675,11 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && (! ($price_ht_devise >= 0) || $price_ht_devise == '')) // Unit price can be 0 but not ''
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && (! ($price_ht_devise >= 0) || $price_ht_devise == '')) // Unit price can be 0 but not ''
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error++;
@ -683,11 +688,25 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
}
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination
$prodcomb = new ProductCombination($db);
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child;
} else {
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
$error ++;
}
}
}
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
// Clean parameters
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start'.$predef.'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
@ -1187,54 +1206,10 @@ if (empty($reshook))
}
}
if ($action == 'builddoc') // In get or post
{
// Save last template used to generate document
if (GETPOST('model'))
$object->setDocModel($user, GETPOST('model', 'alpha'));
if (GETPOST('fk_bank')) { // this field may come from an external module
$object->fk_bank = GETPOST('fk_bank');
} else {
$object->fk_bank = $object->fk_account;
}
// Define output language
$outputlangs = $langs;
$newlang = '';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id']))
$newlang = $_REQUEST['lang_id'];
if ($conf->global->MAIN_MULTILANGS && empty($newlang))
$newlang = $object->thirdparty->default_lang;
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
$result = $object->generateDocument($object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref);
if ($result <= 0)
{
setEventMessages($object->error, $object->errors, 'errors');
$action='';
}
}
// Remove file in doc form
if ($action == 'remove_file')
{
if ($object->id > 0)
{
require_once DOL_DOCUMENT_ROOT . '/core/lib/files.lib.php';
$langs->load("other");
$upload_dir = $conf->commande->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret = dol_delete_file($file, 0, 0, 0, $object);
if ($ret)
setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs');
else
setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors');
$action = '';
}
}
// Actions to build doc
$upload_dir = $conf->commande->dir_output;
$permissioncreate = $user->rights->commande->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
if ($action == 'update_extras')
{
@ -2463,7 +2438,7 @@ if ($action == 'create' && $user->rights->commande->creer)
}
print '</table>';
print '</div>';
print "</form>\n";
dol_fiche_end();
@ -2606,7 +2581,7 @@ if ($action == 'create' && $user->rights->commande->creer)
if ($action != 'presend')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
print '<a name="builddoc"></a>'; // ancre
// Documents
$comref = dol_sanitizeFileName($object->ref);
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';

View File

@ -13,7 +13,7 @@
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -56,6 +56,10 @@ if (! empty($conf->projet->enabled)) {
}
require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('bills');
$langs->load('companies');
$langs->load('compta');
@ -602,7 +606,7 @@ if (empty($reshook))
$canconvert=0;
if ($object->type == Facture::TYPE_DEPOSIT && $object->paye == 1 && empty($discountcheck->id)) $canconvert=1; // we can convert deposit into discount if deposit is payed completely and not already converted (see real condition into condition used to show button converttoreduc)
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
if (($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_STANDARD) && $object->paye == 0 && empty($discountcheck->id)) $canconvert=1; // we can convert credit note into discount if credit note is not payed back and not already converted and amount of payment is 0 (see real condition into condition used to show button converttoreduc)
if ($canconvert)
{
$db->begin();
@ -626,6 +630,8 @@ if (empty($reshook))
$discount->description = '(CREDIT_NOTE)';
elseif ($object->type == Facture::TYPE_DEPOSIT)
$discount->description = '(DEPOSIT)';
elseif ($object->type == Facture::TYPE_STANDARD)
$discount->description = '(EXCESS RECEIVED)';
else {
setEventMessages($langs->trans('CantConvertToReducAnInvoiceOfThisType'), null, 'errors');
}
@ -634,20 +640,46 @@ if (empty($reshook))
$discount->fk_facture_source = $object->id;
$error = 0;
foreach ($amount_ht as $tva_tx => $xxx)
{
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
if ($object->type == Facture::TYPE_STANDARD) {
// If we're on a standard invoice, we have to get excess received to create it in TTC wuthout VAT
$sql = 'SELECT SUM(pf.amount) as total_paiements
FROM llx_c_paiement as c, llx_paiement_facture as pf, llx_paiement as p
WHERE pf.fk_facture = '.$object->id.' AND p.fk_paiement = c.id AND pf.fk_paiement = p.rowid ORDER BY p.datep, p.tms';
$resql = $db->query($sql);
$res = $db->fetch_object($resql);
$total_paiements = $res->total_paiements;
$discount->amount_ht = $discount->amount_ttc = $total_paiements - $object->total_ttc;
$discount->amount_tva = 0;
$discount->tva_tx = 0;
$result = $discount->create($user);
if ($result < 0)
{
$error++;
break;
}
} else {
foreach ($amount_ht as $tva_tx => $xxx)
{
$discount->amount_ht = abs($amount_ht[$tva_tx]);
$discount->amount_tva = abs($amount_tva[$tva_tx]);
$discount->amount_ttc = abs($amount_ttc[$tva_tx]);
$discount->tva_tx = abs($tva_tx);
$result = $discount->create($user);
if ($result < 0)
{
$error++;
break;
}
}
}
if (empty($error))
@ -1334,7 +1366,8 @@ if (empty($reshook))
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$price_ht = GETPOST('price_ht');
$price_ht_devise = GETPOST('multicurrency_price_ht');
if (GETPOST('prod_entry_mode') == 'free')
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free')
{
$idprod=0;
$tva_tx = (GETPOST('tva_tx') ? GETPOST('tva_tx') : 0);
@ -1364,7 +1397,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPriceHT'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
if (! GETPOST('prod_entry_mode'))
if (!$prod_entry_mode)
{
if (GETPOST('type') < 0 && ! GETPOST('search_idprod'))
{
@ -1372,11 +1405,11 @@ if (empty($reshook))
$error ++;
}
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && GETPOST('type') < 0) {
if ($prod_entry_mode == 'free' && empty($idprod) && GETPOST('type') < 0) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not ''
{
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors');
$error ++;
@ -1385,7 +1418,7 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error ++;
}
if (GETPOST('prod_entry_mode') == 'free' && empty($idprod) && empty($product_desc)) {
if ($prod_entry_mode == 'free' && empty($idprod) && empty($product_desc)) {
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error ++;
}
@ -1394,7 +1427,23 @@ if (empty($reshook))
setEventMessages($langs->trans('ErrorQtyForCustomerInvoiceCantBeNegative'), null, 'errors');
$error ++;
}
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination
$prodcomb = new ProductCombination($db);
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child;
} else {
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
$error ++;
}
}
}
if (! $error && ($qty >= 0) && (! empty($product_desc) || ! empty($idprod))) {
$ret = $object->fetch($id);
if ($ret < 0) {
dol_print_error($db, $object->error);
@ -1727,7 +1776,7 @@ if (empty($reshook))
}
}
}
$result = $object->updateline(GETPOST('lineid'), $description, $pu_ht, $qty, GETPOST('remise_percent'),
$date_start, $date_end, $vat_rate, $localtax1_rate, $localtax2_rate, 'HT', $info_bits, $type,
GETPOST('fk_parent_line'), 0, $fournprice, $buyingprice, $label, $special_code, $array_options, GETPOST('progress'),
@ -2119,7 +2168,7 @@ if ($action == 'create')
print '</tr>' . "\n";
$exampletemplateinvoice=new FactureRec($db);
// Overwrite value if creation of invoice is from a predefined invoice
if (empty($origin) && empty($originid) && GETPOST('fac_rec','int') > 0)
{
@ -2436,7 +2485,7 @@ if ($action == 'create')
}
$datefacture = dol_mktime(12, 0, 0, $_POST['remonth'], $_POST['reday'], $_POST['reyear']);
// Date invoice
print '<tr><td class="fieldrequired">' . $langs->trans('DateInvoice') . '</td><td colspan="2">';
print $form->select_date($datefacture?$datefacture:$dateinvoice, '', '', '', '', "add", 1, 1, 1);
@ -2542,15 +2591,15 @@ if ($action == 'create')
'__INVOICE_YEAR__' => $langs->trans("PreviousYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date($dateexample,'%Y').')',
'__INVOICE_NEXT_YEAR__' => $langs->trans("NextYearOfInvoice").' ('.$langs->trans("Example").': '.dol_print_date(dol_time_plus_duree($dateexample, 1, 'y'),'%Y').')'
);
$htmltext = '<i>'.$langs->trans("FollowingConstantsWillBeSubstituted").':<br>';
foreach($substitutionarray as $key => $val)
{
$htmltext.=$key.' = '.$langs->trans($val).'<br>';
}
$htmltext.='</i>';
$htmltext.='</i>';
}
// Public note
print '<tr>';
print '<td class="border tdtop">';
@ -2718,8 +2767,8 @@ else if ($id > 0 || ! empty($ref))
$filterabsolutediscount = "fk_facture_source IS NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
$filtercreditnote = "fk_facture_source IS NOT NULL"; // If we want deposit to be substracted to payments only and not to total of final invoice
} else {
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')";
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%'";
$filterabsolutediscount = "fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%'))";
$filtercreditnote = "fk_facture_source IS NOT NULL AND description NOT LIKE '(DEPOSIT)%' AND description NOT LIKE '(EXCESS RECEIVED)%'";
}
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
@ -2742,7 +2791,10 @@ else if ($id > 0 || ! empty($ref))
// Confirmation de la conversion de l'avoir en reduc
if ($action == 'converttoreduc') {
$text = $langs->trans('ConfirmConvertToReduc');
if($object->type == 0) $type_fac = 'ExcessReceived';
elseif($object->type == 2) $type_fac = 'CreditNote';
elseif($object->type == 3) $type_fac = 'Deposit';
$text = $langs->trans('ConfirmConvertToReduc', strtolower($langs->transnoentities($type_fac)));
$formconfirm = $form->formconfirm($_SERVER['PHP_SELF'] . '?facid=' . $object->id, $langs->trans('ConvertToReduc'), $text, 'confirm_converttoreduc', '', "yes", 2);
}
@ -3470,7 +3522,7 @@ else if ($id > 0 || ! empty($ref))
print '</table>';
// List of previous situation invoices
$sign = 1;
@ -3582,9 +3634,9 @@ else if ($id > 0 || ! empty($ref))
print '</table>';
}
// List of payments already done
print '<table class="noborder paymenttable" width="100%">';
print '<tr class="liste_titre">';
@ -3893,7 +3945,7 @@ else if ($id > 0 || ! empty($ref))
print "</table>\n";
print "</div>";
print "</form>\n";
dol_fiche_end();
@ -3932,7 +3984,10 @@ else if ($id > 0 || ! empty($ref))
}
}
}
$discount = new DiscountAbsolute($db);
$result = $discount->fetch(0, $object->id);
// Reopen a standard paid invoice
if ((($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT)
|| ($object->type == Facture::TYPE_CREDIT_NOTE && empty($discount->id))
@ -3958,7 +4013,7 @@ else if ($id > 0 || ! empty($ref))
}
// Send by mail
if (($object->statut == 1 || $object->statut == 2) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if (($object->statut == Facture::STATUS_VALIDATED || $object->statut == Facture::STATUS_CLOSED) || ! empty($conf->global->FACTURE_SENDBYEMAIL_FOR_ALL_STATUS)) {
if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendByMail') . '</span></div>';
} else {
@ -3969,21 +4024,27 @@ else if ($id > 0 || ! empty($ref))
}
}
// deprecated. Useless because now we can use templates
if (! empty($conf->global->FACTURE_SHOW_SEND_REMINDER)) // For backward compatibility
// Request a direct debit order
if ($object->statut > Facture::STATUS_DRAFT && $object->paye == 0 && $num == 0)
{
if (($object->statut == 1 || $object->statut == 2) && $resteapayer > 0) {
if ($objectidnext) {
print '<div class="inline-block divButAction"><span class="butActionRefused" title="' . $langs->trans("DisabledBecauseReplacedInvoice") . '">' . $langs->trans('SendRemindByMail') . '</span></div>';
} else {
if (empty($conf->global->MAIN_USE_ADVANCED_PERMS) || $user->rights->facture->invoice_advance->send) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER['PHP_SELF'] . '?facid=' . $object->id . '&amp;action=prerelance&amp;mode=init">' . $langs->trans('SendRemindByMail') . '</a></div>';
} else
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">' . $langs->trans('SendRemindByMail') . '</a></div>';
}
}
if ($resteapayer > 0)
{
if ($user->rights->prelevement->bons->creer)
{
$langs->load("withdrawals");
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/facture/prelevement.php?facid='.$object->id.'" title="'.dol_escape_htmltag($langs->trans("MakeWithdrawRequest")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
else
{
//print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("NotEnoughPermissions")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
}
else
{
//print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("AmountMustBePositive")).'">'.$langs->trans("MakeWithdrawRequest").'</a>';
}
}
// Create payment
if ($object->type != Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement) {
if ($objectidnext) {
@ -3998,7 +4059,7 @@ else if ($id > 0 || ! empty($ref))
}
// Reverse back money or convert to reduction
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT) {
if ($object->type == Facture::TYPE_CREDIT_NOTE || $object->type == Facture::TYPE_DEPOSIT || $object->type == Facture::TYPE_STANDARD) {
// For credit note only
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->paiement)
{
@ -4012,6 +4073,11 @@ else if ($id > 0 || ! empty($ref))
}
}
// For standard invoice with excess received
if ($object->type == Facture::TYPE_STANDARD && empty($object->paye) && ($object->total_ttc - $totalpaye - $totalcreditnotes - $totaldeposits) < 0 && $user->rights->facture->creer && empty($discount->id))
{
print '<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER["PHP_SELF"].'?facid='.$object->id.'&amp;action=converttoreduc">'.$langs->trans('ConvertExcessReceivedToReduc').'</a></div>';
}
// For credit note
if ($object->type == Facture::TYPE_CREDIT_NOTE && $object->statut == 1 && $object->paye == 0 && $user->rights->facture->creer && $object->getSommePaiement() == 0) {
print '<div class="inline-block divButAction"><a class="butAction" href="' . $_SERVER["PHP_SELF"] . '?facid=' . $object->id . '&amp;action=converttoreduc">' . $langs->trans('ConvertToReduc') . '</a></div>';

View File

@ -414,7 +414,7 @@ if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')';
if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')';
if ($search_company) $sql .= natural_search('s.nom', $search_company);
if ($search_montant_ht != '') $sql.= natural_search('f.total', $search_montant_ht, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.total_vat', $search_montant_vat, 1);
if ($search_montant_vat != '') $sql.= natural_search('f.tva', $search_montant_vat, 1);
if ($search_montant_ttc != '') $sql.= natural_search('f.total_ttc', $search_montant_ttc, 1);
if ($search_status != '' && $search_status >= 0)
{

View File

@ -128,7 +128,7 @@ if (is_dir($dir))
asort($linkforyear);
foreach($linkforyear as $cursoryear)
{
print '<a href="rapport.php?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
}
if ($year)

View File

@ -124,24 +124,16 @@ if ($nb < 0 || $nb1 < 0 || $nb11 < 0)
print '<table class="border" width="100%">';
print '<tr><td class="titlefield">'.$langs->trans("NbOfInvoiceToWithdraw").'</td>';
print '<td align="right">';
print '<td>';
print $nb;
print '</td></tr>';
print '<tr><td>'.$langs->trans("AmountToWithdraw").'</td>';
print '<td align="right">';
print '<td>';
print price($pricetowithdraw);
print '</td>';
print '</tr>';
//print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdraw").' + '.$langs->trans("ThirdPartyBankCode").'='.$conf->global->PRELEVEMENT_CODE_BANQUE.'</td><td align="right">';
//print $nb1;
//print '</td></tr>';
//print '<tr><td>'.$langs->trans("NbOfInvoiceToWithdrawWithInfo").'</td><td align="right">';
//print $nb11;
//print '</td></tr>';
print '</table>';
print '</div>';
@ -158,8 +150,6 @@ else
{
print '<a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->transnoentitiesnoconv("NoInvoiceToWithdraw")).'">'.$langs->trans("CreateAll")."</a>\n";
}
//if ($nb11) print '<a class="butAction" href="create.php?action=create&amp;banque=1">'.$langs->trans("CreateBanque")."</a>\n";
//if ($nb1) print '<a class="butAction" href="create.php?action=create&amp;banque=1&amp;guichet=1">'.$langs->trans("CreateGuichet")."</a>\n";
print "</div>\n";
print '<br>';
@ -247,7 +237,7 @@ else
/*
* List of last withdraws
* List of latest withdraws
*/
$limit=5;

View File

@ -59,9 +59,7 @@ llxHeader('',$langs->trans("CustomersStandingOrdersArea"));
if (prelevement_check_config() < 0)
{
$langs->load("errors");
print '<div class="error">';
print $langs->trans("ErrorModuleSetupNotComplete");
print '</div>';
setEventMessages($langs->trans("ErrorModuleSetupNotComplete"), null, 'errors');
}
print load_fiche_titre($langs->trans("CustomersStandingOrdersArea"));

View File

@ -41,61 +41,61 @@ class Contact extends CommonObject
public $table_element='socpeople';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
var $civility_id; // In fact we store civility_code
var $civility_code;
var $address;
var $zip;
var $town;
public $civility_id; // In fact we store civility_code
public $civility_code;
public $address;
public $zip;
public $town;
/**
* @deprecated
* @see state_id
*/
var $fk_departement;
public $fk_departement;
/**
* @deprecated
* @see state_code
*/
var $departement_code;
public $departement_code;
/**
* @deprecated
* @see state
*/
var $departement;
var $state_id; // Id of department
var $state_code; // Code of department
var $state; // Label of department
public $departement;
public $state_id; // Id of department
public $state_code; // Code of department
public $state; // Label of department
var $poste; // Position
public $poste; // Position
var $socid; // fk_soc
var $statut; // 0=inactif, 1=actif
public $socid; // fk_soc
public $statut; // 0=inactif, 1=actif
var $code;
var $email;
var $skype;
var $photo;
var $jabberid;
var $phone_pro;
var $phone_perso;
var $phone_mobile;
var $fax;
public $code;
public $email;
public $skype;
public $photo;
public $jabberid;
public $phone_pro;
public $phone_perso;
public $phone_mobile;
public $fax;
var $priv;
public $priv;
var $birthday;
var $default_lang;
var $no_email; // 1=Don't send e-mail to this contact, 0=do
public $birthday;
public $default_lang;
public $no_email; // 1=Don't send e-mail to this contact, 0=do
var $ref_facturation; // Nb de reference facture pour lequel il est contact
var $ref_contrat; // Nb de reference contrat pour lequel il est contact
var $ref_commande; // Nb de reference commande pour lequel il est contact
var $ref_propal; // Nb de reference propal pour lequel il est contact
public $ref_facturation; // Reference number of invoice for which it is contact
public $ref_contrat; // Nb de reference contrat pour lequel il est contact
public $ref_commande; // Nb de reference commande pour lequel il est contact
public $ref_propal; // Nb de reference propal pour lequel il est contact
var $user_id;
var $user_login;
public $user_id;
public $user_login;
var $oldcopy; // To contains a clone of this when we need to save old properties of object
public $oldcopy; // To contains a clone of this when we need to save old properties of object
/**

View File

@ -7,7 +7,7 @@
* Copyright (C) 2013 Christophe Battarel <christophe.battarel@altairis.fr>
* Copyright (C) 2013-2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014-2016 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
@ -446,7 +446,7 @@ if (empty($reshook))
unset($_POST["options_" . $key]);
}
}
if (! $error)
{
// Clean parameters

View File

@ -91,6 +91,9 @@ if ($action == 'builddoc' && $permissioncreate)
else
{
setEventMessages($langs->trans("FileGenerated"), null);
header('Location: '.$_SERVER['REQUEST_URI'].'#builddoc');
exit;
}
}
}

View File

@ -24,31 +24,57 @@ if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
global $user, $db, $langs, $conf;
$time = GETPOST('time');
$time = (int) GETPOST('time'); // Use the time parameter that is always increased by time_update, even if call is late
//$time=dol_now();
session_start();
$time_update = (empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)?'3':(int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY);
$eventfound = array();
//Uncomment this to force a test
//$eventfound[]=array('type'=>'agenda', 'id'=>1, 'tipo'=>'eee', 'location'=>'aaa');
$eventos = array();
//$eventos[]=array('type'=>'agenda', 'id'=>1, 'tipo'=>'eee', 'location'=>'aaa');
//dol_syslog('time='.$time.' $_SESSION[auto_ck_events_not_before]='.$_SESSION['auto_check_events_not_before']);
// TODO Remove test on session. Timer should be managed by a javascript timer
if ($_SESSION['auto_check_events'] <= (int) $time)
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when several tabs are opened.
if ($time >= $_SESSION['auto_check_events_not_before'])
{
$_SESSION['auto_check_events'] = $time + $time_update;
$time_update = (int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined
if (! empty($_SESSION['auto_check_events_not_before']))
{
// We start scan from the not before so if two tabs were opend at differents seconds and we close one (so the js timer),
// then we are not losing periods
$starttime = $_SESSION['auto_check_events_not_before'];
// Protection to avoid too long sessions
if ($starttime < ($time - (int) $conf->global->MAIN_SESSION_TIMEOUT))
{
dol_syslog("We ask to check browser notification on a too large period. We fix this with current date.");
$starttime = $time;
}
}
else
{
$starttime = $time;
}
$_SESSION['auto_check_events_not_before'] = $time + $time_update;
// Force save of session change we did.
// WARNING: Any change in sessions after that will not be saved !
session_write_close();
require_once DOL_DOCUMENT_ROOT.'/comm/action/class/actioncomm.class.php';
dol_syslog('NEW $_SESSION[auto_check_events_not_before]='.$_SESSION['auto_check_events_not_before']);
$sql = 'SELECT id';
$sql .= ' FROM ' . MAIN_DB_PREFIX . 'actioncomm a, ' . MAIN_DB_PREFIX . 'actioncomm_resources ar';
$sql .= ' WHERE a.id = ar.fk_actioncomm';
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when.
// This need to extend period to be sure to not miss and save what we notified to avoid duplicate (save is not done yet).
$sql .= " AND datep BETWEEN '" . $db->idate($time + 1) . "' AND '" . $db->idate($time + $time_update) . "'";
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when several tabs are opened.
// This need to extend period to be sure to not miss and save in session what we notified to avoid duplicate (save is not done yet).
$sql .= " AND datep BETWEEN '" . $db->idate($starttime) . "' AND '" . $db->idate($time + $time_update - 1) . "'";
$sql .= ' AND a.code <> "AC_OTH_AUTO"';
$sql .= ' AND ar.element_type = "user"';
$sql .= ' AND ar.fk_element = ' . $user->id;
@ -59,8 +85,10 @@ if ($_SESSION['auto_check_events'] <= (int) $time)
$actionmod = new ActionComm($db);
while ($obj = $db->fetch_object($resql)) {
while ($obj = $db->fetch_object($resql))
{
$langs->load("agenda");
$actionmod->fetch($obj->id);
$event = array();
@ -68,13 +96,13 @@ if ($_SESSION['auto_check_events'] <= (int) $time)
$event['id'] = $actionmod->id;
$event['tipo'] = $langs->transnoentities('Action' . $actionmod->code);
$event['titulo'] = $actionmod->label;
$event['location'] = $actionmod->location;
$event['location'] = $langs->transnoentities('Location').': '.$actionmod->location;
$eventos[] = $event;
$eventfound[] = $event;
}
}
}
print json_encode($eventos);
print json_encode($eventfound);

View File

@ -3699,6 +3699,12 @@ abstract class CommonObject
$discount->fetch($line->fk_remise_except);
$this->tpl['description'] = $langs->transnoentities("DiscountFromDeposit",$discount->getNomUrl(0));
}
elseif ($line->desc == '(EXCESS RECEIVED)')
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
$this->tpl['description'] = $langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0));
}
else
{
$this->tpl['description'] = dol_trunc($line->desc,60);
@ -4550,7 +4556,7 @@ abstract class CommonObject
var parent = $(this).find("option[parent]:first").attr("parent");
var infos = parent.split(":");
var parent_list = infos[0];
$("select[name=\"options_"+parent_list+"\"]").change(function() {
$("select[name=\""+parent_list+"\"]").change(function() {
showOptions(child_list, parent_list);
});
});

View File

@ -420,6 +420,8 @@ class Conf
if (empty($this->global->MAIN_MONNAIE)) $this->global->MAIN_MONNAIE='EUR';
$this->currency=$this->global->MAIN_MONNAIE;
if (empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY = 30; // Less than 1 minutes to be sure
// conf->global->ACCOUNTING_MODE = Option des modules Comptabilites (simple ou expert). Defini le mode de calcul des etats comptables (CA,...)
if (empty($this->global->ACCOUNTING_MODE)) $this->global->ACCOUNTING_MODE='RECETTES-DEPENSES'; // By default. Can be 'RECETTES-DEPENSES' ou 'CREANCES-DETTES'

View File

@ -1,5 +1,5 @@
<?php
/* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
/* Copyright (C) 2014-2017 Alexandre Spangaro <aspangaro@zendsi.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
@ -89,7 +89,7 @@ class Fiscalyear extends CommonObject
$sql.= " '".$this->label."'";
$sql.= ", '".$this->db->idate($this->date_start)."'";
$sql.= ", ".($this->date_end ? "'".$this->db->idate($this->date_end)."'":"null");
$sql.= ", ".$this->statut;
$sql.= ", 0";
$sql.= ", ".$conf->entity;
$sql.= ", '".$this->db->idate($now)."'";
$sql.= ", ". $user->id;

View File

@ -231,15 +231,15 @@ class HookManager
if (is_array($parameters) && ! empty($parameters['special_code']) && $parameters['special_code'] > 3 && $parameters['special_code'] != $actionclassinstance->module_number) continue;
//dol_syslog("Call method ".$method." of class ".get_class($actionclassinstance).", module=".$module.", hooktype=".$hooktype, LOG_DEBUG);
$result = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
$resaction = $actionclassinstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if (! empty($actionclassinstance->results) && is_array($actionclassinstance->results)) $this->resArray =array_merge($this->resArray, $actionclassinstance->results);
if (! empty($actionclassinstance->resprints)) $this->resPrint.=$actionclassinstance->resprints;
// TODO dead code to remove (do not enable this, but fix hook instead): result must not be a string. we must use $actionclassinstance->resprints to return a string
if (! is_array($result) && ! is_numeric($result))
if (! is_array($resaction) && ! is_numeric($resaction))
{
dol_syslog('Error: Bug into hook '.$method.' of module class '.get_class($actionclassinstance).'. Method must not return a string but an int (0=OK, 1=Replace, -1=KO) and set string into ->resprints', LOG_ERR);
if (empty($actionclassinstance->resprints)) { $this->resPrint.=$result; $result=0; }
if (empty($actionclassinstance->resprints)) { $this->resPrint.=$resaction; $resaction=0; }
}
}

View File

@ -12,7 +12,7 @@
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2014 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Herve Prot <herve.prot@symeos.com>
* Copyright (C) 2012-2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012 Cedric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2012-2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2014 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
@ -80,7 +80,7 @@ class Form
* @param string $typeofdata Type of data ('string' by default, 'email', 'amount:99', 'numeric:99', 'text' or 'textarea:rows:cols', 'datepicker' ('day' do not work, don't know why), 'ckeditor:dolibarr_zzz:width:height:savemethod:1:rows:cols', 'select;xxx[:class]'...)
* @param string $moreparam More param to add on a href URL.
* @param int $fieldrequired 1 if we want to show field as mandatory using the "fieldrequired" CSS.
* @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' '
* @param int $notabletag 1=Do not output table tags but output a ':', 2=Do not output table tags and no ':', 3=Do not output table tags but output a ' '
* @return string HTML edit field
*/
function editfieldkey($text, $htmlname, $preselected, $object, $perm, $typeofdata='string', $moreparam='', $fieldrequired=0, $notabletag=0)
@ -464,8 +464,8 @@ class Form
* @param string $text Text to show
* @param string $htmltext Content of tooltip
* @param int $direction 1=Icon is after text, -1=Icon is before text, 0=no icon
* @param string $type Type of picto (info, help, warning, superadmin...) OR image filepath (mypicto@mymodule)
* @param string $extracss Add a CSS style to td tags
* @param string $type Type of picto ('info', 'help', 'warning', 'superadmin', 'mypicto@mymodule', ...) or image filepath
* @param string $extracss Add a CSS style to td, div or span tag
* @param int $noencodehtmltext Do not encode into html entity the htmltext
* @param int $notabs 0=Include table and tr tags, 1=Do not include table and tr tags, 2=use div, 3=use span
* @return string HTML code of text, picto, tooltip
@ -512,7 +512,7 @@ class Form
*
* @param string $selected Value auto selected when at least one record is selected. Not a preselected value. Use '0' by default.
* @param int $arrayofaction array('code'=>'label', ...). The code is the key stored into the GETPOST('massaction') when submitting action.
* @param int $alwaysvisible 1=select button always visible
* @param int $alwaysvisible 1=select button always visible
* @return string Select list
*/
function selectMassAction($selected, $arrayofaction, $alwaysvisible=0)
@ -586,7 +586,7 @@ class Form
</script>
';
}
return $ret;
}
@ -1171,6 +1171,7 @@ class Form
$desc=dol_trunc($obj->description,40);
if (preg_match('/\(CREDIT_NOTE\)/', $desc)) $desc=preg_replace('/\(CREDIT_NOTE\)/', $langs->trans("CreditNote"), $desc);
if (preg_match('/\(DEPOSIT\)/', $desc)) $desc=preg_replace('/\(DEPOSIT\)/', $langs->trans("Deposit"), $desc);
if (preg_match('/\(EXCESS RECEIVED\)/', $desc)) $desc=preg_replace('/\(EXCESS RECEIVED\)/', $langs->trans("ExcessReceived"), $desc);
$selectstring='';
if ($selected > 0 && $selected == $obj->rowid) $selectstring=' selected';
@ -1409,7 +1410,7 @@ class Form
// Build list includeUsers to have only hierarchy and current user
$includeUsers = implode(",",$user->getAllChildIds(1));
}
$out='';
// On recherche les utilisateurs
@ -1615,7 +1616,7 @@ class Form
$i++;
}
if ($nbassignetouser) $out.='</div>';
//$out.='</form>';
return $out;
}
@ -1641,11 +1642,12 @@ class Form
* @param int $hidepriceinlabel 1=Hide prices in label
* @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used
* 'warehouseopen' = select products from open warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @param array $selected_combinations Selected combinations. Format: array([attrid] => attrval, [...])
* @return void
*/
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='')
function select_produits($selected='', $htmlname='productid', $filtertype='', $limit=20, $price_level=0, $status=1, $finished=2, $selected_input_value='', $hidelabel=0, $ajaxoptions=array(), $socid=0, $showempty='1', $forcecombo=0, $morecss='', $hidepriceinlabel=0, $warehouseStatus='', $selected_combinations = array())
{
global $langs,$conf;
@ -1670,6 +1672,80 @@ class Form
$urloption.='&socid='.$socid;
}
print ajax_autocompleter($selected, $htmlname, DOL_URL_ROOT.'/product/ajax/products.php', $urloption, $conf->global->PRODUIT_USE_SEARCH_TO_SELECT, 0, $ajaxoptions);
if (!empty($conf->variants->enabled)) {
?>
<script>
selected = <?php echo json_encode($selected_combinations) ?>;
combvalues = {};
jQuery(document).ready(function () {
jQuery("input[name='prod_entry_mode']").change(function () {
if (jQuery(this).val() == 'free') {
jQuery('div#attributes_box').empty();
}
});
jQuery("input#<?php echo $htmlname ?>").change(function () {
if (!jQuery(this).val()) {
jQuery('div#attributes_box').empty();
return;
}
jQuery.getJSON("<?php echo dol_buildpath('/variants/ajax/getCombinations.php', 2) ?>", {
id: jQuery(this).val()
}, function (data) {
jQuery('div#attributes_box').empty();
jQuery.each(data, function (key, val) {
combvalues[val.id] = val.values;
var span = jQuery(document.createElement('div')).css({
'display': 'table-row'
});
span.append(
jQuery(document.createElement('div')).text(val.label).css({
'font-weight': 'bold',
'display': 'table-cell',
'text-align': 'right'
})
);
var html = jQuery(document.createElement('select')).attr('name', 'combinations[' + val.id + ']').css({
'margin-left': '15px',
'white-space': 'pre'
}).append(
jQuery(document.createElement('option')).val('')
);
jQuery.each(combvalues[val.id], function (key, val) {
var tag = jQuery(document.createElement('option')).val(val.id).html(val.value);
if (selected[val.fk_product_attribute] == val.id) {
tag.attr('selected', 'selected');
}
html.append(tag);
});
span.append(html);
jQuery('div#attributes_box').append(span);
});
})
});
<?php if ($selected): ?>
jQuery("input#<?php echo $htmlname ?>").change();
<?php endif ?>
});
</script>
<?php
}
if (empty($hidelabel)) print $langs->trans("RefOrLabel").' : ';
else if ($hidelabel > 1) {
if (! empty($conf->global->MAIN_HTML5_PLACEHOLDER)) $placeholder=' placeholder="'.$langs->trans("RefOrLabel").'"';
@ -1708,7 +1784,7 @@ class Form
* @param int $hidepriceinlabel 1=Hide prices in label
* @param string $warehouseStatus warehouse status filter, following comma separated filter options can be used
* 'warehouseopen' = select products from open warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseclosed' = select products from closed warehouses,
* 'warehouseinternal' = select products from warehouses for internal correct/transfer only
* @return array Array of keys for json
*/
@ -1723,19 +1799,19 @@ class Form
if (! empty($warehouseStatus))
{
require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php';
if (preg_match('/warehouseclosed/', $warehouseStatus))
if (preg_match('/warehouseclosed/', $warehouseStatus))
{
$warehouseStatusArray[] = Entrepot::STATUS_CLOSED;
}
if (preg_match('/warehouseopen/', $warehouseStatus))
if (preg_match('/warehouseopen/', $warehouseStatus))
{
$warehouseStatusArray[] = Entrepot::STATUS_OPEN_ALL;
}
if (preg_match('/warehouseinternal/', $warehouseStatus))
if (preg_match('/warehouseinternal/', $warehouseStatus))
{
$warehouseStatusArray[] = Entrepot::STATUS_OPEN_INTERNAL;
}
}
}
$selectFields = " p.rowid, p.label, p.ref, p.description, p.barcode, p.fk_product_type, p.price, p.price_ttc, p.price_base_type, p.tva_tx, p.duration, p.fk_price_expression";
(count($warehouseStatusArray)) ? $selectFieldsGrouped = ", sum(ps.reel) as stock" : $selectFieldsGrouped = ", p.stock";
@ -1774,7 +1850,7 @@ class Form
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as ps on ps.fk_product = p.rowid";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e on ps.fk_entrepot = e.rowid";
}
//Price by customer
if (! empty($conf->global->PRODUIT_CUSTOMER_PRICES) && !empty($socid)) {
$sql.=" LEFT JOIN ".MAIN_DB_PREFIX."product_customer_price as pcp ON pcp.fk_soc=".$socid." AND pcp.fk_product=p.rowid";
@ -1784,11 +1860,21 @@ class Form
{
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_lang as pl ON pl.fk_product = p.rowid AND pl.lang='". $langs->getDefaultLang() ."'";
}
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$sql .= " LEFT JOIN llx_product_attribute_combination pac ON pac.fk_product_child = p.rowid";
}
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
if (count($warehouseStatusArray))
{
$sql.= ' AND (p.fk_product_type = 1 OR e.statut IN ('.implode(',',$warehouseStatusArray).'))';
}
if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) {
$sql .= " AND pac.rowid IS NULL";
}
if ($finished == 0)
{
$sql.= " AND p.finished = ".$finished;
@ -1841,7 +1927,7 @@ class Form
$num = $this->db->num_rows($result);
$events=null;
if ($conf->use_javascript_ajax && ! $forcecombo)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
@ -1849,9 +1935,9 @@ class Form
$out.= $comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
}
$out.='<select class="flat'.($morecss?' '.$morecss:'').'" name="'.$htmlname.'" id="'.$htmlname.'"'.$nodatarole.'>';
$textifempty='';
// Do not use textifempty = ' ' or '&nbsp;' here, or search on key will search on ' key'.
//if (! empty($conf->use_javascript_ajax) || $forcecombo) $textifempty='';
@ -2876,7 +2962,7 @@ class Form
// Set default value if not already set by caller
if (empty($selected) && ! empty($conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID)) $selected = $conf->global->MAIN_DEFAULT_PAYMENT_TERM_ID;
print '<select class="flat" name="'.$htmlname.'">';
if ($addempty) print '<option value="0">&nbsp;</option>';
foreach($this->cache_conditions_paiements as $id => $arrayconditions)
@ -3384,7 +3470,7 @@ class Form
// Clean parameters
$newselectedchoice=empty($selectedchoice)?"no":$selectedchoice;
if ($conf->browser->layout == 'phone') $width='95%';
if (is_array($formquestion) && ! empty($formquestion))
{
// First add hidden fields and value
@ -3650,7 +3736,7 @@ class Form
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
$out='';
$formproject=new FormProjets($this->db);
$langs->load("project");
@ -3678,8 +3764,8 @@ class Form
$out.="&nbsp;";
}
}
if (empty($nooutput))
if (empty($nooutput))
{
print $out;
return '';
@ -4005,7 +4091,7 @@ class Form
}
else
{
if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND description LIKE '(DEPOSIT)%')") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
if (! $filter || $filter=="fk_facture_source IS NULL OR (fk_facture_source IS NOT NULL AND (description LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%'))") print $langs->trans("CompanyHasAbsoluteDiscount",price($amount,0,$langs,0,0,-1,$conf->currency));
else print $langs->trans("CompanyHasCreditNote",price($amount,0,$langs,0,0,-1,$conf->currency));
}
if (empty($hidelist)) print ': ';
@ -4234,7 +4320,7 @@ class Form
// Make select dynamic
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$out.= ajax_combobox($htmlname);
return $out;
}
@ -4429,13 +4515,13 @@ class Form
$key.= $rate['nprtva'] ? '*': '';
if ($mode > 0 && $rate['code']) $key.=' ('.$rate['code'].')';
if ($mode < 0) $key = $rate['rowid'];
$return.= '<option value="'.$key.'"';
if (! $selectedfound)
{
if ($defaultcode) // If defaultcode is defined, we used it in priority to select combo option instead of using rate+npr flag
{
if ($defaultcode == $rate['code'])
if ($defaultcode == $rate['code'])
{
$return.= ' selected';
$selectedfound=true;
@ -4859,7 +4945,7 @@ class Form
* @param string $morecss Add more class to css styles
* @param int $addjscombo Add js combo
* @param string $moreparamonempty Add more param on the empty option line. Not used if show_empty not set.
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry.
* @param int $disablebademail Check if an email is found into value and if not disable and colorize entry.
* @return string HTML select string.
* @see multiselectarray
*/
@ -4881,7 +4967,7 @@ class Form
{
$minLengthToAutocomplete=0;
$tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?(constant('REQUIRE_JQUERY_MULTISELECT')?constant('REQUIRE_JQUERY_MULTISELECT'):'select2'):$conf->global->MAIN_USE_JQUERY_MULTISELECT;
// Enhance with select2
$nodatarole='';
if ($conf->use_javascript_ajax)
@ -4908,7 +4994,7 @@ class Form
// Translate
if ($translate)
{
foreach($array as $key => $value)
foreach($array as $key => $value)
{
$array[$key]=$langs->trans($value);
}
@ -5427,7 +5513,7 @@ class Form
$linktoelem='';
$linktoelemlist='';
if (! is_object($object->thirdparty)) $object->fetch_thirdparty();
$possiblelinks=array(
@ -5440,9 +5526,9 @@ class Form
'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id),
'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id)
);
global $action;
// Can complet the possiblelink array
$hookmanager->initHooks(array('commonobject'));
$parameters=array();
@ -5467,7 +5553,7 @@ class Form
$num = 0;
if (empty($possiblelink['enabled'])) continue;
if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto)))
{
print '<div id="'.$key.'list"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>';
@ -5721,10 +5807,10 @@ class Form
if ($conf->browser->layout == 'phone') $ret.='<div class="floatleft">'.$morehtmlleft.'</div>'; // class="center" to have photo in middle
else $ret.='<div class="inline-block floatleft">'.$morehtmlleft.'</div>';
}
//if ($conf->browser->layout == 'phone') $ret.='<div class="clearboth"></div>';
$ret.='<div class="inline-block floatleft valignmiddle refid'.(($shownav && ($previous_ref || $next_ref))?' refidpadding':'').'">';
// For thirdparty, contact, user, member, the ref is the id, so we show something else
if ($object->element == 'societe')
{
@ -5739,8 +5825,8 @@ class Form
{
$ret.=' '.$morehtmlref;
}
$ret.='</div>';
$ret.='</div>';
$ret.='</div><!-- End banner content -->';
return $ret;

View File

@ -34,11 +34,11 @@
*/
class FormFile
{
var $db;
var $error;
var $numoffiles;
var $infofiles; // Used to return informations by function getDocumentsLink
private $db;
public $error;
public $numoffiles;
public $infofiles; // Used to return informations by function getDocumentsLink
/**
@ -548,7 +548,7 @@ class FormFile
if (empty($buttonlabel)) $buttonlabel=$langs->trans('Generate');
if ($conf->browser->layout == 'phone') $urlsource.='#'.$forname.'_form'; // So we switch to form after a generation
if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" name="'.$forname.'" id="'.$forname.'_form" method="post">';
if (empty($noform)) $out.= '<form action="'.$urlsource.(empty($conf->global->MAIN_JUMP_TAG)?'':'#builddoc').'" id="'.$forname.'_form" method="post">';
$out.= '<input type="hidden" name="action" value="builddoc">';
$out.= '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';

View File

@ -984,7 +984,7 @@ class FormMail extends Form
*/
function setSubstitFromObject($object, $outputlangs=null)
{
global $user;
global $conf, $user;
$this->substit['__REF__'] = $object->ref;
$this->substit['__REFCLIENT__'] = isset($object->ref_client) ? $object->ref_client : '';
$this->substit['__REFSUPPLIER__'] = isset($object->ref_supplier) ? $object->ref_supplier : '';
@ -993,6 +993,7 @@ class FormMail extends Form
$this->substit['__DATE_DUE_YMD__'] = isset($object->date_lim_reglement)? dol_print_date($object->date_lim_reglement, 'day', 0, $outputlangs) : '';
$this->substit['__AMOUNT__'] = price($object->total_ttc);
$this->substit['__AMOUNT_WO_TAX__'] = price($object->total_ht);
$this->substit['__AMOUNT_VAT__'] = price($object->total_tva);
$this->substit['__THIRDPARTY_ID__'] = (is_object($object->thirdparty)?$object->thirdparty->id:'');
$this->substit['__THIRDPARTY_NAME__'] = (is_object($object->thirdparty)?$object->thirdparty->name:'');
@ -1005,6 +1006,7 @@ class FormMail extends Form
$this->substit['__PERSONALIZED__'] = '';
$this->substit['__CONTACTCIVNAME__'] = ''; // Will be replace just before sending
//Fill substit_lines with each object lines content
if (is_array($object->lines))
{
@ -1022,10 +1024,10 @@ class FormMail extends Form
'__SUBPRICE__' => price($line->subprice),
'__AMOUNT__' => price($line->total_ttc),
'__AMOUNT_WO_TAX__' => price($line->total_ht),
//'__PRODUCT_EXTRAFIELD_FIELD__' Done dinamically
//'__PRODUCT_EXTRAFIELD_FIELD__' Done dinamically just after
);
// Create dinamic tags for __PRODUCT_EXTRAFIELD_FIELD__
// Create dynamic tags for __PRODUCT_EXTRAFIELD_FIELD__
if (!empty($line->fk_product))
{
$extrafields = new ExtraFields($this->db);
@ -1045,7 +1047,7 @@ class FormMail extends Form
/**
* Set substit array from object
*
* @param string $mode 'form' or 'emailing'
* @param string $mode 'form', 'formwithlines', 'formforlines' or 'emailing'
* @return void
*/
function getAvailableSubstitKey($mode='form')
@ -1054,18 +1056,32 @@ class FormMail extends Form
$vars=array();
if ($mode == 'form')
if ($mode == 'form' || $mode == 'formwithlines' || $mode == 'formforlines')
{
$vars=array(
'__REF__',
'__REFCLIENT__',
'__THIRDPARTY_NAME__',
'__PROJECT_REF__',
'__PROJECT_NAME__',
'__REFSUPPLIER__',
'__THIRDPARTY_ID__',
'__THIRDPARTY_NAME__',
'__PROJECT_ID__',
'__PROJECT_REF__',
'__PROJECT_NAME__',
'__CONTACTCIVNAME__',
'__PERSONALIZED__', // Paypal link will be added here in form mode
'__AMOUNT__',
'__AMOUNT_WO_TAX__',
'__AMOUNT_VAT__',
'__PERSONALIZED__', // Paypal link will be added here in form mode
'__SIGNATURE__',
);
if ($mode == 'formwithlines')
{
$vars[] = '__LINES__'; // Will be set by the get_form function
}
if ($mode == 'formforlines')
{
$vars[] = '__QUANTITY__'; // Will be set by the get_form function
}
}
if ($mode == 'emailing')
{

View File

@ -60,9 +60,10 @@ class FormProjets
* @param int $nooutput No print output. Return it only.
* @param int $forceaddid Force to add project id in list, event if not qualified
* @param string $morecss More css
* @param int $htmlid Html id to use instead of htmlname
* @return string Return html content
*/
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0, $forceaddid=0, $morecss='')
function select_projects($socid=-1, $selected='', $htmlname='projectid', $maxlength=16, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode = 0, $filterkey = '', $nooutput=0, $forceaddid=0, $morecss='', $htmlid='')
{
global $langs,$conf,$form;
@ -90,7 +91,7 @@ class FormProjets
}
else
{
$out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1);
$out.=$this->select_projects_list($socid, $selected, $htmlname, $maxlength, $option_only, $show_empty, $discard_closed, $forcefocus, $disabled, 0, $filterkey, 1, $forceaddid, $htmlid);
if ($discard_closed)
{
if (class_exists('Form'))
@ -125,14 +126,17 @@ class FormProjets
* @param string $filterkey Key to filter
* @param int $nooutput No print output. Return it only.
* @param int $forceaddid Force to add project id in list, event if not qualified
* @param int $htmlid Html id to use instead of htmlname
* @return int Nb of project if OK, <0 if KO
*/
function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '', $nooutput=0, $forceaddid=0)
function select_projects_list($socid=-1, $selected='', $htmlname='projectid', $maxlength=24, $option_only=0, $show_empty=1, $discard_closed=0, $forcefocus=0, $disabled=0, $mode=0, $filterkey = '', $nooutput=0, $forceaddid=0, $htmlid='')
{
global $user,$conf,$langs;
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
if (empty($htmlid)) $htmlid = $htmlname;
$out='';
$outarray=array();
@ -173,14 +177,14 @@ class FormProjets
if (! empty($conf->use_javascript_ajax))
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/ajax.lib.php';
$comboenhancement = ajax_combobox($htmlname, array(), 0, $forcefocus);
$comboenhancement = ajax_combobox($htmlid, array(), 0, $forcefocus);
$out.=$comboenhancement;
$nodatarole=($comboenhancement?' data-role="none"':'');
$minmax='minwidth100 maxwidth300';
}
if (empty($option_only)) {
$out.= '<select class="flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlname.'" name="'.$htmlname.'"'.$nodatarole.'>';
$out.= '<select class="flat'.($minmax?' '.$minmax:'').'"'.($disabled?' disabled="disabled"':'').' id="'.$htmlid.'" name="'.$htmlname.'"'.$nodatarole.'>';
}
if (!empty($show_empty)) {
$out.= '<option value="0">&nbsp;</option>';
@ -460,7 +464,7 @@ class FormProjets
if ($table_element == 'projet_task') return ''; // Special cas of element we never link to a project (already always done)
$linkedtothirdparty=false;
if (! in_array($table_element, array('don','expensereport_det','expensereport','loan'))) $linkedtothirdparty=true;
if (! in_array($table_element, array('don','expensereport_det','expensereport','loan','stock_mouvement'))) $linkedtothirdparty=true;
$sqlfilter='';
$projectkey="fk_projet";
@ -499,6 +503,10 @@ class FormProjets
case "fichinter":
$sql = "SELECT t.rowid, t.ref";
break;
case 'stock_mouvement':
$sql = 'SELECT t.rowid, t.label as ref';
$projectkey='fk_origin';
break;
default:
$sql = "SELECT t.rowid, t.ref";
break;
@ -512,7 +520,7 @@ class FormProjets
if (is_numeric($socid)) $sql.= " AND t.fk_soc=".$socid;
else $sql.= " AND t.fk_soc IN (".$socid.")";
}
if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity IN ('.getEntity('project',1).')';
if (! in_array($table_element, array('expensereport_det','stock_mouvement'))) $sql.= ' AND t.entity IN ('.getEntity('project',1).')';
if ($linkedtothirdparty) $sql.=" AND s.rowid = t.fk_soc";
if ($sqlfilter) $sql.= " AND ".$sqlfilter;
$sql.= " ORDER BY ref DESC";

View File

@ -256,32 +256,33 @@ class Translate
{
if ($usecachekey) $tabtranslatedomain=array(); // To save lang content in cache
while ($line = fgets($fp,4096)) // Ex: Need 225ms for all fgets on all lang file for Third party page. Same speed than file_get_contents
{
if ($line[0] != "\n" && $line[0] != " " && $line[0] != "#")
{
$tab=explode('=',$line,2);
$key=trim($tab[0]);
/**
* Read each lines until a '=' (with any combination of spaces around it)
* and split the rest until a line feed.
* This is more efficient than fgets + explode + trim by a factor of ~2.
*/
while ($line = fscanf($fp, "%[^= ]%*[ =]%[^\n]")) {
if (isset($line[1])) {
list($key, $value) = $line;
//if ($domain == 'orders') print "Domain=$domain, found a string for $tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."<br>";
//if ($key == 'Order') print "Domain=$domain, found a string for key=$key=$tab[0] with value $tab[1]. Currently in cache ".$this->tab_translate[$key]."<br>";
if (empty($this->tab_translate[$key]) && isset($tab[1])) // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
{
$value=trim(preg_replace('/\\n/',"\n",$tab[1]));
if ($key == 'DIRECTION') // This is to declare direction of language
{
if ($alt < 2 || empty($this->tab_translate[$key])) // We load direction only for primary files or if not yet loaded
{
$this->tab_translate[$key]=$value;
if ($stopafterdirection) break; // We do not save tab if we stop after DIRECTION
else if ($usecachekey) $tabtranslatedomain[$key]=$value;
if (empty($this->tab_translate[$key])) { // If translation was already found, we must not continue, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite entries)
$value = preg_replace('/\\n/', "\n", $value); // Parse and render carriage returns
if ($key == 'DIRECTION') { // This is to declare direction of language
if ($alt < 2 || empty($this->tab_translate[$key])) { // We load direction only for primary files or if not yet loaded
$this->tab_translate[$key] = $value;
if ($stopafterdirection) {
break; // We do not save tab if we stop after DIRECTION
} elseif ($usecachekey) {
$tabtranslatedomain[$key] = $value;
}
}
}
else
{
$this->tab_translate[$key]=$value;
} else {
$this->tab_translate[$key] = $value;
//if ($domain == 'orders') print "$tab[0] value $value<br>";
if ($usecachekey) $tabtranslatedomain[$key]=$value; // To save lang content in cache
if ($usecachekey) {
$tabtranslatedomain[$key] = $value;
} // To save lang content in cache
}
}
}

View File

@ -565,28 +565,6 @@ function urlencode(s) {
}
/*
* =================================================================
* Purpose: Show a popup HTML page.
* Input: url,title
* Author: Laurent Destailleur
* Licence: GPL
* ==================================================================
*/
function newpopup(url,title) {
var argv = newpopup.arguments;
var argc = newpopup.arguments.length;
tmp=url;
var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400;
var left = (screen.width - l)/2;
var top = (screen.height - h)/2;
var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top;
fen=window.open(tmp,title,wfeatures);
return false;
}
/*
* =================================================================
* Purpose:
@ -656,7 +634,13 @@ function hideMessage(fieldId,message) {
/*
* Used by button to set on/off
* Used by button to set on/off
*
* @param string url Url
* @param string code Code
* @param string intput Input
* @param int entity Entity
* @param int strict Strict
*/
function setConstant(url, code, input, entity, strict) {
$.get( url, {
@ -714,7 +698,13 @@ function setConstant(url, code, input, entity, strict) {
}
/*
* Used by button to set on/off
* Used by button to set on/off
*
* @param string url Url
* @param string code Code
* @param string intput Input
* @param int entity Entity
* @param int strict Strict
*/
function delConstant(url, code, input, entity, strict) {
$.get( url, {
@ -768,7 +758,17 @@ function delConstant(url, code, input, entity, strict) {
}
/*
* Used by button to set on/off
* Used by button to set on/off
*
* @param string action Action
* @param string url Url
* @param string code Code
* @param string intput Input
* @param string box Box
* @param int entity Entity
* @param int yesButton yesButton
* @param int noButton noButton
* @param int strict Strict
*/
function confirmConstantAction(action, url, code, input, box, entity, yesButton, noButton, strict) {
var boxConfirm = box;
@ -931,7 +931,7 @@ function confirmConstantAction(action, url, code, input, box, entity, yesButton,
})( jQuery );
/*
/**
* Function to output a dialog bog for copy/paste
*
* @param string text Text to put into copy/paste area
@ -949,16 +949,38 @@ function copyToClipboard(text,text2)
}
/*
* Function show document preview
/**
* Show a popup HTML page. Use the "window.open" function.
*
* @param string url Url
* @param string title Title of popup
* @return boolean False
* @see document_preview
*/
function newpopup(url,title) {
var argv = newpopup.arguments;
var argc = newpopup.arguments.length;
tmp=url;
var l = (argc > 2) ? argv[2] : 600;
var h = (argc > 3) ? argv[3] : 400;
var left = (screen.width - l)/2;
var top = (screen.height - h)/2;
var wfeatures = "directories=0,menubar=0,status=0,resizable=0,scrollbars=1,toolbar=0,width=" + l +",height=" + h + ",left=" + left + ",top=" + top;
fen=window.open(tmp,title,wfeatures);
return false;
}
/**
* Function show document preview. Use the "dialog" function.
*
* @params string file File path
* @params string type mime file
* @params string title
* @param string file Url
* @param string type Mime file type ("image/jpeg", "application/pdf", "text/html")
* @param string title Title of popup
* @return void
* @see newpopup
*/
function document_preview(file, type, title)
{
console.log("document_preview A click was done");
var ValidImageTypes = ["image/gif", "image/jpeg", "image/png"];
console.log("document_preview A click was done. file="+file+", type="+type);
@ -1026,6 +1048,7 @@ function getParameterByName(name, valueifnotfound)
return results === null ? valueifnotfound : decodeURIComponent(results[1].replace(/\+/g, " "));
}
// Code in the public domain from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/round
(function() {
/**
@ -1082,8 +1105,8 @@ function dolroundjs(number, decimals) { return +(Math.round(number + "e+" + deci
/**
* Function similar to PHP price2num()
*
* @param {number|string} amount The amount to convert/clean
* @returns {string} The amount in universal numeric format (Example: '99.99999')
* @param {number|string} amount The amount to convert/clean
* @return {string} The amount in universal numeric format (Example: '99.99999')
* @todo Implement rounding parameter
*/
function price2numjs(amount) {
@ -1128,6 +1151,5 @@ function price2numjs(amount) {
console.log("res="+res)
return res;
}

View File

@ -35,20 +35,23 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['HT
// Define javascript type
header('Content-type: text/javascript; charset=UTF-8');
$nowtime = time();
//$nowtimeprevious = floor($nowtime / 60) * 60; // auto_check_events_not_before is rounded to previous minute
// TODO Try to make a solution with only a javascript timer that is easier. Difficulty is to avoid notification twice when.
session_cache_limiter(FALSE);
header('Cache-Control: no-cache');
session_start();
if (!isset($_SESSION['auto_check_events'])) {
// Round to eliminate the second part
$_SESSION['auto_check_events'] = floor(time() / 60) * 60;
print 'var time_session = ' . $_SESSION['auto_check_events'] . ';'."\n";
print 'var now = ' . $_SESSION['auto_check_events'] . ';' . "\n";
} else {
print 'var time_session = ' . $_SESSION['auto_check_events'] . ';' . "\n";
print 'var now = ' . time() . ';' . "\n";
if (! isset($_SESSION['auto_check_events_not_before']))
{
print 'console.log("_SESSION[auto_check_events_not_before] is not set");'."\n";
// Round to eliminate the seconds
$_SESSION['auto_check_events_not_before'] = $nowtime; // auto_check_events_not_before is rounded to previous minute
}
print 'var time_auto_update = '.(empty($conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY)?'3':(int) $conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY).';' . "\n";
print 'var nowtime = ' . $nowtime . ';' . "\n";
print 'var auto_check_events_not_before = '.$_SESSION['auto_check_events_not_before']. ';'."\n";
print 'var time_js_next_test = Math.max(nowtime, auto_check_events_not_before);'."\n";
print 'var time_auto_update = '.$conf->global->MAIN_BROWSER_NOTIFICATION_FREQUENCY; // Always defined
?>
/* Check if permission ok */
@ -56,31 +59,27 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['HT
Notification.requestPermission()
}
if (now > (time_session + time_auto_update) || now == time_session) {
first_execution(); //firts run auto check
} else {
var time_first_execution = (time_auto_update - (now - time_session)) * 1000; //need milliseconds
setTimeout(first_execution, time_first_execution); //first run auto check
}
/* Launch timer */
// We set a delay before launching first test so next check will arrive after the time_auto_update compared to previous one.
var time_first_execution = (time_auto_update - (nowtime - time_js_next_test)) * 1000; //need milliseconds
console.log("Launch browser notif check: setTimeout to wait time_first_execution="+time_first_execution+" before first check - nowtime = "+nowtime+" auto_check_events_not_before = "+auto_check_events_not_before+" time_js_next_test = "+time_js_next_test+" time_auto_update="+time_auto_update);
setTimeout(first_execution, time_first_execution); //first run auto check
function first_execution() {
console.log("Call first_execution");
check_events();
setInterval(check_events, time_auto_update * 1000); //program time for run check events
console.log("Call first_execution time_auto_update (MAIN_BROWSER_NOTIFICATION_FREQUENCY) = "+time_auto_update);
check_events(); //one check before launching timer to launch other checks
setInterval(check_events, time_auto_update * 1000); //program time to run next check events
}
function check_events() {
if (Notification.permission === "granted")
{
console.log("Call check_events");
console.log("Call check_events time_js_next_test="+time_js_next_test);
$.ajax("<?php print dol_buildpath('/core/ajax/check_notifications.php', 1); ?>", {
type: "post", // Usually post o get
async: true,
data: {time: time_session},
data: {time: time_js_next_test},
success: function (result) {
var arr = JSON.parse(result);
if (arr.length > 0) {
@ -95,7 +94,7 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['HT
var title="Not defined";
var body = value['tipo'] + ': ' + value['titulo'];
if (value['type'] == 'agenda' && value['location'] != null && value['location'] != '') {
body += '\n <?php print $langs->transnoentities('Location')?>: ' + value['location'];
body += '\n' + value['location'];
}
if (value['type'] == 'agenda')
@ -132,7 +131,7 @@ if (!($_SERVER['HTTP_REFERER'] === $dolibarr_main_url_root . '/' || $_SERVER['HT
console.log("Cancel check_events. Useless because Notification.permission is "+Notification.permission);
}
time_session += time_auto_update;
time_js_next_test += time_auto_update;
}
<?php
}

View File

@ -362,7 +362,7 @@ function ajax_dialog($title,$message,$w=350,$h=150)
function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve')
{
global $conf;
if (! empty($conf->browser->phone)) return ''; // select2 disabled for smartphones with standard browser (does not works, popup appears outside screen)
if (! empty($conf->dol_use_jmobile)) return ''; // select2 works with jmobile but it breaks the autosize feature of jmobile.
if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return '';

View File

@ -83,6 +83,12 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) $libelleproduitservice.=' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
}
elseif ($desc == '(EXCESS RECEIVED)' && $line->fk_remise_except)
{
$discount=new DiscountAbsolute($db);
$discount->fetch($line->fk_remise_except);
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromExcessReceived",$discount->ref_facture_source);
}
else
{
if ($idprod)

View File

@ -44,8 +44,8 @@ function dol_basename($pathfile)
* @param string $path Starting path from which to search. This is a full path.
* @param string $types Can be "directories", "files", or "all"
* @param int $recursive Determines whether subdirectories are searched
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.'))
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function. Filter is checked into basename only.
* @param array $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview\.png)$','^\.')). Exclude is checked into fullpath.
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
* @param string $sortorder Sort order (SORT_ASC, SORT_DESC)
* @param int $mode 0=Return array minimum keys loaded (faster), 1=Force all keys like date and size to be loaded (slower), 2=Force load of date only, 3=Force load of size only
@ -104,7 +104,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
$filesize='';
$file_list = array();
while (false !== ($file = readdir($dir)))
while (false !== ($file = readdir($dir))) // $file is always a basename (into directory $newpath)
{
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure data is stored in utf8 in memory
@ -137,7 +137,7 @@ function dol_dir_list($path, $types="all", $recursive=0, $filter="", $excludefil
if ($loaddate || $sortcriteria == 'date') $filedate=dol_filemtime($path."/".$file);
if ($loadsize || $sortcriteria == 'size') $filesize=dol_filesize($path."/".$file);
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into $path, only into $file
if (! $filter || preg_match('/'.$filter.'/i',$file)) // We do not search key $filter into all $path, only into $file part
{
preg_match('/([^\/]+)\/[^\/]+$/',$path.'/'.$file,$reg);
$level1name=(isset($reg[1])?$reg[1]:'');
@ -515,13 +515,23 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
$result=0;
dol_syslog("files.lib.php::dolCopyr srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists);
dol_syslog("files.lib.php::dolCopyDir srcfile=".$srcfile." destfile=".$destfile." newmask=".$newmask." overwriteifexists=".$overwriteifexists);
if (empty($srcfile) || empty($destfile)) return -1;
$destexists=dol_is_dir($destfile);
if (! $overwriteifexists && $destexists) return 0;
if (! $destexists)
{
// We must set mask just before creating dir, becaause it can be set differently by dol_copy
umask(0);
$dirmaskdec=octdec($newmask);
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);
$dirmaskdec |= octdec('0200'); // Set w bit required to be able to create content for recursive subdirs files
dol_mkdir($destfile."/".$file, '', decoct($dirmaskdec));
}
$srcfile=dol_osencode($srcfile);
$destfile=dol_osencode($destfile);
@ -538,6 +548,7 @@ function dolCopyDir($srcfile, $destfile, $newmask, $overwriteifexists)
{
if (!is_dir($destfile."/".$file))
{
// We must set mask just before creating dir, becaause it can be set differently by dol_copy
umask(0);
$dirmaskdec=octdec($newmask);
if (empty($newmask) && ! empty($conf->global->MAIN_UMASK)) $dirmaskdec=octdec($conf->global->MAIN_UMASK);

View File

@ -1,18 +1,18 @@
<?php
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <aspangaro.dolibarr@gmail.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
/* Copyright (C) 2000-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2010-2016 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013-2017 Alexandre Spangaro <aspangaro@zendsi.com>
* Copyright (C) 2014 Cédric GROSS <c.gross@kreiz-it.fr>
* Copyright (C) 2014-2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -983,6 +983,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
$modulepart='unknown';
if ($object->element == 'societe') $modulepart='societe';
if ($object->element == 'contact') $modulepart='contact';
if ($object->element == 'member') $modulepart='memberphoto';
@ -1006,7 +1007,6 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$nophoto='/public/theme/common/nophoto.png';
$morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref"><img class="photo'.$modulepart.($cssclass?' '.$cssclass:'').'" alt="No photo" border="0"'.($width?' width="'.$width.'"':'').($height?' height="'.$height.'"':'').' src="'.DOL_URL_ROOT.$nophoto.'"></div>';
}
}
}
else
@ -1091,7 +1091,11 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
$morehtmlstatus.=$tmptxt;
}
if (! empty($object->name_alias)) $morehtmlref.='<div class="refidno">'.$object->name_alias.'</div>'; // For thirdparty
if ($object->element == 'product' && ! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
if ($object->element == 'product' || $object->element == 'bank_account')
{
if(! empty($object->label)) $morehtmlref.='<div class="refidno">'.$object->label.'</div>';
}
if ($object->element != 'product' && $object->element != 'bookmark')
{

View File

@ -2,7 +2,7 @@
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2008-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2008 Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2015-2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
*
@ -2084,4 +2084,31 @@ function colorStringToArray($stringcolor,$colorifnotfound=array(88,88,88))
return array(hexdec($reg[1]),hexdec($reg[2]),hexdec($reg[3]));
}
/**
* Applies the Cartesian product algorithm to an array
* Source: http://stackoverflow.com/a/15973172
*
* @param array $input Array of products
* @return array Array of combinations
*/
function cartesianArray(array $input) {
// filter out empty values
$input = array_filter($input);
$result = array(array());
foreach ($input as $key => $values) {
$append = array();
foreach($result as $product) {
foreach($values as $item) {
$product[$key] = $item;
$append[] = $product;
}
}
$result = $append;
}
return $result;
}

View File

@ -1211,6 +1211,12 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
// Add date of deposit
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE)) echo ' ('.dol_print_date($discount->datec,'day','',$outputlangs).')';
}
if ($desc == '(EXCESS RECEIVED)' && $object->lines[$i]->fk_remise_except)
{
$discount=new DiscountAbsolute($db);
$discount->fetch($object->lines[$i]->fk_remise_except);
$libelleproduitservice=$outputlangs->transnoentitiesnoconv("DiscountFromExcessReceived",$discount->ref_facture_source);
}
else
{
if ($idprod)

View File

@ -3,7 +3,7 @@
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2009-2010 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2015 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -94,6 +94,26 @@ function product_prepare_head($object)
$head[$h][2] = 'referers';
$h++;
if (!empty($conf->variants->enabled) && $object->isProduct()) {
global $db;
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
$prodcomb = new ProductCombination($db);
if ($prodcomb->fetchByFkProductChild($object->id) == -1)
{
$head[$h][0] = DOL_URL_ROOT."/variants/combinations.php?id=".$object->id;
$head[$h][1] = $langs->trans('ProductCombinations');
$head[$h][2] = 'combinations';
$nbVariant = $prodcomb->countNbOfCombinationForFkProductParent($object->id);
if ($nbVariant > 0) $head[$h][1].= ' <span class="badge">'.$nbVariant.'</span>';
}
$h++;
}
if ($object->isProduct() || ($object->isService() && ! empty($conf->global->STOCK_SUPPORTS_SERVICES))) // If physical product we can stock (or service with option)
{
if (! empty($conf->stock->enabled) && $user->rights->stock->lire)

View File

@ -343,7 +343,7 @@ function restrictedArea($user, $features, $objectid=0, $tableandshare='', $featu
* This function is also called by restrictedArea
*
* @param User $user User to check
* @param array $featuresarray Features/modules to check
* @param array $featuresarray Features/modules to check. Example: ('user','service')
* @param int $objectid Object ID if we want to check a particular record (optional) is linked to a owned thirdparty (optional).
* @param string $tableandshare 'TableName&SharedElement' with Tablename is table where object is stored. SharedElement is an optional key to define where to check entity. Not used if objectid is null (optional)
* @param string $feature2 Feature to check, second level of permission (optional). Can be or check with 'level1|level2'.
@ -365,6 +365,9 @@ function checkUserAccessToObject($user, $featuresarray, $objectid=0, $tableandsh
{
$sql='';
// For backward compatibility
if ($feature == 'member') $feature='adherent';
$check = array('adherent','banque','user','usergroup','produit','service','produit|service','categorie'); // Test on entity only (Objects with no link to company)
$checksoc = array('societe'); // Test for societe object
$checkother = array('contact'); // Test on entity and link to societe. Allowed if link is empty (Ex: contacts...).

View File

@ -61,7 +61,6 @@ insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, left
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 311__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/admin/system/about.php?leftmenu=admintools', 'About', 1, 'admin', '', '', 2, 14, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools"', __HANDLER__, 'left', 320__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/product/admin/product_tools.php?mainmenu=home&amp;leftmenu=admintools', 'ProductVatMassChange', 1, 'products', '', '', 2, 0, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="admintools" && $conf->accounting->enabled', __HANDLER__, 'left', 321__+MAX_llx_menu__, 'home', '', 300__+MAX_llx_menu__, '/accountancy/admin/productaccount.php?mainmenu=home&amp;leftmenu=admintools', 'InitAccountancy', 1, 'accountancy', '', '', 2, 0, __ENTITY__);
-- Home - Menu users and groups
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '1', __HANDLER__, 'left', 400__+MAX_llx_menu__, 'home', 'users', 1__+MAX_llx_menu__, '/user/home.php?leftmenu=users', 'MenuUsersAndGroups', 0, 'users', '', '', 2, 4, __ENTITY__);
insert into llx_menu (module, enabled, menu_handler, type, rowid, mainmenu, leftmenu, fk_menu, url, titre, level, langs, perms, target, usertype, position, entity) values ('', '$leftmenu=="users"', __HANDLER__, 'left', 401__+MAX_llx_menu__, 'home', '', 400__+MAX_llx_menu__, '/user/index.php?leftmenu=users', 'Users', 1, 'users', '$user->rights->user->user->lire || $user->admin', '', 2, 0, __ENTITY__);

View File

@ -579,12 +579,6 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/product/admin/product_tools.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("ProductVatMassChange"), 1, $user->admin);
}
if (! empty($conf->accounting->enabled))
{
$langs->load("accountancy");
$newmenu->add("/accountancy/admin/productaccount.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("InitAccountancy"), 1, $user->admin);
}
$newmenu->add("/support/index.php?mainmenu=home&amp;leftmenu=admintools", $langs->trans("HelpCenter"),1,1,'targethelp');
}
@ -836,6 +830,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
}
$newmenu->add("/fourn/facture/paiement.php", $langs->trans("Payments"),1,$user->rights->fournisseur->facture->lire);
$newmenu->add("/fourn/facture/rapport.php",$langs->trans("Reportings"),2,$user->rights->fournisseur->facture->lire);
$newmenu->add("/compta/facture/stats/index.php?mode=supplier", $langs->trans("Statistics"),1,$user->rights->fournisseur->facture->lire);
}

View File

@ -284,7 +284,7 @@ class pdf_standard extends ModeleExpenseReport
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$initialY = $tab_top + 7;
$nexY = $tab_top + 7;
// Loop on each lines
@ -292,43 +292,41 @@ class pdf_standard extends ModeleExpenseReport
{
$piece_comptable = $i +1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 2); // Into loop to work with multipage
$pdf->SetTextColor(0,0,0);
$pdf->setTopMargin($tab_top_newpage);
$pdf->setPageOrientation('', 1, $heightforfooter+$heightforfreetext+$heightforinfotot); // The only function to edit the bottom margin of current page to set it.
$pageposbefore=$pdf->getPage();
// Description of product line
$curX = $this->posxcomment-1;
$showpricebeforepagebreak=1;
$curY = $nexY;
$pdf->SetFont('','', $default_font_size - 1);
// Accountancy piece
$pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
// Comments
$pdf->SetXY($this->posxcomment, $curY);
$pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1);
// Accountancy piece
$pdf->SetXY($this->posxpiece, $curY);
$pdf->writeHTMLCell($this->posxcomment-$this->posxpiece-0.8, 4, $this->posxpiece-1, $curY, $piece_comptable, 0, 1);
$curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY;
//nexY
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
// Comments
$pdf->SetXY($this->posxcomment, $curY );
$pdf->writeHTMLCell($this->posxdate-$this->posxcomment-0.8, 4, $this->posxcomment-1, $curY, $object->lines[$i]->comments, 0, 1);
$curY = ($pdf->PageNo() > $pageposbefore) ? $pdf->GetY()-4 : $curY;
// Date
// Date
$pdf->SetXY($this->posxdate -1, $curY);
$pdf->MultiCell($this->posxtype-$this->posxdate-0.8, 4, dol_print_date($object->lines[$i]->date,"day",false,$outputlangs), 0, 'C');
// Type
// Type
$pdf->SetXY($this->posxtype -1, $curY);
$pdf->MultiCell($this->posxprojet-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C');
$nextColumnPosX = $this->posxup;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) {
$nextColumnPosX = $this->posxtva;
}
if (!empty($conf->projet->enabled)) {
$nextColumnPosX = $this->posxprojet;
}
$pdf->MultiCell($nextColumnPosX-$this->posxtype-0.8, 4, dol_trunc($outputlangs->transnoentities($object->lines[$i]->type_fees_code), 12), 0, 'C');
// Project
if (! empty($conf->projet->enabled))
@ -344,34 +342,43 @@ class pdf_standard extends ModeleExpenseReport
$vat_rate = pdf_getlinevatrate($object, $i, $outputlangs, $hidedetails);
$pdf->SetXY($this->posxtva, $curY);
$pdf->MultiCell($this->posxup-$this->posxtva-0.8, 4,$vat_rate, 0, 'C');
}
}
// Unit price
$pdf->SetXY($this->posxup, $curY);
$pdf->MultiCell($this->posxqty-$this->posxup-0.8, 4,price($object->lines[$i]->value_unit), 0, 'R');
// Quantity
// Quantity
$pdf->SetXY($this->posxqty, $curY);
$pdf->MultiCell($this->postotalttc-$this->posxqty-0.8, 4,$object->lines[$i]->qty, 0, 'R');
// Total with all taxes
// Total with all taxes
$pdf->SetXY($this->postotalttc-1, $curY);
$pdf->MultiCell($this->page_largeur-$this->marge_droite-$this->postotalttc, 4, price($object->lines[$i]->total_ttc), 0, 'R');
// Cherche nombre de lignes a venir pour savoir si place suffisante
//nexY
$nexY = $pdf->GetY();
$pageposafter=$pdf->getPage();
$pdf->setPage($pageposbefore);
$pdf->setTopMargin($this->marge_haute);
$pdf->setPageOrientation('', 1, 0); // The only function to edit the bottom margin of current page to set it.
$nblineFollowComment = 1;
// Cherche nombre de lignes a venir pour savoir si place suffisante
if ($i < ($nblignes - 1)) // If it's not last line
{
//on recupere la description du produit suivant
$follow_comment = $object->lines[$i+1]->comments;
//Fetch current description to know on which line the next one should be placed
$follow_comment = $object->lines[$i]->comments;
$follow_type = $object->lines[$i]->type_fees_code;
//on compte le nombre de ligne afin de verifier la place disponible (largeur de ligne 52 caracteres)
$nblineFollowComment = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output)*4;
}
else // If it's last line
{
$nblineFollowComment = 0;
$nbLineCommentNeed = dol_nboflines_bis($follow_comment,52,$outputlangs->charset_output);
$nbLineTypeNeed = dol_nboflines_bis($follow_type,4,$outputlangs->charset_output);
$nblineFollowComment = max($nbLineCommentNeed, $nbLineTypeNeed);
}
$nexY+=4; // Passe espace entre les lignes
$nexY+=$nblineFollowComment*($pdf->getFontSize()*1.3); // Passe espace entre les lignes
// Detect if some page were added automatically and output _tableau for past pages
while ($pagenb < $pageposafter)
@ -426,7 +433,7 @@ class pdf_standard extends ModeleExpenseReport
$pdf->SetFont('','', 10);
// Show total area box
$posy=$bottomlasttab+5;//$nexY+95;
$posy=$bottomlasttab+5;
$pdf->SetXY(100, $posy);
$pdf->MultiCell(60, 5, $outputlangs->transnoentities("TotalHT"), 1, 'L');
$pdf->SetXY(160, $posy);

View File

@ -37,6 +37,18 @@ class mod_facture_mars extends ModeleNumRefFactures
var $prefixcreditnote='AV';
var $error='';
/**
* Constructor
*/
function __construct()
{
if (! empty($conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX))
{
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_MARS_FORCE_PREFIX;
}
}
/**
* Renvoi la description du modele de numerotation
*

View File

@ -35,6 +35,18 @@ class mod_facture_terre extends ModeleNumRefFactures
var $prefixdeposit='AC';
var $error='';
/**
* Constructor
*/
function __construct()
{
if (! empty($conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX))
{
$this->prefixinvoice = $conf->global->INVOICE_NUMBERING_TERRE_FORCE_PREFIX;
}
}
/**
* Renvoi la description du modele de numerotation
*

View File

@ -72,7 +72,7 @@ class modAccounting extends DolibarrModules
$this->conflictwith = array("modComptabilite"); // List of modules are in conflict with this module
$this->phpmin = array(5, 3); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3, 9); // Minimum version of Dolibarr required by module
$this->langfiles = array("accountancy");
$this->langfiles = array("accountancy","compta");
// Constants
$this->const = array();
@ -288,6 +288,23 @@ class modAccounting extends DolibarrModules
// Menus
//-------
$this->menu = 1; // This module add menu entries. They are coded into menu manager.
// Exports
//--------
$r=0;
$r++;
$this->export_code[$r]=$this->rights_class.'_'.$r;
$this->export_label[$r]='Chartofaccounts';
$this->export_icon[$r]='accounting';
$this->export_permission[$r]=array(array("accounting","chartofaccount"));
$this->export_fields_array[$r]=array('ac.rowid'=>'ChartofaccountsId','ac.pcg_version'=>'Chartofaccounts','aa.rowid'=>'Id','aa.account_number'=>"AccountAccounting",'aa.label'=>"Label",'aa.account_parent'=>"Accountparent",'aa.pcg_type'=>"Pcgtype",'aa.pcg_subtype'=>'Pcgsubtype','aa.active'=>'Status');
$this->export_TypeFields_array[$r]=array('ac.rowid'=>'List:accounting_system:pcg_version','aa.account_number'=>"Text",'aa.label'=>"Text",'aa.pcg_type'=>'Text','aa.pcg_subtype'=>'Text','aa.active'=>'Status');
$this->export_entities_array[$r]=array('ac.rowid'=>"accounting",'ac.pcg_version'=>"accounting",'aa.rowid'=>'accounting','aa.account_number'=>"accounting",'aa.label'=>"accounting",'aa.accountparent'=>"accounting",'aa.pcg_type'=>"accounting",'aa.pcgsubtype'=>"accounting",'aa_active'=>"accounting");
$this->export_sql_start[$r]='SELECT DISTINCT ';
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'accounting_account as aa, '.MAIN_DB_PREFIX.'accounting_system as ac';
$this->export_sql_end[$r] .=' WHERE ac.pcg_version = aa.fk_pcg_version AND aa.entity IN ('.getEntity('accounting', 1).') ';
}
}

View File

@ -94,7 +94,7 @@ class modExpedition extends DolibarrModules
$this->const[$r][0] = "EXPEDITION_ADDON_NUMBER";
$this->const[$r][1] = "chaine";
$this->const[$r][2] = "mod_expedition_safor";
$this->const[$r][3] = 'Nom du gestionnaire de numerotation des expeditions';
$this->const[$r][3] = 'Name for numbering manager for shipments';
$this->const[$r][4] = 0;
$r++;

View File

@ -205,11 +205,11 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndInvoiceLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export","other"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin', 'pj.ref'=>'ProjectRef', 'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.subprice'=>"LineUnitPrice",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.total_ht'=>"LineTotalHT",'fd.total_tva'=>"LineTotalVAT",'fd.total_ttc'=>"LineTotalTTC",'fd.date_start'=>"DateStart",'fd.date_end'=>"DateEnd",'fd.special_code'=>'SpecialCode','fd.product_type'=>"TypeOfLineServiceOrProduct",'fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_sell'=>'ProductAccountancySellCode');
//Add 'fd.label'=>"Label" to export_fields_array if you use it. Not used by dolibarr currently.
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'fd.description'=>"Text",'fd.price'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text", 'pj.ref'=>'Text', 'fd.label'=>'Text', 'fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>'Numeric','f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Numeric','f.note_private'=>"Text",'f.note_public'=>"Text",'f.fk_user_author'=>'Numeric','uc.login'=>'Text','f.fk_user_valid'=>'Numeric','uv.login'=>'Text','pj.ref'=>'Text','fd.rowid'=>'Numeric','fd.label'=>'Text','fd.description'=>"Text",'fd.subprice'=>"Numeric",'fd.tva_tx'=>"Numeric",'fd.qty'=>"Numeric",'fd.total_ht'=>"Numeric",'fd.total_tva'=>"Numeric",'fd.total_ttc'=>"Numeric",'fd.date_start'=>"Date",'fd.date_end'=>"Date",'fd.special_code'=>'Numeric','fd.product_type'=>"Numeric",'fd.fk_product'=>'List:product:label','p.ref'=>'Text','p.label'=>'Text','p.accountancy_code_sell'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice", 'pj.ref'=>'project', 'fd.rowid'=>'invoice_line','fd.label'=>"invoice_line",'fd.description'=>"invoice_line",'fd.subprice'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_tva'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.date_start'=>"invoice_line",'fd.date_end'=>"invoice_line",'fd.special_code'=>'invoice_line','fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_sell'=>'product','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user');
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
@ -239,10 +239,10 @@ class modFacture extends DolibarrModules
$this->export_label[$r]='CustomersInvoicesAndPayments'; // Translation key (used only if key ExportDataset_xxx_z not found)
$this->export_icon[$r]='bill';
$this->export_permission[$r]=array(array("facture","facture","export"));
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.code_compta'=>'CustomerAccountancyCode','s.code_compta_fournisseur'=>'SupplierAccountancyCode','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.facnumber'=>"InvoiceRef",'f.type'=>"Type",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.date_lim_reglement'=>"DateDue",'f.total'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_private'=>"NotePrivate",'f.note_public'=>"NotePublic",'f.fk_user_author'=>'CreatedById','uc.login'=>'CreatedByLogin','f.fk_user_valid'=>'ValidatedById','uv.login'=>'ValidatedByLogin','pj.ref'=>'ProjectRef','p.rowid'=>'PaymentId','p.ref'=>'PaymentRef','p.amount'=>'AmountPayment','pf.amount'=>'AmountPaymentDistributedOnInvoice','p.datep'=>'DatePayment','p.num_paiement'=>'PaymentNumber','pt.code'=>'IdPaymentMode','pt.libelle'=>'LabelPaymentMode','p.note'=>'PaymentNote','p.fk_bank'=>'IdTransaction','ba.ref'=>'AccountRef');
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:nom",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"List:facture:facnumber",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pf.amount'=>'Numeric','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric');
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
$this->export_TypeFields_array[$r]=array('s.rowid'=>'Numeric','s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.code_compta'=>'Text','s.code_compta_fournisseur'=>'Text','s.tva_intra'=>'Text','f.rowid'=>"Numeric",'f.facnumber'=>"Text",'f.type'=>"Numeric",'f.datec'=>"Date",'f.datef'=>"Date",'f.date_lim_reglement'=>"Date",'f.total'=>"Numeric",'f.total_ttc'=>"Numeric",'f.tva'=>"Numeric",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_private'=>"Text",'f.note_public'=>"Text",'pj.ref'=>'Text','p.amount'=>'Numeric','pf.amount'=>'Numeric','p.rowid'=>'Numeric','p.ref'=>'Text','p.datep'=>'Date','p.num_paiement'=>'Numeric','p.fk_bank'=>'Numeric','p.note'=>'Text','pt.code'=>'Text','pt.libelle'=>'text','ba.ref'=>'Text');
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.code_compta'=>'company','s.code_compta_fournisseur'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.facnumber'=>"invoice",'f.type'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.date_lim_reglement'=>"invoice",'f.total'=>"invoice",'f.total_ttc'=>"invoice",'f.tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_private'=>"invoice",'f.note_public'=>"invoice",'pj.ref'=>'project','p.rowid'=>'payment','p.ref'=>'payment','p.amount'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment','pt.code'=>'payment','pt.libelle'=>'payment','p.note'=>'payment','f.fk_user_author'=>'user','uc.login'=>'user','f.fk_user_valid'=>'user','uv.login'=>'user','p.fk_bank'=>'account','ba.ref'=>'account');
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
$keyforselect='facture'; $keyforelement='invoice'; $keyforaliasextra='extra';
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';

View File

@ -0,0 +1,137 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \defgroup produit Module product variants
* \brief Module to manage product combinations based on product attributes
* \file htdocs/core/modules/modAttributes.class.php
* \ingroup produit
* \brief File to describe module to manage catalog of predefined products
*/
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
/**
* Description and activation class for module Product variants
*/
class modVariants extends DolibarrModules
{
/**
* Constructor. Define names, constants, directories, boxes, permissions
*
* @param DoliDB $db Database handler
*/
public function __construct($db)
{
global $langs,$conf;
$this->db = $db;
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
$this->numero = 610;
// Key text used to identify module (for permissions, menus, etc...)
$this->rights_class = 'variants';
// Family can be 'crm','financial','hr','projects','products','ecm','technic','other'
// It is used to group modules in module setup page
$this->family = "products";
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
$this->name = preg_replace('/^mod/i','',get_class($this));
// Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module)
$this->description = 'Allows creating products variant based on new attributes';
// Possible values for version are: 'development', 'experimental', 'dolibarr' or version
$this->version = 'experimental';
// Key used in llx_const table to save module status enabled/disabled (where MYMODULE is value of property name of module in uppercase)
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
// Where to store the module in setup page (0=common,1=interface,2=others,3=very specific)
$this->special = 0;
// Name of image file used for this module.
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
$this->picto='product';
// Defined all module parts (triggers, login, substitutions, menus, css, etc...)
$this->module_parts = array();
// Data directories to create when module is enabled.
// Example: this->dirs = array("/mymodule/temp");
$this->dirs = array();
// Config pages. Put here list of php page, stored into mymodule/admin directory, to use to setup module.
$this->config_page_url = array(
'admin.php@variants'
);
// Dependencies
$this->hidden = false; // A condition to hide module
$this->depends = array(
'modProduct'
); // List of modules id that must be enabled if this module is enabled
$this->requiredby = array(); // List of modules id to disable if this one is disabled
$this->conflictwith = array(); // List of modules id this module is in conflict with
$this->phpmin = array(5,0); // Minimum version of PHP required by module
$this->need_dolibarr_version = array(3,0); // Minimum version of Dolibarr required by module
$this->langfiles = array("products");
// Constants
$this->const = array();
// Array to add new pages in new tabs
$this->tabs = array(
// 'product:+combinations:Combinaciones:products:1:/variants/combinations.php?id=__ID__'
);
// Dictionaries
if (! isset($conf->mymodule->enabled))
{
$conf->mymodule=new stdClass();
$conf->mymodule->enabled=0;
}
$this->dictionaries=array();
// Boxes
// Add here list of php file(s) stored in core/boxes that contains class to show a box.
$this->boxes = array(); // List of boxes
// Permissions
$this->rights = array(); // Permission array used by this module
// Main menu entries
$this->menu = array(
array(
'fk_menu' => 'fk_mainmenu=products,fk_leftmenu=product',
'type' => 'left',
'titre' => 'VariantAttributes',
'mainmenu' => 'products',
'leftmenu' => 'product',
'url' => '/variants/list.php',
'langs' => 'products',
'position' => 100,
'enabled' => '$conf->product->enabled',
'perms' => 1,
'target' => '',
'user' => 0
)
); // List of menus to add
}
}

View File

@ -274,6 +274,7 @@ class doc_generic_project_odt extends ModelePDFProjects
return array(
'tasktime_rowid'=>$tasktime['rowid'],
'tasktime_task_date'=>dol_print_date($tasktime['task_date'],'day'),
'tasktime_task_duration_sec'=>$tasktime['task_duration'],
'tasktime_task_duration'=>convertSecondToTime($tasktime['task_duration'],'all'),
'tasktime_note'=>$tasktime['note'],
'tasktime_fk_user'=>$tasktime['fk_user'],

View File

@ -0,0 +1,423 @@
<?php
/* Copyright (C) 2017 ATM-Consulting <support@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* or see http://www.gnu.org/
*/
/**
* \file htdocs/core/modules/rapport/pdf_paiement_fourn.class.php
* \ingroup banque
* \brief File to build payment reports
*/
require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
/**
* Classe permettant de generer les rapports de paiement
*/
class pdf_paiement_fourn
{
/**
* Constructor
*
* @param DoliDb $db Database handler
*/
function __construct($db)
{
global $langs,$conf;
$langs->load("bills");
$langs->load("compta");
$this->db = $db;
$this->description = $langs->transnoentities("ListOfCustomerPayments");
// Dimension page pour format A4
$this->type = 'pdf';
$formatarray=pdf_getFormat();
$this->page_largeur = $formatarray['width'];
$this->page_hauteur = $formatarray['height'];
$this->format = array($this->page_largeur,$this->page_hauteur);
$this->marge_gauche=isset($conf->global->MAIN_PDF_MARGIN_LEFT)?$conf->global->MAIN_PDF_MARGIN_LEFT:10;
$this->marge_droite=isset($conf->global->MAIN_PDF_MARGIN_RIGHT)?$conf->global->MAIN_PDF_MARGIN_RIGHT:10;
$this->marge_haute =isset($conf->global->MAIN_PDF_MARGIN_TOP)?$conf->global->MAIN_PDF_MARGIN_TOP:10;
$this->marge_basse =isset($conf->global->MAIN_PDF_MARGIN_BOTTOM)?$conf->global->MAIN_PDF_MARGIN_BOTTOM:10;
$this->tab_top = 30;
$this->line_height = 5;
$this->line_per_page = 40;
$this->tab_height = $this->page_hauteur - $this->marge_haute - $this->marge_basse - $this->tab_top - 5; // must be > $this->line_height * $this->line_per_page and < $this->page_hauteur - $this->marge_haute - $this->marge_basse - $this->tab_top - 5;
$this->posxdate=$this->marge_gauche+2;
$this->posxpaymenttype=42;
$this->posxinvoice=82;
$this->posxbankaccount=110;
$this->posxinvoiceamount=132;
$this->posxpaymentamount=162;
if ($this->page_largeur < 210) // To work with US executive format
{
$this->line_per_page = 35;
$this->posxpaymenttype-=10;
$this->posxinvoice-=0;
$this->posxinvoiceamount-=10;
$this->posxpaymentamount-=20;
}
}
/**
* Fonction generant la rapport sur le disque
*
* @param string $_dir repertoire
* @param int $month mois du rapport
* @param int $year annee du rapport
* @param string $outputlangs Lang output object
* @return int <0 if KO, >0 if OK
*/
function write_file($_dir, $month, $year, $outputlangs)
{
include_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
global $conf, $hookmanager, $langs, $user;
$socid=0;
if ($user->societe_id) $socid=$user->societe_id;
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1';
$this->month=$month;
$this->year=$year;
$dir=$_dir.'/'.$year;
if (! is_dir($dir))
{
$result=dol_mkdir($dir);
if ($result < 0)
{
$this->error=$langs->transnoentities("ErrorCanNotCreateDir",$dir);
return -1;
}
}
$month = sprintf("%02d",$month);
$year = sprintf("%04d",$year);
$file = $dir . "/supplier_payments-".$year."-".$month.".pdf";
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('beforePDFCreation',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
$pdf=pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs); // Must be after pdf_getInstance
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$num=0;
$lines=array();
// count number of lines of payment
$sql = "SELECT p.rowid as prowid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p";
$sql.= " WHERE p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
$sql.= " AND p.entity = " . $conf->entity;
$result = $this->db->query($sql);
if ($result)
{
$numpaiement = $this->db->num_rows($result);
}
// number of bill
$sql = "SELECT p.datep as dp, f.ref";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql.= ", c.code as paiement_code, p.num_paiement";
$sql.= ", p.amount as paiement_amount, f.total_ttc as facture_amount";
$sql.= ", pf.amount as pf_amount";
if (! empty($conf->banque->enabled))
$sql.= ", ba.ref as bankaccount";
$sql.= ", p.rowid as prowid";
$sql.= " FROM ".MAIN_DB_PREFIX."paiementfourn as p, ".MAIN_DB_PREFIX."facture_fourn as f,";
$sql.= " ".MAIN_DB_PREFIX."c_paiement as c, ".MAIN_DB_PREFIX."paiementfourn_facturefourn as pf,";
if (! empty($conf->banque->enabled))
$sql.= " ".MAIN_DB_PREFIX."bank as b, ".MAIN_DB_PREFIX."bank_account as ba,";
$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 AND pf.fk_facturefourn = f.rowid AND pf.fk_paiementfourn = p.rowid";
if (! empty($conf->banque->enabled))
$sql.= " AND p.fk_bank = b.rowid AND b.fk_account = ba.rowid ";
$sql.= " AND f.entity = ".$conf->entity;
$sql.= " AND p.fk_paiement = c.id ";
$sql.= " AND p.datep BETWEEN '".$this->db->idate(dol_get_first_day($year,$month))."' AND '".$this->db->idate(dol_get_last_day($year,$month))."'";
if (! $user->rights->societe->client->voir && ! $socid)
{
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
}
if (! empty($socid)) $sql .= " AND s.rowid = ".$socid;
$sql.= " ORDER BY p.datep ASC, pf.fk_paiementfourn ASC";
dol_syslog(get_class($this)."::write_file", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$num = $this->db->num_rows($result);
$i = 0;
$var=True;
while ($i < $num)
{
$objp = $this->db->fetch_object($result);
$var=!$var;
$lines[$i][0] = $objp->ref;
$lines[$i][1] = dol_print_date($this->db->jdate($objp->dp),"day",false,$outputlangs,true);
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort".$objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount);
$lines[$i][5] = price($objp->facture_amount);
$lines[$i][6] = price($objp->pf_amount);
$lines[$i][7] = $objp->prowid;
$lines[$i][8] = $objp->bankaccount;
$i++;
}
}
else
{
dol_print_error($this->db);
}
$pages = intval(($num + $numpaiement) / $this->line_per_page);
if ((($num + $numpaiement) % $this->line_per_page)>0)
{
$pages++;
}
if ($pages == 0)
{
// force to build at least one page if report has no line
$pages = 1;
}
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->transnoentities("Payments"));
$pdf->SetSubject($outputlangs->transnoentities("Payments"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
//$pdf->SetKeyWords();
if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $pagenb, 1, $outputlangs);
$pdf->SetFont('','', 9);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$this->Body($pdf, 1, $lines, $outputlangs);
if (method_exists($pdf,'AliasNbPages')) $pdf->AliasNbPages();
$pdf->Close();
$pdf->Output($file,'F');
// Add pdfgeneration hook
if (! is_object($hookmanager))
{
include_once DOL_DOCUMENT_ROOT.'/core/class/hookmanager.class.php';
$hookmanager=new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters=array('file'=>$file,'object'=>$object,'outputlangs'=>$outputlangs);
global $action;
$reshook=$hookmanager->executeHooks('afterPDFCreation',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if (! empty($conf->global->MAIN_UMASK))
@chmod($file, octdec($conf->global->MAIN_UMASK));
return 1;
}
/**
* Show top header of page.
*
* @param PDF $pdf Object PDF
* @param int $page Object to show
* @param int $showaddress 0=no, 1=yes
* @param Translate $outputlangs Object lang for output
* @return void
*/
function _pagehead(&$pdf, $page, $showaddress, $outputlangs)
{
global $langs;
// Do not add the BACKGROUND as this is a report
//pdf_pagehead($pdf,$outputlangs,$this->page_hauteur);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$title=$conf->global->MAIN_INFO_SOCIETE_NOM;
$title.=' - '.$outputlangs->transnoentities("ListOfSupplierPayments");
$title.=' - '.dol_print_date(dol_mktime(0,0,0,$this->month,1,$this->year),"%B %Y",false,$outputlangs,true);
$pdf->SetFont('','B',$default_font_size + 1);
$pdf->SetXY($this->marge_gauche,10);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->marge_gauche, 2, $title, 0, 'C');
$pdf->SetFont('','',$default_font_size);
$pdf->SetXY($this->posxdate, 16);
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("DateBuild")." : ".dol_print_date(time(),"day",false,$outputlangs,true), 0, 'L');
$pdf->SetXY($this->posxdate+100, 16);
$pdf->MultiCell(80, 2, $outputlangs->transnoentities("Page")." : ".$page, 0, 'R');
// Title line
$pdf->SetXY($this->posxdate, $this->tab_top+2);
$pdf->MultiCell($this->posxpaymenttype - $this->posxdate, 2, 'Date');
$pdf->line($this->posxpaymenttype - 1, $this->tab_top, $this->posxpaymenttype - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxpaymenttype, $this->tab_top+2);
$pdf->MultiCell($this->posxinvoice - $this->posxpaymenttype, 2, $outputlangs->transnoentities("PaymentMode"), 0, 'L');
$pdf->line($this->posxinvoice - 1, $this->tab_top, $this->posxinvoice - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxinvoice, $this->tab_top+2);
$pdf->MultiCell($this->posxbankaccount - $this->posxinvoice, 2, $outputlangs->transnoentities("Invoice"), 0, 'L');
$pdf->line($this->posxbankaccount - 1, $this->tab_top, $this->posxbankaccount - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxbankaccount, $this->tab_top+2);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxbankaccount, 2, $outputlangs->transnoentities("Account"), 0, 'L');
$pdf->line($this->posxinvoiceamount - 1, $this->tab_top, $this->posxinvoiceamount - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top+2);
$pdf->MultiCell($this->posxpaymentamount - $this->posxinvoiceamount - 1, 2, $outputlangs->transnoentities("AmountInvoice"), 0, 'R');
$pdf->line($this->posxpaymentamount - 1, $this->tab_top, $this->posxpaymentamount - 1, $this->tab_top + $this->tab_height + 10);
$pdf->SetXY($this->posxpaymentamount, $this->tab_top+2);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount - 1, 2, $outputlangs->transnoentities("AmountPayment"), 0, 'R');
$pdf->line($this->marge_gauche, $this->tab_top + 10, $this->page_largeur - $this->marge_droite, $this->tab_top + 10);
$pdf->Rect($this->marge_gauche, $this->tab_top, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $this->tab_height + 10);
}
/**
* Output body
*
* @param PDF $pdf PDF object
* @param string $page Page
* @param array $lines Array of lines
* @param Translate $outputlangs Object langs
* @return void
*/
function Body(&$pdf, $page, $lines, $outputlangs)
{
$default_font_size = pdf_getPDFFontSize($outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$oldprowid = 0;
$pdf->SetFillColor(220,220,220);
$yp = 0;
$numlines=count($lines);
for ($j = 0 ; $j < $numlines ; $j++)
{
$i = $j;
if ($yp > $this->tab_height -5)
{
$page++;
$pdf->AddPage();
$this->_pagehead($pdf, $page, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$yp = 0;
}
if ($oldprowid <> $lines[$j][7])
{
if ($yp > $this->tab_height -10)
{
$page++;
$pdf->AddPage();
$this->_pagehead($pdf, $page, 0, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$yp = 0;
}
$pdf->SetXY($this->posxdate - 1, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymenttype - $this->posxdate + 1, $this->line_height, $lines[$j][1], 0, 'L', 1);
$pdf->SetXY($this->posxpaymenttype, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxpaymenttype, $this->line_height, $lines[$j][2].' '.$lines[$j][3], 0, 'L', 1);
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymentamount- $this->posxinvoiceamount, $this->line_height, '', 0, 'R', 1);
$pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][4], 0, 'R', 1);
$yp = $yp + 5;
}
// Invoice number
$pdf->SetXY($this->posxinvoice, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxinvoiceamount - $this->posxbankaccount, $this->line_height, $lines[$j][0], 0, 'L', 0);
// BankAccount
$pdf->SetXY($this->posxbankaccount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxbankaccount - $this->posxdate, $this->line_height, $lines[$j][8], 0, 'L', 0);
// Invoice amount
$pdf->SetXY($this->posxinvoiceamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->posxpaymentamount- $this->posxinvoiceamount - 1, $this->line_height, $lines[$j][5], 0, 'R', 0);
// Payment amount
$pdf->SetXY($this->posxpaymentamount, $this->tab_top + 10 + $yp);
$pdf->MultiCell($this->page_largeur - $this->marge_droite - $this->posxpaymentamount, $this->line_height, $lines[$j][6], 0, 'R', 0);
$yp = $yp + 5;
if ($oldprowid <> $lines[$j][7])
{
$oldprowid = $lines[$j][7];
}
}
}
}

View File

@ -8,6 +8,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/modules/syslog/logHandler.php';
class mod_syslog_file extends LogHandler implements LogHandlerInterface
{
var $code = 'file';
var $lastTime = 0;
/**
* Return name of logger
@ -145,9 +146,16 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface
LOG_INFO => 'INFO',
LOG_DEBUG => 'DEBUG'
);
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S")." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
$delay = "";
if (!empty($conf->global->MAIN_SYSLOG_SHOW_DELAY))
{
$now = microtime(true);
$delay = " ".sprintf("%05.3f", $this->lastTime != 0 ? $now - $this->lastTime : 0);
$this->lastTime = $now;
}
$message = dol_print_date(time(),"%Y-%m-%d %H:%M:%S").$delay." ".sprintf("%-7s", $logLevels[$content['level']])." ".sprintf("%-15s", $content['ip'])." ".($this->ident>0?str_pad('',$this->ident,' '):'').$content['message'];
fwrite($filefd, $message."\n");
fclose($filefd);
@chmod($logfile, octdec(empty($conf->global->MAIN_UMASK)?'0664':$conf->global->MAIN_UMASK));

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2014 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2015 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015-2016 Marcos García <marcosgdf@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -52,11 +52,12 @@ if (in_array($object->element,array('propal', 'supplier_proposal','facture','fac
?>
<!-- BEGIN PHP TEMPLATE objectline_create.tpl.php -->
<?php
<?php
$nolinesbefore=(count($this->lines) == 0);
if ($nolinesbefore) {
?>
<tr class="liste_titre<?php echo (($nolinesbefore || $object->element=='contrat')?'':' liste_titre_add') ?> nodrag nodrop">
<tr id="addline" class="liste_titre liste_titre_add nodrag nodrop">
<td class="linecoldescription" <?php echo (! empty($conf->global->MAIN_VIEW_LINE_NUMBER) ? ' colspan="2"' : ''); ?>>
<div id="add"></div><span class="hideonsmartphone"><?php echo $langs->trans('AddNewLine'); ?></span><?php // echo $langs->trans("FreeZone"); ?>
</td>
@ -94,7 +95,7 @@ if ($nolinesbefore) {
<?php
}
else $colspan++;
if ($conf->global->MARGIN_TYPE == "1")
echo $langs->trans('BuyingPrice');
else
@ -108,7 +109,7 @@ if ($nolinesbefore) {
?>
<td class="linecoledit" colspan="<?php echo $colspan; ?>">&nbsp;</td>
</tr>
<?php
<?php
}
?>
<tr class="pair nodrag nodrop nohoverpair<?php echo ($nolinesbefore || $object->element=='contrat')?'':' liste_titre_add'; ?>">
@ -191,11 +192,11 @@ else {
if ($conf->global->ENTREPOT_EXTRA_STATUS)
{
// hide products in closed warehouse, but show products for internal transfer
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, 'warehouseopen,warehouseinternal');
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, 'warehouseopen,warehouseinternal', GETPOST('combinations', 'array'));
}
else
{
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id);
$form->select_produits(GETPOST('idprod'), 'idprod', $filtertype, $conf->product->limit_size, $buyer->price_level, 1, 2, '', 1, array(),$buyer->id, '1', 0, '', 0, '', GETPOST('combinations', 'array'));
}
}
else
@ -209,7 +210,7 @@ else {
);
$alsoproductwithnosupplierprice=0;
}
else
else
{
$ajaxoptions = array();
$alsoproductwithnosupplierprice=1;
@ -237,7 +238,14 @@ else {
}
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) echo '<br>';
if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) {
if (!empty($conf->variants->enabled)) {
echo '<div id="attributes_box"></div>';
}
echo '<br>';
}
// Editor wysiwyg
require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php';
@ -306,7 +314,7 @@ else {
<?php
$coldisplay++;
}
if ($user->rights->margins->creer)
{
if (! empty($conf->global->DISPLAY_MARGIN_RATES))
@ -561,9 +569,9 @@ jQuery(document).ready(function() {
$("#idprod, #idprodfournprice").change(function()
{
console.log("#idprod, #idprodfournprice change triggered");
setforpredef(); // TODO Keep vat combo visible and set it to first entry into list that match result of get_default_tva
jQuery('#trlinefordates').show();
<?php
@ -584,13 +592,13 @@ jQuery(document).ready(function() {
var defaultkey = '';
var defaultprice = '';
var bestpricefound = 0;
var bestpriceid = 0; var bestpricevalue = 0;
var pmppriceid = 0; var pmppricevalue = 0;
var costpriceid = 0; var costpricevalue = 0;
/* setup of margin calculation */
var defaultbuyprice = '<?php
var defaultbuyprice = '<?php
if (isset($conf->global->MARGIN_TYPE))
{
if ($conf->global->MARGIN_TYPE == '1') print 'bestsupplierprice';
@ -598,7 +606,7 @@ jQuery(document).ready(function() {
if ($conf->global->MARGIN_TYPE == 'costprice') print 'costprice';
} ?>';
console.log("we will set the field for margin. defaultbuyprice="+defaultbuyprice);
var i = 0;
$(data).each(function() {
if (this.id != 'pmpprice' && this.id != 'costprice')
@ -615,7 +623,7 @@ jQuery(document).ready(function() {
//console.log("id="+this.id+"-price="+this.price);
if ('pmp' == defaultbuyprice || 'costprice' == defaultbuyprice)
{
if (this.price > 0) {
if (this.price > 0) {
defaultkey = this.id; defaultprice = this.price; pmppriceid = this.id; pmppricevalue = this.price;
//console.log("pmppricevalue="+pmppricevalue);
}
@ -634,22 +642,22 @@ jQuery(document).ready(function() {
options += '<option value="'+this.id+'" price="'+this.price+'">'+this.label+'</option>';
});
options += '<option value="inputprice" price="'+defaultprice+'"><?php echo $langs->trans("InputPrice"); ?></option>';
console.log("finally selected defaultkey="+defaultkey+" defaultprice="+defaultprice);
$("#fournprice_predef").html(options).show();
if (defaultkey != '')
{
$("#fournprice_predef").val(defaultkey);
}
/* At loading, no product are yet selected, so we hide field of buying_price */
$("#buying_price").hide();
/* Define default price at loading */
var defaultprice = $("#fournprice_predef").find('option:selected').attr("price");
$("#buying_price").val(defaultprice);
$("#fournprice_predef").change(function() {
console.log("change on fournprice_predef");
/* Hide field buying_price according to choice into list (if 'inputprice' or not) */
@ -701,8 +709,8 @@ function setforfree() {
jQuery("#idprod").val('');
jQuery("#idprodfournprice").val('0'); // Set cursor on not selected product
jQuery("#search_idprodfournprice").val('');
jQuery("#prod_entry_mode_free").prop('checked',true);
jQuery("#prod_entry_mode_predef").prop('checked',false);
jQuery("#prod_entry_mode_free").prop('checked',true).change();
jQuery("#prod_entry_mode_predef").prop('checked',false).change();
jQuery("#price_ht").show();
jQuery("#multicurrency_price_ht").show();
jQuery("#price_ttc").show(); // May no exists
@ -721,8 +729,8 @@ function setforfree() {
function setforpredef() {
console.log("Call setforpredef. We hide some fields");
jQuery("#select_type").val(-1);
jQuery("#prod_entry_mode_free").prop('checked',false);
jQuery("#prod_entry_mode_predef").prop('checked',true);
jQuery("#prod_entry_mode_free").prop('checked',false).change();
jQuery("#prod_entry_mode_predef").prop('checked',true).change();
jQuery("#price_ht").hide();
jQuery("#multicurrency_price_ht").hide();
jQuery("#price_ttc").hide(); // May no exists

View File

@ -63,6 +63,7 @@ if (empty($usemargins)) $usemargins=0;
$txt='';
print img_object($langs->trans("ShowReduc"),'reduc').' ';
if ($line->description == '(DEPOSIT)') $txt=$langs->trans("Deposit");
elseif ($line->description == '(EXCESS RECEIVED)') $txt=$langs->trans("ExcessReceived");
//else $txt=$langs->trans("Discount");
print $txt;
?>
@ -85,6 +86,12 @@ if (empty($usemargins)) $usemargins=0;
if (! empty($conf->global->INVOICE_ADD_DEPOSIT_DATE))
echo ' ('.dol_print_date($discount->datec).')';
}
elseif ($line->description == '(EXCESS RECEIVED)' && $objp->fk_remise_except > 0)
{
$discount=new DiscountAbsolute($this->db);
$discount->fetch($line->fk_remise_except);
echo ($txt?' - ':'').$langs->transnoentities("DiscountFromExcessReceived",$discount->getNomUrl(0));
}
else
{
echo ($txt?' - ':'').dol_htmlentitiesbr($line->description);

View File

@ -209,15 +209,149 @@ $head = donation_admin_prepare_head();
dol_fiche_head($head, 'general', $langs->trans("Donations"), 0, 'payment');
/*
* Params
*/
print load_fiche_titre($langs->trans("Options"));
// Document templates
print load_fiche_titre($langs->trans("DonationsModels"), '', '');
// Defined the template definition table
$type='donation';
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$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 colspan="3">'.$langs->trans("Parameters").'</td>';
//print '<td width="80">&nbsp;</td>';
print '<td>'.$langs->trans("Name").'</td>';
print '<td>'.$langs->trans("Description").'</td>';
print '<td align="center" width="60">'.$langs->trans("Activated").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
$handle=opendir($dir);
$var=True;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module=new $classname($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 '.$bc[$var].'><td width=\"100\">';
echo $module->name;
print '</td>';
print '<td>';
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
if ($conf->global->DON_ADDON_MODEL == $name)
{
print "<td align=\"center\">\n";
print img_picto($langs->trans("Enabled"),'switch_on');
print '</td>';
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
print '</td>';
}
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
if ($conf->global->DON_ADDON_MODEL == "$name")
{
print "<td align=\"center\">";
print img_picto($langs->trans("Default"),'on');
print '</td>';
}
else
{
print "<td align=\"center\">";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;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("MultiLanguage").': '.yn($module->option_multilang,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
print '</table><br>';
/*
* Params
*/
print load_fiche_titre($langs->trans("Options"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>';
print '<td width="60" align="center">'.$langs->trans("Value")."</td>\n";
print '<td></td>';
print "</tr>\n";
$var=true;
@ -228,7 +362,7 @@ print '<input type="hidden" name="action" value="set_DONATION_ACCOUNTINGACCOUNT"
$var=! $var;
print '<tr '.$bc[$var].'>';
print '<td width="50%">';
print '<td>';
$label = $langs->trans("AccountAccounting");
print '<label for="DONATION_ACCOUNTINGACCOUNT">' . $label . '</label></td>';
print '<td>';
@ -251,8 +385,8 @@ print '<input type="hidden" name="action" value="set_DONATION_MESSAGE" />';
$var=! $var;
print '<tr '.$bc[$var].'><td colspan="2">';
print $langs->trans("FreeTextOnDonations").'<br>';
print '<textarea name="DONATION_MESSAGE" class="flat" cols="120">'.$conf->global->DONATION_MESSAGE.'</textarea>';
print $langs->trans("FreeTextOnDonations").' '.img_info($langs->trans("AddCRIfTooLong")).'<br>';
print '<textarea name="DONATION_MESSAGE" class="flat" cols="80">'.$conf->global->DONATION_MESSAGE.'</textarea>';
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
@ -266,7 +400,7 @@ print '</form>';
if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY))
{
print '<br>';
print load_fiche_titre($langs->trans("FrenchOptions"));
print load_fiche_titre($langs->trans("FrenchOptions"), '', '');
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
@ -317,139 +451,6 @@ if (preg_match('/fr/i',$conf->global->MAIN_INFO_SOCIETE_COUNTRY))
print "</table>\n";
}
// Document templates
print '<br>';
print load_fiche_titre($langs->trans("DonationsModels"));
// Defined the template definition table
$type='donation';
$def = array();
$sql = "SELECT nom";
$sql.= " FROM ".MAIN_DB_PREFIX."document_model";
$sql.= " WHERE type = '".$type."'";
$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("Activated").'</td>';
print '<td align="center" width="60">'.$langs->trans("Default").'</td>';
print '<td align="center" width="80">'.$langs->trans("ShortInfo").'</td>';
print '<td align="center" width="80">'.$langs->trans("Preview").'</td>';
print "</tr>\n";
clearstatcache();
$handle=opendir($dir);
$var=True;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/\.modules\.php$/i',$file))
{
$var = !$var;
$name = substr($file, 0, dol_strlen($file) -12);
$classname = substr($file, 0, dol_strlen($file) -12);
require_once $dir.'/'.$file;
$module=new $classname($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 '.$bc[$var].'><td width=\"100\">';
echo $module->name;
print '</td>';
print '<td>';
print $module->description;
print '</td>';
// Active
if (in_array($name, $def))
{
if ($conf->global->DON_ADDON_MODEL == $name)
{
print "<td align=\"center\">\n";
print img_picto($langs->trans("Enabled"),'switch_on');
print '</td>';
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Enabled"),'switch_on').'</a>';
print '</td>';
}
}
else
{
print "<td align=\"center\">\n";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"),'switch_off').'</a>';
print "</td>";
}
// Default
if ($conf->global->DON_ADDON_MODEL == "$name")
{
print "<td align=\"center\">";
print img_picto($langs->trans("Default"),'on');
print '</td>';
}
else
{
print "<td align=\"center\">";
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&amp;value='.$name.'&amp;scandir='.$module->scandir.'&amp;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("MultiLanguage").': '.yn($module->option_multilang,1,1);
print '<td align="center">';
print $form->textwithpicto('',$htmltooltip,-1,0);
print '</td>';
// Preview
print '<td align="center">';
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.$name.'" target="specimen">'.img_object($langs->trans("Preview"),'generic').'</a>';
print '</td>';
print "</tr>\n";
}
}
}
closedir($handle);
}
print '</table>';
llxFooter();
$db->close();

View File

@ -380,7 +380,7 @@ $moreheadjs=empty($conf->use_javascript_ajax)?"":"
, north__paneSelector: \"#ecm-layout-north\"
, west__paneSelector: \"#ecm-layout-west\"
, resizable: true
, north__size: 36
, north__size: 37 /* 2 are removed by js */
, north__resizable: false
, north__closable: false
, west__size: 340
@ -509,24 +509,17 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
// Root of manual section
print '<tr><td>';
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
print '<td align="left" width="24px">';
print img_picto_common('','treemenu/base.gif');
print '</td><td align="left">';
print '<tr class="ecmroot">';
print '<td class="ecmroot">';
print img_picto_common('','treemenu/base.gif','class="inline-block valignmiddle"');
$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsManual").')';
print $form->textwithpicto($txt, $htmltooltip, 1, 'info');
print '</td>';
print '</tr></table></td>';
print '<td align="right">';
print '</td>';
print '<td align="right">&nbsp;</td>';
//print '<td align="right"><a href="'.DOL_URL_ROOT.'/ecm/docdir.php?action=create">'.img_edit_add().'</a></td>';
print '<td align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</td>';
print '<td align="center">';
//print $form->textwithpicto('',$htmltooltip,1,"info");
print '</td>';
print '<td class="ecmroot"></td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot"></td>';
print '</tr>';
if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS))

View File

@ -373,7 +373,7 @@ $moreheadjs=empty($conf->use_javascript_ajax)?"":"
, north__paneSelector: \"#ecm-layout-north\"
, west__paneSelector: \"#ecm-layout-west\"
, resizable: true
, north__size: 36
, north__size: 37 /* 2 are removed by js */
, north__resizable: false
, north__closable: false
, west__size: 340
@ -495,23 +495,17 @@ if (empty($action) || $action == 'file_manager' || preg_match('/refresh/i',$acti
$htmltooltip=$langs->trans("ECMAreaDesc2");
// Root title line (Automatic section)
print '<tr>';
print '<td>';
print '<table class="nobordernopadding"><tr class="nobordernopadding">';
print '<td align="left" width="24">';
print img_picto_common('','treemenu/base.gif');
print '</td><td align="left">';
print '<tr class="ecmroot">';
print '<td class="ecmroot">';
print img_picto_common('','treemenu/base.gif','class="inline-block valignmiddle"');
$txt=$langs->trans("ECMRoot").' ('.$langs->trans("ECMSectionsAuto").')';
print $form->textwithpicto($txt, $htmltooltip, 1, 0);
print '</td>';
print '</tr></table>';
print '</td>';
print '<td align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</td>';
print '<td align="right">&nbsp;</td>';
print '<td align="center">';
print '</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot">&nbsp;</td>';
print '<td class="ecmroot"></td>';
print '</tr>';
$sectionauto=dol_sort_array($sectionauto,'label','ASC',true,false);

View File

@ -118,14 +118,16 @@ class ExpenseReport extends CommonObject
* Create object in database
*
* @param User $user User that create
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function create($user)
function create($user, $notrigger=0)
{
global $conf;
$now = dol_now();
$error = 0;
$fuserid = $this->fk_user_author;
if (empty($fuserid)) $fuserid = $user->id;
@ -200,8 +202,28 @@ class ExpenseReport extends CommonObject
$result=$this->update_price();
if ($result > 0)
{
$this->db->commit();
return $this->id;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_CREATE',$user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return $this->id;
}
else
{
$this->db->rollback();
return -4;
}
}
else
{
@ -301,12 +323,16 @@ class ExpenseReport extends CommonObject
* update
*
* @param User $user User making change
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function update($user)
function update($user, $notrigger = 0)
{
global $langs;
$error = 0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element." SET";
$sql.= " total_ht = ".$this->total_ht;
$sql.= " , total_ttc = ".$this->total_ttc;
@ -328,10 +354,32 @@ class ExpenseReport extends CommonObject
$result = $this->db->query($sql);
if ($result)
{
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_UPDATE',$user);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -1;
}
@ -446,10 +494,14 @@ class ExpenseReport extends CommonObject
*
* @param int $id Id of expense report
* @param user $fuser User making change
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function set_paid($id, $fuser)
function set_paid($id, $fuser, $notrigger = 0)
{
$error = 0;
$this->db->begin();
$sql = "UPDATE ".MAIN_DB_PREFIX."expensereport";
$sql.= " SET fk_statut = 6, paid=1";
$sql.= " WHERE rowid = ".$id." AND fk_statut = 5";
@ -460,15 +512,38 @@ class ExpenseReport extends CommonObject
{
if ($this->db->affected_rows($resql))
{
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_PAID',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->commit();
return 0;
}
}
else
{
$this->db->rollback();
dol_print_error($this->db);
return -1;
}
@ -927,12 +1002,14 @@ class ExpenseReport extends CommonObject
* Set to status validate
*
* @param User $fuser User
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function setValidate($fuser)
function setValidate($fuser, $notrigger=0)
{
global $conf,$langs;
$error = 0;
$this->oldref = $this->ref;
$expld_car = (empty($conf->global->NDF_EXPLODE_CHAR))?"-":$conf->global->NDF_EXPLODE_CHAR;
@ -990,7 +1067,8 @@ class ExpenseReport extends CommonObject
if ($this->fk_statut != 2)
{
$now = dol_now();
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->ref."', fk_statut = 2, fk_user_valid = ".$fuser->id.", date_valid='".$this->db->idate($now)."'";
if ($update_number_int) {
@ -1001,10 +1079,32 @@ class ExpenseReport extends CommonObject
$resql=$this->db->query($sql);
if ($resql)
{
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_VALIDATE',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
@ -1064,26 +1164,52 @@ class ExpenseReport extends CommonObject
* Set status to approved
*
* @param User $fuser User
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function setApproved($fuser)
function setApproved($fuser, $notrigger=0)
{
$now=dol_now();
$error = 0;
// date approval
$this->date_approve = $this->db->idate($now);
if ($this->fk_statut != 5)
{
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET ref = '".$this->ref."', fk_statut = 5, fk_user_approve = ".$fuser->id.",";
$sql.= " date_approve='".$this->date_approve."'";
$sql.= ' WHERE rowid = '.$this->id;
if ($this->db->query($sql))
{
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_APPROVE',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
@ -1099,11 +1225,13 @@ class ExpenseReport extends CommonObject
*
* @param User $fuser User
* @param Details $details Details
* @param int $notrigger Disable triggers
*/
function setDeny($fuser,$details)
function setDeny($fuser,$details,$notrigger=0)
{
$now = dol_now();
$error = 0;
// date de refus
if ($this->fk_statut != 99)
{
@ -1119,10 +1247,33 @@ class ExpenseReport extends CommonObject
$this->fk_user_refuse = $fuser->id;
$this->detail_refuse = $details;
$this->date_refuse = $now;
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_DENY',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->lasterror();
return -1;
}
@ -1137,24 +1288,54 @@ class ExpenseReport extends CommonObject
* set_unpaid
*
* @param User $fuser User
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function set_unpaid($fuser)
function set_unpaid($fuser, $notrigger = 0)
{
$error = 0;
if ($this->fk_c_deplacement_statuts != 5)
{
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_statut = 5";
$sql.= ' WHERE rowid = '.$this->id;
dol_syslog(get_class($this)."::set_unpaid sql=".$sql, LOG_DEBUG);
if ($this->db->query($sql)):
return 1;
else:
$this->error=$this->db->error();
return -1;
endif;
if ($this->db->query($sql))
{
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_UNPAID',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -1;
}
}
else
{
@ -1167,13 +1348,17 @@ class ExpenseReport extends CommonObject
*
* @param User $fuser User
* @param string $detail Detail
* @param int $notrigger Disable triggers
* @return int <0 if KO, >0 if OK
*/
function set_cancel($fuser,$detail)
function set_cancel($fuser,$detail, $notrigger=0)
{
$error = 0;
$this->date_cancel = $this->db->idate(gmmktime());
if ($this->fk_statut != 4)
{
$this->db->begin();
$sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element;
$sql.= " SET fk_statut = 4, fk_user_cancel = ".$fuser->id;
$sql.= ", date_cancel='".$this->date_cancel."'";
@ -1184,10 +1369,32 @@ class ExpenseReport extends CommonObject
if ($this->db->query($sql))
{
return 1;
if (!$notrigger)
{
// Call trigger
$result=$this->call_trigger('EXPENSE_REPORT_CANCEL',$fuser);
if ($result < 0) {
$error++;
}
// End call triggers
}
if (empty($error))
{
$this->db->commit();
return 1;
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -2;
}
}
else
{
$this->db->rollback();
$this->error=$this->db->error();
return -1;
}
@ -2035,9 +2242,10 @@ function select_expensereport_statut($selected='',$htmlname='fk_statut',$useempt
* @param int $selected Preselected type
* @param string $htmlname Name of field in form
* @param int $showempty Add an empty field
* @param int $active 1=Active only, 0=Unactive only, -1=All
* @return string Select html
*/
function select_type_fees_id($selected='',$htmlname='type',$showempty=0)
function select_type_fees_id($selected='',$htmlname='type',$showempty=0, $active=1)
{
global $db,$langs,$user;
$langs->load("trips");
@ -2051,6 +2259,7 @@ function select_type_fees_id($selected='',$htmlname='type',$showempty=0)
}
$sql = "SELECT c.id, c.code, c.label as type FROM ".MAIN_DB_PREFIX."c_type_fees as c";
if ($active >= 0) $sql.= " WHERE c.active = ".$active;
$sql.= " ORDER BY c.label ASC";
$resql=$db->query($sql);
if ($resql)

View File

@ -543,7 +543,7 @@ if ($resql)
if (!empty($obj->note_private) || !empty($obj->note_public))
{
print ' <span class="note">';
print '<a href="'.DOL_URL_ROOT.'/commande/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '<a href="'.DOL_URL_ROOT.'/expensereport/note.php?id='.$obj->rowid.'">'.img_picto($langs->trans("ViewPrivateNote"),'object_generic').'</a>';
print '</span>';
}
print '</td>';

View File

@ -288,15 +288,15 @@ class Export
{
// mode plage
$ValueArray = explode("+", $ValueField);
$szFilterQuery ="(".$this->conditionDate($NameField,$ValueArray[0],">=");
$szFilterQuery.=" AND ".$this->conditionDate($NameField,$ValueArray[1],"<=").")";
$szFilterQuery ="(".$this->conditionDate($NameField,trim($ValueArray[0]),">=");
$szFilterQuery.=" AND ".$this->conditionDate($NameField,trim($ValueArray[1]),"<=").")";
}
else
{
if (is_numeric(substr($ValueField,0,1)))
$szFilterQuery=$this->conditionDate($NameField,$ValueField,"=");
$szFilterQuery=$this->conditionDate($NameField,trim($ValueField),"=");
else
$szFilterQuery=$this->conditionDate($NameField,substr($ValueField,1),substr($ValueField,0,1));
$szFilterQuery=$this->conditionDate($NameField,trim(substr($ValueField,1)),substr($ValueField,0,1));
}
break;
case 'Duree':

View File

@ -595,7 +595,7 @@ if ($step == 2 && $datatoexport)
{
// Selected fields
print '<td>&nbsp;</td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field='.$code.'">'.img_left('default', 0, 'style="max-width: 20px"').'</a></td>';
print '<td align="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=unselectfield&field='.$code.'">'.img_left('default', 0, 'style="max-width: 20px"').'</a></td>';
print '<td>';
//print $text.'-'.$htmltext."<br>";
print $form->textwithpicto($text,$htmltext);
@ -610,7 +610,7 @@ if ($step == 2 && $datatoexport)
print $form->textwithpicto($text,$htmltext);
//print ' ('.$code.')';
print '</td>';
print '<td align="center"><a href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field='.$code.'">'.img_right('default', 0, 'style="max-width: 20px"').'</a></td>';
print '<td align="center"><a class="reposition" href="'.$_SERVER["PHP_SELF"].'?step=2&datatoexport='.$datatoexport.'&action=selectfield&field='.$code.'">'.img_right('default', 0, 'style="max-width: 20px"').'</a></td>';
print '<td>&nbsp;</td>';
}

View File

@ -438,49 +438,6 @@ if (empty($reshook))
}
}
/*
* Build doc
*/
else if ($action == 'builddoc' && $user->rights->ficheinter->creer) // En get ou en post
{
$object->fetch_lines();
// Save last template used to generate document
if (GETPOST('model')) $object->setDocModel($user, GETPOST('model','alpha'));
// Define output language
$outputlangs = $langs;
$newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','alpha')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->thirdparty->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=fichinter_create($db, $object, GETPOST('model','alpha'), $outputlangs);
if ($result <= 0)
{
dol_print_error($db,$result);
exit;
}
}
// Remove file in doc form
else if ($action == 'remove_file')
{
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$object->fetch_thirdparty();
$langs->load("other");
$upload_dir = $conf->ficheinter->dir_output;
$file = $upload_dir . '/' . GETPOST('file');
$ret=dol_delete_file($file,0,0,0,$object);
if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('urlfile')), null, 'mesgs');
else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('urlfile')), null, 'errors');
}
// Set into a project
else if ($action == 'classin' && $user->rights->ficheinter->creer)
{
@ -797,6 +754,11 @@ if (empty($reshook))
if ($error) $action = 'edit_extras';
}
// Actions to build doc
$upload_dir = $conf->ficheinter->dir_output;
$permissioncreate = $user->rights->ficheinter->creer;
include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
if (! empty($conf->global->MAIN_DISABLE_CONTACTS_TAB) && $user->rights->ficheinter->creer)
{
if ($action == 'addcontact')

View File

@ -2346,8 +2346,11 @@ class CommandeFournisseur extends CommonOrder
$subprice = price2num($pu_ht,'MU');
//Fetch current line from the database and then clone the object and set it in $oldline property
$this->line=new CommandeFournisseurLigne($this->db);
$this->line->fetch($rowid);
$oldline = clone $this->line;
$this->line->oldline = $oldline;
$this->line->context = $this->context;

View File

@ -46,7 +46,7 @@ class FactureFournisseur extends CommonInvoice
public $fk_element='fk_facture_fourn';
protected $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
public $picto='bill';
/**
* {@inheritdoc}
*/
@ -320,12 +320,12 @@ class FactureFournisseur extends CommonInvoice
{
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.')';
$resql_insert=$this->db->query($sql);
if ($resql_insert)
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$this->updateline(
$idligne,
$this->lines[$i]->description,
@ -354,19 +354,19 @@ class FactureFournisseur extends CommonInvoice
foreach ($this->lines as $i => $val)
{
$line = $this->lines[$i];
// Test and convert into object this->lines[$i]. When coming from REST API, we may still have an array
//if (! is_object($line)) $line=json_decode(json_encode($line), FALSE); // convert recursively array into object.
if (! is_object($line)) $line = (object) $line;
$sql = 'INSERT INTO '.MAIN_DB_PREFIX.'facture_fourn_det (fk_facture_fourn)';
$sql .= ' VALUES ('.$this->id.')';
$resql_insert=$this->db->query($sql);
if ($resql_insert)
{
$idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det');
$this->updateline(
$idligne,
$line->description,
@ -387,9 +387,9 @@ class FactureFournisseur extends CommonInvoice
$this->db->rollback();
return -5;
}
}
}
}
// Update total price
$result=$this->update_price();
if ($result > 0)
@ -413,7 +413,7 @@ class FactureFournisseur extends CommonInvoice
}
}
else if ($reshook < 0) $error++;
if (! $error)
{
// Call trigger
@ -421,7 +421,7 @@ class FactureFournisseur extends CommonInvoice
if ($result < 0) $error++;
// End call triggers
}
if (! $error)
{
$this->db->commit();
@ -587,7 +587,7 @@ class FactureFournisseur extends CommonInvoice
$this->multicurrency_total_ht = $obj->multicurrency_total_ht;
$this->multicurrency_total_tva = $obj->multicurrency_total_tva;
$this->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$this->extraparams = (array) json_decode($obj->extraparams, true);
$this->socid = $obj->socid;
@ -671,8 +671,8 @@ class FactureFournisseur extends CommonInvoice
$line->subprice = $obj->pu_ht;
$line->pu_ht = $obj->pu_ht;
$line->pu_ttc = $obj->pu_ttc;
$line->vat_src_code = $obj->vat_src_code;
$line->vat_src_code = $obj->vat_src_code;
$line->tva_tx = $obj->tva_tx;
$line->localtax1_tx = $obj->localtax1_tx;
$line->localtax2_tx = $obj->localtax2_tx;
@ -700,7 +700,7 @@ class FactureFournisseur extends CommonInvoice
$line->multicurrency_total_ht = $obj->multicurrency_total_ht;
$line->multicurrency_total_tva = $obj->multicurrency_total_tva;
$line->multicurrency_total_ttc = $obj->multicurrency_total_ttc;
$this->lines[$i] = $line;
$i++;
@ -1260,7 +1260,7 @@ class FactureFournisseur extends CommonInvoice
if (! $error && empty($notrigger))
{
// Call trigger
$result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user);
$result=$this->call_trigger('BILL_SUPPLIER_UNVALIDATE',$user);
if ($result < 0) $error++;
// End call triggers
}
@ -1332,7 +1332,7 @@ class FactureFournisseur extends CommonInvoice
if (empty($txlocaltax2)) $txlocaltax2=0;
$localtaxes_type=getLocalTaxesFromRate($txtva, 0, $mysoc, $this->thirdparty);
// Clean vat code
$vat_src_code='';
if (preg_match('/\((.*)\)/', $txtva, $reg))
@ -1340,7 +1340,7 @@ class FactureFournisseur extends CommonInvoice
$vat_src_code = $reg[1];
$txtva = preg_replace('/\s*\(.*\)/', '', $txtva); // Remove code into vatrate.
}
$remise_percent=price2num($remise_percent);
$qty=price2num($qty);
$pu=price2num($pu);
@ -1374,7 +1374,7 @@ class FactureFournisseur extends CommonInvoice
//$this->line->label=$label; // deprecated
$this->line->desc=$desc;
$this->line->qty= ($this->type==self::TYPE_CREDIT_NOTE?abs($qty):$qty); // For credit note, quantity is always positive and unit price negative
$this->line->vat_src_code=$vat_src_code;
$this->line->tva_tx=$txtva;
$this->line->localtax1_tx=$txlocaltax1;
@ -1503,7 +1503,7 @@ class FactureFournisseur extends CommonInvoice
$vat_src_code = $reg[1];
$vatrate = preg_replace('/\s*\(.*\)/', '', $vatrate); // Remove code into vatrate.
}
$tabprice = calcul_price_total($qty, $pu, $remise_percent, $vatrate, $txlocaltax1, $txlocaltax2, 0, $price_base_type, $info_bits, $type, $this->thirdparty, $localtaxes_type, 100, $this->multicurrency_tx, $pu_ht_devise);
$total_ht = $tabprice[0];
$total_tva = $tabprice[1];
@ -1513,13 +1513,13 @@ class FactureFournisseur extends CommonInvoice
$pu_ttc = $tabprice[5];
$total_localtax1 = $tabprice[9];
$total_localtax2 = $tabprice[10];
// MultiCurrency
$multicurrency_total_ht = $tabprice[16];
$multicurrency_total_tva = $tabprice[17];
$multicurrency_total_ttc = $tabprice[18];
$pu_ht_devise = $tabprice[19];
if (empty($info_bits)) $info_bits=0;
if ($idproduct)
@ -1545,7 +1545,7 @@ class FactureFournisseur extends CommonInvoice
$line->pu_ttc = $pu_ttc;
$line->qty = $qty;
$line->remise_percent = $remise_percent;
$line->vat_src_code=$vat_src_code;
$line->tva_tx = $vatrate;
$line->localtax1_tx = $txlocaltax1;
@ -1871,7 +1871,7 @@ class FactureFournisseur extends CommonInvoice
$linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"';
$linkclose.=' class="classfortooltip"';
}
$linkstart = '<a href="'.$url.'"';
$linkstart.=$linkclose.'>';
$linkend='</a>';
@ -2179,10 +2179,10 @@ class FactureFournisseur extends CommonInvoice
}
else
{
$modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation
$modele = ''; // No default value. For supplier invoice, we allow to disable all PDF generation
}
}
if (empty($modele))
{
return 0;
@ -2266,7 +2266,7 @@ class SupplierInvoiceLine extends CommonObjectLine
public $product_ref;
/**
* Supplier reference of price when we added the line. May have been changed after line was added.
* Supplier reference of price when we added the line. May have been changed after line was added.
* TODO Rename field ref to ref_supplier into table llx_facture_fourn_det and llx_commande_fournisseurdet and update fields into updateline
* @var string
*/
@ -2555,13 +2555,13 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql.= ", product_type = ".$this->product_type;
$sql.= ", info_bits = ".$this->info_bits;
$sql.= ", fk_unit = ".$fk_unit;
// Multicurrency
$sql.= " , multicurrency_subprice=".price2num($this->multicurrency_subprice)."";
$sql.= " , multicurrency_total_ht=".price2num($this->multicurrency_total_ht)."";
$sql.= " , multicurrency_total_tva=".price2num($this->multicurrency_total_tva)."";
$sql.= " , multicurrency_total_ttc=".price2num($this->multicurrency_total_ttc)."";
$sql.= " WHERE rowid = ".$this->id;
dol_syslog(get_class($this)."::update", LOG_DEBUG);
@ -2675,7 +2675,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$sql.= " ".(! empty($this->label)?"'".$this->db->escape($this->label)."'":"null").",";
$sql.= " '".$this->db->escape($this->desc)."',";
$sql.= " ".price2num($this->qty).",";
$sql.= " ".(empty($this->vat_src_code)?"''":"'".$this->vat_src_code."'").",";
$sql.= " ".price2num($this->tva_tx).",";
$sql.= " ".price2num($this->localtax1_tx).",";
@ -2745,7 +2745,7 @@ class SupplierInvoiceLine extends CommonObjectLine
$this->db->rollback();
return -2;
}
}
}
/**
* Mise a jour de l'objet ligne de commande en base
*

View File

@ -70,7 +70,8 @@ class ProductFournisseur extends Product
var $fourn_unitcharges; // old version used a buggy system to calculate margin of a charge field on supplier price. Now margin is on pmp, best supplier price or cost price.
var $fk_supplier_price_expression;
var $supplier_reputation; // reputation of supplier
var $reputations=array(); // list of available supplier reputations
/**
* Constructor
@ -79,7 +80,11 @@ class ProductFournisseur extends Product
*/
function __construct($db)
{
global $langs;
$this->db = $db;
$langs->load("suppliers");
$this->reputations= array('-1'=>'', 'FAVORITE'=>$langs->trans('Favorite'),'NOTTHGOOD'=>$langs->trans('NotTheGoodQualitySupplier'), 'DONOTORDER'=>$langs->trans('DoNotOrderThisProductToThisSupplier'));
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2016 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010-2015 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2011-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2012-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Ion Agorria <ion@agorria.com>
*
@ -50,6 +50,10 @@ if (!empty($conf->projet->enabled)) {
}
require_once NUSOAP_PATH.'/nusoap.php'; // Include SOAP
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('admin');
$langs->load('orders');
$langs->load('sendings');
@ -284,7 +288,7 @@ if (empty($reshook))
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
$date_start=dol_mktime(GETPOST('date_start'.$predef.'hour'), GETPOST('date_start'.$predef.'min'), GETPOST('date_start' . $predef . 'sec'), GETPOST('date_start'.$predef.'month'), GETPOST('date_start'.$predef.'day'), GETPOST('date_start'.$predef.'year'));
$date_end=dol_mktime(GETPOST('date_end'.$predef.'hour'), GETPOST('date_end'.$predef.'min'), GETPOST('date_end' . $predef . 'sec'), GETPOST('date_end'.$predef.'month'), GETPOST('date_end'.$predef.'day'), GETPOST('date_end'.$predef.'year'));
if (GETPOST('prod_entry_mode') == 'free')
if ($prod_entry_mode == 'free')
{
$idprod=0;
$price_ht = GETPOST('price_ht');
@ -313,22 +317,22 @@ if (empty($reshook))
}
}
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
if ($prod_entry_mode =='free' && GETPOST('price_ht') < 0 && $qty < 0)
{
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && ! GETPOST('idprodfournprice') && GETPOST('type') < 0)
if ($prod_entry_mode =='free' && ! GETPOST('idprodfournprice') && GETPOST('type') < 0)
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise === '') // Unit price can be 0 but not ''
if ($prod_entry_mode =='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise === '') // Unit price can be 0 but not ''
{
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && ! GETPOST('dp_desc'))
if ($prod_entry_mode =='free' && ! GETPOST('dp_desc'))
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
@ -339,10 +343,24 @@ if (empty($reshook))
$error++;
}
// Ecrase $pu par celui du produit
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination
$prodcomb = new ProductCombination($db);
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child;
} else {
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
$error ++;
}
}
}
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
if ((GETPOST('prod_entry_mode') != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
if (($prod_entry_mode != 'free') && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{
$productsupplier = new ProductFournisseur($db);
@ -441,7 +459,7 @@ if (empty($reshook))
$ht = $ttc / (1 + ($tva_tx / 100));
$price_base_type = 'HT';
}
$pu_ht_devise = price2num($price_ht_devise, 'MU');
$result=$object->addline($desc, $ht, $qty, $tva_tx, $localtax1_tx, $localtax2_tx, 0, 0, '', $remise_percent, $price_base_type, $ttc, $type,'','', $date_start, $date_end, $array_options, $fk_unit, $pu_ht_devise);
@ -543,7 +561,7 @@ if (empty($reshook))
$localtax1_tx=get_localtax($tva_tx,1,$mysoc,$object->thirdparty);
$localtax2_tx=get_localtax($tva_tx,2,$mysoc,$object->thirdparty);
$pu_ht_devise = GETPOST('multicurrency_subprice');
// Extrafields Lines
@ -1416,7 +1434,7 @@ if ($action=='create')
// If not defined, set default value from constant
if (empty($cond_reglement_id) && ! empty($conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_TERM_ID)) $cond_reglement_id=$conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_TERM_ID;
if (empty($mode_reglement_id) && ! empty($conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_MODE_ID)) $mode_reglement_id=$conf->global->SUPPLIER_ORDER_DEFAULT_PAYMENT_MODE_ID;
print '<form name="add" action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="add">';
@ -1615,7 +1633,7 @@ if ($action=='create')
elseif (! empty($object->id))
{
$result = $object->fetch($id, $ref);
$societe = new Fournisseur($db);
$result=$societe->fetch($object->socid);
if ($result < 0) dol_print_error($db);
@ -2637,7 +2655,7 @@ elseif (! empty($object->id))
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("MakeOrder").'</a></div>';
}
}
// Create bill
if (! empty($conf->facture->enabled))
{
@ -2703,11 +2721,11 @@ elseif (! empty($object->id))
$date_com = dol_mktime(0, 0, 0, GETPOST('remonth'), GETPOST('reday'), GETPOST('reyear'));
print $form->select_date($date_com,'',1,1,'',"commande",1,0,1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("OrderMode").'</td><td>';
$formorder->selectInputMethod(GETPOST('methodecommande'), "methodecommande", 1);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment" value="'.GETPOST('comment').'"></td></tr>';
print '<tr><td align="center" colspan="2">';
print '<input type="submit" name="makeorder" class="button" value="'.$langs->trans("ToOrder").'">';
@ -2718,12 +2736,10 @@ elseif (! empty($object->id))
print '</form>';
print "<br>";
}
if ($action != 'makeorder')
if ($action != 'makeorder')
{
print '<div class="fichecenter"><div class="fichehalfleft">';
/*
* Documents generes
*/
@ -2734,57 +2750,57 @@ elseif (! empty($object->id))
$urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id;
$genallowed=$user->rights->fournisseur->commande->creer;
$delallowed=$user->rights->fournisseur->commande->supprimer;
print $formfile->showdocuments('commande_fournisseur',$comfournref,$filedir,$urlsource,$genallowed,$delallowed,$object->modelpdf,1,0,0,0,0,'','','',$object->thirdparty->default_lang);
$somethingshown=$formfile->numoffiles;
// Show links to link elements
$linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_order','order_supplier'));
$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
{
// Set status to received (action=livraison)
print '<!-- form to record supplier order received -->'."\n";
print '<form action="card.php?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="livraison">';
print load_fiche_titre($langs->trans("Receive"),'','');
print '<table class="noborder" width="100%">';
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
print $form->select_date('','',1,1,'',"commande",1,0,1);
print "</td></tr>\n";
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
$liv = array();
$liv[''] = '&nbsp;';
$liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected");
$liv['par'] = $langs->trans("PartialWoman");
$liv['nev'] = $langs->trans("NeverReceived");
$liv['can'] = $langs->trans("Canceled");
print $form->selectarray("type",$liv);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment"></td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Receive").'"></td></tr>';
print "</table>\n";
print "</form>\n";
print "<br>";
}
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
print '</div></div></div>';
if ($user->rights->fournisseur->commande->receptionner && ($object->statut == 3 || $object->statut == 4))
{
// Set status to received (action=livraison)
print '<!-- form to record supplier order received -->'."\n";
print '<form action="card.php?id='.$object->id.'" method="post">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="livraison">';
print load_fiche_titre($langs->trans("Receive"),'','');
print '<table class="noborder" width="100%">';
//print '<tr class="liste_titre"><td colspan="2">'.$langs->trans("Receive").'</td></tr>';
print '<tr><td>'.$langs->trans("DeliveryDate").'</td><td>';
print $form->select_date('','',1,1,'',"commande",1,0,1);
print "</td></tr>\n";
print "<tr><td>".$langs->trans("Delivery")."</td><td>\n";
$liv = array();
$liv[''] = '&nbsp;';
$liv['tot'] = $langs->trans("CompleteOrNoMoreReceptionExpected");
$liv['par'] = $langs->trans("PartialWoman");
$liv['nev'] = $langs->trans("NeverReceived");
$liv['can'] = $langs->trans("Canceled");
print $form->selectarray("type",$liv);
print '</td></tr>';
print '<tr><td>'.$langs->trans("Comment").'</td><td><input size="40" type="text" name="comment"></td></tr>';
print '<tr><td align="center" colspan="2"><input type="submit" class="button" value="'.$langs->trans("Receive").'"></td></tr>';
print "</table>\n";
print "</form>\n";
print "<br>";
}
// List of actions on element
include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
$formactions=new FormActions($db);
$somethingshown=$formactions->showactions($object,'order_supplier',$socid,0,'listaction'.($genallowed?'largetitle':''));
print '</div></div></div>';}
}
print '</td></tr></table>';

View File

@ -7,7 +7,7 @@
* Copyright (C) 2010-2014 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013-2015 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2014-2016 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2016 Alexandre Spangaro <aspangaro@zendsi.com>
*
* This program is free software; you can redistribute it and/or modify
@ -46,6 +46,10 @@ if (!empty($conf->projet->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
}
if (!empty($conf->variants->enabled)) {
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php';
}
$langs->load('bills');
$langs->load('compta');
@ -321,7 +325,7 @@ if (empty($reshook))
if (empty($conf->global->INVOICE_MAX_OFFSET_IN_FUTURE)) setEventMessages($langs->trans("WarningInvoiceDateInFuture"), null, 'warnings');
else setEventMessages($langs->trans("WarningInvoiceDateTooFarInFuture"), null, 'warnings');
}
$object->fetch($id);
$object->date=$newdate;
@ -878,7 +882,8 @@ if (empty($reshook))
// Set if we used free entry or predefined product
$predef='';
$product_desc=(GETPOST('dp_desc')?GETPOST('dp_desc'):'');
if (GETPOST('prod_entry_mode') == 'free')
$prod_entry_mode = GETPOST('prod_entry_mode');
if ($prod_entry_mode == 'free')
{
$idprod=0;
$price_ht = GETPOST('price_ht');
@ -910,22 +915,22 @@ if (empty($reshook))
}
}
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht') < 0 && $qty < 0)
if ($prod_entry_mode =='free' && GETPOST('price_ht') < 0 && $qty < 0)
{
setEventMessages($langs->trans('ErrorBothFieldCantBeNegative', $langs->transnoentitiesnoconv('UnitPrice'), $langs->transnoentitiesnoconv('Qty')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && ! GETPOST('idprodfournprice') && GETPOST('type') < 0)
if ($prod_entry_mode =='free' && ! GETPOST('idprodfournprice') && GETPOST('type') < 0)
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise==='') // Unit price can be 0 but not ''
if ($prod_entry_mode =='free' && GETPOST('price_ht')==='' && GETPOST('price_ttc')==='' && $price_ht_devise==='') // Unit price can be 0 but not ''
{
setEventMessages($langs->trans($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('UnitPrice'))), null, 'errors');
$error++;
}
if (GETPOST('prod_entry_mode')=='free' && ! GETPOST('dp_desc'))
if ($prod_entry_mode =='free' && ! GETPOST('dp_desc'))
{
setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Description')), null, 'errors');
$error++;
@ -936,7 +941,21 @@ if (empty($reshook))
$error++;
}
if (GETPOST('prod_entry_mode') != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
if (!$error && !empty($conf->variants->enabled) && $prod_entry_mode != 'free') {
if ($combinations = GETPOST('combinations', 'array')) {
//Check if there is a product with the given combination
$prodcomb = new ProductCombination($db);
if ($res = $prodcomb->fetchByProductCombination2ValuePairs($idprod, $combinations)) {
$idprod = $res->fk_product_child;
} else {
setEventMessage($langs->trans('ErrorProductCombinationNotFound'), 'errors');
$error ++;
}
}
}
if ($prod_entry_mode != 'free' && empty($error)) // With combolist mode idprodfournprice is > 0 or -1. With autocomplete, idprodfournprice is > 0 or ''
{
$idprod=0;
$productsupplier=new ProductFournisseur($db);
@ -2297,9 +2316,9 @@ else
/*
* List of payments
*/
$totalpaye = 0;
$sign = 1;
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = - 1;
@ -2407,7 +2426,7 @@ else
dol_print_error($db);
}
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE)
if ($object->type != FactureFournisseur::TYPE_CREDIT_NOTE)
{
// Total already paid
print '<tr><td colspan="' . $nbcols . '" align="right">';
@ -2457,7 +2476,7 @@ else
dol_print_error($db);
}
*/
// Paye partiellement 'escompte'
if (($object->statut == FactureFournisseur::STATUS_CLOSED || $object->statut == FactureFournisseur::STATUS_ABANDONED) && $object->close_code == 'discount_vat') {
print '<tr><td colspan="' . $nbcols . '" align="right" class="nowrap">';

View File

@ -46,6 +46,7 @@ if (!$user->rights->fournisseur->facture->lire) accessforbidden();
$langs->load("bills");
$langs->load("companies");
$langs->load('products');
$langs->load('projects');
$socid = GETPOST('socid','int');

View File

@ -0,0 +1,171 @@
<?php
/* Copyright (C) 2017 ATM-Consulting <support@atm-consulting.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file htdocs/fourn/facture/rapport.php
* \ingroup fourn
* \brief Payment reports page
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/modules/rapport/pdf_paiement_fourn.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
// Security check
$socid='';
if (! empty($user->societe_id)) $socid=$user->societe_id;
$result = restrictedArea($user, 'fournisseur', $id, 'facture_fourn', 'facture');
$action=GETPOST('action');
$socid=0;
if ($user->societe_id > 0)
{
$action = '';
$socid = $user->societe_id;
}
$dir = $conf->fournisseur->facture->dir_output.'/payments';
if (! $user->rights->societe->client->voir || $socid) $dir.='/private/'.$user->id; // If user has no permission to see all, output dir is specific to user
$year = $_GET["year"];
if (! $year) { $year=date("Y"); }
/*
* Actions
*/
if ($action == 'builddoc')
{
$rap = new pdf_paiement_fourn($db);
$outputlangs = $langs;
if (GETPOST('lang_id'))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang(GETPOST('lang_id'));
}
// We save charset_output to restore it because write_file can change it if needed for
// output format that does not support UTF8.
$sav_charset_output=$outputlangs->charset_output;
if ($rap->write_file($dir, $_POST["remonth"], $_POST["reyear"], $outputlangs) > 0)
{
$outputlangs->charset_output=$sav_charset_output;
}
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_print_error($db,$obj->error);
}
$year = $_POST["reyear"];
}
/*
* View
*/
$formother=new FormOther($db);
llxHeader();
$titre=($year?$langs->trans("PaymentsReportsForYear",$year):$langs->trans("PaymentsReports"));
print load_fiche_titre($titre,'','title_accountancy.png');
// Formulaire de generation
print '<form method="post" action="rapport.php?year='.$year.'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
print '<input type="hidden" name="action" value="builddoc">';
$cmonth = GETPOST("remonth")?GETPOST("remonth"):date("n", time());
$syear = GETPOST("reyear")?GETPOST("reyear"):date("Y", time());
print $formother->select_month($cmonth,'remonth');
print $formother->select_year($syear,'reyear');
print '<input type="submit" class="button" value="'.$langs->trans("Create").'">';
print '</form>';
print '<br>';
clearstatcache();
// Show link on other years
$linkforyear=array();
$found=0;
if (is_dir($dir))
{
$handle=opendir($dir);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_dir($dir.'/'.$file) && ! preg_match('/^\./',$file) && is_numeric($file))
{
$found=1;
$linkforyear[]=$file;
}
}
}
}
asort($linkforyear);
foreach($linkforyear as $cursoryear)
{
print '<a href="'.$_SERVER["PHP_SELF"].'?year='.$cursoryear.'">'.$cursoryear.'</a> &nbsp;';
}
if ($year)
{
if (is_dir($dir.'/'.$year))
{
$handle=opendir($dir.'/'.$year);
if ($found) print '<br>';
print '<br>';
print '<table width="100%" class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Reporting").'</td>';
print '<td align="right">'.$langs->trans("Size").'</td>';
print '<td align="right">'.$langs->trans("Date").'</td>';
print '</tr>';
$var=true;
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (preg_match('/^supplier_payment/i',$file))
{
$var=!$var;
$tfile = $dir . '/'.$year.'/'.$file;
$relativepath = $year.'/'.$file;
print "<tr ".$bc[$var].">".'<td><a data-ajax="false" href="'.DOL_URL_ROOT . '/document.php?modulepart=facture_fournisseur&amp;file=payments/'.urlencode($relativepath).'">'.img_pdf().' '.$file.'</a></td>';
print '<td align="right">'.dol_print_size(dol_filesize($tfile)).'</td>';
print '<td align="right">'.dol_print_date(dol_filemtime($tfile),"dayhour").'</td></tr>';
}
}
closedir($handle);
}
print '</table>';
}
}
llxFooter();
$db->close();

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2010-2011 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Marcos García <marcosgdf@gmail.com>
* Copyright (C) 2015 Charlie Benke <charlie@patas-monkey.com>
* 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
@ -15,7 +16,6 @@
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
?>
@ -48,7 +48,7 @@ foreach($linkedObjectBlock as $key => $objectlink)
<td align="right"><?php
if ($user->rights->fournisseur->facture->lire) {
$sign = 1;
if ($object->type == Facture::TYPE_CREDIT_NOTE) $sign = -1;
if ($object->type == FactureFournisseur::TYPE_CREDIT_NOTE) $sign = -1;
if ($objectlink->statut != 3) // If not abandonned
{
$total = $total + $sign * $objectlink->total_ht;

View File

@ -2,7 +2,7 @@
<html>
<head>
<title>Api Explorer</title>
<!-- <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<!-- DOL_LDR_CHANGE <link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">-->
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
@ -53,12 +53,15 @@
$('#input_apiKey').change(function() {
var key = $('#input_apiKey')[0].value;
log("key: " + key);
if(key && key.trim() != "") {
/* DOL_LDR_CHANGE */
log("added key " + key);
/* Disabled for security reason. We keep only param in header
window.authorizations.add("key", new ApiKeyAuthorization("DOLAPIKEY", key, "query"));
console.log("param api_key added with value "+key);
*/
window.authorizations.add("key2", new ApiKeyAuthorization("DOLAPIKEY", key, "header"));
console.log("header DOLAPIKEY added with value "+key);

View File

@ -544,14 +544,11 @@ foreach($valid_dashboardlines as $board)
$boxwork.= '<tr '.$bc[$var].'><td width="16">'.$board->img.'</td><td>'.$board->label.'</td>';
$boxwork.= '<td align="right"><a class="dashboardlineindicator" href="'.$board->url.'"><span class="dashboardlineindicator">'.$board->nbtodo.'</span></a></td>';
$boxwork.= '<td align="right">';
//if ($board->nbtodolate > 0)
//{
$textlate = $langs->trans("NActionsLate",$board->nbtodolate);
$textlate .= ' ('.$langs->trans("Late").' = '.$langs->trans("DateReference").' > '.$langs->trans("DateToday").' '.(ceil($board->warning_delay) >= 0 ? '+' : '').ceil($board->warning_delay).' '.$langs->trans("days").')';
$boxwork.= '<a title="'.dol_escape_htmltag($textlate).'" class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'" href="'.$board->url.'"><span class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'">';
$boxwork.= '<a title="'.dol_escape_htmltag($textlate).'" class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'" href="'.((!$board->url_late) ? $board->url : $board->url_late ).'"><span class="dashboardlineindicatorlate'.($board->nbtodolate>0?' dashboardlineko':' dashboardlineok').'">';
$boxwork.= $board->nbtodolate;
$boxwork.= '</span></a>';
//}
$boxwork.='</td>';
$boxwork.='<td align="left">';
if ($board->nbtodolate > 0) $boxwork.=img_picto($textlate,"warning");

View File

@ -35,3 +35,9 @@ insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (6,'PT_ORDER', 6,1, 'A réception de commande','A réception de commande',0,1);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (7,'PT_DELIVERY', 7,1, 'Livraison','Règlement à la livraison',0,1);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (8,'PT_5050', 8,1, '50 et 50','Règlement 50% à la commande, 50% à la livraison',0,1);
-- add additional payment terms often needed in Austria
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (9,'10D', 9,1, '10 jours','Réglement à 10 jours',0,10);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (10,'10DENDMONTH', 10,1, '10 jours fin de mois','Réglement à 10 jours fin de mois',1,10);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (11,'14D', 11,1, '14 jours','Réglement à 14 jours',0,14);
insert into llx_c_payment_term(rowid, code, sortorder, active, libelle, libelle_facture, type_cdr, nbjour) values (12,'14DENDMONTH', 12,1, '14 jours fin de mois','Réglement à 14 jours fin de mois',1,14);

View File

@ -65,7 +65,7 @@ ALTER TABLE llx_product_lot ADD UNIQUE INDEX uk_product_lot(fk_product, batch);
ALTER TABLE llx_product_lot MODIFY COLUMN entity integer DEFAULT 1;
UPDATE llx_product_lot SET entity = 1 WHERE entity IS NULL;
DROP TABLE llx_stock_serial;
DROP TABLE llx_stock_serial;
ALTER TABLE llx_product ADD COLUMN note_public text;
ALTER TABLE llx_user ADD COLUMN note_public text;

View File

@ -184,6 +184,7 @@ ALTER TABLE llx_resource_extrafields ADD INDEX idx_resource_extrafields (fk_obje
INSERT INTO llx_const (name, value, type, note, visible) values (__ENCRYPT('MAIN_SIZE_SHORTLIST_LIMIT')__,__ENCRYPT('3')__,'chaine','Max length for small lists (tabs)',0);
INSERT INTO llx_const (name, value, type, note, visible, entity) values (__ENCRYPT('EXPEDITION_ADDON_NUMBER')__, __ENCRYPT('mod_expedition_safor')__, 'chaine','Name for numbering manager for shipments',0,1);
ALTER TABLE llx_bank_account ADD COLUMN note_public text;
ALTER TABLE llx_bank_account ADD COLUMN model_pdf varchar(255);
@ -249,3 +250,40 @@ ALTER TABLE llx_projet_task ADD UNIQUE INDEX uk_projet_task_ref (ref, entity);
ALTER TABLE llx_contrat ADD COLUMN fk_user_modif integer;
-- Product attributes
CREATE TABLE llx_product_attribute
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
ref VARCHAR(255) NOT NULL,
label VARCHAR(255) NOT NULL,
rang INT DEFAULT 0 NOT NULL,
entity INT DEFAULT 1 NOT NULL
);
ALTER TABLE llx_product_attribute ADD CONSTRAINT unique_ref UNIQUE (ref);
CREATE TABLE llx_product_attribute_combination
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_product_parent INT NOT NULL,
fk_product_child INT NOT NULL,
variation_price FLOAT NOT NULL,
variation_price_percentage INT NULL,
variation_weight FLOAT NOT NULL,
entity INT DEFAULT 1 NOT NULL
);
CREATE TABLE llx_product_attribute_combination2val
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_prod_combination INT NOT NULL,
fk_prod_attr INT NOT NULL,
fk_prod_attr_val INT NOT NULL
);
CREATE TABLE llx_product_attribute_value
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_product_attribute INT NOT NULL,
ref VARCHAR(255) DEFAULT NULL,
value VARCHAR(255) DEFAULT NULL,
entity INT DEFAULT 1 NOT NULL
);
ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref);

View File

@ -54,6 +54,47 @@ ALTER TABLE llx_projet_task_time ADD COLUMN tms timestamp;
ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_creat integer;
ALTER TABLE llx_product_price_by_qty ADD COLUMN fk_user_modif integer;
ALTER TABLE llx_product_price_by_qty DROP COLUMN date_price;
ALTER TABLE llx_product_price_by_qty ADD COLUMN tms timestamp;
ALTER TABLE llx_product_price_by_qty ADD COLUMN import_key integer;
CREATE TABLE llx_product_attribute
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
ref VARCHAR(255) NOT NULL,
label VARCHAR(255) NOT NULL,
rang INT DEFAULT 0 NOT NULL,
entity INT DEFAULT 1 NOT NULL
);
ALTER TABLE llx_product_attribute ADD CONSTRAINT unique_ref UNIQUE (ref);
CREATE TABLE llx_product_attribute_value
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_product_attribute INT NOT NULL,
ref VARCHAR(255) DEFAULT NULL,
value VARCHAR(255) DEFAULT NULL,
entity INT DEFAULT 1 NOT NULL
);
ALTER TABLE llx_product_attribute_value ADD CONSTRAINT unique_ref UNIQUE (fk_product_attribute,ref);
CREATE TABLE llx_product_attribute_combination2val
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_prod_combination INT NOT NULL,
fk_prod_attr INT NOT NULL,
fk_prod_attr_val INT NOT NULL
);
CREATE TABLE llx_product_attribute_combination
(
rowid INT PRIMARY KEY NOT NULL AUTO_INCREMENT,
fk_product_parent INT NOT NULL,
fk_product_child INT NOT NULL,
variation_price FLOAT NOT NULL,
variation_price_percentage INT NULL,
variation_weight FLOAT NOT NULL,
entity INT DEFAULT 1 NOT NULL
);

Some files were not shown because too many files have changed in this diff Show More