diff --git a/.gitignore b/.gitignore index 1ece034ae94..aa332681474 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ dolibarr_install.log upgrade.log doxygen_warnings.log /.project +/.vscode .DS_Store .idea *.iml diff --git a/COPYRIGHT b/COPYRIGHT index bd3565c3bd1..83f72bb558b 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -53,6 +53,10 @@ JsTimezoneDetect 1.0.6 MIT License Yes SwaggerUI 2.0.24 GPL-2+ Yes JS library to offer the REST API explorer Ace 1.2.8 BSD Yes JS library to get code syntaxique coloration in a textarea. +Image libraries +Octicons 8.1 MIT Yes + + For licenses compatibility informations: http://www.gnu.org/licenses/licenses.en.html diff --git a/ChangeLog b/ChangeLog index 891b27ba78f..e516382f62f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,8 +8,12 @@ For Users: NEW: Stable module: Website NEW: Stable module: WebDAV NEW: Stable module: Module Builder +NEW: Stable module "Skype" has been replaced with module "Social Networks" to support more tools. +NEW: Experimental module "TakePos" NEW: Dolibarr can provide information in page title when multicompany is enabled of not, making Android application like DoliDroid able to provide native features for multicompany module. +NEW: Compatibility with PHP 7.3 + For developers: * Code changes to be more compatible with PSR2 @@ -24,6 +28,40 @@ Following changes may create regressions for some external modules, but were nec +***** ChangeLog for 8.0.2 compared to 8.0.1 ***** +FIX: #8452 +FIX: #9043 +FIX: #9316 Error when listing invoices +FIX: #9317 +FIX: #9353 Bug: html error - div inside span on graphs +FIX: #9355 +FIX: #9393 inconsistency behaviour. option FACTURE_ENABLE_NEGATIVE_LINES +FIX: #9394 +FIX: #9396 +FIX: #9403 +FIX: #9412 +FIX: #9497 +FIX: Add paypal error message in alert email when online payment fails. +FIX: better compatibility with multicompany +FIX: capital must be empty and not 0 if undefined +FIX: character making error on bill list +FIX: Entering negative price on order. +FIX: Expedition not showing extrafields on creation. +FIX: Homepage links were using wrong topmenus +FIX: inconsistency behaviour on option FACTURE_ENABLE_NEGATIVE_LINES +FIX: invert mime type and name. +FIX: invoice popup hide localtax2 and 3 if not defined. +FIX: Lose filter on payment type or category after a sort on invoice list. +FIX: Maxi debug to allow to load chart of account with multicompany. +FIX: Missing translation in predefined email to membership renewal. +FIX: Mixing tickets of different thirdparties. +FIX: "Other ..." link so the "Back to" link works. +FIX: PDF address: handle when contact thirdparty is different from thirdparty of document +FIX: Problems with permissions of module to record payment of salaries +FIX: remove debug +FIX: Several fixes on the management of minimal amount for orders +FIX: wrong var name + ***** ChangeLog for 8.0.1 compared to 8.0.0 ***** FIX: #9258 FIX: #9328 diff --git a/build/exe/doliwamp/Languages/MyEnglish.isl b/build/exe/doliwamp/Languages/MyEnglish.isl index 11d2e4456bd..b7c5ecb6230 100644 --- a/build/exe/doliwamp/Languages/MyEnglish.isl +++ b/build/exe/doliwamp/Languages/MyEnglish.isl @@ -13,8 +13,8 @@ AssocingFileExtension=Associating %1 with the %2 file extension... YouWillInstallDoliWamp=You will install or upgrade DoliWamp (Apache+Mysql+PHP+Dolibarr) on your computer. ThisAssistantInstallOrUpgrade=This assistant installs or upgrades Dolibarr ERP-CRM and all required third party softwares (Apache, Mysql and PHP) optimized for a Dolibarr usage. -IfYouHaveTechnicalKnowledge=If you have technical knowledge and plan to share your Apache, Mysql and PHP with other projects than Dolibarr, you should not use this assistant and make a manual installation of Dolibarr on your existing Apache, Mysql and PHP installation. -ButIfYouLook=But if you look for an automatic setup, you''re on the good way... +IfYouHaveTechnicalKnowledge=If you are looking for a hosted version in the Cloud, you should look at https://saas.dolibarr.org. If you have technical knowledge and want to manage your Apache, Mysql and PHP yourself, you should not use this assistant and make a manual installation of Dolibarr on your existing Apache, Mysql and PHP installation. +ButIfYouLook=But if you look for an automatic setup on your local computer, you''re on the good way... DoYouWantToStart=Do you want to start installation/upgrade process ? TechnicalParameters=Technical parameters diff --git a/build/exe/doliwamp/Languages/MyFrench.isl b/build/exe/doliwamp/Languages/MyFrench.isl index 1daf4425e68..8c7cff0bb42 100644 --- a/build/exe/doliwamp/Languages/MyFrench.isl +++ b/build/exe/doliwamp/Languages/MyFrench.isl @@ -13,8 +13,8 @@ AssocingFileExtension=Associe %1 avec l'extension de fichier %2... YouWillInstallDoliWamp=Vous allez installer ou mettre à jour DoliWamp (Apache+Mysql+PHP+Dolibarr) sur votre ordinateur. ThisAssistantInstallOrUpgrade=Cet assistant installe ou met à jour Dolibarr ERP-CRM et tous ses composants prérequis (Apache, Mysql et PHP) optimisés pour une utilisation de Dolibarr. -IfYouHaveTechnicalKnowledge=Si vous avez des compétences techniques et envisagez de partager votre Apache, Mysql et PHP avec d'autres applications que Dolibarr, vous ne devriez pas utiliser cet assistant mais faire plutôt une installation manuelle de Dolibarr sur un socle Apache, Mysql et PHP existant. -ButIfYouLook=Mais si vous recherchez une installation clé en main automatisée, vous êtes sur la bonne voie... +IfYouHaveTechnicalKnowledge=Si vous cherchez un hébergement dans le Cloud, aller voir sur https://saas.dolibarr.org. Si vous avez des compétences techniques et voulez gérer vous même Apache, Mysql et PHP, vous ne devriez pas utiliser cet assistant mais faire plutôt une installation manuelle de Dolibarr sur votre socle Apache, Mysql et PHP existant. +ButIfYouLook=Mais si vous recherchez une installation automatisée locale sur votre ordinateur, clé en main, vous êtes sur la bonne voie... DoYouWantToStart=Voulez-vous démarrer le processus d'installation/mise à jour ? TechnicalParameters=Paramètres techniques diff --git a/build/exe/doliwamp/doliwamp.iss b/build/exe/doliwamp/doliwamp.iss index 2d4668b447c..cc6a39a62a4 100644 --- a/build/exe/doliwamp/doliwamp.iss +++ b/build/exe/doliwamp/doliwamp.iss @@ -32,7 +32,7 @@ AppPublisherURL=https://www.nltechno.com AppSupportURL=https://www.dolibarr.org AppUpdatesURL=https://www.dolibarr.org AppComments=DoliWamp includes Dolibarr, Apache, PHP and Mysql softwares. -AppCopyright=Copyright (C) 2008-2017 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre) +AppCopyright=Copyright (C) 2008-2018 Laurent Destailleur (NLTechno), Fabian Rodriguez (Le Goût du Libre) DefaultDirName=c:\dolibarr DefaultGroupName=Dolibarr ;LicenseFile=COPYING diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 5a1e7b3afc3..2bdf200225b 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -44,8 +44,7 @@ include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; include_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; include_once DOL_DOCUMENT_ROOT.'/contrat/class/contrat.class.php'; -$langs->load("main"); -$langs->load("errors"); +$langs->loadLangs(array("main", "errors")); // Global variables $version=DOL_VERSION; diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 2eedcda8760..0e3b2c7513f 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -295,6 +295,7 @@ if ((! empty($_REQUEST['unused']) && $_REQUEST['unused'] == 'true') || (isset($a if (preg_match('/^DescADHERENT_/', $value)) $qualifiedforclean=0; if (preg_match('/^SubmitTranslation/', $value)) $qualifiedforclean=0; if (preg_match('/^ModuleCompanyCode/', $value)) $qualifiedforclean=0; + if (preg_match('/InDolibarr$/', $value)) $qualifiedforclean=0; // admin.lang if (preg_match('/^DAV_ALLOW_PUBLIC_DIR/i', $value)) $qualifiedforclean=0; if (preg_match('/^DAV_ALLOW_ECM_DIR/i', $value)) $qualifiedforclean=0; diff --git a/htdocs/accountancy/admin/account.php b/htdocs/accountancy/admin/account.php index ca47dbc7b96..087f9957f16 100644 --- a/htdocs/accountancy/admin/account.php +++ b/htdocs/accountancy/admin/account.php @@ -63,9 +63,9 @@ if (! $sortorder) $sortorder = "ASC"; $arrayfields=array( 'aa.account_number'=>array('label'=>$langs->trans("AccountNumber"), 'checked'=>1), 'aa.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>0), + 'aa.account_parent'=>array('label'=>$langs->trans("Accountparent"), 'checked'=>1), 'aa.pcg_type'=>array('label'=>$langs->trans("Pcgtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), - 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>1, 'help'=>'PcgtypeDesc'), + 'aa.pcg_subtype'=>array('label'=>$langs->trans("Pcgsubtype"), 'checked'=>0, 'help'=>'PcgtypeDesc'), 'aa.active'=>array('label'=>$langs->trans("Activated"), 'checked'=>1) ); @@ -122,16 +122,34 @@ if (empty($reshook)) { $sqlfile = DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_accounting_account_'.strtolower($country_code).'.sql'; - // FIXME Get the ADD rowid and pass it + num of comapny * 100 000 000 to run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. + $offsetforchartofaccount = 0; + // Get the comment line '-- ADD CCCNNNNN to rowid...' to find CCCNNNNN (CCC is country num, NNNNN is id of accounting account) + // and pass CCCNNNNN + (num of company * 100 000 000) as offset to the run_sql as a new parameter to say to update sql on the fly to add offset to rowid and account_parent value. + // This is to be sure there is no conflict for each chart of account, whatever is country, whatever is company when multicompany is used. + $tmp = file_get_contents($sqlfile); + if (preg_match('/-- ADD (\d+) to rowid/ims', $tmp, $reg)) + { + $offsetforchartofaccount += $reg[1]; + } + $offsetforchartofaccount+=($conf->entity * 100000000); - $result = run_sql($sqlfile, 1, 0, 1); + $result = run_sql($sqlfile, 1, $conf->entity, 1, '', 'default', 32768, 0, $offsetforchartofaccount); + + if ($result > 0) + { + setEventMessages($langs->trans("ChartLoaded"), null); + } + else + { + setEventMessages($langs->trans("ErrorDuringChartLoad"), null, 'warnings'); + } } if (! dolibarr_set_const($db, 'CHARTOFACCOUNTS', $chartofaccounts, 'chaine', 0, '', $conf->entity)) { $error++; } } else { - $error ++; + $error++; } } diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 2c7d92f3735..e3ed164d60b 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -524,62 +524,18 @@ if ($id) $valuetoshow=ucfirst($fieldlist[$field]); // Par defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate $align="left"; - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='taux') { - if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); - else $valuetoshow=$langs->trans("Amount"); - $align='right'; - } - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2";} - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3";} - if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } - if ($fieldlist[$field]=='lang') { $valuetoshow=$langs->trans("Language"); } - if ($fieldlist[$field]=='type') { - if ($tabname[$id] == MAIN_DB_PREFIX."c_paiement") $valuetoshow=$form->textwithtooltip($langs->trans("Type"),$langs->trans("TypePaymentDesc"),2,1,img_help(1,'')); - else $valuetoshow=$langs->trans("Type"); - } if ($fieldlist[$field]=='code') { $valuetoshow=$langs->trans("Code"); } if ($fieldlist[$field]=='libelle' || $fieldlist[$field]=='label') { $valuetoshow=$langs->trans("Label"); if ($id != 25) $valuetoshow.="*"; } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='country') { if (in_array('region_id',$fieldlist)) { print ' '; continue; } // For region page, we do not show the country input $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } - if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } - if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $valuetoshow=''; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); } + if ($fieldlist[$field]=='country_id') { $valuetoshow=''; } if ($fieldlist[$field]=='pcg_version' || $fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountparent"); } - if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } - 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"); } - if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } - - if ($id == 2) // Special cas for state page - { - if ($fieldlist[$field]=='region_id') { $valuetoshow=' '; $showfield=1; } - if ($fieldlist[$field]=='region') { $valuetoshow=$langs->trans("Country").'/'.$langs->trans("Region"); $showfield=1; } - } if ($valuetoshow != '') { @@ -709,50 +665,15 @@ if ($id) */ $valuetoshow=ucfirst($fieldlist[$field]); // By defaut $valuetoshow=$langs->trans($valuetoshow); // try to translate - if ($fieldlist[$field]=='source') { $valuetoshow=$langs->trans("Contact"); } - if ($fieldlist[$field]=='price') { $valuetoshow=$langs->trans("PriceUHT"); } - if ($fieldlist[$field]=='taux') { - if ($tabname[$id] != MAIN_DB_PREFIX."c_revenuestamp") $valuetoshow=$langs->trans("Rate"); - else $valuetoshow=$langs->trans("Amount"); - $align='right'; - } - if ($fieldlist[$field]=='localtax1_type') { $valuetoshow=$langs->trans("UseLocalTax")." 2"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax1') { $valuetoshow=$langs->trans("Rate")." 2"; $sortable=0; } - if ($fieldlist[$field]=='localtax2_type') { $valuetoshow=$langs->trans("UseLocalTax")." 3"; $align="center"; $sortable=0; } - if ($fieldlist[$field]=='localtax2') { $valuetoshow=$langs->trans("Rate")." 3"; $sortable=0; } - if ($fieldlist[$field]=='organization') { $valuetoshow=$langs->trans("Organization"); } - 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 ($id != 25) $valuetoshow.="*"; } - if ($fieldlist[$field]=='libelle_facture') { $valuetoshow=$langs->trans("LabelOnDocuments")."*"; } if ($fieldlist[$field]=='country') { $valuetoshow=$langs->trans("Country"); } - if ($fieldlist[$field]=='recuperableonly') { $valuetoshow=$langs->trans("NPR"); $align="center"; } - if ($fieldlist[$field]=='nbjour') { $valuetoshow=$langs->trans("NbOfDays"); } - if ($fieldlist[$field]=='type_cdr') { $valuetoshow=$langs->trans("AtEndOfMonth"); $align="center"; } - if ($fieldlist[$field]=='decalage') { $valuetoshow=$langs->trans("Offset"); } - if ($fieldlist[$field]=='width') { $valuetoshow=$langs->trans("Width"); } - if ($fieldlist[$field]=='height') { $valuetoshow=$langs->trans("Height"); } - if ($fieldlist[$field]=='unit') { $valuetoshow=$langs->trans("MeasuringUnit"); } - if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { $showfield=0; } - if ($fieldlist[$field]=='accountancy_code'){ $valuetoshow=$langs->trans("AccountancyCode"); } - if ($fieldlist[$field]=='accountancy_code_sell'){ $valuetoshow=$langs->trans("AccountancyCodeSell"); $sortable=0; } - if ($fieldlist[$field]=='accountancy_code_buy'){ $valuetoshow=$langs->trans("AccountancyCodeBuy"); $sortable=0; } + if ($fieldlist[$field]=='country_id') { $showfield=0; } if ($fieldlist[$field]=='fk_pcg_version') { $valuetoshow=$langs->trans("Pcg_version"); } - if ($fieldlist[$field]=='account_parent') { $valuetoshow=$langs->trans("Accountsparent"); } - if ($fieldlist[$field]=='pcg_type') { $valuetoshow=$langs->trans("Pcg_type"); } - 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"); } - if ($fieldlist[$field]=='formula') { $valuetoshow=$langs->trans("Formula"); } // Affiche nom du champ if ($showfield) @@ -832,120 +753,9 @@ if ($id) $valuetoshow=($key != "Country".strtoupper($obj->country_code)?$obj->country_code." - ".$key:$obj->country); } } - else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { - if(empty($valuetoshow)) $valuetoshow = $langs->trans('None'); - elseif($valuetoshow == 1) $valuetoshow = $langs->trans('AtEndOfMonth'); - elseif($valuetoshow == 2) $valuetoshow = $langs->trans('CurrentNext'); - $align="center"; - } - else if ($fieldlist[$field]=='price' || preg_match('/^amount/i',$fieldlist[$field])) { - $valuetoshow=price($valuetoshow); - } - else if ($fieldlist[$field]=='libelle_facture') { - $langs->loadLangs(array("bills")); - $key=$langs->trans("PaymentCondition".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentCondition".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - $valuetoshow=nl2br($valuetoshow); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_country') { - $key=$langs->trans("Country".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Country".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_availability') { - $langs->loadLangs(array("propal")); - $key=$langs->trans("AvailabilityType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "AvailabilityType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_actioncomm') { - $key=$langs->trans("Action".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Action".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if (! empty($obj->code_iso) && $fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_currencies') { - $key=$langs->trans("Currency".strtoupper($obj->code_iso)); - $valuetoshow=($obj->code_iso && $key != "Currency".strtoupper($obj->code_iso)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_typent') { - $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_prospectlevel') { - $key=$langs->trans(strtoupper($obj->code)); - $valuetoshow=($key != strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_civility') { - $key=$langs->trans("Civility".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "Civility".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_type_contact') { - $langs->loadLangs(array("agenda")); - $key=$langs->trans("TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "TypeContact_".$obj->element."_".$obj->source."_".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_payment_term') { - $langs->loadLangs(array("bills")); - $key=$langs->trans("PaymentConditionShort".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentConditionShort".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paiement') { - $langs->loadLangs(array("bills")); - $key=$langs->trans("PaymentType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "PaymentType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='label' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_reason') { - $key=$langs->trans("DemandReasonType".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "DemandReasonType".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_input_method') { - $langs->loadLangs(array("orders")); - $key=$langs->trans($obj->code); - $valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->{$fieldlist[$field]}; - } - else if ($fieldlist[$field]=='libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_shipment_mode') { - $langs->loadLangs(array("sendings")); - $key=$langs->trans("SendingMethod".strtoupper($obj->code)); - $valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code)?$key:$obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field] == 'libelle' && $tabname[$id]==MAIN_DB_PREFIX.'c_paper_format') - { - $key = $langs->trans('PaperFormat'.strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != 'PaperFormat'.strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field] == 'label' && $tabname[$id] == MAIN_DB_PREFIX.'c_type_fees') - { - $langs->loadLangs(array("trips")); - $key = $langs->trans(strtoupper($obj->code)); - $valuetoshow = ($obj->code && $key != strtoupper($obj->code) ? $key : $obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='country_id') { + else if ($fieldlist[$field]=='country_id') { $showfield=0; } - else if ($fieldlist[$field]=='unicode') { - $valuetoshow = $langs->getCurrencySymbol($obj->code,1); - } - else if ($fieldlist[$field]=='label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->loadLangs(array("products")); - $valuetoshow=$langs->trans($obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='short_label' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_units') { - $langs->loadLangs(array("products")); - $valuetoshow = $langs->trans($obj->{$fieldlist[$field]}); - } - else if (($fieldlist[$field] == 'unit') && ($tabname[$id] == MAIN_DB_PREFIX.'c_paper_format')) - { - $key = $langs->trans('SizeUnit'.strtolower($obj->unit)); - $valuetoshow = ($obj->code && $key != 'SizeUnit'.strtolower($obj->unit) ? $key : $obj->{$fieldlist[$field]}); - } - else if ($fieldlist[$field]=='taux') { - $valuetoshow = price($valuetoshow, 0, $langs, 0, 0); - $align="right"; - } - else if (in_array($fieldlist[$field],array('recuperableonly'))) - { - $align="center"; - } - else if ($fieldlist[$field]=='accountancy_code' || $fieldlist[$field]=='accountancy_code_sell' || $fieldlist[$field]=='accountancy_code_buy') { - $valuetoshow = length_accountg($valuetoshow); - } $class='tddict'; if ($fieldlist[$field] == 'tracking') $class.=' tdoverflowauto'; @@ -956,17 +766,6 @@ if ($id) // Can an entry be erased or disabled ? $iserasable=1;$canbedisabled=1;$canbemodified=1; // true by default - if (isset($obj->code) && $id != 10) - { - if (($obj->code == '0' || $obj->code == '' || preg_match('/unknown/i',$obj->code))) { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'RECEP') { $iserasable = 0; $canbedisabled = 0; } - else if ($obj->code == 'EF0') { $iserasable = 0; $canbedisabled = 0; } - } - - if (isset($obj->type) && in_array($obj->type, array('system', 'systemauto'))) { $iserasable=0; } - if (in_array($obj->code, array('AC_OTH','AC_OTH_AUTO')) || in_array($obj->type, array('systemauto'))) { $canbedisabled=0; $canbedisabled = 0; } - $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):''); if ($param) $url .= '&'.$param; @@ -1055,53 +854,7 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') print ''; } } - elseif ($fieldlist[$field] == 'region') - { - print ''; - $formcompany->select_region($region_id,'region'); - print ''; - } - elseif ($fieldlist[$field] == 'region_id') - { - $region_id = (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:0); - print ''; - print ''; - print ''; - } - elseif ($fieldlist[$field] == 'lang') - { - print ''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT,'lang'); - print ''; - } - // Le type de template - elseif ($fieldlist[$field] == 'type_template') - { - print ''; - print $form->selectarray('type_template', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - // Le type de l'element (pour les type de contact) - elseif ($fieldlist[$field] == 'element') - { - print ''; - print $form->selectarray('element', $elementList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - // La source de l'element (pour les type de contact) - elseif ($fieldlist[$field] == 'source') - { - print ''; - print $form->selectarray('source', $sourceList,(! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:'')); - print ''; - } - elseif ($fieldlist[$field] == 'type' && $tabname == MAIN_DB_PREFIX."c_actioncomm") - { - print ''; - print 'user'; - print ''; - } - elseif ($fieldlist[$field] == 'recuperableonly' || $fieldlist[$field] == 'type_cdr' || $fieldlist[$field] == 'deductible' || $fieldlist[$field] == 'category_type') { + elseif ($fieldlist[$field] == 'type_cdr') { if ($fieldlist[$field] == 'type_cdr') print ''; else print ''; if ($fieldlist[$field] == 'type_cdr') { @@ -1111,49 +864,9 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') } print ''; } - elseif (in_array($fieldlist[$field],array('nbjour','decalage','taux','localtax1','localtax2'))) { - $align="left"; - if (in_array($fieldlist[$field],array('taux','localtax1','localtax2'))) $align="right"; // Fields aligned on right - print ''; - print ''; - print ''; - } - elseif (in_array($fieldlist[$field], array('libelle_facture'))) { - print ''; - } - elseif (in_array($fieldlist[$field], array('content'))) - { - print ''; - if ($context != 'hide') - { - //print ''; - $okforextended=true; - $doleditor = new DolEditor($fieldlist[$field], (! empty($obj->{$fieldlist[$field]})?$obj->{$fieldlist[$field]}:''), '', 140, 'dolibarr_mailings', 'In', 0, false, $okforextended, ROWS_5, '90%'); - print $doleditor->Create(1); - } - else print ' '; - print ''; - } - elseif ($fieldlist[$field] == 'price' || preg_match('/^amount/i',$fieldlist[$field])) { - print ''; - } elseif ($fieldlist[$field] == 'code' && isset($obj->{$fieldlist[$field]})) { print ''; } - elseif ($fieldlist[$field] == 'accountancy_code' || $fieldlist[$field] == 'accountancy_code_sell' || $fieldlist[$field] == 'accountancy_code_buy') - { - print ''; - if (! empty($conf->accounting->enabled)) - { - $accountancy_account = (! empty($obj->$fieldlist[$field]) ? $obj->$fieldlist[$field] : 0); - print $formaccounting->select_account($accountancy_account, $fieldlist[$field], 1, '', 1, 1, 'maxwidth200 maxwidthonsmartphone'); - } - else - { - print ''; - } - print ''; - } else { print ''; @@ -1161,7 +874,6 @@ function fieldListAccountModel($fieldlist, $obj='', $tabname='', $context='') if ($fieldlist[$field]=='code') $size='size="8" '; if ($fieldlist[$field]=='position') $size='size="4" '; if ($fieldlist[$field]=='libelle') $size='centpercent'; - if ($fieldlist[$field]=='tracking') $class='centpercent'; if ($fieldlist[$field]=='sortorder' || $fieldlist[$field]=='sens' || $fieldlist[$field]=='category_type') $size='size="2" '; print ''; print ''; diff --git a/htdocs/accountancy/class/accountancycategory.class.php b/htdocs/accountancy/class/accountancycategory.class.php index b0c3adb7edd..7cd1f1d11b2 100644 --- a/htdocs/accountancy/class/accountancycategory.class.php +++ b/htdocs/accountancy/class/accountancycategory.class.php @@ -761,7 +761,7 @@ class AccountancyCategory // extends CommonObject * Return list of personalized groups that are active * * @param int $categorytype -1=All, 0=Only non computed groups, 1=Only computed groups - * @return array Array of groups + * @return array|int Array of groups or -1 if error */ public function getCats($categorytype=-1) { @@ -818,7 +818,7 @@ class AccountancyCategory // extends CommonObject * * @param int $cat_id Id if personalized accounting group/category * @param string $predefinedgroupwhere Sql criteria filter to select accounting accounts - * @return array Array of accounting accounts + * @return array|int Array of accounting accounts or -1 if error */ public function getCptsCat($cat_id, $predefinedgroupwhere='') { diff --git a/htdocs/accountancy/class/accountancysystem.class.php b/htdocs/accountancy/class/accountancysystem.class.php index d126bd84acc..444079f5239 100644 --- a/htdocs/accountancy/class/accountancysystem.class.php +++ b/htdocs/accountancy/class/accountancysystem.class.php @@ -38,18 +38,18 @@ class AccountancySystem */ public $error=''; - var $rowid; - var $fk_pcg_version; - var $pcg_type; - var $pcg_subtype; + public $rowid; + public $fk_pcg_version; + public $pcg_type; + public $pcg_subtype; /** * @var string Accountancy System label */ public $label; - var $account_number; - var $account_parent; + public $account_number; + public $account_parent; /** * Constructor diff --git a/htdocs/accountancy/class/lettering.class.php b/htdocs/accountancy/class/lettering.class.php index a67fd457e11..0ddbaeb5026 100644 --- a/htdocs/accountancy/class/lettering.class.php +++ b/htdocs/accountancy/class/lettering.class.php @@ -35,7 +35,7 @@ class lettering extends BookKeeping * lettrageTiers * * @param int $socid Thirdparty id - * @return void + * @return int 1 OK, <0 error */ public function lettrageTiers($socid) { diff --git a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php index be7af41e894..c841f83b297 100644 --- a/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php +++ b/htdocs/adherents/canvas/default/actions_adherentcard_default.class.php @@ -1,7 +1,7 @@ * Copyright (C) 2011 Laurent Destailleur - * Copyright (C) 2012 Philippe Grand + * Copyright (C) 2012-2018 Philippe Grand * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,20 +20,20 @@ /** * \file htdocs/adherents/canvas/default/actions_adherentcard_default.class.php * \ingroup member - * \brief Fichier de la classe Thirdparty adherent card controller (default canvas) + * \brief File of class Thirdparty member card controller (default canvas) */ include_once DOL_DOCUMENT_ROOT.'/adherents/canvas/actions_adherentcard_common.class.php'; /** * \class ActionsAdherentCardDefault - * \brief Classe permettant la gestion des adherents par defaut + * \brief Class allowing the management of the members by default */ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon { /** * Constructor * - * @param DoliDB $db Handler acces base de donnees + * @param DoliDB $db Handler acces data base * @param string $dirmodule Name of directory of module * @param string $targetmodule Name of directory of module where canvas is stored * @param string $canvas Name of canvas @@ -51,7 +51,7 @@ class ActionsAdherentCardDefault extends ActionsAdherentCardCommon /** * Return the title of card * - * @param string $action Code action + * @param string $action Action code * @return string Title */ private function getTitle($action) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3d3c8fb6e54..bc29c67c244 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -622,8 +622,9 @@ if (empty($reshook)) // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_MEMBER_VALIDATION; @@ -640,7 +641,9 @@ if (empty($reshook)) $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs); - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, 2); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); if ($result < 0) { $error++; @@ -693,8 +696,9 @@ if (empty($reshook)) // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; @@ -711,7 +715,9 @@ if (empty($reshook)) $subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs); $texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnResiliate()), $substitutionarray, $outputlangs); - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/card.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } if ($result < 0) { @@ -1384,6 +1390,7 @@ else // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); // Get email content from template $arraydefaultmessage=null; @@ -1444,8 +1451,9 @@ else // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_CANCELATION; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 90f20ca323d..09c5decfc43 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -140,7 +140,7 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * Function sending an email has the adherent with the text supplied in parameter. + * Function sending an email to the current member with the text supplied in parameter. * * @param string $text Content of message (not html entities encoded) * @param string $subject Subject of message @@ -152,9 +152,10 @@ class Adherent extends CommonObject * @param int $deliveryreceipt Ask a delivery receipt * @param int $msgishtml 1=String IS already html, 0=String IS NOT html, -1=Unknown need autodetection * @param string $errors_to erros to + * @param string $moreinheader Add more html headers * @return int <0 if KO, >0 if OK */ - function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='') + function send_an_email($text, $subject, $filename_list=array(), $mimetype_list=array(), $mimefilename_list=array(), $addr_cc="", $addr_bcc="", $deliveryreceipt=0, $msgishtml=-1, $errors_to='', $moreinheader='') { // phpcs:enable global $conf,$langs; @@ -176,9 +177,11 @@ class Adherent extends CommonObject $from=$conf->email_from; if (! empty($conf->global->ADHERENT_MAIL_FROM)) $from=$conf->global->ADHERENT_MAIL_FROM; + $trackid = 'mem'.$this->id; + // Send email (substitutionarray must be done just before this) include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml); + $mailfile = new CMailFile($subjecttosend, $this->email, $from, $texttosend, $filename_list, $mimetype_list, $mimefilename_list, $addr_cc, $addr_bcc, $deliveryreceipt, $msgishtml, '', '', $trackid, $moreinheader); if ($mailfile->sendfile()) { return 1; @@ -2019,52 +2022,47 @@ class Adherent extends CommonObject if ($mode == 0) { if ($statut == -1) return $langs->trans("MemberStatusDraft"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLate"); else return $langs->trans("MemberStatusPaid"); } - if ($statut == 0) return $langs->trans("MemberStatusResiliated"); + elseif ($statut == 0) return $langs->trans("MemberStatusResiliated"); } elseif ($mode == 1) { if ($statut == -1) return $langs->trans("MemberStatusDraftShort"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return $langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return $langs->trans("MemberStatusActiveLateShort"); else return $langs->trans("MemberStatusPaidShort"); } - if ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); + elseif ($statut == 0) return $langs->trans("MemberStatusResiliatedShort"); } elseif ($mode == 2) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraftShort"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActiveShort"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLateShort"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaidShort"); } - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); + elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5').' '.$langs->trans("MemberStatusResiliatedShort"); } elseif ($mode == 3) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return img_picto($langs->trans('MemberStatusPaid'),'statut4'); } - if ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); + elseif ($statut == 0) return img_picto($langs->trans('MemberStatusResiliated'),'statut5'); } elseif ($mode == 4) { if ($statut == -1) return img_picto($langs->trans('MemberStatusDraft'),'statut0').' '.$langs->trans("MemberStatusDraft"); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return img_picto($langs->trans('MemberStatusActive'),'statut1').' '.$langs->trans("MemberStatusActive"); elseif ($date_end_subscription < time()) return img_picto($langs->trans('MemberStatusActiveLate'),'statut3').' '.$langs->trans("MemberStatusActiveLate"); else return img_picto($langs->trans('MemberStatusPaid'),'statut4').' '.$langs->trans("MemberStatusPaid"); @@ -2074,8 +2072,7 @@ class Adherent extends CommonObject elseif ($mode == 5) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + elseif ($statut >= 1) { if (! $date_end_subscription) return ''.$langs->trans("MemberStatusActiveShort").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLateShort").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return ''.$langs->trans("MemberStatusPaidShort").' '.img_picto($langs->trans('MemberStatusPaid'),'statut4'); @@ -2085,8 +2082,7 @@ class Adherent extends CommonObject elseif ($mode == 6) { if ($statut == -1) return $langs->trans("MemberStatusDraft").' '.img_picto($langs->trans('MemberStatusDraft'),'statut0'); - if ($statut >= 1) - { + if ($statut >= 1) { if (! $date_end_subscription) return ''.$langs->trans("MemberStatusActive").' '.img_picto($langs->trans('MemberStatusActive'),'statut1'); elseif ($date_end_subscription < time()) return ''.$langs->trans("MemberStatusActiveLate").' '.img_picto($langs->trans('MemberStatusActiveLate'),'statut3'); else return ''.$langs->trans("MemberStatusPaid").' '.img_picto($langs->trans('MemberStatusPaid'),'statut4'); @@ -2107,7 +2103,7 @@ class Adherent extends CommonObject // phpcs:enable global $conf; - $this->nb=array(); + $this->nb = array(); $sql = "SELECT count(a.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."adherent as a"; @@ -2635,6 +2631,7 @@ class Adherent extends CommonObject // Send reminder email $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($adherent->thirdparty->default_lang) ? $mysoc->default_lang : $adherent->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); dol_syslog("sendReminderForExpiredSubscription Language set to ".$outputlangs->defaultlang); @@ -2654,8 +2651,11 @@ class Adherent extends CommonObject $from = $conf->global->ADHERENT_MAIL_FROM; $to = $adherent->email; + $trackid = 'mem'.$adherent->id; + $moreinheader='X-Dolibarr-Info: sendReminderForExpiredSubscription'."\r\n"; + include_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; - $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1); + $cmail = new CMailFile($subject, $to, $from, $msg, array(), array(), array(), '', '', 0, 1, '', '', $trackid, $moreinheader); $result = $cmail->sendfile(); if (! $result) { diff --git a/htdocs/adherents/class/adherent_type.class.php b/htdocs/adherents/class/adherent_type.class.php index a9d7fd7ead3..dffd1446af0 100644 --- a/htdocs/adherents/class/adherent_type.class.php +++ b/htdocs/adherents/class/adherent_type.class.php @@ -56,8 +56,10 @@ class AdherentType extends CommonObject */ public $libelle; - /** @var string Label */ - public $label; + /** + * @var string Adherent type label + */ + public $label; /** * @var int Subsription required (0 or 1) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index 7b90878dff7..51e1a8b244e 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -582,7 +582,7 @@ if (! empty($arrayfields['t.libelle']['checked'])) print_liste_field_titr if (! empty($arrayfields['d.address']['checked'])) print_liste_field_titre($arrayfields['d.address']['label'],$_SERVER["PHP_SELF"],'d.address','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.zip']['checked'])) print_liste_field_titre($arrayfields['d.zip']['label'],$_SERVER["PHP_SELF"],'d.zip','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.town']['checked'])) print_liste_field_titre($arrayfields['d.town']['label'],$_SERVER["PHP_SELF"],'d.town','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.town']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['d.phone']['checked'])) print_liste_field_titre($arrayfields['d.phone']['label'],$_SERVER["PHP_SELF"],'d.phone','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.phone_perso']['checked'])) print_liste_field_titre($arrayfields['d.phone_perso']['label'],$_SERVER["PHP_SELF"],'d.phone_perso','',$param,'',$sortfield,$sortorder); diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index 78a7ce8495f..9c505477309 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -359,8 +359,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; @@ -393,7 +394,9 @@ if ($user->rights->adherent->cotisation->creer && $action == 'subscription' && ! $listofmimes=array(dol_mimetype($file)); } - $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1); + $moreinheader='X-Dolibarr-Info: send_an_email by adherents/subscription.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, $listofpaths, $listofnames, $listofmimes, "", "", 0, -1, '', $moreinheader); if ($result < 0) { $errmsg=$object->error; @@ -1053,8 +1056,9 @@ if ($rowid > 0) // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_SUBSCRIPTION; diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index f7242ee43bc..e3ea95d18b5 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -328,20 +328,20 @@ if ($action == 'edit' || $action == 'updateedit') // Name print ''; - print ''."\n"; + print ''."\n"; // Addresse print ''; - print ''."\n"; + print ''."\n"; print ''; - print ''."\n"; + print ''."\n"; print ''; - print ''."\n"; + print ''."\n"; // Country @@ -363,29 +363,29 @@ if ($action == 'edit' || $action == 'updateedit') print ''; - print ''; + print ''; print ''."\n"; print ''; - print ''; + print ''; print ''."\n"; print ''; - print ''; + print ''; print ''."\n"; // Web print ''; - print ''; + print ''; print ''."\n"; // Barcode if (! empty($conf->barcode->enabled)) { print ''; - print ''; + print ''; print ''; } @@ -424,19 +424,19 @@ if ($action == 'edit' || $action == 'updateedit') // Managing Director(s) print ''; - print ''; + print ''; // GDPR contact print ''; print $form->textwithpicto($langs->trans("GDPRContact"), $langs->trans("GDPRContactDesc")); print ''; - print ''; + print ''; // Capital print ''; - print ''; + print ''; // Juridical Status @@ -455,7 +455,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -471,7 +471,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -487,7 +487,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -503,7 +503,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -519,7 +519,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -535,7 +535,7 @@ if ($action == 'edit' || $action == 'updateedit') print ''; if (! empty($mysoc->country_code)) { - print ''; + print ''; } else { @@ -547,7 +547,7 @@ if ($action == 'edit' || $action == 'updateedit') // TVA Intra print ''; - print ''; + print ''; print ''; // Object of the company @@ -766,7 +766,13 @@ else // Web - print ''.$langs->trans("Web").'' . dol_print_url($conf->global->MAIN_INFO_SOCIETE_WEB,'_blank',80) . ''; + print ''.$langs->trans("Web").''; + $arrayofurl = preg_split('/\s/', $conf->global->MAIN_INFO_SOCIETE_WEB); + foreach($arrayofurl as $urltoshow) + { + if ($urltoshow) print dol_print_url($urltoshow,'_blank',80); + } + print ''; // Barcode if (! empty($conf->barcode->enabled)) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 984ddfbefd7..4d75ab44235 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2017-2018 Laurent Destailleur * Copyright (C) 2017-2018 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -17,8 +17,13 @@ */ /** - * \file htdocs/admin/defaultvalues.php - * \brief Page to set default values used used in a create form + * \file htdocs/admin/defaultvalues.php + * \brief Page to set default values used used in a create form + * Default values are stored into $user->default_values[url]['createform']['querystring'|'_noquery_'][paramkey]=paramvalue + * Default filters are stored into $user->default_values[url]['filters']['querystring'|'_noquery_'][paramkey]=paramvalue + * Default sort order are stored into $user->default_values[url]['sortorder']['querystring'|'_noquery_'][paramkey]=paramvalue + * Default focus are stored into $user->default_values[url]['focus']['querystring'|'_noquery_'][paramkey]=paramvalue + * Mandatory fields are stored into $user->default_values[url]['mandatory']['querystring'|'_noquery_'][paramkey]=paramvalue */ require '../main.inc.php'; @@ -230,9 +235,9 @@ if ($mode == 'sortorder') { print info_admin($langs->trans("WarningSettingSortOrder")).'
'; } -if ($mode == 'focus') +if ($mode == 'mandatory') { - print info_admin($langs->trans("FeatureNotYetAvailable")).'
'; + print info_admin($langs->trans("FeatureSupportedOnTextFieldsOnly")).'
'; } print ''; @@ -261,7 +266,7 @@ else } print_liste_field_titre($textkey,$_SERVER["PHP_SELF"],'param','',$param,'',$sortfield,$sortorder); // Value -if ($mode != 'focus') +if ($mode != 'focus' && $mode != 'mandatory') { if ($mode != 'sortorder') { @@ -294,14 +299,14 @@ print "\n"; print ''; // Page print ''; -print ''; +print ''; print ''."\n"; // Field print ''; -print ''; +print ''; print ''; // Value -if ($mode != 'focus') +if ($mode != 'focus' && $mode != 'mandatory') { print ''; print ''; @@ -311,15 +316,16 @@ if ($mode != 'focus') if (! empty($conf->multicompany->enabled) && !$user->entity) { print ''; - print ''; + print ''; // We see environment, but to change it we must switch on other entity print ''; - print ''; } else { print ''; print ''; + print ''; } +print ''; $disabled=''; if (empty($conf->global->MAIN_ENABLE_DEFAULT_VALUES)) $disabled=' disabled="disabled"'; print ''; @@ -363,7 +369,7 @@ if ($result) print ''."\n"; // Value - if ($mode != 'focus') + if ($mode != 'focus' && $mode != 'mandatory') { print ''; /*print ''; @@ -376,6 +382,9 @@ if ($result) print ''; } + // Multicompany + print ''; + // Actions print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) diff --git a/htdocs/admin/dict.php b/htdocs/admin/dict.php index 0c25f3a5bd8..aaa4fb03706 100644 --- a/htdocs/admin/dict.php +++ b/htdocs/admin/dict.php @@ -456,7 +456,7 @@ $tabhelp[8] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs-> $tabhelp[9] = array('code'=>$langs->trans("EnterAnyCode"), 'unicode'=>$langs->trans("UnicodeCurrency")); $tabhelp[10] = array('code'=>$langs->trans("EnterAnyCode"), 'taux'=>$langs->trans("SellTaxRate"), 'recuperableonly'=>$langs->trans("RecuperableOnly"), 'localtax1_type'=>$langs->trans("LocalTaxDesc"), 'localtax2_type'=>$langs->trans("LocalTaxDesc")); $tabhelp[11] = array('code'=>$langs->trans("EnterAnyCode"), 'position'=>$langs->trans("PositionIntoComboList")); -$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr")); +$tabhelp[12] = array('code'=>$langs->trans("EnterAnyCode"), 'type_cdr'=>$langs->trans("TypeCdr", $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"), $langs->transnoentitiesnoconv("NbOfDays"), $langs->transnoentitiesnoconv("Offset"))); $tabhelp[13] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[14] = array('code'=>$langs->trans("EnterAnyCode")); $tabhelp[15] = array('code'=>$langs->trans("EnterAnyCode")); @@ -950,8 +950,8 @@ if (empty($id)) { print $langs->trans("DictionaryDesc"); print " ".$langs->trans("OnlyActiveElementsAreShown")."
\n"; + print '
'; } -print "
\n"; $param = '&id='.urlencode($id); @@ -1016,6 +1016,13 @@ if ($id) print ''; print ''; + if ($id == 10 && empty($conf->global->FACTURE_TVAOPTION)) + { + print info_admin($langs->trans("VATIsUsedIsOff", $langs->transnoentities("Setup"), $langs->transnoentities("CompanyFoundation"))); + } + + print "
\n"; + // Form to add a new line if ($tabname[$id]) { diff --git a/htdocs/admin/external_rss.php b/htdocs/admin/external_rss.php index e0f3f72f927..970971c8d29 100644 --- a/htdocs/admin/external_rss.php +++ b/htdocs/admin/external_rss.php @@ -242,10 +242,10 @@ if ($resql) { $obj = $db->fetch_object($resql); - preg_match('/^([0-9]+)/i',$obj->note,$reg); + preg_match('/^([0-9]+)/i',$obj->note,$reg); $idrss = $reg[1]; - $keyrssurl="EXTERNAL_RSS_URLRSS_".$idrss; - $keyrsstitle="EXTERNAL_RSS_URLRSS_".$idrss; + $keyrsstitle="EXTERNAL_RSS_TITLE_".$idrss; + $keyrssurl="EXTERNAL_RSS_URLRSS_".$idrss; //print "x".$idrss; $rssparser=new RssParser($db); diff --git a/htdocs/admin/ihm.php b/htdocs/admin/ihm.php index e15e6d0f91f..8861d1abb68 100644 --- a/htdocs/admin/ihm.php +++ b/htdocs/admin/ihm.php @@ -240,7 +240,7 @@ if ($action == 'edit') // Edit // Default language print ''.$langs->trans("DefaultLanguage").''; - print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300'); + print $formadmin->select_language($conf->global->MAIN_LANG_DEFAULT, 'MAIN_LANG_DEFAULT', 1, 0, 0, 0, 0, 'minwidth300', 2); print ''; print ' '; print ''; diff --git a/htdocs/admin/index.php b/htdocs/admin/index.php index 2f64793c28b..be9859c1beb 100644 --- a/htdocs/admin/index.php +++ b/htdocs/admin/index.php @@ -89,6 +89,14 @@ print '
'; // Show info setup module print img_picto('','puce').' '.$langs->trans("SetupDescription4", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentities("Setup"), $langs->transnoentities("Modules")); + +/* +$nbofactivatedmodules=count($conf->modules); +$moreinfo=$langs->trans("TotalNumberOfActivatedModules",($nbofactivatedmodules-1), count($modules)); +if ($nbofactivatedmodules <= 1) $moreinfo .= ' '.img_warning($langs->trans("YouMustEnableOneModule")); +print '
'.$moreinfo; +*/ + if (count($conf->modules) <= (empty($conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)?1:$conf->global->MAIN_MIN_NB_ENABLED_MODULE_FOR_WARNING)) // If only user module enabled { $langs->load("errors"); diff --git a/htdocs/admin/modulehelp.php b/htdocs/admin/modulehelp.php index b5b33be77aa..13f72e7c4b3 100644 --- a/htdocs/admin/modulehelp.php +++ b/htdocs/admin/modulehelp.php @@ -162,10 +162,10 @@ foreach ($modulesdir as $dir) $familykey = $objMod->family; } - $moduleposition = ($objMod->module_position?$objMod->module_position:'500'); - if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external')) + $moduleposition = ($objMod->module_position?$objMod->module_position:'50'); + if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) { - $moduleposition = 800; + $moduleposition = '80'; // External modules at end by default } $orders[$i] = $familyinfo[$familykey]['position']."_".$familykey."_".$moduleposition."_".$j; // Sort by family, then by module position then number diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 89f0f028e1e..c089e9ef204 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -272,14 +272,13 @@ $dirins_ok=(dol_is_dir($dirins)); $help_url='EN:First_setup|FR:Premiers_paramétrages|ES:Primeras_configuraciones'; llxHeader('',$langs->trans("Setup"),$help_url, '', '', '', $morejs, $morecss, 0, 0); -$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - '.$langs->trans("AllPublishers")); -$arrayofwarnings=array(); // Array of warning each module want to show when activated -$arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module // Search modules dirs $modulesdir = dolGetModulesDirs(); - +$arrayofnatures=array('core'=>$langs->transnoentitiesnoconv("Core"), 'external'=>$langs->transnoentitiesnoconv("External").' - ['.$langs->trans("AllPublishers").']'); +$arrayofwarnings=array(); // Array of warning each module want to show when activated +$arrayofwarningsext=array(); // Array of warning each module want to show when we activate an external module $filename = array(); $modules = array(); $orders = array(); @@ -371,10 +370,10 @@ foreach ($modulesdir as $dir) $familykey = $objMod->family; } - $moduleposition = ($objMod->module_position?$objMod->module_position:'500'); - if ($moduleposition == 500 && ($objMod->isCoreOrExternalModule() == 'external')) + $moduleposition = ($objMod->module_position?$objMod->module_position:'50'); + if ($moduleposition == '50' && ($objMod->isCoreOrExternalModule() == 'external')) { - $moduleposition = 800; + $moduleposition = '80'; // External modules at end by default } // Add list of warnings to show into arrayofwarnings and arrayofwarningsext @@ -847,6 +846,8 @@ if ($mode == 'common') dol_fiche_end(); + print '
'; + // Show warning about external users print info_admin(showModulesExludedForExternal($modules))."\n"; @@ -1063,7 +1064,7 @@ if ($mode == 'develop') //print ''; print '
'; print ''; - print ''.$langs->trans("TryToUseTheModuleBuilder").''; + print ''.$langs->trans("TryToUseTheModuleBuilder", $langs->transnoentitiesnoconv("ModuleBuilder")).''; print ''.$langs->trans("SeeTopRightMenu").''; print ''; diff --git a/htdocs/admin/oauthlogintokens.php b/htdocs/admin/oauthlogintokens.php index 5bfda4f2c9c..fb9f2dd374e 100644 --- a/htdocs/admin/oauthlogintokens.php +++ b/htdocs/admin/oauthlogintokens.php @@ -342,7 +342,7 @@ if ($mode == 'test' && $user->admin) $langs->load($driver); $printer = new $classname($db); //print '
'.print_r($printer, true).'
'; - if (count($printer->getlist_available_printers())) { + if (count($printer->getlistAvailablePrinters())) { if ($printer->listAvailablePrinters()==0) { print $printer->resprint; } else { diff --git a/htdocs/admin/pdf.php b/htdocs/admin/pdf.php index 76b3cf76b57..0dba6ea6700 100644 --- a/htdocs/admin/pdf.php +++ b/htdocs/admin/pdf.php @@ -67,6 +67,8 @@ if ($action == 'update') dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_DESC", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_DESC"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_HIDE_REF", $_POST["MAIN_GENERATE_DOCUMENTS_HIDE_REF"],'chaine',0,'', $conf->entity); + + dolibarr_set_const($db, "MAIN_INVERT_SENDER_RECIPIENT", $_POST["MAIN_INVERT_SENDER_RECIPIENT"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_PDF_USE_ISO_LOCATION", $_POST["MAIN_PDF_USE_ISO_LOCATION"],'chaine',0,'', $conf->entity); dolibarr_set_const($db, "MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS", $_POST["MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS"],'chaine',0,'', $conf->entity); @@ -572,31 +574,36 @@ else // Show print ""; print ''; - //Desc + // Hide Desc print ''.$langs->trans("HideDescOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DESC,1); print ''; - //Ref + // Hide Ref print ''.$langs->trans("HideRefOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_REF,1); print ''; - //Details + // Hide Details print ''.$langs->trans("HideDetailsOnPDF").''; print yn($conf->global->MAIN_GENERATE_DOCUMENTS_HIDE_DETAILS,1); print ''; + // Invert sender and recipient + print ''.$langs->trans("SwapSenderAndRecipientOnPDF").''; + print yn($conf->global->MAIN_INVERT_SENDER_RECIPIENT,1); + print ''; - print ''.$langs->trans("PlaceCustomerAddressToIsoLocation").''; + // Use French location + print ''.$langs->trans("PlaceCustomerAddressToIsoLocation").''; print yn($conf->global->MAIN_PDF_USE_ISO_LOCATION,1); print ''; - print ''.$langs->trans("ShowDetailsInPDFPageFoot").''; + print ''.$langs->trans("ShowDetailsInPDFPageFoot").''; print $arraydetailsforpdffoot[($conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS ? $conf->global->MAIN_GENERATE_DOCUMENTS_SHOW_FOOT_DETAILS : 0)]; print ''; diff --git a/htdocs/admin/socialnetworks.php b/htdocs/admin/socialnetworks.php new file mode 100644 index 00000000000..9aba26b3fc4 --- /dev/null +++ b/htdocs/admin/socialnetworks.php @@ -0,0 +1,123 @@ + + * + * 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 . + */ + +/** + * \file htdocs/admin/socialnetworks.php + * \ingroup socialnetworks + * \brief Page to setup the module Social Networks + */ + +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/mailmanspip.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + +// Load translation files required by the page +$langs->loadLangs(array("admin", "errors")); + +if (! $user->admin) accessforbidden(); + +$type=array('yesno','texte','chaine'); + +$action = GETPOST('action','aZ09'); + + + +/* + * Actions + */ + +// Action activation d'un sous module du module adherent +if ($action == 'set') +{ + $result=dolibarr_set_const($db, $_GET["name"], $_GET["value"], '', 0, '', $conf->entity); + if ($result < 0) + { + dol_print_error($db); + } +} + +// Action desactivation d'un sous module du module adherent +if ($action == 'unset') +{ + $result=dolibarr_del_const($db, $_GET["name"], $conf->entity); + if ($result < 0) + { + dol_print_error($db); + } +} + + +/* + * View + */ + +$help_url=''; + +llxHeader('',$langs->trans("SocialNetworkSetup"),$help_url); + + +$linkback=''.$langs->trans("BackToModuleList").''; +print load_fiche_titre($langs->trans("SocialNetworkSetup"),$linkback,'title_setup'); + +//$head = socialnetworks_admin_prepare_head(); +$h=0; +$head = array(); +$head[$h][0] = DOL_URL_ROOT.'/admin/socialnetworks.php'; +$head[$h][1] = $langs->trans("Setup"); +$head[$h][2] = 'setup'; +$h++; + + +print '
'; + +dol_fiche_head($head, 'setup', '', 0, 'user'); + +print '
'; + +$arrayofsocialnetworks=array('skype'=>'Skype', 'twitter'=>'Twitter', 'facebook'=>'Facebook'); + +foreach($arrayofsocialnetworks as $snkey => $snlabel) +{ + $consttocheck = 'SOCIALNETWORKS_'.strtoupper($snkey); + if (! empty($conf->global->$consttocheck)) + { + //$link=img_picto($langs->trans("Active"),'tick').' '; + $link=''; + //$link.=$langs->trans("Disable"); + $link.=img_picto($langs->trans("Activated"),'switch_on'); + $link.=''; + } + else + { + $link=''; + //$link.=img_$langs->trans("Activate") + $link.=img_picto($langs->trans("Disabled"),'switch_off'); + $link.=''; + } + print $langs->trans('EnableFeatureFor', $snlabel).' '.$link.'

'; +} + + +dol_fiche_end(); + +print '
'; + + +// End of page +llxFooter(); +$db->close(); diff --git a/htdocs/admin/system/dolibarr.php b/htdocs/admin/system/dolibarr.php index 9c2ee62565d..99a07c17248 100644 --- a/htdocs/admin/system/dolibarr.php +++ b/htdocs/admin/system/dolibarr.php @@ -156,7 +156,8 @@ $i=0; foreach($_SESSION as $key => $val) { if ($i > 0) print ', '; - print $key.' => '.dol_escape_htmltag($val); + if (is_array($val)) print $key.' => array(...)'; + else print $key.' => '.dol_escape_htmltag($val); $i++; } print ''."\n"; diff --git a/htdocs/admin/system/filecheck.php b/htdocs/admin/system/filecheck.php index 0418830cce8..e978ac85b55 100644 --- a/htdocs/admin/system/filecheck.php +++ b/htdocs/admin/system/filecheck.php @@ -307,7 +307,7 @@ if (! $error && $xml) } else { - $out.=''.$langs->trans("None").''; + $out.=''.$langs->trans("None").''; } $out.=''; $out.=''; @@ -337,7 +337,13 @@ if (! $error && $xml) $i++; $out.=''; $out.=''.$i.'' . "\n"; - $out.=''.$file['filename'].'' . "\n"; + $out.=''.$file['filename']; + $out.=PHP_OS; + if (! preg_match('/^win/i',PHP_OS)) { + $htmltext=$langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.'/'.$file['filename']); + $out.=' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'); + } + $out.='' . "\n"; $out.=''.$file['expectedmd5'].'' . "\n"; $out.=''.$file['md5'].'' . "\n"; $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']); diff --git a/htdocs/admin/tools/export.php b/htdocs/admin/tools/export.php index f3d2057395f..6b0ea790ab2 100644 --- a/htdocs/admin/tools/export.php +++ b/htdocs/admin/tools/export.php @@ -129,7 +129,7 @@ if ($what == 'mysql') { $arrayofallowedcommand=explode(',', $dolibarr_main_restrict_os_commands); $ok=0; - dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that on of this command is inside ".$cmddump); + dol_syslog("Command are restricted to ".$dolibarr_main_restrict_os_commands.". We check that one of this command is inside ".$cmddump); foreach($arrayofallowedcommand as $allowedcommand) { if (preg_match('/'.preg_quote($allowedcommand,'/').'/', $cmddump)) @@ -235,176 +235,3 @@ $time_end = time(); $db->close(); - - -// MYSQL NO BINARIES (only php) -/** Backup the db OR just a table without mysqldump binary (does not require any exec permission) - * Author: David Walsh (http://davidwalsh.name/backup-mysql-database-php) - * Updated and enhanced by Stephen Larroque (lrq3000) and by the many commentators from the blog - * Note about foreign keys constraints: for Dolibarr, since there are a lot of constraints and when imported the tables will be inserted in the dumped order, not in constraints order, then we ABSOLUTELY need to use SET FOREIGN_KEY_CHECKS=0; when importing the sql dump. - * Note2: db2SQL by Howard Yeend can be an alternative, by using SHOW FIELDS FROM and SHOW KEYS FROM we could generate a more precise dump (eg: by getting the type of the field and then precisely outputting the right formatting - in quotes, numeric or null - instead of trying to guess like we are doing now). - * - * @param string $outputfile Output file name - * @param string $tables Table name or '*' for all - * @return int <0 if KO, >0 if OK - */ -function backup_tables($outputfile, $tables='*') -{ - global $db, $langs; - global $errormsg; - - // Set to UTF-8 - if (is_a($db, 'DoliDBMysqli')) { - /** @var DoliDBMysqli $db */ - $db->db->set_charset('utf8'); - } else { - /** @var DoliDB $db */ - $db->query('SET NAMES utf8'); - $db->query('SET CHARACTER SET utf8'); - } - - //get all of the tables - if ($tables == '*') - { - $tables = array(); - $result = $db->query('SHOW FULL TABLES WHERE Table_type = \'BASE TABLE\''); - while($row = $db->fetch_row($result)) - { - $tables[] = $row[0]; - } - } - else - { - $tables = is_array($tables) ? $tables : explode(',',$tables); - } - - //cycle through - $handle = fopen($outputfile, 'w+'); - if (fwrite($handle, '') === false) - { - $langs->load("errors"); - dol_syslog("Failed to open file ".$outputfile,LOG_ERR); - $errormsg=$langs->trans("ErrorFailedToWriteInDir"); - return -1; - } - - // Print headers and global mysql config vars - $sqlhead = ''; - $sqlhead .= "-- ".$db::LABEL." dump via php with Dolibarr ".DOL_VERSION." --- --- Host: ".$db->db->host_info." Database: ".$db->database_name." --- ------------------------------------------------------ --- Server version ".$db->db->server_info." - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; -/*!40103 SET TIME_ZONE='+00:00' */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; - -"; - - if (GETPOST("nobin_disable_fk")) $sqlhead .= "SET FOREIGN_KEY_CHECKS=0;\n"; - //$sqlhead .= "SET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n"; - if (GETPOST("nobin_use_transaction")) $sqlhead .= "SET AUTOCOMMIT=0;\nSTART TRANSACTION;\n"; - - fwrite($handle, $sqlhead); - - $ignore = ''; - if (GETPOST("nobin_sql_ignore")) $ignore = 'IGNORE '; - $delayed = ''; - if (GETPOST("nobin_delayed")) $delayed = 'DELAYED '; - - // Process each table and print their definition + their datas - foreach($tables as $table) - { - // Saving the table structure - fwrite($handle, "\n--\n-- Table structure for table `".$table."`\n--\n"); - - if (GETPOST("nobin_drop")) fwrite($handle,"DROP TABLE IF EXISTS `".$table."`;\n"); // Dropping table if exists prior to re create it - fwrite($handle,"/*!40101 SET @saved_cs_client = @@character_set_client */;\n"); - fwrite($handle,"/*!40101 SET character_set_client = utf8 */;\n"); - $resqldrop=$db->query('SHOW CREATE TABLE '.$table); - $row2 = $db->fetch_row($resqldrop); - if (empty($row2[1])) - { - fwrite($handle, "\n-- WARNING: Show create table ".$table." return empy string when it should not.\n"); - } - else - { - fwrite($handle,$row2[1].";\n"); - //fwrite($handle,"/*!40101 SET character_set_client = @saved_cs_client */;\n\n"); - - // Dumping the data (locking the table and disabling the keys check while doing the process) - fwrite($handle, "\n--\n-- Dumping data for table `".$table."`\n--\n"); - if (!GETPOST("nobin_nolocks")) fwrite($handle, "LOCK TABLES `".$table."` WRITE;\n"); // Lock the table before inserting data (when the data will be imported back) - if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` DISABLE KEYS;\n"); - else fwrite($handle, "/*!40000 ALTER TABLE `".$table."` DISABLE KEYS */;\n"); - - $sql='SELECT * FROM '.$table; - $result = $db->query($sql); - while($row = $db->fetch_row($result)) - { - // For each row of data we print a line of INSERT - fwrite($handle,'INSERT '.$delayed.$ignore.'INTO `'.$table.'` VALUES ('); - $columns = count($row); - for($j=0; $j<$columns; $j++) { - // Processing each columns of the row to ensure that we correctly save the value (eg: add quotes for string - in fact we add quotes for everything, it's easier) - if ($row[$j] == null && !is_string($row[$j])) { - // IMPORTANT: if the field is NULL we set it NULL - $row[$j] = 'NULL'; - } elseif(is_string($row[$j]) && $row[$j] == '') { - // if it's an empty string, we set it as an empty string - $row[$j] = "''"; - } elseif(is_numeric($row[$j]) && !strcmp($row[$j], $row[$j]+0) ) { // test if it's a numeric type and the numeric version ($nb+0) == string version (eg: if we have 01, it's probably not a number but rather a string, else it would not have any leading 0) - // if it's a number, we return it as-is -// $row[$j] = $row[$j]; - } else { // else for all other cases we escape the value and put quotes around - $row[$j] = addslashes($row[$j]); - $row[$j] = preg_replace("#\n#", "\\n", $row[$j]); - $row[$j] = "'".$row[$j]."'"; - } - } - fwrite($handle,implode(',', $row).");\n"); - } - if (GETPOST("nobin_disable_fk")) fwrite($handle, "ALTER TABLE `".$table."` ENABLE KEYS;\n"); // Enabling back the keys/index checking - if (!GETPOST("nobin_nolocks")) fwrite($handle, "UNLOCK TABLES;\n"); // Unlocking the table - fwrite($handle,"\n\n\n"); - } - } - - /* Backup Procedure structure*/ - /* - $result = $db->query('SHOW PROCEDURE STATUS'); - if ($db->num_rows($result) > 0) - { - while ($row = $db->fetch_row($result)) { $procedures[] = $row[1]; } - foreach($procedures as $proc) - { - fwrite($handle,"DELIMITER $$\n\n"); - fwrite($handle,"DROP PROCEDURE IF EXISTS '$name'.'$proc'$$\n"); - $resqlcreateproc=$db->query("SHOW CREATE PROCEDURE '$proc'"); - $row2 = $db->fetch_row($resqlcreateproc); - fwrite($handle,"\n".$row2[2]."$$\n\n"); - fwrite($handle,"DELIMITER ;\n\n"); - } - } - */ - /* Backup Procedure structure*/ - - // Write the footer (restore the previous database settings) - $sqlfooter="\n\n"; - if (GETPOST("nobin_use_transaction")) $sqlfooter .= "COMMIT;\n"; - if (GETPOST("nobin_disable_fk")) $sqlfooter .= "SET FOREIGN_KEY_CHECKS=1;\n"; - $sqlfooter.="\n\n-- Dump completed on ".date('Y-m-d G-i-s'); - fwrite($handle, $sqlfooter); - - fclose($handle); - - return 1; -} diff --git a/htdocs/admin/tools/listsessions.php b/htdocs/admin/tools/listsessions.php index b1732e0883b..643269bfacd 100644 --- a/htdocs/admin/tools/listsessions.php +++ b/htdocs/admin/tools/listsessions.php @@ -96,7 +96,7 @@ $usefilter=0; $listofsessions=listOfSessions(); $num=count($listofsessions); -print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'',$num,0,'setup'); +print_barre_liste($langs->trans("Sessions"), $page, $_SERVER["PHP_SELF"],"",$sortfield,$sortorder,'', $num, ($num?$num:''),'setup'); // Do not show numer (0) if no session found (it means we can't know) $savehandler=ini_get("session.save_handler"); $savepath=ini_get("session.save_path"); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index 6ddb4dae1b3..6d6ef4578cd 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -254,7 +254,7 @@ class DolibarrApi //$tmp=preg_replace_all('/'.$regexstring.'/', '', $sqlfilters); $tmp=$sqlfilters; $ok=0; - $i=0; $nb=count($tmp); + $i=0; $nb=strlen($tmp); $counter=0; while ($i < $nb) { diff --git a/htdocs/asset/class/asset.class.php b/htdocs/asset/class/asset.class.php index 596b795999d..8aee71b4926 100644 --- a/htdocs/asset/class/asset.class.php +++ b/htdocs/asset/class/asset.class.php @@ -108,17 +108,17 @@ class Asset extends CommonObject public $entity; - /** - * @var string Asset label - */ - public $label; + /** + * @var string Asset label + */ + public $label; public $amount; /** * @var int Thirdparty ID */ - public $fk_soc; + public $fk_soc; /** * @var string description @@ -372,32 +372,32 @@ class Asset extends CommonObject if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } diff --git a/htdocs/asset/class/asset_type.class.php b/htdocs/asset/class/asset_type.class.php index df2f4c1415e..f1c6f9d771b 100644 --- a/htdocs/asset/class/asset_type.class.php +++ b/htdocs/asset/class/asset_type.class.php @@ -46,8 +46,10 @@ class AssetType extends CommonObject public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe - /** @var string Label */ - public $label; + /** + * @var string Asset type label + */ + public $label; /** @var string Accountancy code asset */ public $accountancy_code_asset; diff --git a/htdocs/blockedlog/class/authority.class.php b/htdocs/blockedlog/class/authority.class.php index b976857a522..0102a5d88d6 100644 --- a/htdocs/blockedlog/class/authority.class.php +++ b/htdocs/blockedlog/class/authority.class.php @@ -52,7 +52,6 @@ class BlockedLogAuthority */ public function __construct($db) { - $this->db = $db; } diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index dab99d80bc9..eb2070d703a 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -46,6 +46,9 @@ class BlockedLog */ public $entity; + /** + * @var string Error message + */ public $error = ''; /** diff --git a/htdocs/cashdesk/validation_verif.php b/htdocs/cashdesk/validation_verif.php index cdf9873e791..05da0bdebe1 100644 --- a/htdocs/cashdesk/validation_verif.php +++ b/htdocs/cashdesk/validation_verif.php @@ -215,6 +215,7 @@ switch ($action) $invoice->note_private=$note; $invoice->cond_reglement_id=$cond_reglement_id; $invoice->mode_reglement_id=$mode_reglement_id; + $invoice->module_source = 'cashdesk'; //print "c=".$invoice->cond_reglement_id." m=".$invoice->mode_reglement_id; exit; // Si paiement differe ... diff --git a/htdocs/categories/card.php b/htdocs/categories/card.php index ce3324505eb..44b209e4371 100644 --- a/htdocs/categories/card.php +++ b/htdocs/categories/card.php @@ -44,6 +44,7 @@ $origin = GETPOST('origin','alpha'); $catorigin = GETPOST('catorigin','int'); $type = GETPOST('type','alpha'); $urlfrom = GETPOST('urlfrom','alpha'); +$backtopage = GETPOST('backtopage','alpha'); $socid=GETPOST('socid','int'); $label=GETPOST('label'); @@ -173,6 +174,11 @@ if (($action == 'add' || $action == 'confirmed') && $user->rights->categorie->cr header("Location: ".$urlfrom); exit; } + elseif ($backtopage) + { + header("Location: ".$backtopage); + exit; + } else if ($idProdOrigin) { header("Location: ".DOL_URL_ROOT.'/categories/viewcat.php?id='.$idProdOrigin.'&type='.$type.'&mesg='.urlencode($langs->trans("CatCreated"))); @@ -232,8 +238,9 @@ if ($user->rights->categorie->creer) print ''; print ''; print ''; - print ''; + print ''; print ''; + print ''; if ($origin) print ''; if ($catorigin) print ''; diff --git a/htdocs/categories/index.php b/htdocs/categories/index.php index e634da4fe80..18112f13eba 100644 --- a/htdocs/categories/index.php +++ b/htdocs/categories/index.php @@ -65,8 +65,11 @@ $arrayofcss=array('/includes/jquery/plugins/jquerytreeview/jquery.treeview.css') llxHeader('',$title,'','',0,0,$arrayofjs,$arrayofcss); +$newcardbutton = ''.$langs->trans("NewCategory").''; +$newcardbutton.= ''; +$newcardbutton.= ''; -print load_fiche_titre($title); +print load_fiche_titre($title, $newcardbutton); //print ''; //print ''; + // Adds a line numbering column if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } @@ -4486,6 +4490,7 @@ else if ($id > 0 || ! empty($ref)) print ''; print "\n"; + // Adds a line numbering column if (!empty($conf->global->MAIN_VIEW_LINE_NUMBER)) { print ''; } @@ -4509,7 +4514,7 @@ else if ($id > 0 || ! empty($ref)) print ' - + '; diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index 0773e6eedc1..dd207af57ec 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -126,6 +126,10 @@ class Facture extends CommonInvoice public $close_note; //! 1 if invoice paid COMPLETELY, 0 otherwise (do not use it anymore, use statut and close_code) public $paye; + //! key of module source when invoice generated from a dedicated module ('cashdesk', 'takepos', ...) + public $module_source; + //! id of template invoice when generated from a template invoice + public $fk_fac_rec_source; //! id of source invoice if replacement invoice or credit note public $fk_facture_source; public $linked_objects=array(); @@ -216,7 +220,7 @@ class Facture extends CommonInvoice const TYPE_SITUATION = 5; /** - * Draft + * Draft status */ const STATUS_DRAFT = 0; @@ -443,7 +447,7 @@ class Facture extends CommonInvoice $sql.= ", note_public"; $sql.= ", ref_client, ref_int"; $sql.= ", fk_account"; - $sql.= ", fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet"; + $sql.= ", module_source, fk_fac_rec_source, fk_facture_source, fk_user_author, fk_projet"; $sql.= ", fk_cond_reglement, fk_mode_reglement, date_lim_reglement, model_pdf"; $sql.= ", situation_cycle_ref, situation_counter, situation_final"; $sql.= ", fk_incoterms, location_incoterms"; @@ -467,6 +471,7 @@ class Facture extends CommonInvoice $sql.= ", ".($this->ref_client?"'".$this->db->escape($this->ref_client)."'":"null"); $sql.= ", ".($this->ref_int?"'".$this->db->escape($this->ref_int)."'":"null"); $sql.= ", ".($this->fk_account>0?$this->fk_account:'NULL'); + $sql.= ", ".($this->module_source ? "'".$this->db->escape($this->module_source)."'" : "null"); $sql.= ", ".($this->fk_fac_rec_source?"'".$this->db->escape($this->fk_fac_rec_source)."'":"null"); $sql.= ", ".($this->fk_facture_source?"'".$this->db->escape($this->fk_facture_source)."'":"null"); $sql.= ", ".($user->id > 0 ? "'".$user->id."'":"null"); @@ -1213,7 +1218,7 @@ class Facture extends CommonInvoice if (! empty($this->total_tva)) $label.= '
' . $langs->trans('VAT') . ': ' . price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax1) && $this->total_localtax1 != 0) // We keep test != 0 because $this->total_localtax1 can be '0.00000000' - $label.= '
eee' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); + $label.= '
' . $langs->trans('LT1') . ': ' . price($this->total_localtax1, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_localtax2) && $this->total_localtax2 != 0) $label.= '
' . $langs->trans('LT2') . ': ' . price($this->total_localtax2, 0, $langs, 0, -1, -1, $conf->currency); if (! empty($this->total_ttc)) @@ -1253,12 +1258,14 @@ class Facture extends CommonInvoice if ($addlinktonotes) { - $txttoshow=($user->societe_id>0?$this->note_public:$this->note_private); + $txttoshow=($user->socid > 0 ? $this->note_public : $this->note_private); if ($txttoshow) { $notetoshow=$langs->trans("ViewPrivateNote").':
'.dol_string_nohtmltag($txttoshow,1); $result.=' '; - $result.=''.img_picto('','object_generic').''; + $result.=''; + $result.=img_picto('','note'); + $result.=''; //$result.=img_picto($langs->trans("ViewNote"),'object_generic'); //$result.=''; $result.=''; @@ -1411,7 +1418,7 @@ class Facture extends CommonInvoice } else { - $this->error='Bill with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; + $this->error='Invoice with id='.$rowid.' or ref='.$ref.' or ref_ext='.$ref_ext.' not found'; dol_syslog(get_class($this)."::fetch Error ".$this->error, LOG_ERR); return 0; } @@ -1519,7 +1526,7 @@ class Facture extends CommonInvoice $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - // TODO Fetch optional like done in fetch line of facture_rec ? + $line->fetch_optionals(); $this->lines[$i] = $line; @@ -1982,7 +1989,8 @@ class Facture extends CommonInvoice if (! dol_delete_file($file,0,0,0,$this)) // For triggers { - $this->error=$langs->trans("ErrorCanNotDeleteFile",$file); + $langs->load("errors"); + $this->error=$langs->trans("ErrorFailToDeleteFile",$file); $this->db->rollback(); return 0; } @@ -1991,7 +1999,8 @@ class Facture extends CommonInvoice { if (! dol_delete_dir_recursive($dir)) // For remove dir and meta { - $this->error=$langs->trans("ErrorCanNotDeleteDir",$dir); + $langs->load("errors"); + $this->error=$langs->trans("ErrorFailToDeleteDir",$dir); $this->db->rollback(); return 0; } @@ -4911,9 +4920,10 @@ class FactureLigne extends CommonInvoiceLine * Warning: If invoice is a replacement invoice, this->fk_prev_id is id of the replaced line. * * @param int $invoiceid Invoice id + * @param bool $include_credit_note Include credit note or not * @return int >= 0 */ - function get_prev_progress($invoiceid) + function get_prev_progress($invoiceid, $include_credit_note=true) { // phpcs:enable if (is_null($this->fk_prev_id) || empty($this->fk_prev_id) || $this->fk_prev_id == "") { @@ -4928,7 +4938,26 @@ class FactureLigne extends CommonInvoiceLine $resql = $this->db->query($sql); if ($resql && $resql->num_rows > 0) { $res = $this->db->fetch_array($resql); - return floatval($res['situation_percent']); + + $returnPercent = floatval($res['situation_percent']); + + if($include_credit_note) { + + $sql = 'SELECT fd.situation_percent FROM ' . MAIN_DB_PREFIX . 'facturedet fd'; + $sql.= ' JOIN ' . MAIN_DB_PREFIX . 'facture f ON (f.rowid = fd.fk_facture) '; + $sql.= ' WHERE fd.fk_prev_id =' . $this->fk_prev_id; + $sql.= ' AND f.situation_cycle_ref = '.$tmpinvoice->situation_cycle_ref; // Prevent cycle outed + $sql.= ' AND f.type = '.Facture::TYPE_CREDIT_NOTE; + + $res = $this->db->query($sql); + if($res) { + while($obj = $this->db->fetch_object($res)) { + $returnPercent = $returnPercent + floatval($obj->situation_percent); + } + } + } + + return $returnPercent; } else { $this->error = $this->db->error(); dol_syslog(get_class($this) . "::select Error " . $this->error, LOG_ERR); diff --git a/htdocs/compta/facture/class/paymentterm.class.php b/htdocs/compta/facture/class/paymentterm.class.php index 619487e9574..31e362445f0 100644 --- a/htdocs/compta/facture/class/paymentterm.class.php +++ b/htdocs/compta/facture/class/paymentterm.class.php @@ -135,18 +135,17 @@ class PaymentTerm // extends CommonObject { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."c_payment_term"); - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $notrigger) { - //// Call triggers - //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; - //$interface=new Interfaces($this->db); - //$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); - //if ($result < 0) { $error++; $this->errors=$interface->errors; } - //// End call triggers - } + // // Call triggers + // include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; + // $interface=new Interfaces($this->db); + // $result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf); + // if ($result < 0) { $error++; $this->errors=$interface->errors; } + // // End call triggers + //} } // Commit or rollback @@ -311,21 +310,16 @@ class PaymentTerm // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $error && ! $notrigger) { // Call triggers //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //$interface=new Interfaces($this->db); //$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } // End call triggers - } - } + //} // Commit or rollback if ($error) @@ -367,21 +361,16 @@ class PaymentTerm // extends CommonObject $resql = $this->db->query($sql); if (! $resql) { $error++; $this->errors[]="Error ".$this->db->lasterror(); } - if (! $error) - { - if (! $notrigger) - { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action call a trigger. - + // Uncomment this and change MYOBJECT to your own tag if you + // want this action call a trigger. + //if (! $error && ! $notrigger) { //// Call triggers //include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php'; //$interface=new Interfaces($this->db); //$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf); //if ($result < 0) { $error++; $this->errors=$interface->errors; } //// End call triggers - } - } + //} // Commit or rollback if ($error) @@ -439,12 +428,9 @@ class PaymentTerm // extends CommonObject $error++; } - if (! $error) - { - - - - } + //if (! $error) + //{ + //} unset($this->context['createfromclone']); diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 3fa091e0665..a8eadd76a93 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -664,7 +664,7 @@ if (empty($reshook)) if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); @@ -744,7 +744,7 @@ if (empty($reshook)) } } - elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) + elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -831,7 +831,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); // Check price is not lower than minimum (check is done only for standard or replacement invoices) - if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error ++; @@ -1626,7 +1626,7 @@ else // Lines print ' - + '; diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3fdfbc0c514..2e5cb83883f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -903,6 +903,7 @@ if ($resql) print "\n"; $projectstatic=new Project($db); + $discount = new DiscountAbsolute($db); if ($num > 0) { @@ -913,6 +914,7 @@ if ($resql) $obj = $db->fetch_object($resql); $datelimit=$db->jdate($obj->datelimite); + $facturestatic->id=$obj->id; $facturestatic->ref=$obj->ref; $facturestatic->type=$obj->type; @@ -920,6 +922,9 @@ if ($resql) $facturestatic->total_tva=$obj->total_vat; $facturestatic->total_ttc=$obj->total_ttc; $facturestatic->statut=$obj->fk_statut; + $facturestatic->total_ttc=$obj->total_ttc; + $facturestatic->paye=$obj->paye; + $facturestatic->fk_soc=$obj->fk_soc; $facturestatic->date_lim_reglement=$db->jdate($obj->datelimite); $facturestatic->note_public=$obj->note_public; $facturestatic->note_private=$obj->note_private; @@ -939,7 +944,12 @@ if ($resql) $totalcreditnotes = $facturestatic->getSumCreditNotesUsed(); $totaldeposits = $facturestatic->getSumDepositsUsed(); $totalpay = $paiement + $totalcreditnotes + $totaldeposits; - $remaintopay = $obj->total_ttc - $totalpay; + $remaintopay = $facturestatic->total_ttc - $totalpay; + if ($facturestatic->type == Facture::TYPE_CREDIT_NOTE && $obj->paye == 1) { + $remaincreditnote = $discount->getAvailableDiscounts($obj->fk_soc, '', 'rc.fk_facture_source='.$facturestatic->id); + $remaintopay = -$remaincreditnote; + $totalpay = $facturestatic->total_ttc - $remaintopay; + } print ''; if (! empty($arrayfields['f.facnumber']['checked'])) @@ -948,12 +958,10 @@ if ($resql) print '
'; @@ -170,6 +173,8 @@ foreach($fulltree as $key => $val) } +//print_barre_liste('', 0, $_SERVER["PHP_SELF"], '', '', '', '', 0, 0, '', 0, $newcardbutton, '', 0, 1, 1); + print ''; print ''; + + print ''; } if (!empty($origin) && !empty($originid)) @@ -1270,10 +1311,41 @@ if ($id > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; print ''; print ''; - print ''; + + if ($object->elementtype == 'task' && ! empty($conf->projet->enabled)) + { + print ''; + } + else + { + print ''; + } + print ''; } diff --git a/htdocs/comm/action/class/actioncomm.class.php b/htdocs/comm/action/class/actioncomm.class.php index 7b9caabb8a9..c175ad900ea 100644 --- a/htdocs/comm/action/class/actioncomm.class.php +++ b/htdocs/comm/action/class/actioncomm.class.php @@ -1166,58 +1166,58 @@ class ActionComm extends CommonObject if ($mode == 0) { if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); - else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; - else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; - else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; + elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%)'; + elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%)'; + elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%)'; } - else if ($mode == 1) + elseif ($mode == 1) { if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable'); - else if ($percent==0) return $langs->trans('StatusActionToDo'); - else if ($percent > 0 && $percent < 100) return $percent.'%'; - else if ($percent >= 100) return $langs->trans('StatusActionDone'); + elseif ($percent==0) return $langs->trans('StatusActionToDo'); + elseif ($percent > 0 && $percent < 100) return $percent.'%'; + elseif ($percent >= 100) return $langs->trans('StatusActionDone'); } - else if ($mode == 2) + elseif ($mode == 2) { if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); - else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo'); - else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%'; - else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone'); + elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo'); + elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '. $percent.'%'; + elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone'); } - else if ($mode == 3) + elseif ($mode == 3) { if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans("Status").': '.$langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1'); - else if ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); - else if ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6'); + elseif ($percent==0) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionToDo').' (0%)','statut1'); + elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)','statut3'); + elseif ($percent >= 100) return img_picto($langs->trans("Status").': '.$langs->trans('StatusActionDone').' (100%)','statut6'); } - else if ($mode == 4) + elseif ($mode == 4) { if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9').' '.$langs->trans('StatusNotApplicable'); - else if ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)'; - else if ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)'; - else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)'; + elseif ($percent==0) return img_picto($langs->trans('StatusActionToDo'),'statut1').' '.$langs->trans('StatusActionToDo').' (0%)'; + elseif ($percent > 0 && $percent < 100) return img_picto($langs->trans('StatusActionInProcess'),'statut3').' '.$langs->trans('StatusActionInProcess').' ('.$percent.'%)'; + elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6').' '.$langs->trans('StatusActionDone').' (100%)'; } - else if ($mode == 5) + elseif ($mode == 5) { if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); - else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); - else if ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6'); + elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + elseif ($percent >= 100) return $langs->trans('StatusActionDone').' '.img_picto($langs->trans('StatusActionDone'),'statut6'); } - else if ($mode == 6) + elseif ($mode == 6) { if ($percent==-1 && ! $hidenastatus) return $langs->trans('StatusNotApplicable').' '.img_picto($langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1'); - else if ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); - else if ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); + elseif ($percent==0) return $langs->trans('StatusActionToDo').' (0%) '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + elseif ($percent > 0 && $percent < 100) return $langs->trans('StatusActionInProcess').' ('.$percent.'%) '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + elseif ($percent >= 100) return $langs->trans('StatusActionDone').' (100%) '.img_picto($langs->trans('StatusActionDone'),'statut6'); } - else if ($mode == 7) + elseif ($mode == 7) { if ($percent==-1 && ! $hidenastatus) return img_picto($langs->trans('StatusNotApplicable'),'statut9'); - else if ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); - else if ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); - else if ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); + elseif ($percent==0) return '0% '.img_picto($langs->trans('StatusActionToDo'),'statut1'); + elseif ($percent > 0 && $percent < 100) return $percent.'% '.img_picto($langs->trans('StatusActionInProcess').' - '.$percent.'%','statut3'); + elseif ($percent >= 100) return img_picto($langs->trans('StatusActionDone'),'statut6'); } return ''; @@ -1564,8 +1564,8 @@ class ActionComm extends CommonObject // Write file if ($format == 'vcal') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); - if ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); - if ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp); + elseif ($format == 'ical') $result=build_calfile($format,$title,$desc,$eventarray,$outputfiletmp); + elseif ($format == 'rss') $result=build_rssfile($format,$title,$desc,$eventarray,$outputfiletmp); if ($result >= 0) { diff --git a/htdocs/comm/action/class/actioncommreminder.class.php b/htdocs/comm/action/class/actioncommreminder.class.php index 63773661cbd..6c9632d83e5 100644 --- a/htdocs/comm/action/class/actioncommreminder.class.php +++ b/htdocs/comm/action/class/actioncommreminder.class.php @@ -189,32 +189,32 @@ class ActionCommReminder extends CommonObject if ($mode == 0 || $mode == 1) { if ($status == 1) return $langs->trans('Done'); - if ($status == 0) return $langs->trans('ToDo'); + elseif ($status == 0) return $langs->trans('ToDo'); } elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); - if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); + elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); } elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4'); - if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5'); + elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5'); } elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Done'),'statut4').' '.$langs->trans('Done'); - if ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); + elseif ($status == 0) return img_picto($langs->trans('ToDo'),'statut5').' '.$langs->trans('ToDo'); } elseif ($mode == 5) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); - if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); + elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); } elseif ($mode == 6) { if ($status == 1) return $langs->trans('Done').' '.img_picto($langs->trans('Done'),'statut4'); - if ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); + elseif ($status == 0) return $langs->trans('ToDo').' '.img_picto($langs->trans('ToDo'),'statut5'); } } diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 7e27c0d924c..b6e02861c9b 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -83,7 +83,7 @@ $resourceid=GETPOST("resourceid","int"); $year=GETPOST("year","int")?GETPOST("year","int"):date("Y"); $month=GETPOST("month","int")?GETPOST("month","int"):date("m"); $week=GETPOST("week","int")?GETPOST("week","int"):date("W"); -$day=GETPOST("day","int")?GETPOST("day","int"):0; +$day=GETPOST("day","int")?GETPOST("day","int"):date("d"); $pid=GETPOST("projectid","int",3); $status=GETPOST("status",'aZ09'); // status may be 0, 50, 100, 'todo' $type=GETPOST("type",'az09'); @@ -109,16 +109,15 @@ if ($action == 'default') // When action is default, we want a calendar view and { $action = (($defaultview != 'show_list') ? $defaultview : 'show_month'); } - -if (GETPOST('viewcal') && $action != 'show_day' && $action != 'show_week') { +if (GETPOST('viewcal','none') && GETPOST('action','alpha') != 'show_day' && GETPOST('action','alpha') != 'show_week') { $action='show_month'; $day=''; -} // View by month -if (GETPOST('viewweek') || $action == 'show_week') { +} // View by month +if (GETPOST('viewweek','none') || GETPOST('action','alpha') == 'show_week') { $action='show_week'; $week=($week?$week:date("W")); $day=($day?$day:date("d")); -} // View by week -if (GETPOST('viewday') || $action == 'show_day') { +} // View by week +if (GETPOST('viewday','none') || GETPOST('action','alpha') == 'show_day') { $action='show_day'; $day=($day?$day:date("d")); -} // View by day +} // View by day // Load translation files required by the page $langs->loadLangs(array('agenda', 'other', 'commercial')); diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index 5874a7b855c..596c3cb3c5b 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -666,6 +666,8 @@ if ($object->id > 0) */ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { + $langs->load("propal"); + $sql = "SELECT s.nom, s.rowid, p.rowid as propalid, p.fk_statut, p.total_ht"; $sql.= ", p.tva as total_tva"; $sql.= ", p.total as total_ttc"; @@ -674,7 +676,7 @@ if ($object->id > 0) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as p, ".MAIN_DB_PREFIX."c_propalst as c"; $sql.= " WHERE p.fk_soc = s.rowid AND p.fk_statut = c.id"; $sql.= " AND s.rowid = ".$object->id; - $sql.= " AND p.entity = ".$conf->entity; + $sql.= " AND p.entity IN (".getEntity('propal').")"; $sql.= " ORDER BY p.datep DESC"; $resql=$db->query($sql); diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 469db6f2a54..a2e63da99cc 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -874,7 +874,7 @@ else } } - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; $nbtry = $nbok = 0; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 7a0d758ae17..bb6ac93d1c2 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -530,6 +530,81 @@ class Mailing extends CommonObject } + /** + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param string $option On what the link point to ('nolink', ...) + * @param int $notooltip 1=Disable tooltip + * @param string $morecss Add more css on link + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL + */ + function getNomUrl($withpicto=0, $option='', $notooltip=0, $morecss='', $save_lastsearch_value=-1) + { + global $db, $conf, $langs, $hookmanager; + global $dolibarr_main_authentication, $dolibarr_main_demo; + global $menumanager; + + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips + + $result = ''; + $companylink = ''; + + $label = '' . $langs->trans("ShowEmailing") . ''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/comm/mailing/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowEmailing"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('myobjectdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend=''; + + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action; + $hookmanager->initHooks(array('emailingdao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; + + return $result; + } + /** * Return label of status of emailing (draft, validated, ...) * diff --git a/htdocs/comm/mailing/list.php b/htdocs/comm/mailing/list.php index 5087698b9ab..133a354723f 100644 --- a/htdocs/comm/mailing/list.php +++ b/htdocs/comm/mailing/list.php @@ -35,15 +35,15 @@ $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); -if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +if (empty($page) || $page == -1 || GETPOST('button_search','alpha') || GETPOST('button_removefilter','alpha') || (empty($toselect) && $massaction === '0')) { $page = 0; } // If $page is not defined, or '' or -1 or if we click on clear filters or if we select empty mass action $offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="m.date_creat"; -$sall=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); -$sref=GETPOST("sref", "alpha"); +$search_all=trim((GETPOST('search_all', 'alphanohtml')!='')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); +$search_ref=GETPOST("search_ref", "alpha") ? GETPOST("search_ref", "alpha") : GETPOST("sref", "alpha"); $filteremail=GETPOST('filteremail','alpha'); // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context @@ -59,6 +59,53 @@ $fieldstosearchall = array( 'm.titre'=>'Ref', ); +$object = new Mailing($db); + + + +/* + * Actions + */ + +if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Purge search criteria + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers + { + /*foreach($object->fields as $key => $val) + { + $search[$key]=''; + }*/ + $search_ref = ''; + $search_all = ''; + $toselect=''; + $search_array_options=array(); + } + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha') + || GETPOST('button_search_x','alpha') || GETPOST('button_search.x','alpha') || GETPOST('button_search','alpha')) + { + $massaction=''; // Protection to avoid mass action if we force a new search during a mass action confirmation + } + + // Mass actions + /*$objectclass='MyObject'; + $objectlabel='MyObject'; + $permtoread = $user->rights->mymodule->read; + $permtodelete = $user->rights->mymodule->delete; + $uploaddir = $conf->mymodule->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + */ +} /* @@ -76,8 +123,8 @@ if ($filteremail) $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m, ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql.= " WHERE m.rowid = mc.fk_mailing AND m.entity = ".$conf->entity; $sql.= " AND mc.email = '".$db->escape($filteremail)."'"; - if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'"; - if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')"; + if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'"; + if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="m.rowid"; $sql.= $db->order($sortfield,$sortorder); @@ -88,8 +135,8 @@ else $sql = "SELECT m.rowid, m.titre, m.nbemail, m.statut, m.date_creat as datec, m.date_envoi as date_envoi"; $sql.= " FROM ".MAIN_DB_PREFIX."mailing as m"; $sql.= " WHERE m.entity = ".$conf->entity; - if ($sref) $sql.= " AND m.rowid = '".$db->escape($sref)."'"; - if ($sall) $sql.= " AND (m.titre like '%".$db->escape($sall)."%' OR m.sujet like '%".$db->escape($sall)."%' OR m.body like '%".$db->escape($sall)."%')"; + if ($search_ref) $sql.= " AND m.rowid = '".$db->escape($search_ref)."'"; + if ($search_all) $sql.= " AND (m.titre like '%".$db->escape($search_all)."%' OR m.sujet like '%".$db->escape($search_all)."%' OR m.body like '%".$db->escape($search_all)."%')"; if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="m.rowid"; $sql.= $db->order($sortfield,$sortorder); @@ -115,7 +162,7 @@ if ($result) $i = 0; - $param = "&sall=".urlencode($sall); + $param = "&search_all=".urlencode($search_all); if ($filteremail) $param.='&filteremail='.urlencode($filteremail); print ''; @@ -135,11 +182,11 @@ if ($result) print ''; print ''; // Title print ''; print ''; if (! $filteremail) print ''; @@ -169,16 +216,22 @@ if ($result) { $obj = $db->fetch_object($result); - + $email->id = $obj->rowid; + $email->ref = $obj->rowid; print ""; - print ''; + + print ''; + print ''; // Date creation + print ''; + // Nb of email if (! $filteremail) { @@ -196,9 +249,11 @@ if ($result) print $nbemail; print ''; } + // Last send print ''; print ''; + // Status print ''; + print ''; + print "\n"; $i++; } diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 30fa8d74a8d..b87c1b0c066 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -993,7 +993,7 @@ if (empty($reshook)) if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { @@ -1057,7 +1057,7 @@ if (empty($reshook)) } // Update a line within proposal - else if ($action == 'updateligne' && $usercancreate && GETPOST('save')) + else if ($action == 'updateline' && $usercancreate && GETPOST('save')) { // Define info_bits $info_bits = 0; @@ -1112,8 +1112,7 @@ if (empty($reshook)) $price_min = $product->multiprices_min [$object->thirdparty->price_level]; $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - - if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error ++; } @@ -1194,7 +1193,7 @@ if (empty($reshook)) } } - else if ($action == 'updateligne' && $usercancreate && GETPOST('cancel','alpha')) + else if ($action == 'updateline' && $usercancreate && GETPOST('cancel','alpha')) { header('Location: ' . $_SERVER['PHP_SELF'] . '?id=' . $object->id); // Pour reaffichage de la fiche en cours d'edition exit(); @@ -1848,7 +1847,7 @@ if ($action == 'create') $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $usercancreate, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherProposals").')'; + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherProposals").')'; // Project if (! empty($conf->projet->enabled)) { @@ -2284,7 +2283,7 @@ if ($action == 'create') print ' - + '; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 45e139c0b4f..263a425ff01 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -13,6 +13,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2014-2015 Marcos García * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Frédéric France * * 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 @@ -1032,6 +1033,7 @@ class Propal extends CommonObject // Add linked object (deprecated, use ->linkedObjectsIds instead) if (! $error && $this->origin && $this->origin_id) { + dol_syslog('Deprecated use of linked object, use ->linkedObjectsIds instead', LOG_WARNING); $ret = $this->add_object_linked(); if (! $ret) dol_print_error($this->db); } @@ -1104,13 +1106,6 @@ class Propal extends CommonObject } } - // Add linked object - if (! $error && $this->origin && $this->origin_id) - { - $ret = $this->add_object_linked(); - if (! $ret) dol_print_error($this->db); - } - // Set delivery address if (! $error && $this->fk_delivery_address) { @@ -1625,6 +1620,7 @@ class Propal extends CommonObject $line->product_type = $objp->product_type; $line->label = $objp->custom_label; $line->desc = $objp->description; // Description ligne + $line->description = $objp->description; // Description ligne $line->qty = $objp->qty; $line->vat_src_code = $objp->vat_src_code; $line->tva_tx = $objp->tva_tx; @@ -3174,18 +3170,18 @@ class Propal extends CommonObject $statuttrans=''; if ($statut==self::STATUS_DRAFT) $statuttrans='statut0'; - if ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; - if ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; - if ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; - if ($statut==self::STATUS_BILLED) $statuttrans='statut6'; + elseif ($statut==self::STATUS_VALIDATED) $statuttrans='statut1'; + elseif ($statut==self::STATUS_SIGNED) $statuttrans='statut3'; + elseif ($statut==self::STATUS_NOTSIGNED) $statuttrans='statut5'; + elseif ($statut==self::STATUS_BILLED) $statuttrans='statut6'; if ($mode == 0) return $this->labelstatut[$statut]; - if ($mode == 1) return $this->labelstatut_short[$statut]; - if ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; - if ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); - if ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; - if ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); - if ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 1) return $this->labelstatut_short[$statut]; + elseif ($mode == 2) return img_picto($this->labelstatut_short[$statut], $statuttrans).' '.$this->labelstatut_short[$statut]; + elseif ($mode == 3) return img_picto($this->labelstatut[$statut], $statuttrans); + elseif ($mode == 4) return img_picto($this->labelstatut[$statut],$statuttrans).' '.$this->labelstatut[$statut]; + elseif ($mode == 5) return ''.$this->labelstatut_short[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); + elseif ($mode == 6) return ''.$this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],$statuttrans); } @@ -3555,103 +3551,13 @@ class Propal extends CommonObject } /** - * Retrieve an array of propal lines + * Retrieve an array of proposal lines * * @return int >0 if OK, <0 if KO */ function getLinesArray() { return $this->fetch_lines(); - /* - $this->lines = array(); - - $sql = 'SELECT pt.rowid, pt.label as custom_label, pt.description, pt.fk_product, pt.fk_remise_except,'; - $sql.= ' pt.qty, pt.vat_src_code, pt.tva_tx, pt.localtax1_tx, pt.localtax2_tx, pt.localtax1_type, pt.localtax2_type, pt.remise_percent, pt.subprice, pt.info_bits,'; - $sql.= ' pt.total_ht, pt.total_tva, pt.total_ttc, pt.total_localtax1, pt.total_localtax2, pt.fk_product_fournisseur_price as fk_fournprice, pt.buy_price_ht as pa_ht, pt.special_code,'; - $sql.= ' pt.date_start, pt.date_end, pt.product_type, pt.rang, pt.fk_parent_line,'; - $sql.= ' pt.fk_unit,'; - $sql.= ' p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.description as product_desc, p.tobatch as product_tobatch,'; - $sql.= ' p.entity,'; - $sql.= ' pt.fk_multicurrency, pt.multicurrency_code, pt.multicurrency_subprice, pt.multicurrency_total_ht, pt.multicurrency_total_tva, pt.multicurrency_total_ttc'; - $sql.= ' FROM '.MAIN_DB_PREFIX.'propaldet as pt'; - $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON pt.fk_product=p.rowid'; - $sql.= ' WHERE pt.fk_propal = '.$this->id; - $sql.= ' ORDER BY pt.rang ASC, pt.rowid'; - - dol_syslog(get_class($this).'::getLinesArray', LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $this->lines[$i] = new PropaleLigne($this->db); - $this->lines[$i]->id = $obj->rowid; // for backward compatibility - $this->lines[$i]->rowid = $obj->rowid; - $this->lines[$i]->label = $obj->custom_label; - $this->lines[$i]->desc = $obj->description; - $this->lines[$i]->description = $obj->description; - $this->lines[$i]->fk_product = $obj->fk_product; - $this->lines[$i]->ref = $obj->ref; - $this->lines[$i]->product_ref = $obj->ref; - $this->lines[$i]->entity = $obj->entity; // Product entity - $this->lines[$i]->product_label = $obj->product_label; - $this->lines[$i]->product_desc = $obj->product_desc; - $this->lines[$i]->product_tobatch = $obj->product_tobatch; - $this->lines[$i]->fk_product_type = $obj->fk_product_type; // deprecated - $this->lines[$i]->product_type = $obj->product_type; - $this->lines[$i]->qty = $obj->qty; - $this->lines[$i]->subprice = $obj->subprice; - $this->lines[$i]->fk_remise_except = $obj->fk_remise_except; - $this->lines[$i]->remise_percent = $obj->remise_percent; - - $this->lines[$i]->vat_src_code = $obj->vat_src_code; - $this->lines[$i]->tva_tx = $obj->tva_tx; - $this->lines[$i]->localtax1_tx = $obj->localtax1_tx; - $this->lines[$i]->localtax2_tx = $obj->localtax2_tx; - $this->lines[$i]->localtax1_type = $obj->localtax1_type; - $this->lines[$i]->localtax2_type = $obj->localtax2_type; - $this->lines[$i]->info_bits = $obj->info_bits; - $this->lines[$i]->total_ht = $obj->total_ht; - $this->lines[$i]->total_tva = $obj->total_tva; - $this->lines[$i]->total_ttc = $obj->total_ttc; - $this->lines[$i]->total_localtax1 = $obj->total_localtax1; - $this->lines[$i]->total_localtax2 = $obj->total_localtax2; - $this->lines[$i]->fk_fournprice = $obj->fk_fournprice; - $marginInfos = getMarginInfos($obj->subprice, $obj->remise_percent, $obj->tva_tx, $obj->localtax1_tx, $obj->localtax2_tx, $this->lines[$i]->fk_fournprice, $obj->pa_ht); - $this->lines[$i]->pa_ht = $marginInfos[0]; - $this->lines[$i]->marge_tx = $marginInfos[1]; - $this->lines[$i]->marque_tx = $marginInfos[2]; - $this->lines[$i]->fk_parent_line = $obj->fk_parent_line; - $this->lines[$i]->special_code = $obj->special_code; - $this->lines[$i]->rang = $obj->rang; - $this->lines[$i]->date_start = $this->db->jdate($obj->date_start); - $this->lines[$i]->date_end = $this->db->jdate($obj->date_end); - $this->lines[$i]->fk_unit = $obj->fk_unit; - - // Multicurrency - $this->lines[$i]->fk_multicurrency = $obj->fk_multicurrency; - $this->lines[$i]->multicurrency_code = $obj->multicurrency_code; - $this->lines[$i]->multicurrency_subprice = $obj->multicurrency_subprice; - $this->lines[$i]->multicurrency_total_ht = $obj->multicurrency_total_ht; - $this->lines[$i]->multicurrency_total_tva = $obj->multicurrency_total_tva; - $this->lines[$i]->multicurrency_total_ttc = $obj->multicurrency_total_ttc; - - $i++; - } - $this->db->free($resql); - - return 1; - } - else - { - $this->error=$this->db->error(); - return -1; - }*/ } /** diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index 00db6264377..b7f6bd68493 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -65,9 +65,7 @@ $langs->loadLangs(array('orders', 'companies', 'other', 'suppliers', 'supplier_p $form=new Form($db); $formpropal=new FormPropal($db); -$langs->load('propal'); -$langs->load('other'); -$langs->load("companies"); +$langs->loadLangs(array('propal', 'other', 'companies')); if ($mode == 'customer') { diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0dd266ef186..75b949ff203 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -931,7 +931,7 @@ if (empty($reshook)) if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { @@ -1052,7 +1052,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); - if ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -1989,7 +1989,7 @@ if ($action == 'create' && $user->rights->commande->creer) $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->commande->creer, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $soc->getNomUrl(1); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherOrders").')'; + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherOrders").')'; // Project if (! empty($conf->projet->enabled)) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 65459d37895..39b0f0db2ee 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1917,7 +1917,9 @@ class Commande extends CommonOrder $line->multicurrency_total_tva = $objp->multicurrency_total_tva; $line->multicurrency_total_ttc = $objp->multicurrency_total_ttc; - $this->lines[$i] = $line; + $line->fetch_optionals(); + + $this->lines[$i] = $line; $i++; } diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 311335fd96b..081d674a6a3 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -302,7 +302,7 @@ if (GETPOST('save') && ! $cancel && $user->rights->banque->modifier) $error++; }*/ - if (! $error) + if (! $error && ! empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { $objecttmp = new Account($db); $objecttmp->fetch($bankaccountid); @@ -630,7 +630,7 @@ if ($resql) } // Form to add a transaction with no invoice - if ($user->rights->banque->modifier && $action == 'addline') + if ($user->rights->banque->modifier && $action == 'addline' && ! empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) { print load_fiche_titre($langs->trans("AddBankRecordLong"),'',''); @@ -729,7 +729,7 @@ if ($resql) { if (empty($conf->global->BANK_DISABLE_DIRECT_INPUT)) { - if (! empty($conf->global->BANK_USE_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments + if (empty($conf->global->BANK_USE_OLD_VARIOUS_PAYMENT)) // If direct entries is done using miscellaneous payments { if ($user->rights->banque->modifier) { $newcardbutton = ''.$langs->trans("AddBankRecord").''; diff --git a/htdocs/compta/bank/card.php b/htdocs/compta/bank/card.php index b58619b66a2..2325d30a26a 100644 --- a/htdocs/compta/bank/card.php +++ b/htdocs/compta/bank/card.php @@ -60,7 +60,8 @@ $extrafields = new ExtraFields($db); // fetch optionals attributes and labels $extralabels=$extrafields->fetch_name_optionals_label($object->table_element); - +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('bankcard','globalcard')); /* * Actions diff --git a/htdocs/compta/bank/class/account.class.php b/htdocs/compta/bank/class/account.class.php index 3bd5997506e..b9d19ba5b64 100644 --- a/htdocs/compta/bank/class/account.class.php +++ b/htdocs/compta/bank/class/account.class.php @@ -59,7 +59,7 @@ class Account extends CommonObject public $rowid; /** - * Label + * Account Label * @var string */ public $label; @@ -1716,7 +1716,11 @@ class AccountLine extends CommonObject public $fk_account; // Id of bank account public $bank_account_label; // Label of bank account - public $emetteur; + /** + * Issuer + * @var Societe + */ + public $emetteur; /** * Constructor diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 25a5b06df98..c3b6e942e1a 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -553,18 +553,63 @@ class PaymentVarious extends CommonObject */ function getNomUrl($withpicto=0, $option='', $save_lastsearch_value=-1, $notooltip=0) { + global $db, $conf, $langs, $hookmanager; global $langs; - $result=''; - $label=$langs->trans("ShowVariousPayment").': '.$this->ref; + if (! empty($conf->dol_no_mouse_hover)) $notooltip=1; // Force disable tooltips - $linkstart = ''; + $result=''; + + $label=''.$langs->trans("ShowVariousPayment").''; + $label.= '
'; + $label.= '' . $langs->trans('Ref') . ': ' . $this->ref; + + $url = DOL_URL_ROOT.'/compta/bank/various_payment/card.php?id='.$this->id; + + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMyObject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + + /* + $hookmanager->initHooks(array('myobjectdao')); + $parameters=array('id'=>$this->id); + $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $linkclose = $hookmanager->resPrint; + */ + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = '
'; $linkend=''; $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref.($option == 'reflabel' && $this->label ? ' - '.$this->label : ''); + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; $result .= $linkend; + //if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : ''); + + global $action; + $hookmanager->initHooks(array('variouspayment')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) $result = $hookmanager->resPrint; + else $result .= $hookmanager->resPrint; return $result; } diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index 1f01355050c..0794634e3a3 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -1,6 +1,4 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin @@ -428,7 +426,7 @@ foreach ($accounts as $key=>$type) // Ref if (! empty($arrayfields['b.ref']['checked'])) { - print '
'; + print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/compta/bank/treso.php b/htdocs/compta/bank/treso.php index 2389d1fec77..9bd00c81894 100644 --- a/htdocs/compta/bank/treso.php +++ b/htdocs/compta/bank/treso.php @@ -49,6 +49,9 @@ $result=restrictedArea($user,'banque',$id,'bank_account&bank_account','','',$fie $vline=isset($_GET["vline"])?$_GET["vline"]:$_POST["vline"]; $page=isset($_GET["page"])?$_GET["page"]:0; +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('banktreso','globalcard')); + /* * View */ @@ -130,6 +133,7 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // Remainder to pay in future + $sqls = array(); // Customer invoices $sql = "SELECT 'invoice' as family, f.rowid as objid, f.facnumber as ref, f.total_ttc, f.type, f.date_lim_reglement as dlr,"; @@ -138,79 +142,55 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON f.fk_soc = s.rowid"; $sql.= " WHERE f.entity = ".$conf->entity; $sql.= " AND f.paye = 0 AND f.fk_statut = 1"; // Not paid - $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice - $sql.= " ORDER BY dlr ASC"; + $sql.= " AND (f.fk_account IN (0, ".$object->id.") OR f.fk_account IS NULL)"; // Id bank account of invoice + $sql.= " ORDER BY dlr ASC"; + $sqls[] = $sql; // Supplier invoices - $sql2= " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; - $sql2.= " s.rowid as socid, s.nom as name, s.fournisseur"; - $sql2.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; - $sql2.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; - $sql2.= " WHERE ff.entity = ".$conf->entity; - $sql2.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid - $sql2.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice - $sql2.= " ORDER BY dlr ASC"; + $sql = " SELECT 'invoice_supplier' as family, ff.rowid as objid, ff.ref as ref, ff.ref_supplier as ref_supplier, (-1*ff.total_ttc) as total_ttc, ff.type, ff.date_lim_reglement as dlr,"; + $sql.= " s.rowid as socid, s.nom as name, s.fournisseur"; + $sql.= " FROM ".MAIN_DB_PREFIX."facture_fourn as ff"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON ff.fk_soc = s.rowid"; + $sql.= " WHERE ff.entity = ".$conf->entity; + $sql.= " AND ff.paye = 0 AND fk_statut = 1"; // Not paid + $sql.= " AND (ff.fk_account IN (0, ".$object->id.") OR ff.fk_account IS NULL)"; // Id bank account of supplier invoice + $sql.= " ORDER BY dlr ASC"; + $sqls[] = $sql; // Social contributions - $sql3= " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; - $sql3.= ", cs.fk_account"; - $sql3.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; - $sql3.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; - $sql3.= " WHERE cs.entity = ".$conf->entity; - $sql3.= " AND cs.paye = 0"; // Not paid - $sql3.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution - $sql3.= " ORDER BY dlr ASC"; + $sql = " SELECT 'social_contribution' as family, cs.rowid as objid, cs.libelle as ref, (-1*cs.amount) as total_ttc, ccs.libelle as type, cs.date_ech as dlr"; + $sql.= ", cs.fk_account"; + $sql.= " FROM ".MAIN_DB_PREFIX."chargesociales as cs"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_chargesociales as ccs ON cs.fk_type = ccs.id"; + $sql.= " WHERE cs.entity = ".$conf->entity; + $sql.= " AND cs.paye = 0"; // Not paid + $sql.= " AND (cs.fk_account IN (0, ".$object->id.") OR cs.fk_account IS NULL)"; // Id bank account of social contribution + $sql.= " ORDER BY dlr ASC"; + $sqls[] = $sql; + + // others sql + $parameters = array(); + $reshook = $hookmanager->executeHooks('addMoreSQL', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if(empty($reshook) and isset($hookmanager->resArray['sql'])){ + $sqls[] = $hookmanager->resArray['sql']; + } $error=0; $tab_sqlobjOrder=array(); $tab_sqlobj=array(); - // List customer invoices - $result = $db->query($sql); - if ($result) - { - $num = $db->num_rows($result); - for ($i = 0;$i < $num;$i++) - { - $sqlobj = $db->fetch_object($result); - $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); - } - $db->free($result); - } - else $error++; - - // List supplier invoices - $result2=$db->query($sql2); - if ($result2) - { - $num = $db->num_rows($result2); - for ($i = 0;$i < $num;$i++) - { - $sqlobj = $db->fetch_object($result2); - $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); - } - $db->free($result2); - } - else $error++; - - // List social contributions - $result3=$db->query($sql3); - if ($result3) - { - $num = $db->num_rows($result3); - - for ($i = 0;$i < $num;$i++) - { - $sqlobj = $db->fetch_object($result3); - $tab_sqlobj[] = $sqlobj; - $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); - } - $db->free($result3); - } - else $error++; - + foreach($sqls as $sql){ + $resql = $db->query($sql); + if($resql){ + while($sqlobj = $db->fetch_object($resql)){ + $tab_sqlobj[] = $sqlobj; + $tab_sqlobjOrder[]= $db->jdate($sqlobj->dlr); + } + $db->free($resql); + }else{ + $error++; + } + } // Sort array if (! $error) @@ -228,7 +208,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $num = count($tab_sqlobj); - //$num = $db->num_rows($result); $i = 0; while ($i < $num) { @@ -236,7 +215,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $ref = ''; $refcomp = ''; - //$obj = $db->fetch_object($result); $obj = array_shift($tab_sqlobj); if ($obj->family == 'invoice_supplier') @@ -284,6 +262,14 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) $paiement = -1*$socialcontribstatic->getSommePaiement(); // Payment already done } + $parameters = array('obj' => $obj); + $reshook = $hookmanager->executeHooks('moreFamily', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if(empty($reshook)){ + $ref = isset($hookmanager->resArray['ref']) ? $hookmanager->resArray['ref'] : ''; + $refcomp = isset($hookmanager->resArray['refcomp']) ? $hookmanager->resArray['refcomp'] : ''; + $paiement = isset($hookmanager->resArray['paiement']) ? $hookmanager->resArray['paiement'] : 0; + } + $total_ttc = $obj->total_ttc; if ($paiement) $total_ttc = $obj->total_ttc - $paiement; $solde += $total_ttc; @@ -291,8 +277,6 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) // We discard lines with a remainder to pay to 0 if (price2num($total_ttc) != 0) { - - // Show line print ''; print ''; print ''; print ''; print ''; print "
'.$langs->trans("Categories").''; if (! empty($conf->use_javascript_ajax)) diff --git a/htdocs/comm/action/card.php b/htdocs/comm/action/card.php index 8fd1f1b0030..f968f9800e9 100644 --- a/htdocs/comm/action/card.php +++ b/htdocs/comm/action/card.php @@ -40,6 +40,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php'; require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/task.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; @@ -251,6 +252,19 @@ if ($action == 'add') } } $object->fk_project = isset($_POST["projectid"])?$_POST["projectid"]:0; + + $taskid = GETPOST('taskid','int'); + if(!empty($taskid)){ + + $taskProject = new Task($db); + if($taskProject->fetch($taskid)>0){ + $object->fk_project = $taskProject->fk_project; + } + + $object->fk_element = $taskid; + $object->elementtype = 'task'; + } + $object->datep = $datep; $object->datef = $datef; $object->percentage = $percentage; @@ -876,11 +890,38 @@ if ($action == 'create') { // Projet associe $langs->load("projects"); + + $projectid = GETPOST('projectid', 'int'); - print '
'.$langs->trans("Project").''; + print '
'.$langs->trans("Project").''; - $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), GETPOST("projectid")?GETPOST("projectid"):'', 'projectid', 0, 0, 1, 1); + $numproject=$formproject->select_projects((! empty($societe->id)?$societe->id:-1), $projectid, 'projectid', 0, 0, 1, 1); + print '   '.$langs->trans("AddProject").''; + $urloption='?action=create'; + $url = dol_buildpath('comm/action/card.php',2).$urloption; + + // update task list + print "\n".''."\n"; + + print '
'.$langs->trans("Task").''; + + $projectsListId=false; + if(!empty($projectid)){ $projectsListId=$projectid; } + $tid=GETPOST("projecttaskid")?GETPOST("projecttaskid"):''; + $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $tid, 'taskid', 24, 0, '1', 1, 0, 0, 'maxwidth500',$projectsListId); print '
'.$langs->trans("LinkedObject").''.dolGetElementUrl($object->fk_element,$object->elementtype,1); - print ''; - print ''; - print ''; + + $urloption='?action=create'; // we use create not edit for more flexibility + $url = DOL_URL_ROOT.'/comm/action/card.php'.$urloption; + + // update task list + print "\n".''."\n"; + + $formproject->selectTasks((! empty($societe->id)?$societe->id:-1), $object->fk_element, 'fk_element', 24, 0, 0, 1, 0, 0, 'maxwidth500',$object->fk_project); + print ''; + + print ''; + print dolGetElementUrl($object->fk_element,$object->elementtype,1); + print ''; + print ''; + print '
'; - print ''; + print ''; print ''; - print ''; + print ''; print '  
'; - print img_object($langs->trans("ShowEMail"),"email").' '.stripslashes($obj->rowid).''; + print $email->getNomUrl(1); + print ''.$obj->titre.''; print dol_print_date($db->jdate($obj->datec),'day'); print ''.dol_print_date($db->jdate($obj->date_envoi),'day').''; if ($filteremail) @@ -210,7 +265,9 @@ if ($result) print $email->LibStatut($obj->statut,5); } print '
'.$obj->getNomUrl(1).''.$obj->getNomUrl(1).'
'; @@ -315,15 +299,22 @@ if ($_REQUEST["account"] || $_REQUEST["ref"]) dol_print_error($db); } - // Solde actuel + // Other lines + $parameters = array('solde' => $solde); + $reshook = $hookmanager->executeHooks('printObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + if(empty($reshook)){ + print $hookmanager->resPrint; + $solde = isset($hookmanager->resArray['solde']) ? $hookmanager->resArray['solde'] : $solde; + } + // solde print '
'.$langs->trans("FutureBalance").' ('.$object->currency_code.')'.price($solde, 0, $langs, 0, 0, -1, $object->currency_code).'
"; - print ""; + print ""; } else { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 33757c67c6a..0f417777417 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -86,7 +86,7 @@ if (empty($reshook)) { if ($action != 'addlink') { - $urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/index.php',1); + $urltogo=$backtopage?$backtopage:dol_buildpath('/compta/bank/various_payment/list.php',1); header("Location: ".$urltogo); exit; } @@ -155,7 +155,8 @@ if (empty($reshook)) if ($ret > 0) { $db->commit(); - header("Location: index.php"); + $urltogo=($backtopage ? $backtopage : DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); + header("Location: ".$urltogo); exit; } else @@ -190,7 +191,7 @@ if (empty($reshook)) if ($result >= 0) { $db->commit(); - header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/index.php'); + header("Location: ".DOL_URL_ROOT.'/compta/bank/various_payment/list.php'); exit; } else @@ -376,7 +377,7 @@ if ($id) { $langs->load("projects"); $morehtmlref.=$langs->trans('Project') . ' '; - if ($user->rights->tax->charges->creer) + if ($user->rights->banque->modifier) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; @@ -395,16 +396,14 @@ if ($id) if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref.=$proj->getNomUrl(1); } else { $morehtmlref.=''; } } } $morehtmlref.=''; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); diff --git a/htdocs/compta/bank/various_payment/document.php b/htdocs/compta/bank/various_payment/document.php index faa9a8ed199..c255ef19c16 100644 --- a/htdocs/compta/bank/various_payment/document.php +++ b/htdocs/compta/bank/various_payment/document.php @@ -27,6 +27,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); @@ -81,15 +82,15 @@ if ($object->id) { $head=various_payment_prepare_head($object); - dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), 0, 'payment'); + dol_fiche_head($head, 'documents', $langs->trans("VariousPayment"), -1, 'payment'); $morehtmlref='
'; // Project if (! empty($conf->projet->enabled)) { $langs->load("projects"); - $morehtmlref.=$langs->trans('Project') . ' '; - if ($user->rights->tax->charges->creer) + $morehtmlref.=$langs->trans('Project') . ' : '; + if ($user->rights->banque->modifier && 0) { if ($action != 'classify') $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; @@ -108,16 +109,14 @@ if ($object->id) if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref.=$proj->getNomUrl(1); } else { $morehtmlref.=''; } } } $morehtmlref.='
'; - $linkback = ''.$langs->trans("BackToList").''; + $linkback = ''.$langs->trans("BackToList").''; dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); diff --git a/htdocs/compta/bank/various_payment/info.php b/htdocs/compta/bank/various_payment/info.php index c39a6379000..d9f8709b155 100644 --- a/htdocs/compta/bank/various_payment/info.php +++ b/htdocs/compta/bank/various_payment/info.php @@ -25,6 +25,7 @@ require '../../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/bank.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array("compta", "banks", "bills", "users", "accountancy")); @@ -49,9 +50,50 @@ $object->info($id); $head = various_payment_prepare_head($object); -dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), 0, 'payment'); +dol_fiche_head($head, 'info', $langs->trans("VariousPayment"), -1, 'payment'); +$morehtmlref='
'; +// Project +if (! empty($conf->projet->enabled)) +{ + $langs->load("projects"); + $morehtmlref.=$langs->trans('Project') . ' : '; + if ($user->rights->banque->modifier && 0) + { + if ($action != 'classify') + $morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects(0, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1); + } + } else { + if (! empty($object->fk_project)) { + $proj = new Project($db); + $proj->fetch($object->fk_project); + $morehtmlref.=$proj->getNomUrl(1); + } else { + $morehtmlref.=''; + } + } +} +$morehtmlref.='
'; +$linkback = ''.$langs->trans("BackToList").''; + +dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', $morehtmlref, '', 0, '', $morehtmlright); + +print '
'; +print '
'; + +print '
'; + print '
'; dol_print_object_info($object); print '
'; diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/list.php similarity index 99% rename from htdocs/compta/bank/various_payment/index.php rename to htdocs/compta/bank/various_payment/list.php index 7e3f921b67f..91608666601 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/list.php @@ -18,7 +18,7 @@ */ /** - * \file htdocs/compta/bank/various_payment/index.php + * \file htdocs/compta/bank/various_payment/list.php * \ingroup bank * \brief List of various payments */ diff --git a/htdocs/compta/compta-files.php b/htdocs/compta/compta-files.php new file mode 100644 index 00000000000..9e00bf10ae0 --- /dev/null +++ b/htdocs/compta/compta-files.php @@ -0,0 +1,318 @@ + + * Copyright (C) 2004-2018 Laurent Destailleur + * Copyright (C) 2017 Pierre-Henry Favre + * + * 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 . + */ +/** + * \file htdocs/compta/compta-files.php + * \ingroup compta + * \brief Page to show portoflio and files of a thirdparty and download it + */ +require '../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/fourn/class/fournisseur.facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/sociales/class/chargesociales.class.php'; + +restrictedArea($user,'banque'); + +$langs->load("companies"); +if (! empty($conf->facture->enabled)) $langs->load("bills"); +$date_start =GETPOST('date_start','alpha'); +$date_startDay= GETPOST('date_startday','int'); +$date_startMonth= GETPOST('date_startmonth','int'); +$date_startYear= GETPOST('date_startyear','int'); +$date_start=($date_startDay)?dol_mktime(0,0,0,$date_startMonth,$date_startDay,$date_startYear):strtotime($date_start); +$date_stop =GETPOST('date_stop','alpha'); +$date_stopDay= GETPOST('date_stopday','int'); +$date_stopMonth= GETPOST('date_stopmonth','int'); +$date_stopYear= GETPOST('date_stopyear','int'); +//FIXME doldate +$date_stop=($date_stopDay)?dol_mktime(0,0,0,$date_stopMonth,$date_stopDay,$date_stopYear):strtotime($date_stop); +$action =GETPOST('action','alpha'); +// Security check +//if ($user->societe_id) $id=$user->societe_id; +//$result = restrictedArea($user, 'societe', $id, '&societe'); +//$object = new Societe($db); +//if ($id > 0) $object->fetch($id); +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array('comptafilescard','globalcard')); +// Load variable for pagination +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield = GETPOST('sortfield','alpha'); +$sortorder = GETPOST('sortorder','alpha'); +$page = GETPOST('page','int'); +if (empty($page) || $page == -1) { $page = 0; } // If $page is not defined, or '' or -1 +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; +if (! $sortfield) $sortfield="f.datef,f.rowid"; // Set here default search field +if (! $sortorder) $sortorder="DESC"; +$arrayfields=array( + 'date'=>array('label'=>"Date", 'checked'=>1), + //... +); + + +/* + * Actions + */ + +//$parameters = array('socid' => $id); +//$reshook = $hookmanager->executeHooks('doActions', $parameters, $object); // Note that $object may have been modified by some hooks +//if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + + + +/* + * View + */ + +$filesarray=array(); +$result=false; +if(($action=="searchfiles"||$action=="dl" ) && $date_start && $date_stop){ + $wheretail=" '".$db->idate($date_start)."' AND '".$db->idate($date_stop)."'"; + $sql="SELECT rowid as id, facnumber as ref,paye as paid,total_ttc,fk_soc,datef as date, 'Invoice' as item FROM ".MAIN_DB_PREFIX."facture"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id,ref, paye as paid, total_ttc, fk_soc,datef as date, 'InvoiceSupplier' as item FROM ".MAIN_DB_PREFIX."facture_fourn"; + $sql.=" WHERE datef between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id,ref,paid,total_ttc,fk_user_author as fk_soc,date_fin as date,'Expense' as item FROM ".MAIN_DB_PREFIX."expensereport"; + $sql.=" WHERE date_fin between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id,ref,paid,amount as total_ttc,CONCAT(firstname,' ',lastname) as fk_soc,datedon as date,'Donation' as item FROM ".MAIN_DB_PREFIX."don"; + $sql.=" WHERE datedon between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id,label as ref,1 as paid,amount as total_ttc,fk_user as fk_soc,datep as date,'Salary' as item FROM ".MAIN_DB_PREFIX."payment_salary"; + $sql.=" WHERE datep between ".$wheretail; + $sql.=" UNION ALL"; + $sql.=" SELECT rowid as id,num_paiement as ref,1 as paid,amount as total_ttc,fk_charge as fk_soc,datep as date,'Charge' as item FROM ".MAIN_DB_PREFIX."paiementcharge"; + $sql.=" WHERE datep between ".$wheretail; + $resd = $db->query($sql); + $files=array(); + $link=''; + + if ($resd) + { + $numd = $db->num_rows($resd); + + $upload_dir =''; + $i=0; + while($i<$numd) + { + + + $objd = $db->fetch_object($resd); + + switch($objd->item){ + case "Invoice": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->facture->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=facture&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "InvoiceSupplier": + $subdir=get_exdir($objd->id,2,0,0,$objd,'invoice_supplier').dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->fournisseur->facture->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=facture_fournisseur&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Expense": + $subdir=dol_sanitizeFileName($objd->ref); + $upload_dir = $conf->expensereport->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=expensereport&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Salary": + $subdir=dol_sanitizeFileName($objd->id); + $upload_dir = $conf->salaries->dir_output.'/'.$subdir; + $link="../../document.php?modulepart=salaries&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Donation": + $subdir=get_exdir(null,2,0,1,$objd,'donation'). '/'. dol_sanitizeFileName($objd->id); + $upload_dir = $conf->don->dir_output . '/' . $subdir; + $link="../../document.php?modulepart=don&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + case "Charge": + $subdir=dol_sanitizeFileName($objd->id); + $upload_dir = $conf->tax->dir_output . '/' . $subdir; + $link="../../document.php?modulepart=tax&file=".str_replace('/','%2F',$subdir).'%2F'; + break; + default: + break; + } + + if(!empty($upload_dir)){ + $result=true; + $files=dol_dir_list($upload_dir,"files",0,'','(\.meta|_preview\.png)$','',SORT_ASC,1); + foreach ($files as $key => $file){ + $file['date']=$db->idate($objd->date); + $file['paid']=$objd->paid; + $file['amount']=$objd->total_ttc; + $file['ref']=$objd->ref; + $file['fk']=$objd->fk_soc; + $file['item']=$objd->item; + $file['link']=$link.$file['name']; + $out.= '
'.$file['name'].''; + $filesarray[]=$file; + } + if(count($files)<1){ + $nofile['date']=$db->idate($objd->date); + $nofile['paid']=$objd->paid; + $nofile['amount']=$objd->total_ttc; + $nofile['ref']=$objd->ref; + $nofile['fk']=$objd->fk_soc; + $nofile['item']=$objd->item; + $filesarray[]=$nofile; + } + } + $i++; + } + } + $db->free($resd); + +} +/* + * cleanup of old ZIP + */ +//FIXME +/* +*ZIP creation +*/ +if($result & $action=="dl"){ + unset($zip); + $log='date,type,ref,total,paid,filename,item_id'."\n"; + $zipname = ($date_start)."-".($date_stop).'_export.zip'; + $zip = new ZipArchive; + $res = $zip->open($zipname, ZipArchive::OVERWRITE|ZipArchive::CREATE); + if ($res){ + foreach ($filesarray as $key=> $file) { + if(file_exists($file["fullname"])) $zip->addFile($file["fullname"],$file["name"]);// + $log.=$file['date'].','.$file['item'].','.$file['ref'].','.$file['amount'].','.$file['paid'].','.$file["name"].','.$file['fk']."\n"; + } + $zip->addFromString('log.csv', $log); + $zip->close(); + ///Then download the zipped file. + header('Content-Type: application/zip'); + header('Content-disposition: attachment; filename='.$zipname); + header('Content-Length: ' . filesize($zipname)); + readfile($zipname); + unlink($zipname); + exit(); + } +} +// None +/* + * View + */ +$form = new Form($db); +$userstatic=new User($db); +$title=$langs->trans("ComptaFiles").' - '.$langs->trans("List"); +//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name.' - '.$langs->trans("Symmary"); +$help_url='EN:Module_Accounting|FR:Module_Compatibilite'; //FIXME +llxHeader('',$title,$help_url); +print ''."\n\t\t"; +if (!empty($date_start) && !empty($date_stop))echo dol_print_date($date_start)." - ".dol_print_date($date_stop); +print ''; +print ''; +//if (! empty($arrayfields['f.datef']['checked'])) +print_liste_field_titre($arrayfields['date']['label'],$_SERVER["PHP_SELF"],"date","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +if ($result) +{ + $TData = dol_sort_array($filesarray, 'date', 'ASC'); + if(empty($TData)) { + print ''; + } else { + // Sort array by date ASC to calucalte balance + + $totalDebit = 0; + $totalCredit = 0; + // Balance calculation + $balance = 0; + foreach($TData as &$data1) { + if($data1['item']!='Invoice'&& $data1['item']!='Donation' ){ + $data1['amount']=-$data1['amount']; + } + if ($data1['amount']>0){ + }else{ + } + $balance += $data1['amount']; + $data1['balance'] = $balance; + } + // Display array + foreach($TData as $data) { + $html_class = ''; + //if (!empty($data['fk_facture'])) $html_class = 'facid-'.$data['fk_facture']; + //elseif (!empty($data['fk_paiement'])) $html_class = 'payid-'.$data['fk_paiement']; + print ''; + print "\n"; + print ''; + print ''; + print '\n"; + print ''; + print '\n"; + $totalDebit += ($data['amount'] > 0) ? abs($data['amount']) : 0; + print '\n"; + $totalCredit += ($data['amount'] > 0) ? 0 : abs($data['amount']); + // Balance + print '\n"; + print "\n"; + } + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "\n"; + } + + } +print "
'.$langs->trans("Type").''.$langs->trans("Ref").''.$langs->trans("File").''.$langs->trans("Paid").''.$langs->trans("Debit").''.$langs->trans("Credit").''.$langs->trans("Balance").'
'.$langs->trans("NoItem").'
"; + print dol_print_date($data['date'],'day'); + print "'.$data['item'].''.$data['ref'].' ".$data['name']."'.$data['paid'].''.(($data['amount'] > 0) ? price(abs($data['amount'])) : '')."'.(($data['amount'] > 0) ? '' : price(abs($data['amount'])))."'.price($data['balance'])."
 '.price($totalDebit).''.price($totalCredit).''.price(price2num($totalDebit - $totalCredit, 'MT')).'
"; +print '
'."\n\t\t\t"; + +print ''; +print ''; + +//print ''; +//print ''; +//print ''; + +//print ''; +//print ''; +//print ''; + + +print '
'."\n\t\t\n\t\t
\n\t\t\t"; + + + +llxFooter(); +$db->close(); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index a40ad636976..4d538bfc68b 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -954,6 +954,8 @@ if (empty($reshook)) if($facture_source->type == Facture::TYPE_SITUATION) { + $source_fk_prev_id = $line->fk_prev_id; // temporary storing situation invoice fk_prev_id + $line->fk_prev_id = $line->id; // Credit note line need to be linked to the situation invoice it is create from if(!empty($facture_source->tab_previous_situation_invoice)) { @@ -977,7 +979,7 @@ if (empty($reshook)) $maxPrevSituationPercent = 0; foreach($facture_source->tab_previous_situation_invoice[$lineIndex]->lines as $prevLine) { - if($prevLine->id == $line->fk_prev_id) + if($prevLine->id == $source_fk_prev_id) { $maxPrevSituationPercent = max($maxPrevSituationPercent,$prevLine->situation_percent); @@ -1535,6 +1537,7 @@ if (empty($reshook)) $line->origin = $object->origin; $line->origin_id = $line->id; $line->fetch_optionals($line->id); + $line->situation_percent = $line->get_prev_progress($object->id); // get good progress including credit note // Si fk_remise_except defini on vérifie si la réduction à déjà été appliquée if ($line->fk_remise_except) @@ -1960,7 +1963,7 @@ if (empty($reshook)) if ($tva_npr) $info_bits |= 0x01; - if (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& (! empty($price_min) && (price2num($pu_ht) * (1 - price2num($remise_percent) / 100) < price2num($price_min)))) { $mesg = $langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)); setEventMessages($mesg, null, 'errors'); } else { @@ -2032,7 +2035,7 @@ if (empty($reshook)) } } - elseif ($action == 'updateligne' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) + elseif ($action == 'updateline' && $user->rights->facture->creer && ! GETPOST('cancel','alpha')) { if (! $object->fetch($id) > 0) dol_print_error($db); $object->fetch_thirdparty(); @@ -2123,7 +2126,7 @@ if (empty($reshook)) $label = ((GETPOST('update_label') && GETPOST('product_label')) ? GETPOST('product_label') : ''); // Check price is not lower than minimum (check is done only for standard or replacement invoices) - if (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min))) { + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) ) && (($object->type == Facture::TYPE_STANDARD || $object->type == Facture::TYPE_REPLACEMENT) && $price_min && (price2num($pu_ht) * (1 - price2num(GETPOST('remise_percent')) / 100) < price2num($price_min)))) { setEventMessages($langs->trans("CantBeLessThanMinPrice", price(price2num($price_min, 'MU'), 0, $langs, 0, 0, - 1, $conf->currency)), null, 'errors'); $error++; } @@ -2255,7 +2258,7 @@ if (empty($reshook)) } } - else if ($action == 'updateligne' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) { + else if ($action == 'updateline' && $user->rights->facture->creer && $_POST['cancel'] == $langs->trans('Cancel')) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); // Pour reaffichage de la fiche en cours d'edition exit(); } @@ -3644,7 +3647,7 @@ else if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, $user->rights->facture->creer, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1,'customer'); - if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherBills").')'; + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherBills").')'; // Project if (! empty($conf->projet->enabled)) { @@ -4463,6 +4466,7 @@ else if ($id > 0 || ! empty($ref)) print '
  
 
'; - print ''; - print ''; - print ''; + print ''; - // Skype - if (! empty($conf->skype->enabled)) + if (! empty($conf->socialnetworks->enabled)) { - print ''; - print ''; + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print ''; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print ''; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } } // Visibility @@ -914,11 +933,26 @@ else } print ''; - // Skype - if (! empty($conf->skype->enabled)) + if (! empty($conf->socialnetworks->enabled)) { - print ''; - print ''; + // Skype + if (! empty($conf->global->SOCIALNETWORKS_SKYPE)) + { + print ''; + print ''; + } + // Twitter + if (! empty($conf->global->SOCIALNETWORKS_TWITTER)) + { + print ''; + print ''; + } + // Facebook + if (! empty($conf->global->SOCIALNETWORKS_FACEBOOK)) + { + print ''; + print ''; + } } // Visibility diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index f81c4eed4c3..b8cadaa4632 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -100,7 +100,7 @@ class Contact extends CommonObject public $state_code; // Code of department public $state; // Label of department - public $poste; // Position + public $poste; // Position public $socid; // fk_soc public $statut; // 0=inactif, 1=actif @@ -354,6 +354,8 @@ class Contact extends CommonObject $sql .= ", fax='".$this->db->escape($this->fax)."'"; $sql .= ", email='".$this->db->escape($this->email)."'"; $sql .= ", skype='".$this->db->escape($this->skype)."'"; + $sql .= ", twitter='".$this->db->escape($this->twitter)."'"; + $sql .= ", facebook='".$this->db->escape($this->facebook)."'"; $sql .= ", photo='".$this->db->escape($this->photo)."'"; $sql .= ", birthday=".($this->birthday ? "'".$this->db->idate($this->birthday)."'" : "null"); $sql .= ", note_private = ".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null"); @@ -441,6 +443,16 @@ class Contact extends CommonObject $tmpobj->skype = $this->skype; $usermustbemodified++; } + if ($tmpobj->twitter != $this->twitter) + { + $tmpobj->twitter = $this->twitter; + $usermustbemodified++; + } + if ($tmpobj->facebook != $this->facebook) + { + $tmpobj->facebook = $this->facebook; + $usermustbemodified++; + } if ($usermustbemodified) { $result=$tmpobj->update($user, 0, 1, 1, 1); @@ -493,8 +505,8 @@ class Contact extends CommonObject global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS].",".$conf->global->LDAP_CONTACT_DN; - if ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN; - if ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS]; + elseif ($mode==1) $dn=$conf->global->LDAP_CONTACT_DN; + elseif ($mode==2) $dn=$conf->global->LDAP_KEY_CONTACTS."=".$info[$conf->global->LDAP_KEY_CONTACTS]; return $dn; } @@ -508,12 +520,12 @@ class Contact extends CommonObject function _load_ldap_info() { // phpcs:enable - global $conf,$langs; + global $conf, $langs; $info = array(); // Object classes - $info["objectclass"]=explode(',',$conf->global->LDAP_CONTACT_OBJECT_CLASS); + $info["objectclass"]=explode(',', $conf->global->LDAP_CONTACT_OBJECT_CLASS); $this->fullname=$this->getFullName($langs); @@ -690,7 +702,7 @@ class Contact extends CommonObject $sql.= " c.fk_pays as country_id,"; $sql.= " c.fk_departement,"; $sql.= " c.birthday,"; - $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype,"; + $sql.= " c.poste, c.phone, c.phone_perso, c.phone_mobile, c.fax, c.email, c.jabberid, c.skype, c.twitter, c.facebook,"; $sql.= " c.photo,"; $sql.= " c.priv, c.note_private, c.note_public, c.default_lang, c.no_email, c.canvas,"; $sql.= " c.import_key,"; @@ -756,6 +768,8 @@ class Contact extends CommonObject $this->email = $obj->email; $this->jabberid = $obj->jabberid; $this->skype = $obj->skype; + $this->twitter = $obj->twitter; + $this->facebook = $obj->facebook; $this->photo = $obj->photo; $this->priv = $obj->priv; $this->mail = $obj->email; @@ -887,9 +901,9 @@ class Contact extends CommonObject if ($obj->nb) { if ($obj->element=='facture') $this->ref_facturation = $obj->nb; - if ($obj->element=='contrat') $this->ref_contrat = $obj->nb; - if ($obj->element=='commande') $this->ref_commande = $obj->nb; - if ($obj->element=='propal') $this->ref_propal = $obj->nb; + elseif ($obj->element=='contrat') $this->ref_contrat = $obj->nb; + elseif ($obj->element=='commande') $this->ref_commande = $obj->nb; + elseif ($obj->element=='propal') $this->ref_propal = $obj->nb; } } $this->db->free($resql); @@ -914,8 +928,8 @@ class Contact extends CommonObject $error=0; - $this->old_lastname = $obj->lastname; - $this->old_firstname = $obj->firstname; + $this->old_lastname = $obj->lastname; + $this->old_firstname = $obj->firstname; $this->db->begin(); @@ -1035,7 +1049,7 @@ class Contact extends CommonObject { $obj = $this->db->fetch_object($resql); - $this->id = $obj->rowid; + $this->id = $obj->rowid; if ($obj->fk_user_creat) { $cuser = new User($this->db); @@ -1069,9 +1083,9 @@ class Contact extends CommonObject function getNbOfEMailings() { $sql = "SELECT count(mc.email) as nb"; - $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; - $sql.= " WHERE mc.email = '".$this->db->escape($this->email)."'"; - $sql.= " AND mc.statut NOT IN (-1,0)"; // -1 erreur, 0 non envoye, 1 envoye avec succes + $sql.= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc, ".MAIN_DB_PREFIX."mailing as m"; + $sql.= " WHERE mc.fk_mailing=m.rowid AND mc.email = '".$this->db->escape($this->email)."' "; + $sql.= " AND m.entity IN (".getEntity($this->element).") AND mc.statut NOT IN (-1,0)"; // -1 error, 0 not sent, 1 sent with success $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index b60fdd8886b..04132fa9b75 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -732,7 +732,7 @@ while ($i < min($num,$limit)) // Job position if (! empty($arrayfields['p.poste']['checked'])) { - print ''; + print ''; if (! $i) $totalarray['nbfield']++; } // Zip diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 0e0b0ee44f1..0c0247dc7fa 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -566,7 +566,7 @@ if (empty($reshook)) $info_bits=0; if ($tva_npr) $info_bits |= 0x01; - if($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min))) + if (((!empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->produit->ignore_price_min_advance)) || empty($conf->global->MAIN_USE_ADVANCED_PERMS) )&& ($price_min && (price2num($pu_ht)*(1-price2num($remise_percent)/100) < price2num($price_min)))) { $object->error = $langs->trans("CantBeLessThanMinPrice",price(price2num($price_min,'MU'),0,$langs,0,0,-1,$conf->currency)); $result = -1 ; @@ -1318,8 +1318,10 @@ else { $object->fetch_thirdparty(); - $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed - if ($result < 0) dol_print_error($db,$object->error); + $result=$object->fetch_lines(); // This also init $this->nbofserviceswait, $this->nbofservicesopened, $this->nbofservicesexpired=, $this->nbofservicesclosed + if ($result < 0) { + dol_print_error($db,$object->error); + } $nbofservices=count($object->lines); @@ -1334,56 +1336,54 @@ else $head = contract_prepare_head($object); - $hselected = 0; + $hselected = 0; + $formconfirm = ''; - dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract'); + dol_fiche_head($head, $hselected, $langs->trans("Contract"), -1, 'contract'); - /* - * Confirmation de la suppression du contrat - */ - if ($action == 'delete') - { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); + if ($action == 'delete') { + //Confirmation de la suppression du contrat + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("DeleteAContract"),$langs->trans("ConfirmDeleteAContract"),"confirm_delete",'',0,1); + } elseif ($action == 'valid') { + //Confirmation de la validation + $ref = substr($object->ref, 1, 4); + if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) { + $numref = $object->getNextNumRef($object->thirdparty); + } else { + $numref = $object->ref; + } + $text = $langs->trans('ConfirmValidateContract',$numref); + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); + } elseif ($action == 'close') { + // Confirmation de la fermeture + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); + } elseif ($action == 'activate') { + $formconfirm = $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1); + } elseif ($action == 'clone') { + // Clone confirmation + $formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); + $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); + } - } - /* - * Confirmation de la validation - */ - if ($action == 'valid') - { - $ref = substr($object->ref, 1, 4); - if ($ref == 'PROV' && !empty($modCodeContract->code_auto)) - { - $numref = $object->getNextNumRef($object->thirdparty); - } - else - { - $numref = $object->ref; - } + // Call Hook formConfirm + $parameters = array( + 'id' => $id, + //'lineid' => $lineid, + ); + // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); + if (empty($reshook)) { + $formconfirm .= $hookmanager->resPrint; + } elseif ($reshook > 0) { + $formconfirm = $hookmanager->resPrint; + } - $text=$langs->trans('ConfirmValidateContract',$numref); + // Print form confirm + print $formconfirm; - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ValidateAContract"),$text,"confirm_valid",'',0,1); - - } - - /* - * Confirmation de la fermeture - */ - if ($action == 'close') - { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("CloseAContract"),$langs->trans("ConfirmCloseContract"),"confirm_close",'',0,1); - - } - if ($action == 'activate') - { - print $form->formconfirm($_SERVER['PHP_SELF']."?id=".$object->id,$langs->trans("ActivateAllOnContract"),$langs->trans("ConfirmActivateAllOnContract"),"confirm_activate",'',0,1); - - } - - /* + /* * Contrat */ if (! empty($object->brouillon) && $user->rights->contrat->creer) @@ -1393,12 +1393,6 @@ else print ''; } - // Clone confirmation - if ($action == 'clone') { - $formquestion = array(array('type' => 'other','name' => 'socid','label' => $langs->trans("SelectThirdParty"),'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)'))); - print $form->formconfirm($_SERVER["PHP_SELF"] . '?id=' . $object->id, $langs->trans('CloneContract'), $langs->trans('ConfirmCloneContract', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); - } - // Contract card $linkback = ''.$langs->trans("BackToList").''; @@ -1422,6 +1416,7 @@ else $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, $user->rights->contrat->creer, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); + if (empty($conf->global->MAIN_DISABLE_OTHER_LINK) && $object->thirdparty->id > 0) $morehtmlref.=' ('.$langs->trans("OtherContracts").')'; // Project if (! empty($conf->projet->enabled)) { @@ -1516,7 +1511,7 @@ else } - $colorb='666666'; + $colorb = '666666'; $arrayothercontracts=$object->getListOfContracts('others'); diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index a811f10f881..2bcb802000f 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -312,11 +312,11 @@ class Contrat extends CommonObject $this->db->begin(); + $error=0; + // Load lines $this->fetch_lines(); - $error=0; - foreach($this->lines as $contratline) { // Open lines not already open @@ -643,56 +643,49 @@ class Contrat extends CommonObject $resql = $this->db->query($sql); if ($resql) { - $result = $this->db->fetch_array($resql); + $obj = $this->db->fetch_object($resql); - if ($result) + if ($obj) { - $this->id = $result["rowid"]; - $this->ref = (!isset($result["ref"]) || !$result["ref"]) ? $result["rowid"] : $result["ref"]; - $this->ref_customer = $result["ref_customer"]; - $this->ref_supplier = $result["ref_supplier"]; - $this->ref_ext = $result["ref_ext"]; - $this->statut = $result["statut"]; - $this->mise_en_service = $this->db->jdate($result["datemise"]); + $this->id = $obj->rowid; + $this->ref = (!isset($obj->ref) || !$obj->ref) ? $obj->rowid : $obj->ref; + $this->ref_customer = $obj->ref_customer; + $this->ref_supplier = $obj->ref_supplier; + $this->ref_ext = $obj->ref_ext; + $this->statut = $obj->statut; + $this->mise_en_service = $this->db->jdate($obj->datemise); - $this->date_contrat = $this->db->jdate($result["datecontrat"]); - $this->date_creation = $this->db->jdate($result["datecontrat"]); + $this->date_contrat = $this->db->jdate($obj->datecontrat); + $this->date_creation = $this->db->jdate($obj->datecontrat); - $this->fin_validite = $this->db->jdate($result["fin_validite"]); - $this->date_cloture = $this->db->jdate($result["date_cloture"]); + $this->fin_validite = $this->db->jdate($obj->fin_validite); + $this->date_cloture = $this->db->jdate($obj->date_cloture); - $this->user_author_id = $result["fk_user_author"]; + $this->user_author_id = $obj->fk_user_author; - $this->commercial_signature_id = $result["fk_commercial_signature"]; - $this->commercial_suivi_id = $result["fk_commercial_suivi"]; + $this->commercial_signature_id = $obj->fk_commercial_signature; + $this->commercial_suivi_id = $obj->fk_commercial_suivi; - $this->note_private = $result["note_private"]; - $this->note_public = $result["note_public"]; - $this->modelpdf = $result["model_pdf"]; + $this->note_private = $obj->note_private; + $this->note_public = $obj->note_public; + $this->modelpdf = $obj->model_pdf; - $this->fk_projet = $result["fk_projet"]; // deprecated - $this->fk_project = $result["fk_projet"]; + $this->fk_projet = $obj->fk_projet; // deprecated + $this->fk_project = $obj->fk_projet; - $this->socid = $result["fk_soc"]; - $this->fk_soc = $result["fk_soc"]; + $this->socid = $obj->fk_soc; + $this->fk_soc = $obj->fk_soc; - $this->extraparams = (array) json_decode($result["extraparams"], true); + $this->extraparams = (array) json_decode($obj->extraparams, true); $this->db->free($resql); - // Retreive all extrafields // fetch optionals attributes and labels $this->fetch_optionals(); - - /* - * Lines - */ - - $this->lines = array(); - + // Lines $result=$this->fetch_lines(); if ($result < 0) { @@ -1717,7 +1710,7 @@ class Contrat extends CommonObject else { $this->db->rollback(); - dol_syslog(get_class($this)."::updateligne Erreur -2"); + dol_syslog(get_class($this)."::updateline Erreur -2"); return -2; } } @@ -1725,7 +1718,7 @@ class Contrat extends CommonObject { $this->db->rollback(); $this->error=$this->db->error(); - dol_syslog(get_class($this)."::updateligne Erreur -1"); + dol_syslog(get_class($this)."::updateline Erreur -1"); return -1; } } @@ -1852,28 +1845,28 @@ class Contrat extends CommonObject if ($mode == 0) { if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } - if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } - if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); } + elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); } } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == 0) { return $langs->trans("ContractStatusDraft"); } - if ($statut == 1) { return $langs->trans("ContractStatusValidated"); } - if ($statut == 2) { return $langs->trans("ContractStatusClosed"); } + elseif ($statut == 1) { return $langs->trans("ContractStatusValidated"); } + elseif ($statut == 2) { return $langs->trans("ContractStatusClosed"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0').' '.$langs->trans("ContractStatusDraft"); } - if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); } - if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); } + elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4').' '.$langs->trans("ContractStatusValidated"); } + elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6').' '.$langs->trans("ContractStatusClosed"); } } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 0) { return img_picto($langs->trans('ContractStatusDraft'),'statut0'); } - if ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); } - if ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); } + elseif ($statut == 1) { return img_picto($langs->trans('ContractStatusValidated'),'statut4'); } + elseif ($statut == 2) { return img_picto($langs->trans('ContractStatusClosed'),'statut6'); } } - if ($mode == 4 || $mode == 6 || $mode == 7) + elseif ($mode == 4 || $mode == 6 || $mode == 7) { $text=''; if ($mode == 4) @@ -1895,11 +1888,11 @@ class Contrat extends CommonObject $text.=($mode == 7?'':''); return $text; } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 0) { return $langs->trans("ContractStatusDraft").' '.img_picto($langs->trans('ContractStatusDraft'),'statut0'); } - if ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); } - if ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); } + elseif ($statut == 1) { return $langs->trans("ContractStatusValidated").' '.img_picto($langs->trans('ContractStatusValidated'),'statut4'); } + elseif ($statut == 2) { return $langs->trans("ContractStatusClosed").' '.img_picto($langs->trans('ContractStatusClosed'),'statut6'); } } } @@ -2123,7 +2116,7 @@ class Contrat extends CommonObject $sql.= " AND c.rowid = cd.fk_contrat"; $sql.= " AND cd.statut = 0"; } - if ($mode == 'expired') + elseif ($mode == 'expired') { $sql = "SELECT cd.rowid, cd.date_fin_validite as datefin"; $sql.= $this->from; @@ -2389,7 +2382,7 @@ class Contrat extends CommonObject */ function createFromClone($socid = 0, $notrigger=0) { - global $db, $user, $langs, $conf, $hookmanager; + global $db, $user, $langs, $conf, $hookmanager, $extrafields; dol_include_once('/projet/class/project.class.php'); @@ -2398,6 +2391,7 @@ class Contrat extends CommonObject $error = 0; $this->fetch($this->id); + // Load dest object $clonedObj = clone $this; $clonedObj->socid = $socid; @@ -2408,8 +2402,23 @@ class Contrat extends CommonObject $objsoc->fetch($clonedObj->socid); - // $clonedObj->id=0; + // Clean data $clonedObj->statut = 0; + // Clean extrafields + if (is_array($clonedObj->array_options) && count($clonedObj->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($clonedObj->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + //var_dump($shortkey); var_dump($extrafields->attributes[$this->element]['unique'][$shortkey]); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($clonedObj->array_options[$key]); + } + } + } if (empty($conf->global->CONTRACT_ADDON) || ! is_readable(DOL_DOCUMENT_ROOT . "/core/modules/contract/" . $conf->global->CONTRACT_ADDON . ".php")) { $this->error = 'ErrorSetupNotComplete'; @@ -2424,8 +2433,8 @@ class Contrat extends CommonObject $clonedObj->ref = $modContract->getNextValue($objsoc, $clonedObj); // get extrafields so they will be clone - foreach ( $this->lines as $line ) { - $line->fetch_optionals($line->rowid); + foreach ($this->lines as $line) { + $line->fetch_optionals($line->id); } // Create clone @@ -2628,50 +2637,50 @@ class ContratLigne extends CommonObjectLine if ($mode == 0) { if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); } - if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLate"); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLate"); } + elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial"); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); } - if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning"); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort"); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort"); } + elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed"); } } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); } - if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLateShort"); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLateShort"); } + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0',$moreatt); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); } - if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4',$moreatt); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4',$moreatt); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3',$moreatt); } + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6',$moreatt); } } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == self::STATUS_INITIAL) { return img_picto($langs->trans('ServiceStatusInitial'),'statut0').' '.$langs->trans("ServiceStatusInitial"); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); } - if ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return img_picto($langs->trans('ServiceStatusRunning'),'statut4').' '.$langs->trans("ServiceStatusRunning"); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return img_picto($langs->trans('ServiceStatusNotLate'),'statut4').' '.$langs->trans("ServiceStatusNotLate"); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return img_picto($langs->trans('ServiceStatusLate'),'statut3').' '.$langs->trans("ServiceStatusLate"); } + elseif ($statut == self::STATUS_CLOSED) { return img_picto($langs->trans('ServiceStatusClosed'),'statut6') .' '.$langs->trans("ServiceStatusClosed"); } } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == self::STATUS_INITIAL) { return $langs->trans("ServiceStatusInitial").' '.img_picto($langs->trans('ServiceStatusInitial'),'statut0'); } - if ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); } - if ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); } - if ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); } - if ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); } + elseif ($statut == self::STATUS_OPEN && $expired == -1) { return $langs->trans("ServiceStatusRunning").' '.img_picto($langs->trans('ServiceStatusRunning'),'statut4'); } + elseif ($statut == self::STATUS_OPEN && $expired == 0) { return $langs->trans("ServiceStatusNotLateShort").' '.img_picto($langs->trans('ServiceStatusNotLateShort'),'statut4'); } + elseif ($statut == self::STATUS_OPEN && $expired == 1) { return $langs->trans("ServiceStatusLateShort").' '.img_picto($langs->trans('ServiceStatusLate'),'statut3'); } + elseif ($statut == self::STATUS_CLOSED) { return $langs->trans("ServiceStatusClosed").' '.img_picto($langs->trans('ServiceStatusClosed'),'statut6'); } } } @@ -3011,15 +3020,14 @@ class ContratLigne extends CommonObjectLine } } - if (! $error) - { - if (! $notrigger) - { - // Call trigger - $result=$this->call_trigger('LINECONTRACT_UPDATE', $user); - if ($result < 0) { $error++; $this->db->rollback(); } - // End call triggers - } + if (! $error && ! $notrigger) { + // Call trigger + $result=$this->call_trigger('LINECONTRACT_UPDATE', $user); + if ($result < 0) { + $error++; + $this->db->rollback(); + } + // End call triggers } if (! $error) diff --git a/htdocs/contrat/contact.php b/htdocs/contrat/contact.php index 063e3ecb228..f34eb1b5bdb 100644 --- a/htdocs/contrat/contact.php +++ b/htdocs/contrat/contact.php @@ -163,27 +163,26 @@ if ($id > 0 || ! empty($ref)) $morehtmlref.=$form->editfieldval("RefSupplier", 'ref_supplier', $object->ref_supplier, $object, 0, 'string', '', null, null, '', 1); // Thirdparty $morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); - // Project - if (! empty($conf->projet->enabled)) - { - $langs->load("projects"); - $morehtmlref.='
'.$langs->trans('Project') . ' '; - if ($user->rights->contrat->creer) - { - if ($action != 'classify') - //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; - $morehtmlref.=' : '; - if ($action == 'classify') { - //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=''; - $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); - $morehtmlref.=''; - $morehtmlref.=''; - } else { - $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); - } + // Project + if (! empty($conf->projet->enabled)) { + $langs->load("projects"); + $morehtmlref.='
'.$langs->trans('Project') . ' '; + if ($user->rights->contrat->creer) { + if ($action != 'classify') { + //$morehtmlref.='' . img_edit($langs->transnoentitiesnoconv('SetProject')) . ' : '; + $morehtmlref.=' : '; + } + if ($action == 'classify') { + //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1); + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=''; + $morehtmlref.=$formproject->select_projects($object->thirdparty->id, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1); + $morehtmlref.=''; + $morehtmlref.=''; + } else { + $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->thirdparty->id, $object->fk_project, 'none', 0, 0, 0, 1); + } } else { if (! empty($object->fk_project)) { $proj = new Project($db); @@ -210,9 +209,12 @@ if ($id > 0 || ! empty($ref)) // Ligne info remises tiers print ''; + // Adds a line numbering column if (! empty($conf->global->MAIN_VIEW_LINE_NUMBER)) print ''; // Description @@ -4911,6 +4924,9 @@ abstract class CommonObject } } + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -4924,6 +4940,21 @@ abstract class CommonObject $new_array_options[$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $new_array_options[$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $new_array_options[$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { @@ -5118,6 +5149,9 @@ abstract class CommonObject $attributeParam = $extrafields->attributes[$this->table_element]['param'][$key]; $attributeRequired = $extrafields->attributes[$this->table_element]['required'][$key]; + //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); + //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); + switch ($attributeType) { case 'int': @@ -5131,6 +5165,21 @@ abstract class CommonObject $this->array_options["options_".$key] = null; } break; + case 'double': + $value = price2num($value); + if (!is_numeric($value) && $value!='') + { + dol_syslog($langs->trans("ExtraFieldHasWrongValue")." sur ".$attributeLabel."(".$value."is not '".$attributeType."')", LOG_DEBUG); + $this->errors[]=$langs->trans("ExtraFieldHasWrongValue", $attributeLabel); + return -1; + } + elseif ($value=='') + { + $this->array_options["options_".$key] = null; + } + //dol_syslog("double value"." sur ".$attributeLabel."(".$value." is '".$attributeType."')", LOG_DEBUG); + $this->array_options["options_".$key] = $value; + break; /*case 'select': // Not required, we chosed value='0' for undefined values if ($value=='-1') { @@ -5222,37 +5271,34 @@ abstract class CommonObject $val=$this->fields[$key]; $out=''; - $type=''; - $param['options']=array(); - $size =$this->fields[$key]['size']; - // Because we work on extrafields - if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ - $param['options']=array($reg[1].':'.$reg[2]=>'N'); - $type ='link'; - }else if(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)){ - $param['options']=array($reg[1].':'.$reg[2]=>'N'); - $type ='link'; - }else if(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)){ - - $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); - $type ='sellist'; - }else if(preg_match('/varchar\((\d+)\)/', $val['type'],$reg)){ - - $param['options']=array(); - $type ='varchar'; - $size=$reg[1]; - }else if(preg_match('/varchar/', $val['type'])){ - - $param['options']=array(); - $type ='varchar'; - }else if(is_array($this->fields[$key]['arrayofkeyval'])){ - - $param['options']=$this->fields[$key]['arrayofkeyval']; - $type ='select'; - }else { - $param['options']=array(); - $type =$this->fields[$key]['type']; - } + $type=''; + $param = array(); + $param['options']=array(); + $size =$this->fields[$key]['size']; + // Because we work on extrafields + if(preg_match('/^integer:(.*):(.*)/i', $val['type'], $reg)){ + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + } elseif(preg_match('/^link:(.*):(.*)/i', $val['type'], $reg)) { + $param['options']=array($reg[1].':'.$reg[2]=>'N'); + $type ='link'; + } elseif(preg_match('/^sellist:(.*):(.*):(.*):(.*)/i', $val['type'], $reg)) { + $param['options']=array($reg[1].':'.$reg[2].':'.$reg[3].':'.$reg[4]=>'N'); + $type ='sellist'; + } elseif(preg_match('/varchar\((\d+)\)/', $val['type'],$reg)) { + $param['options']=array(); + $type ='varchar'; + $size=$reg[1]; + } elseif(preg_match('/varchar/', $val['type'])) { + $param['options']=array(); + $type ='varchar'; + } elseif(is_array($this->fields[$key]['arrayofkeyval'])) { + $param['options']=$this->fields[$key]['arrayofkeyval']; + $type ='select'; + } else { + $param['options']=array(); + $type =$this->fields[$key]['type']; + } $label=$this->fields[$key]['label']; //$elementtype=$this->fields[$key]['elementtype']; // Seems not used @@ -5329,7 +5375,7 @@ abstract class CommonObject if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); } elseif (in_array($type,array('int','integer'))) { @@ -7288,7 +7334,7 @@ abstract class CommonObject $comment = new Comment($this->db); $result=$comment->fetchAllFor($this->element, $this->id); if ($result<0) { - $this->errors=array_merge($this->errors,$comment->errors); + $this->errors=array_merge($this->errors, $comment->errors); return -1; } else { $this->comments = $comment->comments; @@ -7305,4 +7351,20 @@ abstract class CommonObject { return count($this->comments); } + + /** + * Trim object parameters + * @param string[] $parameters array of parameters to trim + * + * @return void + */ + public function trimParameters($parameters) + { + if (!is_array($parameters)) return; + foreach ($parameters as $parameter) { + if (isset($this->$parameter)) { + $this->$parameter = trim($this->$parameter); + } + } + } } diff --git a/htdocs/core/class/commonstickergenerator.class.php b/htdocs/core/class/commonstickergenerator.class.php index 6d4c32d82bb..d5bf6f3317e 100644 --- a/htdocs/core/class/commonstickergenerator.class.php +++ b/htdocs/core/class/commonstickergenerator.class.php @@ -1,10 +1,10 @@ * Copyright (C) 2002-2003 Jean-Louis Bergamo * Copyright (C) 2006-2013 Laurent Destailleur - * Copyright (C) 2015 Francis Appels + * Copyright (C) 2015 Francis Appels * * 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 @@ -61,9 +61,12 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/format_cards.lib.php'; */ abstract class CommonStickerGenerator { - public $code; // Code of format - public $format; // Array with informations + + /** + * @var array format Array with informations + */ + public $format; // protected var $_Avery_Name = ''; // Nom du format de l'etiquette @@ -215,26 +218,26 @@ abstract class CommonStickerGenerator $pdf->SetDrawColor(0,0,0); } - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** - * protected Convert units (in to mm, mm to in) + * Convert units (in to mm, mm to in) * $src and $dest must be 'in' or 'mm' * * @param int $value value - * @param string $src from - * @param string $dest to + * @param string $src from ('in' or 'mm') + * @param string $dest to ('in' or 'mm') * @return float value value after conversion */ - function _Convert_Metric($value, $src, $dest) + private function convertMetric($value, $src, $dest) { - // phpcs:enable if ($src != $dest) { - $tab['in'] = 39.37008; - $tab['mm'] = 1000; + $tab = array( + 'in'=>39.37008, + 'mm'=>1000 + ); return $value * $tab[$dest] / $tab[$src]; - } else { - return $value; } + + return $value; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps @@ -270,14 +273,14 @@ abstract class CommonStickerGenerator $this->_Metric = $format['metric']; $this->_Avery_Name = $format['name']; $this->_Avery_Code = $format['code']; - $this->_Margin_Left = $this->_Convert_Metric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); - $this->_Margin_Top = $this->_Convert_Metric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); - $this->_X_Space = $this->_Convert_Metric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); - $this->_Y_Space = $this->_Convert_Metric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc); + $this->_Margin_Left = $this->convertMetric($format['marginLeft'], $this->_Metric, $this->_Metric_Doc); + $this->_Margin_Top = $this->convertMetric($format['marginTop'], $this->_Metric, $this->_Metric_Doc); + $this->_X_Space = $this->convertMetric($format['SpaceX'], $this->_Metric, $this->_Metric_Doc); + $this->_Y_Space = $this->convertMetric($format['SpaceY'], $this->_Metric, $this->_Metric_Doc); $this->_X_Number = $format['NX']; $this->_Y_Number = $format['NY']; - $this->_Width = $this->_Convert_Metric($format['width'], $this->_Metric, $this->_Metric_Doc); - $this->_Height = $this->_Convert_Metric($format['height'], $this->_Metric, $this->_Metric_Doc); + $this->_Width = $this->convertMetric($format['width'], $this->_Metric, $this->_Metric_Doc); + $this->_Height = $this->convertMetric($format['height'], $this->_Metric, $this->_Metric_Doc); $this->Set_Char_Size($pdf, $format['font-size']); } } diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index db22d443c54..420b90926dd 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -35,12 +35,12 @@ class Conf /** \public */ //! To store properties found in conf file var $file; - + /** * @var DoliDB Database handler. */ public $db; - + //! To store properties found into database var $global; //! To store browser info @@ -48,7 +48,7 @@ class Conf //! To store if javascript/ajax is enabked public $use_javascript_ajax; - //! Used to store current currency + //! Used to store current currency (ISO code like 'USD', 'EUR', ...) public $currency; //! Used to store current css (from theme) public $theme; // Contains current theme ("eldy", "auguria", ...) @@ -182,7 +182,7 @@ class Conf if (is_array($arrValue) && ! empty($arrValue)) $value = $arrValue; else if (in_array($partname,array('login','menus','substitutions','triggers','tpl'))) $value = '/'.$modulename.'/core/'.$partname.'/'; else if (in_array($partname,array('models','theme'))) $value = '/'.$modulename.'/'; - else if (in_array($partname,array('sms'))) $value = $modulename; + else if (in_array($partname,array('sms'))) $value = '/'.$modulename.'/'; else if ($value == 1) $value = '/'.$modulename.'/core/modules/'.$partname.'/'; // ex: partname = societe $this->modules_parts[$partname] = array_merge($this->modules_parts[$partname], array($modulename => $value)); // $value may be a string or an array } diff --git a/htdocs/core/class/cstate.class.php b/htdocs/core/class/cstate.class.php index 085da06c754..4320446d7b5 100644 --- a/htdocs/core/class/cstate.class.php +++ b/htdocs/core/class/cstate.class.php @@ -56,7 +56,19 @@ class Cstate // extends CommonObject public $id; public $code_departement; - public $nom; + + /** + * @var string + * @deprecated + * @see name + */ + public $nom=''; + + /** + * @var string name + */ + public $name=''; + public $active; @@ -70,7 +82,6 @@ class Cstate // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/ctypent.class.php b/htdocs/core/class/ctypent.class.php index 9366cf6317b..db8ed461727 100644 --- a/htdocs/core/class/ctypent.class.php +++ b/htdocs/core/class/ctypent.class.php @@ -66,7 +66,6 @@ class Ctypent // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index 618716ce0e4..ad7b900b033 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -39,46 +39,46 @@ */ class DolGraph { - var $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...) - var $mode='side'; // Mode bars graph: side, depth + public $type=array(); // Array with type of each series. Example: array('bars', 'lines', ...) + public $mode='side'; // Mode bars graph: side, depth private $_library='jflot'; // Graphic library to use (jflot, artichow) //! Array of data - var $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) - var $title; // Title of graph - var $cssprefix=''; // To add into css styles - var $width=380; - var $height=200; - var $MaxValue=0; - var $MinValue=0; - var $SetShading=0; + public $data; // Data of graph: array(array('abs1',valA1,valB1), array('abs2',valA2,valB2), ...) + public $title; // Title of graph + public $cssprefix=''; // To add into css styles + public $width=380; + public $height=200; + public $MaxValue=0; + public $MinValue=0; + public $SetShading=0; - var $PrecisionY=-1; + public $PrecisionY=-1; - var $horizTickIncrement=-1; - var $SetNumXTicks=-1; - var $labelInterval=-1; + public $horizTickIncrement=-1; + public $SetNumXTicks=-1; + public $labelInterval=-1; - var $hideXGrid=false; - var $hideYGrid=false; + public $hideXGrid=false; + public $hideYGrid=false; - var $Legend=array(); - var $LegendWidthMin=0; - var $showlegend=1; - var $showpointvalue=1; - var $showpercent=0; - var $combine=0; // 0.05 if you want to combine records < 5% into "other" - var $graph; // Objet Graph (Artichow, Phplot...) + public $Legend=array(); + public $LegendWidthMin=0; + public $showlegend=1; + public $showpointvalue=1; + public $showpercent=0; + public $combine=0; // 0.05 if you want to combine records < 5% into "other" + public $graph; // Objet Graph (Artichow, Phplot...) /** * @var string Error code (or message) */ public $error=''; - var $bordercolor; // array(R,G,B) - var $bgcolor; // array(R,G,B) - var $bgcolorgrid=array(255,255,255); // array(R,G,B) - var $datacolor; // array(array(R,G,B),...) + public $bordercolor; // array(R,G,B) + public $bgcolor; // array(R,G,B) + public $bgcolorgrid=array(255,255,255); // array(R,G,B) + public $datacolor; // array(array(R,G,B),...) private $stringtoshow; // To store string to output graph into HTML page diff --git a/htdocs/core/class/emailsenderprofile.class.php b/htdocs/core/class/emailsenderprofile.class.php index d2bf33b5461..c5304fec31c 100644 --- a/htdocs/core/class/emailsenderprofile.class.php +++ b/htdocs/core/class/emailsenderprofile.class.php @@ -99,7 +99,11 @@ class EmailSenderProfile extends CommonObject */ public $entity; - public $label; + /** + * @var string Email Sender Profile label + */ + public $label; + public $email; public $date_creation; public $tms; diff --git a/htdocs/core/class/events.class.php b/htdocs/core/class/events.class.php index 2ac2a51d2ed..d8d71513cd9 100644 --- a/htdocs/core/class/events.class.php +++ b/htdocs/core/class/events.class.php @@ -59,10 +59,10 @@ class Events // extends CommonObject */ public $error=''; - var $tms; - var $type; - var $entity; - var $dateevent; + public $tms; + public $type; + public $entity; + public $dateevent; /** * @var string description @@ -70,7 +70,7 @@ class Events // extends CommonObject public $description; // List of all Audit/Security events supported by triggers - var $eventstolog=array( + public $eventstolog=array( /*array('id'=>'USER_LOGIN', 'test'=>1), array('id'=>'USER_LOGIN_FAILED', 'test'=>1), array('id'=>'USER_LOGOUT', 'test'=>1),*/ @@ -117,7 +117,6 @@ class Events // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index c86bd3eff3f..07f6849e7ec 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1001,7 +1001,7 @@ class ExtraFields if (!$required && $value == '') $value = '-1'; // TODO Must also support $moreparam - $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 1, 0); + $out = $form->selectDate($value, $keyprefix.$key.$keysuffix, $showtime, $showtime, $required, '', 1, (($keyprefix != 'search_' && $keyprefix != 'search_options_') ? 1 : 0), 0, 1); } elseif (in_array($type,array('int','integer'))) { diff --git a/htdocs/core/class/fiscalyear.class.php b/htdocs/core/class/fiscalyear.class.php index de4dc46ac90..c4ab50179d9 100644 --- a/htdocs/core/class/fiscalyear.class.php +++ b/htdocs/core/class/fiscalyear.class.php @@ -79,9 +79,7 @@ class Fiscalyear extends CommonObject $this->db = $db; $this->statuts_short = array(0 => 'Opened', 1 => 'Closed'); - $this->statuts = array(0 => 'Opened', 1 => 'Closed'); - - return 1; + $this->statuts = array(0 => 'Opened', 1 => 'Closed'); } /** diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 177b05850ed..9fce2c6c0cc 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -721,7 +721,7 @@ class Form if (empty($row['favorite']) && $atleastonefavorite) { $atleastonefavorite=0; - $out.= ''; + $out.= ''; } if ($selected && $selected != '-1' && ($selected == $row['rowid'] || $selected == $row['code_iso'] || $selected == $row['code_iso3'] || $selected == $row['label']) ) { @@ -1108,8 +1108,8 @@ class Form else if (!is_array($selected)) $selected = array($selected); // Clean $filter that may contains sql conditions so sql code - if (function_exists('test_sql_and_script_inject')) { - if (test_sql_and_script_inject($filter, 3)>0) { + if (function_exists('testSqlAndScriptInject')) { + if (testSqlAndScriptInject($filter, 3)>0) { $filter =''; } } @@ -3422,7 +3422,7 @@ class Form if ($obj->situation_final != 1) { //Not prov? if (substr($obj->facnumber, 1, 4) != 'PROV') { - if ($selected == $obj->situation_final) { + if ($selected == $obj->rowid) { $opt .= ''; } else { $opt .= ''; @@ -4506,21 +4506,23 @@ class Form * @param int $showtype Show third party type in combolist (customer, prospect or supplier) * @param int $forcecombo Force to use combo box * @param array $events Event options. Example: array(array('method'=>'getContacts', 'url'=>dol_buildpath('/core/ajax/contacts.php',1), 'htmlname'=>'contactid', 'params'=>array('add-customer-contact'=>'disabled'))) + * @param int $nooutput No print output. Return it only. * @return void */ - function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array()) + function form_thirdparty($page, $selected='', $htmlname='socid', $filter='',$showempty=0, $showtype=0, $forcecombo=0, $events=array(), $nooutput=0) { // phpcs:enable global $langs; + $out = ''; if ($htmlname != "none") { - print '
'; - print ''; - print ''; - print $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); - print ''; - print ''; + $out.='
'; + $out.= ''; + $out.= ''; + $out.= $this->select_company($selected, $htmlname, $filter, $showempty, $showtype, $forcecombo, $events); + $out.= ''; + $out.= ''; } else { @@ -4529,13 +4531,16 @@ class Form require_once DOL_DOCUMENT_ROOT .'/societe/class/societe.class.php'; $soc = new Societe($this->db); $soc->fetch($selected); - print $soc->getNomUrl($langs); + $out.= $soc->getNomUrl($langs); } else { - print " "; + $out.= " "; } } + + if ($nooutput) return $out; + else print $out; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps @@ -4829,6 +4834,10 @@ class Form $tmpthirdparty=new Societe($this->db); $defaulttx=get_default_tva($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); $defaultnpr=get_default_npr($societe_vendeuse, (is_object($societe_acheteuse)?$societe_acheteuse:$tmpthirdparty), $idprod); + if (preg_match('/\((.*)\)/', $defaulttx, $reg)) { + $defaultcode=$reg[1]; + $defaulttx=preg_replace('/\s*\(.*\)/','',$defaulttx); + } if (empty($defaulttx)) $defaultnpr=0; } @@ -4928,18 +4937,17 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another select_date field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. - * @return string|null Nothing or string if nooutput is 1 + * @return string|null Nothing or string if nooutput is 1 * @deprecated * @see form_date, select_month, select_year, select_dayofweek */ function select_date($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $nooutput=0, $disabled=0, $fullday='', $addplusone='', $adddateof='') { // phpcs:enable - $retstring = $this->selectDate($set_time='', $prefix='re', $h=0, $m=0, $empty=0, $form_name="", $d=1, $addnowlink=0, $disabled=0, $fullday='', $addplusone='', $adddateof=''); + $retstring = $this->selectDate($set_time, $prefix, $h, $m, $empty, $form_name, $d, $addnowlink, $disabled, $fullday, $addplusone, $adddateof); if (! empty($nooutput)) { return $retstring; } - print $retstring; return; } @@ -5730,7 +5738,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string * @see selectArrayFilter, ajax_combobox in ajax.lib.php */ @@ -5832,7 +5840,7 @@ class Form * @param string $morecss Add more class to css styles * @param int $callurlonselect If set to 1, some code is added so an url return by the ajax is called when value is selected. * @param string $placeholder String to use as placeholder - * @param integer $acceptdelayedhtml 1 if caller request to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) + * @param integer $acceptdelayedhtml 1 = caller is requesting to have html js content not returned but saved into global $delayedhtmlcontent (so caller can show it at end of page to avoid flash FOUC effect) * @return string HTML select string * @see selectArrayAjax, ajax_combobox in ajax.lib.php */ @@ -5949,55 +5957,76 @@ class Form * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% * @param string $moreattrib Add more options on select component. Example: 'disabled' * @param string $elemtype Type of element we show ('category', ...) + * @param string $placeholder String to use as placeholder + * @param int $addjscombo Add js combo * @return string HTML multiselect string * @see selectarray */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') + static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='', $elemtype='', $placeholder='', $addjscombo=1) { global $conf, $langs; $out = ''; + // Add code for jquery to use multiselect if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { - $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; - $out.="\n".' - '; + $out.="\n".' + '; } // Try also magic suggest @@ -6075,7 +6104,7 @@ class Form } if ($val['label']) { - $lis.='
  • '.dol_escape_htmltag($langs->trans($val['label'])).'
  • '; + $lis.='
  • '; $listcheckedstring.=(empty($val['checked'])?'':$key.','); } } @@ -6346,6 +6375,7 @@ class Form 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('propal').')'), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('commande').')'), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), + 'invoice_template'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToTemplateInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.titre as ref, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_rec as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('facture').')'), 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('contract').')'), 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('intervention').')'), 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc IN (".$listofidcompanytoscan.') AND t.entity IN ('.getEntity('supplier_proposal').')'), @@ -6408,8 +6438,7 @@ class Form { $objp = $this->db->fetch_object($resqllist); - $var = ! $var; - print '
    '; + print ''; print ''; @@ -6483,7 +6512,7 @@ class Form * @param int $useempty 1=Add empty line * @return string See option */ - function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty='') + function selectyesno($htmlname, $value='', $option=0, $disabled=false, $useempty=0) { global $langs; diff --git a/htdocs/core/class/html.formactions.class.php b/htdocs/core/class/html.formactions.class.php index e01e1f2ad65..25a3973cbd8 100644 --- a/htdocs/core/class/html.formactions.class.php +++ b/htdocs/core/class/html.formactions.class.php @@ -48,7 +48,6 @@ class FormActions function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formadmin.class.php b/htdocs/core/class/html.formadmin.class.php index 22fa73741ce..510b34c8f47 100644 --- a/htdocs/core/class/html.formadmin.class.php +++ b/htdocs/core/class/html.formadmin.class.php @@ -41,7 +41,6 @@ class FormAdmin function __construct($db) { $this->db = $db; - return 1; } // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps @@ -56,7 +55,7 @@ class FormAdmin * @param int $showwarning Show a warning if language is not complete * @param int $disabled Disable edit of select * @param string $morecss Add more css styles - * @param int $showcode Add language code into label + * @param int $showcode 1=Add language code into label at begining, 2=Add language code into label at end * @param int $forcecombo Force to use combo box (so no ajax beautify effect) * @return string Return HTML select string with list of languages */ @@ -90,8 +89,9 @@ class FormAdmin foreach ($langs_available as $key => $value) { - $valuetoshow=$value; - if ($showcode) $valuetoshow=$key.' - '.$value; + $valuetoshow=$value; + if ($showcode == 1) $valuetoshow=$key.' - '.$value; + if ($showcode == 2) $valuetoshow=$value.' ('.$key.')'; if ($filter && is_array($filter)) { diff --git a/htdocs/core/class/html.formbarcode.class.php b/htdocs/core/class/html.formbarcode.class.php index c2c408801c4..eb08aab6de7 100644 --- a/htdocs/core/class/html.formbarcode.class.php +++ b/htdocs/core/class/html.formbarcode.class.php @@ -48,7 +48,6 @@ class FormBarCode function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index 5c39bc0cef4..273a84cbc94 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -49,8 +49,6 @@ class FormCompany function __construct($db) { $this->db = $db; - - return 1; } diff --git a/htdocs/core/class/html.formcron.class.php b/htdocs/core/class/html.formcron.class.php index 496d77f1f68..94747481cb0 100644 --- a/htdocs/core/class/html.formcron.class.php +++ b/htdocs/core/class/html.formcron.class.php @@ -46,7 +46,6 @@ class FormCron extends Form function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index c1bc479fc73..4a59e28f044 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -54,7 +54,6 @@ class FormFile { $this->db = $db; $this->numoffiles=0; - return 1; } @@ -128,11 +127,12 @@ class FormFile if (preg_match('/g$/i',$maxphp)) $maxphp=$maxphp*1024*1024; if (preg_match('/t$/i',$maxphp)) $maxphp=$maxphp*1024*1024*1024; // Now $max and $maxphp are in Kb - if ($maxphp > 0) $max=min($max,$maxphp); + $maxmin = $max; + if ($maxphp > 0) $maxmin=min($max,$maxphp); - if ($max > 0) + if ($maxmin > 0) { - $out .= ''; + $out .= ''; } $out .= 'load('link'); $title = $langs->trans("LinkANewFile"); $out .= load_fiche_titre($title, null, null); @@ -213,19 +213,18 @@ class FormFile $out .= ''; $out .= '
    '; $out .= '
    '; - $parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''),'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm); - $res = $hookmanager->executeHooks('formattachOptions',$parameters,$object); - $out .= "\n\n"; + $out .= "\n\n"; } + $parameters = array('socid'=>(isset($GLOBALS['socid'])?$GLOBALS['socid']:''), 'id'=>(isset($GLOBALS['id'])?$GLOBALS['id']:''), 'url'=>$url, 'perm'=>$perm); + $res = $hookmanager->executeHooks('formattachOptions',$parameters,$object); if (empty($res)) { print '
    '; print $out; print '
    '; } - print $hookmanager->resPrint; return 1; @@ -916,7 +915,7 @@ class FormFile if (! empty($file_list)) { $out=''."\n"; - print ''; @@ -159,9 +158,17 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg if (! empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { - print ''; + } - // Show filemanager tree (will be filled by call of ajax enablefiletreeajax.tpl.php that execute ajaxdirtree.php) + + + print 'global->MAIN_VIEW_LINE_NUMBER)) { $coldisplay=2; ?> diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 88ac2ee98bb..0a5f3bc43bd 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -259,9 +259,9 @@ if (!empty($extrafieldsline)) '; } - print '
    '; + print ''; print $facturestatic->getNomUrl(1,'',200,0,'',0,1); print empty($obj->increment)?'':' ('.$obj->increment.')'; - print ''; $filename=dol_sanitizeFileName($obj->ref); $filedir=$conf->facture->dir_output . '/' . dol_sanitizeFileName($obj->ref); $urlsource=$_SERVER['PHP_SELF'].'?id='.$obj->id; diff --git a/htdocs/compta/paiement/class/cpaiement.class.php b/htdocs/compta/paiement/class/cpaiement.class.php index c9794d9662e..1f0175bd370 100644 --- a/htdocs/compta/paiement/class/cpaiement.class.php +++ b/htdocs/compta/paiement/class/cpaiement.class.php @@ -135,15 +135,15 @@ class Cpaiement if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action to call a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action to call a trigger. + //if (!$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_CREATE',$user); - //if ($result < 0) $error++; - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_CREATE',$user); + // if ($result < 0) $error++; + // // End call triggers + //} } // Commit or rollback @@ -278,15 +278,15 @@ class Cpaiement dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_MODIFY',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} // Commit or rollback if ($error) { @@ -316,17 +316,15 @@ class Cpaiement $this->db->begin(); - if (!$error) { - if (!$notrigger) { - // Uncomment this and change MYOBJECT to your own tag if you - // want this action calls a trigger. + // Uncomment this and change MYOBJECT to your own tag if you + // want this action calls a trigger. + //if (!$error && !$notrigger) { - //// Call triggers - //$result=$this->call_trigger('MYOBJECT_DELETE',$user); - //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} - //// End call triggers - } - } + // // Call triggers + // $result=$this->call_trigger('MYOBJECT_DELETE',$user); + // if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} + // // End call triggers + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; diff --git a/htdocs/compta/payment_sc/card.php b/htdocs/compta/payment_sc/card.php index b22d4d21e43..b4a21e198de 100644 --- a/htdocs/compta/payment_sc/card.php +++ b/htdocs/compta/payment_sc/card.php @@ -74,7 +74,8 @@ if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->tax->char } } -// Create payment +// Validate social contribution +/* if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->charges->creer) { $db->begin(); @@ -111,6 +112,7 @@ if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->tax->char $db->rollback(); } } +*/ /* @@ -150,12 +152,14 @@ if ($action == 'delete') /* * Validation confirmation of payment */ +/* if ($action == 'valide') { $facid = $_GET['facid']; print $form->formconfirm('card.php?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2); } +*/ $linkback = '' . $langs->trans("BackToList") . ''; diff --git a/htdocs/compta/salaries/class/paymentsalary.class.php b/htdocs/compta/salaries/class/paymentsalary.class.php index dc45c9a4fb0..ea67873c2ee 100644 --- a/htdocs/compta/salaries/class/paymentsalary.class.php +++ b/htdocs/compta/salaries/class/paymentsalary.class.php @@ -82,7 +82,6 @@ class PaymentSalary extends CommonObject $this->db = $db; $this->element = 'payment_salary'; $this->table_element = 'payment_salary'; - return 1; } /** diff --git a/htdocs/compta/sociales/class/cchargesociales.class.php b/htdocs/compta/sociales/class/cchargesociales.class.php index 409ee99aaae..9013edee195 100644 --- a/htdocs/compta/sociales/class/cchargesociales.class.php +++ b/htdocs/compta/sociales/class/cchargesociales.class.php @@ -25,7 +25,7 @@ */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; +//require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; //require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; //require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; @@ -77,31 +77,18 @@ class Cchargesociales $error = 0; - // Clean parameters - - if (isset($this->libelle)) { - $this->libelle = trim($this->libelle); - } - if (isset($this->deductible)) { - $this->deductible = trim($this->deductible); - } - if (isset($this->active)) { - $this->active = trim($this->active); - } - if (isset($this->code)) { - $this->code = trim($this->code); - } - if (isset($this->fk_pays)) { - $this->fk_pays = trim($this->fk_pays); - } - if (isset($this->module)) { - $this->module = trim($this->module); - } - if (isset($this->accountancy_code)) { - $this->accountancy_code = trim($this->accountancy_code); - } - - + // Clean parameters + $this->trimParameters( + array( + 'libelle', + 'deductible', + 'active', + 'code', + 'fk_pays', + 'module', + 'accountancy_code', + ) + ); // Check parameters // Put here code to add control on parameters values @@ -143,7 +130,7 @@ class Cchargesociales if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. @@ -151,7 +138,7 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_CREATE',$user); //if ($result < 0) $error++; //// End call triggers - } + //} } // Commit or rollback @@ -243,28 +230,17 @@ class Cchargesociales // Clean parameters - if (isset($this->libelle)) { - $this->libelle = trim($this->libelle); - } - if (isset($this->deductible)) { - $this->deductible = trim($this->deductible); - } - if (isset($this->active)) { - $this->active = trim($this->active); - } - if (isset($this->code)) { - $this->code = trim($this->code); - } - if (isset($this->fk_pays)) { - $this->fk_pays = trim($this->fk_pays); - } - if (isset($this->module)) { - $this->module = trim($this->module); - } - if (isset($this->accountancy_code)) { - $this->accountancy_code = trim($this->accountancy_code); - } - + $this->trimParameters( + array( + 'libelle', + 'deductible', + 'active', + 'code', + 'fk_pays', + 'module', + 'accountancy_code', + ) + ); // Check parameters @@ -290,7 +266,7 @@ class Cchargesociales dol_syslog(__METHOD__ . ' ' . join(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { + //if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -298,7 +274,7 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } + //} // Commit or rollback if ($error) { @@ -328,8 +304,8 @@ class Cchargesociales $this->db->begin(); - if (!$error) { - if (!$notrigger) { + //if (!$error) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -337,8 +313,8 @@ class Cchargesociales //$result=$this->call_trigger('MYOBJECT_DELETE',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } - } + //} + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; @@ -476,34 +452,33 @@ class Cchargesociales if ($mode == 0) { - $prefix=''; if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } @@ -526,4 +501,20 @@ class Cchargesociales $this->module = ''; $this->accountancy_code = ''; } + + /** + * Trim object parameters + * @param string[] $parameters array of parameters to trim + * + * @return void + */ + private function trimParameters($parameters) + { + if (!is_array($parameters)) return; + foreach ($parameters as $parameter) { + if (isset($this->$parameter)) { + $this->$parameter = trim($this->$parameter); + } + } + } } diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index 2ea82fb32c4..aa5786d0eb5 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -76,7 +76,6 @@ class ChargeSociales extends CommonObject function __construct($db) { $this->db = $db; - return 1; } /** @@ -431,8 +430,9 @@ class ChargeSociales extends CommonObject { // phpcs:enable global $langs; - $langs->load('customers'); - $langs->load('bills'); + + // Load translation files required by the page + $langs->loadLangs(array("customers","bills")); if ($mode == 0 || $mode == 1) { diff --git a/htdocs/contact/card.php b/htdocs/contact/card.php index 9e1757fdc5a..babc7e1453a 100644 --- a/htdocs/contact/card.php +++ b/htdocs/contact/card.php @@ -186,6 +186,8 @@ if (empty($reshook)) $object->country_id = GETPOST("country_id",'int'); $object->state_id = GETPOST("state_id",'int'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->email = GETPOST("email",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); @@ -358,6 +360,8 @@ if (empty($reshook)) $object->email = GETPOST("email",'alpha'); $object->skype = GETPOST("skype",'alpha'); + $object->twitter = GETPOST("twitter",'alpha'); + $object->facebook = GETPOST("facebook",'alpha'); $object->phone_pro = GETPOST("phone_pro",'alpha'); $object->phone_perso = GETPOST("phone_perso",'alpha'); $object->phone_mobile = GETPOST("phone_mobile",'alpha'); @@ -658,13 +662,28 @@ else // Instant message and no email print '
    jabberid).'">
    jabberid).'">
    skype).'">
    skype).'">
    twitter).'">
    facebook).'">
    skype).'">
    skype).'">
    twitter).'">
    facebook).'">
    '.dol_trunc($obj->poste,20).''.$obj->poste.'
    '.$langs->trans('Discount').''; - if ($object->thirdparty->remise_percent) print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); - else print $langs->trans("CompanyHasNoRelativeDiscount"); - $absolute_discount=$object->thirdparty->getAvailableDiscounts(); + if ($object->thirdparty->remise_percent) { + print $langs->trans("CompanyHasRelativeDiscount",$object->thirdparty->remise_percent); + } else { + print $langs->trans("CompanyHasNoRelativeDiscount"); + } + $absolute_discount = $object->thirdparty->getAvailableDiscounts(); print '. '; if ($absolute_discount) print $langs->trans("CompanyHasAbsoluteDiscount",price($absolute_discount),$langs->trans("Currency".$conf->currency)); else print $langs->trans("CompanyHasNoAbsoluteDiscount"); @@ -239,9 +241,7 @@ if ($id > 0 || ! empty($ref)) // Contacts lines include DOL_DOCUMENT_ROOT.'/core/tpl/contacts.tpl.php'; - } - else - { + } else { print "ErrorRecordNotFound"; } } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index e616afefd99..96f20fdaf67 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -107,7 +107,6 @@ $fieldstosearchall = array( 'c.ref_customer'=>'RefCustomer', 'c.ref_supplier'=>'RefSupplier', 's.nom'=>"ThirdParty", - 'cd.description'=>'Description', 'c.note_public'=>'NotePublic', ); if (empty($user->socid)) $fieldstosearchall["c.note_private"]="NotePrivate"; @@ -252,7 +251,7 @@ else if ($year > 0) $sql.= " AND c.date_contrat BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } if ($search_name) $sql .= natural_search('s.nom', $search_name); -if ($search_email) $sql .= natural_search('s.email', $search_name); +if ($search_email) $sql .= natural_search('s.email', $search_email); if ($search_contract) $sql .= natural_search(array('c.rowid', 'c.ref'), $search_contract); if (!empty($search_ref_customer)) $sql .= natural_search(array('c.ref_customer'), $search_ref_customer); if (!empty($search_ref_supplier)) $sql .= natural_search(array('c.ref_supplier'), $search_ref_supplier); @@ -622,7 +621,7 @@ while ($i < min($num,$limit)) if (!empty($obj->note_private) || !empty($obj->note_public)) { print ' '; - print ''.img_picto($langs->trans("ViewPrivateNote"),'object_generic').''; + print ''.img_picto($langs->trans("ViewPrivateNote"),'note').''; print ''; } diff --git a/htdocs/core/actions_printing.inc.php b/htdocs/core/actions_printing.inc.php index 302ad161241..d2d34cd523a 100644 --- a/htdocs/core/actions_printing.inc.php +++ b/htdocs/core/actions_printing.inc.php @@ -28,8 +28,7 @@ // Filename to print must be provided into 'file' parameter // Print file -if ($action == 'print_file' && $user->rights->printing->read) -{ +if ($action == 'print_file' && $user->rights->printing->read) { $langs->load("printing"); require_once DOL_DOCUMENT_ROOT . '/core/modules/printing/modules_printing.php'; $objectprint = new PrintingDriver($db); @@ -55,7 +54,7 @@ if ($action == 'print_file' && $user->rights->printing->read) $subdir = 'commande'; } try { - $ret = $printer->print_file(GETPOST('file', 'alpha'), $module, $subdir); + $ret = $printer->printFile(GETPOST('file', 'alpha'), $module, $subdir); if ($ret > 0) { //print '
    '.print_r($printer->errors, true).'
    '; setEventMessages($printer->error, $printer->errors, 'errors'); diff --git a/htdocs/core/ajax/selectsearchbox.php b/htdocs/core/ajax/selectsearchbox.php index 57483848c4e..364903c9cd7 100644 --- a/htdocs/core/ajax/selectsearchbox.php +++ b/htdocs/core/ajax/selectsearchbox.php @@ -53,6 +53,12 @@ $search_boxvalue=GETPOST('q', 'none'); $arrayresult=array(); // Define $searchform + +if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) +{ + $arrayresult['searchintomember']=array('position'=>8, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); +} + if ((( ! empty($conf->societe->enabled) && (empty($conf->global->SOCIETE_DISABLE_PROSPECTS) || empty($conf->global->SOCIETE_DISABLE_CUSTOMERS))) || ! empty($conf->fournisseur->enabled)) && empty($conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED) && $user->rights->societe->lire) { $arrayresult['searchintothirdparty']=array('position'=>10, 'shortcut'=>'T', 'img'=>'object_company', 'label'=>$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'text'=>img_picto('','object_company').' '.$langs->trans("SearchIntoThirdparties", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/societe/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); @@ -63,11 +69,6 @@ if (! empty($conf->societe->enabled) && empty($conf->global->MAIN_SEARCHFORM_CON $arrayresult['searchintocontact']=array('position'=>15, 'shortcut'=>'A', 'img'=>'object_contact', 'label'=>$langs->trans("SearchIntoContacts", $search_boxvalue), 'text'=>img_picto('','object_contact').' '.$langs->trans("SearchIntoContacts", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/contact/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); } -if (! empty($conf->adherent->enabled) && empty($conf->global->MAIN_SEARCHFORM_ADHERENT_DISABLED) && $user->rights->adherent->lire) -{ - $arrayresult['searchintomember']=array('position'=>20, 'shortcut'=>'M', 'img'=>'object_user', 'label'=>$langs->trans("SearchIntoMembers", $search_boxvalue), 'text'=>img_picto('','object_user').' '.$langs->trans("SearchIntoMembers", $search_boxvalue), 'url'=>DOL_URL_ROOT.'/adherents/list.php'.($search_boxvalue?'?sall='.urlencode($search_boxvalue):'')); -} - if (((! empty($conf->product->enabled) && $user->rights->produit->lire) || (! empty($conf->service->enabled) && $user->rights->service->lire)) && empty($conf->global->MAIN_SEARCHFORM_PRODUITSERVICE_DISABLED)) { diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index 54d265bf6af..dd64a07b8d9 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -86,7 +86,7 @@ class box_factures_imp extends ModeleBoxes if ($user->rights->facture->lire) { - $sql = "SELECT s.nom as name, s.rowid as socid,"; + $sql = "SELECT s.nom as name, s.rowid as socid, s.email,"; $sql.= " s.code_client,"; $sql.= " s.logo,"; $sql.= " f.facnumber, f.date_lim_reglement as datelimite,"; @@ -134,9 +134,11 @@ class box_factures_imp extends ModeleBoxes $facturestatic->total_ttc = $objp->total_ttc; $facturestatic->statut = $objp->fk_statut; $facturestatic->date_lim_reglement = $db->jdate($objp->datelimite); + $societestatic->id = $objp->socid; $societestatic->name = $objp->name; $societestatic->client = 1; + $societestatic->email = $objp->email; $societestatic->code_client = $objp->code_client; $societestatic->logo = $objp->logo; diff --git a/htdocs/core/class/CMailFile.class.php b/htdocs/core/class/CMailFile.class.php index 45998a78869..7562cd609c2 100644 --- a/htdocs/core/class/CMailFile.class.php +++ b/htdocs/core/class/CMailFile.class.php @@ -59,7 +59,11 @@ class CMailFile var $eol; var $eol2; - var $error=''; + + /** + * @var string Error code (or message) + */ + public $error=''; var $smtps; // Contains SMTPs object (if this method is used) var $phpmailer; // Contains PHPMailer object (if this method is used) @@ -385,13 +389,17 @@ class CMailFile // TODO if (! empty($moreinheader)) ... // Give the message a subject - $this->message->setSubject($this->encodetorfc2822($subject)); + try { + $result = $this->message->setSubject($subject); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + } // Set the From address with an associative array //$this->message->setFrom(array('john@doe.com' => 'John Doe')); if (! empty($from)) { try { - $this->message->setFrom($this->getArrayAddress($from)); + $result = $this->message->setFrom($this->getArrayAddress($from)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -400,7 +408,7 @@ class CMailFile // Set the To addresses with an associative array if (! empty($to)) { try { - $this->message->setTo($this->getArrayAddress($to)); + $result = $this->message->setTo($this->getArrayAddress($to)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } @@ -408,13 +416,17 @@ class CMailFile if (! empty($replyto)) { try { - $this->message->SetReplyTo($this->getArrayAddress($replyto)); + $result = $this->message->SetReplyTo($this->getArrayAddress($replyto)); } catch (Exception $e) { $this->errors[] = $e->getMessage(); } } - $this->message->setCharSet($conf->file->character_set_client); + try { + $result = $this->message->setCharSet($conf->file->character_set_client); + } catch (Exception $e) { + $this->errors[] = $e->getMessage(); + } if (! empty($this->html)) { @@ -1027,7 +1039,7 @@ class CMailFile $mimedone=0; $out = ""; - if ($filename_list) + if (is_array($filename_list)) { $filename_list_size=count($filename_list); for($i=0;$i < $filename_list_size;$i++) @@ -1199,7 +1211,7 @@ class CMailFile /** * Attach an image to email (mode = 'mail') * - * @param array $images_list Tableau + * @param array $images_list Array of array image * @return string Chaine images encodees */ function write_images($images_list) @@ -1207,7 +1219,7 @@ class CMailFile // phpcs:enable $out = ''; - if ($images_list) + if (is_array($images_list)) { foreach ($images_list as $img) { diff --git a/htdocs/core/class/CSMSFile.class.php b/htdocs/core/class/CSMSFile.class.php index c2512af70ef..b6c334f7e1c 100644 --- a/htdocs/core/class/CSMSFile.class.php +++ b/htdocs/core/class/CSMSFile.class.php @@ -34,15 +34,18 @@ */ class CSMSFile { - var $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; - var $addr_from; - var $addr_to; - var $deferred; - var $priority; - var $class; - var $message; - var $nostop; + public $addr_from; + public $addr_to; + public $deferred; + public $priority; + public $class; + public $message; + public $nostop; /** diff --git a/htdocs/core/class/antivir.class.php b/htdocs/core/class/antivir.class.php index d18501d54d9..c67e3f5f59d 100644 --- a/htdocs/core/class/antivir.class.php +++ b/htdocs/core/class/antivir.class.php @@ -40,7 +40,10 @@ class AntiVir */ public $errors = array(); - var $output; + /** + * @var string Used to return message + */ + public $output; /** * @var DoliDB Database handler. diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index a4665701661..cf830048cc0 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -43,15 +43,15 @@ class Canvas */ public $errors = array(); - var $actiontype; + public $actiontype; - var $dirmodule; // Module directory - var $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...) - var $canvas; // Name of canvas (ex: company, individual, product, service, ...) - var $card; // Tab (sub-canvas) + public $dirmodule; // Module directory + public $targetmodule; // Module concerned by canvas (ex: thirdparty, contact, ...) + public $canvas; // Name of canvas (ex: company, individual, product, service, ...) + public $card; // Tab (sub-canvas) - var $template_dir; // Initialized by getCanvas with templates directory - var $control; // Initialized by getCanvas with controller instance + public $template_dir; // Initialized by getCanvas with templates directory + public $control; // Initialized by getCanvas with controller instance /** diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index 2f9a8636c8b..f07916a7511 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -76,7 +76,6 @@ class Ccountry // extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/core/class/commondocgenerator.class.php b/htdocs/core/class/commondocgenerator.class.php index a818bfe7a2f..3792aaf9327 100644 --- a/htdocs/core/class/commondocgenerator.class.php +++ b/htdocs/core/class/commondocgenerator.class.php @@ -33,7 +33,11 @@ */ abstract class CommonDocGenerator { - var $error=''; + /** + * @var string Error code (or message) + */ + public $error=''; + protected $db; @@ -491,11 +495,11 @@ abstract class CommonDocGenerator /** * Define array with couple substitution key => substitution value * - * @param array $line Array of lines + * @param Object $line Object line * @param Translate $outputlangs Lang object to use for output * @return array Return a substitution array */ - function get_substitutionarray_lines($line,$outputlangs) + function get_substitutionarray_lines($line, $outputlangs) { // phpcs:enable global $conf; diff --git a/htdocs/core/class/commoninvoice.class.php b/htdocs/core/class/commoninvoice.class.php index e9be4b1f9da..b5b363db923 100644 --- a/htdocs/core/class/commoninvoice.class.php +++ b/htdocs/core/class/commoninvoice.class.php @@ -62,7 +62,7 @@ abstract class CommonInvoice extends CommonObject const TYPE_SITUATION = 5; /** - * Draft + * Draft status */ const STATUS_DRAFT = 0; @@ -431,11 +431,11 @@ abstract class CommonInvoice extends CommonObject { global $langs; if ($this->type == CommonInvoice::TYPE_STANDARD) return $langs->trans("InvoiceStandard"); - if ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); - if ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); - if ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); - if ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. - if ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); + elseif ($this->type == CommonInvoice::TYPE_REPLACEMENT) return $langs->trans("InvoiceReplacement"); + elseif ($this->type == CommonInvoice::TYPE_CREDIT_NOTE) return $langs->trans("InvoiceAvoir"); + elseif ($this->type == CommonInvoice::TYPE_DEPOSIT) return $langs->trans("InvoiceDeposit"); + elseif ($this->type == CommonInvoice::TYPE_PROFORMA) return $langs->trans("InvoiceProForma"); // Not used. + elseif ($this->type == CommonInvoice::TYPE_SITUATION) return $langs->trans("InvoiceSituation"); return $langs->trans("Unknown"); } @@ -475,10 +475,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); - return $langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusClosedUnpaid'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return $langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -493,10 +493,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return $langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); - return $langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return $langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return $langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return $langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -511,10 +511,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('Bill'.$prefix.'StatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); - return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('StatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('Bill'.$prefix.'StatusNotPaid'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('Bill'.$prefix.'StatusStarted'); } else { @@ -529,10 +529,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); - return img_picto($langs->trans('BillStatusStarted'),'statut3'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3'); } else { @@ -547,10 +547,10 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return img_picto($langs->trans('BillStatusDraft'),'statut0').' '.$langs->trans('BillStatusDraft'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); - if ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); - return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return img_picto($langs->trans('BillStatusCanceled'),'statut5').' '.$langs->trans('Bill'.$prefix.'StatusCanceled'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9').' '.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially'); + elseif ($alreadypaid <= 0) return img_picto($langs->trans('BillStatusNotPaid'),'statut1').' '.$langs->trans('BillStatusNotPaid'); + else return img_picto($langs->trans('BillStatusStarted'),'statut3').' '.$langs->trans('BillStatusStarted'); } else { @@ -566,14 +566,14 @@ abstract class CommonInvoice extends CommonObject if (! $paye) { if ($status == 0) return ''.$langs->trans('Bill'.$prefix.'StatusDraft').' '.img_picto($langs->trans('BillStatusDraft'),'statut0'); - if (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); - if (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); - if ($alreadypaid <= 0) + elseif (($status == 3 || $status == 2) && $alreadypaid <= 0) return ''.$langs->trans('Bill'.$prefix.'StatusCanceled').' '.img_picto($langs->trans('BillStatusCanceled'),'statut5'); + elseif (($status == 3 || $status == 2) && $alreadypaid > 0) return ''.$langs->trans('Bill'.$prefix.'StatusClosedPaidPartially').' '.img_picto($langs->trans('BillStatusClosedPaidPartially'),'statut9'); + elseif ($alreadypaid <= 0) { if ($type == self::TYPE_CREDIT_NOTE) return ''.$langs->trans('Bill'.$prefix.'StatusNotRefunded').' '.img_picto($langs->trans('StatusNotRefunded'),'statut1'); return ''.$langs->trans('Bill'.$prefix.'StatusNotPaid').' '.img_picto($langs->trans('BillStatusNotPaid'),'statut1'); } - return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); + else return ''.$langs->trans('Bill'.$prefix.'StatusStarted').' '.img_picto($langs->trans('BillStatusStarted'),'statut3'); } else { @@ -587,7 +587,7 @@ abstract class CommonInvoice extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.NotCamelCaps /** * Renvoi une date limite de reglement de facture en fonction des - * conditions de reglements de la facture et date de facturation + * conditions de reglements de la facture et date de facturation. * * @param integer $cond_reglement Condition of payment (code or id) to use. If 0, we use current condition. * @return date Date limite de reglement si ok, <0 si ko @@ -598,9 +598,11 @@ abstract class CommonInvoice extends CommonObject if (! $cond_reglement) $cond_reglement=$this->cond_reglement_code; if (! $cond_reglement) $cond_reglement=$this->cond_reglement_id; - $cdr_nbjour=0; $cdr_type=0; $cdr_decalage=0; + $cdr_nbjour=0; + $cdr_type=0; + $cdr_decalage=0; - $sqltemp = 'SELECT c.type_cdr,c.nbjour,c.decalage'; + $sqltemp = 'SELECT c.type_cdr, c.nbjour, c.decalage'; $sqltemp.= ' FROM '.MAIN_DB_PREFIX.'c_payment_term as c'; if (is_numeric($cond_reglement)) $sqltemp.= " WHERE c.rowid=".$cond_reglement; else { @@ -629,12 +631,18 @@ abstract class CommonInvoice extends CommonObject /* Definition de la date limite */ - // 1 : ajout du nombre de jours - $datelim = $this->date + ($cdr_nbjour * 3600 * 24); - - // 2 : application de la regle "fin de mois" - if ($cdr_type == 1) + // 0 : ajout du nombre de jours + if ($cdr_type == 0) { + $datelim = $this->date + ($cdr_nbjour * 3600 * 24); + + $datelim += ($cdr_decalage * 3600 * 24); + } + // 1 : application de la regle "fin de mois" + elseif ($cdr_type == 1) + { + $datelim = $this->date + ($cdr_nbjour * 3600 * 24); + $mois=date('m', $datelim); $annee=date('Y', $datelim); if ($mois == 12) @@ -649,23 +657,24 @@ abstract class CommonInvoice extends CommonObject // On se deplace au debut du mois suivant, et on retire un jour $datelim=dol_mktime(12,0,0,$mois,1,$annee); $datelim -= (3600 * 24); - } - elseif($cdr_type == 2 && !empty($cdr_nbjour)) // Application de la règle, le N du mois courant ou suivant - { - $date_piece = dol_mktime(0,0,0,date('m', $this->date),date('d', $this->date),date('Y', $this->date)); // Sans les heures minutes et secondes - $date_lim_current = dol_mktime(0,0,0,date('m', $this->date),$cdr_nbjour,date('Y', $this->date)); // Sans les heures minutes et secondes - $date_lim_next = strtotime(date('Y-m-d', $date_lim_current).' +1month'); + $datelim += ($cdr_decalage * 3600 * 24); + } + // 2 : application de la règle, le N du mois courant ou suivant + elseif ($cdr_type == 2 && !empty($cdr_decalage)) + { + $datelim = $this->date + ($cdr_nbjour * 3600 * 24); + + $date_piece = dol_mktime(0, 0, 0, date('m', $datelim),date('d', $datelim),date('Y', $datelim)); // Sans les heures minutes et secondes + $date_lim_current = dol_mktime(0, 0, 0, date('m', $datelim), $cdr_decalage, date('Y', $datelim)); // Sans les heures minutes et secondes + $date_lim_next = dol_time_plus_duree($date_lim_current, 1, 'm'); // Add 1 month $diff = $date_piece - $date_lim_current; - if($diff < 0) $datelim = $date_lim_current; + if ($diff < 0) $datelim = $date_lim_current; else $datelim = $date_lim_next; - } - - // 3 : application du decalage - $datelim += ($cdr_decalage * 3600 * 24); + else return 'Bad value for type_cdr in database for record cond_reglement = '.$cond_reglement; return $datelim; } diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 7991bbb9ae9..a11cd3dd49e 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -976,7 +976,7 @@ abstract class CommonObject * @param string $source Source of contact: external or thirdparty (llx_socpeople) or internal (llx_user) * @param int $list 0:Return array contains all properties, 1:Return array contains just id * @param string $code Filter on this code of contact type ('SHIPPING', 'BILLING', ...) - * @return array Array of contacts + * @return array|int Array of contacts, -1 if error */ function liste_contact($statut=-1,$source='external',$list=0,$code='') { @@ -1164,8 +1164,8 @@ abstract class CommonObject $sql.= " ".MAIN_DB_PREFIX."c_type_contact as tc"; $sql.= " WHERE ec.element_id = ".$id; $sql.= " AND ec.fk_socpeople = c.rowid"; - if ($source == 'internal') $sql.= " AND c.entity IN (0,".$conf->entity.")"; - if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('socpeople').")"; + if ($source == 'internal') $sql.= " AND c.entity IN (".getEntity('user').")"; + if ($source == 'external') $sql.= " AND c.entity IN (".getEntity('societe').")"; $sql.= " AND ec.fk_c_type_contact = tc.rowid"; $sql.= " AND tc.element = '".$element."'"; $sql.= " AND tc.source = '".$source."'"; @@ -2899,6 +2899,7 @@ abstract class CommonObject // Special case if ($origin == 'order') $origin='commande'; if ($origin == 'invoice') $origin='facture'; + if ($origin == 'invoice_template') $origin='facturerec'; $this->db->begin(); @@ -2929,7 +2930,9 @@ abstract class CommonObject } /** - * Fetch array of objects linked to current object. Links are loaded into this->linkedObjects array and this->linkedObjectsIds + * Fetch array of objects linked to current object (object of enabled modules only). Links are loaded into + * this->linkedObjectsIds array and + * this->linkedObjects array if $loadalsoobjects = 1 * Possible usage for parameters: * - all parameters empty -> we look all link to current object (current object can be source or target) * - source id+type -> will get target list linked to source @@ -2937,17 +2940,18 @@ abstract class CommonObject * - source id+type + target type -> will get target list of the type * - target id+type + target source -> will get source list of the type * - * @param int $sourceid Object source id (if not defined, id of object) - * @param string $sourcetype Object source type (if not defined, element name of object) - * @param int $targetid Object target id (if not defined, id of object) - * @param string $targettype Object target type (if not defined, elemennt name of object) - * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided - * @param int $alsosametype 0=Return only links to object that differs from source. 1=Include also link to objects of same type. - * @param string $orderby SQL 'ORDER BY' clause - * @return int <0 if KO, >0 if OK + * @param int $sourceid Object source id (if not defined, id of object) + * @param string $sourcetype Object source type (if not defined, element name of object) + * @param int $targetid Object target id (if not defined, id of object) + * @param string $targettype Object target type (if not defined, elemennt name of object) + * @param string $clause 'OR' or 'AND' clause used when both source id and target id are provided + * @param int $alsosametype 0=Return only links to object that differs from source type. 1=Include also link to objects of same type. + * @param string $orderby SQL 'ORDER BY' clause + * @param int $loadalsoobjects Load also array this->linkedObjects (Use 0 to increase performances) + * @return int <0 if KO, >0 if OK * @see add_object_linked, updateObjectLinked, deleteObjectLinked */ - function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1,$orderby='sourcetype') + function fetchObjectLinked($sourceid=null,$sourcetype='',$targetid=null,$targettype='',$clause='OR',$alsosametype=1,$orderby='sourcetype',$loadalsoobjects=1) { global $conf; @@ -2976,10 +2980,10 @@ abstract class CommonObject $targettype = (! empty($targettype) ? $targettype : $this->element); /*if (empty($sourceid) && empty($targetid)) - { - dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR); - return -1; - }*/ + { + dol_syslog('Bad usage of function. No source nor target id defined (nor as parameter nor as object id)', LOG_ERR); + return -1; + }*/ // Links between objects are stored in table element_element $sql = 'SELECT rowid, fk_source, sourcetype, fk_target, targettype'; @@ -3041,7 +3045,8 @@ abstract class CommonObject if (! empty($this->linkedObjectsIds)) { - foreach($this->linkedObjectsIds as $objecttype => $objectids) // $objecttype is a module name ('facture', 'mymodule', ...) or a module name with a suffix ('project_task', 'mymodule_myobj', ...) + $tmparray = $this->linkedObjectsIds; + foreach($tmparray as $objecttype => $objectids) // $objecttype is a module name ('facture', 'mymodule', ...) or a module name with a suffix ('project_task', 'mymodule_myobj', ...) { // Parse element/subelement (ex: project_task, cabinetmed_consultation, ...) $module = $element = $subelement = $objecttype; @@ -3107,21 +3112,28 @@ abstract class CommonObject // Here $module, $classfile and $classname are set if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { - dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); - //print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname); - if (class_exists($classname)) + if ($loadalsoobjects) { - foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element + dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); + //print '/'.$classpath.'/'.$classfile.'.class.php '.class_exists($classname); + if (class_exists($classname)) { - $object = new $classname($this->db); - $ret = $object->fetch($objectid); - if ($ret >= 0) + foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element { - $this->linkedObjects[$objecttype][$i] = $object; + $object = new $classname($this->db); + $ret = $object->fetch($objectid); + if ($ret >= 0) + { + $this->linkedObjects[$objecttype][$i] = $object; + } } } } } + else + { + unset($this->linkedObjectsIds[$objecttype]); + } } } return 1; @@ -3824,6 +3836,7 @@ abstract class CommonObject print '
     
    '; print ''; print '
    '; + print ''; print ' '.$langs->trans("ECMSections"); print '
    '; + // Show the link to "Root" + if ($showroot) + { + print '
    '; + + // Show filemanager tree (will be filled by call of ajax /ecm/tpl/enablefiletreeajax.tpl.php that execute ajaxdirtree.php) print '
    '; if ($action == 'deletefile') print $form->formconfirm('eeeee', $langs->trans('DeleteFile'), $langs->trans('ConfirmDeleteFile'), 'confirm_deletefile', '', '', 'deletefile'); @@ -170,7 +177,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg } else { - print '
    '; + print '
    '; $_POST['modulepart'] = $module; $_POST['openeddir'] = GETPOST('openeddir'); diff --git a/htdocs/core/tpl/login.tpl.php b/htdocs/core/tpl/login.tpl.php index eb9ce00c5ed..f3367d3e90f 100644 --- a/htdocs/core/tpl/login.tpl.php +++ b/htdocs/core/tpl/login.tpl.php @@ -78,7 +78,7 @@ $(document).ready(function () { - - +
    @@ -213,7 +213,9 @@ if ($forgetpasslink || $helpcenterlink) echo '
    '; echo '
    '; if ($forgetpasslink) { - echo ''; + $url=DOL_URL_ROOT.'/user/passwordforgotten.php'.$moreparam; + if (! empty($conf->global->MAIN_PASSWORD_FORGOTLINK)) $url=$conf->global->MAIN_PASSWORD_FORGOTLINK; + echo ''; echo $langs->trans('PasswordForgotten'); echo ''; } diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index f429f7216c0..23640216cd9 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -160,6 +160,7 @@ if ($nolinesbefore) { ?>
    trans('ServiceLimitedDuration').' '.$langs->trans('From').' '; ?> global->MAIN_USE_HOURMIN_IN_DATE_RANGE)?$conf->global->MAIN_USE_HOURMIN_IN_DATE_RANGE:''); - print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateligne", 1, 0); + print $form->selectDate($line->date_start, 'date_start', $hourmin, $hourmin, $line->date_start?0:1, "updateline", 1, 0); print ' '.$langs->trans('to').' '; - print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateligne", 1, 0); + print $form->selectDate($line->date_end, 'date_end', $hourmin, $hourmin, $line->date_end?0:1, "updateline", 1, 0); print '"; + +print ''; +print ''; +print ''; +print ''; +if ($conf->global->MAIN_MULTILANGS) { + print ''; +} +$subject = 'DATAPOLICIESSUBJECT_' . $l; +$linka = 'TXTLINKDATAPOLICIESACCEPT_' . $l; +$linkr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; +$content = 'DATAPOLICIESCONTENT_' . $l; +$acc = 'DATAPOLICIESACCEPT_' . $l; +$ref = 'DATAPOLICIESREFUSE_' . $l; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print '
    ' . fieldLabel('DefaultLang', 'default_lang') . '' . "\n"; + print $formadmin->select_language((GETPOST('l') ? GETPOST('l') : $langs->defaultlang), 'default_lang', 0, 0, 1, 0, 0, 'maxwidth200onsmartphone'); + print '
    '; +print $langs->trans('DATAPOLICIESSUBJECTMAIL') . ''; +print ''; +print '
    '; +print $langs->trans('DATAPOLICIESCONTENTMAIL').''; +print $langs->trans('DATAPOLICIESSUBSITUTION');echo'__LINKACCEPT__,__LINKREFUSED__,__FIRSTNAME__,__NAME__,__CIVILITY__'; +$doleditor = new DolEditor($content, $conf->global->$content, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
    '; +print $langs->trans('TXTLINKDATAPOLICIESACCEPT') . ''; +print ''; +print '
    '; +print $langs->trans('TXTLINKDATAPOLICIESREFUSE') . ''; +print ''; +print '
    '; + +print $langs->trans('DATAPOLICIESACCEPT').''; + +$doleditor = new DolEditor($acc, $conf->global->$acc, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
    '; +print $langs->trans('DATAPOLICIESREFUSE').''; + +print $langs->trans(''); +$doleditor = new DolEditor($ref, $conf->global->$ref, '', 250, 'Full', '', false, true, 1, 200, 70); +$doleditor->Create(); +print '
    '; + +print '
    '; + +print ''; + +dol_fiche_end(); + +print '

    '; + +print $langs->trans('SendAgreementText'); +print ''.$langs->trans('SendAgreement').''; + +llxFooter(); +$db->close(); diff --git a/htdocs/datapolicies/class/actions_datapolicies.class.php b/htdocs/datapolicies/class/actions_datapolicies.class.php new file mode 100644 index 00000000000..839d3f8ae07 --- /dev/null +++ b/htdocs/datapolicies/class/actions_datapolicies.class.php @@ -0,0 +1,476 @@ + + * + * 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 . + */ + +/** + * \file datapolicies/class/actions_datapolicies.class.php + * \ingroup datapolicies + * \brief Example hook overload. + */ + +/** + * Class ActionsDatapolicies + */ +class ActionsDatapolicies +{ + /** + * @var DoliDB Database handler. + */ + public $db; + + /** + * @var string Error + */ + public $error = ''; + + /** + * @var array Errors + */ + public $errors = array(); + + /** + * @var array Hook results. Propagated to $hookmanager->resArray for later reuse + */ + public $results = array(); + + /** + * @var string String displayed by executeHook() immediately after return + */ + public $resprints; + + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function getNomUrl($parameters, &$object, &$action) + { + global $db, $langs, $conf, $user; + $this->resprints = ''; + return 0; + } + + /** + * Overloading the doActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; + $langs->load('datapolicies@datapolicies'); + $error = 0; // Error counter + + if (GETPOST('socid') && $parameters['currentcontext'] == 'thirdpartycard') { + $object->fetch(GETPOST('socid')); + } + + // FIXME Removed hard coded id, use codes + if ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'anonymiser' && (in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8)) { + // on verifie si l'objet est utilisé + if ($object->isObjectUsed(GETPOST('socid'))) { + $object->name = $langs->trans('ANONYME'); + $object->name_bis = ''; + $object->name_alias = ''; + $object->address = ''; + $object->town = ''; + $object->zip = ''; + $object->phone = ''; + $object->email = ''; + $object->url = ''; + $object->fax = ''; + $object->state = ''; + $object->country = ''; + $object->state_id = ''; + $object->skype = ''; + $object->country_id = ''; + $object->note_private = $object->note_private . '
    ' . $langs->trans('ANONYMISER_AT', dol_print_date(time())); + + if ($object->update($object->id, $user, 0)) { + + // On supprime les contacts associé + $sql = "DELETE FROM " . MAIN_DB_PREFIX . "socpeople WHERE fk_soc = " . $object->id; + $this->db->query($sql); + + setEventMessages($langs->trans('ANONYMISER_SUCCESS'), array()); + header('Location:' . $_SERVER["PHP_SELF"] . "?socid=" . $object->id); + } + } + } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'datapolicies_portabilite') { + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $object->fetch(GETPOST('socid')); + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->name . ';'; + echo ';'; + echo ';'; + echo ';'; + echo ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone . ';'; + echo ';'; + echo ';'; + echo $object->skype . ';'; + echo ';'; + exit; + } elseif ($parameters['currentcontext'] == 'membercard' && $action == 'datapolicies_portabilite') { + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $soc = $object->fetch_thirdparty(); + + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->lastname . ';'; + echo $object->firstname . ';'; + echo $object->getCivilityLabel() . ';'; + echo ($soc != -1 ? $object->thirdparty->name : '') . ';'; + echo ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone . ';'; + echo $object->phone_perso . ';'; + echo $object->phone_mobile . ';'; + echo $object->skype . ';'; + echo dol_print_date($object->birth) . ';'; + exit; + } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'datapolicies_portabilite') { + $object->fetch(GETPOST('id')); + header('Content-Type: application/csv'); + header('Content-Disposition: attachment; filename=datapolicies_portabilite.csv'); + header('Pragma: no-cache'); + $soc = $object->fetch_thirdparty(); + echo 'Nom;Prénom;Civilite;Tiers;Poste/Fonction;Adresse;CP;Ville;Département;Pays;Email;Tel Pro;Tel Perso;Tel Portable;Messagerie instantanée;Date de naissance;' . PHP_EOL; + echo $object->lastname . ';'; + echo $object->firstname . ';'; + echo $object->getCivilityLabel() . ';'; + echo ($soc != -1 ? $object->thirdparty->name : '') . ';'; + echo $object->poste . ';'; + echo $object->address . ';'; + echo $object->zip . ';'; + echo $object->town . ';'; + echo $object->state . ';'; + echo $object->country . ';'; + echo $object->email . ';'; + echo $object->phone_pro . ';'; + echo $object->phone_perso . ';'; + echo $object->phone_mobile . ';'; + echo $object->jabberid . ';'; + echo dol_print_date($object->birth) . ';'; + exit; + } elseif ($parameters['currentcontext'] == 'contactcard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('id')); + + require_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; + DataPolicies::sendMailDataPoliciesContact($object); + } + elseif ($parameters['currentcontext'] == 'membercard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('id')); + require_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; + DataPolicies::sendMailDataPoliciesAdherent($object); + } elseif ($parameters['currentcontext'] == 'thirdpartycard' && $action == 'send_datapolicies') { + $object->fetch(GETPOST('socid')); + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; + DataPolicies::sendMailDataPoliciesCompany($object); + } + + + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Overloading the doActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function doMassActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; + + $error = 0; // Error counter + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + //if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { + // // do something only for the context 'somecontext1' or 'somecontext2' + // foreach ($parameters['toselect'] as $objectid) { + // // Do action on each object id + // } + //} + + if (!$error) { + $this->results = array('myreturn' => 999); + $this->resprints = 'A text to show'; + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Overloading the addMoreMassActions function : replacing the parent's function with the one below + * + * @param array $parameters Hook metadatas (context, etc...) + * @param CommonObject $object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...) + * @param string $action Current action (if set). Generally create or edit or null + * @param HookManager $hookmanager Hook manager propagated to allow calling another hook + * @return int < 0 on error, 0 on success, 1 to replace standard code + */ + public function addMoreMassActions($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; + + $error = 0; // Error counter + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + $this->resprints = ''; + } + + if (!$error) { + return 0; // or return 1 to replace standard code + } else { + $this->errors[] = 'Error message'; + return -1; + } + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $object Object output on PDF + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function beforePDFCreation($parameters, &$object, &$action) + { + global $conf, $user, $langs; + global $hookmanager; + + $outputlangs = $langs; + + $ret = 0; + $deltemp = array(); + dol_syslog(get_class($this) . '::executeHooks action=' . $action); + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + + } + + return $ret; + } + + /** + * Execute action + * + * @param array $parameters Array of parameters + * @param Object $pdfhandler PDF builder handler + * @param string $action 'add', 'update', 'view' + * @return int <0 if KO, + * =0 if OK but we want to process standard actions too, + * >0 if OK and we want to replace standard actions. + */ + function afterPDFCreation($parameters, &$pdfhandler, &$action) + { + global $conf, $user, $langs; + global $hookmanager; + + $outputlangs = $langs; + + $ret = 0; + $deltemp = array(); + dol_syslog(get_class($this) . '::executeHooks action=' . $action); + + /* print_r($parameters); print_r($object); echo "action: " . $action; */ + if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2' + + } + + return $ret; + } + + /** + * addMoreActionsButtons + * + * @param array $parameters array of parameters + * @param Object $object Object + * @param string $action Actions + * @param HookManager $hookmanager Hook manager + * @return void + */ + function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; + $langs->load('datapolicies@datapolicies'); + + $dialog = '"; + $dialog .= ''; + echo $dialog; + if ($parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif ($parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif ($parameters['currentcontext'] == 'contactcard') { + echo ''; + } + if (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'membercard') { + echo ''; + } elseif (!empty($object->mail) && empty($object->array_options['options_datapolicies_send']) && $parameters['currentcontext'] == 'contactcard') { + echo ''; + } + } + + /** + * printCommonFooter + * + * @param array $parameters array of parameters + * @param Object $object Object + * @param string $action Actions + * @param HookManager $hookmanager Hook manager + * @return void + */ + function printCommonFooter($parameters, &$object, &$action, $hookmanager) + { + global $conf, $user, $langs; + + $jsscript = ''; + if ($parameters['currentcontext'] == 'thirdpartycard') { + if (GETPOST('action') == 'create' || GETPOST('action') == 'edit' || GETPOST('action') == '') { + $jsscript .= ''; + } elseif (GETPOST('action') == 'confirm_delete' && GETPOST('confirm') == 'yes' && GETPOST('socid') > 0) { + + // La suppression n'a pas été possible + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + $societe = new Societe($this->db); + $societe->fetch(GETPOST('socid')); + // On vérifie si il est utilisé + if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(GETPOST('socid'))) { + + require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + $form = new Form($this->db); + echo $form->formconfirm($_SERVER["PHP_SELF"] . "?socid=" . GETPOST('socid'), substr($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans("DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans("DATAPOLICIES_POPUP_ANONYME_TEXTE"), 'anonymiser', '', '', 1); + } + } + + if (GETPOST('socid')) { + require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; + $societe = new Societe($this->db); + $societe->fetch(GETPOST('socid')); + + if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) { + + require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php'; + $jsscript .= ''; + } + } + } elseif ($parameters['currentcontext'] == 'contactcard') { + if (GETPOST('action') == 'create' || GETPOST('action') == 'edit') { + $jsscript .= ''; + } + } + + echo $jsscript; + } +} diff --git a/htdocs/datapolicies/class/datapolicies.class.php b/htdocs/datapolicies/class/datapolicies.class.php new file mode 100644 index 00000000000..1fbf1f71d45 --- /dev/null +++ b/htdocs/datapolicies/class/datapolicies.class.php @@ -0,0 +1,348 @@ +. + */ + +/** + * \file datapolicies/class/actions_datapolicies.class.php + * \ingroup datapolicies + * \brief Example hook overload. + * + * Put detailed description here. + */ +include_once DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php'; +include_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php'; +include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php'; + + +/** + * Class DataPolicies + */ +Class DataPolicies extends Contact +{ + /** + * getAllContactNotInformed + * + * @return number + */ + function getAllContactNotInformed() + { + global $langs, $conf, $db, $user; + + $langs->load("companies"); + + $sql = "SELECT c.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "socpeople as c"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe as s ON c.fk_soc = s.rowid"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "socpeople_extrafields as spe ON spe.fk_object = c.rowid"; + $sql .= " WHERE (c.statut=1 AND c.no_email=0 AND (spe.datapolicies_consentement=0 OR spe.datapolicies_consentement IS NULL) AND (spe.datapolicies_opposition_traitement=0 OR spe.datapolicies_opposition_traitement IS NULL) AND (spe.datapolicies_opposition_prospection=0 OR spe.datapolicies_opposition_prospection IS NULL))"; + $sql .= " AND spe.datapolicies_send IS NULL"; + $sql .= " AND c.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
    ".print_r($obj,1)."
    "; + $contact = new Contact($db); + $contact->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesContact($contact); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + /** + * getAllCompaniesNotInformed + * + * @return number + */ + function getAllCompaniesNotInformed() + { + global $langs, $conf, $db, $user; + + $langs->load("companies"); + + $sql = "SELECT s.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "societe_extrafields as se ON se.fk_object = s.rowid"; + $sql .= " WHERE s.statut=0 AND (se.datapolicies_consentement=0 OR se.datapolicies_consentement IS NULL) AND (se.datapolicies_opposition_traitement=0 OR se.datapolicies_opposition_traitement IS NULL) AND (se.datapolicies_opposition_prospection=0 OR se.datapolicies_opposition_prospection IS NULL)"; + $sql .= " AND se.datapolicies_send IS NULL"; + $sql .= " AND s.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
    ".print_r($obj,1)."
    "; + $societe = new Societe($db); + $societe->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesCompany($societe); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + /** + * getAllAdherentsNotInformed + * + * @return number + */ + function getAllAdherentsNotInformed() + { + global $langs, $conf, $db, $user; + + $langs->load("adherent"); + + $sql = "SELECT a.rowid"; + $sql .= " FROM " . MAIN_DB_PREFIX . "adherent as a"; + $sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "adherent_extrafields as ae ON ae.fk_object = a.rowid"; + $sql .= " WHERE a.statut=0 AND (ae.datapolicies_consentement=0 OR ae.datapolicies_consentement IS NULL) AND (ae.datapolicies_opposition_traitement=0 OR ae.datapolicies_opposition_traitement IS NULL) AND (ae.datapolicies_opposition_prospection=0 OR ae.datapolicies_opposition_prospection IS NULL)"; + $sql .= " AND ae.datapolicies_send IS NULL"; + $sql .= " AND a.entity=" . $conf->entity; + $resql = $this->db->query($sql); + if ($resql) { + $num = $this->db->num_rows($resql); + $i = 0; + while ($i < $num) { + $obj = $this->db->fetch_object($resql); + //echo "
    ".print_r($obj,1)."
    "; + $adherent = new Adherent($db); + $adherent->fetch($obj->rowid); + + DataPolicies::sendMailDataPoliciesAdherent($adherent); + $i++; + } + } else { + $this->error = $this->db->error(); + return -1; + } + } + + /** + * sendMailDataPoliciesContact + * + * @param mixed $contact Contact + * @return void + */ + function sendMailDataPoliciesContact($contact) + { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $contact->email; + //echo "
    ".print_r($contact,1)."
    "; + $code= md5($contact->email); + if (!empty($contact->default_lang)) { + $l = $contact->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + '__FIRSTNAME__' => $contact->firstname, + '__NAME__' => $contact->lastname, + '__CIVILITY__' => $contact->civility, + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $message); + } + + + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + + if ($mailfile->error) { + $resultmasssend .= '
    ' . $mailfile->error . '
    '; + } else { + $result4 = $mailfile->sendfile(); + if (!$error) { + + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
    "; + $contact->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $contact->update($contact->id); + + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + } + + /** + * sendMailDataPoliciesCompany + * + * @param Societe $societe Object societe + * @return void + */ + function sendMailDataPoliciesCompany($societe) + { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $societe->email; + + $code= md5($societe->email); + if (!empty($societe->default_lang)) { + $l = $societe->default_lang; + } else { + $l = $langs->defaultlang; + } + $s = "DATAPOLICIESSUBJECT_" . $l; + $ma = "DATAPOLICIESCONTENT_" . $l; + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + } + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg .= dol_concatdesc($actionmsg, $message); + } + + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
    ' . $mailfile->error . '
    '; + } else { + $result4 = $mailfile->sendfile(); + + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
    "; + $societe->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $societe->update($societe->id); + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + } + + /** + * sendMailDataPoliciesAdherent + * + * @param Adherent $adherent Member + * @return void + */ + function sendMailDataPoliciesAdherent($adherent) + { + global $langs, $conf, $db, $user; + $from = $user->getFullName($langs) . ' <' . $user->email . '>'; + $replyto = $from; + $sendto = $adherent->email; + + $code= md5($adherent->email); + if (!empty($adherent->default_lang)) { + $l = $adherent->default_lang; + } else { + $l = $langs->defaultlang; + } + $la = 'TXTLINKDATAPOLICIESACCEPT_' . $l; + $lr = 'TXTLINKDATAPOLICIESREFUSE_' . $l; + + $subject = $conf->global->$s; + $message = $conf->global->$ma; + $linka = $conf->global->$la; + $linkr = $conf->global->$lr; + + + $substitutionarray = array( + '__LINKACCEPT__' => ''.$linka.'', + '__LINKREFUSED__' => ''.$linkr.'', + ); + $subject = make_substitutions($subject, $substitutionarray); + $message = make_substitutions($message, $substitutionarray); + + $actiontypecode = 'AC_EMAIL'; + $actionmsg = $langs->transnoentities('MailSentBy') . ' ' . $from . ' ' . $langs->transnoentities('To') . ' ' . $sendto; + if ($message) { + if ($sendtocc) { + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + } + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subject); + $actionmsg .= dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg .= dol_concatdesc($actionmsg, $message); + } + + + // Send mail + require_once DOL_DOCUMENT_ROOT . '/core/class/CMailFile.class.php'; + $mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1); + if ($mailfile->error) { + $resultmasssend .= '
    ' . $mailfile->error . '
    '; + } else { + $result4 = $mailfile->sendfile(); + + if (!$error) { + $resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "
    "; + $adherent->array_options['options_datapolicies_send'] = date('Y-m-d', time()); + $adherent->update($user); + + } else { + dol_print_error($db); + } + } + setEventMessage($resultmasssend); + } +} diff --git a/htdocs/datapolicies/class/datapoliciescron.class.php b/htdocs/datapolicies/class/datapoliciescron.class.php new file mode 100644 index 00000000000..0de8e0b0635 --- /dev/null +++ b/htdocs/datapolicies/class/datapoliciescron.class.php @@ -0,0 +1,523 @@ + + * + * 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 . + */ + +/** + * \file datapolicies/class/datapoliciescron.class.php + * \ingroup datapolicies + * \brief Example hook overload. + */ + +/** + * Class DataPoliciesCron + */ +class DataPoliciesCron +{ + /** + * Function exec + * + * @return boolean + */ + public function exec() + { + global $conf, $db, $langs, $user; + + $langs->load('datapolicies@datapolicies'); + + // FIXME Removed hardcoded values of id + $arrayofparameters=array( + 'DATAPOLICIES_TIERS_CLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 1 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_PROSPECT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 2 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_PROSPECT_CLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 3 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) + AND s.entity = %d + AND s.client = 0 + AND s.fournisseur = 0 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_soc IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_TIERS_FOURNISSEUR' => array( + 'sql' => " + SELECT s.rowid FROM ".MAIN_DB_PREFIX."societe as s + WHERE (s.fk_forme_juridique IN (11, 12, 13, 15, 17, 18, 19, 35, 60, 312, 316, 401, 600, 700, 1005) OR s.fk_typent = 8) + AND s.entity = %d + AND s.fournisseur = 1 + AND s.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.rowid NOT IN ( + SELECT DISTINCT a.fk_soc + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Societe", + "file" => DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php', + 'fields_anonym' => array( + 'name' => $langs->trans('ANONYME'), + 'name_bis' => '', + 'name_alias' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_CLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 1 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_PROSPECT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 2 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_PROSPECT_CLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 3 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.client = 0 + AND s.fournisseur = 0 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_CONTACT_FOURNISSEUR' => array( + 'sql' => " + SELECT c.rowid FROM ".MAIN_DB_PREFIX."socpeople as c + INNER JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = c.fk_soc + WHERE c.entity = %d + AND c.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND s.fournisseur = 1 + AND c.rowid NOT IN ( + SELECT DISTINCT a.fk_contact + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.fk_contact IS NOT NULL + ) + ", + "class" => "Contact", + "file" => DOL_DOCUMENT_ROOT . '/contact/class/contact.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => '', + 'civility_id' => '', + 'poste' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone_pro' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'jabberid' => '', + 'country_id' => '', + ) + ), + 'DATAPOLICIES_ADHERENT' => array( + 'sql' => " + SELECT a.rowid FROM ".MAIN_DB_PREFIX."adherent as a + WHERE a.entity = %d + AND a.tms < DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.rowid NOT IN ( + SELECT DISTINCT a.fk_element + FROM ".MAIN_DB_PREFIX."actioncomm as a + WHERE a.tms > DATE_SUB(NOW(), INTERVAL %d MONTH) + AND a.elementtype LIKE 'member' + AND a.fk_element IS NOT NULL + ) + ", + "class" => "Adherent", + "file" => DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php', + 'fields_anonym' => array( + 'lastname' => $langs->trans('ANONYME'), + 'firstname' => $langs->trans('ANONYME'), + 'civility_id' => '', + 'societe' => '', + 'address' => '', + 'town' => '', + 'zip' => '', + 'phone' => '', + 'phone_perso' => '', + 'phone_mobile' => '', + 'email' => '', + 'url' => '', + 'fax' => '', + 'state' => '', + 'country' => '', + 'state_id' => '', + 'skype' => '', + 'country_id' => '', + ) + ), + ); + + foreach ($arrayofparameters as $key => $params) { + if ($conf->global->$key != '' && is_numeric($conf->global->$key) && (int) $conf->global->$key > 0) { + + $sql = sprintf($params['sql'], (int) $conf->entity, (int) $conf->global->$key, (int) $conf->global->$key); + + $resql = $db->query($sql); + + if ($resql && $db->num_rows($resql) > 0) { + + $num = $db->num_rows($resql); + $i = 0; + + require_once $params['file']; + $object = new $params['class']($db); + + while ($i < $num) + { + $obj = $db->fetch_object($resql); + + $object->fetch($obj->rowid); + $object->id = $obj->rowid; + + if ($object->isObjectUsed($obj->rowid) > 0) { + foreach ($params['fields_anonym'] as $fields => $val) { + $object->$fields = $val; + } + $object->update($obj->rowid, $user); + if ($params['class'] == 'Societe') { + // On supprime les contacts associé + $sql = "DELETE FROM ".MAIN_DB_PREFIX."socpeople WHERE fk_soc = " . $obj->rowid; + $db->query($sql); + } + } else { + if (DOL_VERSION < 8) { + $ret = $object->delete($obj->rowid, $user); + } else { + if ($object->element == 'adherent') { + $ret = $object->delete($obj->rowid); + } else { + $ret = $object->delete(); + } + } + + } + + $i++; + } + } + } + + } + return true; + } + + + /** + * sendMailing + * + * @return boolean + */ + public function sendMailing() + { + global $conf, $db, $langs, $user; + + $langs->load('datapolicies@datapolicies'); + + require_once DOL_DOCUMENT_ROOT . '/datapolicies/class/datapolicies.class.php'; + + $contacts = new DataPolicies($db); + $contacts->getAllContactNotInformed(); + $contacts->getAllCompaniesNotInformed(); + $contacts->getAllAdherentsNotInformed(); + return true; + } +} \ No newline at end of file diff --git a/htdocs/datapolicies/css/datapolicies.css.php b/htdocs/datapolicies/css/datapolicies.css.php new file mode 100644 index 00000000000..2e573ef92c3 --- /dev/null +++ b/htdocs/datapolicies/css/datapolicies.css.php @@ -0,0 +1,61 @@ +. + */ + +/** + * \file rgpd/css/rgpd.css.php + * \ingroup rgpd + * \brief CSS file for module rgpd. + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled. Language code is found on url. +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); +if (! defined('NOLOGIN')) define('NOLOGIN',1); // File must be accessed by logon page so without login +//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); // We need top menu content +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +require '../../main.inc.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; + +session_cache_limiter(false); + +// Load user to have $user->conf loaded (not done by default here because of NOLOGIN constant defined) and load permission if we need to use them in CSS +/*if (empty($user->id) && ! empty($_SESSION['dol_login'])) +{ + $user->fetch('',$_SESSION['dol_login']); + $user->getrights(); +}*/ + + +// Define css type +header('Content-type: text/css'); +// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. +// You can use CTRL+F5 to refresh your browser cache. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); +else header('Cache-Control: no-cache'); + +?> + +.myclasscss { + /* ... */ +} + + diff --git a/htdocs/datapolicies/img/datapolicies.png b/htdocs/datapolicies/img/datapolicies.png new file mode 100644 index 00000000000..2681ccc1d3a Binary files /dev/null and b/htdocs/datapolicies/img/datapolicies.png differ diff --git a/htdocs/datapolicies/img/gfdl.png b/htdocs/datapolicies/img/gfdl.png new file mode 100644 index 00000000000..f2bacfd179a Binary files /dev/null and b/htdocs/datapolicies/img/gfdl.png differ diff --git a/htdocs/datapolicies/img/gplv3.png b/htdocs/datapolicies/img/gplv3.png new file mode 100644 index 00000000000..ba78d4c4941 Binary files /dev/null and b/htdocs/datapolicies/img/gplv3.png differ diff --git a/htdocs/datapolicies/img/object_datapolicies.png b/htdocs/datapolicies/img/object_datapolicies.png new file mode 100644 index 00000000000..5d65c309cca Binary files /dev/null and b/htdocs/datapolicies/img/object_datapolicies.png differ diff --git a/htdocs/datapolicies/img/object_inoveaconseil.png b/htdocs/datapolicies/img/object_inoveaconseil.png new file mode 100644 index 00000000000..292a9c75ef2 Binary files /dev/null and b/htdocs/datapolicies/img/object_inoveaconseil.png differ diff --git a/htdocs/datapolicies/js/datapolicies.js.php b/htdocs/datapolicies/js/datapolicies.js.php new file mode 100644 index 00000000000..4433ab8ab81 --- /dev/null +++ b/htdocs/datapolicies/js/datapolicies.js.php @@ -0,0 +1,59 @@ +. + * + * Library javascript to enable Browser notifications + */ + +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); +if (!defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL', 1); +if (!defined('NOLOGIN')) define('NOLOGIN', 1); +if (!defined('NOREQUIREMENU')) define('NOREQUIREMENU', 1); +if (!defined('NOREQUIREHTML')) define('NOREQUIREHTML', 1); +if (!defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + + +/** + * \file datapolicies/js/datapolicies.js.php + * \ingroup datapolicies + * \brief JavaScript file for module datapolicies. + */ + +// Load Dolibarr environment +$res=0; +// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined) +if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); +// Try main.inc.php into web root detected using web root caluclated from SCRIPT_FILENAME +$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; +while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); +if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/../main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/../main.inc.php"); +// Try main.inc.php using relative path +if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); +if (! $res && file_exists("../../../main.inc.php")) $res=@include("../../../main.inc.php"); +if (! $res) die("Include of main fails"); + +// Define js type +header('Content-Type: application/javascript'); +// Important: Following code is to cache this file to avoid page request by browser at each Dolibarr page access. +// You can use CTRL+F5 to refresh your browser cache. +if (empty($dolibarr_nocache)) header('Cache-Control: max-age=3600, public, must-revalidate'); +else header('Cache-Control: no-cache'); +?> + diff --git a/htdocs/datapolicies/langs/en_US/datapolicies.lang b/htdocs/datapolicies/langs/en_US/datapolicies.lang new file mode 100644 index 00000000000..0afff450b38 --- /dev/null +++ b/htdocs/datapolicies/langs/en_US/datapolicies.lang @@ -0,0 +1,92 @@ +# Copyright (C) 2018 SuperAdmin +# +# 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 . + +# Module label 'ModulergpdName' +ModulergpdName = GDPR +# Module description 'ModulergpdDesc' +ModulergpdDesc = Conformity with the GDPR + +# +# Page d'administration +# +rgpdSetup = Module Setup +Settings_DATAPOLICIES = Settings of DATAPOLICIES module +rgpdSetupPage = According to Article 5 of the GDPR, personal data must be kept for a period not exceeding that necessary for the purposes for which they were processed, except for archival purposes. +The deletion will be done automatically after a certain duration without event (the duration which you will have indicated below). +NB_MONTHS = %s months +ONE_YEAR = 1 year +NB_YEARS = %s years +DATAPOLICIES_TIERS_CLIENT = Customer +DATAPOLICIES_TIERS_PROSPECT = Prospect +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Prospect/Customer +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Nor prospect/Nor customer +DATAPOLICIES_TIERS_FOURNISSEUR = Supplier +DATAPOLICIES_CONTACT_CLIENT = Customer +DATAPOLICIES_CONTACT_PROSPECT = Prospect +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Prospect/Customer +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Nor prospect/Nor customer +DATAPOLICIES_CONTACT_FOURNISSEUR = Supplier +DATAPOLICIES_ADHERENT = Member +DATAPOLICIES_Tooltip_SETUP = Type of contact - Indicate your choices for each type. +DATAPOLICIESMail=Emails Setup +DATAPOLICIESSUBJECTMAIL=Subject of email +DATAPOLICIESCONTENTMAIL=Content of the email +DATAPOLICIESSUBSITUTION=You can use the following variables in your email (LINKACCEPT allows to create a link recording the agreement of the person, LINKREFUSED makes it possible to record the refusal of the person): +DATAPOLICIESACCEPT=Message after agreement +DATAPOLICIESREFUSE=Message after desagreement +SendAgreementText=You can send a GDPR email to all your relevant contacts (who have not yet received an email and for which you have not registered anything about their GDPR agreement). To do this, use the following button. +SendAgreement=Send emails +AllAgreementSend = All emails have been sent +TXTLINKDATAPOLICIESACCEPT= Text for the link "agreement" +TXTLINKDATAPOLICIESREFUSE= Text for the link "desagreement" + + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = GDPR : Processing of personal data +DATAPOLICIES_consentement = Consent obtained for the processing of personal data +DATAPOLICIES_opposition_traitement = Opposes the processing of his personal data +DATAPOLICIES_opposition_prospection = Opposes the processing of his personal data for the purposes of prospecting + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonymize a thirdparty +DATAPOLICIES_POPUP_ANONYME_TEXTE = You can not delete this contact from Dolibarr because there are related items. In accordance with the GDPR, you will make all this data anonymous to respect your obligations. Would you like to continue ? + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portability GDPR +DATAPOLICIES_PORTABILITE_TITLE = Export of personal data +DATAPOLICIES_PORTABILITE_CONFIRMATION = You want to export the personal data of this contact. Are you sure ? + +# +# Note ajoutés lors d'une anonymisation +# +ANONYMISER_AT = Anonymised the %s + +#V2 +DATAPOLICIESReturn=GDPR Validation +DATAPOLICIES_date = Date of agreement/desagreement GDPR +DATAPOLICIES_send = Date sending agreement email +DATAPOLICIESReturn = GDPR Return +DATAPOLICIES_SEND = Send GDPR email +MailSent = Email has been sent + +#ERROR +ErrorSubjectIsRequired= Error : The subject of email is required. Indicate it in the module setup +=Due to a technical problem, we were unable to register your choice. We apologize for that. Contact us to send us your choice. diff --git a/htdocs/datapolicies/langs/fr_FR/datapolicies.lang b/htdocs/datapolicies/langs/fr_FR/datapolicies.lang new file mode 100644 index 00000000000..ba024fbb2fb --- /dev/null +++ b/htdocs/datapolicies/langs/fr_FR/datapolicies.lang @@ -0,0 +1,96 @@ +# Copyright (C) 2018 INOVEA CONSEIl info@inovea-conseil.com +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (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 . + +# +# Générique +# + +# Module label 'ModulergpdName' +ModulergpdName = DATAPOLICIES +# Module description 'ModulergpdDesc' +Module432452Desc = Module de mise en conformité avec le DATAPOLICIES + +# +# Page d'administration +# +rgpdSetup = Configuration du module DATAPOLICIES +Settings_DATAPOLICIES = Paramétrage du module DATAPOLICIES +rgpdSetupPage = Selon l’article 5 du DATAPOLICIES, les données à caractère personnel doivent être conservées pendant une durée n’excédant pas celle nécessaire au regard des finalités pour lesquelles elles ont été traitées, à l’exception de fins archivistiques. La suppression se fera automatiquement après une certaine durée sans évènement (la durée que vous aurez indiquée ci-dessous). +NB_MONTHS = %s mois +ONE_YEAR = 1 an +NB_YEARS = %s ans +DATAPOLICIES_TIERS_CLIENT = Client +DATAPOLICIES_TIERS_PROSPECT = Prospect +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Prospect/Client +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Ni prospect / Ni client +DATAPOLICIES_TIERS_FOURNISSEUR = Fournisseur +DATAPOLICIES_CONTACT_CLIENT = Client +DATAPOLICIES_CONTACT_PROSPECT = Prospect +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Prospect/Client +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Ni prospect / Ni client +DATAPOLICIES_CONTACT_FOURNISSEUR = Fournisseur +DATAPOLICIES_ADHERENT = Adhérent +DATAPOLICIES_Tooltip_SETUP = Type du contact - Indiquez vos choix pour chaque type. +DATAPOLICIESMail=Paramétrage des emails +DATAPOLICIESSUBJECTMAIL=Objet du mail +DATAPOLICIESCONTENTMAIL=Contenu du mail +DATAPOLICIESSUBSITUTION=Vous pouvez utiliser les variables suivantes dans votre email (LINKACCEPT permet de créer un lien enregistrant l'acceptation de la personne, LINKREFUSED permet d'enregistrer le refus de la personne) : +DATAPOLICIESACCEPT=Message suite acceptation +DATAPOLICIESREFUSE=Message suite opposition +SendAgreementText=Vous pouvez envoyer un email DATAPOLICIES à tous vos contacts concernés (qui n'ont pas encore reçus de mail et pour lesquels vous n'avez rien enregistré concernant leur accord/désaccord DATAPOLICIES). Pour cela, utilisez le bouton suivant. +SendAgreement=Envoyer les emails +AllAgreementSend = Tous les e-mails de consentement ont été envoyés +TXTLINKDATAPOLICIESACCEPT= Texte du lien d'acceptation +TXTLINKDATAPOLICIESREFUSE= Texte du lien d'opposition + + + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = DATAPOLICIES : Traitement des données à caractère personnel +DATAPOLICIES_consentement = Consentement recueilli pour le traitement des données à caractère personnel le concernant +DATAPOLICIES_opposition_traitement = S’oppose au traitement de ses données à caractère personnel +DATAPOLICIES_opposition_prospection = S’oppose au traitement de ses données à caractère personnel à des fins de prospection + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonymiser un tiers +DATAPOLICIES_POPUP_ANONYME_TEXTE = Vous ne pouvez pas supprimer ce contact de Dolibarr car des éléments y sont liés. Conformément au DATAPOLICIES, vous allez rendre toutes ces données anonymes afin de respecter vos obligations. Souhaitez-vous continuer ? + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portabilité DATAPOLICIES +DATAPOLICIES_PORTABILITE_TITLE = Export des données à caractère personnel +DATAPOLICIES_PORTABILITE_CONFIRMATION = Vous souhaitez exporter les données à caractère personnel de ce contact. Etes-vous sûr ? + +# +# Note ajoutés lors d'une anonymisation +# +ANONYMISER_AT = Anonymisé le %s + +#V2 +DATAPOLICIESReturn=Validation DATAPOLICIES +DATAPOLICIES_date=Date d'accord/opposition au traitement +DATAPOLICIES_send=Date envoi consentement +DATAPOLICIESReturn=Retour DATAPOLICIES +DATAPOLICIES_SEND=Envoyer l'email de consentement +MailSent=L'email a bien été envoyé + +#ERROR +ErrorSubjectIsRequired=Erreur : vous n'avez pas indiqué l'objet de l'email dans la configuration +=Suite à un problème technique, nous n'avons pas pu enregistrer votre choix. Nous nous en excusons. Contactez-nous pour nous transmettre votre choix. diff --git a/htdocs/datapolicies/langs/it_IT/datapolicies.lang b/htdocs/datapolicies/langs/it_IT/datapolicies.lang new file mode 100644 index 00000000000..a979c931c41 --- /dev/null +++ b/htdocs/datapolicies/langs/it_IT/datapolicies.lang @@ -0,0 +1,80 @@ +# Copyright (C) 2018 INOVEA CONSEIl info@inovea-conseil.com - Thanks to Claudio Aschieri +# +# # Module label 'ModulergpdName' +ModulergpdName = GDPR +# Module description 'ModulergpdDesc' +ModulergpdDesc = Conformità con GDPR +Module432452Name=GDPR +Module432452Desc=Conformità con GDPR (Regolamento Generale sulla protezione di dati) + +# +# Page d'administration +# +rgpdSetup = Module Setup +Settings_DATAPOLICIES = Configurazione modulo GDPR +rgpdSetupPage = In accordo con l'art 5 del GDPR i dati personali devono essere conservati per un periodo di tempo che .... ed eliminati se non sono più utili agli scopi per cui sono stati processati. +NB_MONTHS = %s mesi +ONE_YEAR = 1 anno +NB_YEARS = %s anni +DATAPOLICIES_TIERS_CLIENT = Cliente +DATAPOLICIES_TIERS_PROSPECT = Fornitore +DATAPOLICIES_TIERS_PROSPECT_CLIENT = Potenziale Cliente / Cliente +DATAPOLICIES_TIERS_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente +DATAPOLICIES_TIERS_FOURNISSEUR = Fornitore +DATAPOLICIES_CONTACT_CLIENT = Cliente +DATAPOLICIES_CONTACT_PROSPECT = Potenziale cliente +DATAPOLICIES_CONTACT_PROSPECT_CLIENT = Potenziale Cliente / Cliente +DATAPOLICIES_CONTACT_NIPROSPECT_NICLIENT = Nè potenziale cliente / Nè cliente +DATAPOLICIES_CONTACT_FOURNISSEUR = Fornitore +DATAPOLICIES_ADHERENT = Membri +DATAPOLICIES_Tooltip_SETUP = Tipo di contatto - Indica la scelta per ogni tipologia +DATAPOLICIESMail=Configurazione Email +DATAPOLICIESSUBJECTMAIL=Subject dell'e-mail +DATAPOLICIESCONTENTMAIL=Contenuto dell'e-mail +DATAPOLICIESSUBSITUTION=Puoi utilizzare le seguenti variabili nella tua email (LINKACCEPT consente di creare un link per registrare l'accettazione della persona, LINKREFUSED consente di registrare il rifiuto della persona): +DATAPOLICIESACCEPT= Messaggio dopo il consenso +DATAPOLICIESREFUSE=Messaggio dopo il rifiuto +SendAgreementText=Puoi inviare un'email GDPR a tutti i tuoi contatti rilevanti (che non hanno ancora ricevuto un'e-mail e per i quali non hai registrato nulla sul loro accordo GDPR). Per fare ciò, utilizzare il seguente pulsante. +SendAgreement=Invia emails +AllAgreementSend = Tutte le email sono state inviate +TXTLINKDATAPOLICIESACCEPT= Testo per il link "Consenso" +TXTLINKDATAPOLICIESREFUSE= Testo per il link "Consenso negato" + +# +# Extrafield +# +DATAPOLICIES_BLOCKCHECKBOX = GDPR : Trattamento dei dati personali +DATAPOLICIES_consentement = Consenso ottenuto al Trattamento dei dati personali +DATAPOLICIES_opposition_traitement = Consenso negato al trattamento dei dati personali +DATAPOLICIES_opposition_prospection = Consenso negato al trattamento dei dati personali a fini commerciali + +# +# Popup +# +DATAPOLICIES_POPUP_ANONYME_TITLE = Anonimizza un soggetto terzo +DATAPOLICIES_POPUP_ANONYME_TEXTE = Impossibile eliminare questo contatto da Dolibarr perchè vi sono elementi collegati. In conformità con il GDPR, renderai tutti questi dati anonimi per rispettare i tuoi obblighi. Vuoi continuare? + + +# +# Bouton portabilité +# +DATAPOLICIES_PORTABILITE = Portabilità GDPR +DATAPOLICIES_PORTABILITE_TITLE = Esporta i dati personali +DATAPOLICIES_PORTABILITE_CONFIRMATION = Vuoi davvero esportare i dati personali di questo contatto? + +# +# Note ajoutée lors d'une anonymisation +# +ANONYMISER_AT = Anonimizzato il %s + +#V2 +DATAPOLICIESReturn=GDPR Validazione +DATAPOLICIES_date = Data di accordo / disaccordo GDPR +DATAPOLICIES_send = Data di invio del consenso (e-mail) +DATAPOLICIESReturn = GDPR ritorno +DATAPOLICIES_SEND = Inviare GDPR e-mail +MailSent=L'email è stata inviata + +#ERROR +ErrorSubjectIsRequired= Errore: L'oggetto della mail è obbligatorio. Inserisci l'oggetto nella configurazione del modulo. +=A causa di un problema tecnico, non siamo stati in grado di registrare la tua scelta. Ci scusiamo per questo. Contattaci per inviarci la tua scelta. diff --git a/htdocs/datapolicies/lib/datapolicies.lib.php b/htdocs/datapolicies/lib/datapolicies.lib.php new file mode 100644 index 00000000000..d02668d40fc --- /dev/null +++ b/htdocs/datapolicies/lib/datapolicies.lib.php @@ -0,0 +1,59 @@ +. + */ + +/** + * \file datapolicies/lib/datapolicies.lib.php + * \ingroup datapolicies + * \brief Library files with common functions for datapolicies + */ + +/** + * Prepare admin pages header + * + * @return array + */ +function datapoliciesAdminPrepareHead() +{ + global $langs, $conf; + + $langs->load("datapolicies@datapolicies"); + + $h = 0; + $head = array(); + + $head[$h][0] = dol_buildpath("/datapolicies/admin/setup.php", 1); + $head[$h][1] = $langs->trans("Settings_DATAPOLICIES"); + $head[$h][2] = 'settings'; + $h++; + + $head[$h][0] = dol_buildpath("/datapolicies/admin/setupmail.php", 1); + $head[$h][1] = $langs->trans("DATAPOLICIESMail"); + $head[$h][2] = 'settings'; + $h++; + + // Show more tabs from modules + // Entries must be declared in modules descriptor with line + //$this->tabs = array( + // 'entity:+tabname:Title:@datapolicies:/datapolicies/mypage.php?id=__ID__' + //); // to add new tab + //$this->tabs = array( + // 'entity:-tabname:Title:@datapolicies:/datapolicies/mypage.php?id=__ID__' + //); // to remove a tab + complete_head_from_modules($conf, $langs, $object, $head, $h, 'datapolicies'); + + return $head; +} diff --git a/htdocs/datapolicies/mailing.php b/htdocs/datapolicies/mailing.php new file mode 100644 index 00000000000..08c24d9aceb --- /dev/null +++ b/htdocs/datapolicies/mailing.php @@ -0,0 +1,43 @@ + + * + * 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 . + */ + +/** + * \file datapolicies/mailing.php + * \ingroup datapolicies + * \brief datapolicies mailing page. + */ + +require '../../main.inc.php'; +dol_include_once('/contact/class/contact.class.php'); +dol_include_once('/datapolicies/class/datapolicies.class.php'); + +$idcontact = GETPOST('idc'); + +if(!empty($idcontact)){ + $contact = new Contact($db); + $contact->fetch($idcontact); + DataPolicies::sendMailDataPoliciesContact($contact); + + +}else{ + + $contacts = new DataPolicies($db); + $contacts->getAllContactNotInformed(); + $contacts->getAllCompaniesNotInformed(); + $contacts->getAllAdherentsNotInformed(); + echo $langs->trans('AllAgreementSend'); +} diff --git a/htdocs/datapolicies/modulebuilder.txt b/htdocs/datapolicies/modulebuilder.txt new file mode 100644 index 00000000000..24ea0d6eac5 --- /dev/null +++ b/htdocs/datapolicies/modulebuilder.txt @@ -0,0 +1,3 @@ +# DO NOT DELETE THIS FILE MANUALLY +# File to flag module built using official module template. +# When this file is present into a module directory, you can edit it with the module builder tool. Use ModuleBuilder if you want to delete module. \ No newline at end of file diff --git a/htdocs/datapolicies/public/index.php b/htdocs/datapolicies/public/index.php new file mode 100644 index 00000000000..4dd07f2ea2d --- /dev/null +++ b/htdocs/datapolicies/public/index.php @@ -0,0 +1,142 @@ + + * + * 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 . + */ + +/** + * \file datapolicies/admin/setup.php + * \ingroup datapolicies + * \brief datapolicies setup page. + */ +if (!defined('NOLOGIN')) + define("NOLOGIN", 1); // This means this output page does not require to be logged. +if (!defined('NOCSRFCHECK')) + define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test +if (!defined('NOREQUIREMENU')) + define('NOREQUIREMENU', '1'); + +require '../../main.inc.php'; +dol_include_once('/contact/class/contact.class.php'); +dol_include_once('/societe/class/societe.class.php'); +dol_include_once('/adherents/class/adherent.class.php'); +dol_include_once('/user/class/user.class.php'); +dol_include_once('/datapolicies/class/datapolicies.class.php'); + +$idc = GETPOST('c'); +$ids = GETPOST('s'); +$ida = GETPOST('a'); +$action = GETPOST('action'); +$lang = GETPOST('l'); +$code = GETPOST('key'); +$acc = "DATAPOLICIESACCEPT_" . $lang; +$ref = "DATAPOLICIESREFUSE_" . $lang; +$langs->load('datapolicies@datapolicies',0,0,$lang); + +if (empty($action) || (empty($idc) && empty($ids) && empty($ida))) { + return 0; +} elseif (!empty($idc)) { + $contact = new Contact($db); + $contact->fetch($idc); + $check = md5($contact->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $contact->array_options['options_datapolicies_consentement'] = 1; + $contact->array_options['options_datapolicies_opposition_traitement'] = 0; + $contact->array_options['options_datapolicies_opposition_prospection'] = 0; + $contact->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$acc; + } elseif ($action == 2) { + $contact->no_email = 1; + $contact->array_options['options_datapolicies_consentement'] = 0; + $contact->array_options['options_datapolicies_opposition_traitement'] = 1; + $contact->array_options['options_datapolicies_opposition_prospection'] = 1; + $contact->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $contact->update($idc); +} elseif (!empty($ids)) { + $societe = new Societe($db); + $societe->fetch($ids); + $check = md5($societe->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $societe->array_options['options_datapolicies_consentement'] = 1; + $societe->array_options['options_datapolicies_opposition_traitement'] = 0; + $societe->array_options['options_datapolicies_opposition_prospection'] = 0; + $societe->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + $return = $conf->global->$acc; + } elseif ($action == 2) { + $societe->array_options['options_datapolicies_consentement'] = 0; + $societe->array_options['options_datapolicies_opposition_traitement'] = 1; + $societe->array_options['options_datapolicies_opposition_prospection'] = 1; + $societe->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $societe->update($ids); +} elseif (!empty($ida)) { + $adherent = new Adherent($db); + $adherent->fetch($ida); + $check = md5($adherent->email); + if ($check != $code) { + $return = $langs->trans('ErrorEmailDATAPOLICIES'); + } elseif ($action == 1) { + $adherent->array_options['options_datapolicies_consentement'] = 1; + $adherent->array_options['options_datapolicies_opposition_traitement'] = 0; + $adherent->array_options['options_datapolicies_opposition_prospection'] = 0; + //$adherent->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + $return = $conf->global->$acc; + } elseif ($action == 2) { + $adherent->array_options['options_datapolicies_consentement'] = 0; + $adherent->array_options['options_datapolicies_opposition_traitement'] = 1; + $adherent->array_options['options_datapolicies_opposition_prospection'] = 1; + //$adherent->array_options['options_datapolicies_date'] = date('Y-m-d', time()); + + $return = $conf->global->$ref; + } + $newuser = new User($db); + $adherent->update($newuser); +} + +header("Content-type: text/html; charset=" . $conf->file->character_set_client); + +print ''; +print "\n"; +print "\n"; +print "\n"; +print '' . "\n"; +print '' . "\n"; +print '' . "\n"; +print "" . $langs->trans("DATAPOLICIESReturn") . "\n"; +print '' . "\n"; +print ''; + +print "\n"; +print '' . "\n"; +print '
    '; +print $return . "
    \n"; +print '
    '; +print "\n"; +print "\n"; + +$db->close(); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 279f8d980de..0723ecb659a 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -107,7 +107,7 @@ class Don extends CommonObject function LibStatut($statut,$mode=0) { // phpcs:enable - if (empty($this->labelstatut) || empty($this->labelstatushort)) + if (empty($this->labelstatut) || empty($this->labelstatutshort)) { global $langs; $langs->load("donations"); @@ -132,37 +132,37 @@ class Don extends CommonObject elseif ($mode == 2) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatutshort[$statut]; - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatutshort[$statut]; + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatutshort[$statut]; } elseif ($mode == 3) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6'); } elseif ($mode == 4) { if ($statut == -1) return img_picto($this->labelstatut[$statut],'statut5').' '.$this->labelstatut[$statut]; - if ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; - if ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; - if ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; + elseif ($statut == 0) return img_picto($this->labelstatut[$statut],'statut0').' '.$this->labelstatut[$statut]; + elseif ($statut == 1) return img_picto($this->labelstatut[$statut],'statut1').' '.$this->labelstatut[$statut]; + elseif ($statut == 2) return img_picto($this->labelstatut[$statut],'statut6').' '.$this->labelstatut[$statut]; } elseif ($mode == 5) { if ($statut == -1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return $this->labelstatutshort[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } elseif ($mode == 6) { if ($statut == -1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut5'); - if ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); - if ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); - if ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); + elseif ($statut == 0) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut0'); + elseif ($statut == 1) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut1'); + elseif ($statut == 2) return $this->labelstatut[$statut].' '.img_picto($this->labelstatut[$statut],'statut6'); } } diff --git a/htdocs/don/document.php b/htdocs/don/document.php index 7459bf82453..177b2b82d8b 100644 --- a/htdocs/don/document.php +++ b/htdocs/don/document.php @@ -40,9 +40,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -$langs->load("other"); -$langs->load("donations"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","other","donations")); $id = GETPOST('id','int'); $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 1e7d93302d8..782a3afba75 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -28,8 +28,8 @@ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; -$langs->load("companies"); -$langs->load("donations"); +// Load translation files required by the page +$langs->loadLangs(array("companies","donations")); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); diff --git a/htdocs/don/note.php b/htdocs/don/note.php index d78aa2c7ea5..3a5c55f7c6d 100644 --- a/htdocs/don/note.php +++ b/htdocs/don/note.php @@ -35,9 +35,8 @@ if (! empty($conf->projet->enabled)) require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; } -$langs->load("companies"); -$langs->load("bills"); -$langs->load("donations"); +// Load translation files required by the page +$langs->loadLangs(array("companies","bills","donations")); $id=(GETPOST('id','int')?GETPOST('id','int'):GETPOST('facid','int')); // For backward compatibility $ref=GETPOST('ref','alpha'); diff --git a/htdocs/don/payment/card.php b/htdocs/don/payment/card.php index e4a7ef5c5d4..dde03cb461d 100644 --- a/htdocs/don/payment/card.php +++ b/htdocs/don/payment/card.php @@ -28,9 +28,8 @@ require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/modules/facture/modules_facture.php'; if (! empty($conf->banque->enabled)) require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; -$langs->load('bills'); -$langs->load('banks'); -$langs->load('companies'); +// Load translation files required by the page +$langs->loadLangs(array("bills","banks","companies")); // Security check $id=GETPOST('rowid')?GETPOST('rowid','int'):GETPOST('id','int'); diff --git a/htdocs/don/stats/index.php b/htdocs/don/stats/index.php index cb574da939a..224e674e9da 100644 --- a/htdocs/don/stats/index.php +++ b/htdocs/don/stats/index.php @@ -47,9 +47,8 @@ $year = GETPOST('year')>0?GETPOST('year'):$nowyear; $startyear=$year-1; $endyear=$year; -$langs->load("sendings"); -$langs->load("other"); -$langs->load("companies"); +// Load translation files required by the page +$langs->loadLangs(array("companies","other","sendings")); /* diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php index 54077a68de6..50dbcb60dc6 100644 --- a/htdocs/ecm/class/ecmfiles.class.php +++ b/htdocs/ecm/class/ecmfiles.class.php @@ -56,7 +56,12 @@ class EcmFiles extends CommonObject */ public $ref; - public $label; // hash of file content (md5_file(dol_osencode($destfull)) + /** + * hash of file content (md5_file(dol_osencode($destfull)) + * @var string Ecm Files label + */ + public $label; + public $share; // hash for file sharing, empty by default (example: getRandomPassword(true)) /** @@ -848,7 +853,10 @@ class EcmFiles extends CommonObject class EcmfilesLine { - public $label; + /** + * @var string ECM files line label + */ + public $label; /** * @var int Entity diff --git a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php index 0a51e8cc73d..b7c20e33d2d 100644 --- a/htdocs/ecm/tpl/enablefiletreeajax.tpl.php +++ b/htdocs/ecm/tpl/enablefiletreeajax.tpl.php @@ -27,7 +27,7 @@ if (empty($conf) || ! is_object($conf)) ?> - + '."\n"; // We include full because we need the support of containerCssClass } - } + if (! defined('DISABLE_MULTISELECT')) // jQuery plugin "mutiselect" to select with checkboxes + { + print ''."\n"; + } + } if (! $disablejs && ! empty($conf->use_javascript_ajax)) { diff --git a/htdocs/margin/admin/margin.php b/htdocs/margin/admin/margin.php index 4ccdcc4542a..b2c74506990 100644 --- a/htdocs/margin/admin/margin.php +++ b/htdocs/margin/admin/margin.php @@ -29,10 +29,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php'; require_once DOL_DOCUMENT_ROOT."/compta/facture/class/facture.class.php"; -$langs->load("admin"); -$langs->load("bills"); -$langs->load("margins"); -$langs->load("stocks"); +$langs->loadLangs(array("admin", "bills", "margins", "stocks")); if (! $user->admin) accessforbidden(); diff --git a/htdocs/margin/tabs/productMargins.php b/htdocs/margin/tabs/productMargins.php index b4c1ac0cdd0..b8360c7ca6c 100644 --- a/htdocs/margin/tabs/productMargins.php +++ b/htdocs/margin/tabs/productMargins.php @@ -26,10 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/product.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -$langs->load("companies"); -$langs->load("bills"); -$langs->load("products"); -$langs->load("margins"); +$langs->loadLangs(array("companies", "bills", "products", "margins")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref', 'alpha'); diff --git a/htdocs/margin/tabs/thirdpartyMargins.php b/htdocs/margin/tabs/thirdpartyMargins.php index 2ecd6088abf..8ce4b7a0c0b 100644 --- a/htdocs/margin/tabs/thirdpartyMargins.php +++ b/htdocs/margin/tabs/thirdpartyMargins.php @@ -26,10 +26,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; -$langs->load("companies"); -$langs->load("bills"); -$langs->load("products"); -$langs->load("margins"); +$langs->loadLangs(array("companies", "bills", "products", "margins")); // Security check $socid = GETPOST('socid','int'); diff --git a/htdocs/modulebuilder/admin/setup.php b/htdocs/modulebuilder/admin/setup.php index 26e64785524..6ca9bfe2a1e 100644 --- a/htdocs/modulebuilder/admin/setup.php +++ b/htdocs/modulebuilder/admin/setup.php @@ -73,7 +73,7 @@ if (preg_match('/del_(.*)/', $action, $reg)) { } } - + /* * View */ @@ -87,73 +87,78 @@ if (GETPOST('withtab', 'alpha')) { $linkback = '' . $langs->trans("BackToModuleList") . ''; } +print '
    '; +print ''; +print ''; + print load_fiche_titre($langs->trans("ModuleSetup") . ' ' . $langs->trans('Modulebuilder'), $linkback); if (GETPOST('withtab', 'alpha')) { dol_fiche_head($head, 'modulebuilder', '', -1); } - print '' . $langs->trans("ModuleBuilderDesc") . "
    \n"; print '
    '; print ''; + print ''; print ''; print ''; print "\n"; -print ''; -print ''; -print ''; + print ''; + print ''; + + print ''; + print ''; + print ''; } -print ''; - - print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; - -print ''; -print ''; -print ''; -print ''; -print ''; +print ''; +print ''; +print ''; print '
    ' . $langs->trans("Key") . '' . $langs->trans("Value") . '
    ' . $langs->trans("UseAboutPage") . ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); -} else { - if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; - } else { - print '' . img_picto($langs->trans("Enabled"), 'on') . ''; - } + +if ($conf->global->MAIN_FEATURES_LEVEL >= 2) +{ + // What is use cas of this 2 options ? + + print '
    ' . $langs->trans("UseAboutPage") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_ABOUT'); + } else { + if (empty($conf->global->MODULEBUILDER_USE_ABOUT)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } + } + print '
    ' . $langs->trans("UseDocFolder") . ''; + if ($conf->use_javascript_ajax) { + print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER'); + } else { + if (empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) { + print '' . img_picto($langs->trans("Disabled"), 'off') . ''; + } else { + print '' . img_picto($langs->trans("Enabled"), 'on') . ''; + } + } + print '
    ' . $langs->trans("UseDocFolder") . ''; -if ($conf->use_javascript_ajax) { - print ajax_constantonoff('MODULEBUILDER_USE_DOCFOLDER'); -} else { - if (empty($conf->global->MODULEBUILDER_USE_DOCFOLDER)) { - print '' . img_picto($langs->trans("Disabled"), 'off') . ''; - } else { - print '' . img_picto($langs->trans("Enabled"), 'on') . ''; - } -} -print '
    ' . $langs->trans("UseSpecificReadme") . ''; -print ''; -print '
    '; -print ''; -print '
    ' . $langs->trans("UseSpecificReadme") . ''; +print ''; +print '
    '; +print '
    '; + if (GETPOST('withtab', 'alpha')) { dol_fiche_end(); } -print '

    '; +print '
    '; + +print '
    '; // End of page llxFooter(); diff --git a/htdocs/modulebuilder/template/admin/setup.php b/htdocs/modulebuilder/template/admin/setup.php index 2cc6468729c..6e0be4d0011 100644 --- a/htdocs/modulebuilder/template/admin/setup.php +++ b/htdocs/modulebuilder/template/admin/setup.php @@ -85,7 +85,7 @@ $head = mymoduleAdminPrepareHead(); dol_fiche_head($head, 'settings', '', -1, "mymodule@mymodule"); // Setup page goes here -echo $langs->trans("MyModuleSetupPage"); +echo $langs->trans("MyModuleSetupPage").'

    '; if ($action == 'edit') @@ -99,13 +99,10 @@ if ($action == 'edit') foreach($arrayofparameters as $key => $val) { - if (isset($val['enabled']) && empty($val['enabled'])) continue; - print '
    '; print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); print '
    '; print '
    '; @@ -117,21 +114,28 @@ if ($action == 'edit') } else { - print ''; - print ''; - - foreach($arrayofparameters as $key => $val) + if (! empty($arrayofparameters)) { - print ''; + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; - print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); - print '' . $conf->global->$key . '
    '; + print ''; + + foreach($arrayofparameters as $key => $val) + { + print ''; + } + + print '
    '.$langs->trans("Parameter").''.$langs->trans("Value").'
    '; + print $form->textwithpicto($langs->trans($key),$langs->trans($key.'Tooltip')); + print '' . $conf->global->$key . '
    '; + + print '
    '; + print ''.$langs->trans("Modify").''; + print '
    '; + } + else + { + print '
    '.$langs->trans("NothingToSetup"); } - - print ''; - - print '
    '; - print ''.$langs->trans("Modify").''; - print '
    '; } @@ -140,3 +144,4 @@ dol_fiche_end(); llxFooter(); $db->close(); + diff --git a/htdocs/modulebuilder/template/class/actions_mymodule.class.php b/htdocs/modulebuilder/template/class/actions_mymodule.class.php index 45008aa76f3..7d85d804d25 100644 --- a/htdocs/modulebuilder/template/class/actions_mymodule.class.php +++ b/htdocs/modulebuilder/template/class/actions_mymodule.class.php @@ -32,10 +32,12 @@ class ActionsMyModule * @var DoliDB Database handler. */ public $db; + /** - * @var string Error + * @var string Error code (or message) */ public $error = ''; + /** * @var array Errors */ diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 2da97f5b800..0439f78f3a5 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -116,7 +116,11 @@ class MyObject extends CommonObject */ public $entity; - public $label; + /** + * @var string label + */ + public $label; + public $amount; public $status; public $date_creation; @@ -202,7 +206,7 @@ class MyObject extends CommonObject */ public function createFromClone(User $user, $fromid) { - global $hookmanager, $langs; + global $langs, $hookmanager, $extrafields; $error = 0; dol_syslog(__METHOD__, LOG_DEBUG); @@ -222,6 +226,20 @@ class MyObject extends CommonObject $object->ref = "copy_of_".$object->ref; $object->title = $langs->trans("CopyOf")." ".$object->title; // ... + // Clear extrafields that are unique + if (is_array($object->array_options) && count($object->array_options) > 0) + { + $extrafields->fetch_name_optionals_label($this->element); + foreach($object->array_options as $key => $option) + { + $shortkey = preg_replace('/options_/', '', $key); + if (! empty($extrafields->attributes[$this->element]['unique'][$shortkey])) + { + //var_dump($key); var_dump($clonedObj->array_options[$key]); exit; + unset($object->array_options[$key]); + } + } + } // Create clone $object->context['createfromclone'] = 'createfromclone'; diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php index 728270d6179..b83580f4017 100644 --- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php +++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php @@ -55,12 +55,12 @@ class modMyModule extends DolibarrModules $this->family = "other"; // Module position in the family on 2 digits ('01', '10', '20', ...) $this->module_position = '90'; - // Gives the possibility to the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) + // Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this) //$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily"))); - // Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModue is name of module). + // Module label (no space allowed), used if translation string 'ModuleMyModuleName' not found (MyModule is name of module). $this->name = preg_replace('/^mod/i','',get_class($this)); - // Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModue is name of module). + // Module description, used if translation string 'ModuleMyModuleDesc' not found (MyModule is name of module). $this->description = "MyModuleDescription"; // Used only if file README.md and README-LL.md not found. $this->descriptionlong = "MyModuleDescription (Long)"; @@ -71,8 +71,8 @@ class modMyModule extends DolibarrModules // Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z' $this->version = '1.0'; - //Url to the file with your last numberversion of this module - $this->url_last_version = 'http://www.example.com/versionmodule.txt'; + //Url to the file with your last numberversion of this module + $this->url_last_version = 'http://www.example.com/versionmodule.txt'; // 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); // Name of image file used for this module. @@ -200,10 +200,10 @@ class modMyModule extends DolibarrModules // Cronjobs (List of cron jobs entries to add when module is enabled) // unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week $this->cronjobs = array( - 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true) + 0=>array('label'=>'MyJob label', 'jobtype'=>'method', 'class'=>'/mymodule/class/myobject.class.php', 'objectname'=>'MyObject', 'method'=>'doScheduledJob', 'parameters'=>'', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mymodule->enabled') ); - // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true), - // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>true) + // Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->mymodule->enabled'), + // 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->mymodule->enabled') // ); diff --git a/htdocs/modulebuilder/template/doc/user/Makefile b/htdocs/modulebuilder/template/doc/user/Makefile deleted file mode 100644 index 5c33e8bf0a3..00000000000 --- a/htdocs/modulebuilder/template/doc/user/Makefile +++ /dev/null @@ -1,225 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = -BUILDDIR = build - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -# the i18n builder cannot share the environment and doctrees with the others -I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source - -.PHONY: help -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " dirhtml to make HTML files named index.html in directories" - @echo " singlehtml to make a single large HTML file" - @echo " pickle to make pickle files" - @echo " json to make JSON files" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " qthelp to make HTML files and a qthelp project" - @echo " applehelp to make an Apple Help Book" - @echo " devhelp to make HTML files and a Devhelp project" - @echo " epub to make an epub" - @echo " epub3 to make an epub3" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " latexpdf to make LaTeX files and run them through pdflatex" - @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" - @echo " text to make text files" - @echo " man to make manual pages" - @echo " texinfo to make Texinfo files" - @echo " info to make Texinfo files and run them through makeinfo" - @echo " gettext to make PO message catalogs" - @echo " changes to make an overview of all changed/added/deprecated items" - @echo " xml to make Docutils-native XML files" - @echo " pseudoxml to make pseudoxml-XML files for display purposes" - @echo " linkcheck to check all external links for integrity" - @echo " doctest to run all doctests embedded in the documentation (if enabled)" - @echo " coverage to run coverage check of the documentation (if enabled)" - @echo " dummy to check syntax errors of document sources" - -.PHONY: clean -clean: - rm -rf $(BUILDDIR)/* - -.PHONY: html -html: - $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." - -.PHONY: dirhtml -dirhtml: - $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml - @echo - @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." - -.PHONY: singlehtml -singlehtml: - $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml - @echo - @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." - -.PHONY: pickle -pickle: - $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle - @echo - @echo "Build finished; now you can process the pickle files." - -.PHONY: json -json: - $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json - @echo - @echo "Build finished; now you can process the JSON files." - -.PHONY: htmlhelp -htmlhelp: - $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in $(BUILDDIR)/htmlhelp." - -.PHONY: qthelp -qthelp: - $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp - @echo - @echo "Build finished; now you can run "qcollectiongenerator" with the" \ - ".qhcp project file in $(BUILDDIR)/qthelp, like this:" - @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Mymodule.qhcp" - @echo "To view the help file:" - @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Mymodule.qhc" - -.PHONY: applehelp -applehelp: - $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp - @echo - @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." - @echo "N.B. You won't be able to view it unless you put it in" \ - "~/Library/Documentation/Help or install it in your application" \ - "bundle." - -.PHONY: devhelp -devhelp: - $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp - @echo - @echo "Build finished." - @echo "To view the help file:" - @echo "# mkdir -p $$HOME/.local/share/devhelp/Mymodule" - @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Mymodule" - @echo "# devhelp" - -.PHONY: epub -epub: - $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub - @echo - @echo "Build finished. The epub file is in $(BUILDDIR)/epub." - -.PHONY: epub3 -epub3: - $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 - @echo - @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." - -.PHONY: latex -latex: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo - @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." - @echo "Run \`make' in that directory to run these through (pdf)latex" \ - "(use \`make latexpdf' here to do that automatically)." - -.PHONY: latexpdf -latexpdf: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through pdflatex..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -.PHONY: latexpdfja -latexpdfja: - $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex - @echo "Running LaTeX files through platex and dvipdfmx..." - $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja - @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." - -.PHONY: text -text: - $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text - @echo - @echo "Build finished. The text files are in $(BUILDDIR)/text." - -.PHONY: man -man: - $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man - @echo - @echo "Build finished. The manual pages are in $(BUILDDIR)/man." - -.PHONY: texinfo -texinfo: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo - @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." - @echo "Run \`make' in that directory to run these through makeinfo" \ - "(use \`make info' here to do that automatically)." - -.PHONY: info -info: - $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo - @echo "Running Texinfo files through makeinfo..." - make -C $(BUILDDIR)/texinfo info - @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." - -.PHONY: gettext -gettext: - $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale - @echo - @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." - -.PHONY: changes -changes: - $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes - @echo - @echo "The overview file is in $(BUILDDIR)/changes." - -.PHONY: linkcheck -linkcheck: - $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in $(BUILDDIR)/linkcheck/output.txt." - -.PHONY: doctest -doctest: - $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest - @echo "Testing of doctests in the sources finished, look at the " \ - "results in $(BUILDDIR)/doctest/output.txt." - -.PHONY: coverage -coverage: - $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage - @echo "Testing of coverage in the sources finished, look at the " \ - "results in $(BUILDDIR)/coverage/python.txt." - -.PHONY: xml -xml: - $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml - @echo - @echo "Build finished. The XML files are in $(BUILDDIR)/xml." - -.PHONY: pseudoxml -pseudoxml: - $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml - @echo - @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." - -.PHONY: dummy -dummy: - $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy - @echo - @echo "Build finished. Dummy builder generates no files." diff --git a/htdocs/modulebuilder/template/doc/user/make.bat b/htdocs/modulebuilder/template/doc/user/make.bat deleted file mode 100644 index 35018adf3ba..00000000000 --- a/htdocs/modulebuilder/template/doc/user/make.bat +++ /dev/null @@ -1,281 +0,0 @@ -@ECHO OFF - -REM Command file for Sphinx documentation - -if "%SPHINXBUILD%" == "" ( - set SPHINXBUILD=sphinx-build -) -set BUILDDIR=build -set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source -set I18NSPHINXOPTS=%SPHINXOPTS% source -if NOT "%PAPER%" == "" ( - set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% - set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% -) - -if "%1" == "" goto help - -if "%1" == "help" ( - :help - echo.Please use `make ^` where ^ is one of - echo. html to make standalone HTML files - echo. dirhtml to make HTML files named index.html in directories - echo. singlehtml to make a single large HTML file - echo. pickle to make pickle files - echo. json to make JSON files - echo. htmlhelp to make HTML files and a HTML help project - echo. qthelp to make HTML files and a qthelp project - echo. devhelp to make HTML files and a Devhelp project - echo. epub to make an epub - echo. epub3 to make an epub3 - echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter - echo. text to make text files - echo. man to make manual pages - echo. texinfo to make Texinfo files - echo. gettext to make PO message catalogs - echo. changes to make an overview over all changed/added/deprecated items - echo. xml to make Docutils-native XML files - echo. pseudoxml to make pseudoxml-XML files for display purposes - echo. linkcheck to check all external links for integrity - echo. doctest to run all doctests embedded in the documentation if enabled - echo. coverage to run coverage check of the documentation if enabled - echo. dummy to check syntax errors of document sources - goto end -) - -if "%1" == "clean" ( - for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i - del /q /s %BUILDDIR%\* - goto end -) - - -REM Check if sphinx-build is available and fallback to Python version if any -%SPHINXBUILD% 1>NUL 2>NUL -if errorlevel 9009 goto sphinx_python -goto sphinx_ok - -:sphinx_python - -set SPHINXBUILD=python -m sphinx.__init__ -%SPHINXBUILD% 2> nul -if errorlevel 9009 ( - echo. - echo.The 'sphinx-build' command was not found. Make sure you have Sphinx - echo.installed, then set the SPHINXBUILD environment variable to point - echo.to the full path of the 'sphinx-build' executable. Alternatively you - echo.may add the Sphinx directory to PATH. - echo. - echo.If you don't have Sphinx installed, grab it from - echo.http://sphinx-doc.org/ - exit /b 1 -) - -:sphinx_ok - - -if "%1" == "html" ( - %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/html. - goto end -) - -if "%1" == "dirhtml" ( - %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. - goto end -) - -if "%1" == "singlehtml" ( - %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. - goto end -) - -if "%1" == "pickle" ( - %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the pickle files. - goto end -) - -if "%1" == "json" ( - %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can process the JSON files. - goto end -) - -if "%1" == "htmlhelp" ( - %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run HTML Help Workshop with the ^ -.hhp project file in %BUILDDIR%/htmlhelp. - goto end -) - -if "%1" == "qthelp" ( - %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; now you can run "qcollectiongenerator" with the ^ -.qhcp project file in %BUILDDIR%/qthelp, like this: - echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Mymodule.qhcp - echo.To view the help file: - echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Mymodule.ghc - goto end -) - -if "%1" == "devhelp" ( - %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. - goto end -) - -if "%1" == "epub" ( - %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub file is in %BUILDDIR%/epub. - goto end -) - -if "%1" == "epub3" ( - %SPHINXBUILD% -b epub3 %ALLSPHINXOPTS% %BUILDDIR%/epub3 - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The epub3 file is in %BUILDDIR%/epub3. - goto end -) - -if "%1" == "latex" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - if errorlevel 1 exit /b 1 - echo. - echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdf" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf - cd %~dp0 - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "latexpdfja" ( - %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex - cd %BUILDDIR%/latex - make all-pdf-ja - cd %~dp0 - echo. - echo.Build finished; the PDF files are in %BUILDDIR%/latex. - goto end -) - -if "%1" == "text" ( - %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The text files are in %BUILDDIR%/text. - goto end -) - -if "%1" == "man" ( - %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The manual pages are in %BUILDDIR%/man. - goto end -) - -if "%1" == "texinfo" ( - %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. - goto end -) - -if "%1" == "gettext" ( - %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The message catalogs are in %BUILDDIR%/locale. - goto end -) - -if "%1" == "changes" ( - %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes - if errorlevel 1 exit /b 1 - echo. - echo.The overview file is in %BUILDDIR%/changes. - goto end -) - -if "%1" == "linkcheck" ( - %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck - if errorlevel 1 exit /b 1 - echo. - echo.Link check complete; look for any errors in the above output ^ -or in %BUILDDIR%/linkcheck/output.txt. - goto end -) - -if "%1" == "doctest" ( - %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest - if errorlevel 1 exit /b 1 - echo. - echo.Testing of doctests in the sources finished, look at the ^ -results in %BUILDDIR%/doctest/output.txt. - goto end -) - -if "%1" == "coverage" ( - %SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage - if errorlevel 1 exit /b 1 - echo. - echo.Testing of coverage in the sources finished, look at the ^ -results in %BUILDDIR%/coverage/python.txt. - goto end -) - -if "%1" == "xml" ( - %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The XML files are in %BUILDDIR%/xml. - goto end -) - -if "%1" == "pseudoxml" ( - %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml. - goto end -) - -if "%1" == "dummy" ( - %SPHINXBUILD% -b dummy %ALLSPHINXOPTS% %BUILDDIR%/dummy - if errorlevel 1 exit /b 1 - echo. - echo.Build finished. Dummy builder generates no files. - goto end -) - -:end diff --git a/htdocs/modulebuilder/template/doc/user/source/conf.py b/htdocs/modulebuilder/template/doc/user/source/conf.py deleted file mode 100644 index 130bd5a12e5..00000000000 --- a/htdocs/modulebuilder/template/doc/user/source/conf.py +++ /dev/null @@ -1,428 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# My Module documentation build configuration file, created by -# sphinx-quickstart on Mon Sep 26 17:54:17 2016. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [ - 'sphinx.ext.todo', - 'sphinx.ext.imgmath', - 'sphinx.ext.githubpages', -] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The encoding of source files. -# -# source_encoding = 'utf-8-sig' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'My Module' -copyright = '2016, Raphaël Doursenaud ' -author = 'Raphaël Doursenaud ' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = 'development' -# The full version, including alpha/beta/rc tags. -release = 'development' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -# -# today = '' -# -# Else, today_fmt is used as the format for a strftime call. -# -# today_fmt = '%B %d, %Y' - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = [] - -# The reST default role (used for this markup: `text`) to use for all -# documents. -# -# default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -# -# add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -# -# add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -# -# show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# A list of ignored prefixes for module index sorting. -# modindex_common_prefix = [] - -# If true, keep warnings as "system message" paragraphs in the built documents. -# keep_warnings = False - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = True - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom themes here, relative to this directory. -# html_theme_path = [] - -# The name for this set of Sphinx documents. -# " v documentation" by default. -# -# html_title = 'My Module vdevelopment' - -# A shorter title for the navigation bar. Default is the same as html_title. -# -# html_short_title = None - -# The name of an image file (relative to this directory) to place at the top -# of the sidebar. -# -# html_logo = None - -# The name of an image file (relative to this directory) to use as a favicon of -# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -# -# html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Add any extra paths that contain custom files (such as robots.txt or -# .htaccess) here, relative to this directory. These files are copied -# directly to the root of the documentation. -# -# html_extra_path = [] - -# If not None, a 'Last updated on:' timestamp is inserted at every page -# bottom, using the given strftime format. -# The empty string is equivalent to '%b %d, %Y'. -# -# html_last_updated_fmt = None - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -# -# html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -# -# html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -# -# html_additional_pages = {} - -# If false, no module index is generated. -# -# html_domain_indices = True - -# If false, no index is generated. -# -# html_use_index = True - -# If true, the index is split into individual pages for each letter. -# -# html_split_index = False - -# If true, links to the reST sources are added to the pages. -# -# html_show_sourcelink = True - -# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -# -# html_show_sphinx = True - -# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -# -# html_show_copyright = True - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -# -# html_use_opensearch = '' - -# This is the file name suffix for HTML files (e.g. ".xhtml"). -# html_file_suffix = None - -# Language to be used for generating the HTML full-text search index. -# Sphinx supports the following languages: -# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' -# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' -# -# html_search_language = 'en' - -# A dictionary with options for the search language support, empty by default. -# 'ja' uses this config value. -# 'zh' user can custom change `jieba` dictionary path. -# -# html_search_options = {'type': 'default'} - -# The name of a javascript file (relative to the configuration directory) that -# implements a search results scorer. If empty, the default will be used. -# -# html_search_scorer = 'scorer.js' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'Mymoduledoc' - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'Mymodule.tex', 'My Module Documentation', - 'Raphaël Doursenaud \\textless{}rdoursenaud@gpcsolutions.fr\\textgreater{}', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -# -# latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -# -# latex_use_parts = False - -# If true, show page references after internal links. -# -# latex_show_pagerefs = False - -# If true, show URL addresses after external links. -# -# latex_show_urls = False - -# Documents to append as an appendix to all manuals. -# -# latex_appendices = [] - -# It false, will not define \strong, \code, itleref, \crossref ... but only -# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added -# packages. -# -# latex_keep_old_macro_names = True - -# If false, no module index is generated. -# -# latex_domain_indices = True - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'mymodule', 'My Module Documentation', - [author], 1) -] - -# If true, show URL addresses after external links. -# -# man_show_urls = False - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'Mymodule', 'My Module Documentation', - author, 'Mymodule', 'One line description of project.', - 'Miscellaneous'), -] - -# Documents to append as an appendix to all manuals. -# -# texinfo_appendices = [] - -# If false, no module index is generated. -# -# texinfo_domain_indices = True - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# -# texinfo_show_urls = 'footnote' - -# If true, do not generate a @detailmenu in the "Top" node's menu. -# -# texinfo_no_detailmenu = False - - -# -- Options for Epub output ---------------------------------------------- - -# Bibliographic Dublin Core info. -epub_title = project -epub_author = author -epub_publisher = author -epub_copyright = copyright - -# The basename for the epub file. It defaults to the project name. -# epub_basename = project - -# The HTML theme for the epub output. Since the default themes are not -# optimized for small screen space, using the same theme for HTML and epub -# output is usually not wise. This defaults to 'epub', a theme designed to save -# visual space. -# -# epub_theme = 'epub' - -# The language of the text. It defaults to the language option -# or 'en' if the language is not set. -# -# epub_language = '' - -# The scheme of the identifier. Typical schemes are ISBN or URL. -# epub_scheme = '' - -# The unique identifier of the text. This can be a ISBN number -# or the project homepage. -# -# epub_identifier = '' - -# A unique identification for the text. -# -# epub_uid = '' - -# A tuple containing the cover image and cover page html template filenames. -# -# epub_cover = () - -# A sequence of (type, uri, title) tuples for the guide element of content.opf. -# -# epub_guide = () - -# HTML files that should be inserted before the pages created by sphinx. -# The format is a list of tuples containing the path and title. -# -# epub_pre_files = [] - -# HTML files that should be inserted after the pages created by sphinx. -# The format is a list of tuples containing the path and title. -# -# epub_post_files = [] - -# A list of files that should not be packed into the epub file. -epub_exclude_files = ['search.html'] - -# The depth of the table of contents in toc.ncx. -# -# epub_tocdepth = 3 - -# Allow duplicate toc entries. -# -# epub_tocdup = True - -# Choose between 'default' and 'includehidden'. -# -# epub_tocscope = 'default' - -# Fix unsupported image types using the Pillow. -# -# epub_fix_images = False - -# Scale large images. -# -# epub_max_image_width = 0 - -# How to display URL addresses: 'footnote', 'no', or 'inline'. -# -# epub_show_urls = 'inline' - -# If false, no index is generated. -# -# epub_use_index = True diff --git a/htdocs/modulebuilder/template/doc/user/source/index.rst b/htdocs/modulebuilder/template/doc/user/source/index.rst deleted file mode 100644 index 48f2a6e49d8..00000000000 --- a/htdocs/modulebuilder/template/doc/user/source/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -.. My Module documentation master file, created by - sphinx-quickstart on Mon Sep 26 17:54:17 2016. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -Welcome to My Module's documentation! -===================================== - -Contents: - -.. toctree:: - :maxdepth: 2 - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - diff --git a/htdocs/modulebuilder/template/myobject_card.php b/htdocs/modulebuilder/template/myobject_card.php index 9ba0a5a4ad5..26643bd7c33 100644 --- a/htdocs/modulebuilder/template/myobject_card.php +++ b/htdocs/modulebuilder/template/myobject_card.php @@ -88,19 +88,18 @@ $search_all=trim(GETPOST("search_all",'alpha')); $search=array(); foreach($object->fields as $key => $val) { - if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); } if (empty($action) && empty($id) && empty($ref)) $action='view'; -// Security check - Protection if external user -//if ($user->societe_id > 0) access_forbidden(); -//if ($user->societe_id > 0) $socid = $user->societe_id; -//$result = restrictedArea($user, 'mymodule', $id); - // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; +//$result = restrictedArea($user, 'mymodule', $object->id); /* @@ -126,6 +125,9 @@ if (empty($reshook)) // Actions cancel, add, update, delete or clone include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php'; + // Actions when linking object each other + include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be include, not include_once + // Actions when printing a doc from card include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php'; @@ -316,9 +318,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref.=$proj->getNomUrl(); } else { $morehtmlref.=''; } @@ -410,7 +410,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Select mail models is same action as presend if (GETPOST('modelselected')) { - $action = 'presend'; + $action = 'presend'; } if ($action != 'presend') diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 3e73497b703..ece26aba6cb 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -336,7 +336,7 @@ $arrayofmassactions = array( //'builddoc'=>$langs->trans("PDFMerge"), ); if ($user->rights->mymodule->delete) $arrayofmassactions['predelete']=$langs->trans("Delete"); -if (in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); $massactionbutton=$form->selectMassAction('', $arrayofmassactions); print '
    '; @@ -352,7 +352,7 @@ print ''; $newcardbutton=''; //if ($user->rights->mymodule->creer) //{ - $newcardbutton=''.$langs->trans('New').''; + $newcardbutton=''.$langs->trans('New').''; $newcardbutton.= ''; $newcardbutton.= ''; //} diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index ab72aabaee0..549f0fd411a 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -20,15 +20,14 @@ */ /** - * \file dev/skeletons/skeleton_class.class.php - * \ingroup mymodule othermodule1 othermodule2 - * \brief This file is an example for a CRUD class file (Create/Read/Update/Delete) - * Put some comments here + * \file htdocs/multicurrency/class/multicurrency.class.php + * \ingroup multicurrency + * \brief This file is a CRUD class file (Create/Read/Update/Delete) for multicurrency */ // Put here all includes required by your class file -require_once DOL_DOCUMENT_ROOT . '/core/class/commonobject.class.php'; -require_once DOL_DOCUMENT_ROOT ."/core/class/commonobjectline.class.php"; +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT .'/core/class/commonobjectline.class.php'; /** * Class Currency diff --git a/htdocs/opensurvey/class/opensurveysondage.class.php b/htdocs/opensurvey/class/opensurveysondage.class.php index 169aebde712..2e6789b3f89 100644 --- a/htdocs/opensurvey/class/opensurveysondage.class.php +++ b/htdocs/opensurvey/class/opensurveysondage.class.php @@ -111,7 +111,6 @@ class Opensurveysondage extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/printing/admin/printing.php b/htdocs/printing/admin/printing.php index b2300c7125a..529ad7e33ec 100644 --- a/htdocs/printing/admin/printing.php +++ b/htdocs/printing/admin/printing.php @@ -109,12 +109,12 @@ if ($action == 'setvalue' && $user->admin) $form = new Form($db); -llxHeader('',$langs->trans("PrintingSetup")); +llxHeader('', $langs->trans("PrintingSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("PrintingSetup"),$linkback,'title_setup'); -$head=printingadmin_prepare_head($mode); +$head = printingAdminPrepareHead($mode); if ($mode == 'setup' && $user->admin) { @@ -134,8 +134,7 @@ if ($mode == 'setup' && $user->admin) print "\n"; $submit_enabled=0; - if (! empty($driver)) - { + if (! empty($driver)) { require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; $classname = 'printing_'.$driver; $langs->load($driver); @@ -304,7 +303,7 @@ if ($mode == 'test' && $user->admin) $langs->load($driver); $printer = new $classname($db); //print '
    '.print_r($printer, true).'
    '; - if (count($printer->getlist_available_printers())) { + if (count($printer->getlistAvailablePrinters())) { if ($printer->listAvailablePrinters()==0) { print $printer->resprint; } else { diff --git a/htdocs/printing/index.php b/htdocs/printing/index.php index 9abb4dbb3f2..a95e3517be6 100644 --- a/htdocs/printing/index.php +++ b/htdocs/printing/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2016 Laurent Destailleur +/* Copyright (C) 2014-2018 Frederic France + * Copyright (C) 2016 Laurent Destailleur * * 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,29 +40,26 @@ $langs->load("printing"); * View */ -llxHeader("",$langs->trans("Printing")); +llxHeader("", $langs->trans("Printing")); -print_barre_liste($langs->trans("Printing"), 0, $_SERVER["PHP_SELF"], '', '', '', ''.$langs->trans("Refresh").'', 0, 0, 'title_setup.png'); +print_barre_liste($langs->trans("Printing"), 0, $_SERVER["PHP_SELF"], '', '', '', '' . $langs->trans("Refresh") . '', 0, 0, 'title_setup.png'); print $langs->trans("DirectPrintingJobsDesc").'

    '; // List Jobs from printing modules $object = new PrintingDriver($db); $result = $object->listDrivers($db, 10); -foreach ($result as $driver) -{ +foreach ($result as $driver) { require_once DOL_DOCUMENT_ROOT.'/core/modules/printing/'.$driver.'.modules.php'; $classname = 'printing_'.$driver; $langs->load($driver); $printer = new $classname($db); - if ($conf->global->{$printer->active}) - { - //$printer->list_jobs('commande'); - $result = $printer->list_jobs(); + if ($conf->global->{$printer->active}) { + //$printer->listJobs('commande'); + $result = $printer->listJobs(); print $printer->resprint; - if ($result > 0) - { + if ($result > 0) { setEventMessages($printer->error, $printer->errors, 'errors'); } } diff --git a/htdocs/printing/lib/printing.lib.php b/htdocs/printing/lib/printing.lib.php index 697e986cd56..53257891e25 100644 --- a/htdocs/printing/lib/printing.lib.php +++ b/htdocs/printing/lib/printing.lib.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2015 Laurent Destailleur + * Copyright (C) 2018 Frédéric France * * 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 @@ -26,10 +27,10 @@ /** * Define head array for tabs of printing tools setup pages * - * @param string $mode Mode - * @return Array of head + * @param string $mode Mode + * @return array Array of head */ -function printingadmin_prepare_head($mode) +function printingAdminPrepareHead($mode) { global $langs, $conf; @@ -41,28 +42,26 @@ function printingadmin_prepare_head($mode) $head[$h][2] = 'config'; $h++; - if ($mode == 'setup') - { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver','alpha'); - $head[$h][1] = $langs->trans("SetupDriver"); - $head[$h][2] = 'setup'; - $h++; + if ($mode == 'setup') { + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=setup&driver=".GETPOST('driver','alpha'); + $head[$h][1] = $langs->trans("SetupDriver"); + $head[$h][2] = 'setup'; + $h++; } - if ($mode == 'test') - { - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver','alpha'); - $head[$h][1] = $langs->trans("TargetedPrinter"); - $head[$h][2] = 'test'; - $h++; + if ($mode == 'test') { + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=test&driver=".GETPOST('driver','alpha'); + $head[$h][1] = $langs->trans("TargetedPrinter"); + $head[$h][2] = 'test'; + $h++; } - /** TODO This feature seem to be not ready yet. - $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf"; - $head[$h][1] = $langs->trans("UserConf"); - $head[$h][2] = 'userconf'; - $h++; - */ + /** TODO This feature seem to be not ready yet. + $head[$h][0] = DOL_URL_ROOT."/printing/admin/printing.php?mode=userconf"; + $head[$h][1] = $langs->trans("UserConf"); + $head[$h][2] = 'userconf'; + $h++; + */ //$object=new stdClass(); @@ -76,4 +75,3 @@ function printingadmin_prepare_head($mode) return $head; } - diff --git a/htdocs/product/class/html.formproduct.class.php b/htdocs/product/class/html.formproduct.class.php index 22b5e4656a7..5356d212c38 100644 --- a/htdocs/product/class/html.formproduct.class.php +++ b/htdocs/product/class/html.formproduct.class.php @@ -52,8 +52,6 @@ class FormProduct function __construct($db) { $this->db = $db; - - return 1; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 2b5b9c71ba6..12ddfb9e6d7 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -354,8 +354,6 @@ class Product extends CommonObject */ function __construct($db) { - global $langs; - $this->db = $db; $this->canvas = ''; } @@ -3656,10 +3654,10 @@ class Product extends CommonObject $label.="
    ".$langs->trans("ManageLotSerial").': '.$this->getLibStatut(0,2); } } - if ($this->type == Product::TYPE_SERVICE) - { + //if ($this->type == Product::TYPE_SERVICE) + //{ // - } + //} if (! empty($conf->accounting->enabled) && $this->status) { include_once DOL_DOCUMENT_ROOT.'/core/lib/accounting.lib.php'; @@ -3840,37 +3838,37 @@ class Product extends CommonObject if ($mode == 0) { if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); - if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); + elseif ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); - if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); + elseif ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); + elseif ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 0) return img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell') : $langs->trans('ProductStatusNotOnBuy')),'statut5', 'class="pictostatus"'); - if ($status == 1) return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); + elseif ($status == 1) return img_picto(($type==0 ? $langs->trans('ProductStatusOnSell') : $langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans('ProductStatusNotOnSell'),'statut5', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')); - if ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); + elseif ($status == 1) return img_picto($langs->trans('ProductStatusOnSell'),'statut4', 'class="pictostatus"').' '.($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); - if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); + elseif ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 0) return ($type==0 ? $langs->trans('ProductStatusNotOnSellShort'):$langs->trans('ProductStatusNotOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusNotOnSell'):$langs->trans('ProductStatusNotOnBuy')), 'statut5', 'class="pictostatus"'); - if ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); + elseif ($status == 1) return ($type==0 ? $langs->trans('ProductStatusOnSellShort'):$langs->trans('ProductStatusOnBuyShort')).' '.img_picto(($type==0 ? $langs->trans('ProductStatusOnSell'):$langs->trans('ProductStatusOnBuy')),'statut4', 'class="pictostatus"'); } return $langs->trans('Unknown'); } diff --git a/htdocs/product/class/productbatch.class.php b/htdocs/product/class/productbatch.class.php index fc36c64a3eb..f6a7df212eb 100644 --- a/htdocs/product/class/productbatch.class.php +++ b/htdocs/product/class/productbatch.class.php @@ -56,7 +56,6 @@ class Productbatch extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/product/class/productcustomerprice.class.php b/htdocs/product/class/productcustomerprice.class.php index 0d1d7ae4484..7f9e5a0b383 100644 --- a/htdocs/product/class/productcustomerprice.class.php +++ b/htdocs/product/class/productcustomerprice.class.php @@ -75,9 +75,7 @@ class Productcustomerprice extends CommonObject */ function __construct($db) { - $this->db = $db; - return 1; } /** diff --git a/htdocs/product/class/propalmergepdfproduct.class.php b/htdocs/product/class/propalmergepdfproduct.class.php index e58e09c4bfd..3a7f3fb586d 100644 --- a/htdocs/product/class/propalmergepdfproduct.class.php +++ b/htdocs/product/class/propalmergepdfproduct.class.php @@ -62,7 +62,6 @@ class Propalmergepdfproduct extends CommonObject function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/product/dynamic_price/class/price_expression.class.php b/htdocs/product/dynamic_price/class/price_expression.class.php index c7300be5d20..6b73b413522 100644 --- a/htdocs/product/dynamic_price/class/price_expression.class.php +++ b/htdocs/product/dynamic_price/class/price_expression.class.php @@ -65,7 +65,6 @@ class PriceExpression function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable.class.php b/htdocs/product/dynamic_price/class/price_global_variable.class.php index ebdba3b5949..4cd900979ab 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable.class.php @@ -71,7 +71,6 @@ class PriceGlobalVariable function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php index 14ea4357a66..b06a249ccc6 100644 --- a/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php +++ b/htdocs/product/dynamic_price/class/price_global_variable_updater.class.php @@ -78,7 +78,6 @@ class PriceGlobalVariableUpdater function __construct($db) { $this->db = $db; - return 1; } diff --git a/htdocs/product/inventory/class/inventory.class.php b/htdocs/product/inventory/class/inventory.class.php index 750b675c92a..5b0bbb99a65 100644 --- a/htdocs/product/inventory/class/inventory.class.php +++ b/htdocs/product/inventory/class/inventory.class.php @@ -368,44 +368,44 @@ class Inventory extends CommonObject { $prefix=''; if ($status == 0) return $langs->trans('Draft'); - if ($status == 1) return $langs->trans('Enabled'); - if ($status == -1) return $langs->trans('Canceled'); + elseif ($status == 1) return $langs->trans('Enabled'); + elseif ($status == -1) return $langs->trans('Canceled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 0) return $langs->trans('Draft'); - if ($status == 1) return $langs->trans('Enabled'); - if ($status == -1) return $langs->trans('Canceled'); + elseif ($status == 1) return $langs->trans('Enabled'); + elseif ($status == -1) return $langs->trans('Canceled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 0) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == -1) return img_picto($langs->trans('Canceled'),'statut6').' '.$langs->trans('Canceled'); + elseif ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + elseif ($status == -1) return img_picto($langs->trans('Canceled'),'statut6').' '.$langs->trans('Canceled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 0) return img_picto($langs->trans('Draft'),'statut0'); - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == -1) return img_picto($langs->trans('Canceled'),'statut6'); + elseif ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); + elseif ($status == -1) return img_picto($langs->trans('Canceled'),'statut6'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 0) return img_picto($langs->trans('Draft'),'statut0').' '.$langs->trans('Draft'); - if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == -1) return img_picto($langs->trans('Canceled'),'statut6').' '.$langs->trans('Canceled'); + elseif ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); + elseif ($status == -1) return img_picto($langs->trans('Canceled'),'statut6').' '.$langs->trans('Canceled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 0) return $langs->trans('Draft').' '.img_picto($langs->trans('Draft'),'statut0'); - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == -1) return $langs->trans('Canceled').' '.img_picto($langs->trans('Canceled'),'statut6'); + elseif ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + elseif ($status == -1) return $langs->trans('Canceled').' '.img_picto($langs->trans('Canceled'),'statut6'); } - if ($mode == 6) + elseif ($mode == 6) { if ($status == 0) return $langs->trans('Draft').' '.img_picto($langs->trans('Draft'),'statut0'); - if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == -1) return $langs->trans('Canceled').' '.img_picto($langs->trans('Canceled'),'statut6'); + elseif ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); + elseif ($status == -1) return $langs->trans('Canceled').' '.img_picto($langs->trans('Canceled'),'statut6'); } } diff --git a/htdocs/product/stats/card.php b/htdocs/product/stats/card.php index 52ffa0a58c8..e7c50e8309e 100644 --- a/htdocs/product/stats/card.php +++ b/htdocs/product/stats/card.php @@ -75,9 +75,9 @@ if (empty($search_year)) $search_year=$currentyear; $form = new Form($db); $htmlother = new FormOther($db); - $object = new Product($db); -if (! $id) + +if (! $id && empty($ref)) { llxHeader("",$langs->trans("ProductStatistics")); diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index 9f205580444..59e3f2fb057 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -60,23 +60,23 @@ class Entrepot extends CommonObject */ const STATUS_OPEN_INTERNAL = 2; - var $libelle; + public $libelle; /** * @var string description */ public $description; - var $statut; - var $lieu; - var $address; + public $statut; + public $lieu; + public $address; //! Code Postal - var $zip; - var $town; - var $fk_parent; + public $zip; + public $town; + public $fk_parent; // List of short language codes for status - var $statuts = array(); + public $statuts = array(); /** * Constructor diff --git a/htdocs/product/stock/class/mouvementstock.class.php b/htdocs/product/stock/class/mouvementstock.class.php index 76225ff8902..0d8338c4d9f 100644 --- a/htdocs/product/stock/class/mouvementstock.class.php +++ b/htdocs/product/stock/class/mouvementstock.class.php @@ -50,7 +50,12 @@ class MouvementStock extends CommonObject public $datem = ''; public $price; public $fk_user_author; - public $label; + + /** + * @var string stock movements label + */ + public $label; + public $fk_origin; public $origintype; public $inventorycode; diff --git a/htdocs/product/stock/class/productstockentrepot.class.php b/htdocs/product/stock/class/productstockentrepot.class.php index e0c15d03520..1ab24b553d8 100644 --- a/htdocs/product/stock/class/productstockentrepot.class.php +++ b/htdocs/product/stock/class/productstockentrepot.class.php @@ -3,7 +3,7 @@ * Copyright (C) 2014-2016 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) ---Put here your own copyright and developer email--- + * Copyright (C) 2018 Frédéric France * * 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 @@ -126,7 +126,7 @@ class ProductStockEntrepot extends CommonObject if (!$error) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . $this->table_element); - if (!$notrigger) { + //if (!$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action to call a trigger. @@ -134,7 +134,7 @@ class ProductStockEntrepot extends CommonObject //$result=$this->call_trigger('MYOBJECT_CREATE',$user); //if ($result < 0) $error++; //// End call triggers - } + //} } // Commit or rollback @@ -340,7 +340,7 @@ class ProductStockEntrepot extends CommonObject dol_syslog(__METHOD__ . ' ' . implode(',', $this->errors), LOG_ERR); } - if (!$error && !$notrigger) { + //if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -348,7 +348,7 @@ class ProductStockEntrepot extends CommonObject //$result=$this->call_trigger('MYOBJECT_MODIFY',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } + //} // Commit or rollback if ($error) { @@ -378,8 +378,7 @@ class ProductStockEntrepot extends CommonObject $this->db->begin(); - if (!$error) { - if (!$notrigger) { + //if (!$error && !$notrigger) { // Uncomment this and change MYOBJECT to your own tag if you // want this action calls a trigger. @@ -387,8 +386,7 @@ class ProductStockEntrepot extends CommonObject //$result=$this->call_trigger('MYOBJECT_DELETE',$user); //if ($result < 0) { $error++; //Do also what you must do to rollback action if trigger fail} //// End call triggers - } - } + //} if (!$error) { $sql = 'DELETE FROM ' . MAIN_DB_PREFIX . $this->table_element; @@ -526,34 +524,33 @@ class ProductStockEntrepot extends CommonObject if ($mode == 0) { - $prefix=''; if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($status == 1) return $langs->trans('Enabled'); - if ($status == 0) return $langs->trans('Disabled'); + elseif ($status == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5'); } - if ($mode == 4) + elseif ($mode == 4) { if ($status == 1) return img_picto($langs->trans('Enabled'),'statut4').' '.$langs->trans('Enabled'); - if ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); + elseif ($status == 0) return img_picto($langs->trans('Disabled'),'statut5').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($status == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4'); - if ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); + elseif ($status == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5'); } } diff --git a/htdocs/product/stock/replenish.php b/htdocs/product/stock/replenish.php index bc5d03c7296..994edfa823e 100644 --- a/htdocs/product/stock/replenish.php +++ b/htdocs/product/stock/replenish.php @@ -190,6 +190,7 @@ if ($action == 'order' && isset($_POST['valid'])) $sql = "SELECT rowid FROM ".MAIN_DB_PREFIX."commande_fournisseur"; $sql.= " WHERE fk_soc = ".$suppliersid[$i]; $sql.= " AND source = 42 AND fk_statut = 0"; + $sql.= " AND entity IN (".getEntity('commande_fournisseur').")"; $sql.= " ORDER BY date_creation DESC"; $resql = $db->query($sql); if($resql && $db->num_rows($resql) > 0) { diff --git a/htdocs/projet/activity/perday.php b/htdocs/projet/activity/perday.php index c3351a5efff..623838f8149 100644 --- a/htdocs/projet/activity/perday.php +++ b/htdocs/projet/activity/perday.php @@ -118,6 +118,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_project_ref = ''; $search_thirdparty = ''; $search_declared_progress = ''; + + // We redefine $usertoprocess + $usertoprocess=$user; } if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha')) { @@ -345,7 +348,7 @@ if ($morewherefilter) // Get all task without any filter, so we can show total o } $projectsrole=$taskstatic->getUserRolesForProjectsOrTasks($usertoprocess, 0, ($project->id?$project->id:0), 0, $onlyopenedproject); $tasksrole=$taskstatic->getUserRolesForProjectsOrTasks(0, $usertoprocess, ($project->id?$project->id:0), 0, $onlyopenedproject); -//var_dump($tasksarray); +//var_dump($usertoprocess); //var_dump($projectsrole); //var_dump($taskrole); @@ -502,7 +505,7 @@ print ''.$langs->trans("TimeSpent").($user print ''.$langs->trans("HourStart").''; // By default, we can edit only tasks we are assigned to -$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0); +$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED); // Get if user is available or not for each day $isavailable=array(); diff --git a/htdocs/projet/activity/perweek.php b/htdocs/projet/activity/perweek.php index fdf7b9ea187..214879c7f92 100644 --- a/htdocs/projet/activity/perweek.php +++ b/htdocs/projet/activity/perweek.php @@ -129,6 +129,9 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', $search_project_ref = ''; $search_thirdparty = ''; $search_declared_progress = ''; + + // We redefine $usertoprocess + $usertoprocess=$user; } if (GETPOST("button_search_x",'alpha') || GETPOST("button_search.x",'alpha') || GETPOST("button_search",'alpha')) { @@ -594,8 +597,7 @@ if ($conf->use_javascript_ajax) // By default, we can edit only tasks we are assigned to -$restrictviewformytask=(empty($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)?1:0); - +$restrictviewformytask=((! isset($conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED)) ? 2 : $conf->global->PROJECT_TIME_SHOW_TASK_NOT_ASSIGNED); if (count($tasksarray) > 0) { //var_dump($tasksarray); // contains only selected tasks diff --git a/htdocs/projet/admin/project_extrafields.php b/htdocs/projet/admin/project_extrafields.php index 8f39a20f762..15ccd50bf76 100644 --- a/htdocs/projet/admin/project_extrafields.php +++ b/htdocs/projet/admin/project_extrafields.php @@ -30,8 +30,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; -$langs->load("project"); -$langs->load("admin"); +$langs->loadLangs(array("project", "admin")); $extrafields = new ExtraFields($db); $form = new Form($db); diff --git a/htdocs/projet/card.php b/htdocs/projet/card.php index dfc0b753559..dd18a115ab6 100644 --- a/htdocs/projet/card.php +++ b/htdocs/projet/card.php @@ -472,6 +472,17 @@ $help_url="EN:Module_Projects|FR:Module_Projets|ES:Módulo_Proyectos"; llxHeader("",$title,$help_url); +$titleboth=$langs->trans("LeadsOrProjects"); +$titlenew = $langs->trans("NewLeadOrProject"); // Leads and opportunities by default +if ($conf->global->PROJECT_USE_OPPORTUNITIES == 0) +{ + $titleboth=$langs->trans("Projects"); + $titlenew = $langs->trans("NewProject"); +} +if ($conf->global->PROJECT_USE_OPPORTUNITIES == 2) { // 2 = leads only + $titleboth=$langs->trans("Leads"); + $titlenew = $langs->trans("NewLead"); +} if ($action == 'create' && $user->rights->projet->creer) { @@ -482,7 +493,7 @@ if ($action == 'create' && $user->rights->projet->creer) $thirdparty=new Societe($db); if ($socid > 0) $thirdparty->fetch($socid); - print load_fiche_titre($langs->trans("NewProject"), '', 'title_project'); + print load_fiche_titre($titlenew, '', 'title_project'); print ''; print ''; diff --git a/htdocs/projet/class/task.class.php b/htdocs/projet/class/task.class.php index aec0f40443e..a3fd5fb1703 100644 --- a/htdocs/projet/class/task.class.php +++ b/htdocs/projet/class/task.class.php @@ -61,37 +61,37 @@ class Task extends CommonObject */ public $description; - var $duration_effective; // total of time spent on this task - var $planned_workload; - var $date_c; - var $date_start; - var $date_end; - var $progress; - var $fk_statut; - var $priority; - var $fk_user_creat; - var $fk_user_valid; - var $rang; + public $duration_effective; // total of time spent on this task + public $planned_workload; + public $date_c; + public $date_start; + public $date_end; + public $progress; + public $fk_statut; + public $priority; + public $fk_user_creat; + public $fk_user_valid; + public $rang; - var $timespent_min_date; - var $timespent_max_date; - var $timespent_total_duration; - var $timespent_total_amount; - var $timespent_nblinesnull; - var $timespent_nblines; + public $timespent_min_date; + public $timespent_max_date; + public $timespent_total_duration; + public $timespent_total_amount; + public $timespent_nblinesnull; + public $timespent_nblines; // For detail of lines of timespent record, there is the property ->lines in common // Var used to call method addTimeSpent(). Bad practice. - var $timespent_id; - var $timespent_duration; - var $timespent_old_duration; - var $timespent_date; - var $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) - var $timespent_withhour; // 1 = we entered also start hours for timesheet line - var $timespent_fk_user; - var $timespent_note; + public $timespent_id; + public $timespent_duration; + public $timespent_old_duration; + public $timespent_date; + public $timespent_datehour; // More accurate start date (same than timespent_date but includes hours, minutes and seconds) + public $timespent_withhour; // 1 = we entered also start hours for timesheet line + public $timespent_fk_user; + public $timespent_note; - var $comments = array(); + public $comments = array(); public $oldcopy; diff --git a/htdocs/projet/class/taskstats.class.php b/htdocs/projet/class/taskstats.class.php index 84633944250..4164c1427b6 100644 --- a/htdocs/projet/class/taskstats.class.php +++ b/htdocs/projet/class/taskstats.class.php @@ -36,8 +36,6 @@ class TaskStats extends Stats */ function __construct($db) { - global $conf, $user; - $this->db = $db; require_once 'task.class.php'; diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index 83ebdc47507..1da887ea7a9 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -548,11 +548,8 @@ if (! $showdatefilter) // Show balance for whole project -$langs->load("suppliers"); -$langs->load("bills"); -$langs->load("orders"); -$langs->load("proposals"); -$langs->load("margins"); +$langs->loadLangs(array("suppliers", "bills", "orders", "proposals", "margins")); + if (!empty($conf->stock->enabled)) $langs->load('stocks'); print load_fiche_titre($langs->trans("Profit"), '', 'title_accountancy'); @@ -712,6 +709,9 @@ foreach ($listofreferent as $key => $value) $testnew=$value['testnew']; $project_field=$value['project_field']; + $exclude_select_element = array('payment_various'); + if (!empty($value['exclude_select_element'])) $exclude_select_element[] = $value['exclude_select_element']; + if ($qualified) { // If we want the project task array to have details of users @@ -731,7 +731,7 @@ foreach ($listofreferent as $key => $value) if (! empty($conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS)) $idtofilterthirdparty.=','.$conf->global->PROJECT_OTHER_THIRDPARTY_ID_TO_ADD_ELEMENTS; } - if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename, array('payment_various'))) + if (empty($conf->global->PROJECT_LINK_ON_OVERWIEW_DISABLED) && $idtofilterthirdparty && !in_array($tablename,$exclude_select_element)) { $selectList=$formproject->select_element($tablename, $idtofilterthirdparty, 'minwidth300',-2,!empty($project_field)?$project_field:'fk_projet'); if (! $selectList || ($selectList<0)) diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index 60fc718040f..a93fac0edbd 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -352,6 +352,7 @@ if ($search_opp_status) if (is_numeric($search_opp_status) && $search_opp_status > 0) $sql .= " AND p.fk_opp_status = ".$db->escape($search_opp_status); if ($search_opp_status == 'all') $sql .= " AND p.fk_opp_status IS NOT NULL"; if ($search_opp_status == 'openedopp') $sql .= " AND p.fk_opp_status IS NOT NULL AND p.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST'))"; + if ($search_opp_status == 'notopenedopp') $sql .= " AND (p.fk_opp_status IS NULL OR p.fk_opp_status IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON')))"; if ($search_opp_status == 'none') $sql .= " AND p.fk_opp_status IS NULL"; } if ($search_public!='') $sql .= " AND p.public = ".$db->escape($search_public); @@ -424,7 +425,7 @@ if ($search_ref != '') $param.='&search_ref='.$search_ref; if ($search_label != '') $param.='&search_label='.$search_label; if ($search_societe != '') $param.='&search_societe='.$search_societe; if ($search_status >= 0) $param.='&search_status='.$search_status; -if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); +if ((is_numeric($search_opp_status) && $search_opp_status >= 0) || in_array($search_opp_status, array('all','openedopp','notopenedopp','none'))) $param.='&search_opp_status='.urlencode($search_opp_status); if ($search_opp_percent != '') $param.='&search_opp_percent='.urlencode($search_opp_percent); if ($search_public != '') $param.='&search_public='.$search_public; if ($search_project_user != '') $param.='&search_project_user='.$search_project_user; @@ -538,18 +539,21 @@ print '
    '; print ''."\n"; print ''; +// Project ref if (! empty($arrayfields['p.ref']['checked'])) { print ''; } +// Project label if (! empty($arrayfields['p.title']['checked'])) { print ''; } +// Third party if (! empty($arrayfields['s.nom']['checked'])) { print ''; } +// Opp status if (! empty($arrayfields['p.fk_opp_status']['checked'])) { print ''; - // Thirdparty - print ''; - // User assigned print ''; - print ''; print '
    '; print ''; print ''; print ''; print ''; @@ -592,6 +596,7 @@ if (! empty($arrayfields['p.public']['checked'])) print $form->selectarray('search_public',$array,$search_public); print ''; diff --git a/htdocs/public/cron/cron_run_jobs.php b/htdocs/public/cron/cron_run_jobs.php index 49e1a2de561..320a8e3895a 100644 --- a/htdocs/public/cron/cron_run_jobs.php +++ b/htdocs/public/cron/cron_run_jobs.php @@ -44,8 +44,7 @@ dol_include_once("/cron/class/cronjob.class.php"); global $langs, $conf; // Language Management -$langs->load("admin"); -$langs->load("cron"); +$langs->loadLangs(array("admin", "cron")); /* * View diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 61919c54b1a..f9169bb47d2 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -30,9 +30,7 @@ define("NOCSRFCHECK",1); // We accept to go on this page from external web site. require '../../main.inc.php'; require_once '../../core/lib/functions2.lib.php'; -$langs->load("main"); -$langs->load("install"); -$langs->load("other"); +$langs->loadLangs(array("main", "install", "other")); $conf->dol_hide_topmenu=GETPOST('dol_hide_topmenu','int'); $conf->dol_hide_leftmenu=GETPOST('dol_hide_leftmenu','int'); diff --git a/htdocs/public/donations/donateurs_code.php b/htdocs/public/donations/donateurs_code.php index 3705c9945bc..9f03f9e293e 100644 --- a/htdocs/public/donations/donateurs_code.php +++ b/htdocs/public/donations/donateurs_code.php @@ -1,5 +1,6 @@ +/* Copyright (C) 2002 Rodolphe Quiedeville + * Copyright (C) 2018 Frédéric France * * 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 @@ -48,7 +49,7 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT .'/don/class/don.class.php'; // Security check -if (empty($conf->don->enabled)) accessforbidden('',0,0,1); +if (empty($conf->don->enabled)) accessforbidden('', 0, 0, 1); $langs->load("donations"); @@ -71,13 +72,13 @@ if ($resql) if ($num) { - print ""; + print "
    "; - print ''; + print ''; print ""; print ""; - print ""; - print "\n"; + print ""; + print "\n"; while ($i < $num) { diff --git a/htdocs/public/emailing/mailing-unsubscribe.php b/htdocs/public/emailing/mailing-unsubscribe.php index 1dc1477e7b4..c27cb024aab 100644 --- a/htdocs/public/emailing/mailing-unsubscribe.php +++ b/htdocs/public/emailing/mailing-unsubscribe.php @@ -53,8 +53,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php'; global $user, $conf, $langs; -$langs->load("main"); -$langs->load("mails"); +$langs->loadLangs(array("main", "mails")); $tag=GETPOST('tag'); $unsuscrib=GETPOST('unsuscrib'); diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 7e09e990221..f2395020bda 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -277,8 +277,9 @@ if ($action == 'add') // Set output language $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang); + // Load traductions files requiredby by page $outputlangs->loadLangs(array("main", "members")); - // Get email content fro mtemplae + // Get email content from template $arraydefaultmessage=null; $labeltouse = $conf->global->ADHERENT_EMAIL_TEMPLATE_AUTOREGISTER; @@ -297,7 +298,9 @@ if ($action == 'add') if ($subjecttosend && $texttosend) { - $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1); + $moreinheader='X-Dolibarr-Info: send_an_email by public/members/new.php'."\r\n"; + + $result=$object->send_an_email($texttosend, $subjecttosend, array(), array(), array(), "", "", 0, -1, '', $moreinheader); } /*if ($result < 0) { diff --git a/htdocs/public/members/public_card.php b/htdocs/public/members/public_card.php index 5dee0eb49a3..eda1aaf2c68 100644 --- a/htdocs/public/members/public_card.php +++ b/htdocs/public/members/public_card.php @@ -43,10 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php'; if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); -$langs->load("main"); -$langs->load("members"); -$langs->load("companies"); -$langs->load("other"); +$langs->loadLangs(array("main", "members", "companies", "other")); $id=GETPOST('id','int'); $object = new Adherent($db); diff --git a/htdocs/public/members/public_list.php b/htdocs/public/members/public_list.php index 1f9a4406028..6ba46182427 100644 --- a/htdocs/public/members/public_list.php +++ b/htdocs/public/members/public_list.php @@ -40,10 +40,7 @@ require '../../main.inc.php'; if (empty($conf->adherent->enabled)) accessforbidden('',0,0,1); -$langs->load("main"); -$langs->load("members"); -$langs->load("companies"); -$langs->load("other"); +$langs->loadLangs(array("main", "members", "companies", "other")); /** diff --git a/htdocs/public/onlinesign/newonlinesign.php b/htdocs/public/onlinesign/newonlinesign.php index 43508cfe177..e8db916ad91 100644 --- a/htdocs/public/onlinesign/newonlinesign.php +++ b/htdocs/public/onlinesign/newonlinesign.php @@ -44,13 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; // Security check // No check on module enabled. Done later according to $validpaymentmethod -$langs->load("main"); -$langs->load("other"); -$langs->load("dict"); -$langs->load("bills"); -$langs->load("companies"); -$langs->load("errors"); -$langs->load("paybox"); // File with generic data +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "errors", "paybox")); $action=GETPOST('action','alpha'); diff --git a/htdocs/public/paybox/paymentko.php b/htdocs/public/paybox/paymentko.php index feb4070c16b..ef642a5b80b 100644 --- a/htdocs/public/paybox/paymentko.php +++ b/htdocs/public/paybox/paymentko.php @@ -39,15 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Security check if (empty($conf->paybox->enabled)) accessforbidden('',0,0,1); -$langs->load("main"); -$langs->load("other"); -$langs->load("dict"); -$langs->load("bills"); -$langs->load("companies"); -$langs->load("paybox"); -$langs->load("paypal"); -$langs->load("stripe"); - +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); $object = new stdClass(); // For triggers diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index 9e711ade51b..41eef8784bc 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -39,14 +39,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php'; // Security check if (empty($conf->paybox->enabled)) accessforbidden('',0,0,1); -$langs->load("main"); -$langs->load("other"); -$langs->load("dict"); -$langs->load("bills"); -$langs->load("companies"); -$langs->load("paybox"); -$langs->load("paypal"); -$langs->load("stripe"); +$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe")); /*$source=GETPOST('source'); $ref=GETPOST('ref'); diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index c1bfd167b51..0eff61cd9fa 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -410,7 +410,10 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $stripeToken = GETPOST("stripeToken",'alpha'); $email = GETPOST("email",'alpha'); $thirdparty_id=GETPOST('thirdparty_id', 'int'); // Note that for payment following online registration for members, this is empty because thirdparty is created once payment is confirmed by paymentok.php - $vatnumber = GETPOST('vatnumber','alpha'); + $dol_type=(GETPOST('s', 'alpha') ? GETPOST('s', 'alpha') : GETPOST('source', 'alpha')); + $dol_id=GETPOST('dol_id', 'int'); + $vatnumber = GETPOST('vatnumber','alpha'); + $savesource=GETPOST('savesource', 'int'); dol_syslog("stripeToken = ".$stripeToken, LOG_DEBUG, 0, '_stripe'); dol_syslog("email = ".$email, LOG_DEBUG, 0, '_stripe'); @@ -421,12 +424,12 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) try { $metadata = array( - 'dol_version'=>DOL_VERSION, - 'dol_entity'=>$conf->entity, + 'dol_version' => DOL_VERSION, + 'dol_entity' => $conf->entity, + 'dol_company' => $mysoc->name, // Usefull when using multicompany 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR']) ); - if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; - if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; + if (! empty($thirdparty_id)) $metadata["dol_thirdparty_id"] = $thirdparty_id; if ($thirdparty_id > 0) @@ -452,7 +455,9 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) $customer = $stripe->customerStripe($thirdparty, $stripeacc, $servicestatus, 1); // Create Stripe card from Token + if (! empty($savesource)) { $card = $customer->sources->create(array("source" => $stripeToken, "metadata" => $metadata)); + } else { $card = $stripeToken; } if (empty($card)) { @@ -463,13 +468,17 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) } else { + if (! empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; + if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; + if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; + dol_syslog("Create charge on card ".$card->id, LOG_DEBUG, 0, '_stripe'); $charge = \Stripe\Charge::create(array( 'amount' => price2num($amountstripe, 'MU'), 'currency' => $currency, 'capture' => true, // Charge immediatly 'description' => 'Stripe payment: '.$FULLTAG, - 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])), + 'metadata' => $metadata, 'customer' => $customer->id, 'source' => $card, 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt @@ -496,6 +505,10 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) )); // Return $customer = array('id'=>'cus_XXXX', ...) + if (! empty($FULLTAG)) $metadata["FULLTAG"] = $FULLTAG; + if (! empty($dol_id)) $metadata["dol_id"] = $dol_id; + if (! empty($dol_type)) $metadata["dol_type"] = $dol_type; + // The customer was just created with a source, so we can make a charge // with no card defined, the source just used for customer creation will be used. dol_syslog("Create charge", LOG_DEBUG, 0, '_stripe'); @@ -505,7 +518,7 @@ if ($action == 'charge' && ! empty($conf->stripe->enabled)) 'currency' => $currency, 'capture' => true, // Charge immediatly 'description' => 'Stripe payment: '.$FULLTAG, - 'metadata' => array("FULLTAG" => $FULLTAG, 'Recipient' => $mysoc->name, 'dol_version'=>DOL_VERSION, 'dol_entity'=>$conf->entity, 'ipaddress'=>(empty($_SERVER['REMOTE_ADDR'])?'':$_SERVER['REMOTE_ADDR'])), + 'metadata' => $metadata, 'statement_descriptor' => dol_trunc(dol_trunc(dol_string_unaccent($mysoc->name), 6, 'right', 'UTF-8', 1).' '.$FULLTAG, 22, 'right', 'UTF-8', 1) // 22 chars that appears on bank receipt ),array("idempotency_key" => "$ref","stripe_account" => "$stripeacc")); // Return $charge = array('id'=>'ch_XXXX', 'status'=>'succeeded|pending|failed', 'failure_code'=>, 'failure_message'=>...) @@ -822,6 +835,7 @@ if ($source == 'order') print ''.$line->product_label.''; + } + } + foreach ($invoice->lines as $line){ + if ($line->special_code=="3") continue; + $c = new Categorie($db); + $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id'); + $result = array_intersect($catsprinter2, $existing); + $count=count($result); + if ($count>0){ + $sql="UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='3' where rowid=$line->rowid"; + $db->query($sql); + $order_receipt_printer2.=''.$line->product_label.''; + } + } + $invoice->fetch($placeid); +} + +?> + + +'; +print '
    ".$langs->trans("Name")." / ".$langs->trans("Company")."Date".$langs->trans("Amount")."
    ".$langs->trans("Amount")."
    '.$text; print ''; print ''; + print ''; $directdownloadlink = $order->getLastMainDocLink('commande'); if ($directdownloadlink) { @@ -941,6 +955,7 @@ if ($source == 'invoice') print ''.$text; print ''; print ''; + print ''; $directdownloadlink = $invoice->getLastMainDocLink('facture'); if ($directdownloadlink) { @@ -1139,6 +1154,7 @@ if ($source == 'contractline') print ''.$text; print ''; print ''; + print ''; $directdownloadlink = $contract->getLastMainDocLink('contract'); if ($directdownloadlink) { @@ -1545,7 +1561,6 @@ if (preg_match('/^dopayment/',$action))
    - @@ -1556,8 +1571,6 @@ if (preg_match('/^dopayment/',$action)) - - + societe_id) $socid=$user->societe_id; +$result = restrictedArea($user,'societe',$socid,''); + +$search_all=trim(GETPOST('search_all', 'alphanohtml')?GETPOST('search_all', 'alphanohtml'):GETPOST('sall', 'alphanohtml')); +$search_cti=preg_replace('/^0+/', '', preg_replace('/[^0-9]/', '', GETPOST('search_cti', 'alphanohtml'))); // Phone number without any special chars + +$search_id=trim(GETPOST("search_id","int")); +$search_nom=trim(GETPOST("search_nom")); +$search_alias=trim(GETPOST("search_alias")); +$search_nom_only=trim(GETPOST("search_nom_only")); +$search_barcode=trim(GETPOST("search_barcode")); +$search_customer_code=trim(GETPOST('search_customer_code')); +$search_supplier_code=trim(GETPOST('search_supplier_code')); +$search_account_customer_code=trim(GETPOST('search_account_customer_code')); +$search_account_supplier_code=trim(GETPOST('search_account_supplier_code')); +$search_town=trim(GETPOST("search_town")); +$search_zip=trim(GETPOST("search_zip")); +$search_state=trim(GETPOST("search_state")); +$search_region=trim(GETPOST("search_region")); +$search_email=trim(GETPOST('search_email')); +$search_phone=trim(GETPOST('search_phone')); +$search_url=trim(GETPOST('search_url')); +$search_idprof1=trim(GETPOST('search_idprof1')); +$search_idprof2=trim(GETPOST('search_idprof2')); +$search_idprof3=trim(GETPOST('search_idprof3')); +$search_idprof4=trim(GETPOST('search_idprof4')); +$search_idprof5=trim(GETPOST('search_idprof5')); +$search_idprof6=trim(GETPOST('search_idprof6')); +$search_vat=trim(GETPOST('search_vat')); +$search_sale=trim(GETPOST("search_sale",'int')); +$search_categ_cus=trim(GETPOST("search_categ_cus",'int')); +$search_categ_sup=trim(GETPOST("search_categ_sup",'int')); +$search_country=GETPOST("search_country",'intcomma'); +$search_type_thirdparty=GETPOST("search_type_thirdparty",'int'); +$search_status=GETPOST("search_status",'int'); +$search_type=GETPOST('search_type','alpha'); +$search_level_from = GETPOST("search_level_from","alpha"); +$search_level_to = GETPOST("search_level_to","alpha"); +$search_stcomm=GETPOST('search_stcomm','int'); +$search_import_key = GETPOST("search_import_key","alpha"); + +$type=GETPOST('type'); +$optioncss=GETPOST('optioncss','alpha'); +$mode=GETPOST("mode"); + +$diroutputmassaction=$conf->societe->dir_output . '/temp/massgeneration/'.$user->id; + +$limit = GETPOST('limit','int')?GETPOST('limit','int'):$conf->liste_limit; +$sortfield=GETPOST("sortfield",'alpha'); +$sortorder=GETPOST("sortorder",'alpha'); +$page=GETPOST("page",'int'); +if (! $sortorder) $sortorder="ASC"; +if (! $sortfield) $sortfield="s.nom"; +if (empty($page) || $page == -1) { $page = 0; } +$offset = $limit * $page; +$pageprev = $page - 1; +$pagenext = $page + 1; + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$contextpage='thirdpartylist'; +/*if ($search_type == '1,3') { $contextpage='customerlist'; $type='c'; } +if ($search_type == '2,3') { $contextpage='prospectlist'; $type='p'; } +if ($search_type == '4') { $contextpage='supplierlist'; $type='f'; } +*/ +if ($type == 'c') { $contextpage='customerlist'; if ($search_type=='') $search_type='1,3'; } +if ($type == 'p') { $contextpage='prospectlist'; if ($search_type=='') $search_type='2,3'; } +if ($type == 'f') { $contextpage='supplierlist'; if ($search_type=='') $search_type='4'; } + +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$hookmanager->initHooks(array($contextpage)); +$extrafields = new ExtraFields($db); + +// fetch optionals attributes and labels +$extralabels = $extrafields->fetch_name_optionals_label('societe'); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); + +// List of fields to search into when doing a "search in all" +$fieldstosearchall = array( + 's.nom'=>"ThirdPartyName", + 's.name_alias'=>"AliasNameShort", + 's.code_client'=>"CustomerCode", + 's.code_fournisseur'=>"SupplierCode", + 's.code_compta'=>"CustomerAccountancyCodeShort", + 's.code_compta_fournisseur'=>"SupplierAccountancyCodeShort", + 's.email'=>"EMail", + 's.url'=>"URL", + 's.tva_intra'=>"VATIntra", + 's.siren'=>"ProfId1", + 's.siret'=>"ProfId2", + 's.ape'=>"ProfId3", +); +if (($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof4']='ProfId4'; +if (($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof5']='ProfId5'; +if (($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') $fieldstosearchall['s.idprof6']='ProfId6'; +if (!empty($conf->barcode->enabled)) $fieldstosearchall['s.barcode']='Gencod'; + +// Define list of fields to show into list +$checkedcustomercode=(in_array($contextpage, array('thirdpartylist', 'customerlist', 'prospectlist')) ? 1 : 0); +$checkedsuppliercode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); +$checkedcustomeraccountcode=(in_array($contextpage, array('customerlist')) ? 1 : 0); +$checkedsupplieraccountcode=(in_array($contextpage, array('supplierlist')) ? 1 : 0); +$checkedtypetiers=1; +$checkedprofid1=0; +$checkedprofid2=0; +$checkedprofid3=0; +$checkedprofid4=0; +$checkedprofid5=0; +$checkedprofid6=0; +//$checkedprofid4=((($tmp = $langs->transnoentities("ProfId4".$mysoc->country_code)) && $tmp != "ProfId4".$mysoc->country_code && $tmp != '-') ? 1 : 0); +//$checkedprofid5=((($tmp = $langs->transnoentities("ProfId5".$mysoc->country_code)) && $tmp != "ProfId5".$mysoc->country_code && $tmp != '-') ? 1 : 0); +//$checkedprofid6=((($tmp = $langs->transnoentities("ProfId6".$mysoc->country_code)) && $tmp != "ProfId6".$mysoc->country_code && $tmp != '-') ? 1 : 0); +$checkprospectlevel=(in_array($contextpage, array('prospectlist')) ? 1 : 0); +$checkstcomm=(in_array($contextpage, array('prospectlist')) ? 1 : 0); +$arrayfields=array( + 's.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0)), + 's.nom'=>array('label'=>"ThirdPartyName", 'checked'=>1), + 's.name_alias'=>array('label'=>"AliasNameShort", 'checked'=>1), + 's.barcode'=>array('label'=>"Gencod", 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), + 's.code_client'=>array('label'=>"CustomerCodeShort", 'checked'=>$checkedcustomercode), + 's.code_fournisseur'=>array('label'=>"SupplierCodeShort", 'checked'=>$checkedsuppliercode, 'enabled'=>(! empty($conf->fournisseur->enabled))), + 's.code_compta'=>array('label'=>"CustomerAccountancyCodeShort", 'checked'=>$checkedcustomeraccountcode), + 's.code_compta_fournisseur'=>array('label'=>"SupplierAccountancyCodeShort", 'checked'=>$checkedsupplieraccountcode, 'enabled'=>(! empty($conf->fournisseur->enabled))), + 's.town'=>array('label'=>"Town", 'checked'=>1), + 's.zip'=>array('label'=>"Zip", 'checked'=>1), + 'state.nom'=>array('label'=>"State", 'checked'=>0), + 'region.nom'=>array('label'=>"Region", 'checked'=>0), + 'country.code_iso'=>array('label'=>"Country", 'checked'=>0), + 's.email'=>array('label'=>"Email", 'checked'=>0), + 's.url'=>array('label'=>"Url", 'checked'=>0), + 's.phone'=>array('label'=>"Phone", 'checked'=>1), + 'typent.code'=>array('label'=>"ThirdPartyType", 'checked'=>$checkedtypetiers), + 's.siren'=>array('label'=>"ProfId1Short", 'checked'=>$checkedprofid1), + 's.siret'=>array('label'=>"ProfId2Short", 'checked'=>$checkedprofid2), + 's.ape'=>array('label'=>"ProfId3Short", 'checked'=>$checkedprofid3), + 's.idprof4'=>array('label'=>"ProfId4Short", 'checked'=>$checkedprofid4), + 's.idprof5'=>array('label'=>"ProfId5Short", 'checked'=>$checkedprofid5), + 's.idprof6'=>array('label'=>"ProfId6Short", 'checked'=>$checkedprofid6), + 's.tva_intra'=>array('label'=>"VATIntra", 'checked'=>0), + 'customerorsupplier'=>array('label'=>'Nature', 'checked'=>1), + 's.fk_prospectlevel'=>array('label'=>"ProspectLevelShort", 'checked'=>$checkprospectlevel), + 's.fk_stcomm'=>array('label'=>"StatusProsp", 'checked'=>$checkstcomm), + 's.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), + 's.tms'=>array('label'=>"DateModificationShort", 'checked'=>0, 'position'=>500), + 's.status'=>array('label'=>"Status", 'checked'=>1, 'position'=>1000), + 's.import_key'=>array('label'=>"ImportId", 'checked'=>0, 'position'=>1100), +); +// Extra fields +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +{ + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($extrafields->attribute_list[$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attribute_label[$key], 'checked'=>(($extrafields->attribute_list[$key]<0)?0:1), 'position'=>$extrafields->attribute_pos[$key], 'enabled'=>(abs($extrafields->attribute_list[$key])!=3 && $extrafields->attribute_perms[$key])); + } +} + +$object = new Societe($db); + + +/* + * Actions + */ + +if (GETPOST('cancel','alpha')) { $action='list'; $massaction=''; } +if (! GETPOST('confirmmassaction','alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } + +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + +if (empty($reshook)) +{ + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + // Did we click on purge search criteria ? + if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') || GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers + { + $search_id=''; + $search_nom=''; + $search_alias=''; + $search_categ_cus=0; + $search_categ_sup=0; + $search_sale=''; + $search_barcode=""; + $search_customer_code=''; + $search_supplier_code=''; + $search_account_customer_code=''; + $search_account_supplier_code=''; + $search_town=""; + $search_zip=""; + $search_state=""; + $search_country=''; + $search_email=''; + $search_phone=''; + $search_url=''; + $search_idprof1=''; + $search_idprof2=''; + $search_idprof3=''; + $search_idprof4=''; + $search_idprof5=''; + $search_idprof6=''; + $search_vat=''; + $search_type=''; + $search_type_thirdparty=''; + $search_status=-1; + $search_stcomm=''; + $search_level_from=''; + $search_level_to=''; + $search_import_key=''; + $toselect=''; + $search_array_options=array(); + } + + // Mass actions + $objectclass='Societe'; + $objectlabel='ThirdParty'; + $permtoread = $user->rights->societe->lire; + $permtodelete = $user->rights->societe->supprimer; + $uploaddir = $conf->societe->dir_output; + include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php'; + + if ($action == 'setstcomm') + { + $object = new Client($db); + $result=$object->fetch(GETPOST('stcommsocid')); + $object->stcomm_id=dol_getIdFromCode($db, GETPOST('stcomm','alpha'), 'c_stcomm'); + $result=$object->update($object->id, $user); + if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); + + $action=''; + } +} + +if ($search_status=='') $search_status=1; // always display active thirdparty first + + + +/* + * View + */ + +/* + REM: Rules on permissions to see thirdparties + Internal or External user + No permission to see customers => See nothing + Internal user socid=0 + Permission to see ALL customers => See all thirdparties + Internal user socid=0 + No permission to see ALL customers => See only thirdparties linked to user that are sale representative + External user socid=x + Permission to see ALL customers => Can see only himself + External user socid=x + No permission to see ALL customers => Can see only himself + */ + +$form=new Form($db); +$formother=new FormOther($db); +$companystatic=new Societe($db); +$formcompany=new FormCompany($db); +$prospectstatic=new Client($db); +$prospectstatic->client=2; +$prospectstatic->loadCacheOfProspStatus(); + + +$title=$langs->trans("ListOfThirdParties"); +if ($type == 'c' && (empty($search_type) || ($search_type == '1,3'))) $title=$langs->trans("ListOfCustomers"); +if ($type == 'p' && (empty($search_type) || ($search_type == '2,3'))) $title=$langs->trans("ListOfProspects"); +if ($type == 'f' && (empty($search_type) || ($search_type == '4'))) $title=$langs->trans("ListOfSuppliers"); + +// If both parameters are set, search for everything BETWEEN them +if ($search_level_from != '' && $search_level_to != '') +{ + // Ensure that these parameters are numbers + $search_level_from = (int) $search_level_from; + $search_level_to = (int) $search_level_to; + + // If from is greater than to, reverse orders + if ($search_level_from > $search_level_to) + { + $tmp = $search_level_to; + $search_level_to = $search_level_from; + $search_level_from = $tmp; + } + + // Generate the SQL request + $sortwhere = '(sortorder BETWEEN '.$search_level_from.' AND '.$search_level_to.') AS is_in_range'; +} +// If only "from" parameter is set, search for everything GREATER THAN it +else if ($search_level_from != '') +{ + // Ensure that this parameter is a number + $search_level_from = (int) $search_level_from; + + // Generate the SQL request + $sortwhere = '(sortorder >= '.$search_level_from.') AS is_in_range'; +} +// If only "to" parameter is set, search for everything LOWER THAN it +else if ($search_level_to != '') +{ + // Ensure that this parameter is a number + $search_level_to = (int) $search_level_to; + + // Generate the SQL request + $sortwhere = '(sortorder <= '.$search_level_to.') AS is_in_range'; +} +// If no parameters are set, dont search for anything +else +{ + $sortwhere = '0 as is_in_range'; +} + +// Select every potentiels, and note each potentiels which fit in search parameters +dol_syslog('societe/list.php',LOG_DEBUG); +$sql = "SELECT code, label, sortorder, ".$sortwhere; +$sql.= " FROM ".MAIN_DB_PREFIX."c_prospectlevel"; +$sql.= " WHERE active > 0"; +$sql.= " ORDER BY sortorder"; + +$resql = $db->query($sql); +if ($resql) +{ + $tab_level = array(); + $search_levels = array(); + + while ($obj = $db->fetch_object($resql)) + { + // Compute level text + $level=$langs->trans($obj->code); + if ($level == $obj->code) $level=$langs->trans($obj->label); + + // Put it in the array sorted by sortorder + $tab_level[$obj->sortorder] = $level; + + // If this potentiel fit in parameters, add its code to the $search_levels array + if ($obj->is_in_range == 1) + { + $search_levels[] = '"'.preg_replace('[^A-Za-z0-9_-]', '', $obj->code).'"'; + } + } + + // Implode the $search_levels array so that it can be use in a "IN (...)" where clause. + // If no paramters was set, $search_levels will be empty + $search_levels = implode(',', $search_levels); +} +else dol_print_error($db); + +$sql = "SELECT s.rowid, s.nom as name, s.name_alias, s.barcode, s.town, s.zip, s.datec, s.code_client, s.code_fournisseur, s.logo,"; +$sql.= " st.libelle as stcomm, s.fk_stcomm as stcomm_id, s.fk_prospectlevel, s.prefix_comm, s.client, s.fournisseur, s.canvas, s.status as status,"; +$sql.= " s.email, s.phone, s.url, s.siren as idprof1, s.siret as idprof2, s.ape as idprof3, s.idprof4 as idprof4, s.idprof5 as idprof5, s.idprof6 as idprof6, s.tva_intra, s.fk_pays,"; +$sql.= " s.tms as date_update, s.datec as date_creation,"; +$sql.= " s.code_compta,s.code_compta_fournisseur,"; +$sql.= " typent.code as typent_code,"; +$sql.= " state.code_departement as state_code, state.nom as state_name,"; +$sql.= " region.code_region as region_code, region.nom as region_name"; +// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects) +if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; +// We'll need these fields in order to filter by categ +if ($search_categ_cus) $sql .= ", cc.fk_categorie, cc.fk_soc"; +if ($search_categ_sup) $sql .= ", cs.fk_categorie, cs.fk_soc"; +// Add fields from extrafields +foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; +$sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; +if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_extrafields as ef on (s.rowid = ef.fk_object)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_typent as typent on (typent.id = s.fk_typent)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as state on (state.rowid = s.fk_departement)"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_regions as region on (region. code_region = state.fk_region)"; +// We'll need this table joined to the select in order to filter by categ +if (! empty($search_categ_cus)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cc ON s.rowid = cc.fk_soc"; // We'll need this table joined to the select in order to filter by categ +if (! empty($search_categ_sup)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_fournisseur as cs ON s.rowid = cs.fk_soc"; // We'll need this table joined to the select in order to filter by categ +$sql.= " ,".MAIN_DB_PREFIX."c_stcomm as st"; +// We'll need this table joined to the select in order to filter by sale +if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +$sql.= " WHERE s.fk_stcomm = st.id"; +$sql.= " AND s.entity IN (".getEntity('societe').")"; +if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; +if ($socid) $sql.= " AND s.rowid = ".$socid; +if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale +if (! $user->rights->fournisseur->lire) $sql.=" AND (s.fournisseur <> 1 OR s.client <> 0)"; // client=0, fournisseur=0 must be visible +if ($search_sale) $sql.= " AND sc.fk_user = ".$db->escape($search_sale); +if ($search_categ_cus > 0) $sql.= " AND cc.fk_categorie = ".$db->escape($search_categ_cus); +if ($search_categ_sup > 0) $sql.= " AND cs.fk_categorie = ".$db->escape($search_categ_sup); +if ($search_categ_cus == -2) $sql.= " AND cc.fk_categorie IS NULL"; +if ($search_categ_sup == -2) $sql.= " AND cs.fk_categorie IS NULL"; + +if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); +if (strlen($search_cti)) $sql.= natural_search('s.phone', $search_cti); + +if ($search_id > 0) $sql.= natural_search("s.rowid",$search_id,1); +if ($search_nom) $sql.= natural_search("s.nom",$search_nom); +if ($search_alias) $sql.= natural_search("s.name_alias",$search_alias); +if ($search_nom_only) $sql.= natural_search("s.nom",$search_nom_only); +if ($search_customer_code) $sql.= natural_search("s.code_client",$search_customer_code); +if ($search_supplier_code) $sql.= natural_search("s.code_fournisseur",$search_supplier_code); +if ($search_account_customer_code) $sql.= natural_search("s.code_compta",$search_account_customer_code); +if ($search_account_supplier_code) $sql.= natural_search("s.code_compta_fournisseur",$search_account_supplier_code); +if ($search_town) $sql.= natural_search("s.town",$search_town); +if (strlen($search_zip)) $sql.= natural_search("s.zip",$search_zip); +if ($search_state) $sql.= natural_search("state.nom",$search_state); +if ($search_region) $sql.= natural_search("region.nom",$search_region); +if ($search_country) $sql .= " AND s.fk_pays IN (".$search_country.')'; +if ($search_email) $sql.= natural_search("s.email",$search_email); +if (strlen($search_phone)) $sql.= natural_search("s.phone", $search_phone); +if ($search_url) $sql.= natural_search("s.url",$search_url); +if (strlen($search_idprof1)) $sql.= natural_search("s.siren",$search_idprof1); +if (strlen($search_idprof2)) $sql.= natural_search("s.siret",$search_idprof2); +if (strlen($search_idprof3)) $sql.= natural_search("s.ape",$search_idprof3); +if (strlen($search_idprof4)) $sql.= natural_search("s.idprof4",$search_idprof4); +if (strlen($search_idprof5)) $sql.= natural_search("s.idprof5",$search_idprof5); +if (strlen($search_idprof6)) $sql.= natural_search("s.idprof6",$search_idprof6); +if (strlen($search_vat)) $sql.= natural_search("s.tva_intra",$search_vat); +// Filter on type of thirdparty +if ($search_type > 0 && in_array($search_type,array('1,3','2,3'))) $sql .= " AND s.client IN (".$db->escape($search_type).")"; +if ($search_type > 0 && in_array($search_type,array('4'))) $sql .= " AND s.fournisseur = 1"; +if ($search_type == '0') $sql .= " AND s.client = 0 AND s.fournisseur = 0"; +if ($search_status!='' && $search_status >= 0) $sql .= " AND s.status = ".$db->escape($search_status); +if (!empty($conf->barcode->enabled) && $search_barcode) $sql.= natural_search("s.barcode", $search_barcode); +if ($search_type_thirdparty) $sql .= " AND s.fk_typent IN (".$search_type_thirdparty.')'; +if ($search_levels) $sql .= " AND s.fk_prospectlevel IN (".$search_levels.')'; +if ($search_stcomm != '' && $search_stcomm != -2) $sql.= natural_search("s.fk_stcomm",$search_stcomm,2); +if ($search_import_key) $sql.= natural_search("s.import_key",$search_import_key); +// Add where from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; + +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + +$sql.= $db->order($sortfield,$sortorder); + +// Count total nb of records +$nbtotalofrecords = ''; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); + +$resql = $db->query($sql); +if (! $resql) +{ + dol_print_error($db); + exit; +} + +$num = $db->num_rows($resql); + +$arrayofselected=is_array($toselect)?$toselect:array(); + +if ($num == 1 && ! empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && ($search_all != '' || $search_cti != '') && $action != 'list') +{ + $obj = $db->fetch_object($resql); + $id = $obj->rowid; + header("Location: ".DOL_URL_ROOT.'/societe/card.php?socid='.$id); + exit; +} + +$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; +llxHeader('',$langs->trans("ThirdParty"),$help_url); + +$param=''; +if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; +if ($search_all != '') $param = "&sall=".urlencode($search_all); +if ($sall != '') $param .= "&sall=".urlencode($sall); +if ($search_categ_cus > 0) $param.='&search_categ_cus='.urlencode($search_categ_cus); +if ($search_categ_sup > 0) $param.='&search_categ_sup='.urlencode($search_categ_sup); +if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); +if ($search_id > 0) $param.= "&search_id=".urlencode($search_id); +if ($search_nom != '') $param.= "&search_nom=".urlencode($search_nom); +if ($search_alias != '') $param.= "&search_alias=".urlencode($search_alias); +if ($search_town != '') $param.= "&search_town=".urlencode($search_town); +if ($search_zip != '') $param.= "&search_zip=".urlencode($search_zip); +if ($search_phone != '') $param.= "&search_phone=".urlencode($search_phone); +if ($search_email != '') $param.= "&search_email=".urlencode($search_email); +if ($search_url != '') $param.= "&search_url=".urlencode($search_url); +if ($search_state != '') $param.= "&search_state=".urlencode($search_state); +if ($search_country != '') $param.= "&search_country=".urlencode($search_country); +if ($search_customer_code != '') $param.= "&search_customer_code=".urlencode($search_customer_code); +if ($search_supplier_code != '') $param.= "&search_supplier_code=".urlencode($search_supplier_code); +if ($search_account_customer_code != '') $param.= "&search_account_customer_code=".urlencode($search_account_customer_code); +if ($search_account_supplier_code != '') $param.= "&search_account_supplier_code=".urlencode($search_account_supplier_code); +if ($search_barcode != '') $param.= "&search_barcode=".urlencode($search_barcode); +if ($search_idprof1 != '') $param.= '&search_idprof1='.urlencode($search_idprof1); +if ($search_idprof2 != '') $param.= '&search_idprof2='.urlencode($search_idprof2); +if ($search_idprof3 != '') $param.= '&search_idprof3='.urlencode($search_idprof3); +if ($search_idprof4 != '') $param.= '&search_idprof4='.urlencode($search_idprof4); +if ($search_idprof5 != '') $param.= '&search_idprof5='.urlencode($search_idprof5); +if ($search_idprof6 != '') $param.= '&search_idprof6='.urlencode($search_idprof6); +if ($search_vat != '') $param.= '&search_vat='.urlencode($search_vat); +if ($search_type_thirdparty != '') $param.='&search_type_thirdparty='.urlencode($search_type_thirdparty); +if ($search_type != '') $param.='&search_type='.urlencode($search_type); +if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); +if ($search_status != '') $param.='&search_status='.urlencode($search_status); +if ($search_stcomm != '') $param.='&search_stcomm='.urlencode($search_stcomm); +if ($search_level_from != '') $param.='&search_level_from='.urlencode($search_level_from); +if ($search_level_to != '') $param.='&search_level_to='.urlencode($search_level_to); +if ($search_import_key != '') $param.='&search_import_key='.urlencode($search_import_key); +if ($type != '') $param.='&type='.urlencode($type); +// Add $param from extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; + +// Show delete result message +if (GETPOST('delsoc')) +{ + setEventMessages($langs->trans("CompanyDeleted",GETPOST('delsoc')), null, 'mesgs'); +} + +// List of mass actions available +$arrayofmassactions = array( + 'presend'=>$langs->trans("SendByMail"), +// 'builddoc'=>$langs->trans("PDFMerge"), +); +//if($user->rights->societe->creer) $arrayofmassactions['createbills']=$langs->trans("CreateInvoiceForThisCustomer"); +if ($user->rights->societe->supprimer) $arrayofmassactions['predelete']=$langs->trans("Delete"); +if (GETPOST('nomassaction','int') || in_array($massaction, array('presend','predelete'))) $arrayofmassactions=array(); +$massactionbutton=$form->selectMassAction('', $arrayofmassactions); + +print '
    '; +if ($optioncss != '') print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'title_companies', 0, '', '', $limit); + +$langs->load("other"); +$textprofid=array(); +foreach(array(1,2,3,4,5,6) as $key) +{ + $label=$langs->transnoentities("ProfId".$key.$mysoc->country_code); + $textprofid[$key]=''; + if ($label != "ProfId".$key.$mysoc->country_code) + { // Get only text between () + if (preg_match('/\((.*)\)/i',$label,$reg)) $label=$reg[1]; + $textprofid[$key]=$langs->trans("ProfIdShortDesc",$key,$mysoc->country_code,$label); + } +} + +$topicmail="Information"; +$modelmail="thirdparty"; +$objecttmp=new Societe($db); +$trackid='thi'.$object->id; +include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php'; + +if ($search_all) +{ + foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); + print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); +} + +// Filter on categories +$moreforfilter=''; +if (empty($type) || $type == 'c' || $type == 'p') +{ + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
    '; + $moreforfilter.=$langs->trans('CustomersProspectsCategoriesShort').': '; + $moreforfilter.=$formother->select_categories('customer', $search_categ_cus, 'search_categ_cus', 1, $langs->trans('CustomersProspectsCategoriesShort')); + $moreforfilter.='
    '; + } +} +if (empty($type) || $type == 'f') +{ + if (! empty($conf->categorie->enabled)) + { + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $moreforfilter.='
    '; + $moreforfilter.=$langs->trans('SuppliersCategoriesShort').': '; + $moreforfilter.=$formother->select_categories('supplier',$search_categ_sup,'search_categ_sup',1); + $moreforfilter.='
    '; + } +} + +// If the user can view prospects other than his' +if ($user->rights->societe->client->voir || $socid) +{ + $moreforfilter.='
    '; + $moreforfilter.=$langs->trans('SalesRepresentatives'). ': '; + $moreforfilter.=$formother->select_salesrepresentatives($search_sale,'search_sale',$user, 0, 1, 'maxwidth300'); + $moreforfilter.='
    '; +} +if ($moreforfilter) +{ + print '
    '; + print $moreforfilter; + $parameters=array('type'=>$type); + $reshook=$hookmanager->executeHooks('printFieldPreListTitle',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print '
    '; +} + +$varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; +$selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); + +if (empty($arrayfields['customerorsupplier']['checked'])) print ''; + +print '
    '; +print ''."\n"; + +// Fields title search +print ''; +if (! empty($arrayfields['s.rowid']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.nom']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.name_alias']['checked'])) +{ + print ''; +} +// Barcode +if (! empty($arrayfields['s.barcode']['checked'])) +{ + print ''; +} +// Customer code +if (! empty($arrayfields['s.code_client']['checked'])) +{ + print ''; +} +// Supplier code +if (! empty($arrayfields['s.code_fournisseur']['checked'])) +{ + print ''; +} +// Account Customer code +if (! empty($arrayfields['s.code_compta']['checked'])) +{ + print ''; +} +// Account Supplier code +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) +{ + print ''; +} +// Town +if (! empty($arrayfields['s.town']['checked'])) +{ + print ''; +} +// Zip +if (! empty($arrayfields['s.zip']['checked'])) +{ + print ''; +} +// State +if (! empty($arrayfields['state.nom']['checked'])) +{ + print ''; +} +// Region +if (! empty($arrayfields['region.nom']['checked'])) +{ + print ''; +} +// Country +if (! empty($arrayfields['country.code_iso']['checked'])) +{ + print ''; +} +// Company type +if (! empty($arrayfields['typent.code']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.email']['checked'])) +{ + // Email + print ''; +} +if (! empty($arrayfields['s.phone']['checked'])) +{ + // Phone + print ''; +} +if (! empty($arrayfields['s.url']['checked'])) +{ + // Url + print ''; +} +if (! empty($arrayfields['s.siren']['checked'])) +{ + // IdProf1 + print ''; +} +if (! empty($arrayfields['s.siret']['checked'])) +{ + // IdProf2 + print ''; +} +if (! empty($arrayfields['s.ape']['checked'])) +{ + // IdProf3 + print ''; +} +if (! empty($arrayfields['s.idprof4']['checked'])) +{ + // IdProf4 + print ''; +} +if (! empty($arrayfields['s.idprof5']['checked'])) +{ + // IdProf5 + print ''; +} +if (! empty($arrayfields['s.idprof6']['checked'])) +{ + // IdProf6 + print ''; +} +if (! empty($arrayfields['s.tva_intra']['checked'])) +{ + // Vat number + print ''; +} + +// Type (customer/prospect/supplier) +if (! empty($arrayfields['customerorsupplier']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) +{ + // Prospect level + print ''; +} + +if (! empty($arrayfields['s.fk_stcomm']['checked'])) +{ + // Prospect status + print ''; +} +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +// Date creation +if (! empty($arrayfields['s.datec']['checked'])) +{ + print ''; +} +// Date modification +if (! empty($arrayfields['s.tms']['checked'])) +{ + print ''; +} +// Status +if (! empty($arrayfields['s.status']['checked'])) +{ + print ''; +} +if (! empty($arrayfields['s.import_key']['checked'])) +{ + print ''; +} +// Action column +print ''; + +print "\n"; + +print ''; +if (! empty($arrayfields['s.rowid']['checked'])) print_liste_field_titre($arrayfields['s.rowid']['label'], $_SERVER["PHP_SELF"],"s.rowid","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.nom']['checked'])) print_liste_field_titre($arrayfields['s.nom']['label'], $_SERVER["PHP_SELF"],"s.nom","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.name_alias']['checked'])) print_liste_field_titre($arrayfields['s.name_alias']['label'], $_SERVER["PHP_SELF"],"s.name_alias","",$param,"",$sortfield,$sortorder); +if (! empty($arrayfields['s.barcode']['checked'])) print_liste_field_titre($arrayfields['s.barcode']['label'], $_SERVER["PHP_SELF"], "s.barcode",$param,'','',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_client']['checked'])) print_liste_field_titre($arrayfields['s.code_client']['label'],$_SERVER["PHP_SELF"],"s.code_client","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_fournisseur","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta']['checked'])) print_liste_field_titre($arrayfields['s.code_compta']['label'],$_SERVER["PHP_SELF"],"s.code_compta","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) print_liste_field_titre($arrayfields['s.code_compta_fournisseur']['label'],$_SERVER["PHP_SELF"],"s.code_compta_fournisseur","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.town']['checked'])) print_liste_field_titre($arrayfields['s.town']['label'],$_SERVER["PHP_SELF"],"s.town","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.zip']['checked'])) print_liste_field_titre($arrayfields['s.zip']['label'],$_SERVER["PHP_SELF"],"s.zip","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['state.nom']['checked'])) print_liste_field_titre($arrayfields['state.nom']['label'],$_SERVER["PHP_SELF"],"state.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['region.nom']['checked'])) print_liste_field_titre($arrayfields['region.nom']['label'],$_SERVER["PHP_SELF"],"region.nom","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['country.code_iso']['checked'])) print_liste_field_titre($arrayfields['country.code_iso']['label'],$_SERVER["PHP_SELF"],"country.code_iso","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['typent.code']['checked'])) print_liste_field_titre($arrayfields['typent.code']['label'],$_SERVER["PHP_SELF"],"typent.code","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.email']['checked'])) print_liste_field_titre($arrayfields['s.email']['label'],$_SERVER["PHP_SELF"],"s.email","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.phone']['checked'])) print_liste_field_titre($arrayfields['s.phone']['label'],$_SERVER["PHP_SELF"],"s.phone","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.url']['checked'])) print_liste_field_titre($arrayfields['s.url']['label'],$_SERVER["PHP_SELF"],"s.url","",$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['s.siren']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId1Short"),$textprofid[1],1,0),$_SERVER["PHP_SELF"],"s.siren","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.siret']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId2Short"),$textprofid[2],1,0),$_SERVER["PHP_SELF"],"s.siret","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.ape']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId3Short"),$textprofid[3],1,0),$_SERVER["PHP_SELF"],"s.ape","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof4']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId4Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof4","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof5']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId5Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof5","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.idprof6']['checked'])) print_liste_field_titre($form->textwithpicto($langs->trans("ProfId6Short"),$textprofid[4],1,0),$_SERVER["PHP_SELF"],"s.idprof6","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.tva_intra']['checked'])) print_liste_field_titre($arrayfields['s.tva_intra']['label'],$_SERVER["PHP_SELF"],"s.tva_intra","",$param,'class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['customerorsupplier']['checked'])) print_liste_field_titre(''); // type of customer +if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) print_liste_field_titre($arrayfields['s.fk_prospectlevel']['label'],$_SERVER["PHP_SELF"],"s.fk_prospectlevel","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.fk_stcomm']['checked'])) print_liste_field_titre($arrayfields['s.fk_stcomm']['label'],$_SERVER["PHP_SELF"],"s.fk_stcomm","",$param,'align="center"',$sortfield,$sortorder); +// Extra fields +include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; +if (! empty($arrayfields['s.datec']['checked'])) print_liste_field_titre($arrayfields['s.datec']['label'],$_SERVER["PHP_SELF"],"s.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.tms']['checked'])) print_liste_field_titre($arrayfields['s.tms']['label'],$_SERVER["PHP_SELF"],"s.tms","",$param,'align="center" class="nowrap"',$sortfield,$sortorder); +if (! empty($arrayfields['s.status']['checked'])) print_liste_field_titre($arrayfields['s.status']['label'],$_SERVER["PHP_SELF"],"s.status","",$param,'align="center"',$sortfield,$sortorder); +if (! empty($arrayfields['s.import_key']['checked'])) print_liste_field_titre($arrayfields['s.import_key']['label'],$_SERVER["PHP_SELF"],"s.import_key","",$param,'align="center"',$sortfield,$sortorder); +print_liste_field_titre($selectedfields, $_SERVER["PHP_SELF"],"",'','','align="center"',$sortfield,$sortorder,'maxwidthsearch '); +print "\n"; + + +$i = 0; +$totalarray=array(); +while ($i < min($num, $limit)) +{ + $obj = $db->fetch_object($resql); + + $companystatic->id=$obj->rowid; + $companystatic->name=$obj->name; + $companystatic->name_alias=$obj->name_alias; + $companystatic->logo=$obj->logo; + $companystatic->canvas=$obj->canvas; + $companystatic->client=$obj->client; + $companystatic->status=$obj->status; + $companystatic->email=$obj->email; + $companystatic->fournisseur=$obj->fournisseur; + $companystatic->code_client=$obj->code_client; + $companystatic->code_fournisseur=$obj->code_fournisseur; + + $companystatic->code_compta_client=$obj->code_compta; + $companystatic->code_compta_fournisseur=$obj->code_compta_fournisseur; + + $companystatic->fk_prospectlevel=$obj->fk_prospectlevel; + + print ''; + if (! empty($arrayfields['s.rowid']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.nom']['checked'])) + { + $savalias = $obj->name_alias; + if (! empty($arrayfields['s.name_alias']['checked'])) $companystatic->name_alias=''; + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.name_alias']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + // Barcode + if (! empty($arrayfields['s.barcode']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Customer code + if (! empty($arrayfields['s.code_client']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Supplier code + if (! empty($arrayfields['s.code_fournisseur']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Account customer code + if (! empty($arrayfields['s.code_compta']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Account supplier code + if (! empty($arrayfields['s.code_compta_fournisseur']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Town + if (! empty($arrayfields['s.town']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Zip + if (! empty($arrayfields['s.zip']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // State + if (! empty($arrayfields['state.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Region + if (! empty($arrayfields['region.nom']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Country + if (! empty($arrayfields['country.code_iso']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Type ent + if (! empty($arrayfields['typent.code']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.email']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.phone']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.url']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.siren']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.siret']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.ape']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.idprof4']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.idprof5']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.idprof6']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.tva_intra']['checked'])) + { + print "\n"; + if (! $i) $totalarray['nbfield']++; + } + // Type + if (! empty($arrayfields['customerorsupplier']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + + if (! empty($arrayfields['s.fk_prospectlevel']['checked'])) + { + // Prospect level + print '"; + if (! $i) $totalarray['nbfield']++; + } + + if (! empty($arrayfields['s.fk_stcomm']['checked'])) + { + // Prospect status + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue',$parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Date creation + if (! empty($arrayfields['s.datec']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Date modification + if (! empty($arrayfields['s.tms']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + // Status + if (! empty($arrayfields['s.status']['checked'])) + { + print ''; + if (! $i) $totalarray['nbfield']++; + } + if (! empty($arrayfields['s.import_key']['checked'])) + { + print '\n"; + if (! $i) $totalarray['nbfield']++; + } + + // Action column + print ''; + if (! $i) $totalarray['nbfield']++; + + print ''."\n"; + $i++; +} + +$db->free($resql); + +$parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); +$reshook=$hookmanager->executeHooks('printFieldListFooter',$parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + +print "
    '; + print ''; + print ''; + if (! empty($search_nom_only) && empty($search_nom)) $search_nom=$search_nom_only; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print $form->select_country($search_country,'search_country','',0,'maxwidth100'); + print ''; + print $form->selectarray("search_type_thirdparty", $formcompany->typent_array(0), $search_type_thirdparty, 0, 0, 0, '', 0, 0, 0, (empty($conf->global->SOCIETE_SORT_ON_TYPEENT)?'ASC':$conf->global->SOCIETE_SORT_ON_TYPEENT)); + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + if ($type != '') print ''; + print ''; + $options_from = ''; // Generate in $options_from the list of each option sorted + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) + { + $options_from .= ''; + } + array_reverse($tab_level, true); // Reverse the list + $options_to = ''; // Generate in $options_to the list of each option sorted in the reversed order + foreach ($tab_level as $tab_level_sortorder => $tab_level_label) + { + $options_to .= ''; + } + + // Print these two select + print $langs->trans("From").' '; + print ' '; + print $langs->trans("to").' '; + + print ''; + $arraystcomm=array(); + foreach($prospectstatic->cacheprospectstatus as $key => $val) + { + $arraystcomm[$val['id']]=($langs->trans("StatusProspect".$val['id']) != "StatusProspect".$val['id'] ? $langs->trans("StatusProspect".$val['id']) : $val['label']); + } + print $form->selectarray('search_stcomm', $arraystcomm, $search_stcomm, -2); + print ''; + print ''; + print ''; + print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $search_status, 1); + print ''; + print ''; + print ''; +$searchpicto=$form->showFilterButtons(); +print $searchpicto; +print '
    '; + print $obj->rowid; + print "'; + print $obj->name; + print "'; + print $companystatic->name_alias; + print "'.$obj->barcode.''.$obj->code_client.''.$obj->code_fournisseur.''.$obj->code_compta.''.$obj->code_compta_fournisseur.'".$obj->town."".$obj->zip."".$obj->state_name."".$obj->region_name."'; + $tmparray=getCountry($obj->fk_pays,'all'); + print $tmparray['label']; + print ''; + if (! is_array($typenArray) || count($typenArray)==0) $typenArray = $formcompany->typent_array(1); + print $typenArray[$obj->typent_code]; + print '".$obj->email."".$obj->phone."".$obj->url."".$obj->idprof1."".$obj->idprof2."".$obj->idprof3."".$obj->idprof4."".$obj->idprof5."".$obj->idprof6."".$obj->tva_intra."'; + $s=''; + if (($obj->client==1 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) + { + $companystatic->name=$langs->trans("Customer"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'customer',0,1); + } + if (($obj->client==2 || $obj->client==3) && empty($conf->global->SOCIETE_DISABLE_PROSPECTS)) + { + if ($s) $s.=" / "; + $companystatic->name=$langs->trans("Prospect"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'prospect',0,1); + } + if (! empty($conf->fournisseur->enabled) && $obj->fournisseur) + { + if ($s) $s.=" / "; + $companystatic->name=$langs->trans("Supplier"); + $companystatic->name_alias=''; + $s.=$companystatic->getNomUrl(0,'supplier',0,1); + } + print $s; + print ''; + print $companystatic->getLibProspLevel(); + print "
    '; + print '
    '.$companystatic->LibProspCommStatut($obj->stcomm_id,2,$prospectstatic->cacheprospectstatus[$obj->stcomm_id]['label']); + print '
    -
    '; + foreach($prospectstatic->cacheprospectstatus as $key => $val) + { + $titlealt='default'; + if (! empty($val['code']) && ! in_array($val['code'], array('ST_NO', 'ST_NEVER', 'ST_TODO', 'ST_PEND', 'ST_DONE'))) $titlealt=$val['label']; + if ($obj->stcomm_id != $val['id']) print ''.img_action($titlealt,$val['code']).''; + } + print '
    '; + print dol_print_date($db->jdate($obj->date_creation), 'dayhour', 'tzuser'); + print ''; + print dol_print_date($db->jdate($obj->date_update), 'dayhour', 'tzuser'); + print ''.$companystatic->getLibStatut(3).''; + print $obj->import_key; + print "'; + if ($massactionbutton || $massaction) // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined + { + $selected=0; + if (in_array($obj->rowid, $arrayofselected)) $selected=1; + print ''; + } + print '
    "; +print "
    "; + +print '
    '; + +llxFooter(); +$db->close(); diff --git a/htdocs/takepos/dev/img/README.md b/htdocs/takepos/dev/img/README.md new file mode 100644 index 00000000000..5cd4c76d010 --- /dev/null +++ b/htdocs/takepos/dev/img/README.md @@ -0,0 +1,53 @@ +Source images +============= + +Used to generate icons and publication assets. + +Icons +----- + +### Dolibarr + +These resides in the [/img](../../img) directory. + +#### Small + +Required. +Name must begin by ```object_```. + +- Sample: ![object_takepos.png](../../img/object_takepos.png) [object_takepos.png](../../img/object_takepos.png) +- Size: 14×14 pixels +- Type: PNG + +#### Large + +Optional. + +- Sample: ![takepos.png](../../img/takepos.png) [takepos.png](../../img/takepos.png) +- Size: 32×32 pixels +- Type: PNG + +### Dolistore + +Designed to fit a 512×512 icon + publisher branding. + +- Size: 704×704 +- Type: PNG + +Export to 512×512 + +### Transifex + +- Size: 96×96 +- Type: PNG + +### Others + +To be on the safe side, you may also want to generate all popular sizes: +- 16×16 +- 32×32 +- 48×48 +- 64×64 +- 128×128 +- 256×256 +- 512×512 diff --git a/htdocs/takepos/dev/img/gfdl-129x44.png b/htdocs/takepos/dev/img/gfdl-129x44.png new file mode 100644 index 00000000000..f2bacfd179a Binary files /dev/null and b/htdocs/takepos/dev/img/gfdl-129x44.png differ diff --git a/htdocs/takepos/dev/img/gfdl-66x23.png b/htdocs/takepos/dev/img/gfdl-66x23.png new file mode 100644 index 00000000000..b43479bf3c8 Binary files /dev/null and b/htdocs/takepos/dev/img/gfdl-66x23.png differ diff --git a/htdocs/takepos/dev/img/gfdl-logo.svg b/htdocs/takepos/dev/img/gfdl-logo.svg new file mode 100644 index 00000000000..a0daca0ead8 --- /dev/null +++ b/htdocs/takepos/dev/img/gfdl-logo.svg @@ -0,0 +1,110 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + GFDL + + + + + + + diff --git a/htdocs/takepos/dev/img/gpl-v3-logo.svg b/htdocs/takepos/dev/img/gpl-v3-logo.svg new file mode 100644 index 00000000000..6754c994bda --- /dev/null +++ b/htdocs/takepos/dev/img/gpl-v3-logo.svg @@ -0,0 +1,389 @@ + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/htdocs/takepos/dev/img/gplv3-127x51.png b/htdocs/takepos/dev/img/gplv3-127x51.png new file mode 100644 index 00000000000..3e9136e6266 Binary files /dev/null and b/htdocs/takepos/dev/img/gplv3-127x51.png differ diff --git a/htdocs/takepos/dev/img/gplv3-88x31.png b/htdocs/takepos/dev/img/gplv3-88x31.png new file mode 100644 index 00000000000..ba78d4c4941 Binary files /dev/null and b/htdocs/takepos/dev/img/gplv3-88x31.png differ diff --git a/htdocs/takepos/dev/img/takepos.svg b/htdocs/takepos/dev/img/takepos.svg new file mode 100644 index 00000000000..f51ead1a94e --- /dev/null +++ b/htdocs/takepos/dev/img/takepos.svg @@ -0,0 +1,70 @@ + + + + + + + + + + image/svg+xml + + + + + + + M + + diff --git a/htdocs/takepos/floors.php b/htdocs/takepos/floors.php new file mode 100644 index 00000000000..8dd6f729950 --- /dev/null +++ b/htdocs/takepos/floors.php @@ -0,0 +1,176 @@ + + * + * 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 . + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS + +require '../main.inc.php'; // Load $user and permissions + +$floor=GETPOST('floor','alpha'); +if ($floor=="") $floor=1; +$id = GETPOST('id','int'); +$action = GETPOST('action','alpha'); +$left = GETPOST('left','alpha'); +$top = GETPOST('top','alpha'); +$place = GETPOST('place','int'); +$newname = GETPOST('newname'); +$mode = GETPOST('mode','alpha'); + +if ($action=="getTables"){ + $sql="SELECT * from ".MAIN_DB_PREFIX."takepos_floor_tables where floor=".$floor; + $resql = $db->query($sql); + $rows = array(); + while($row = $db->fetch_array ($resql)){ + $rows[] = $row; + } + echo json_encode($rows); + exit; +} + +if ($action=="update") +{ + if ($left>95) $left=95; + if ($top>95) $top=95; + if ($left>3 or $top>4) $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set leftpos=$left, toppos=$top where label='$place'"); + else $db->query("delete from ".MAIN_DB_PREFIX."takepos_floor_tables where label='$place'"); +} + +if ($action=="updatename") +{ + $newname = preg_replace("/[^a-zA-Z0-9\s]/", "", $newname); // Only English chars + if (strlen($newname) > 3) $newname = substr($newname, 0, 3); // Only 3 chars + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label='$newname' where label='$place'"); +} + +if ($action=="add") +{ + $asdf=$db->query("insert into ".MAIN_DB_PREFIX."takepos_floor_tables values ('', '', '', '45', '45', $floor)"); + $db->query("update ".MAIN_DB_PREFIX."takepos_floor_tables set label=rowid where label=''"); // No empty table names +} + +// Title +$title='TakePOS - Dolibarr '.DOL_VERSION; +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); +?> + + + + + + +admin){?> + + + +
    +
    +

    ';">trans("Floor")." ".$floor; ?>

    +
    +
    + + \ No newline at end of file diff --git a/htdocs/takepos/freezone.php b/htdocs/takepos/freezone.php new file mode 100644 index 00000000000..702c59541a3 --- /dev/null +++ b/htdocs/takepos/freezone.php @@ -0,0 +1,59 @@ + + * + * 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 . + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +require '../main.inc.php'; // Load $user and permissions + +$langs->loadLangs(array("bills", "cashdesk")); + +$place = GETPOST('place','int'); + + +/* + * View + */ + +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + +?> + + + +
    +
    + + + + +
    + + + \ No newline at end of file diff --git a/htdocs/takepos/genimg/add.jpg b/htdocs/takepos/genimg/add.jpg new file mode 100644 index 00000000000..976fd10697d Binary files /dev/null and b/htdocs/takepos/genimg/add.jpg differ diff --git a/htdocs/takepos/genimg/empty.jpg b/htdocs/takepos/genimg/empty.jpg new file mode 100644 index 00000000000..8883f7c9957 Binary files /dev/null and b/htdocs/takepos/genimg/empty.jpg differ diff --git a/htdocs/takepos/genimg/index.php b/htdocs/takepos/genimg/index.php new file mode 100644 index 00000000000..ff1b368b743 --- /dev/null +++ b/htdocs/takepos/genimg/index.php @@ -0,0 +1,143 @@ + + * + * 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 . + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +require '../../main.inc.php'; // Load $user and permissions + +$id= GETPOST('id'); +$w= GETPOST('w'); +$h= GETPOST('h'); +$query= GETPOST('query'); + + + +/* + * View + */ + +header('Content-Type: image/jpeg'); +header('Cache-Control: max-age=604800, public, must-revalidate'); +header('Pragma: cache'); + +if ($query=="cat") +{ + require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/categories.lib.php'; + + $object = new Categorie($db); + $result = $object->fetch($id); + $upload_dir = $conf->categorie->multidir_output[$object->entity]; + $pdir = get_exdir($object->id,2,0,0,$object,'category') . $object->id ."/photos/"; + $dir = $upload_dir.'/'.$pdir; + foreach ($object->liste_photos($dir) as $key => $obj) + { + $filename=$obj['photo']; + } + + // The file + $filename = $dir.$filename; + if (!file_exists($filename)) $filename="empty.jpg"; + + // Dimensions + list($width, $height) = getimagesize($filename); + $new_width = $w; + $new_height = $h; + + // Resample + $image_p = imagecreatetruecolor($new_width, $new_height); + $image = imagecreatefromjpeg($filename); + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + + // Add icon + $icon = imagecreatefromjpeg('add.jpg'); + list($width, $height) = getimagesize('add.jpg'); + $new_width = $w*0.3; + $new_height = $h*0.3; + $icon_p = imagecreatetruecolor($new_width, $new_height); + imagecopyresampled($icon_p, $icon, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + imagecopymerge($image_p, $icon_p, 0, 0, 0, 0, $new_width, $new_height, 100); + + // Output + imagejpeg($image_p, null, 100); +} +else if ($query=="pro") +{ + require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; + + $objProd = new Product($db); + $objProd->fetch($id); + + $dir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; + $pdir .= get_exdir(0,0,0,0,$objProd,'product').$objProd->ref.'/'; + + foreach ($objProd->liste_photos($dir) as $key => $obj) + { + $filename=$obj['photo']; + } + $filename = $dir.$filename; + + if (!file_exists($filename)){ + $dir = $conf->product->multidir_output[$objProd->entity].'/'.$pdir; + foreach ($objProd->liste_photos($dir) as $key => $obj) + { + $filename=$obj['photo']; + } + $filename = $dir.$filename; + } + + if (!file_exists($filename)) $filename="empty.jpg"; + + // Dimensions + list($width, $height) = getimagesize($filename); + $new_width = $w; + $new_height = $h; + + // Resample + $image_p = imagecreatetruecolor($new_width, $new_height); + $image = imagecreatefromjpeg($filename); + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + + // Output + imagejpeg($image_p, null, 100); +} +else +{ + // The file + $filename = $query.".jpg"; + + // Dimensions + list($width, $height) = getimagesize($filename); + $new_width = $w; + $new_height = $h; + + // Resample + $image_p = imagecreatetruecolor($new_width, $new_height); + $image = imagecreatefromjpeg($filename); + imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + + // Output + imagejpeg($image_p, null, 100); +} diff --git a/htdocs/takepos/img/arrow-next-top.png b/htdocs/takepos/img/arrow-next-top.png new file mode 100644 index 00000000000..70f720cab10 Binary files /dev/null and b/htdocs/takepos/img/arrow-next-top.png differ diff --git a/htdocs/takepos/img/arrow-next.png b/htdocs/takepos/img/arrow-next.png new file mode 100644 index 00000000000..1056f024390 Binary files /dev/null and b/htdocs/takepos/img/arrow-next.png differ diff --git a/htdocs/takepos/img/arrow-prev-top.png b/htdocs/takepos/img/arrow-prev-top.png new file mode 100644 index 00000000000..23567d35890 Binary files /dev/null and b/htdocs/takepos/img/arrow-prev-top.png differ diff --git a/htdocs/takepos/img/arrow-prev.png b/htdocs/takepos/img/arrow-prev.png new file mode 100644 index 00000000000..b7311f26f54 Binary files /dev/null and b/htdocs/takepos/img/arrow-prev.png differ diff --git a/htdocs/takepos/img/gfdl.png b/htdocs/takepos/img/gfdl.png new file mode 100644 index 00000000000..f2bacfd179a Binary files /dev/null and b/htdocs/takepos/img/gfdl.png differ diff --git a/htdocs/takepos/img/gplv3.png b/htdocs/takepos/img/gplv3.png new file mode 100644 index 00000000000..ba78d4c4941 Binary files /dev/null and b/htdocs/takepos/img/gplv3.png differ diff --git a/htdocs/takepos/img/marketplace/cashcontrol.jpg b/htdocs/takepos/img/marketplace/cashcontrol.jpg new file mode 100644 index 00000000000..66240218dff Binary files /dev/null and b/htdocs/takepos/img/marketplace/cashcontrol.jpg differ diff --git a/htdocs/takepos/img/marketplace/takeposmobile.jpg b/htdocs/takepos/img/marketplace/takeposmobile.jpg new file mode 100644 index 00000000000..918f7c49d5e Binary files /dev/null and b/htdocs/takepos/img/marketplace/takeposmobile.jpg differ diff --git a/htdocs/takepos/img/object_takepos.png b/htdocs/takepos/img/object_takepos.png new file mode 100644 index 00000000000..5a307bfc62f Binary files /dev/null and b/htdocs/takepos/img/object_takepos.png differ diff --git a/htdocs/takepos/img/table.gif b/htdocs/takepos/img/table.gif new file mode 100644 index 00000000000..54f7a209d89 Binary files /dev/null and b/htdocs/takepos/img/table.gif differ diff --git a/htdocs/takepos/img/takepos.png b/htdocs/takepos/img/takepos.png new file mode 100644 index 00000000000..be9d3dcfc3f Binary files /dev/null and b/htdocs/takepos/img/takepos.png differ diff --git a/htdocs/takepos/invoice.php b/htdocs/takepos/invoice.php new file mode 100644 index 00000000000..939d1ea2189 --- /dev/null +++ b/htdocs/takepos/invoice.php @@ -0,0 +1,288 @@ + + * + * 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 . + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; +require_once DOL_DOCUMENT_ROOT.'/compta/paiement/class/paiement.class.php'; + +$langs->loadLangs(array("bills", "cashdesk")); + +$id = GETPOST('id','int'); +$action = GETPOST('action','alpha'); +$idproduct = GETPOST('idproduct','int'); +$place = GETPOST('place','int'); +$number = GETPOST('number'); +$idline = GETPOST('idline'); +$desc = GETPOST('desc','alpha'); +$pay = GETPOST('pay'); + +$sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where facnumber='(PROV-POS-".$place.")'"; +$resql = $db->query($sql); +$row = $db->fetch_array ($resql); +$placeid=$row[0]; +if (! $placeid) $placeid=0; // not necesary +else{ + $invoice = new Facture($db); + $invoice->fetch($placeid); +} + +/* + * Actions + */ + +if ($action == 'valid' && $user->rights->facture->creer){ + if ($pay=="cash") $bankaccount=$conf->global->CASHDESK_ID_BANKACCOUNT_CASH; + else if ($pay=="card") $bankaccount=$conf->global->CASHDESK_ID_BANKACCOUNT_CB; + $now=dol_now(); + $invoice = new Facture($db); + $invoice->fetch($placeid); + if (! empty($conf->stock->enabled) and $conf->global->CASHDESK_NO_DECREASE_STOCK!="1") $invoice->validate($user, '', $conf->global->CASHDESK_ID_WAREHOUSE); + else $invoice->validate($user); + // Add the payment + $payment=new Paiement($db); + $payment->datepaye=$now; + $payment->bank_account=$bankaccount; + $payment->amounts[$invoice->id]=$invoice->total_ttc; + if ($pay=="cash") $payment->paiementid=4; + else if ($pay=="card") $payment->paiementid=6; + $payment->num_paiement=$invoice->facnumber; + $payment->create($user); + $payment->addPaymentToBank($user, 'payment', '(CustomerInvoicePayment)', $bankaccount, '', ''); + $invoice->set_paid($user); +} + +if (($action=="addline" || $action=="freezone") and $placeid==0) +{ + if ($placeid==0) { + $invoice = new Facture($db); + $invoice->socid=$conf->global->CASHDESK_ID_THIRDPARTY; + $invoice->date=dol_now(); + $invoice->ref="(PROV-POS)"; + $invoice->module_source = 'takepos'; + + $placeid=$invoice->create($user); + $sql="UPDATE ".MAIN_DB_PREFIX."facture set facnumber='(PROV-POS-".$place.")' where rowid=".$placeid; + $db->query($sql); + } +} + +if ($action=="addline"){ + $prod = new Product($db); + $prod->fetch($idproduct); + $invoice->addline($prod->description, $prod->price, 1, $prod->tva_tx, $prod->localtax1_tx, $prod->localtax2_tx, $idproduct, $prod->remise_percent, '', 0, 0, 0, '', $prod->price_base_type, $prod->price_ttc, $prod->type, - 1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); + $invoice->fetch($placeid); +} + +if ($action=="freezone"){ + $invoice->addline($desc, $number, 1, $conf->global->MAIN_VAT_DEFAULT_IF_AUTODETECT_FAILS, 0, 0, 0, 0, '', 0, 0, 0, '', 'TTC', $number, 0, - 1, 0, '', 0, 0, null, 0, '', 0, 100, '', null, 0); + $invoice->fetch($placeid); +} + +if ($action=="deleteline"){ + if ($idline>0 and $placeid>0){ //If exist invoice and line, to avoid errors if deleted from other device or no line selected + $invoice->deleteline($idline); + $invoice->fetch($placeid); + } + else if ($placeid>0){ //If exist invoice, but no line selected, proced to delete last line + $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facturedet where fk_facture='$placeid' order by rowid DESC"; + $resql = $db->query($sql); + $row = $db->fetch_array ($resql); + $deletelineid=$row[0]; + $invoice->deleteline($deletelineid); + $invoice->fetch($deletelineid); + } +} + +if ($action=="updateqty"){ + foreach ($invoice->lines as $line){ + if ($line->id==$idline) $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $number, $line->remise_percent, + $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, + $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, + $line->fk_unit); + } + $invoice->fetch($placeid); +} + +if ($action=="updateprice"){ + foreach ($invoice->lines as $line){ + if ($line->id==$idline) $result = $invoice->updateline($line->id, $line->desc, $number, $line->qty, $line->remise_percent, + $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, + $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, + $line->fk_unit); + } + $invoice->fetch($placeid); +} + +if ($action=="updatereduction"){ + foreach ($invoice->lines as $line){ + if ($line->id==$idline) $result = $invoice->updateline($line->id, $line->desc, $line->subprice, $line->qty, $number, + $line->date_start, $line->date_end, $line->tva_tx, $line->localtax1_tx, $line->localtax2_tx, 'HT', $line->info_bits, $line->product_type, + $line->fk_parent_line, 0, $line->fk_fournprice, $line->pa_ht, $line->label, $line->special_code, $line->array_options, $line->situation_percent, + $line->fk_unit); + } + $invoice->fetch($placeid); +} + +if ($action=="order"){ + require_once DOL_DOCUMENT_ROOT . '/categories/class/categorie.class.php'; + $headerorder='
    '.$langs->trans('Place').' '.$place.'
    '; + $footerorder='
    '.$langs->trans("Label").''.$langs->trans("Qty").'
    '.dol_print_date(dol_now(), 'dayhour').'
    '; + $order_receipt_printer1=""; + $order_receipt_printer2=""; + $catsprinter1 = explode(';',$conf->global->TAKEPOS_PRINTED_CATEGORIES_1); + $catsprinter2 = explode(';',$conf->global->TAKEPOS_PRINTED_CATEGORIES_2); + foreach ($invoice->lines as $line){ + if ($line->special_code=="3") continue; + $c = new Categorie($db); + $existing = $c->containing($line->fk_product, Categorie::TYPE_PRODUCT, 'id'); + $result = array_intersect($catsprinter1, $existing); + $count=count($result); + if ($count>0){ + $sql="UPDATE ".MAIN_DB_PREFIX."facturedet set special_code='3' where rowid=$line->rowid"; + $db->query($sql); + $order_receipt_printer1.='
    '.$line->qty.'
    '.$line->qty.'
    '; +print ''; +print ''; +print ''; +print ''; +print "\n"; +if ($placeid>0) foreach ($invoice->lines as $line) +{ + print ''; + print ''; + print ''; + print ''; + print ''; +} +print '
    '.$langs->trans('Description').''.$langs->trans('Qty').''.$langs->trans('TotalHTShort').'
    '.$line->product_label.$line->desc.''.$line->qty.''.price($line->total_ttc).'
    '; +print '

    '.$langs->trans('TotalTTC'); +if($conf->global->TAKEPOS_BAR_RESTAURANT) print " ".$langs->trans('Place')." ".$place; +print ': '.price($invoice->total_ttc, 1, '', 1, - 1, - 1, $conf->currency).' 

    '; + +//if ($invoice->socid != $conf->global->CASHDESK_ID_THIRDPARTY){ + $soc = new Societe($db); + if ($invoice->socid > 0) $soc->fetch($invoice->socid); + else $soc->fetch($conf->global->CASHDESK_ID_THIRDPARTY); + print '

    '; + print $langs->trans("Customer").': '.$soc->name; + print '

    '; +//} +if ($action=="valid"){ + print '

    '.$invoice->facnumber." ".$langs->trans('BillShortStatusValidated').'

    '; + if ($conf->global->TAKEBOX) print '
    '; + else print '
    '; +} +if ($action=="search"){ + print '
    + '; +} +print ''; diff --git a/htdocs/takepos/js/jquery.colorbox-min.js b/htdocs/takepos/js/jquery.colorbox-min.js new file mode 100644 index 00000000000..b5109a262ef --- /dev/null +++ b/htdocs/takepos/js/jquery.colorbox-min.js @@ -0,0 +1,6 @@ +/*! + Colorbox 1.6.4 + license: MIT + http://www.jacklmoore.com/colorbox +*/ +(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(A+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in x[0]&&!x[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),x.focus())}function c(t){c.str!==t&&(x.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){A=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),A=W.index(_.el),-1===A&&(W=W.add(_.el),A=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!U){U=$=!0,c(_.get("className")),x.css({visibility:"hidden",display:"block",opacity:""}),I=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(I),j=T.height()+k.height()+b.outerHeight(!0)-b.height(),D=C.width()+H.width()+b.outerWidth(!0)-b.width(),N=I.outerHeight(!0),z=I.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=Math.max((l!==!1?Math.min(h,a(l,"x")):h)-z-D,0),_.h=Math.max((f!==!1?Math.min(s,a(f,"y")):s)-N-j,0),I.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(F).hide(),x.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}var p=parseFloat(_.get("opacity"));v.css({opacity:p===p?p:"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
    "),w()}}function p(){x||(V=!1,E=t(i),x=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),L=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),y=n(se,"Wrapper"),b=n(se,"Content").append(F=n(se,"Title"),R=n(se,"Current"),P=t(' + + + + + + + + + + + + + + + +
    + + + \ No newline at end of file diff --git a/htdocs/takepos/receipt.php b/htdocs/takepos/receipt.php new file mode 100644 index 00000000000..d5c4ceba0a1 --- /dev/null +++ b/htdocs/takepos/receipt.php @@ -0,0 +1,106 @@ + + * Copyright (C) 2011 Laurent Destailleur + * Copyright (C) 2012 Marcos García + * Copyright (C) 2018 Andreu Bisquerra + * + * 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 . + */ + +require '../main.inc.php'; // Load $user and permissions +include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + +$langs->loadLangs(array("main", "cashdesk")); + +/* + * View + */ + +top_httphead('text/html'); + +$facid=GETPOST('facid','int'); +$place=GETPOST('place','int'); +if ($place>0){ + $sql="SELECT rowid FROM ".MAIN_DB_PREFIX."facture where facnumber='(PROV-POS-".$place.")'"; + $resql = $db->query($sql); + $row = $db->fetch_array ($resql); + $facid=$row[0]; +} +$object=new Facture($db); +$object->fetch($facid); + +// IMPORTANT: This file is sended to 'Takepos Printing' application. Keep basic file. No external files as css, js... If you need images use absolut path. +?> + + +
    + +name; ?> + +
    +
    +

    + +

    +

    +trans('Date')." ".dol_print_date($object->date, 'day').'
    '; +if ($mysoc->country_code == 'ES') print "Factura simplificada "; +print $object->ref; +?> +

    +
    + + + + + + + + + + + lines as $line) + { + ?> + + + + + + + +
    trans("Label"); ?>trans("Qty"); ?>trans("TotalTTC"); ?>
    product_label;?>qty;?>total_ttc);?>
    +
    + + + + + + + + + + + +
    trans("TotalHT");?>total_ht, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>
    trans("TotalVAT").''.price($object->total_tva, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>
    trans("TotalTTC").''.price($object->total_ttc, 1, '', 1, - 1, - 1, $conf->currency)."\n";?>
    + + + + diff --git a/htdocs/takepos/takepos.php b/htdocs/takepos/takepos.php new file mode 100644 index 00000000000..8dec143bffe --- /dev/null +++ b/htdocs/takepos/takepos.php @@ -0,0 +1,403 @@ + + * + * 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 . + */ + +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); +if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1'); +if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1'); +if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1'); +if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1'); +if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); + +$_GET['theme']="md"; // Force theme. MD theme provides better look and feel to TakePOS + +require '../main.inc.php'; // Load $user and permissions +require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; +require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; +require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php'; + +$place = GETPOST('place','int'); +if ($place=="") $place="0"; +$action = GETPOST('action','alpha'); + +$langs->loadLangs(array("bills","orders","commercial","cashdesk")); + + +/* + * View + */ + +// Title +$title='TakePOS - Dolibarr '.DOL_VERSION; +if (! empty($conf->global->MAIN_APPLICATION_TITLE)) $title='TakePOS - '.$conf->global->MAIN_APPLICATION_TITLE; +top_htmlhead($head, $title, $disablejs, $disablehead, $arrayofjs, $arrayofcss); + +?> + + + + + + + + +
    +
    + +
    + + + + + + + + + + + + + + + + +
    + +$langs->trans("SearchProduct"), + 'action'=>'Search();'); +$menus[$r++]=array('title'=>$langs->trans("FreeZone"), + 'action'=>'FreeZone();'); +$menus[$r++]=array('title'=>$langs->trans("Customer"), + 'action'=>'Customer();'); +$menus[$r++]=array('title'=>$langs->trans("BackOffice"), + 'action'=>'window.open(\''.DOL_URL_ROOT.'\', \'backoffice\');'); +$menus[$r++]=array('title'=>$langs->trans("ValidateBill"), + 'action'=>'CloseBill();'); +$menus[$r++]=array('title'=>$langs->trans("Logout"), + 'action'=>'window.location.href=\''.DOL_URL_ROOT.'/user/logout.php\';'); +if($conf->global->TAKEPOS_BAR_RESTAURANT){ + $menus[$r++]=array('title'=>$langs->trans("Floors"), + 'action'=>'Floors();'); + if ($conf->global->TAKEPOS_ORDER_PRINTERS){ + $menus[$r++]=array('title'=>$langs->trans("Order"), + 'action'=>'TakeposPrintingOrder();'); + } +} +?> +
    +'.$menu['title'].''; +} +?> +
    + +
    + +
    id='catdiv'> + width="98%" id='catimg'/> +
    +
    +
    +
    + +
    + +
    + +
    onclick="MoreProducts('less');" onclick="MoreProducts('more');" > + width="95%" id='proimg'/> +
    +
    +
    +
    + +
    + + +close(); + + + diff --git a/htdocs/theme/common/octicons/build/data.json b/htdocs/theme/common/octicons/build/data.json index 41fa0740b8a..c70ceda6631 100644 --- a/htdocs/theme/common/octicons/build/data.json +++ b/htdocs/theme/common/octicons/build/data.json @@ -1 +1 @@ -{"alert":{"name":"alert","figma":{"id":"0:5","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["warning","triangle","exclamation","point"],"width":16,"height":16,"path":""},"arrow-down":{"name":"arrow-down","figma":{"id":"0:8","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-left":{"name":"arrow-left","figma":{"id":"0:10","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-right":{"name":"arrow-right","figma":{"id":"0:12","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-up":{"name":"arrow-up","figma":{"id":"0:14","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-small-down":{"name":"arrow-small-down","figma":{"id":"0:16","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-left":{"name":"arrow-small-left","figma":{"id":"0:18","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-right":{"name":"arrow-small-right","figma":{"id":"0:20","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-up":{"name":"arrow-small-up","figma":{"id":"0:22","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"beaker":{"name":"beaker","figma":{"id":"0:26","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["experiment","labs","experimental","feature","test","science","education","study","development","testing"],"width":16,"height":16,"path":""},"bell":{"name":"bell","figma":{"id":"0:34","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["notification"],"width":14,"height":16,"path":""},"bold":{"name":"bold","figma":{"id":"0:38","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["markdown","bold","text"],"width":10,"height":16,"path":""},"book":{"name":"book","figma":{"id":"0:43","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","wiki","readme"],"width":16,"height":16,"path":""},"bookmark":{"name":"bookmark","figma":{"id":"0:54","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["tab","star"],"width":10,"height":16,"path":""},"briefcase":{"name":"briefcase","figma":{"id":"0:58","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["suitcase","business"],"width":14,"height":16,"path":""},"broadcast":{"name":"broadcast","figma":{"id":"0:63","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["rss","radio","signal"],"width":16,"height":16,"path":""},"browser":{"name":"browser","figma":{"id":"0:70","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["window","web"],"width":14,"height":16,"path":""},"bug":{"name":"bug","figma":{"id":"0:78","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["insect","issue"],"width":16,"height":16,"path":""},"calendar":{"name":"calendar","figma":{"id":"0:82","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","day","month","year","date","appointment"],"width":14,"height":16,"path":""},"check":{"name":"check","figma":{"id":"0:104","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mark","yes","confirm","accept","ok","success"],"width":12,"height":16,"path":""},"checklist":{"name":"checklist","figma":{"id":"0:108","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["todo","tasks"],"width":16,"height":16,"path":""},"chevron-down":{"name":"chevron-down","figma":{"id":"0:117","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":10,"height":16,"path":""},"chevron-left":{"name":"chevron-left","figma":{"id":"0:119","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":8,"height":16,"path":""},"chevron-right":{"name":"chevron-right","figma":{"id":"0:121","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":8,"height":16,"path":""},"chevron-up":{"name":"chevron-up","figma":{"id":"0:123","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":10,"height":16,"path":""},"circle-slash":{"name":"circle-slash","figma":{"id":"0:127","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["no","deny","fail","failure","error","bad"],"width":14,"height":16,"path":""},"circuit-board":{"name":"circuit-board","figma":{"id":"0:132","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["developer","hardware","electricity"],"width":14,"height":16,"path":""},"clippy":{"name":"clippy","figma":{"id":"0:138","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["copy","paste","save","capture","clipboard"],"width":14,"height":16,"path":""},"clock":{"name":"clock","figma":{"id":"0:147","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","hour","minute","second","watch"],"width":14,"height":16,"path":""},"cloud-download":{"name":"cloud-download","figma":{"id":"0:152","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","install","get"],"width":16,"height":16,"path":""},"cloud-upload":{"name":"cloud-upload","figma":{"id":"0:156","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["put","export"],"width":16,"height":16,"path":""},"code":{"name":"code","figma":{"id":"0:160","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brackets"],"width":14,"height":16,"path":""},"comment-discussion":{"name":"comment-discussion","figma":{"id":"0:164","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["converse","talk"],"width":16,"height":16,"path":""},"comment":{"name":"comment","figma":{"id":"0:169","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["speak","bubble"],"width":16,"height":16,"path":""},"credit-card":{"name":"credit-card","figma":{"id":"0:173","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["money","billing","payments","transactions"],"width":16,"height":16,"path":""},"dash":{"name":"dash","figma":{"id":"0:178","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hyphen","range"],"width":8,"height":16,"path":""},"dashboard":{"name":"dashboard","figma":{"id":"0:182","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["speed","dial"],"width":16,"height":16,"path":""},"database":{"name":"database","figma":{"id":"0:190","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["disks","data"],"width":12,"height":16,"path":""},"desktop-download":{"name":"desktop-download","figma":{"id":"0:196","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["clone","download"],"width":16,"height":16,"path":""},"device-camera-video":{"name":"device-camera-video","figma":{"id":"0:198","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["watch","view","media","stream"],"width":16,"height":16,"path":""},"device-camera":{"name":"device-camera","figma":{"id":"0:202","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["photo","picture","image","snapshot"],"width":16,"height":16,"path":""},"device-desktop":{"name":"device-desktop","figma":{"id":"0:208","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["computer","monitor"],"width":16,"height":16,"path":""},"device-mobile":{"name":"device-mobile","figma":{"id":"0:212","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["phone","iphone","cellphone"],"width":10,"height":16,"path":""},"diff-added":{"name":"diff-added","figma":{"id":"0:217","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["new","addition","plus"],"width":14,"height":16,"path":""},"diff-ignored":{"name":"diff-ignored","figma":{"id":"0:222","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["slash"],"width":14,"height":16,"path":""},"diff-modified":{"name":"diff-modified","figma":{"id":"0:227","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["dot","changed","updated"],"width":14,"height":16,"path":""},"diff-removed":{"name":"diff-removed","figma":{"id":"0:232","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["deleted","subtracted","dash"],"width":14,"height":16,"path":""},"diff-renamed":{"name":"diff-renamed","figma":{"id":"0:237","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["moved","arrow"],"width":14,"height":16,"path":""},"diff":{"name":"diff","figma":{"id":"0:242","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["difference","changes","compare"],"width":13,"height":16,"path":""},"ellipsis":{"name":"ellipsis","figma":{"id":"0:249","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["dot","read","more","hidden","expand"],"width":12,"height":16,"path":""},"eye":{"name":"eye","figma":{"id":"0:255","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["look","watch","see"],"width":16,"height":16,"path":""},"file-binary":{"name":"file-binary","figma":{"id":"0:260","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["image","video","word","powerpoint","excel"],"width":12,"height":16,"path":""},"file-code":{"name":"file-code","figma":{"id":"0:270","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["text","javascript","html","css","php","ruby","coffeescript","sass","scss"],"width":12,"height":16,"path":""},"file-directory":{"name":"file-directory","figma":{"id":"0:276","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder"],"width":14,"height":16,"path":""},"file-media":{"name":"file-media","figma":{"id":"0:280","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["image","video","audio"],"width":12,"height":16,"path":""},"file-pdf":{"name":"file-pdf","figma":{"id":"0:285","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["adobe"],"width":12,"height":16,"path":""},"file-submodule":{"name":"file-submodule","figma":{"id":"0:292","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder"],"width":14,"height":16,"path":""},"file-symlink-directory":{"name":"file-symlink-directory","figma":{"id":"0:298","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder","subfolder","link","alias"],"width":14,"height":16,"path":""},"file-symlink-file":{"name":"file-symlink-file","figma":{"id":"0:303","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["link","alias"],"width":12,"height":16,"path":""},"file":{"name":"file","figma":{"id":"0:308","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["file","text","words"],"width":12,"height":16,"path":""},"file-zip":{"name":"file-zip","figma":{"id":"0:316","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["compress","archive"],"width":12,"height":16,"path":""},"flame":{"name":"flame","figma":{"id":"0:325","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fire","hot","burn","trending"],"width":12,"height":16,"path":""},"fold":{"name":"fold","figma":{"id":"0:329","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["unfold","hide","collapse"],"width":14,"height":16,"path":""},"gear":{"name":"gear","figma":{"id":"0:334","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["settings"],"width":14,"height":16,"path":""},"gift":{"name":"gift","figma":{"id":"0:338","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["package","present","skill","craft","freebie"],"width":14,"height":16,"path":""},"gist-secret":{"name":"gist-secret","figma":{"id":"0:347","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["gist","secret","private"],"width":14,"height":16,"path":""},"gist":{"name":"gist","figma":{"id":"0:354","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["gist","github"],"width":12,"height":16,"path":""},"git-branch":{"name":"git-branch","figma":{"id":"0:360","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fork","branch","git","duplicate"],"width":10,"height":16,"path":""},"git-commit":{"name":"git-commit","figma":{"id":"0:366","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save"],"width":14,"height":16,"path":""},"git-compare":{"name":"git-compare","figma":{"id":"0:370","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["difference","changes"],"width":14,"height":16,"path":""},"git-merge":{"name":"git-merge","figma":{"id":"0:376","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["join"],"width":12,"height":16,"path":""},"git-pull-request":{"name":"git-pull-request","figma":{"id":"0:382","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["review"],"width":12,"height":16,"path":""},"globe":{"name":"globe","figma":{"id":"0:389","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["world","earth","planet"],"width":14,"height":16,"path":""},"graph":{"name":"graph","figma":{"id":"0:396","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["trend","stats","statistics"],"width":16,"height":16,"path":""},"heart":{"name":"heart","figma":{"id":"0:400","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["love","beat"],"width":12,"height":16,"path":""},"history":{"name":"history","figma":{"id":"0:404","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","past","revert","back"],"width":14,"height":16,"path":""},"home":{"name":"home","figma":{"id":"0:408","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["welcome","index","house","building"],"width":16,"height":16,"path":""},"horizontal-rule":{"name":"horizontal-rule","figma":{"id":"0:412","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hr"],"width":10,"height":16,"path":""},"hubot":{"name":"hubot","figma":{"id":"0:419","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["robot","bot"],"width":14,"height":16,"path":""},"inbox":{"name":"inbox","figma":{"id":"0:426","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mail","todo","new","messages"],"width":14,"height":16,"path":""},"info":{"name":"info","figma":{"id":"0:430","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["help"],"width":14,"height":16,"path":""},"issue-closed":{"name":"issue-closed","figma":{"id":"0:436","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["done","complete"],"width":16,"height":16,"path":""},"issue-opened":{"name":"issue-opened","figma":{"id":"0:442","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["new"],"width":14,"height":16,"path":""},"issue-reopened":{"name":"issue-reopened","figma":{"id":"0:448","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["regression"],"width":14,"height":16,"path":""},"italic":{"name":"italic","figma":{"id":"0:454","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["font","italic","style"],"width":6,"height":16,"path":""},"jersey":{"name":"jersey","figma":{"id":"0:458","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["team","game","basketball"],"width":14,"height":16,"path":""},"keyboard":{"name":"keyboard","figma":{"id":"0:466","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["type","keys","write","shortcuts"],"width":16,"height":16,"path":""},"law":{"name":"law","figma":{"id":"0:490","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["legal","bill"],"width":14,"height":16,"path":""},"link":{"name":"link","figma":{"id":"0:496","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["connect","hyperlink"],"width":16,"height":16,"path":""},"list-ordered":{"name":"list-ordered","figma":{"id":"0:500","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["numbers","tasks","todo","items"],"width":12,"height":16,"path":""},"list-unordered":{"name":"list-unordered","figma":{"id":"0:508","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["bullet","point","tasks","todo","items"],"width":12,"height":16,"path":""},"location":{"name":"location","figma":{"id":"0:516","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["here","marker"],"width":12,"height":16,"path":""},"lock":{"name":"lock","figma":{"id":"0:521","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["secure","safe","protected"],"width":12,"height":16,"path":""},"logo-gist":{"name":"logo-gist","figma":{"id":"0:529","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brand","github","logo"],"width":25,"height":16,"path":""},"logo-github":{"name":"logo-github","figma":{"id":"0:536","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brand","github","logo"],"width":45,"height":16,"path":""},"mail-read":{"name":"mail-read","figma":{"id":"0:547","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["email","open"],"width":14,"height":16,"path":""},"reply":{"name":"reply","figma":{"id":"0:554","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["reply all","back"],"width":14,"height":16,"path":""},"mail":{"name":"mail","figma":{"id":"0:558","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["email","unread"],"width":14,"height":16,"path":""},"mark-github":{"name":"mark-github","figma":{"id":"0:563","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["octocat","brand","github","logo"],"width":16,"height":16,"path":""},"markdown":{"name":"markdown","figma":{"id":"0:567","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["markup","style"],"width":16,"height":16,"path":""},"megaphone":{"name":"megaphone","figma":{"id":"0:572","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["bullhorn","loud","shout","broadcast"],"width":16,"height":16,"path":""},"mention":{"name":"mention","figma":{"id":"0:579","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["at","ping"],"width":14,"height":16,"path":""},"milestone":{"name":"milestone","figma":{"id":"0:583","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["marker"],"width":14,"height":16,"path":""},"mirror":{"name":"mirror","figma":{"id":"0:589","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["reflect"],"width":16,"height":16,"path":""},"mortar-board":{"name":"mortar-board","figma":{"id":"0:594","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["education","learn","teach"],"width":16,"height":16,"path":""},"mute":{"name":"mute","figma":{"id":"0:599","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["quiet","sound","audio","turn","off"],"width":16,"height":16,"path":""},"no-newline":{"name":"no-newline","figma":{"id":"0:603","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["return"],"width":16,"height":16,"path":""},"octoface":{"name":"octoface","figma":{"id":"0:609","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["octocat","brand"],"width":16,"height":16,"path":""},"organization":{"name":"organization","figma":{"id":"0:613","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["people","group","team"],"width":16,"height":16,"path":""},"package":{"name":"package","figma":{"id":"0:617","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["box","ship"],"width":16,"height":16,"path":""},"paintcan":{"name":"paintcan","figma":{"id":"0:624","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["style","theme","art","color"],"width":12,"height":16,"path":""},"pencil":{"name":"pencil","figma":{"id":"0:630","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["edit","change","update","write"],"width":14,"height":16,"path":""},"person":{"name":"person","figma":{"id":"0:633","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["people","man","woman","human"],"width":12,"height":16,"path":""},"pin":{"name":"pin","figma":{"id":"0:635","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","star","bookmark"],"width":16,"height":16,"path":""},"plug":{"name":"plug","figma":{"id":"0:637","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hook","webhook"],"width":14,"height":16,"path":""},"plus":{"name":"plus","figma":{"id":"0:639","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["add","new","more"],"width":12,"height":16,"path":""},"primitive-dot":{"name":"primitive-dot","figma":{"id":"0:641","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["circle"],"width":8,"height":16,"path":""},"primitive-square":{"name":"primitive-square","figma":{"id":"0:643","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["box"],"width":8,"height":16,"path":""},"pulse":{"name":"pulse","figma":{"id":"0:645","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["graph","trend","line","activity"],"width":14,"height":16,"path":""},"question":{"name":"question","figma":{"id":"0:649","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["help","explain"],"width":14,"height":16,"path":""},"quote":{"name":"quote","figma":{"id":"0:655","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["quotation"],"width":14,"height":16,"path":""},"radio-tower":{"name":"radio-tower","figma":{"id":"0:659","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["broadcast"],"width":16,"height":16,"path":""},"repo-clone":{"name":"repo-clone","figma":{"id":"0:669","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository"],"width":16,"height":16,"path":""},"repo-force-push":{"name":"repo-force-push","figma":{"id":"0:681","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","put"],"width":12,"height":16,"path":""},"repo-forked":{"name":"repo-forked","figma":{"id":"0:685","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","copy"],"width":10,"height":16,"path":""},"repo-pull":{"name":"repo-pull","figma":{"id":"0:691","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","get"],"width":16,"height":16,"path":""},"repo-push":{"name":"repo-push","figma":{"id":"0:700","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository","put"],"width":12,"height":16,"path":""},"repo":{"name":"repo","figma":{"id":"0:706","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository"],"width":12,"height":16,"path":""},"rocket":{"name":"rocket","figma":{"id":"0:715","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["staff","stafftools","blast","off","space","launch","ship"],"width":16,"height":16,"path":""},"rss":{"name":"rss","figma":{"id":"0:719","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["broadcast","feed","atom"],"width":10,"height":16,"path":""},"ruby":{"name":"ruby","figma":{"id":"0:724","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["code","language"],"width":16,"height":16,"path":""},"search":{"name":"search","figma":{"id":"0:729","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["magnifying","glass"],"width":16,"height":16,"path":""},"server":{"name":"server","figma":{"id":"0:733","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["computers","racks","ops"],"width":12,"height":16,"path":""},"settings":{"name":"settings","figma":{"id":"0:751","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["sliders","filters","controls","levels"],"width":16,"height":16,"path":""},"shield":{"name":"shield","figma":{"id":"0:762","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["protect","shield","lock"],"width":14,"height":16,"path":""},"sign-in":{"name":"sign-in","figma":{"id":"0:764","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["door","arrow","direction","enter","log in"],"width":14,"height":16,"path":""},"sign-out":{"name":"sign-out","figma":{"id":"0:768","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["door","arrow","direction","leave","log out"],"width":16,"height":16,"path":""},"smiley":{"name":"smiley","figma":{"id":"0:772","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["emoji","smile","mood","emotion"],"width":16,"height":16,"path":""},"squirrel":{"name":"squirrel","figma":{"id":"0:779","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["ship","shipit","launch"],"width":16,"height":16,"path":""},"star":{"name":"star","figma":{"id":"0:781","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","remember","like"],"width":14,"height":16,"path":""},"stop":{"name":"stop","figma":{"id":"0:785","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["block","spam","report"],"width":14,"height":16,"path":""},"sync":{"name":"sync","figma":{"id":"0:791","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["cycle","refresh","loop"],"width":12,"height":16,"path":""},"tag":{"name":"tag","figma":{"id":"0:795","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["release"],"width":14,"height":16,"path":""},"tasklist":{"name":"tasklist","figma":{"id":"0:800","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["todo"],"width":16,"height":16,"path":""},"telescope":{"name":"telescope","figma":{"id":"0:806","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["science","space","look","view","explore"],"width":14,"height":16,"path":""},"terminal":{"name":"terminal","figma":{"id":"0:815","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["code","ops","shell"],"width":14,"height":16,"path":""},"text-size":{"name":"text-size","figma":{"id":"0:821","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["font","size","text"],"width":18,"height":16,"path":""},"three-bars":{"name":"three-bars","figma":{"id":"0:826","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hamburger","menu","dropdown"],"width":12,"height":16,"path":""},"thumbsdown":{"name":"thumbsdown","figma":{"id":"0:831","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["thumb","thumbsdown","rejected","dislike"],"width":16,"height":16,"path":""},"thumbsup":{"name":"thumbsup","figma":{"id":"0:835","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["thumb","thumbsup","prop","ship","like"],"width":16,"height":16,"path":""},"tools":{"name":"tools","figma":{"id":"0:839","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["screwdriver","wrench","settings"],"width":16,"height":16,"path":""},"trashcan":{"name":"trashcan","figma":{"id":"0:844","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["garbage","rubbish","recycle","delete"],"width":12,"height":16,"path":""},"triangle-down":{"name":"triangle-down","figma":{"id":"0:847","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":12,"height":16,"path":""},"triangle-left":{"name":"triangle-left","figma":{"id":"0:849","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":6,"height":16,"path":""},"triangle-right":{"name":"triangle-right","figma":{"id":"0:851","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":6,"height":16,"path":""},"triangle-up":{"name":"triangle-up","figma":{"id":"0:853","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":12,"height":16,"path":""},"unfold":{"name":"unfold","figma":{"id":"0:857","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["expand","open","reveal"],"width":14,"height":16,"path":""},"unmute":{"name":"unmute","figma":{"id":"0:862","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["loud","volume","audio","sound","play"],"width":16,"height":16,"path":""},"project":{"name":"project","figma":{"id":"0:868","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["board","kanban","columns","scrum"],"width":15,"height":16,"path":""},"kebab-horizontal":{"name":"kebab-horizontal","figma":{"id":"0:875","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["kebab","dot","menu","more"],"width":13,"height":16,"path":""},"kebab-vertical":{"name":"kebab-vertical","figma":{"id":"0:880","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["kebab","dot","menu","more"],"width":3,"height":16,"path":""},"report":{"name":"report","figma":{"id":"0:885","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["report","abuse","flag"],"width":16,"height":16,"path":""},"note":{"name":"note","figma":{"id":"0:891","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["card","paper","ticket"],"width":14,"height":16,"path":""},"screen-full":{"name":"screen-full","figma":{"id":"0:898","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fullscreen","expand"],"width":14,"height":16,"path":""},"screen-normal":{"name":"screen-normal","figma":{"id":"0:906","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fullscreen","expand","exit"],"width":14,"height":16,"path":""},"unverified":{"name":"unverified","figma":{"id":"0:914","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["insecure","untrusted","signed"],"width":16,"height":16,"path":""},"verified":{"name":"verified","figma":{"id":"0:919","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["trusted","secure","trustworthy","signed"],"width":16,"height":16,"path":""},"versions":{"name":"versions","figma":{"id":"0:923","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["history","commits"],"width":14,"height":16,"path":""},"watch":{"name":"watch","figma":{"id":"0:929","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["wait","hourglass","time","date"],"width":12,"height":16,"path":""},"x":{"name":"x","figma":{"id":"0:932","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["remove","close","delete"],"width":12,"height":16,"path":""},"zap":{"name":"zap","figma":{"id":"0:934","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["electricity","lightning","props","like","star","save"],"width":10,"height":16,"path":""},"key":{"name":"key","figma":{"id":"0:938","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["key","lock","secure","safe"],"width":14,"height":16,"path":""},"grabber":{"name":"grabber","figma":{"id":"0:942","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mover","drap","drop","sort"],"width":8,"height":16,"path":""},"plus-small":{"name":"plus-small","figma":{"id":"0:947","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["add","new","more","small"],"width":7,"height":16,"path":""},"light-bulb":{"name":"light-bulb","figma":{"id":"0:951","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["idea"],"width":12,"height":16,"path":""},"link-external":{"name":"link-external","figma":{"id":"0:956","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["out","see","more","go","to"],"width":12,"height":16,"path":""}} \ No newline at end of file +{"alert":{"name":"alert","figma":{"id":"0:5","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["warning","triangle","exclamation","point"],"width":16,"height":16,"path":""},"arrow-down":{"name":"arrow-down","figma":{"id":"0:8","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-left":{"name":"arrow-left","figma":{"id":"0:10","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-right":{"name":"arrow-right","figma":{"id":"0:12","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-up":{"name":"arrow-up","figma":{"id":"0:14","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction"],"width":10,"height":16,"path":""},"arrow-both":{"name":"arrow-both","figma":{"id":"7345:13","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","left","right"],"width":20,"height":16,"path":""},"arrow-small-down":{"name":"arrow-small-down","figma":{"id":"0:16","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-left":{"name":"arrow-small-left","figma":{"id":"0:18","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-right":{"name":"arrow-small-right","figma":{"id":"0:20","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"arrow-small-up":{"name":"arrow-small-up","figma":{"id":"0:22","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["point","direction","little","tiny"],"width":6,"height":16,"path":""},"beaker":{"name":"beaker","figma":{"id":"0:26","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["experiment","labs","experimental","feature","test","science","education","study","development","testing"],"width":16,"height":16,"path":""},"bell":{"name":"bell","figma":{"id":"0:34","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["notification"],"width":14,"height":16,"path":""},"bold":{"name":"bold","figma":{"id":"0:38","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["markdown","bold","text"],"width":10,"height":16,"path":""},"book":{"name":"book","figma":{"id":"0:43","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","wiki","readme"],"width":16,"height":16,"path":""},"bookmark":{"name":"bookmark","figma":{"id":"0:54","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["tab","star"],"width":10,"height":16,"path":""},"briefcase":{"name":"briefcase","figma":{"id":"0:58","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["suitcase","business"],"width":14,"height":16,"path":""},"broadcast":{"name":"broadcast","figma":{"id":"0:63","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["rss","radio","signal"],"width":16,"height":16,"path":""},"browser":{"name":"browser","figma":{"id":"0:70","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["window","web"],"width":14,"height":16,"path":""},"bug":{"name":"bug","figma":{"id":"0:78","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["insect","issue"],"width":16,"height":16,"path":""},"calendar":{"name":"calendar","figma":{"id":"0:82","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","day","month","year","date","appointment"],"width":14,"height":16,"path":""},"check":{"name":"check","figma":{"id":"0:104","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mark","yes","confirm","accept","ok","success"],"width":12,"height":16,"path":""},"checklist":{"name":"checklist","figma":{"id":"0:108","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["todo","tasks"],"width":16,"height":16,"path":""},"chevron-down":{"name":"chevron-down","figma":{"id":"0:117","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":10,"height":16,"path":""},"chevron-left":{"name":"chevron-left","figma":{"id":"0:119","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":8,"height":16,"path":""},"chevron-right":{"name":"chevron-right","figma":{"id":"0:121","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":8,"height":16,"path":""},"chevron-up":{"name":"chevron-up","figma":{"id":"0:123","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["triangle","arrow"],"width":10,"height":16,"path":""},"circle-slash":{"name":"circle-slash","figma":{"id":"0:127","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["no","deny","fail","failure","error","bad"],"width":14,"height":16,"path":""},"circuit-board":{"name":"circuit-board","figma":{"id":"0:132","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["developer","hardware","electricity"],"width":14,"height":16,"path":""},"clippy":{"name":"clippy","figma":{"id":"0:138","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["copy","paste","save","capture","clipboard"],"width":14,"height":16,"path":""},"clock":{"name":"clock","figma":{"id":"0:147","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","hour","minute","second","watch"],"width":14,"height":16,"path":""},"cloud-download":{"name":"cloud-download","figma":{"id":"0:152","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","install","get"],"width":16,"height":16,"path":""},"cloud-upload":{"name":"cloud-upload","figma":{"id":"0:156","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["put","export"],"width":16,"height":16,"path":""},"code":{"name":"code","figma":{"id":"0:160","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brackets"],"width":14,"height":16,"path":""},"comment-discussion":{"name":"comment-discussion","figma":{"id":"0:164","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["converse","talk"],"width":16,"height":16,"path":""},"comment":{"name":"comment","figma":{"id":"0:169","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["speak","bubble"],"width":16,"height":16,"path":""},"credit-card":{"name":"credit-card","figma":{"id":"0:173","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["money","billing","payments","transactions"],"width":16,"height":16,"path":""},"dash":{"name":"dash","figma":{"id":"0:178","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hyphen","range"],"width":8,"height":16,"path":""},"dashboard":{"name":"dashboard","figma":{"id":"0:182","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["speed","dial"],"width":16,"height":16,"path":""},"database":{"name":"database","figma":{"id":"0:190","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["disks","data"],"width":12,"height":16,"path":""},"desktop-download":{"name":"desktop-download","figma":{"id":"0:196","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["clone","download"],"width":16,"height":16,"path":""},"device-camera-video":{"name":"device-camera-video","figma":{"id":"0:198","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["watch","view","media","stream"],"width":16,"height":16,"path":""},"device-camera":{"name":"device-camera","figma":{"id":"0:202","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["photo","picture","image","snapshot"],"width":16,"height":16,"path":""},"device-desktop":{"name":"device-desktop","figma":{"id":"0:208","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["computer","monitor"],"width":16,"height":16,"path":""},"device-mobile":{"name":"device-mobile","figma":{"id":"0:212","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["phone","iphone","cellphone"],"width":10,"height":16,"path":""},"diff-added":{"name":"diff-added","figma":{"id":"0:217","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["new","addition","plus"],"width":14,"height":16,"path":""},"diff-ignored":{"name":"diff-ignored","figma":{"id":"0:222","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["slash"],"width":14,"height":16,"path":""},"diff-modified":{"name":"diff-modified","figma":{"id":"0:227","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["dot","changed","updated"],"width":14,"height":16,"path":""},"diff-removed":{"name":"diff-removed","figma":{"id":"0:232","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["deleted","subtracted","dash"],"width":14,"height":16,"path":""},"diff-renamed":{"name":"diff-renamed","figma":{"id":"0:237","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["moved","arrow"],"width":14,"height":16,"path":""},"diff":{"name":"diff","figma":{"id":"0:242","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["difference","changes","compare"],"width":13,"height":16,"path":""},"ellipsis":{"name":"ellipsis","figma":{"id":"0:249","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["dot","read","more","hidden","expand"],"width":12,"height":16,"path":""},"eye":{"name":"eye","figma":{"id":"0:255","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["look","watch","see"],"width":16,"height":16,"path":""},"file-binary":{"name":"file-binary","figma":{"id":"0:260","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["image","video","word","powerpoint","excel"],"width":12,"height":16,"path":""},"file-code":{"name":"file-code","figma":{"id":"0:270","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["text","javascript","html","css","php","ruby","coffeescript","sass","scss"],"width":12,"height":16,"path":""},"file-directory":{"name":"file-directory","figma":{"id":"0:276","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder"],"width":14,"height":16,"path":""},"file-media":{"name":"file-media","figma":{"id":"0:280","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["image","video","audio"],"width":12,"height":16,"path":""},"file-pdf":{"name":"file-pdf","figma":{"id":"0:285","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["adobe"],"width":12,"height":16,"path":""},"file-submodule":{"name":"file-submodule","figma":{"id":"0:292","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder"],"width":14,"height":16,"path":""},"file-symlink-directory":{"name":"file-symlink-directory","figma":{"id":"0:298","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["folder","subfolder","link","alias"],"width":14,"height":16,"path":""},"file-symlink-file":{"name":"file-symlink-file","figma":{"id":"0:303","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["link","alias"],"width":12,"height":16,"path":""},"file":{"name":"file","figma":{"id":"0:308","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["file","text","words"],"width":12,"height":16,"path":""},"file-zip":{"name":"file-zip","figma":{"id":"0:316","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["compress","archive"],"width":12,"height":16,"path":""},"flame":{"name":"flame","figma":{"id":"0:325","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fire","hot","burn","trending"],"width":12,"height":16,"path":""},"fold":{"name":"fold","figma":{"id":"0:329","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["unfold","hide","collapse"],"width":14,"height":16,"path":""},"gear":{"name":"gear","figma":{"id":"0:334","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["settings"],"width":14,"height":16,"path":""},"gift":{"name":"gift","figma":{"id":"0:338","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["package","present","skill","craft","freebie"],"width":14,"height":16,"path":""},"gist-secret":{"name":"gist-secret","figma":{"id":"0:347","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["gist","secret","private"],"width":14,"height":16,"path":""},"gist":{"name":"gist","figma":{"id":"0:354","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["gist","github"],"width":12,"height":16,"path":""},"git-branch":{"name":"git-branch","figma":{"id":"0:360","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fork","branch","git","duplicate"],"width":10,"height":16,"path":""},"git-commit":{"name":"git-commit","figma":{"id":"0:366","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save"],"width":14,"height":16,"path":""},"git-compare":{"name":"git-compare","figma":{"id":"0:370","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["difference","changes"],"width":14,"height":16,"path":""},"git-merge":{"name":"git-merge","figma":{"id":"0:376","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["join"],"width":12,"height":16,"path":""},"git-pull-request":{"name":"git-pull-request","figma":{"id":"0:382","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["review"],"width":12,"height":16,"path":""},"globe":{"name":"globe","figma":{"id":"0:389","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["world","earth","planet"],"width":14,"height":16,"path":""},"graph":{"name":"graph","figma":{"id":"0:396","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["trend","stats","statistics"],"width":16,"height":16,"path":""},"heart":{"name":"heart","figma":{"id":"0:400","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["love","beat"],"width":12,"height":16,"path":""},"history":{"name":"history","figma":{"id":"0:404","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["time","past","revert","back"],"width":14,"height":16,"path":""},"home":{"name":"home","figma":{"id":"0:408","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["welcome","index","house","building"],"width":16,"height":16,"path":""},"horizontal-rule":{"name":"horizontal-rule","figma":{"id":"0:412","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hr"],"width":10,"height":16,"path":""},"hubot":{"name":"hubot","figma":{"id":"0:419","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["robot","bot"],"width":14,"height":16,"path":""},"inbox":{"name":"inbox","figma":{"id":"0:426","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mail","todo","new","messages"],"width":14,"height":16,"path":""},"info":{"name":"info","figma":{"id":"0:430","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["help"],"width":14,"height":16,"path":""},"issue-closed":{"name":"issue-closed","figma":{"id":"0:436","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["done","complete"],"width":16,"height":16,"path":""},"issue-opened":{"name":"issue-opened","figma":{"id":"0:442","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["new"],"width":14,"height":16,"path":""},"issue-reopened":{"name":"issue-reopened","figma":{"id":"0:448","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["regression"],"width":14,"height":16,"path":""},"italic":{"name":"italic","figma":{"id":"0:454","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["font","italic","style"],"width":6,"height":16,"path":""},"jersey":{"name":"jersey","figma":{"id":"0:458","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["team","game","basketball"],"width":14,"height":16,"path":""},"keyboard":{"name":"keyboard","figma":{"id":"0:466","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["type","keys","write","shortcuts"],"width":16,"height":16,"path":""},"law":{"name":"law","figma":{"id":"0:490","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["legal","bill"],"width":14,"height":16,"path":""},"link":{"name":"link","figma":{"id":"0:496","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["connect","hyperlink"],"width":16,"height":16,"path":""},"list-ordered":{"name":"list-ordered","figma":{"id":"0:500","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["numbers","tasks","todo","items"],"width":12,"height":16,"path":""},"list-unordered":{"name":"list-unordered","figma":{"id":"0:508","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["bullet","point","tasks","todo","items"],"width":12,"height":16,"path":""},"location":{"name":"location","figma":{"id":"0:516","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["here","marker"],"width":12,"height":16,"path":""},"lock":{"name":"lock","figma":{"id":"0:521","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["secure","safe","protected"],"width":12,"height":16,"path":""},"logo-gist":{"name":"logo-gist","figma":{"id":"0:529","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brand","github","logo"],"width":25,"height":16,"path":""},"logo-github":{"name":"logo-github","figma":{"id":"0:536","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["brand","github","logo"],"width":45,"height":16,"path":""},"mail-read":{"name":"mail-read","figma":{"id":"0:547","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["email","open"],"width":14,"height":16,"path":""},"reply":{"name":"reply","figma":{"id":"0:554","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["reply all","back"],"width":14,"height":16,"path":""},"mail":{"name":"mail","figma":{"id":"0:558","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["email","unread"],"width":14,"height":16,"path":""},"mark-github":{"name":"mark-github","figma":{"id":"0:563","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["octocat","brand","github","logo"],"width":16,"height":16,"path":""},"markdown":{"name":"markdown","figma":{"id":"0:567","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["markup","style"],"width":16,"height":16,"path":""},"megaphone":{"name":"megaphone","figma":{"id":"0:572","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["bullhorn","loud","shout","broadcast"],"width":16,"height":16,"path":""},"mention":{"name":"mention","figma":{"id":"0:579","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["at","ping"],"width":14,"height":16,"path":""},"milestone":{"name":"milestone","figma":{"id":"0:583","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["marker"],"width":14,"height":16,"path":""},"mirror":{"name":"mirror","figma":{"id":"0:589","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["reflect"],"width":16,"height":16,"path":""},"mortar-board":{"name":"mortar-board","figma":{"id":"0:594","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["education","learn","teach"],"width":16,"height":16,"path":""},"mute":{"name":"mute","figma":{"id":"0:599","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["quiet","sound","audio","turn","off"],"width":16,"height":16,"path":""},"no-newline":{"name":"no-newline","figma":{"id":"0:603","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["return"],"width":16,"height":16,"path":""},"octoface":{"name":"octoface","figma":{"id":"0:609","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["octocat","brand"],"width":16,"height":16,"path":""},"organization":{"name":"organization","figma":{"id":"0:613","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["people","group","team"],"width":16,"height":16,"path":""},"package":{"name":"package","figma":{"id":"0:617","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["box","ship"],"width":16,"height":16,"path":""},"paintcan":{"name":"paintcan","figma":{"id":"0:624","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["style","theme","art","color"],"width":12,"height":16,"path":""},"pencil":{"name":"pencil","figma":{"id":"0:630","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["edit","change","update","write"],"width":14,"height":16,"path":""},"person":{"name":"person","figma":{"id":"0:633","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["people","man","woman","human"],"width":12,"height":16,"path":""},"pin":{"name":"pin","figma":{"id":"0:635","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","star","bookmark"],"width":16,"height":16,"path":""},"plug":{"name":"plug","figma":{"id":"0:637","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hook","webhook"],"width":14,"height":16,"path":""},"plus":{"name":"plus","figma":{"id":"0:639","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["add","new","more"],"width":12,"height":16,"path":""},"primitive-dot":{"name":"primitive-dot","figma":{"id":"0:641","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["circle"],"width":8,"height":16,"path":""},"primitive-square":{"name":"primitive-square","figma":{"id":"0:643","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["box"],"width":8,"height":16,"path":""},"pulse":{"name":"pulse","figma":{"id":"0:645","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["graph","trend","line","activity"],"width":14,"height":16,"path":""},"question":{"name":"question","figma":{"id":"0:649","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["help","explain"],"width":14,"height":16,"path":""},"quote":{"name":"quote","figma":{"id":"0:655","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["quotation"],"width":14,"height":16,"path":""},"radio-tower":{"name":"radio-tower","figma":{"id":"0:659","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["broadcast"],"width":16,"height":16,"path":""},"repo-clone":{"name":"repo-clone","figma":{"id":"0:669","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository"],"width":16,"height":16,"path":""},"repo-force-push":{"name":"repo-force-push","figma":{"id":"0:681","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","put"],"width":12,"height":16,"path":""},"repo-forked":{"name":"repo-forked","figma":{"id":"0:685","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","copy"],"width":10,"height":16,"path":""},"repo-pull":{"name":"repo-pull","figma":{"id":"0:691","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","get"],"width":16,"height":16,"path":""},"repo-push":{"name":"repo-push","figma":{"id":"0:700","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository","put"],"width":12,"height":16,"path":""},"repo":{"name":"repo","figma":{"id":"0:706","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["book","journal","repository"],"width":12,"height":16,"path":""},"rocket":{"name":"rocket","figma":{"id":"0:715","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["staff","stafftools","blast","off","space","launch","ship"],"width":16,"height":16,"path":""},"rss":{"name":"rss","figma":{"id":"0:719","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["broadcast","feed","atom"],"width":10,"height":16,"path":""},"ruby":{"name":"ruby","figma":{"id":"0:724","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["code","language"],"width":16,"height":16,"path":""},"search":{"name":"search","figma":{"id":"0:729","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["magnifying","glass"],"width":16,"height":16,"path":""},"server":{"name":"server","figma":{"id":"0:733","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["computers","racks","ops"],"width":12,"height":16,"path":""},"settings":{"name":"settings","figma":{"id":"0:751","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["sliders","filters","controls","levels"],"width":16,"height":16,"path":""},"shield":{"name":"shield","figma":{"id":"0:762","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["protect","shield","lock"],"width":14,"height":16,"path":""},"sign-in":{"name":"sign-in","figma":{"id":"0:764","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["door","arrow","direction","enter","log in"],"width":14,"height":16,"path":""},"sign-out":{"name":"sign-out","figma":{"id":"0:768","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["door","arrow","direction","leave","log out"],"width":16,"height":16,"path":""},"smiley":{"name":"smiley","figma":{"id":"0:772","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["emoji","smile","mood","emotion"],"width":16,"height":16,"path":""},"squirrel":{"name":"squirrel","figma":{"id":"0:779","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["ship","shipit","launch"],"width":16,"height":16,"path":""},"star":{"name":"star","figma":{"id":"0:781","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["save","remember","like"],"width":14,"height":16,"path":""},"stop":{"name":"stop","figma":{"id":"0:785","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["block","spam","report"],"width":14,"height":16,"path":""},"sync":{"name":"sync","figma":{"id":"0:791","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["cycle","refresh","loop"],"width":12,"height":16,"path":""},"tag":{"name":"tag","figma":{"id":"0:795","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["release"],"width":14,"height":16,"path":""},"tasklist":{"name":"tasklist","figma":{"id":"0:800","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["todo"],"width":16,"height":16,"path":""},"telescope":{"name":"telescope","figma":{"id":"0:806","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["science","space","look","view","explore"],"width":14,"height":16,"path":""},"terminal":{"name":"terminal","figma":{"id":"0:815","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["code","ops","shell"],"width":14,"height":16,"path":""},"text-size":{"name":"text-size","figma":{"id":"0:821","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["font","size","text"],"width":18,"height":16,"path":""},"three-bars":{"name":"three-bars","figma":{"id":"0:826","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["hamburger","menu","dropdown"],"width":12,"height":16,"path":""},"thumbsdown":{"name":"thumbsdown","figma":{"id":"0:831","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["thumb","thumbsdown","rejected","dislike"],"width":16,"height":16,"path":""},"thumbsup":{"name":"thumbsup","figma":{"id":"0:835","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["thumb","thumbsup","prop","ship","like"],"width":16,"height":16,"path":""},"tools":{"name":"tools","figma":{"id":"0:839","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["screwdriver","wrench","settings"],"width":16,"height":16,"path":""},"trashcan":{"name":"trashcan","figma":{"id":"0:844","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["garbage","rubbish","recycle","delete"],"width":12,"height":16,"path":""},"triangle-down":{"name":"triangle-down","figma":{"id":"0:847","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":12,"height":16,"path":""},"triangle-left":{"name":"triangle-left","figma":{"id":"0:849","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":6,"height":16,"path":""},"triangle-right":{"name":"triangle-right","figma":{"id":"0:851","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":6,"height":16,"path":""},"triangle-up":{"name":"triangle-up","figma":{"id":"0:853","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["arrow","point","direction"],"width":12,"height":16,"path":""},"unfold":{"name":"unfold","figma":{"id":"0:857","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["expand","open","reveal"],"width":14,"height":16,"path":""},"unmute":{"name":"unmute","figma":{"id":"0:862","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["loud","volume","audio","sound","play"],"width":16,"height":16,"path":""},"project":{"name":"project","figma":{"id":"0:868","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["board","kanban","columns","scrum"],"width":15,"height":16,"path":""},"kebab-horizontal":{"name":"kebab-horizontal","figma":{"id":"0:875","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["kebab","dot","menu","more"],"width":13,"height":16,"path":""},"kebab-vertical":{"name":"kebab-vertical","figma":{"id":"0:880","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["kebab","dot","menu","more"],"width":3,"height":16,"path":""},"report":{"name":"report","figma":{"id":"0:885","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["report","abuse","flag"],"width":16,"height":16,"path":""},"note":{"name":"note","figma":{"id":"0:891","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["card","paper","ticket"],"width":14,"height":16,"path":""},"screen-full":{"name":"screen-full","figma":{"id":"0:898","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fullscreen","expand"],"width":14,"height":16,"path":""},"screen-normal":{"name":"screen-normal","figma":{"id":"0:906","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["fullscreen","expand","exit"],"width":14,"height":16,"path":""},"unverified":{"name":"unverified","figma":{"id":"0:914","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["insecure","untrusted","signed"],"width":16,"height":16,"path":""},"verified":{"name":"verified","figma":{"id":"0:919","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["trusted","secure","trustworthy","signed"],"width":16,"height":16,"path":""},"versions":{"name":"versions","figma":{"id":"0:923","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["history","commits"],"width":14,"height":16,"path":""},"watch":{"name":"watch","figma":{"id":"0:929","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["wait","hourglass","time","date"],"width":12,"height":16,"path":""},"x":{"name":"x","figma":{"id":"0:932","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["remove","close","delete"],"width":12,"height":16,"path":""},"zap":{"name":"zap","figma":{"id":"0:934","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["electricity","lightning","props","like","star","save"],"width":10,"height":16,"path":""},"key":{"name":"key","figma":{"id":"0:938","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["key","lock","secure","safe"],"width":14,"height":16,"path":""},"grabber":{"name":"grabber","figma":{"id":"0:942","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["mover","drap","drop","sort"],"width":8,"height":16,"path":""},"plus-small":{"name":"plus-small","figma":{"id":"0:947","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["add","new","more","small"],"width":7,"height":16,"path":""},"light-bulb":{"name":"light-bulb","figma":{"id":"0:951","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["idea"],"width":12,"height":16,"path":""},"link-external":{"name":"link-external","figma":{"id":"0:956","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["out","see","more","go","to"],"width":12,"height":16,"path":""},"archive":{"name":"archive","figma":{"id":"2228:2","file":"FP7lqd1V00LUaT5zvdklkkZr"},"keywords":["box","catalog"],"width":14,"height":16,"path":""}} \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/archive.svg b/htdocs/theme/common/octicons/build/svg/archive.svg new file mode 100644 index 00000000000..d1eaa21f97b --- /dev/null +++ b/htdocs/theme/common/octicons/build/svg/archive.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/arrow-both.svg b/htdocs/theme/common/octicons/build/svg/arrow-both.svg new file mode 100644 index 00000000000..4167746d84b --- /dev/null +++ b/htdocs/theme/common/octicons/build/svg/arrow-both.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/beaker.svg b/htdocs/theme/common/octicons/build/svg/beaker.svg index 19377609a5d..0997bb0931c 100644 --- a/htdocs/theme/common/octicons/build/svg/beaker.svg +++ b/htdocs/theme/common/octicons/build/svg/beaker.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/bell.svg b/htdocs/theme/common/octicons/build/svg/bell.svg index d076a0c2129..171f84f1e0f 100644 --- a/htdocs/theme/common/octicons/build/svg/bell.svg +++ b/htdocs/theme/common/octicons/build/svg/bell.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/bug.svg b/htdocs/theme/common/octicons/build/svg/bug.svg index bd533f829e7..75188298bdc 100644 --- a/htdocs/theme/common/octicons/build/svg/bug.svg +++ b/htdocs/theme/common/octicons/build/svg/bug.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/check.svg b/htdocs/theme/common/octicons/build/svg/check.svg index 2d59600912e..2df5deeef92 100644 --- a/htdocs/theme/common/octicons/build/svg/check.svg +++ b/htdocs/theme/common/octicons/build/svg/check.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/chevron-down.svg b/htdocs/theme/common/octicons/build/svg/chevron-down.svg index 3a4e0aad5c6..32eab7b007f 100644 --- a/htdocs/theme/common/octicons/build/svg/chevron-down.svg +++ b/htdocs/theme/common/octicons/build/svg/chevron-down.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/chevron-left.svg b/htdocs/theme/common/octicons/build/svg/chevron-left.svg index 2de62df36b3..680c9a0740c 100644 --- a/htdocs/theme/common/octicons/build/svg/chevron-left.svg +++ b/htdocs/theme/common/octicons/build/svg/chevron-left.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/database.svg b/htdocs/theme/common/octicons/build/svg/database.svg index 08b036d9aee..e686d98e4c7 100644 --- a/htdocs/theme/common/octicons/build/svg/database.svg +++ b/htdocs/theme/common/octicons/build/svg/database.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/device-camera-video.svg b/htdocs/theme/common/octicons/build/svg/device-camera-video.svg index 8f989c86e9c..dc0e55e6f0b 100644 --- a/htdocs/theme/common/octicons/build/svg/device-camera-video.svg +++ b/htdocs/theme/common/octicons/build/svg/device-camera-video.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/file-pdf.svg b/htdocs/theme/common/octicons/build/svg/file-pdf.svg index 1b1703e19fd..6d04a046024 100644 --- a/htdocs/theme/common/octicons/build/svg/file-pdf.svg +++ b/htdocs/theme/common/octicons/build/svg/file-pdf.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/flame.svg b/htdocs/theme/common/octicons/build/svg/flame.svg index 49507a1073a..1fcb94b429a 100644 --- a/htdocs/theme/common/octicons/build/svg/flame.svg +++ b/htdocs/theme/common/octicons/build/svg/flame.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/gear.svg b/htdocs/theme/common/octicons/build/svg/gear.svg index aded0c46675..bf82007a485 100644 --- a/htdocs/theme/common/octicons/build/svg/gear.svg +++ b/htdocs/theme/common/octicons/build/svg/gear.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/gift.svg b/htdocs/theme/common/octicons/build/svg/gift.svg index 761be5473ca..4539ce60945 100644 --- a/htdocs/theme/common/octicons/build/svg/gift.svg +++ b/htdocs/theme/common/octicons/build/svg/gift.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/gist-secret.svg b/htdocs/theme/common/octicons/build/svg/gist-secret.svg index a6459e19bf2..6495281267c 100644 --- a/htdocs/theme/common/octicons/build/svg/gist-secret.svg +++ b/htdocs/theme/common/octicons/build/svg/gist-secret.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/git-merge.svg b/htdocs/theme/common/octicons/build/svg/git-merge.svg index fedb516064a..63c43f76936 100644 --- a/htdocs/theme/common/octicons/build/svg/git-merge.svg +++ b/htdocs/theme/common/octicons/build/svg/git-merge.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/heart.svg b/htdocs/theme/common/octicons/build/svg/heart.svg index 8b81f8845fe..e9407b514c7 100644 --- a/htdocs/theme/common/octicons/build/svg/heart.svg +++ b/htdocs/theme/common/octicons/build/svg/heart.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/info.svg b/htdocs/theme/common/octicons/build/svg/info.svg index 745ef337a3d..26db463ff03 100644 --- a/htdocs/theme/common/octicons/build/svg/info.svg +++ b/htdocs/theme/common/octicons/build/svg/info.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/list-ordered.svg b/htdocs/theme/common/octicons/build/svg/list-ordered.svg index 64126c3b8ef..2450532b491 100644 --- a/htdocs/theme/common/octicons/build/svg/list-ordered.svg +++ b/htdocs/theme/common/octicons/build/svg/list-ordered.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/logo-github.svg b/htdocs/theme/common/octicons/build/svg/logo-github.svg index 253c13ecbaa..0da3476f6e3 100644 --- a/htdocs/theme/common/octicons/build/svg/logo-github.svg +++ b/htdocs/theme/common/octicons/build/svg/logo-github.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/mortar-board.svg b/htdocs/theme/common/octicons/build/svg/mortar-board.svg index 302415b1736..869f9ae8e7c 100644 --- a/htdocs/theme/common/octicons/build/svg/mortar-board.svg +++ b/htdocs/theme/common/octicons/build/svg/mortar-board.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/mute.svg b/htdocs/theme/common/octicons/build/svg/mute.svg index 4d894a1cadd..e448808fbe5 100644 --- a/htdocs/theme/common/octicons/build/svg/mute.svg +++ b/htdocs/theme/common/octicons/build/svg/mute.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/organization.svg b/htdocs/theme/common/octicons/build/svg/organization.svg index af333e418dd..6bf4ae94b40 100644 --- a/htdocs/theme/common/octicons/build/svg/organization.svg +++ b/htdocs/theme/common/octicons/build/svg/organization.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/package.svg b/htdocs/theme/common/octicons/build/svg/package.svg index 720e30026a5..2db03518db2 100644 --- a/htdocs/theme/common/octicons/build/svg/package.svg +++ b/htdocs/theme/common/octicons/build/svg/package.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/pencil.svg b/htdocs/theme/common/octicons/build/svg/pencil.svg index 41c6e7ec6f8..8702f4dcecd 100644 --- a/htdocs/theme/common/octicons/build/svg/pencil.svg +++ b/htdocs/theme/common/octicons/build/svg/pencil.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/pin.svg b/htdocs/theme/common/octicons/build/svg/pin.svg index 861ae05afdc..95405c537c0 100644 --- a/htdocs/theme/common/octicons/build/svg/pin.svg +++ b/htdocs/theme/common/octicons/build/svg/pin.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/pulse.svg b/htdocs/theme/common/octicons/build/svg/pulse.svg index d87d04ea419..4ec57bacaae 100644 --- a/htdocs/theme/common/octicons/build/svg/pulse.svg +++ b/htdocs/theme/common/octicons/build/svg/pulse.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/quote.svg b/htdocs/theme/common/octicons/build/svg/quote.svg index 7b5f4a7f191..da5c2b22cef 100644 --- a/htdocs/theme/common/octicons/build/svg/quote.svg +++ b/htdocs/theme/common/octicons/build/svg/quote.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/radio-tower.svg b/htdocs/theme/common/octicons/build/svg/radio-tower.svg index a438661ce55..f89a7052a7a 100644 --- a/htdocs/theme/common/octicons/build/svg/radio-tower.svg +++ b/htdocs/theme/common/octicons/build/svg/radio-tower.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/reply.svg b/htdocs/theme/common/octicons/build/svg/reply.svg index 5f89aad3010..12717db93da 100644 --- a/htdocs/theme/common/octicons/build/svg/reply.svg +++ b/htdocs/theme/common/octicons/build/svg/reply.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/sign-out.svg b/htdocs/theme/common/octicons/build/svg/sign-out.svg index e0893cbce43..ccfc4959ae3 100644 --- a/htdocs/theme/common/octicons/build/svg/sign-out.svg +++ b/htdocs/theme/common/octicons/build/svg/sign-out.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/squirrel.svg b/htdocs/theme/common/octicons/build/svg/squirrel.svg index 7c974be5979..3e5b51beea4 100644 --- a/htdocs/theme/common/octicons/build/svg/squirrel.svg +++ b/htdocs/theme/common/octicons/build/svg/squirrel.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/sync.svg b/htdocs/theme/common/octicons/build/svg/sync.svg index 61bef53cbd0..692349a1f93 100644 --- a/htdocs/theme/common/octicons/build/svg/sync.svg +++ b/htdocs/theme/common/octicons/build/svg/sync.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/tag.svg b/htdocs/theme/common/octicons/build/svg/tag.svg index 6c8a9c43c1e..aee833d91b9 100644 --- a/htdocs/theme/common/octicons/build/svg/tag.svg +++ b/htdocs/theme/common/octicons/build/svg/tag.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/telescope.svg b/htdocs/theme/common/octicons/build/svg/telescope.svg index ce4bfaaa184..95047dc191d 100644 --- a/htdocs/theme/common/octicons/build/svg/telescope.svg +++ b/htdocs/theme/common/octicons/build/svg/telescope.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/thumbsdown.svg b/htdocs/theme/common/octicons/build/svg/thumbsdown.svg index ac4c7c6996b..aa319a29879 100644 --- a/htdocs/theme/common/octicons/build/svg/thumbsdown.svg +++ b/htdocs/theme/common/octicons/build/svg/thumbsdown.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/thumbsup.svg b/htdocs/theme/common/octicons/build/svg/thumbsup.svg index e77f1e30e57..5b197266c1a 100644 --- a/htdocs/theme/common/octicons/build/svg/thumbsup.svg +++ b/htdocs/theme/common/octicons/build/svg/thumbsup.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/unmute.svg b/htdocs/theme/common/octicons/build/svg/unmute.svg index 531aafc8b46..19b375fb08c 100644 --- a/htdocs/theme/common/octicons/build/svg/unmute.svg +++ b/htdocs/theme/common/octicons/build/svg/unmute.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/unverified.svg b/htdocs/theme/common/octicons/build/svg/unverified.svg index becff6dfc8f..cf04ce3f81e 100644 --- a/htdocs/theme/common/octicons/build/svg/unverified.svg +++ b/htdocs/theme/common/octicons/build/svg/unverified.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/verified.svg b/htdocs/theme/common/octicons/build/svg/verified.svg index 8420d2ac554..e1c6c71f72b 100644 --- a/htdocs/theme/common/octicons/build/svg/verified.svg +++ b/htdocs/theme/common/octicons/build/svg/verified.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/build/svg/x.svg b/htdocs/theme/common/octicons/build/svg/x.svg index 3725777be40..e3773142bb9 100644 --- a/htdocs/theme/common/octicons/build/svg/x.svg +++ b/htdocs/theme/common/octicons/build/svg/x.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/htdocs/theme/common/octicons/package.json b/htdocs/theme/common/octicons/package.json index 77188450670..4d8ea495b08 100644 --- a/htdocs/theme/common/octicons/package.json +++ b/htdocs/theme/common/octicons/package.json @@ -1,6 +1,6 @@ { - "version": "7.2.0", "name": "octicons", + "version": "8.1.0", "description": "A scalable set of icons handcrafted with <3 by GitHub.", "homepage": "https://octicons.github.com", "author": "GitHub Inc.", diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index 9aa6f0bb909..82f50a5771c 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -54,7 +54,7 @@ $colortexttitlenotab='100,60,20'; $colortexttitle='0,0,0'; $colortext='0,0,0'; $colortextlink='0,0,100'; -$fontsize='0.85em'; +$fontsize='0.86em'; $fontsizesmaller='0.75em'; if (defined('THEME_ONLY_CONSTANT')) return; @@ -264,7 +264,7 @@ body { trans("DIRECTION").";\n"; ?> } -.thumbstat, a.tab { font-weight: bold !important; } +.thumbstat { font-weight: bold !important; } th a { font-weight: !important; } a.tab { font-weight: bold !important; } @@ -497,6 +497,7 @@ input#onlinepaymenturl, input#directdownloadlink { } hr { border: 0; border-top: 1px solid #ccc; } +.tabBar hr { margin-top: 20px; margin-bottom: 17px; } .button, .buttonDelete, input[name="sbmtConnexion"] { margin-bottom: 0; @@ -552,7 +553,7 @@ form { margin:0px; } form#addproduct { - padding-top: 6px; + padding-top: 10px; } div.float { @@ -1168,8 +1169,8 @@ td.showDragHandle { table-layout: fixed; } #id-right, #id-left { - padding-top: 16px; - padding-bottom: 16px; + padding-top: 20px; + padding-bottom: 20px; display: table-cell; /* DOL_XXX Empeche fonctionnement correct du scroll horizontal sur tableau, avec datatable ou CSS */ float: none; @@ -1274,8 +1275,8 @@ div.fiche { div.fiche { - margin-: dol_optimize_smallscreen)?'25':'6')); ?>px; - margin-: dol_optimize_smallscreen)?'24':'6')); ?>px; + margin-: dol_optimize_smallscreen)?'30':'6')); ?>px; + margin-: dol_optimize_smallscreen)?'29':'6')); ?>px; } @@ -1378,7 +1379,7 @@ div.nopadding { margin : 0px auto; } -#pictotitle { +.pictotitle { margin-: 8px; margin-bottom: 4px; } @@ -1706,6 +1707,10 @@ div.mainmenu.cashdesk { background-image: url(); } +div.mainmenu.takepos { + background-image: url(); +} + div.mainmenu.companies { background-image: url(); } @@ -1775,7 +1780,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); +$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); // Put here list of menu entries we are sure we don't want $divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) @@ -1836,6 +1841,7 @@ foreach($mainmenuusedarray as $val) position: absolute; height: 100%; width: 100%; + font-size: 1em; } .login_center { display: table-cell; @@ -1852,8 +1858,9 @@ form#login { } .login_table_title { max-width: 530px; - color: #aaa !important; + color: #eee !important; padding-bottom: 20px; + text-shadow: 1px 1px #444; } .login_table label { text-shadow: 1px 1px 1px #FFF; @@ -1884,7 +1891,7 @@ if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { } .login_table input#username, .login_table input#password, .login_table input#securitycode { border: none; - /* border-bottom: solid 1px rgba(180,180,180,.4); */ + border-bottom: solid 1px rgba(180,180,180,.4); padding: 5px; margin-left: 5px; margin-top: 5px; @@ -1894,18 +1901,25 @@ if (! empty($conf->global->MAIN_LOGIN_BACKGROUND)) { outline: none !important; } .login_table .trinputlogin { + font-size: 1.2em; margin: 8px; } .login_table .tdinputlogin { - background-color: #fff; - border: 2px solid #ccc; - min-width: 200px; + background-color: transparent; + /* border: 2px solid #ccc; */ + min-width: 220px; border-radius: 2px; } .login_table .tdinputlogin .fa { padding-left: 10px; width: 14px; } +.login_table .tdinputlogin input#username, .login_table .tdinputlogin input#password { + font-size: 1em; +} +.login_table .tdinputlogin input#securitycode { + font-size: 1em; +} .login_main_message { text-align: center; max-width: 570px; @@ -2325,6 +2339,7 @@ div.tabBar table.tableforservicepart2:last-child { } .tableforservicepart1 .tdhrthin { height: unset; + padding-top: 0 !important; } div.popuptabset { @@ -2339,7 +2354,7 @@ div.popuptab { padding-right: 5px; } div.tabsAction { - margin: 20px 0em 20px 0em; + margin: 20px 0em 30px 0em; padding: 0em 0em; text-align: right; } @@ -2366,7 +2381,7 @@ a.tabunactive { } a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { font-family: ; - padding: 12px 9px 13px; + padding: 12px 14px 13px; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; @@ -2718,7 +2733,9 @@ table.paddingtopbottomonly tr td { background: rgb() !important; } tr.liste_titre_filter td.liste_titre { -/* border-bottom: 1px solid #ddd; */ + /* border-bottom: 1px solid #ddd; */ + padding-top: 1px; + padding-bottom: 0px; } .liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { @@ -3237,8 +3254,9 @@ ul.noborder li:nth-child(even):not(.liste_titre) { margin-bottom: 5px; text-align: center; - background: #f8f8f8; + background: #fcfcfc; border: 1px solid #eee; + /* border-left: 6px solid #ddd; */ box-shadow: 1px 1px 8px #ddd; border-radius: 0px; } @@ -3286,9 +3304,11 @@ ul.noborder li:nth-child(even):not(.liste_titre) { } .thumbstat { flex: 1 1 110px; + margin-bottom: 8px; } .thumbstat150 { flex: 1 1 110px; + margin-bottom: 8px; } .dashboardlineindicator { float: left; @@ -3482,7 +3502,7 @@ div.warning { background: #fcf8e3; } div.warning a, div.info a, div.error a { - color: rgb(); + color: rgb(); } /* Error message */ @@ -4416,7 +4436,7 @@ td.gminorheading { .ecmfiletree { width: 99%; height: 99%; - background: #FFF; + /* background: #FFF; */ padding-left: 2px; font-weight: normal; } @@ -4913,7 +4933,81 @@ span.noborderoncategories { /* ============================================================================== */ -/* Multiselect with checkbox */ +/* External lib multiselect with checkbox */ +/* ============================================================================== */ + +.multi-select-container { + display: inline-block; + position: relative; +} + +.multi-select-menu { + position: absolute; + left: 0; + top: 0.8em; + float: left; + min-width: 100%; + background: #fff; + margin: 1em 0; + padding: 0.4em 0; + border: 1px solid #aaa; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); + display: none; +} + +.multi-select-menu input { + margin-right: 0.3em; + vertical-align: 0.1em; +} + +.multi-select-button { + display: inline-block; + max-width: 20em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + background-color: #fff; + cursor: default; + + border: none; + border-bottom: solid 1px rgba(0,0,0,.2); + padding: 5px; + padding-left: 2px; + height: 17px; +} +.multi-select-button:focus { + outline: none; + border-bottom: 1px solid #666; +} + +.multi-select-button:after { + content: ""; + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 0.5em 0.23em 0em 0.23em; + border-color: #444 transparent transparent transparent; + margin-left: 0.4em; +} + +.multi-select-container--open .multi-select-menu { display: block; } + +.multi-select-container--open .multi-select-button:after { + border-width: 0 0.4em 0.4em 0.4em; + border-color: transparent transparent #999 transparent; +} + +.multi-select-menuitem { + clear: both; + float: left; + padding-left: 5px +} + + +/* ============================================================================== */ +/* Native multiselect with checkbox */ /* ============================================================================== */ ul.ulselectedfields { @@ -4953,10 +5047,10 @@ dl.dropdown { } .dropdown dd ul { background-color: #FFF; - border: 1px solid #888; + box-shadow: 1px 1px 10px #aaa; display:none; :0px; /* pop is align on right */ - padding: 2px 15px 2px 5px; + padding: 0 0 0 0; position:absolute; top:2px; list-style:none; @@ -4966,10 +5060,13 @@ dl.dropdown { .dropdown dd ul li { white-space: nowrap; font-weight: normal; - padding: 2px; + padding: 7px 8px 7px 8px; /* color: rgb(); */ color: #000; } +.dropdown dd ul li:hover { + background: #eee; +} .dropdown dd ul li input[type="checkbox"] { margin-: 3px; } @@ -4981,7 +5078,7 @@ dl.dropdown { color: #888; } .dropdown dd ul li a:hover { - background-color:#fff; + background-color:#eee; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 58c239e33cd..23575680acf 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -55,7 +55,7 @@ $colortexttitlenotab='90,90,90'; $colortexttitle='20,20,20'; $colortext='0,0,0'; $colortextlink='0,0,120'; -$fontsize='13'; +$fontsize='14'; $fontsizesmaller='11'; if (defined('THEME_ONLY_CONSTANT')) return; @@ -100,7 +100,7 @@ $dol_no_mouse_hover=$conf->dol_no_mouse_hover; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; //var_dump($user->conf->THEME_ELDY_RGB); -$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:1); +$useboldtitle=(isset($conf->global->THEME_ELDY_USEBOLDTITLE)?$conf->global->THEME_ELDY_USEBOLDTITLE:0); $borderwidth=2; // Case of option always editable @@ -121,7 +121,7 @@ if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) $conf->global->THEME_ELDY_BACKTABCARD1='255,255,255'; // card $conf->global->THEME_ELDY_BACKTABACTIVE='234,234,234'; $conf->global->THEME_ELDY_TEXT='0,0,0'; - $conf->global->THEME_ELDY_FONT_SIZE1='13'; + $conf->global->THEME_ELDY_FONT_SIZE1='14'; $conf->global->THEME_ELDY_FONT_SIZE2='11'; } @@ -257,7 +257,8 @@ body { trans("DIRECTION").";\n"; ?> } -th a, .thumbstat, a.tab { font-weight: bold !important; } +.thumbstat { font-weight: bold !important; } +th a { font-weight: !important; } a.tab { font-weight: bold !important; } a:link, a:visited, a:hover, a:active { font-family: ; font-weight: normal; color: rgb(); text-decoration: none; } @@ -1372,7 +1373,7 @@ table.noborder tr.liste_titre td { margin : 0px auto; } -#pictotitle { +.pictotitle { margin-: 8px; margin-bottom: 4px; } @@ -1696,6 +1697,10 @@ div.mainmenu.cashdesk { background-image: url(); } +div.mainmenu.takepos { + background-image: url(); +} + div.mainmenu.companies { background-image: url(); } @@ -1769,7 +1774,7 @@ $mainmenuusedarray=array_unique(explode(',',$mainmenuused)); $generic=1; // Put here list of menu entries when the div.mainmenu.menuentry was previously defined -$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); +$divalreadydefined=array('home','companies','products','commercial','externalsite','accountancy','project','tools','members','agenda','ftp','holiday','hrm','bookmark','cashdesk','takepos','ecm','geoipmaxmind','gravatar','clicktodial','paypal','stripe','webservices','website'); // Put here list of menu entries we are sure we don't want $divnotrequired=array('multicurrency','salaries','ticket','margin','opensurvey','paybox','expensereport','incoterm','prelevement','propal','workflow','notification','supplier_proposal','cron','product','productbatch','expedition'); foreach($mainmenuusedarray as $val) @@ -1890,7 +1895,7 @@ form#login { .login_table .tdinputlogin { background-color: #fff; border: 2px solid #ccc; - min-width: 200px; + min-width: 220px; border-radius: 2px; } .login_table .tdinputlogin .fa { @@ -2323,7 +2328,7 @@ a.tabTitle { a.tab:link, a.tab:visited, a.tab:hover, a.tab#active { font-family: ; - padding: 12px 9px 12px; + padding: 12px 13px 12px; margin: 0em 0.2em; text-decoration: none; white-space: nowrap; @@ -2685,6 +2690,8 @@ table.paddingtopbottomonly tr td { } tr.liste_titre_filter td.liste_titre { border-bottom: 1px solid #FDFFFF; + padding-top: 4px; + padding-bottom: 3px; } .liste_titre_create td, .liste_titre_create th, .liste_titre_create .tagtd { @@ -2716,7 +2723,7 @@ table.liste td, table.noborder td, div.noborder form div { padding: 8px 6px 8px 6px; /* t r b l */ } div.liste_titre_bydiv .divsearchfield { - padding: 2px 1px 2px 0px; /* t r b l */ + padding: 2px 1px 2px 6px; /* t r b l */ } table.nobordernopadding { @@ -3397,7 +3404,7 @@ div.warning { background: #fcf8e3; } div.warning a, div.info a, div.error a { - color: rgb(); + color: rgb(); } /* Error message */ @@ -4772,7 +4779,81 @@ span.noborderoncategories { /* ============================================================================== */ -/* Multiselect with checkbox */ +/* External lib multiselect with checkbox */ +/* ============================================================================== */ + +.multi-select-container { + display: inline-block; + position: relative; +} + +.multi-select-menu { + position: absolute; + left: 0; + top: 0.8em; + float: left; + min-width: 100%; + background: #fff; + margin: 1em 0; + padding: 0.4em 0; + border: 1px solid #aaa; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); + display: none; +} + +.multi-select-menu input { + margin-right: 0.3em; + vertical-align: 0.1em; +} + +.multi-select-button { + display: inline-block; + max-width: 20em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + vertical-align: middle; + background-color: #fff; + cursor: default; + + border: none; + border-bottom: solid 1px rgba(0,0,0,.2); + padding: 5px; + padding-left: 2px; + height: 17px; +} +.multi-select-button:focus { + outline: none; + border-bottom: 1px solid #666; +} + +.multi-select-button:after { + content: ""; + display: inline-block; + width: 0; + height: 0; + border-style: solid; + border-width: 0.5em 0.23em 0em 0.23em; + border-color: #444 transparent transparent transparent; + margin-left: 0.4em; +} + +.multi-select-container--open .multi-select-menu { display: block; } + +.multi-select-container--open .multi-select-button:after { + border-width: 0 0.4em 0.4em 0.4em; + border-color: transparent transparent #999 transparent; +} + +.multi-select-menuitem { + clear: both; + float: left; + padding-left: 5px +} + + +/* ============================================================================== */ +/* Native multiselect with checkbox */ /* ============================================================================== */ ul.ulselectedfields { @@ -4783,7 +4864,7 @@ dl.dropdown { padding:0px; margin-left: 2px; margin-right: 2px; - vertical-align: text-bottom; + vertical-align: middle; display: inline-block; } .dropdown dd, .dropdown dt { @@ -4812,10 +4893,10 @@ dl.dropdown { } .dropdown dd ul { background-color: #FFF; - border: 1px solid #888; + box-shadow: 1px 1px 10px #aaa; display:none; right:0px; /* pop is align on right */ - padding: 2px 15px 2px 5px; + padding: 0 0 0 0; position:absolute; top:2px; list-style:none; @@ -4825,9 +4906,12 @@ dl.dropdown { .dropdown dd ul li { white-space: nowrap; font-weight: normal; - padding: 2px; + padding: 7px 8px 7px 8px; color: #000; } +.dropdown dd ul li:hover { + background: #eee; +} .dropdown dd ul li input[type="checkbox"] { margin-right: 3px; } @@ -4839,7 +4923,7 @@ dl.dropdown { color: #888; } .dropdown dd ul li a:hover { - background-color:#fff; + background-color: #eee; } diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index b736b49646f..c4718c395b3 100644 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -55,26 +55,43 @@ $action = GETPOST('action', 'alpha', 3); $hookmanager->initHooks(array('ticketcard','globalcard')); $object = new Ticket($db); - $extrafields = new ExtraFields($db); +// Fetch optionals attributes and labels $extralabels = $extrafields->fetch_name_optionals_label($object->table_element); +$search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); -if (!$action) { - $action = 'view'; +// Initialize array of search criterias +$search_all=trim(GETPOST("search_all",'alpha')); +$search=array(); +foreach($object->fields as $key => $val) +{ + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); } + +if (empty($action) && empty($id) && empty($ref)) $action='view'; + //Select mail models is same action as add_message if (GETPOST('modelselected','alpha')) { $action = 'add_message'; } +// Load object +//include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals +if ($id || $track_id || $ref) { + $res = $object->fetch($id, $ref, $track_id); + if ($res >= 0) + { + $id = $object->id; + $track_id = $object->track_id; + } +} + // Store current page url $url_page_current = DOL_URL_ROOT.'/ticket/card.php'; -if ($id || $track_id || $ref) { - $res = $object->fetch($id, $ref, $track_id); -} - -// Security check +// Security check - Protection if external user +//if ($user->societe_id > 0) access_forbidden(); +//if ($user->societe_id > 0) $socid = $user->societe_id; $result = restrictedArea($user, 'ticket', $object->id); $triggermodname = 'TICKETSUP_MODIFY'; @@ -89,7 +106,9 @@ $now = dol_now(); * Actions */ -// TODO Replace actions with common includes actions_addupdatedelete.inc.php +$parameters=array(); +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if ($cancel) { @@ -98,7 +117,7 @@ if ($cancel) header("Location: ".$backtopage); exit; } - $action=''; + $action='view'; } // Do action @@ -157,26 +176,25 @@ include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php'; // Must be inc $userstat = new User($db); $form = new Form($db); $formticket = new FormTicket($db); +if (! empty($conf->projet->enabled)) $formproject = new FormProjets($db); -if (! empty($conf->projet->enabled)) { - $formproject = new FormProjets($db); -} +$help_url = 'FR:DocumentationModuleTicket'; +$page_title = $actionobject->getTitle($action); -if ($action == 'view' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' +llxHeader('', $page_title, $help_url); + + +if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'add_message' || $action == 'close' || $action == 'delete' || $action == 'editcustomer' || $action == 'progression' || $action == 'reopen' || $action == 'editsubject' || $action == 'edit_extras' || $action == 'update_extras' || $action == 'edit_extrafields' || $action == 'set_extrafields' || $action == 'classify' || $action == 'sel_contract' || $action == 'edit_message_init' || $action == 'set_status' || $action == 'dellink') { - if ($res > 0) { + if ($res > 0) + { // or for unauthorized internals users if (!$user->societe_id && ($conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY && $object->fk_user_assign != $user->id) && !$user->rights->ticket->manage) { accessforbidden('', 0); } - $help_url = 'FR:DocumentationModuleTicket'; - $page_title = $actionobject->getTitle($action); - - llxHeader('', $page_title, $help_url); - // Confirmation close if ($action == 'close') { print $form->formconfirm($url_page_current . "?track_id=" . $object->track_id, $langs->trans("CloseATicket"), $langs->trans("ConfirmCloseAticket"), "confirm_close", '', '', 1); @@ -287,7 +305,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti $morehtmlref.= $object->subject; // Author if ($object->fk_user_create > 0) { - $morehtmlref .= '
    ' . $langs->trans("CreatedBy") . ' '; + $morehtmlref .= '
    ' . $langs->trans("CreatedBy") . ' : '; $langs->load("users"); $fuser = new User($db); @@ -295,10 +313,24 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti $morehtmlref .= $fuser->getNomUrl(0); } if (!empty($object->origin_email)) { - $morehtmlref .= '
    ' . $langs->trans("CreatedBy") . ' '; + $morehtmlref .= '
    ' . $langs->trans("CreatedBy") . ' : '; $morehtmlref .= $object->origin_email . ' (' . $langs->trans("TicketEmailOriginIssuer") . ')'; } + // Thirdparty + if (! empty($conf->societe->enabled)) + { + $morehtmlref.='
    '.$langs->trans('ThirdParty') . ' '; + if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { + $morehtmlref.='
    ' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . ' : '; + } + if ($action == 'editcustomer') { + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'editcustomer', '', 1, 0, 0, array(), 1); + } else { + $morehtmlref.=$form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->socid, 'none', '', 1, 0, 0, array(), 1); + } + } + // Project if (! empty($conf->projet->enabled)) { @@ -323,9 +355,7 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti if (! empty($object->fk_project)) { $proj = new Project($db); $proj->fetch($object->fk_project); - $morehtmlref.=''; - $morehtmlref.=$proj->ref; - $morehtmlref.=''; + $morehtmlref.=$proj->getNomUrl(1); } else { $morehtmlref.=''; } @@ -385,24 +415,6 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti } print '
    '; - print ''; - if ($action != 'editcustomer' && $object->fk_statut < 8 && !$user->societe_id && $user->rights->ticket->write) { - print ''; - } - print '
    '; - print $langs->trans('ThirdParty'); - print '' . img_edit($langs->transnoentitiesnoconv('Edit'), 1) . '
    '; - print '
    '; - - if ($action == 'editcustomer') { - $form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->fk_soc, 'editcustomer', ($object->fk_soc ? 's.rowid <> ' . $object->fk_soc : ''), 1); - } else { - $form->form_thirdparty($url_page_current . '?track_id=' . $object->track_id, $object->fk_soc, 'none', 's.rowid <> ' . $object->fk_soc, 1); - } - print '
    ' . $langs->trans("AssignedTo") . ''; if ($object->fk_user_assign > 0) { @@ -692,151 +704,146 @@ if ($action == 'view' || $action == 'add_message' || $action == 'close' || $acti print ''; } - // Contract - if ($action == 'sel_contract') { - if (!empty($conf->contrat->enabled)) { - $langs->load('contrats'); - print load_fiche_titre($langs->trans('LinkToAContract'), '', 'title_commercial.png'); - - $form_contract = new FormContract($db); - $form_contract->formSelectContract( - $url_page_current.'?track_id='.$object->track_id, - $object->fk_soc, - GETPOST('contractid'), - 'contractid' - ); - } - } - print ''; print '
    '; - print dol_fiche_end(); + dol_fiche_end(); - /* ActionBar */ - print '
    '; + // Buttons for actions + if ($action != 'presend' && $action != 'editline') { + print '
    '."\n"; + $parameters=array(); + $reshook=$hookmanager->executeHooks('addMoreActionsButtons',$parameters,$object,$action); // Note that $action and $object may have been modified by hook + if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - // Show link to add a message (if read and not closed) - if ($object->fk_statut < 8 && $action != "add_message") { - print ''; - } + if (empty($reshook)) + { + // Show link to add a message (if read and not closed) + if ($object->fk_statut < 8 && $action != "add_message") { + print ''; + } - // Link to create an intervention - // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ - if (!$object->fk_soc && $user->rights->ficheinter->creer) { - print ''; - } - if ($object->fk_soc > 0 && $object->fk_statut < 8 && $user->rights->ficheinter->creer) { - print ''; - } + // Link to create an intervention + // socid is needed otherwise fichinter ask it and forgot origin after form submit :\ + if (!$object->fk_soc && $user->rights->ficheinter->creer) { + print ''; + } + if ($object->fk_soc > 0 && $object->fk_statut < 8 && $user->rights->ficheinter->creer) { + print ''; + } - // Button to link to a contract - if ($user->rights->ticket->write && $object->fk_statut < 5 && $user->rights->contrat->creer) { - print ''; - } + // Close ticket if statut is read + if ($object->fk_statut > 0 && $object->fk_statut < 8 && $user->rights->ticket->write) { + print ''; + } - // Close ticket if statut is read - if ($object->fk_statut > 0 && $object->fk_statut < 8 && $user->rights->ticket->write) { - print ''; - } + // Re-open ticket + if (!$user->socid && $object->fk_statut == 8 && !$user->societe_id) { + print ''; + } - // Re-open ticket - if (!$user->socid && $object->fk_statut == 8 && !$user->societe_id) { - print ''; - } - - // Delete ticket - if ($user->rights->ticket->delete && !$user->societe_id) { - print ''; - } - print '
    '; - - if ($action == 'view' || $action == 'edit_message_init') { - print '
    '; - - //print '
    '; - // Message list - print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); - $show_private_message = ($user->societe_id ? 0 : 1); - $actionobject->viewTicketTimelineMessages($show_private_message, true, $object); - - print '
    '; - print '
    '; - print '
    '; - } elseif ($action == 'add_message') { - $action='new_message'; - $modelmail='ticket_send'; - - print '
    '; - print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); - - // 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->default_lang; - } - - $formticket = new FormTicket($db); - - $formticket->action = $action; - $formticket->track_id = $object->track_id; - $formticket->id = $object->id; - - $formticket->withfile = 2; - $formticket->param = array('fk_user_create' => $user->id); - $formticket->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); - - // Tableau des parametres complementaires du post - $formticket->param['models']=$modelmail; - $formticket->param['models_id']=GETPOST('modelmailselected', 'int'); - //$formticket->param['socid']=$object->fk_soc; - $formticket->param['returnurl']=$_SERVER["PHP_SELF"].'?track_id='.$object->track_id; + // Delete ticket + if ($user->rights->ticket->delete && !$user->societe_id) { + print ''; + } + } + print '
    '."\n"; + } - $formticket->withsubstit = 1; + // Select mail models is same action as presend + if (GETPOST('modelselected')) { + $action = 'presend'; + } - if ($object->fk_soc > 0) { - $object->fetch_thirdparty(); - $formticket->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; - } - $formticket->substit['__SIGNATURE__'] = $user->signature; - $formticket->substit['__TICKETSUP_TRACKID__'] = $object->track_id; - $formticket->substit['__TICKETSUP_REF__'] = $object->ref; - $formticket->substit['__TICKETSUP_SUBJECT__'] = $object->subject; - $formticket->substit['__TICKETSUP_TYPE__'] = $object->type_code; - $formticket->substit['__TICKETSUP_CATEGORY__'] = $object->category_code; - $formticket->substit['__TICKETSUP_SEVERITY__'] = $object->severity_code; - $formticket->substit['__TICKETSUP_MESSAGE__'] = $object->message; - $formticket->substit['__TICKETSUP_PROGRESSION__'] = $object->progress; - if ($object->fk_user_assign > 0) { - $userstat->fetch($object->fk_user_assign); - $formticket->substit['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } + if (empty($action) || $action == 'view' || $action == 'addlink' || $action == 'dellink' || $action == 'edit_message_init') + { + print '
    '; + print ''; // ancre - if ($object->fk_user_create > 0) { - $userstat->fetch($object->fk_user_create); - $formticket->substit['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); - } + // Show links to link elements + $linktoelem = $form->showLinkToObjectBlock($object, null, array('ticket')); + $somethingshown = $form->showLinkedObjectBlock($object, $linktoelem); + + print '
    '; + + // Message list + print load_fiche_titre($langs->trans('TicketMessagesList'), '', 'messages@ticket'); + $show_private_message = ($user->societe_id ? 0 : 1); + $actionobject->viewTicketTimelineMessages($show_private_message, true, $object); + + print '
    '; + print '
    '; + print '
    '; + } + elseif ($action == 'add_message') + { + $action='new_message'; + $modelmail='ticket_send'; + + print '
    '; + print load_fiche_titre($langs->trans('TicketAddMessage'), '', 'messages@ticket'); + + // 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->default_lang; + } + + $formticket = new FormTicket($db); + + $formticket->action = $action; + $formticket->track_id = $object->track_id; + $formticket->id = $object->id; + + $formticket->withfile = 2; + $formticket->param = array('fk_user_create' => $user->id); + $formticket->param['langsmodels']=(empty($newlang)?$langs->defaultlang:$newlang); + + // Tableau des parametres complementaires du post + $formticket->param['models']=$modelmail; + $formticket->param['models_id']=GETPOST('modelmailselected', 'int'); + //$formticket->param['socid']=$object->fk_soc; + $formticket->param['returnurl']=$_SERVER["PHP_SELF"].'?track_id='.$object->track_id; - $formticket->showMessageForm('100%'); - print '
    '; - } - } -} // End action view + $formticket->withsubstit = 1; -/*************************************************** - * LINKED OBJECT BLOCK - * - * Put here code to view linked object - ****************************************************/ -$somethingshown = $form->showLinkedObjectBlock($object); + if ($object->fk_soc > 0) { + $object->fetch_thirdparty(); + $formticket->substit['__THIRDPARTY_NAME__'] = $object->thirdparty->name; + } + $formticket->substit['__SIGNATURE__'] = $user->signature; + $formticket->substit['__TICKETSUP_TRACKID__'] = $object->track_id; + $formticket->substit['__TICKETSUP_REF__'] = $object->ref; + $formticket->substit['__TICKETSUP_SUBJECT__'] = $object->subject; + $formticket->substit['__TICKETSUP_TYPE__'] = $object->type_code; + $formticket->substit['__TICKETSUP_CATEGORY__'] = $object->category_code; + $formticket->substit['__TICKETSUP_SEVERITY__'] = $object->severity_code; + $formticket->substit['__TICKETSUP_MESSAGE__'] = $object->message; + $formticket->substit['__TICKETSUP_PROGRESSION__'] = $object->progress; + if ($object->fk_user_assign > 0) { + $userstat->fetch($object->fk_user_assign); + $formticket->substit['__TICKETSUP_USER_ASSIGN__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } + + if ($object->fk_user_create > 0) { + $userstat->fetch($object->fk_user_create); + $formticket->substit['__TICKETSUP_USER_CREATE__'] = dolGetFirstLastname($userstat->firstname, $userstat->lastname); + } + + + $formticket->showMessageForm('100%'); + print '
    '; + } + } +} // End of page -llxFooter(''); +llxFooter(); $db->close(); diff --git a/htdocs/ticket/class/actions_ticket.class.php b/htdocs/ticket/class/actions_ticket.class.php index 845ca8ca773..2fd26b5797b 100644 --- a/htdocs/ticket/class/actions_ticket.class.php +++ b/htdocs/ticket/class/actions_ticket.class.php @@ -60,6 +60,9 @@ class ActionsTicket public $template_dir; public $template; + /** + * @var string ticket action label + */ public $label; /** diff --git a/htdocs/ticket/class/ticketlogs.class.php b/htdocs/ticket/class/ticketlogs.class.php index c5e77bc9dae..01ba7972ced 100644 --- a/htdocs/ticket/class/ticketlogs.class.php +++ b/htdocs/ticket/class/ticketlogs.class.php @@ -75,7 +75,6 @@ class Ticketlogs// extends CommonObject public function __construct($db) { $this->db = $db; - return 1; } /** diff --git a/htdocs/ticket/list.php b/htdocs/ticket/list.php index b23b4c5d27e..b1fb2d31cef 100644 --- a/htdocs/ticket/list.php +++ b/htdocs/ticket/list.php @@ -219,8 +219,8 @@ foreach($search as $key => $val) if ($search[$key] != '') $sql.=natural_search($key, $search[$key], (($key == 'fk_statut')?2:$mode_search)); } if ($search_all) $sql.= natural_search(array_keys($fieldstosearchall), $search_all); -if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc); -if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project); +if ($search_fk_soc) $sql.= natural_search('fk_soc', $search_fk_soc, 2); +if ($search_fk_project) $sql.= natural_search('fk_project', $search_fk_project, 2); if (!$user->societe_id && ($mode == "my_assign" || (!$user->admin && $conf->global->TICKET_LIMIT_VIEW_ASSIGNED_ONLY))) { $sql.= " AND t.fk_user_assign=".$user->id; } diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 3f3e217dc04..9020cd3a4bc 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -7,7 +7,7 @@ * Copyright (C) 2005-2017 Regis Houssin * Copyright (C) 2005 Lionel Cousteix * Copyright (C) 2011 Herve Prot - * Copyright (C) 2013-2014 Philippe Grand + * Copyright (C) 2013-2018 Philippe Grand * Copyright (C) 2013-2015 Alexandre Spangaro * Copyright (C) 2015 Marcos García * Copyright (C) 2018 charlene Benke @@ -62,7 +62,7 @@ class User extends CommonObject public $birth; public $email; public $skype; - public $job; + public $job; // job position public $signature; public $address; public $zip; @@ -1853,7 +1853,7 @@ class User extends CommonObject function send_password($user, $password='', $changelater=0) { // phpcs:enable - global $conf,$langs; + global $conf, $langs; global $dolibarr_main_url_root; require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; @@ -1874,10 +1874,8 @@ class User extends CommonObject $outputlangs=$langs; } - $outputlangs->load("main"); - $outputlangs->load("errors"); - $outputlangs->load("users"); - $outputlangs->load("other"); + // Load translation files required by the page + $outputlangs->loadLangs(array("main", "errors", "users", "other")); $appli=constant('DOL_APPLICATION_TITLE'); if (!empty($conf->global->MAIN_APPLICATION_TITLE)) $appli=$conf->global->MAIN_APPLICATION_TITLE; @@ -2169,9 +2167,7 @@ class User extends CommonObject */ function getPhotoUrl($width, $height, $cssclass='', $imagesize='') { - $result=''; - - $result.=''; + $result =''; $result.=Form::showphoto('userphoto', $this, $width, $height, 0, $cssclass, $imagesize); $result.=''; @@ -2199,7 +2195,7 @@ class User extends CommonObject global $dolibarr_main_authentication, $dolibarr_main_demo; global $menumanager; - if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink'; + if(!$user->rights->user->user->lire && $user->id !=$this->id) $option='nolink'; if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) && $withpictoimg) $withpictoimg=0; @@ -2348,7 +2344,7 @@ class User extends CommonObject $linkend=''; } - if ($option == 'nolink') + if ($option == 'nolink') { $linkstart = ''; $linkend=''; @@ -2388,34 +2384,33 @@ class User extends CommonObject if ($mode == 0) { - $prefix=''; if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); + elseif ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 1) + elseif ($mode == 1) { if ($statut == 1) return $langs->trans('Enabled'); - if ($statut == 0) return $langs->trans('Disabled'); + elseif ($statut == 0) return $langs->trans('Disabled'); } - if ($mode == 2) + elseif ($mode == 2) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } - if ($mode == 3) + elseif ($mode == 3) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); + elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } - if ($mode == 4) + elseif ($mode == 4) { if ($statut == 1) return img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"').' '.$langs->trans('Enabled'); - if ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); + elseif ($statut == 0) return img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"').' '.$langs->trans('Disabled'); } - if ($mode == 5) + elseif ($mode == 5) { if ($statut == 1) return $langs->trans('Enabled').' '.img_picto($langs->trans('Enabled'),'statut4','class="pictostatus"'); - if ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); + elseif ($statut == 0) return $langs->trans('Disabled').' '.img_picto($langs->trans('Disabled'),'statut5','class="pictostatus"'); } } @@ -2436,8 +2431,8 @@ class User extends CommonObject global $conf; $dn=''; if ($mode==0) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS].",".$conf->global->LDAP_USER_DN; - if ($mode==1) $dn=$conf->global->LDAP_USER_DN; - if ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS]; + elseif ($mode==1) $dn=$conf->global->LDAP_USER_DN; + elseif ($mode==2) $dn=$conf->global->LDAP_KEY_USERS."=".$info[$conf->global->LDAP_KEY_USERS]; return $dn; } @@ -2511,7 +2506,7 @@ class User extends CommonObject if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass, 4); // Create OpenLDAP MD5 password (TODO add type of encryption) } // Set LDAP password if possible - else if ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password + elseif ($conf->global->LDAP_SERVER_PROTOCOLVERSION !== '3') // If ldap key is modified and LDAPv3 we use ldap_rename function for avoid lose encrypt password { if (! empty($conf->global->DATABASE_PWD_ENCRYPTED)) { @@ -2524,7 +2519,7 @@ class User extends CommonObject } } // Use $this->pass_indatabase value if exists - else if (! empty($this->pass_indatabase)) + elseif (! empty($this->pass_indatabase)) { if (! empty($conf->global->LDAP_FIELD_PASSWORD)) $info[$conf->global->LDAP_FIELD_PASSWORD] = $this->pass_indatabase; // $this->pass_indatabase = mot de passe non crypte if (! empty($conf->global->LDAP_FIELD_PASSWORD_CRYPTED)) $info[$conf->global->LDAP_FIELD_PASSWORD_CRYPTED] = dol_hash($this->pass_indatabase, 4); // md5 for OpenLdap TODO add type of encryption @@ -3020,7 +3015,7 @@ class User extends CommonObject public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { $tables = array( - 'user' + 'user', ); return CommonObject::commonReplaceThirdparty($db, $origin_id, $dest_id, $tables); @@ -3077,7 +3072,7 @@ class User extends CommonObject */ public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0, $moreparams=null) { - global $conf,$user,$langs; + global $conf, $user, $langs; $langs->load("user"); diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 78ef5b7a390..e3ada6efcac 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -1,11 +1,11 @@ - * Copyright (c) 2005-2018 Laurent Destailleur - * Copyright (c) 2005-2018 Regis Houssin - * Copyright (C) 2012 Florian Henry - * Copyright (C) 2014 Juanjo Menent - * Copyright (C) 2014 Alexis Algoud - * Copyright (C) 2018 Nicolas ZABOURI +/* Copyright (c) 2005 Rodolphe Quiedeville + * Copyright (c) 2005-2018 Laurent Destailleur + * Copyright (c) 2005-2018 Regis Houssin + * Copyright (C) 2012 Florian Henry + * Copyright (C) 2014 Juanjo Menent + * Copyright (C) 2014 Alexis Algoud + * Copyright (C) 2018 Nicolas ZABOURI * * 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 @@ -46,6 +46,7 @@ class UserGroup extends CommonObject public $table_element='usergroup'; public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe + public $picto='group'; /** @@ -53,16 +54,26 @@ class UserGroup extends CommonObject */ public $entity; - public $name; // Name of group /** + * @var string * @deprecated * @see name */ - public $nom; // Name of group + public $nom; + + /** + * @var string name + */ + public $name; // Name of group + public $globalgroup; // Global group + public $datec; // Creation date of group + public $datem; // Modification date of group + public $note; // Description + public $members=array(); // Array of users public $nb_rights; // Number of rights granted to the user diff --git a/htdocs/user/group/index.html b/htdocs/user/group/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/user/group/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/user/home.php b/htdocs/user/home.php index f9ccd9aa7ca..d232c3cf7f1 100644 --- a/htdocs/user/home.php +++ b/htdocs/user/home.php @@ -150,7 +150,7 @@ if ($resql) $companystatic->canvas=$obj->canvas; print '
    '; + print ''; print $fuserstatic->getNomUrl(-1); if (! empty($conf->multicompany->enabled) && $obj->admin && ! $obj->entity) { diff --git a/htdocs/user/index.html b/htdocs/user/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/user/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/user/notify/index.html b/htdocs/user/notify/index.html new file mode 100644 index 00000000000..8b137891791 --- /dev/null +++ b/htdocs/user/notify/index.html @@ -0,0 +1 @@ + diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index 62c5386d65d..0d1ea7af03b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -25,8 +25,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php' require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; -$langs->load("products"); -$langs->load("other"); +$langs->loadLangs(array("products", "other")); $var = false; $id = GETPOST('id', 'int'); diff --git a/htdocs/variants/generator.php b/htdocs/variants/generator.php index d07c8bf66d0..afed5c98b16 100644 --- a/htdocs/variants/generator.php +++ b/htdocs/variants/generator.php @@ -24,8 +24,7 @@ require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php' require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination.class.php'; require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductCombination2ValuePair.class.php'; -$langs->load("products"); -$langs->load('other'); +$langs->loadLangs(array("products", "other")); $id = GETPOST('id', 'int'); $ref = GETPOST('ref'); diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 1629a698673..843304fbe45 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -1,10 +1,9 @@ +/* Copyright (C) 2007-2018 Laurent Destailleur * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2018 Frédéric France - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 @@ -158,7 +157,7 @@ class Website extends CommonObject $sql.= 'status,'; $sql.= 'fk_default_home,'; $sql.= 'virtualhost,'; - $sql.= 'fk_user_create,'; + $sql.= 'fk_user_creat,'; $sql.= 'date_creation,'; $sql.= 'tms'; $sql .= ') VALUES ('; @@ -168,7 +167,7 @@ class Website extends CommonObject $sql .= ' '.(! isset($this->status)?'1':$this->status).','; $sql .= ' '.(! isset($this->fk_default_home)?'NULL':$this->fk_default_home).','; $sql .= ' '.(! isset($this->virtualhost)?'NULL':"'".$this->db->escape($this->virtualhost)."'").","; - $sql .= ' '.(! isset($this->fk_user_create)?$user->id:$this->fk_user_create).','; + $sql .= ' '.(! isset($this->fk_user_creat)?$user->id:$this->fk_user_creat).','; $sql .= ' '.(! isset($this->date_creation) || dol_strlen($this->date_creation)==0?'NULL':"'".$this->db->idate($this->date_creation)."'").","; $sql .= ' '.(! isset($this->date_modification) || dol_strlen($this->date_modification)==0?'NULL':"'".$this->db->idate($this->date_creation)."'"); $sql .= ')'; @@ -227,7 +226,7 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; - $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification"; @@ -253,7 +252,7 @@ class Website extends CommonObject $this->status = $obj->status; $this->fk_default_home = $obj->fk_default_home; $this->virtualhost = $obj->virtualhost; - $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); @@ -317,7 +316,7 @@ class Website extends CommonObject $sql .= " t.status,"; $sql .= " t.fk_default_home,"; $sql .= " t.virtualhost,"; - $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification"; @@ -357,7 +356,7 @@ class Website extends CommonObject $line->status = $obj->status; $line->fk_default_home = $obj->fk_default_home; $line->virtualhost = $obj->virtualhost; - $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; $line->date_creation = $this->db->jdate($obj->date_creation); $line->date_modification = $this->db->jdate($obj->date_modification); @@ -639,10 +638,11 @@ class Website extends CommonObject if (! $error) { $filetpl=$pathofwebsitenew.'/page'.$newidforhome.'.tpl.php'; + $filewrapper=$pathofwebsitenew.'/wrapper.php'; // Generate the index.php page to be the home page //------------------------------------------------- - $result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl); + $result = dolSaveIndexPage($pathofwebsitenew, $fileindex, $filetpl, $filewrapper); } } @@ -769,7 +769,7 @@ class Website extends CommonObject $this->status = ''; $this->fk_default_home = null; $this->virtualhost = 'http://myvirtualhost'; - $this->fk_user_create = $user->id; + $this->fk_user_creat = $user->id; $this->fk_user_modif = $user->id; $this->date_creation = dol_now(); $this->tms = dol_now(); @@ -783,7 +783,7 @@ class Website extends CommonObject */ function exportWebSite() { - global $conf; + global $conf, $mysoc; $website = $this; @@ -904,6 +904,9 @@ class Website extends CommonObject $stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport); $stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport); $stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport); $line.= "'".$this->db->escape(str_replace(array("\r\n","\r","\n"), "__N__", $stringtoexport))."', "; // Replace \r \n to have record on 1 line $stringtoexport = $objectpageold->content; @@ -912,6 +915,9 @@ class Website extends CommonObject $stringtoexport = str_replace('file=js/'.$website->ref.'/', "file=js/__WEBSITE_KEY__/", $stringtoexport); $stringtoexport = str_replace('medias/image/'.$website->ref.'/', "medias/image/__WEBSITE_KEY__/", $stringtoexport); $stringtoexport = str_replace('medias/js/'.$website->ref.'/', "medias/js/__WEBSITE_KEY__/", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_small, "file=logos%2Fthumbs%2F__LOGO_SMALL_KEY__", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo_mini, "file=logos%2Fthumbs%2F__LOGO_MINI_KEY__", $stringtoexport); + $stringtoexport = str_replace('file=logos%2Fthumbs%2F'.$mysoc->logo, "file=logos%2Fthumbs%2F__LOGO_KEY__", $stringtoexport); $line.= "'".$this->db->escape($stringtoexport)."'"; // Replace \r \n to have record on 1 line $line.= ");"; $line.= "\n"; @@ -951,7 +957,7 @@ class Website extends CommonObject */ function importWebSite($pathtofile) { - global $conf; + global $conf, $mysoc; $error = 0; @@ -1000,10 +1006,14 @@ class Website extends CommonObject $arrayreplacement['__WEBSITE_ID__'] = $object->id; $arrayreplacement['__WEBSITE_KEY__'] = $object->ref; $arrayreplacement['__N__'] = $this->db->escape("\n"); // Restore \n + $arrayreplacement['__LOGO_SMALL_KEY__'] = $this->db->escape($mysoc->logo_small); + $arrayreplacement['__LOGO_MINI_KEY__'] = $this->db->escape($mysoc->logo_mini); + $arrayreplacement['__LOGO_KEY__'] = $this->db->escape($mysoc->logo); $result = dolReplaceInFile($sqlfile, $arrayreplacement); $this->db->begin(); + // Search the $maxrowid because we need it later $sqlgetrowid='SELECT MAX(rowid) as max from '.MAIN_DB_PREFIX.'website_page'; $resql=$this->db->query($sqlgetrowid); if ($resql) @@ -1012,7 +1022,8 @@ class Website extends CommonObject $maxrowid=$obj->max; } - $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); + // Load sql record + $runsql = run_sql($sqlfile, 1, '', 0, '', 'none', 0, 1); // The maxrowid of table is searched into this function two if ($runsql <= 0) { $this->errors[]='Failed to load sql file '.$sqlfile; @@ -1035,13 +1046,19 @@ class Website extends CommonObject $newid = ($reg[2] + $maxrowid); $aliasesarray = explode(',', $reg[3]); + $objectpagestatic->fetch($newid); + dol_syslog("Found ID ".$oldid." to replace with ID ".$newid." and shortcut aliases to create: ".$reg[3]); dol_move($conf->website->dir_output.'/'.$object->ref.'/page'.$oldid.'.tpl.php', $conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php', 0, 1, 0, 0); + // The move is not enough, so we regenerate page + $filetpl=$conf->website->dir_output.'/'.$object->ref.'/page'.$newid.'.tpl.php'; + dolSavePageContent($filetpl, $object, $objectpagestatic); + + // Regenerate alternative aliases pages foreach($aliasesarray as $aliasshortcuttocreate) { - $objectpagestatic->id = $newid; $filealias=$conf->website->dir_output.'/'.$object->ref.'/'.$aliasshortcuttocreate.'.php'; dolSavePageAlias($filealias, $object, $objectpagestatic); } @@ -1060,4 +1077,77 @@ class Website extends CommonObject return $object->id; } } + + /** + * Component to select language (Full CSS Only) + * + * @param array $languagecodes Language codes array. Example: array('en_US','fr_FR','de_DE','es_ES') + * @param Translate $weblangs Language Object + * @param string $morecss More CSS class on component + * @param string $htmlname Suffix for HTML name + * @return string HTML select component + */ + public function componentSelectLang($languagecodes, $weblangs, $morecss='', $htmlname='') + { + if (! is_object($weblangs)) return 'ERROR componentSelectLang called with parameter $weblangs not defined'; + + $languagecodeselected = $weblangs->defaultlang; + $weblangs->load('languages'); + + $url = $_SERVER["REQUEST_URI"]; + $url = preg_replace('/(\?|&)l=([a-zA-Z_]*)/', '', $url); // We remove param l from url + //$url = preg_replace('/(\?|&)lang=([a-zA-Z_]*)/', '', $url); // We remove param lang from url + $url.= (preg_match('/\?/', $url) ? '&' : '?').'l='; + + $HEIGHTOPTION=40; + $MAXHEIGHT = 4 * $HEIGHTOPTION; + $nboflanguage = count($languagecodes); + + $out.=''."\n"; + $out.= ''; + $out.= '
      '; + if ($languagecodeselected) + { + $shortcode = strtolower(substr($languagecodeselected, -2)); + $label = $weblangs->trans("Language_".$languagecodeselected); + if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label); + $out.= '
    • '.$label; + $out.= ''; + $out.= '
    • '; + } + $i=0; + foreach($languagecodes as $languagecode) + { + if ($languagecode == $languagecodeselected) continue; // Already output + $shortcode = strtolower(substr($languagecode, -2)); + $label = $weblangs->trans("Language_".$languagecode); + if ($shortcode == 'us') $label = preg_replace('/\s*\(.*\)/', '', $label); + $out.= '
    • '.$label; + if (empty($i) && empty($languagecodeselected)) $out.= ''; + $out.= '
    • '; + $i++; + } + $out.= '
    '; + + return $out; + } } diff --git a/htdocs/website/class/websitepage.class.php b/htdocs/website/class/websitepage.class.php index e60a0d2bcfe..97aba5e6ac2 100644 --- a/htdocs/website/class/websitepage.class.php +++ b/htdocs/website/class/websitepage.class.php @@ -1,9 +1,8 @@ +/* Copyright (C) 2007-2018 Laurent Destailleur * Copyright (C) 2014 Juanjo Menent * Copyright (C) 2015 Florian Henry * Copyright (C) 2015 Raphaël Doursenaud - * Copyright (C) ---Put here your own copyright and developer email--- * * 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 @@ -92,8 +91,8 @@ class WebsitePage extends CommonObject 'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>500), 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-1, 'notnull'=>1, 'position'=>501), //'date_valid' =>array('type'=>'datetime', 'label'=>'DateValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>502), - //'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510), - //'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-1, 'notnull'=>true, 'position'=>510), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-1, 'position'=>511), //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-1, 'index'=>1, 'position'=>1000, 'notnull'=>-1), ); @@ -130,7 +129,7 @@ class WebsitePage extends CommonObject * Load object in memory from the database * * @param int $id Id object. - * - If this is 0, the value into $page will be used. If not found of $page not defined, the default page of website_id will be used or the first page found if not set. + * - If this is 0, the value into $page will be used. If not found or $page not defined, the default page of website_id will be used or the first page found if not set. * - If value is < 0, we must exclude this ID. * @param string $website_id Web site id (page name must also be filled if this parameter is used) * @param string $page Page name (website id must also be filled if this parameter is used) @@ -159,7 +158,7 @@ class WebsitePage extends CommonObject $sql .= " t.grabbed_from,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification,"; - $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; //$sql .= ' WHERE entity IN ('.getEntity('website').')'; // entity is on website level @@ -202,7 +201,7 @@ class WebsitePage extends CommonObject $this->grabbed_from = $obj->grabbed_from; $this->date_creation = $this->db->jdate($obj->date_creation); $this->date_modification = $this->db->jdate($obj->date_modification); - $this->fk_user_create = $obj->fk_user_create; + $this->fk_user_creat = $obj->fk_user_creat; $this->fk_user_modif = $obj->fk_user_modif; } $this->db->free($resql); @@ -255,7 +254,7 @@ class WebsitePage extends CommonObject $sql .= " t.grabbed_from,"; $sql .= " t.date_creation,"; $sql .= " t.tms as date_modification,"; - $sql .= " t.fk_user_create,"; + $sql .= " t.fk_user_creat,"; $sql .= " t.fk_user_modif"; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' WHERE t.fk_website = '.$websiteid; @@ -271,11 +270,11 @@ class WebsitePage extends CommonObject } } if (count($sqlwhere) > 0) { - $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere); + $sql .= ' AND (' . implode(' '.$filtermode.' ', $sqlwhere).')'; } if (!empty($sortfield)) { - $sql .= $this->db->order($sortfield,$sortorder); + $sql .= $this->db->order($sortfield, $sortorder); } if (!empty($limit)) { $sql .= ' ' . $this->db->plimit($limit, $offset); @@ -305,7 +304,7 @@ class WebsitePage extends CommonObject $record->grabbed_from = $obj->grabbed_from; $record->date_creation = $this->db->jdate($obj->date_creation); $record->date_modification = $this->db->jdate($obj->date_modification); - $record->fk_user_create = $obj->fk_user_create; + $record->fk_user_creat = $obj->fk_user_creat; $record->fk_user_modif = $obj->fk_user_modif; //var_dump($record->id); $records[$record->id] = $record; @@ -401,7 +400,7 @@ class WebsitePage extends CommonObject $object->ref = $newref; $object->pageurl = $newref; $object->aliasalt = ''; - $object->fk_user_create = $user->id; + $object->fk_user_creat = $user->id; $object->title = ($keeptitleunchanged ? '' : $langs->trans("CopyOf").' ').$object->title; if (! empty($newlang)) $object->lang=$newlang; if ($istranslation) $object->fk_page = $fromid; @@ -555,6 +554,6 @@ class WebsitePage extends CommonObject $this->grabbed_from = ''; $this->date_creation = $now - (24 * 30 * 3600); $this->date_modification = $now - (24 * 7 * 3600); - $this->fk_user_create = $user->id; + $this->fk_user_creat = $user->id; } } diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 590423de2e4..1d277c32ed7 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -92,7 +92,7 @@ if (empty($action)) $action='preview'; $object=new Website($db); $objectpage=new WebsitePage($db); -$object->fetchAll(); // Init $object->records +$object->fetchAll(); // Init $object->records with list of websites // If website not defined, we take first found if (empty($websitekey)) @@ -109,28 +109,63 @@ if ($websitekey) } $website = $object; +// Check pageid received as aprameter if ($pageid < 0) $pageid = 0; if (($pageid > 0 || $pageref) && $action != 'addcontainer') { $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref); - //var_dump($res);exit; - //if ($res == 0) // Page ref not found, we check in alias - //{ - // $res = $objectpage->fetch($pageid, ($object->id > 0 ? $object->id : null), $pageref); - //} // Check if pageid is inside the new website, if not we reset param pageid - if ($object->id > 0 && ($objectpage->fk_website != $object->id)) + if ($res >= 0 && $object->id > 0) { - $res = $objectpage->fetch(0, $object->id, '');; - if ($res == 0) // Page was not found, we reset it + if ($objectpage->fk_website != $object->id) // We have a bad page that does not belong to web site { - $objectpage=new WebsitePage($db); + if ($object->fk_default_home > 0) + { + $res = $objectpage->fetch($object->fk_default_home, $object->id, ''); // We search first page of web site + if ($res > 0) $pageid = $object->fk_default_home; + } + else + { + $res = $objectpage->fetch(0, $object->id, ''); // We search first page of web site + if ($res == 0) // Page was not found, we reset it + { + $objectpage=new WebsitePage($db); + } + else // We found a page, we set pageid to it. + { + $pageid = $objectpage->id; + } + } + } + else // We have a valid page. We force pageid for the case we got the page with a fetch on ref. + { + $pageid = $objectpage->id; } } - $pageid = $objectpage->id; } +// Define pageid if pageid and pageref not received as parameter or was wrong +if (empty($pageid) && empty($pageref) && $object->id > 0 && $action != 'createcontainer') +{ + $pageid = $object->fk_default_home; + if (empty($pageid)) + { + $array=$objectpage->fetchAll($object->id, 'ASC,ASC', 'type_container,pageurl'); + if (! is_array($array) && $array < 0) dol_print_error('', $objectpage->error, $objectpage->errors); + $atleastonepage=(is_array($array) && count($array) > 0); + + $firstpageid=0;$homepageid=0; + foreach($array as $key => $valpage) + { + if (empty($firstpageid)) $firstpageid=$valpage->id; + if ($object->fk_default_home && $key == $object->fk_default_home) $homepageid=$valpage->id; + } + $pageid=($homepageid?$homepageid:$firstpageid); // We choose home page and if not defined yet, we take first page + } +} + + global $dolibarr_main_data_root; $pathofwebsite=$dolibarr_main_data_root.'/website/'.$websitekey; $filehtmlheader=$pathofwebsite.'/htmlheader.html'; @@ -180,6 +215,7 @@ if ($action == 'renamefile') $action='file_manager'; // After actions_linkedfil if ($action == 'seteditinline') { dolibarr_set_const($db, 'WEBSITE_EDITINLINE', 1); + setEventMessages($langs->trans("FeatureNotYetAvailable"), null, 'warnings'); dolibarr_set_const($db, 'WEBSITE_SUBCONTAINERSINLINE', 0); // Force disable of show included containers header("Location: ".$_SERVER["PHP_SELF"].'?website='.GETPOST('website','alphanohtml').'&pageid='.GETPOST('pageid','int')); exit; @@ -360,7 +396,7 @@ if ($action == 'addcontainer') // Remove comments $tmp['content'] = removeHtmlComment($tmp['content']); - preg_match('/(.*)<\/head>/is', $tmp['content'], $reg); + preg_match('/(.*)<\/head>/ims', $tmp['content'], $reg); $head = $reg[1]; $objectpage->type_container = 'page'; @@ -820,7 +856,7 @@ if ($action == 'updatecss') /* We disable php code since htmlheader is never executed as an include but only read by fgets_content. $htmlheadercontent.= "begin(); + $objectnew = new Website($db); $result = $objectnew->createFromClone($user, GETPOST('id','int'), GETPOST('siteref','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):'')); if ($result < 0) @@ -1210,6 +1248,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf $error++; setEventMessages($objectnew->error, $objectnew->errors, 'errors'); $action='preview'; + + $db->rollback(); } else { @@ -1217,6 +1257,8 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf $id = $object->id; $pageid = $object->fk_default_home; $websitekey = GETPOST('siteref','aZ09'); + + $db->commit(); } } @@ -1235,17 +1277,51 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf if (! $error) { + $db->begin(); + + $newwebsiteid = GETPOST('newwebsite','int'); + $pathofwebsitenew = $pathofwebsite; + + $tmpwebsite=new Website($db); + if ($newwebsiteid > 0 && $newwebsiteid != $object->id) + { + $tmpwebsite->fetch($newwebsiteid); + $pathofwebsitenew = $dolibarr_main_data_root.'/website/'.$tmpwebsite->ref; + } + else + { + $tmpwebsite = $object; + } + $objectpage = new WebsitePage($db); - $result = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, GETPOST('newwebsite','int')); - if ($result < 0) + $resultpage = $objectpage->createFromClone($user, $pageid, GETPOST('pageurl','aZ09'), (GETPOST('newlang','aZ09')?GETPOST('newlang','aZ09'):''), $istranslation, $newwebsiteid); + if ($resultpage < 0) { $error++; setEventMessages($objectpage->error, $objectpage->errors, 'errors'); $action='createpagefromclone'; + + $db->rollback(); } else { - // TODO Switch on the new page ? + $fileindex=$pathofwebsitenew.'/index.php'; + $filetpl=$pathofwebsitenew.'/page'.$resultpage->id.'.tpl.php'; + $filewrapper=$pathofwebsitenew.'/wrapper.php'; + + //var_dump($pathofwebsitenew); + //var_dump($filetpl); + //exit; + + dolSavePageContent($filetpl, $tmpwebsite, $resultpage); + + // Switch on the new page if web site of new page/container is same + if (empty($newwebsiteid) || $newwebsiteid == $object->id) + { + $pageid = $resultpage->id; + } + + $db->commit(); } } } @@ -1299,7 +1375,7 @@ if (($action == 'updatesource' || $action == 'updatecontent' || $action == 'conf $objectpage->content = GETPOST('PAGE_CONTENT','none'); // Clean data. We remove all the head section. - $objectpage->content = preg_replace('/.*<\/head>/s', '', $objectpage->content); + $objectpage->content = preg_replace('/.*<\/head>/ims', '', $objectpage->content); /* $objectpage->content = preg_replace('//s', '', $objectpage->content); */ @@ -1566,7 +1642,7 @@ if (! GETPOST('hide_websitemenu')) //var_dump($objectpage);exit; print '
    '; -if (count($object->records) > 0) +if (count($object->records) > 0) // There is at least one web site { // ***** Part for web sites @@ -1662,7 +1738,8 @@ if (count($object->records) > 0) print '
    '; - // Toolbar for website + // Toolbar for websites + print '
    '; if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpagefromclone') @@ -1762,7 +1839,7 @@ if (count($object->records) > 0) $out.=''; @@ -1868,16 +1945,15 @@ if (count($object->records) > 0) print '
    '; print '
    '; + print $langs->trans("EditInLine"); if ($websitepage->grabbed_from) { //print ''; - $langs->trans("EditInLine"); - print ''.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').''; + print ''.img_picto($langs->trans("OnlyEditionOfSourceForGrabbedContent"),'switch_off','',false,0,0,'','nomarginleft').''; } else { //print ''; - print $langs->trans("EditInLine"); if (empty($conf->global->WEBSITE_EDITINLINE)) { print ''.img_picto($langs->trans("EditInLineOff"),'switch_off','',false,0,0,'','nomarginleft').''; @@ -1890,13 +1966,20 @@ if (count($object->records) > 0) print '
    '; print ''; print '
    '; @@ -2319,6 +2402,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print '
    '; print $langs->trans("URL"); print ''; + print info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, 'warning'); print ' '; print ' '.$langs->trans("GrabImagesInto"); print ' '; @@ -2327,7 +2411,6 @@ if ($action == 'editmeta' || $action == 'createcontainer') print $form->selectarray('grabimagesinto', $arraygrabimagesinto, GETPOSTISSET('grabimagesinto')?GETPOST('grabimagesinto'):'root'); print '
    '; print ''; - print '
    '.info_admin($langs->trans("OnlyEditionOfSourceForGrabbedContentFuture"), 0, 0, '1'); print '
    '; @@ -2347,7 +2430,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print ''; - print $langs->trans('WEBSITE_PAGEURL'); + print $langs->trans('InternalURLOfPage'); print ''; print '/public/website/index.php?website='.urlencode($websitekey).'&pageid='.urlencode($pageid); print ''; @@ -2368,10 +2451,15 @@ if ($action == 'editmeta' || $action == 'createcontainer') $pagekeywords=$objectpage->keywords; $pagelang=$objectpage->lang; $pagehtmlheader=$objectpage->htmlheader; + $pagedatecreation=$objectpage->date_creation; + $pagedatemodification=$objectpage->date_modification; + $pageauthorid=$objectpage->fk_user_create; } else { $type_container = 'page'; + $pagedatecreation=dol_now(); + $pageauthorid=$user->id; } if (GETPOST('WEBSITE_TITLE','alpha')) $pagetitle=GETPOST('WEBSITE_TITLE','alpha'); if (GETPOST('WEBSITE_PAGENAME','alpha')) $pageurl=GETPOST('WEBSITE_PAGENAME','alpha'); @@ -2395,6 +2483,7 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print ''; + // Type of container print ''; print $langs->trans('WEBSITE_TYPE_CONTAINER'); print ''; @@ -2435,13 +2524,37 @@ if ($action == 'editmeta' || $action == 'createcontainer') print ''; print ''; + $fuser=new User($db); + $fuser->fetch($pageauthorid); + + print ''; + print $langs->trans('Author'); + print ''; + if ($pageauthorid > 0) print $fuser->getNomUrl(1); + print ''; + + print ''; + print $langs->trans('DateCreation'); + print ''; + print dol_print_date($pagedatecreation, 'dayhour'); + print ''; + + if ($action != 'createcontainer') + { + print ''; + print $langs->trans('DateModification'); + print ''; + print dol_print_date($pagedatemodification, 'dayhour'); + print ''; + } + print ''; $htmlhelp=$langs->trans("EditTheWebSiteForACommonHeader").'

    '; $htmlhelp=$langs->trans("Example").' :
    '; $htmlhelp.=dol_htmlentitiesbr($htmlheadercontentdefault); print $form->textwithpicto($langs->trans('HtmlHeaderPage'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip'); print ''; - $doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '180', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $doleditor=new DolEditor('htmlheader', $pagehtmlheader, '', '120', 'ace', 'In', true, false, 'ace', ROWS_3, '100%', ''); print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print ''; @@ -2507,31 +2620,34 @@ if ($action == 'editmenu') if ($action == 'editsource') { - /* - * Editing with source editor - */ + // Editing with source editor $contentforedit = ''; - /*$contentforedit.=''."\n";*/ + //$contentforedit.=''."\n"; $contentforedit .= $objectpage->content; - + //var_dump($_SESSION["dol_screenheight"]); + $maxheightwin=480; + if (isset($_SESSION["dol_screenheight"])) + { + if ($_SESSION["dol_screenheight"] > 680) $maxheightwin = $_SESSION["dol_screenheight"]-400; + if ($_SESSION["dol_screenheight"] > 800) $maxheightwin = $_SESSION["dol_screenheight"]-490; + } + //var_dump($_SESSION["dol_screenheight"]); require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; - $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',500,'Full','',true,true,'ace',ROWS_5,'90%'); + $doleditor=new DolEditor('PAGE_CONTENT',$contentforedit,'',$maxheightwin,'Full','',true,true,'ace',ROWS_5,'40%'); $doleditor->Create(0, '', false, 'HTML Source', 'php'); } -if ($action == 'editcontent') +/*if ($action == 'editcontent') { - /* - * Editing with default ckeditor - */ + // Editing with default ckeditor $contentforedit = ''; - /*$contentforedit.=''."\n";*/ + //$contentforedit.=''."\n"; $contentforedit .= $objectpage->content; $contentforedit = preg_replace('/(Create(0, '', false); -} +}*/ print "
    \n\n"; @@ -2556,16 +2672,21 @@ if ($action == 'preview' || $action == 'createfromclone' || $action == 'createpa $objectpage->fetch($pageid); $jscontent = @file_get_contents($filejs); - $out = ''."\n"; + $out = ''."\n"; // Include a html so we can benefit of the header of page. // Note: We can't use iframe as it can be used to include another external html file // Note: We can't use frame as it is deprecated. + /*if ($includepageintoaframeoradiv == 'iframe') + { + $out .= "