2008-09-30 01:18:52 +02:00
< ? php
2011-05-12 23:14:17 +02:00
/* Copyright ( C ) 2008 - 2011 Laurent Destailleur < eldy @ users . sourceforge . net >
2008-09-30 01:18:52 +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
2008-09-30 01:18:52 +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 />.
2008-09-30 01:18:52 +02:00
*/
/**
2009-07-30 00:52:08 +02:00
* \defgroup pos Module points of sale
* \brief Module to manage points of sale
2011-10-24 14:11:49 +02:00
* \file htdocs / core / modules / modCashDesk . class . php
2009-07-30 00:52:08 +02:00
* \ingroup pos
2021-03-20 13:55:43 +01:00
* \brief Description and activation file for the module Point Of Sales
2009-07-30 00:52:08 +02:00
*/
2020-01-30 01:48:28 +01:00
include_once DOL_DOCUMENT_ROOT . '/core/modules/DolibarrModules.class.php' ;
2008-09-30 01:18:52 +02:00
/**
2012-10-03 00:30:50 +02:00
* Class to describe and enable module Point Of Sales
2009-05-04 13:40:00 +02:00
*/
2008-09-30 01:18:52 +02:00
class modCashDesk extends DolibarrModules
{
/**
2011-09-26 16:22:35 +02:00
* Constructor . Define names , constants , directories , boxes , permissions
*
2012-01-04 21:23:50 +01:00
* @ param DoliDB $db Database handler
2008-09-30 01:18:52 +02:00
*/
2019-02-25 20:35:59 +01:00
public function __construct ( $db )
2008-09-30 01:18:52 +02:00
{
2012-01-04 21:23:50 +01:00
$this -> db = $db ;
2009-05-04 13:40:00 +02:00
2008-10-01 21:10:17 +02:00
// Id for module (must be unique).
// Use here a free id (See in Home -> System information -> Dolibarr for list of used module id).
2008-09-30 01:18:52 +02:00
$this -> numero = 50100 ;
// Key text used to identify module (for permission, menus, etc...)
$this -> rights_class = 'cashdesk' ;
2009-05-04 13:40:00 +02:00
2015-10-07 07:57:09 +02:00
$this -> family = " portal " ;
2020-10-02 16:15:24 +02:00
$this -> module_position = '59' ;
2008-10-01 21:10:17 +02:00
// Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module)
2019-01-27 11:55:16 +01:00
$this -> name = preg_replace ( '/^mod/i' , '' , get_class ( $this ));
2008-09-30 01:18:52 +02:00
$this -> description = " CashDesk module " ;
2009-05-04 13:40:00 +02:00
2021-05-19 19:46:46 +02:00
$this -> version = 'deprecated' ;
2009-05-04 13:40:00 +02:00
2008-10-06 09:39:52 +02:00
$this -> const_name = 'MAIN_MODULE_' . strtoupper ( $this -> name );
2020-04-06 15:34:28 +02:00
$this -> picto = 'cash-register' ;
2009-05-04 13:40:00 +02:00
// Data directories to create when module is enabled
2008-09-30 01:18:52 +02:00
$this -> dirs = array ();
2009-05-04 13:40:00 +02:00
2008-10-03 00:29:54 +02:00
// Config pages. Put here list of php page names stored in admmin directory used to setup module.
2010-05-03 11:27:12 +02:00
$this -> config_page_url = array ( " cashdesk.php@cashdesk " );
2009-05-04 13:40:00 +02:00
2008-09-30 01:18:52 +02:00
// Dependencies
2020-01-30 01:48:28 +01:00
$this -> hidden = false ; // A condition to hide module
$this -> depends = array ( 'always' => " modBanque " , 'always' => " modFacture " , 'always' => " modProduct " , 'FR' => 'modBlockedLog' ); // List of modules id that must be enabled if this module is enabled
$this -> requiredby = array (); // List of modules id to disable if this one is disabled
2021-02-06 13:48:31 +01:00
$this -> phpmin = array ( 5 , 6 ); // Minimum version of PHP required by module
2020-01-30 01:48:28 +01:00
$this -> need_dolibarr_version = array ( 2 , 4 ); // Minimum version of Dolibarr required by module
2010-10-22 02:39:39 +02:00
$this -> langfiles = array ( " cashdesk " );
2020-01-30 01:48:28 +01:00
$this -> warnings_activation = array ( 'FR' => 'WarningNoteModulePOSForFrenchLaw' ); // Warning to show when we activate module. array('always'='text') or array('FR'='text')
2017-06-23 23:40:02 +02:00
//$this->warnings_activation_ext = array('FR'=>'WarningInstallationMayBecomeNotCompliantWithLaw'); // Warning to show when we activate an external module. array('always'='text') or array('FR'='text')
2009-05-04 13:40:00 +02:00
2015-09-07 15:40:55 +02:00
// Constants
2008-09-30 01:18:52 +02:00
$this -> const = array ();
2009-05-04 13:40:00 +02:00
2008-09-30 01:18:52 +02:00
// Boxes
$this -> boxes = array ();
2009-05-04 13:40:00 +02:00
2008-09-30 01:18:52 +02:00
// Permissions
$this -> rights = array ();
2020-01-30 01:48:28 +01:00
$r = 0 ;
2011-10-10 10:11:09 +02:00
$r ++ ;
2011-10-10 20:02:47 +02:00
$this -> rights [ $r ][ 0 ] = 50101 ;
2020-01-25 14:23:23 +01:00
$this -> rights [ $r ][ 1 ] = 'Use Point of sale' ;
2011-10-10 10:11:09 +02:00
$this -> rights [ $r ][ 2 ] = 'a' ;
2016-06-04 12:16:30 +02:00
$this -> rights [ $r ][ 3 ] = 0 ;
2020-01-25 14:23:23 +01:00
$this -> rights [ $r ][ 4 ] = 'run' ;
2009-05-04 13:40:00 +02:00
2008-09-30 01:18:52 +02:00
// Main menu entries
2020-01-30 01:48:28 +01:00
$this -> menus = array (); // List of menus to add
$r = 0 ;
2008-09-30 01:18:52 +02:00
// This is to declare the Top Menu entry:
2020-01-30 01:48:28 +01:00
$this -> menu [ $r ] = array ( 'fk_menu' => 0 , // Put 0 if this is a top menu
'type' => 'top' , // This is a Top menu entry
2018-11-29 11:03:02 +01:00
'titre' => 'PointOfSaleShort' ,
2008-09-30 01:18:52 +02:00
'mainmenu' => 'cashdesk' ,
2021-03-30 02:01:08 +02:00
'leftmenu' => '' ,
'prefix' => img_picto ( '' , $this -> picto , 'class="paddingright pictofixedwidth"' ),
2020-01-01 22:27:08 +01:00
'url' => '/cashdesk/index.php?user=__USER_LOGIN__' ,
2020-01-30 01:48:28 +01:00
'langs' => 'cashdesk' , // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
2016-05-25 00:02:48 +02:00
'position' => 900 ,
2020-10-31 14:32:18 +01:00
'enabled' => '$conf->cashdesk->enabled' ,
'perms' => '$user->rights->cashdesk->run' , // Use 'perms'=>'1' if you want your menu with no permission rules
2010-07-14 13:37:56 +02:00
'target' => 'pointofsale' ,
2020-01-30 01:48:28 +01:00
'user' => 0 ); // 0=Menu for internal users, 1=external users, 2=both
2009-04-21 11:05:47 +02:00
2008-09-30 01:18:52 +02:00
$r ++ ;
2009-05-04 13:40:00 +02:00
2008-09-30 01:18:52 +02:00
// This is to declare a Left Menu entry:
// $this->menu[$r]=array( 'fk_menu'=>'r=0', // Use r=value where r is index key used for the top menu entry
// 'type'=>'left', // This is a Left menu entry
// 'titre'=>'Title left menu',
// 'mainmenu'=>'mymodule',
// 'url'=>'/comm/action/index2.php',
// 'langs'=>'mylangfile', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
// 'position'=>100,
// 'perms'=>'$user->rights->mymodule->level1->level2', // Use 'perms'=>'1' if you want your menu with no permission rules
// 'target'=>'',
// 'user'=>2); // 0=Menu for internal users, 1=external users, 2=both
// $r++;
2020-10-31 14:32:18 +01:00
}
/**
* Function called when module is enabled .
* The init function add constants , boxes , permissions and menus ( defined in constructor ) into Dolibarr database .
* It also creates data directories
*
* @ param string $options Options when enabling module ( '' , 'noboxes' )
* @ return int 1 if OK , 0 if KO
*/
public function init ( $options = '' )
{
$sql = array ();
// Remove permissions and default values
$this -> remove ( $options );
return $this -> _init ( $sql , $options );
}
2008-09-30 01:18:52 +02:00
}