2005-10-13 23:39:38 +02:00
< ? php
2011-12-28 09:26:36 +01:00
/* Copyright ( C ) 2004 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2009-04-27 22:37:50 +02:00
* Copyright ( C ) 2006 Andre Cianfarani < acianfa @ free . fr >
2007-01-05 16:34:43 +01:00
* Copyright ( C ) 2006 - 2007 Rodolphe Quiedeville < rodolphe @ quiedeville . org >
2009-04-27 22:37:50 +02:00
* Copyright ( C ) 2007 Auguria SARL < info @ auguria . org >
2018-10-27 14:43:12 +02:00
* Copyright ( C ) 2005 - 2012 Regis Houssin < regis . houssin @ inodbox . com >
2012-03-29 10:54:48 +02:00
* Copyright ( C ) 2011 - 2012 Juanjo Menent < jmenent @ 2 byte . es >
2016-08-05 00:42:40 +02:00
* Copyright ( C ) 2012 Christophe Battarel < christophe . battarel @ altairis . fr >
2015-02-26 14:15:33 +01:00
* Copyright ( C ) 2012 Cedric Salvador < csalvador @ gpcsolutions . fr >
2016-08-05 00:42:40 +02:00
* Copyright ( C ) 2016 Charlie Benke < charlie @ patas - monkey . com >
2016-08-01 10:20:10 +02:00
* Copyright ( C ) 2016 Ferran Marcet < fmarcet @ 2 byte . es >
2015-02-26 14:15:33 +01:00
*
2005-10-13 23:39:38 +02:00
* 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
2013-01-16 15:36:08 +01:00
* the Free Software Foundation ; either version 3 of the License , or
2005-10-13 23:39:38 +02:00
* ( 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
2019-09-23 21:55:30 +02:00
* along with this program . If not , see < https :// www . gnu . org / licenses />.
2005-10-13 23:39:38 +02:00
*/
/**
2012-04-16 12:01:32 +02:00
* \file htdocs / product / admin / product . php
2010-03-01 10:20:41 +01:00
* \ingroup produit
2012-04-16 12:01:32 +02:00
* \brief Setup page of product module
2008-08-28 02:31:27 +02:00
*/
2005-10-13 23:39:38 +02:00
2012-08-22 23:24:21 +02:00
require '../../main.inc.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php' ;
require_once DOL_DOCUMENT_ROOT . '/core/lib/product.lib.php' ;
2017-04-12 19:30:01 +02:00
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
2012-08-22 23:11:24 +02:00
require_once DOL_DOCUMENT_ROOT . '/core/class/html.formbarcode.class.php' ;
2005-10-13 23:39:38 +02:00
2018-05-26 17:57:30 +02:00
// Load translation files required by the page
2020-02-21 17:53:37 +01:00
$langs -> loadLangs ( array ( " admin " , " products " ));
2005-10-13 23:39:38 +02:00
2008-10-24 23:36:12 +02:00
// Security check
2021-02-26 14:25:17 +01:00
if ( ! $user -> admin || ( empty ( $conf -> product -> enabled ) && empty ( $conf -> service -> enabled ))) {
2012-08-03 11:56:42 +02:00
accessforbidden ();
2021-02-26 14:25:17 +01:00
}
2005-10-13 23:39:38 +02:00
2020-09-16 19:39:50 +02:00
$action = GETPOST ( 'action' , 'aZ09' );
2019-01-27 11:55:16 +01:00
$value = GETPOST ( 'value' , 'alpha' );
2022-01-22 15:33:47 +01:00
$modulepart = GETPOST ( 'modulepart' , 'aZ09' ); // Used by actions_setmoduleoptions.inc.php
2019-01-27 11:55:16 +01:00
$label = GETPOST ( 'label' , 'alpha' );
$scandir = GETPOST ( 'scan_dir' , 'alpha' );
2020-02-21 17:53:37 +01:00
$type = 'product' ;
2005-10-13 23:39:38 +02:00
2014-02-23 16:16:47 +01:00
// Pricing Rules
2020-02-21 17:53:37 +01:00
$select_pricing_rules = array (
'PRODUCT_PRICE_UNIQ' => $langs -> trans ( 'PriceCatalogue' ), // Unique price
'PRODUIT_MULTIPRICES' => $langs -> trans ( 'MultiPricesAbility' ), // Several prices according to a customer level
'PRODUIT_CUSTOMER_PRICES' => $langs -> trans ( 'PriceByCustomer' ), // Different price for each customer
2014-02-23 16:16:47 +01:00
);
2020-02-21 17:53:37 +01:00
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY' ;
2021-02-26 14:25:17 +01:00
if ( $conf -> global -> MAIN_FEATURES_LEVEL >= 1 || ! empty ( $conf -> global -> $keyforparam )) {
$select_pricing_rules [ 'PRODUIT_CUSTOMER_PRICES_BY_QTY' ] = $langs -> trans ( 'PriceByQuantity' ) . ' (' . $langs -> trans ( " VersionExperimental " ) . ')' ; // TODO If this is enabled, price must be hidden when price by qty is enabled, also price for quantity must be used when adding product into order/propal/invoice
}
2020-02-21 17:53:37 +01:00
$keyforparam = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES' ;
2021-02-26 14:25:17 +01:00
if ( $conf -> global -> MAIN_FEATURES_LEVEL >= 2 || ! empty ( $conf -> global -> $keyforparam )) {
$select_pricing_rules [ 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES' ] = $langs -> trans ( 'MultiPricesAbility' ) . '+' . $langs -> trans ( 'PriceByQuantity' ) . ' (' . $langs -> trans ( " VersionExperimental " ) . ')' ;
}
2014-02-23 16:16:47 +01:00
2015-04-02 19:41:19 +02:00
// Clean param
2020-02-21 17:53:37 +01:00
if ( ! empty ( $conf -> global -> PRODUIT_MULTIPRICES ) && empty ( $conf -> global -> PRODUIT_MULTIPRICES_LIMIT )) {
2016-03-02 11:38:40 +01:00
dolibarr_set_const ( $db , 'PRODUIT_MULTIPRICES_LIMIT' , 5 , 'chaine' , 0 , '' , $conf -> entity );
}
2015-04-02 19:41:19 +02:00
2017-04-12 19:30:01 +02:00
$error = 0 ;
2015-04-02 19:41:19 +02:00
2011-10-03 22:48:10 +02:00
/*
* Actions
*/
2015-07-20 13:03:12 +02:00
2020-02-21 17:53:37 +01:00
$nomessageinsetmoduleoptions = 1 ;
2017-06-01 12:11:45 +02:00
include DOL_DOCUMENT_ROOT . '/core/actions_setmoduleoptions.inc.php' ;
2021-02-26 14:25:17 +01:00
if ( $action == 'setcodeproduct' ) {
if ( dolibarr_set_const ( $db , " PRODUCT_CODEPRODUCT_ADDON " , $value , 'chaine' , 0 , '' , $conf -> entity ) > 0 ) {
2012-08-31 05:58:38 +02:00
header ( " Location: " . $_SERVER [ " PHP_SELF " ]);
2012-08-09 01:41:55 +02:00
exit ;
2020-05-21 15:05:19 +02:00
} else {
2012-08-09 01:41:55 +02:00
dol_print_error ( $db );
}
}
2021-02-26 14:25:17 +01:00
if ( $action == 'other' && GETPOST ( 'value_PRODUIT_LIMIT_SIZE' ) >= 0 ) {
2019-01-27 11:55:16 +01:00
$res = dolibarr_set_const ( $db , " PRODUIT_LIMIT_SIZE " , GETPOST ( 'value_PRODUIT_LIMIT_SIZE' ), 'chaine' , 0 , '' , $conf -> entity );
2021-02-26 14:25:17 +01:00
if ( ! ( $res > 0 )) {
$error ++ ;
}
2005-10-13 23:39:38 +02:00
}
2021-02-26 14:25:17 +01:00
if ( $action == 'other' && GETPOST ( 'value_PRODUIT_MULTIPRICES_LIMIT' ) > 0 ) {
2019-01-27 11:55:16 +01:00
$res = dolibarr_set_const ( $db , " PRODUIT_MULTIPRICES_LIMIT " , GETPOST ( 'value_PRODUIT_MULTIPRICES_LIMIT' ), 'chaine' , 0 , '' , $conf -> entity );
2021-02-26 14:25:17 +01:00
if ( ! ( $res > 0 )) {
$error ++ ;
}
2006-02-03 17:42:39 +01:00
}
2021-02-26 14:25:17 +01:00
if ( $action == 'other' ) {
2019-01-27 11:55:16 +01:00
$princingrules = GETPOST ( 'princingrule' , 'alpha' );
2021-02-26 14:25:17 +01:00
foreach ( $select_pricing_rules as $rule => $label ) { // Loop on each possible mode
if ( $rule == $princingrules ) { // We are on selected rule, we enable it
if ( $princingrules == 'PRODUCT_PRICE_UNIQ' ) { // For this case, we disable entries manually
2014-05-01 11:54:48 +02:00
$res = dolibarr_set_const ( $db , 'PRODUIT_MULTIPRICES' , 0 , 'chaine' , 0 , '' , $conf -> entity );
$res = dolibarr_set_const ( $db , 'PRODUIT_CUSTOMER_PRICES_BY_QTY' , 0 , 'chaine' , 0 , '' , $conf -> entity );
$res = dolibarr_set_const ( $db , 'PRODUIT_CUSTOMER_PRICES' , 0 , 'chaine' , 0 , '' , $conf -> entity );
dolibarr_set_const ( $db , 'PRODUCT_PRICE_UNIQ' , 1 , 'chaine' , 0 , '' , $conf -> entity );
2020-05-21 15:05:19 +02:00
} else {
2020-02-21 17:53:37 +01:00
$multirule = explode ( '&' , $princingrules );
2021-02-26 14:25:17 +01:00
foreach ( $multirule as $rulesselected ) {
2014-05-01 11:54:48 +02:00
$res = dolibarr_set_const ( $db , $rulesselected , 1 , 'chaine' , 0 , '' , $conf -> entity );
2014-02-23 16:16:47 +01:00
}
}
2020-05-21 15:05:19 +02:00
} else // We clear this mode
2014-05-01 11:54:48 +02:00
{
2020-02-21 17:53:37 +01:00
if ( strpos ( $rule , '&' ) === false ) {
2014-05-01 11:54:48 +02:00
$res = dolibarr_set_const ( $db , $rule , 0 , 'chaine' , 0 , '' , $conf -> entity );
2014-02-23 16:16:47 +01:00
}
}
2014-10-04 17:20:17 +02:00
}
2017-04-12 19:30:01 +02:00
2020-05-03 19:47:10 +02:00
$value = GETPOST ( 'price_base_type' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUCT_PRICE_BASE_TYPE " , $value , 'chaine' , 0 , '' , $conf -> entity );
2020-05-03 19:50:10 +02:00
2020-12-15 11:10:35 +01:00
/* $value = GETPOST ( 'PRODUIT_SOUSPRODUITS' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_SOUSPRODUITS " , $value , 'chaine' , 0 , '' , $conf -> entity ); */
2017-04-12 19:30:01 +02:00
2019-01-27 11:55:16 +01:00
$value = GETPOST ( 'activate_viewProdDescInForm' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_DESC_IN_FORM " , $value , 'chaine' , 0 , '' , $conf -> entity );
2017-04-12 19:30:01 +02:00
2019-01-27 11:55:16 +01:00
$value = GETPOST ( 'activate_viewProdTextsInThirdpartyLanguage' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE " , $value , 'chaine' , 0 , '' , $conf -> entity );
2017-04-12 19:30:01 +02:00
2019-01-27 11:55:16 +01:00
$value = GETPOST ( 'activate_mergePropalProductCard' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_PDF_MERGE_PROPAL " , $value , 'chaine' , 0 , '' , $conf -> entity );
2017-04-12 19:30:01 +02:00
2019-01-27 11:55:16 +01:00
$value = GETPOST ( 'activate_usesearchtoselectproduct' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_USE_SEARCH_TO_SELECT " , $value , 'chaine' , 0 , '' , $conf -> entity );
2019-05-21 15:31:56 +02:00
2020-10-28 16:37:41 +01:00
$value = GETPOST ( 'activate_FillProductDescAuto' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_AUTOFILL_DESC " , $value , 'chaine' , 0 , '' , $conf -> entity );
2022-03-14 11:19:08 +01:00
$value = GETPOST ( 'PRODUIT_FOURN_TEXTS' , 'alpha' );
$res = dolibarr_set_const ( $db , " PRODUIT_FOURN_TEXTS " , $value , 'chaine' , 0 , '' , $conf -> entity );
$value = GETPOST ( 'PRODUCT_USE_SUPPLIER_PACKAGING' , 'alpha' );
2019-11-25 08:08:22 +01:00
$res = dolibarr_set_const ( $db , " PRODUCT_USE_SUPPLIER_PACKAGING " , $value , 'chaine' , 0 , '' , $conf -> entity );
2006-12-01 16:37:26 +01:00
}
2016-02-04 16:17:45 +01:00
2022-03-14 11:19:08 +01:00
2021-02-26 14:25:17 +01:00
if ( $action == 'specimen' ) { // For products
2020-02-21 17:53:37 +01:00
$modele = GETPOST ( 'module' , 'alpha' );
2016-02-04 16:17:45 +01:00
2017-04-12 19:30:01 +02:00
$product = new Product ( $db );
$product -> initAsSpecimen ();
2016-02-04 16:17:45 +01:00
// Search template files
2020-02-21 17:53:37 +01:00
$file = '' ; $classname = '' ; $filefound = 0 ;
$dirmodels = array_merge ( array ( '/' ), ( array ) $conf -> modules_parts [ 'models' ]);
2021-02-26 14:25:17 +01:00
foreach ( $dirmodels as $reldir ) {
2020-10-31 14:32:18 +01:00
$file = dol_buildpath ( $reldir . " core/modules/product/doc/pdf_ " . $modele . " .modules.php " , 0 );
2021-02-26 14:25:17 +01:00
if ( file_exists ( $file )) {
2020-02-21 17:53:37 +01:00
$filefound = 1 ;
2016-02-04 16:17:45 +01:00
$classname = " pdf_ " . $modele ;
break ;
}
}
2021-02-26 14:25:17 +01:00
if ( $filefound ) {
2016-02-04 16:17:45 +01:00
require_once $file ;
$module = new $classname ( $db );
2021-02-26 14:25:17 +01:00
if ( $module -> write_file ( $product , $langs , '' ) > 0 ) {
2017-04-12 19:30:01 +02:00
header ( " Location: " . DOL_URL_ROOT . " /document.php?modulepart=product&file=SPECIMEN.pdf " );
2016-02-04 16:17:45 +01:00
return ;
2020-05-21 15:05:19 +02:00
} else {
2018-07-25 15:36:50 +02:00
setEventMessages ( $obj -> error , $obj -> errors , 'errors' );
2016-02-04 16:17:45 +01:00
dol_syslog ( $obj -> error , LOG_ERR );
}
2020-05-21 15:05:19 +02:00
} else {
2018-07-25 15:36:50 +02:00
setEventMessages ( $langs -> trans ( " ErrorModuleNotFound " ), null , 'errors' );
2016-02-04 16:17:45 +01:00
dol_syslog ( $langs -> trans ( " ErrorModuleNotFound " ), LOG_ERR );
}
}
// Activate a model
2021-02-26 14:25:17 +01:00
if ( $action == 'set' ) {
2016-02-04 16:17:45 +01:00
$ret = addDocumentModel ( $value , $type , $label , $scandir );
}
2021-02-26 14:25:17 +01:00
if ( $action == 'del' ) {
2016-02-04 16:17:45 +01:00
$ret = delDocumentModel ( $value , $type );
2021-02-26 14:25:17 +01:00
if ( $ret > 0 ) {
if ( $conf -> global -> PRODUCT_ADDON_PDF == " $value " ) {
dolibarr_del_const ( $db , 'PRODUCT_ADDON_PDF' , $conf -> entity );
}
2016-02-04 16:17:45 +01:00
}
}
// Set default model
2021-02-26 14:25:17 +01:00
if ( $action == 'setdoc' ) {
if ( dolibarr_set_const ( $db , " PRODUCT_ADDON_PDF " , $value , 'chaine' , 0 , '' , $conf -> entity )) {
2016-02-04 16:17:45 +01:00
// La constante qui a ete lue en avant du nouveau set
// on passe donc par une variable pour avoir un affichage coherent
$conf -> global -> PRODUCT_ADDON_PDF = $value ;
}
// On active le modele
$ret = delDocumentModel ( $value , $type );
2021-02-26 14:25:17 +01:00
if ( $ret > 0 ) {
2016-02-04 16:17:45 +01:00
$ret = addDocumentModel ( $value , $type , $label , $scandir );
}
}
2021-02-26 14:25:17 +01:00
if ( $action == 'set' ) {
2019-01-27 11:55:16 +01:00
$const = " PRODUCT_SPECIAL_ " . strtoupper ( GETPOST ( 'spe' , 'alpha' ));
2015-07-20 13:03:12 +02:00
$value = GETPOST ( 'value' );
2021-02-26 14:25:17 +01:00
if ( GETPOST ( 'value' , 'alpha' )) {
$res = dolibarr_set_const ( $db , $const , $value , 'chaine' , 0 , '' , $conf -> entity );
} else {
$res = dolibarr_del_const ( $db , $const , $conf -> entity );
}
if ( ! ( $res > 0 )) {
$error ++ ;
}
2006-06-08 11:46:25 +02:00
}
2011-09-02 15:47:10 +02:00
2022-03-14 11:19:08 +01:00
// To enable a constant whithout javascript
if ( preg_match ( '/set_(.+)/' , $action , $reg )) {
$keyforvar = $reg [ 1 ];
if ( $keyforvar ) {
$value = 1 ;
$res = dolibarr_set_const ( $db , $keyforvar , $value , 'chaine' , 0 , '' , $conf -> entity );
}
}
// To disable a constant whithout javascript
if ( preg_match ( '/del_(.+)/' , $action , $reg )) {
$keyforvar = $reg [ 1 ];
if ( $keyforvar ) {
$res = dolibarr_del_const ( $db , $keyforvar , $conf -> entity );
}
}
2015-02-26 14:15:33 +01:00
2021-02-26 14:25:17 +01:00
if ( $action ) {
if ( ! $error ) {
2020-10-31 14:32:18 +01:00
setEventMessages ( $langs -> trans ( " SetupSaved " ), null , 'mesgs' );
} else {
setEventMessages ( $langs -> trans ( " SetupNotError " ), null , 'errors' );
}
2011-09-02 15:47:10 +02:00
}
2005-10-13 23:39:38 +02:00
/*
2011-03-05 14:56:09 +01:00
* View
2005-10-13 23:39:38 +02:00
*/
2020-02-21 17:53:37 +01:00
$formbarcode = new FormBarCode ( $db );
2008-01-03 20:02:40 +01:00
2011-12-28 09:26:36 +01:00
$title = $langs -> trans ( 'ProductServiceSetup' );
$tab = $langs -> trans ( " ProductsAndServices " );
2021-02-26 14:25:17 +01:00
if ( empty ( $conf -> product -> enabled )) {
2011-12-28 09:26:36 +01:00
$title = $langs -> trans ( 'ServiceSetup' );
$tab = $langs -> trans ( 'Services' );
2021-02-26 14:25:17 +01:00
} elseif ( empty ( $conf -> service -> enabled )) {
2011-12-28 09:26:36 +01:00
$title = $langs -> trans ( 'ProductSetup' );
$tab = $langs -> trans ( 'Products' );
}
2019-01-27 11:55:16 +01:00
llxHeader ( '' , $title );
2005-10-13 23:39:38 +02:00
2020-02-21 17:53:37 +01:00
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php?restore_lastsearch_values=1">' . $langs -> trans ( " BackToModuleList " ) . '</a>' ;
2019-01-27 11:55:16 +01:00
print load_fiche_titre ( $title , $linkback , 'title_setup' );
2005-10-13 23:39:38 +02:00
2012-05-22 18:35:14 +02:00
$head = product_admin_prepare_head ();
2020-10-22 22:50:03 +02:00
print dol_get_fiche_head ( $head , 'general' , $tab , - 1 , 'product' );
2011-03-05 14:56:09 +01:00
2020-02-21 17:53:37 +01:00
$form = new Form ( $db );
2012-08-09 01:41:55 +02:00
2017-04-12 19:30:01 +02:00
// Module to manage product / services code
2020-02-21 17:53:37 +01:00
$dirproduct = array ( '/core/modules/product/' );
$dirmodels = array_merge ( array ( '/' ), ( array ) $conf -> modules_parts [ 'models' ]);
2012-08-09 01:41:55 +02:00
2016-02-08 15:49:38 +01:00
print load_fiche_titre ( $langs -> trans ( " ProductCodeChecker " ), '' , '' );
2012-08-09 01:41:55 +02:00
2021-07-23 00:02:14 +02:00
print '<div class="div-table-responsive-no-min">' ;
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">' . " \n " ;
2012-08-09 01:41:55 +02:00
print '<tr class="liste_titre">' . " \n " ;
print ' <td>' . $langs -> trans ( " Name " ) . '</td>' ;
print ' <td>' . $langs -> trans ( " Description " ) . '</td>' ;
print ' <td>' . $langs -> trans ( " Example " ) . '</td>' ;
2019-03-15 09:50:53 +01:00
print ' <td class="center" width="80">' . $langs -> trans ( " Status " ) . '</td>' ;
2021-07-23 00:02:14 +02:00
print ' <td class="center"></td>' ;
2012-08-09 01:41:55 +02:00
print " </tr> \n " ;
2021-02-26 14:25:17 +01:00
foreach ( $dirproduct as $dirroot ) {
2019-01-27 11:55:16 +01:00
$dir = dol_buildpath ( $dirroot , 0 );
2012-08-09 01:41:55 +02:00
2020-10-31 14:32:18 +01:00
$handle = @ opendir ( $dir );
2021-02-26 14:25:17 +01:00
if ( is_resource ( $handle )) {
2020-10-31 14:32:18 +01:00
// Loop on each module find in opened directory
2021-02-26 14:25:17 +01:00
while (( $file = readdir ( $handle )) !== false ) {
if ( substr ( $file , 0 , 16 ) == 'mod_codeproduct_' && substr ( $file , - 3 ) == 'php' ) {
2020-10-31 14:32:18 +01:00
$file = substr ( $file , 0 , dol_strlen ( $file ) - 4 );
try {
dol_include_once ( $dirroot . $file . '.php' );
2021-02-26 14:25:17 +01:00
} catch ( Exception $e ) {
2020-10-31 14:32:18 +01:00
dol_syslog ( $e -> getMessage (), LOG_ERR );
}
$modCodeProduct = new $file ;
// Show modules according to features level
2021-02-26 14:25:17 +01:00
if ( $modCodeProduct -> version == 'development' && $conf -> global -> MAIN_FEATURES_LEVEL < 2 ) {
continue ;
}
if ( $modCodeProduct -> version == 'experimental' && $conf -> global -> MAIN_FEATURES_LEVEL < 1 ) {
continue ;
}
2020-10-31 14:32:18 +01:00
print '<tr class="oddeven">' . " \n " ;
print '<td width="140">' . $modCodeProduct -> name . '</td>' . " \n " ;
print '<td>' . $modCodeProduct -> info ( $langs ) . '</td>' . " \n " ;
2021-07-23 00:02:14 +02:00
print '<td class="nowrap"><span class="opacitymedium">' . $modCodeProduct -> getExample ( $langs ) . '</span></td>' . " \n " ;
2020-10-31 14:32:18 +01:00
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> global -> PRODUCT_CODEPRODUCT_ADDON ) && $conf -> global -> PRODUCT_CODEPRODUCT_ADDON == $file ) {
2020-10-31 14:32:18 +01:00
print '<td class="center">' . " \n " ;
print img_picto ( $langs -> trans ( " Activated " ), 'switch_on' );
print " </td> \n " ;
} else {
$disabled = false ;
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> multicompany -> enabled ) && ( is_object ( $mc ) && ! empty ( $mc -> sharings [ 'referent' ]) && $mc -> sharings [ 'referent' ] == $conf -> entity ) ? false : true ) {
}
2020-10-31 14:32:18 +01:00
print '<td class="center">' ;
2021-02-26 14:25:17 +01:00
if ( ! $disabled ) {
2021-09-19 18:03:38 +02:00
print '<a class="reposition" href="' . $_SERVER [ 'PHP_SELF' ] . '?action=setcodeproduct&token=' . newToken () . '&value=' . urlencode ( $file ) . '">' ;
2021-02-26 14:25:17 +01:00
}
2020-10-31 14:32:18 +01:00
print img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' );
2021-02-26 14:25:17 +01:00
if ( ! $disabled ) {
print '</a>' ;
}
2020-10-31 14:32:18 +01:00
print '</td>' ;
}
print '<td class="center">' ;
$s = $modCodeProduct -> getToolTip ( $langs , null , - 1 );
print $form -> textwithpicto ( '' , $s , 1 );
print '</td>' ;
print '</tr>' ;
}
}
closedir ( $handle );
}
2012-08-09 01:41:55 +02:00
}
print '</table>' ;
2021-07-23 00:02:14 +02:00
print '</div>' ;
2012-08-09 01:41:55 +02:00
2017-04-12 19:30:01 +02:00
// Module to build doc
2016-02-04 16:17:45 +01:00
$def = array ();
$sql = " SELECT nom " ;
2020-02-21 17:53:37 +01:00
$sql .= " FROM " . MAIN_DB_PREFIX . " document_model " ;
2020-09-20 02:57:15 +02:00
$sql .= " WHERE type = ' " . $db -> escape ( $type ) . " ' " ;
2020-02-21 17:53:37 +01:00
$sql .= " AND entity = " . $conf -> entity ;
$resql = $db -> query ( $sql );
2021-02-26 14:25:17 +01:00
if ( $resql ) {
2016-02-04 16:17:45 +01:00
$i = 0 ;
2020-02-21 17:53:37 +01:00
$num_rows = $db -> num_rows ( $resql );
2021-02-26 14:25:17 +01:00
while ( $i < $num_rows ) {
2017-03-14 09:25:29 +01:00
$array = $db -> fetch_array ( $resql );
array_push ( $def , $array [ 0 ]);
$i ++ ;
2016-02-04 16:17:45 +01:00
}
2020-05-21 15:05:19 +02:00
} else {
2017-03-14 09:25:29 +01:00
dol_print_error ( $db );
2016-02-04 16:17:45 +01:00
}
2017-03-14 09:25:29 +01:00
2017-04-12 19:30:01 +02:00
print '<br>' ;
print load_fiche_titre ( $langs -> trans ( " ProductDocumentTemplates " ), '' , '' );
2021-07-23 00:02:14 +02:00
print '<div class="div-table-responsive-no-min">' ;
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">' ;
2017-03-14 09:25:29 +01:00
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " Name " ) . '</td>' ;
print '<td>' . $langs -> trans ( " Description " ) . '</td>' ;
2019-03-15 09:50:53 +01:00
print '<td class="center" width="60">' . $langs -> trans ( " Status " ) . " </td> \n " ;
print '<td class="center" width="60">' . $langs -> trans ( " Default " ) . " </td> \n " ;
2021-07-23 00:02:14 +02:00
print '<td class="center"></td>' ;
2019-03-15 09:50:53 +01:00
print '<td class="center" width="80">' . $langs -> trans ( " Preview " ) . '</td>' ;
2017-03-14 09:25:29 +01:00
print " </tr> \n " ;
clearstatcache ();
2021-02-26 14:25:17 +01:00
foreach ( $dirmodels as $reldir ) {
foreach ( array ( '' , '/doc' ) as $valdir ) {
2020-10-31 14:32:18 +01:00
$dir = dol_buildpath ( $reldir . " core/modules/product " . $valdir );
2021-02-26 14:25:17 +01:00
if ( is_dir ( $dir )) {
2020-10-31 14:32:18 +01:00
$handle = opendir ( $dir );
2021-02-26 14:25:17 +01:00
if ( is_resource ( $handle )) {
while (( $file = readdir ( $handle )) !== false ) {
2020-10-31 14:32:18 +01:00
$filelist [] = $file ;
}
closedir ( $handle );
arsort ( $filelist );
2021-02-26 14:25:17 +01:00
foreach ( $filelist as $file ) {
if ( preg_match ( '/\.modules\.php$/i' , $file ) && preg_match ( '/^(pdf_|doc_)/' , $file )) {
if ( file_exists ( $dir . '/' . $file )) {
2020-10-31 14:32:18 +01:00
$name = substr ( $file , 4 , dol_strlen ( $file ) - 16 );
$classname = substr ( $file , 0 , dol_strlen ( $file ) - 12 );
require_once $dir . '/' . $file ;
$module = new $classname ( $db );
$modulequalified = 1 ;
2021-02-26 14:25:17 +01:00
if ( $module -> version == 'development' && $conf -> global -> MAIN_FEATURES_LEVEL < 2 ) {
$modulequalified = 0 ;
}
if ( $module -> version == 'experimental' && $conf -> global -> MAIN_FEATURES_LEVEL < 1 ) {
$modulequalified = 0 ;
}
2020-10-31 14:32:18 +01:00
2021-02-26 14:25:17 +01:00
if ( $modulequalified ) {
2020-10-31 14:32:18 +01:00
print '<tr class="oddeven"><td width="100">' ;
print ( empty ( $module -> name ) ? $name : $module -> name );
print " </td><td> \n " ;
2021-02-26 14:25:17 +01:00
if ( method_exists ( $module , 'info' )) {
print $module -> info ( $langs );
} else {
print $module -> description ;
}
2020-10-31 14:32:18 +01:00
print '</td>' ;
// Active
2021-02-26 14:25:17 +01:00
if ( in_array ( $name , $def )) {
2020-10-31 14:32:18 +01:00
print '<td class="center">' . " \n " ;
2021-09-19 14:41:46 +02:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=del&token=' . newToken () . '&value=' . urlencode ( $name ) . '">' ;
2020-10-31 14:32:18 +01:00
print img_picto ( $langs -> trans ( " Enabled " ), 'switch_on' );
print '</a>' ;
print '</td>' ;
} else {
print '<td class="center">' . " \n " ;
2021-09-19 14:41:46 +02:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=set&token=' . newToken () . '&value=' . urlencode ( $name ) . '&scan_dir=' . urlencode ( $module -> scandir ) . '&label=' . urlencode ( $module -> name ) . '">' . img_picto ( $langs -> trans ( " Disabled " ), 'switch_off' ) . '</a>' ;
2020-10-31 14:32:18 +01:00
print " </td> " ;
}
// Defaut
print '<td class="center">' ;
2021-02-26 14:25:17 +01:00
if ( $conf -> global -> PRODUCT_ADDON_PDF == $name ) {
2020-10-31 14:32:18 +01:00
print img_picto ( $langs -> trans ( " Default " ), 'on' );
} else {
2021-09-19 18:03:38 +02:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=setdoc&token=' . newToken () . '&value=' . urlencode ( $name ) . '&scan_dir=' . urlencode ( $module -> scandir ) . '&label=' . urlencode ( $module -> name ) . '" alt="' . $langs -> trans ( " Default " ) . '">' . img_picto ( $langs -> trans ( " Disabled " ), 'off' ) . '</a>' ;
2020-10-31 14:32:18 +01:00
}
print '</td>' ;
2017-03-14 09:25:29 +01:00
2019-10-20 11:59:21 +02:00
// Info
2020-10-31 14:32:18 +01:00
$htmltooltip = '' . $langs -> trans ( " Name " ) . ': ' . $module -> name ;
$htmltooltip .= '<br>' . $langs -> trans ( " Type " ) . ': ' . ( $module -> type ? $module -> type : $langs -> trans ( " Unknown " ));
2021-02-26 14:25:17 +01:00
if ( $module -> type == 'pdf' ) {
2020-10-31 14:32:18 +01:00
$htmltooltip .= '<br>' . $langs -> trans ( " Width " ) . '/' . $langs -> trans ( " Height " ) . ': ' . $module -> page_largeur . '/' . $module -> page_hauteur ;
}
$htmltooltip .= '<br><br><u>' . $langs -> trans ( " FeaturesSupported " ) . ':</u>' ;
$htmltooltip .= '<br>' . $langs -> trans ( " Logo " ) . ': ' . yn ( $module -> option_logo , 1 , 1 );
$htmltooltip .= '<br>' . $langs -> trans ( " MultiLanguage " ) . ': ' . yn ( $module -> option_multilang , 1 , 1 );
print '<td class="center">' ;
print $form -> textwithpicto ( '' , $htmltooltip , 1 , 0 );
print '</td>' ;
// Preview
print '<td class="center">' ;
2021-02-26 14:25:17 +01:00
if ( $module -> type == 'pdf' ) {
2020-10-31 14:32:18 +01:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=specimen&module=' . $name . '">' . img_object ( $langs -> trans ( " Preview " ), 'contract' ) . '</a>' ;
} else {
print img_object ( $langs -> trans ( " PreviewNotAvailable " ), 'generic' );
}
print '</td>' ;
print " </tr> \n " ;
}
}
}
}
}
}
}
2017-03-14 09:25:29 +01:00
}
print '</table>' ;
2021-07-23 00:02:14 +02:00
print '</div>' ;
2017-03-14 09:25:29 +01:00
print " <br> " ;
2017-06-01 12:11:45 +02:00
2012-08-09 01:41:55 +02:00
/*
* Other conf
*/
print " <br> " ;
2015-07-20 13:03:12 +02:00
print '<form method="POST" action="' . $_SERVER [ 'PHP_SELF' ] . '">' ;
2019-12-18 23:12:31 +01:00
print '<input type="hidden" name="token" value="' . newToken () . '">' ;
2015-07-20 13:03:12 +02:00
print '<input type="hidden" name="action" value="other">' ;
2020-07-06 15:34:26 +02:00
print '<input type="hidden" name="page_y" value="">' ;
2015-07-20 13:03:12 +02:00
2021-07-05 14:09:01 +02:00
print load_fiche_titre ( $langs -> trans ( " ProductOtherConf " ), '' , '' );
2021-07-23 00:02:14 +02:00
print '<div class="div-table-responsive-no-min">' ;
2019-11-05 21:24:41 +01:00
print '<table class="noborder centpercent">' ;
2006-07-25 11:42:59 +02:00
print '<tr class="liste_titre">' ;
2011-12-28 09:26:36 +01:00
print '<td>' . $langs -> trans ( " Parameters " ) . '</td>' . " \n " ;
2019-03-15 09:50:53 +01:00
print '<td class="right" width="60">' . $langs -> trans ( " Value " ) . '</td>' . " \n " ;
2020-06-05 23:06:59 +02:00
print '</tr>' . " \n " ;
2006-07-25 11:42:59 +02:00
2015-07-20 13:03:12 +02:00
2020-12-15 11:10:35 +01:00
// Enable kits (subproducts)
2005-10-13 23:39:38 +02:00
2020-12-15 11:10:35 +01:00
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " AssociatedProductsAbility " ) . '</td>' ;
print '<td class="right">' ;
print ajax_constantonoff ( " PRODUIT_SOUSPRODUITS " , array (), $conf -> entity , 0 , 0 , 1 , 0 );
//print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1);
print '</td>' ;
print '</tr>' ;
2014-02-23 16:16:47 +01:00
2017-04-14 11:22:48 +02:00
2020-12-15 11:10:35 +01:00
// Enable variants
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " VariantsAbility " ) . '</td>' ;
print '<td class="right">' ;
//print ajax_constantonoff("PRODUIT_SOUSPRODUITS", array(), $conf->entity, 0, 0, 1, 0);
//print $form->selectyesno("PRODUIT_SOUSPRODUITS", $conf->global->PRODUIT_SOUSPRODUITS, 1);
if ( empty ( $conf -> variants -> enabled )) {
print '<span class="opacitymedium">' . $langs -> trans ( " ModuleMustBeEnabled " , $langs -> transnoentitiesnoconv ( " Module610Name " )) . '</span>' ;
} else {
print yn ( 1 ) . ' <span class="opacitymedium">(' . $langs -> trans ( " ModuleIsEnabled " , $langs -> transnoentitiesnoconv ( " Module610Name " )) . ')</span>' ;
}
print '</td>' ;
print '</tr>' ;
2005-10-13 23:39:38 +02:00
2014-02-23 16:16:47 +01:00
2020-12-15 11:10:35 +01:00
// Rule for price
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2021-02-26 14:25:17 +01:00
if ( empty ( $conf -> multicompany -> enabled )) {
2019-08-09 09:33:14 +02:00
print '<td>' . $langs -> trans ( " PricingRule " ) . '</td>' ;
2020-05-21 15:05:19 +02:00
} else {
2019-08-09 09:33:14 +02:00
print '<td>' . $form -> textwithpicto ( $langs -> trans ( " PricingRule " ), $langs -> trans ( " SamePriceAlsoForSharedCompanies " ), 1 ) . '</td>' ;
}
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2014-02-23 16:16:47 +01:00
$current_rule = 'PRODUCT_PRICE_UNIQ' ;
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> global -> PRODUIT_MULTIPRICES )) {
$current_rule = 'PRODUIT_MULTIPRICES' ;
}
if ( ! empty ( $conf -> global -> PRODUIT_CUSTOMER_PRICES_BY_QTY )) {
$current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY' ;
}
if ( ! empty ( $conf -> global -> PRODUIT_CUSTOMER_PRICES )) {
$current_rule = 'PRODUIT_CUSTOMER_PRICES' ;
}
if ( ! empty ( $conf -> global -> PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES )) {
$current_rule = 'PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES' ;
}
2021-01-07 12:39:51 +01:00
print $form -> selectarray ( " princingrule " , $select_pricing_rules , $current_rule , 0 , 0 , 0 , '' , 1 , 0 , 0 , '' , 'maxwidth400' , 1 );
2011-12-28 09:26:36 +01:00
print '</td>' ;
2006-02-03 17:42:39 +01:00
print '</tr>' ;
2006-02-03 19:21:55 +01:00
2006-02-03 17:42:39 +01:00
// multiprix nombre de prix a proposer
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> global -> PRODUIT_MULTIPRICES ) || ! empty ( $conf -> global -> PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES )) {
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2008-08-28 02:31:27 +02:00
print '<td>' . $langs -> trans ( " MultiPricesNumPrices " ) . '</td>' ;
2022-03-14 11:19:08 +01:00
print '<td class="right"><input size="3" type="text" class="flat right" name="value_PRODUIT_MULTIPRICES_LIMIT" value="' . $conf -> global -> PRODUIT_MULTIPRICES_LIMIT . '"></td>' ;
2008-08-28 02:31:27 +02:00
print '</tr>' ;
2006-02-03 17:42:39 +01:00
}
2006-03-22 10:03:55 +01:00
2020-12-15 11:10:35 +01:00
// Default product price base type
2020-05-03 19:47:10 +02:00
print '<tr class="oddeven">' ;
print '<td>' . $langs -> trans ( " DefaultPriceType " ) . '</td>' ;
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2020-05-03 19:47:10 +02:00
print $form -> selectPriceBaseType ( $conf -> global -> PRODUCT_PRICE_BASE_TYPE , " price_base_type " );
2011-12-28 09:26:36 +01:00
print '</td>' ;
2006-02-20 11:58:10 +01:00
print '</tr>' ;
2006-02-03 17:42:39 +01:00
2022-08-23 13:39:06 +02:00
// Use conditionnement in buying
2021-07-05 14:09:01 +02:00
if (( ! empty ( $conf -> fournisseur -> enabled ) && empty ( $conf -> global -> MAIN_USE_NEW_SUPPLIERMOD )) || ! empty ( $conf -> supplier_order -> enabled ) || ! empty ( $conf -> supplier_invoice -> enabled )) {
print '<tr class="oddeven">' ;
2022-08-23 13:39:06 +02:00
print '<td>' . $form -> textwithpicto ( $langs -> trans ( " UseProductSupplierPackaging " ), $langs -> trans ( " PackagingForThisProductDesc " )) . '</td>' ;
2022-03-14 11:19:08 +01:00
print '<td align="right">' ;
print ajax_constantonoff ( " PRODUCT_USE_SUPPLIER_PACKAGING " , array (), $conf -> entity , 0 , 0 , 0 , 0 );
//print $form->selectyesno("activate_useProdSupplierPackaging", (!empty($conf->global->PRODUCT_USE_SUPPLIER_PACKAGING) ? $conf->global->PRODUCT_USE_SUPPLIER_PACKAGING : 0), 1);
2021-07-05 14:09:01 +02:00
print '</td>' ;
print '</tr>' ;
print '<tr class="oddeven">' ;
2022-03-14 11:19:08 +01:00
print '<td>' . $langs -> trans ( " UseProductFournDesc " ) . '</td>' ;
print '<td class="right">' ;
print ajax_constantonoff ( " PRODUIT_FOURN_TEXTS " , array (), $conf -> entity , 0 , 0 , 0 , 0 );
//print $form->selectyesno("activate_useProdFournDesc", (!empty($conf->global->PRODUIT_FOURN_TEXTS) ? $conf->global->PRODUIT_FOURN_TEXTS : 0), 1);
2021-07-05 14:09:01 +02:00
print '</td>' ;
print '</tr>' ;
}
print '</table>' ;
2021-07-23 00:02:14 +02:00
print '</div>' ;
2021-07-05 14:09:01 +02:00
print '<div class="center">' ;
print '<input type="submit" class="button reposition" value="' . $langs -> trans ( " Modify " ) . '">' ;
print '</div>' ;
print load_fiche_titre ( $langs -> trans ( " UserInterface " ), '' , '' );
2021-07-23 00:02:14 +02:00
print '<div class="div-table-responsive-no-min">' ;
2021-07-05 14:09:01 +02:00
print '<table class="noborder centpercent">' ;
print '<tr class="liste_titre">' ;
print '<td>' . $langs -> trans ( " Parameters " ) . '</td>' . " \n " ;
print '<td class="right" width="60">' . $langs -> trans ( " Value " ) . '</td>' . " \n " ;
print '</tr>' . " \n " ;
2020-12-15 11:10:35 +01:00
// Use Ajax form to select a product
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2019-01-27 11:55:16 +01:00
print '<td>' . $form -> textwithpicto ( $langs -> trans ( " UseSearchToSelectProduct " ), $langs -> trans ( 'UseSearchToSelectProductTooltip' ), 1 ) . '</td>' ;
2021-02-26 14:25:17 +01:00
if ( empty ( $conf -> use_javascript_ajax )) {
2020-06-05 23:06:59 +02:00
print '<td class="nowrap right">' ;
2008-08-28 02:31:27 +02:00
print $langs -> trans ( " NotAvailableWhenAjaxDisabled " );
2011-12-28 09:26:36 +01:00
print '</td>' ;
2020-05-21 15:05:19 +02:00
} else {
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2020-02-21 17:53:37 +01:00
$arrval = array (
2015-07-20 13:03:12 +02:00
'0' => $langs -> trans ( " No " ),
2019-01-27 11:55:16 +01:00
'1' => $langs -> trans ( " Yes " ) . ' (' . $langs -> trans ( " NumberOfKeyToSearch " , 1 ) . ')' ,
2020-10-31 14:32:18 +01:00
'2' => $langs -> trans ( " Yes " ) . ' (' . $langs -> trans ( " NumberOfKeyToSearch " , 2 ) . ')' ,
'3' => $langs -> trans ( " Yes " ) . ' (' . $langs -> trans ( " NumberOfKeyToSearch " , 3 ) . ')' ,
2011-10-03 22:48:10 +02:00
);
2019-01-27 11:55:16 +01:00
print $form -> selectarray ( " activate_usesearchtoselectproduct " , $arrval , $conf -> global -> PRODUIT_USE_SEARCH_TO_SELECT );
2011-12-28 09:26:36 +01:00
print '</td>' ;
2006-10-22 15:30:13 +02:00
}
2006-07-25 11:42:59 +02:00
print '</tr>' ;
2021-02-26 14:25:17 +01:00
if ( empty ( $conf -> global -> PRODUIT_USE_SEARCH_TO_SELECT )) {
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2008-12-02 13:56:29 +01:00
print '<td>' . $langs -> trans ( " NumberOfProductShowInSelect " ) . '</td>' ;
2019-03-15 09:50:53 +01:00
print '<td class="right"><input size="3" type="text" class="flat" name="value_PRODUIT_LIMIT_SIZE" value="' . $conf -> global -> PRODUIT_LIMIT_SIZE . '"></td>' ;
2008-12-02 13:56:29 +01:00
print '</tr>' ;
}
2020-10-28 16:37:41 +01:00
// Do Not Add Product description on add lines
print '<tr class="oddeven">' ;
2021-01-07 12:39:51 +01:00
print '<td>' . $langs -> trans ( " OnProductSelectAddProductDesc " ) . '</td>' ;
2020-10-28 16:37:41 +01:00
print '<td class="right">' ;
2021-07-05 11:59:30 +02:00
print '<!-- PRODUIT_AUTOFILL_DESC -->' ;
2021-01-07 12:39:51 +01:00
print $form -> selectarray (
" activate_FillProductDescAuto " ,
2021-07-05 11:59:30 +02:00
array ( 0 => 'DoNotAutofillButAutoConcat' , 1 => 'AutoFillFormFieldBeforeSubmit' , 2 => 'DoNotUseDescriptionOfProdut' ),
2021-01-07 12:39:51 +01:00
empty ( $conf -> global -> PRODUIT_AUTOFILL_DESC ) ? 0 : $conf -> global -> PRODUIT_AUTOFILL_DESC ,
0 ,
0 ,
0 ,
'' ,
1 ,
0 ,
0 ,
'' ,
2021-07-23 00:02:14 +02:00
'minwidth100imp maxwidth400' ,
2021-01-07 12:39:51 +01:00
1
);
2020-10-28 16:37:41 +01:00
print '</td>' ;
print '</tr>' ;
2021-01-07 12:39:51 +01:00
// Visualiser description produit dans les formulaires activation/desactivation
2020-10-28 16:37:41 +01:00
print '<tr class="oddeven">' ;
2021-01-07 12:39:51 +01:00
print '<td>' . $langs -> trans ( " ViewProductDescInFormAbility " ) . '</td>' ;
2020-10-28 16:37:41 +01:00
print '<td class="right">' ;
2021-01-07 12:39:51 +01:00
print $form -> selectyesno ( " activate_viewProdDescInForm " , $conf -> global -> PRODUIT_DESC_IN_FORM , 1 );
2020-10-28 16:37:41 +01:00
print '</td>' ;
print '</tr>' ;
2015-04-18 18:44:05 +02:00
// Activate propal merge produt card
2015-07-20 13:03:12 +02:00
/* Kept as hidden feature only . PRODUIT_PDF_MERGE_PROPAL can be added manually . Still did not understand how this feature works .
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2015-04-18 18:44:05 +02:00
print '<td>' . $langs -> trans ( " MergePropalProductCard " ) . '</td>' ;
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2016-03-25 15:53:44 +01:00
print $form -> selectyesno ( " activate_mergePropalProductCard " , $conf -> global -> PRODUIT_PDF_MERGE_PROPAL , 1 );
2015-04-18 18:44:05 +02:00
print '</td>' ;
print '</tr>' ;
2015-07-20 13:03:12 +02:00
*/
2015-04-18 18:44:05 +02:00
2015-02-26 14:15:33 +01:00
// Use units
2015-07-20 13:03:12 +02:00
/* Kept as hidden feature only . PRODUCT_USE_UNITS is hidden for the moment . Because it seems to be a duplicated feature with already existing field to store unit of product
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2015-02-26 14:15:33 +01:00
print '<td>' . $langs -> trans ( " UseUnits " ) . '</td>' ;
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2016-03-25 15:53:44 +01:00
print $form -> selectyesno ( " activate_units " , $conf -> global -> PRODUCT_USE_UNITS , 1 );
2015-02-26 14:15:33 +01:00
print '</td>' ;
print '</tr>' ;
2015-07-20 13:03:12 +02:00
*/
2015-02-26 14:15:33 +01:00
2012-01-13 17:46:15 +01:00
// View product description in thirdparty language
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> global -> MAIN_MULTILANGS )) {
2017-04-14 11:22:48 +02:00
print '<tr class="oddeven">' ;
2012-01-13 17:46:15 +01:00
print '<td>' . $langs -> trans ( " ViewProductDescInThirdpartyLanguageAbility " ) . '</td>' ;
2020-06-05 23:06:59 +02:00
print '<td class="right">' ;
2020-02-21 17:53:37 +01:00
print $form -> selectyesno ( " activate_viewProdTextsInThirdpartyLanguage " , ( ! empty ( $conf -> global -> PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE ) ? $conf -> global -> PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE : 0 ), 1 );
2012-01-13 17:46:15 +01:00
print '</td>' ;
print '</tr>' ;
}
2012-01-13 16:53:28 +01:00
2019-07-18 11:53:36 +02:00
2021-02-26 14:25:17 +01:00
if ( ! empty ( $conf -> global -> PRODUCT_CANVAS_ABILITY )) {
2010-03-22 12:49:10 +01:00
// Add canvas feature
2020-02-21 17:53:37 +01:00
$dir = DOL_DOCUMENT_ROOT . " /product/canvas/ " ;
2010-04-30 20:39:21 +02:00
2007-10-07 16:45:42 +02:00
print '<tr class="liste_titre">' ;
2010-03-22 12:49:10 +01:00
print '<td>' . $langs -> trans ( " ProductSpecial " ) . '</td>' . " \n " ;
2020-06-05 23:06:59 +02:00
print '<td class="right">' . $langs -> trans ( " Value " ) . '</td>' . " \n " ;
print '</tr>' . " \n " ;
2010-04-30 20:39:21 +02:00
2021-02-26 14:25:17 +01:00
if ( is_dir ( $dir )) {
2020-02-21 17:53:37 +01:00
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php' ;
2010-04-30 20:39:21 +02:00
2020-02-21 17:53:37 +01:00
$handle = opendir ( $dir );
2021-02-26 14:25:17 +01:00
if ( is_resource ( $handle )) {
while (( $file = readdir ( $handle )) !== false ) {
if ( file_exists ( $dir . $file . '/product.' . $file . '.class.php' )) {
2020-10-31 14:32:18 +01:00
$classfile = $dir . $file . '/product.' . $file . '.class.php' ;
$classname = 'Product' . ucfirst ( $file );
require_once $classfile ;
$object = new $classname ();
$module = $object -> module ;
2021-02-26 14:25:17 +01:00
if ( $conf -> $module -> enabled ) {
2020-10-31 14:32:18 +01:00
print '<tr class="oddeven"><td>' ;
print $object -> description ;
print '</td><td class="right">' ;
$const = " PRODUCT_SPECIAL_ " . strtoupper ( $file );
2021-02-26 14:25:17 +01:00
if ( $conf -> global -> $const ) {
2020-10-31 14:32:18 +01:00
print img_picto ( $langs -> trans ( " Active " ), 'tick' );
print '</td><td class="right">' ;
2021-09-19 18:03:38 +02:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=set&token=' . newToken () . '&spe=' . urlencode ( $file ) . '&value=0">' . $langs -> trans ( " Disable " ) . '</a>' ;
2020-10-31 14:32:18 +01:00
} else {
print ' </td><td class="right">' ;
2021-09-19 18:03:38 +02:00
print '<a href="' . $_SERVER [ " PHP_SELF " ] . '?action=set&token=' . newToken () . '&spe=' . urlencode ( $file ) . '&value=1">' . $langs -> trans ( " Activate " ) . '</a>' ;
2020-10-31 14:32:18 +01:00
}
print '</td></tr>' ;
}
}
}
closedir ( $handle );
}
2020-05-21 15:05:19 +02:00
} else {
2015-11-05 11:11:51 +01:00
setEventMessages ( $dir . ' ' . $langs -> trans ( " IsNotADir " ), null , 'errors' );
2006-12-01 16:37:26 +01:00
}
}
2006-07-25 11:42:59 +02:00
2015-07-20 13:03:12 +02:00
print '</table>' ;
2021-07-23 00:02:14 +02:00
print '</div>' ;
2015-07-20 13:03:12 +02:00
2020-07-06 15:34:26 +02:00
print '<div class="center">' ;
print '<input type="submit" class="button reposition" value="' . $langs -> trans ( " Modify " ) . '">' ;
print '</div>' ;
2020-06-05 23:06:59 +02:00
2015-07-20 13:03:12 +02:00
print '</form>' ;
2018-08-14 09:55:58 +02:00
// End of page
2012-01-13 17:46:15 +01:00
llxFooter ();
2005-10-13 23:39:38 +02:00
$db -> close ();