Skip to content

Commit

Permalink
Merge pull request #19 from simnandez/3.1
Browse files Browse the repository at this point in the history
Fix: (Bug 13) CashDesk: Everyone can access to the Point of sales
  • Loading branch information
eldy committed Oct 10, 2011
2 parents 7fe7624 + 1a85d08 commit d9fcc18
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 3 deletions.
60 changes: 58 additions & 2 deletions htdocs/admin/dict.php
Expand Up @@ -774,7 +774,7 @@
$valuetoshow=($key != "Country".strtoupper($obj->pays_code))?$obj->pays_code." - ".$key:$obj->pays;
}
}
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm') {
else if ($fieldlist[$field]=='recuperableonly' || $fieldlist[$field]=='fdm') {
$valuetoshow=yn($valuetoshow);
}
else if ($fieldlist[$field]=='price') {
Expand All @@ -784,12 +784,68 @@
$valuetoshow=price($valuetoshow);
}
else if ($fieldlist[$field]=='libelle_facture') {
$langs->load("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]=='libelle' && $tabname[$_GET["id"]]=='llx_c_pays') {
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_pays') {
$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[$_GET["id"]]==MAIN_DB_PREFIX.'c_availability') {
$langs->load("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[$_GET["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 ($fieldlist[$field]=='libelle' && $tabname[$_GET["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[$_GET["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[$_GET["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]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_civilite') {
$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[$_GET["id"]]==MAIN_DB_PREFIX.'c_type_contact') {
$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[$_GET["id"]]==MAIN_DB_PREFIX.'c_payment_term') {
$langs->load("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[$_GET["id"]]==MAIN_DB_PREFIX.'c_paiement') {
$langs->load("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[$_GET["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[$_GET["id"]]==MAIN_DB_PREFIX.'c_input_method') {
$langs->load("orders");
$key=$langs->trans($obj->code);
$valuetoshow=($obj->code && $key != $obj->code)?$key:$obj->$fieldlist[$field];
}
else if ($fieldlist[$field]=='libelle' && $tabname[$_GET["id"]]==MAIN_DB_PREFIX.'c_shipment_mode') {
$langs->load("sendings");
$key=$langs->trans("SendingMethod".strtoupper($obj->code));
$valuetoshow=($obj->code && $key != "SendingMethod".strtoupper($obj->code))?$key:$obj->$fieldlist[$field];
}
else if ($fieldlist[$field]=='region_id' || $fieldlist[$field]=='pays_id') {
$showfield=0;
}
Expand Down
12 changes: 11 additions & 1 deletion htdocs/includes/modules/modCashDesk.class.php
@@ -1,5 +1,6 @@
<?php
/* Copyright (C) 2008-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* 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
Expand Down Expand Up @@ -85,6 +86,15 @@ function modCashDesk ($DB)

// Permissions
$this->rights = array();
$this->rights_class = 'cashdesk';
$r=0;

$r++;
$this->rights[$r][0] = 50001;
$this->rights[$r][1] = 'Use cashdesk';
$this->rights[$r][2] = 'a';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'use';

// Main menu entries
$this->menus = array(); // List of menus to add
Expand All @@ -100,7 +110,7 @@ function modCashDesk ($DB)
'langs'=>'cashdesk', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
'position'=>100,
'enabled'=>'$conf->cashdesk->enabled',
'perms'=>1, // Use 'perms'=>'1' if you want your menu with no permission rules
'perms'=>'$user->rights->cashdesk->use', // Use 'perms'=>'1' if you want your menu with no permission rules
'target'=>'pointofsale',
'user'=>0); // 0=Menu for internal users, 1=external users, 2=both

Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/ca_ES/admin.lang
Expand Up @@ -635,6 +635,7 @@ Permission2515=Configuració carpetes de documents
Permission8555=Ús del mòdul
Permission8556=Establir llocs ecommerce
Permission8557=Importar dades
Permission50001=Utilitzar TPV
Permission50201=Consultar les transaccions
Permission50202=Importar les transaccions
DictionnaryCompanyType=Tipus d'empresa
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/en_US/admin.lang
Expand Up @@ -627,6 +627,7 @@ Permission2501=Read/Download documents
Permission2502=Download documents
Permission2503=Submit or delete documents
Permission2515=Setup documents directories
Permission50001=Use Point of sales
Permission50201= Read transactions
Permission50202= Import transactions
DictionnaryCompanyType=Company types
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/es_ES/admin.lang
Expand Up @@ -635,6 +635,7 @@ Permission2515=Configuración directorios de documentos
Permission8555=Uso del módulo
Permission8556=Establecer sitios e-commerce
Permission8557=Importar datos
Permission50001=Usar TPV
Permission50201=Consultar las transacciones
Permission50202=Importar las transacciones
DictionnaryCompanyType=Tipos de empresa
Expand Down
1 change: 1 addition & 0 deletions htdocs/langs/fr_FR/admin.lang
Expand Up @@ -636,6 +636,7 @@ Permission2515= Administrer les rubriques de documents
Permission8555= Utilisation du module
Permission8556= Définir les sites ecommerce
Permission8557= Importer les données
Permission50001=Utiliser Point de vente
Permission50201= Consulter les transactions
Permission50202= Importer les transactions
DictionnaryCompanyType= Types de sociétés
Expand Down

0 comments on commit d9fcc18

Please sign in to comment.