Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop Conflicts: htdocs/core/class/extrafields.class.php
This commit is contained in:
commit
b4a8f19696
@ -1721,8 +1721,8 @@ class Adherent extends CommonObject
|
||||
/**
|
||||
* Load indicators for dashboard (this->nbtodo and this->nbtodolate)
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
* @param User $user Objet user
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user)
|
||||
{
|
||||
|
||||
@ -67,7 +67,7 @@ llxHeader('',$langs->trans("DefaultRights"));
|
||||
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
|
||||
|
||||
print $langs->trans("DefaultRightsDesc");
|
||||
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br>\n";
|
||||
print " ".$langs->trans("OnlyActiveElementsAreShown")."<br><br>\n";
|
||||
|
||||
$db->begin();
|
||||
|
||||
@ -115,16 +115,15 @@ foreach ($modulesdir as $dir)
|
||||
|
||||
$db->commit();
|
||||
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
print "<br>\n";
|
||||
|
||||
|
||||
$head=security_prepare_head();
|
||||
|
||||
dol_fiche_head($head, 'default', $langs->trans("Security"));
|
||||
|
||||
|
||||
// Show warning about external users
|
||||
print info_admin(showModulesExludedForExternal($modules)).'<br>'."\n";
|
||||
|
||||
|
||||
print '<table class="noborder" width="100%">';
|
||||
|
||||
// Affiche lignes des permissions
|
||||
|
||||
@ -2243,7 +2243,11 @@ if ($action == 'create' && $user->rights->commande->creer)
|
||||
}
|
||||
|
||||
// Cancel order
|
||||
if ($object->statut == 1 && $user->rights->commande->annuler) {
|
||||
if ($object->statut == 1 &&
|
||||
((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->cloturer))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->commande->order_advance->annuler)))
|
||||
)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butActionDelete" href="' . $_SERVER["PHP_SELF"] . '?id=' . $object->id . '&action=cancel">' . $langs->trans('Cancel') . '</a></div>';
|
||||
}
|
||||
|
||||
|
||||
@ -917,7 +917,7 @@ class Account extends CommonObject
|
||||
*
|
||||
* @param User $user Objet user
|
||||
* @param int $filteraccountid To get info for a particular account id
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
* @return WorkboardResponse|int <0 if KO, WorkboardResponse if OK
|
||||
*/
|
||||
function load_board($user,$filteraccountid=0)
|
||||
{
|
||||
@ -940,7 +940,7 @@ class Account extends CommonObject
|
||||
$langs->load("banks");
|
||||
$now=dol_now();
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
|
||||
$response = new WorkboardResponse();
|
||||
$response->warning_delay=$conf->bank->rappro->warning_delay/60/60/24;
|
||||
|
||||
@ -49,8 +49,8 @@ class WorkboardResponse
|
||||
public $url_late;
|
||||
|
||||
/**
|
||||
* Delay time to mark an item as late
|
||||
* @var int
|
||||
* Delay time to mark an item as late. In number of days.
|
||||
* @var double
|
||||
*/
|
||||
public $warning_delay;
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright (C) 2013-2014 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||
* Copyright (C) 2014-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -270,7 +271,7 @@ abstract class DoliDB implements Database
|
||||
*
|
||||
* @param string $string Date in a string (YYYYMMDDHHMMSS, YYYYMMDD, YYYY-MM-DD HH:MM:SS)
|
||||
* @param int $gm 1=Input informations are GMT values, otherwise local to server TZ
|
||||
* @return timestamp|string Date TMS
|
||||
* @return int|string Date TMS
|
||||
*/
|
||||
function jdate($string, $gm=false)
|
||||
{
|
||||
|
||||
@ -1157,7 +1157,7 @@ function dol_getdate($timestamp,$fast=false)
|
||||
* @param int $year Year
|
||||
* @param mixed $gm True or 1 or 'gmt'=Input informations are GMT values, False or 0 or 'server' = local to server TZ, 'user' = local to user TZ
|
||||
* @param int $check 0=No check on parameters (Can use day 32, etc...)
|
||||
* @return timestamp|string Date as a timestamp, '' or false if error
|
||||
* @return int|string Date as a timestamp, '' or false if error
|
||||
* @see dol_print_date, dol_stringtotime, dol_getdate
|
||||
*/
|
||||
function dol_mktime($hour,$minute,$second,$month,$day,$year,$gm=false,$check=1)
|
||||
@ -4952,7 +4952,7 @@ function dol_getmypid()
|
||||
* @param string $value The value to look for.
|
||||
* If param $numeric is 0, can contains several keywords separated with a space, like "keyword1 keyword2" = We want record field like keyword1 and field like keyword2
|
||||
* If param $numeric is 1, can contains an operator <>= like "<10" or ">=100.5 < 1000"
|
||||
* @param string $number 0=value is list of keywords, 1=value is a numeric test
|
||||
* @param string $numeric 0=value is list of keywords, 1=value is a numeric test
|
||||
* @return string $res The statement to append to the SQL query
|
||||
*/
|
||||
function natural_search($fields, $value, $numeric=0)
|
||||
|
||||
@ -591,12 +591,9 @@ class pdf_aurore extends ModelePDFAskPriceSupplier
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","PROP_OUTPUTDIR");
|
||||
$this->error=$langs->trans("ErrorConstantNotDefined","ASKSUPPLIERPICE_OUTPUTDIR");
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->error=$langs->trans("ErrorUnknown");
|
||||
return 0; // Erreur par defaut
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
|
||||
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
@ -21,11 +21,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup askpricesupplier Module de demandes de prix fournisseurs
|
||||
* \brief Module pour gerer la tenue des demandes fournisseurs
|
||||
* \defgroup askpricesupplier Module to request supplier price proposals
|
||||
* \brief Module to request supplier price proposals
|
||||
* \file htdocs/core/modules/modAskPriceSupplier.class.php
|
||||
* \ingroup askpricesupplier
|
||||
* \brief Fichier de description et activation du module AskPriceSupplier
|
||||
* \brief File to describe and activate module AskPriceSupplier
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT .'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
@ -110,7 +110,6 @@ class modAskPriceSupplier extends DolibarrModules
|
||||
$this->rights[$r][3] = 1; // La permission est-elle une permission par defaut
|
||||
$this->rights[$r][4] = 'creer';
|
||||
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = $this->numero + $r; // id de la permission
|
||||
$this->rights[$r][1] = 'Validate supplier proposals'; // libelle de la permission
|
||||
|
||||
@ -151,8 +151,9 @@ class modCommande extends DolibarrModules
|
||||
$this->rights[$r][1] = 'Annuler les commandes clients';
|
||||
$this->rights[$r][2] = 'd';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'annuler';
|
||||
|
||||
$this->rights[$r][4] = 'order_advance';
|
||||
$this->rights[$r][5] = 'annuler';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 89;
|
||||
$this->rights[$r][1] = 'Supprimer les commandes clients';
|
||||
|
||||
@ -41,7 +41,7 @@ class modContrat extends DolibarrModules
|
||||
*/
|
||||
function __construct($db)
|
||||
{
|
||||
global $conf;
|
||||
global $conf, $langs;
|
||||
|
||||
$this->db = $db;
|
||||
$this->numero = 54;
|
||||
@ -118,10 +118,12 @@ class modContrat extends DolibarrModules
|
||||
|
||||
// Exports
|
||||
//--------
|
||||
$langs->load("contracts");
|
||||
|
||||
$r=1;
|
||||
|
||||
$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||
$this->export_label[$r]='ContractAndServices'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_label[$r]=$langs->trans('ContractsAndLine'); // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r]='contract';
|
||||
$this->export_permission[$r]=array(array("contrat","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode',
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2013 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
@ -177,6 +177,14 @@ class modFournisseur extends DolibarrModules
|
||||
$this->rights[$r][4] = 'commande';
|
||||
$this->rights[$r][5] = 'receptionner';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1189;
|
||||
$this->rights[$r][1] = 'Check/Uncheck a supplier order reception';
|
||||
$this->rights[$r][2] = 'w';
|
||||
$this->rights[$r][3] = 0;
|
||||
$this->rights[$r][4] = 'commande_advance';
|
||||
$this->rights[$r][5] = 'check';
|
||||
|
||||
$r++;
|
||||
$this->rights[$r][0] = 1188;
|
||||
$this->rights[$r][1] = 'Supprimer une commande fournisseur';
|
||||
@ -251,11 +259,11 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_icon[$r]='bill';
|
||||
$this->export_permission[$r]=array(array("fournisseur","facture","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"InvoiceId",'f.ref'=>"InvoiceRef",'f.ref_supplier'=>"RefSupplier",'f.datec'=>"InvoiceDateCreation",'f.datef'=>"DateInvoice",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.total_tva'=>"TotalVAT",'f.paye'=>"InvoicePaid",'f.fk_statut'=>'InvoiceStatus','f.note_public'=>"InvoiceNote",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel','p.accountancy_code_buy'=>'ProductAccountancyBuyCode');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
//$this->export_TypeFields_array[$r]=array('s.rowid'=>"List:societe:CompanyName",'s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Text",'fd.qty'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'fd.rowid'=>'invoice_line','fd.description'=>"invoice_line",'fd.tva_tx'=>"invoice_line",'fd.qty'=>"invoice_line",'fd.remise_percent'=>"invoice_line",'fd.total_ht'=>"invoice_line",'fd.total_ttc'=>"invoice_line",'fd.tva'=>"invoice_line",'fd.product_type'=>'invoice_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product','p.accountancy_code_buy'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('invoice_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
@ -288,13 +296,48 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_entities_array[$r][$fieldname]='invoice';
|
||||
}
|
||||
}
|
||||
// End add axtra fields
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
// End add extra fields
|
||||
// Add extra fields line
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn_det'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname='extraline.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$typeFilter="Text";
|
||||
switch($obj->type)
|
||||
{
|
||||
case 'int':
|
||||
case 'double':
|
||||
case 'price':
|
||||
$typeFilter="Numeric";
|
||||
break;
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
$typeFilter="Date";
|
||||
break;
|
||||
case 'boolean':
|
||||
$typeFilter="Boolean";
|
||||
break;
|
||||
case 'sellist':
|
||||
$typeFilter="List:".$obj->param;
|
||||
break;
|
||||
}
|
||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||
$this->export_entities_array[$r][$fieldname]='invoice_line';
|
||||
}
|
||||
}
|
||||
// End add extra fields line
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'facture_fourn as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_extrafields as extra ON f.rowid = extra.fk_object';
|
||||
$this->export_sql_end[$r] .=' , '.MAIN_DB_PREFIX.'facture_fourn_det as fd';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'facture_fourn_det_extrafields as extraline ON fd.rowid = extraline.fk_object';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
|
||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_facture_fourn';
|
||||
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_invoice',1).')';
|
||||
@ -309,7 +352,7 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_TypeFields_array[$r]=array('s.nom'=>'Text','s.address'=>'Text','s.zip'=>'Text','s.town'=>'Text','c.code'=>'Text','s.phone'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.datec'=>"Date",'f.datef'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.total_tva'=>"Number",'f.paye'=>"Boolean",'f.fk_statut'=>'Status','f.note_public'=>"Text",'pf.amount'=>'Number','p.datep'=>'Date','p.num_paiement'=>'Number');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"invoice",'f.ref'=>"invoice",'f.ref_supplier'=>"invoice",'f.datec'=>"invoice",'f.datef'=>"invoice",'f.total_ht'=>"invoice",'f.total_ttc'=>"invoice",'f.total_tva'=>"invoice",'f.paye'=>"invoice",'f.fk_statut'=>'invoice','f.note_public'=>"invoice",'p.rowid'=>'payment','pf.amount'=>'payment','p.datep'=>'payment','p.num_paiement'=>'payment');
|
||||
$this->export_dependencies_array[$r]=array('payment'=>'p.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'facture_fourn'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
@ -342,7 +385,7 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_entities_array[$r][$fieldname]='invoice';
|
||||
}
|
||||
}
|
||||
// End add axtra fields
|
||||
// End add extra fields object
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
|
||||
@ -361,10 +404,10 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_icon[$r]='order';
|
||||
$this->export_permission[$r]=array(array("fournisseur","commande","export"));
|
||||
$this->export_fields_array[$r]=array('s.rowid'=>"IdCompany",'s.nom'=>'CompanyName','s.address'=>'Address','s.zip'=>'Zip','s.town'=>'Town','c.code'=>'CountryCode','s.phone'=>'Phone','s.siren'=>'ProfId1','s.siret'=>'ProfId2','s.ape'=>'ProfId3','s.idprof4'=>'ProfId4','s.idprof5'=>'ProfId5','s.idprof6'=>'ProfId6','s.tva_intra'=>'VATIntra','f.rowid'=>"OrderId",'f.ref'=>"Ref",'f.ref_supplier'=>"RefSupplier",'f.date_creation'=>"DateCreation",'f.date_commande'=>"OrderDate",'f.total_ht'=>"TotalHT",'f.total_ttc'=>"TotalTTC",'f.tva'=>"TotalVAT",'f.fk_statut'=>'Status','f.note_public'=>"NotePublic",'f.note_private'=>"NotePrivate",'fd.rowid'=>'LineId','fd.description'=>"LineDescription",'fd.tva_tx'=>"LineVATRate",'fd.qty'=>"LineQty",'fd.remise_percent'=>"Discount",'fd.total_ht'=>"LineTotalHT",'fd.total_ttc'=>"LineTotalTTC",'fd.total_tva'=>"LineTotalVAT",'fd.product_type'=>'TypeOfLineServiceOrProduct','fd.fk_product'=>'ProductId','p.ref'=>'ProductRef','p.label'=>'ProductLabel');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Boolean','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_TypeFields_array[$r]=array('s.rowid'=>"company",'s.nom'=>'Text','s.address'=>'Text','s.cp'=>'Text','s.ville'=>'Text','c.code'=>'Text','s.tel'=>'Text','s.siren'=>'Text','s.siret'=>'Text','s.ape'=>'Text','s.idprof4'=>'Text','s.idprof5'=>'Text','s.idprof6'=>'Text','s.tva_intra'=>'Text','f.ref'=>"Text",'f.ref_supplier'=>"Text",'f.date_creation'=>"Date",'f.date_commande'=>"Date",'f.total_ht'=>"Number",'f.total_ttc'=>"Number",'f.tva'=>"Number",'f.fk_statut'=>'Status','f.note_public'=>"Text",'f.note_private'=>"Text",'fd.description'=>"Text",'fd.tva_tx'=>"Number",'fd.qty'=>"Number",'fd.remise_percent'=>"Number",'fd.total_ht'=>"Number",'fd.total_ttc'=>"Number",'fd.total_tva'=>"Number",'fd.product_type'=>'Number','fd.fk_product'=>'List:Product:label','p.ref'=>'Text','p.label'=>'Text');
|
||||
$this->export_entities_array[$r]=array('s.rowid'=>"company",'s.nom'=>'company','s.address'=>'company','s.zip'=>'company','s.town'=>'company','c.code'=>'company','s.phone'=>'company','s.siren'=>'company','s.siret'=>'company','s.ape'=>'company','s.idprof4'=>'company','s.idprof5'=>'company','s.idprof6'=>'company','s.tva_intra'=>'company','f.rowid'=>"order",'f.ref'=>"order",'f.ref_supplier'=>"order",'f.date_creation'=>"order",'f.date_commande'=>"order",'f.total_ht'=>"order",'f.total_ttc'=>"order",'f.tva'=>"order",'f.fk_statut'=>'order','f.note_public'=>"order",'f.note_private'=>"order",'fd.rowid'=>'order_line','fd.description'=>"order_line",'fd.tva_tx'=>"order_line",'fd.qty'=>"order_line",'fd.remise_percent'=>"order_line",'fd.total_ht'=>"order_line",'fd.total_ttc'=>"order_line",'fd.total_tva'=>"order_line",'fd.product_type'=>'order_line','fd.fk_product'=>'product','p.ref'=>'product','p.label'=>'product');
|
||||
$this->export_dependencies_array[$r]=array('order_line'=>'fd.rowid','product'=>'fd.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
|
||||
// Add extra fields
|
||||
// Add extra fields object
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseur'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
@ -397,13 +440,48 @@ class modFournisseur extends DolibarrModules
|
||||
$this->export_entities_array[$r][$fieldname]='order';
|
||||
}
|
||||
}
|
||||
// End add axtra fields
|
||||
// End add extra fields object
|
||||
// Add extra fields line
|
||||
$sql="SELECT name, label, type, param FROM ".MAIN_DB_PREFIX."extrafields WHERE elementtype = 'commande_fournisseurdet'";
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql) // This can fail when class is used on old database (during migration for example)
|
||||
{
|
||||
while ($obj=$this->db->fetch_object($resql))
|
||||
{
|
||||
$fieldname='extraline.'.$obj->name;
|
||||
$fieldlabel=ucfirst($obj->label);
|
||||
$typeFilter="Text";
|
||||
switch($obj->type)
|
||||
{
|
||||
case 'int':
|
||||
case 'double':
|
||||
case 'price':
|
||||
$typeFilter="Numeric";
|
||||
break;
|
||||
case 'date':
|
||||
case 'datetime':
|
||||
$typeFilter="Date";
|
||||
break;
|
||||
case 'boolean':
|
||||
$typeFilter="Boolean";
|
||||
break;
|
||||
case 'sellist':
|
||||
$typeFilter="List:".$obj->param;
|
||||
break;
|
||||
}
|
||||
$this->export_fields_array[$r][$fieldname]=$fieldlabel;
|
||||
$this->export_TypeFields_array[$r][$fieldname]=$typeFilter;
|
||||
$this->export_entities_array[$r][$fieldname]='order_line';
|
||||
}
|
||||
}
|
||||
// End add extra fields line
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'societe as s';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as c ON s.fk_pays = c.rowid,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseur as f';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseur_extrafields as extra ON f.rowid = extra.fk_object,';
|
||||
$this->export_sql_end[$r] .=' '.MAIN_DB_PREFIX.'commande_fournisseurdet as fd';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'commande_fournisseurdet_extrafields as extraline ON fd.rowid = extraline.fk_object';
|
||||
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'product as p on (fd.fk_product = p.rowid)';
|
||||
$this->export_sql_end[$r] .=' WHERE f.fk_soc = s.rowid AND f.rowid = fd.fk_commande';
|
||||
$this->export_sql_end[$r] .=' AND f.entity IN ('.getEntity('supplier_order',1).')';
|
||||
|
||||
@ -67,7 +67,10 @@ $mesg='';
|
||||
* Actions
|
||||
*/
|
||||
|
||||
if ($action == 'checkdispatchline')
|
||||
if ($action == 'checkdispatchline' &&
|
||||
! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))
|
||||
)
|
||||
{
|
||||
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
|
||||
$result=$supplierorderdispatch->fetch($lineid);
|
||||
@ -81,7 +84,10 @@ if ($action == 'checkdispatchline')
|
||||
}
|
||||
}
|
||||
|
||||
if ($action == 'uncheckdispatchline')
|
||||
if ($action == 'uncheckdispatchline' &&
|
||||
! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check)))
|
||||
)
|
||||
{
|
||||
$supplierorderdispatch = new CommandeFournisseurDispatch($db);
|
||||
$result=$supplierorderdispatch->fetch($lineid);
|
||||
@ -630,15 +636,31 @@ if ($id > 0 || ! empty($ref))
|
||||
|
||||
// Add button to check/uncheck disaptching
|
||||
print '<td align="center">';
|
||||
$disabled='';
|
||||
if ($commande->statut == 5) $disabled=1;
|
||||
if (empty($objp->status))
|
||||
if ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande->receptionner))
|
||||
|| (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->fournisseur->commande_advance->check))
|
||||
)
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=checkdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Check").'</a>';
|
||||
if (empty($objp->status))
|
||||
{
|
||||
print '<a class="button buttonRefused" href="#">'.$langs->trans("Check").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="button buttonRefused" href="#">'.$langs->trans("Uncheck").'</a>';
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Uncheck").'</a>';
|
||||
$disabled='';
|
||||
if ($commande->statut == 5) $disabled=1;
|
||||
if (empty($objp->status))
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=checkdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Check").'</a>';
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<a class="button'.($disabled?' buttonRefused':'').'" href="'.$_SERVER["PHP_SELF"]."?id=".$id."&action=uncheckdispatchline&lineid=".$objp->dispatchlineid.'">'.$langs->trans("Uncheck").'</a>';
|
||||
}
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ print '</tr>'."\n";
|
||||
// Do not include sections without management permission
|
||||
//
|
||||
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/WorkboardResponse.class.php';
|
||||
require DOL_DOCUMENT_ROOT.'/core/class/workboardresponse.class.php';
|
||||
|
||||
// Number of actions to do (late)
|
||||
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->read)
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
-- -- VMYSQL4.1 DELETE FROM llx_usergroup_user WHERE fk_usergroup NOT IN (SELECT rowid from llx_usergroup);
|
||||
|
||||
|
||||
ALTER TABLE llx_extrafields ADD COLUMN perms varchar(255) after fieldrequired;
|
||||
|
||||
ALTER TABLE llx_payment_salary ADD COLUMN salary real after datev;
|
||||
|
||||
UPDATE llx_projet_task_time SET task_datehour = task_date where task_datehour IS NULL;
|
||||
|
||||
@ -29,6 +29,7 @@ create table llx_extrafields
|
||||
size varchar(8) DEFAULT NULL,
|
||||
fieldunique integer DEFAULT 0,
|
||||
fieldrequired integer DEFAULT 0,
|
||||
perms varchar(255),
|
||||
pos integer DEFAULT 0,
|
||||
alwayseditable integer DEFAULT 0,
|
||||
param text
|
||||
|
||||
@ -500,6 +500,8 @@ Module700Name=Donations
|
||||
Module700Desc=Donation management
|
||||
Module770Name=Expense Report
|
||||
Module770Desc=Management and claim expense reports (transportation, meal, ...)
|
||||
Module1120Name=Supplier commercial proposal
|
||||
Module1120Desc=Request supplier commercial proposal and prices
|
||||
Module1200Name=Mantis
|
||||
Module1200Desc=Mantis integration
|
||||
Module1400Name=Accounting
|
||||
|
||||
@ -19,6 +19,7 @@ ServiceStatusLateShort=Expired
|
||||
ServiceStatusClosed=Closed
|
||||
ServicesLegend=Services legend
|
||||
Contracts=Contracts
|
||||
ContractsAndLine=Contracts and line of contracts
|
||||
Contract=Contract
|
||||
NoContracts=No contracts
|
||||
MenuServices=Services
|
||||
|
||||
@ -1,24 +1,24 @@
|
||||
<?php
|
||||
/* Copyright (C) 2002-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2002-2003 Jean-Louis Bergamo <jlb@j1b.org>
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004 Eric Seigne <eric.seigne@ryxeo.com>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2012 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
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/user/perms.php
|
||||
@ -74,10 +74,10 @@ if ($user->id <> $id && ! $canreaduser) accessforbidden();
|
||||
|
||||
if ($action == 'addrights' && $caneditperms)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$edituser = new User($db);
|
||||
$edituser->fetch($id);
|
||||
//$edituser->addrights($rights, $module, '', $entity); // TODO unused for the moment
|
||||
$edituser->addrights($rights, $module);
|
||||
//$edituser->addrights($rights, $module, '', $entity); // TODO unused for the moment
|
||||
$edituser->addrights($rights, $module);
|
||||
|
||||
// Si on a touche a ses propres droits, on recharge
|
||||
if ($id == $user->id)
|
||||
@ -90,10 +90,10 @@ if ($action == 'addrights' && $caneditperms)
|
||||
|
||||
if ($action == 'delrights' && $caneditperms)
|
||||
{
|
||||
$edituser = new User($db);
|
||||
$edituser = new User($db);
|
||||
$edituser->fetch($id);
|
||||
//$edituser->delrights($rights, $module, '', $entity); // TODO unused for the moment
|
||||
$edituser->delrights($rights, $module);
|
||||
//$edituser->delrights($rights, $module, '', $entity); // TODO unused for the moment
|
||||
$edituser->delrights($rights, $module);
|
||||
|
||||
// Si on a touche a ses propres droits, on recharge
|
||||
if ($id == $user->id)
|
||||
@ -133,39 +133,39 @@ $modulesdir = dolGetModulesDirs();
|
||||
foreach($modulesdir as $dir)
|
||||
{
|
||||
$handle=@opendir(dol_osencode($dir));
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
if (is_resource($handle))
|
||||
{
|
||||
while (($file = readdir($handle))!==false)
|
||||
{
|
||||
if (is_readable($dir.$file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php')
|
||||
{
|
||||
$modName = substr($file, 0, dol_strlen($file) - 10);
|
||||
|
||||
if ($modName)
|
||||
{
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
if ($modName)
|
||||
{
|
||||
include_once $dir.$file;
|
||||
$objMod = new $modName($db);
|
||||
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||
{
|
||||
foreach($objMod->langfiles as $domain)
|
||||
{
|
||||
$langs->load($domain);
|
||||
}
|
||||
}
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class)
|
||||
{
|
||||
$forceEntity=((! empty($conf->multicompany->enabled) && ! empty($fuser->entity)) ? $fuser->entity : null);
|
||||
$ret=$objMod->insert_permissions(0, $forceEntity);
|
||||
$modules[$objMod->rights_class]=$objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Load all lang files of module
|
||||
if (isset($objMod->langfiles) && is_array($objMod->langfiles))
|
||||
{
|
||||
foreach($objMod->langfiles as $domain)
|
||||
{
|
||||
$langs->load($domain);
|
||||
}
|
||||
}
|
||||
// Load all permissions
|
||||
if ($objMod->rights_class)
|
||||
{
|
||||
$forceEntity=((! empty($conf->multicompany->enabled) && ! empty($fuser->entity)) ? $fuser->entity : null);
|
||||
$ret=$objMod->insert_permissions(0, $forceEntity);
|
||||
$modules[$objMod->rights_class]=$objMod;
|
||||
//print "modules[".$objMod->rights_class."]=$objMod;";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$db->commit();
|
||||
@ -195,19 +195,19 @@ dol_syslog("get user perms", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
array_push($permsuser,$obj->id);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
array_push($permsuser,$obj->id);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
// Lecture des droits groupes
|
||||
@ -231,27 +231,27 @@ dol_syslog("get user perms", LOG_DEBUG);
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
if (! isset($permsgroupbyentity[$obj->entity]))
|
||||
$permsgroupbyentity[$obj->entity] = array();
|
||||
array_push($permsgroupbyentity[$obj->entity], $obj->id);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
if (! isset($permsgroupbyentity[$obj->entity]))
|
||||
$permsgroupbyentity[$obj->entity] = array();
|
||||
array_push($permsgroupbyentity[$obj->entity], $obj->id);
|
||||
$i++;
|
||||
}
|
||||
$db->free($result);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Ecran ajout/suppression permission
|
||||
*/
|
||||
*/
|
||||
|
||||
print '<table class="border" width="100%">';
|
||||
|
||||
@ -274,9 +274,9 @@ print '</tr>'."\n";
|
||||
|
||||
print '</table><br>';
|
||||
|
||||
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"), 0, 1).'<br>';
|
||||
if ($user->admin) print info_admin($langs->trans("WarningOnlyPermissionOfActivatedModules"));
|
||||
// Show warning about external users
|
||||
if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules)).'<br><br>'."\n";
|
||||
if (empty($user->societe_id)) print info_admin(showModulesExludedForExternal($modules))."\n";
|
||||
|
||||
// For multicompany transversal mode
|
||||
// TODO Place a hook here
|
||||
@ -310,115 +310,115 @@ $sql.= " ORDER BY r.module, r.id";
|
||||
$result=$db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$oldmod='';
|
||||
$num = $db->num_rows($result);
|
||||
$i = 0;
|
||||
$var = True;
|
||||
$oldmod='';
|
||||
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
while ($i < $num)
|
||||
{
|
||||
$obj = $db->fetch_object($result);
|
||||
|
||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||
if (empty($modules[$obj->module]))
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
// Si la ligne correspond a un module qui n'existe plus (absent de includes/module), on l'ignore
|
||||
if (empty($modules[$obj->module]))
|
||||
{
|
||||
$i++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($obj->module) && ($oldmod <> $obj->module))
|
||||
{
|
||||
$oldmod = $obj->module;
|
||||
$var = !$var;
|
||||
if (isset($obj->module) && ($oldmod <> $obj->module))
|
||||
{
|
||||
$oldmod = $obj->module;
|
||||
$var = !$var;
|
||||
|
||||
// Rupture detectee, on recupere objMod
|
||||
$objMod=$modules[$obj->module];
|
||||
$picto=($objMod->picto?$objMod->picto:'generic');
|
||||
// Rupture detectee, on recupere objMod
|
||||
$objMod=$modules[$obj->module];
|
||||
$picto=($objMod->picto?$objMod->picto:'generic');
|
||||
|
||||
if ($caneditperms && (empty($objMod->rights_admin_allowed) || empty($fuser->admin)))
|
||||
{
|
||||
// On affiche ligne pour modifier droits
|
||||
print '<tr '. $bc[$var].'>';
|
||||
print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"> </a></td>';
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="perms.php?id='.$fuser->id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
if ($caneditperms && (empty($objMod->rights_admin_allowed) || empty($fuser->admin)))
|
||||
{
|
||||
// On affiche ligne pour modifier droits
|
||||
print '<tr '. $bc[$var].'>';
|
||||
print '<td class="nowrap">'.img_object('',$picto).' '.$objMod->getName();
|
||||
print '<a name="'.$objMod->getName().'"> </a></td>';
|
||||
print '<td align="center" class="nowrap">';
|
||||
print '<a title="'.dol_escape_htmltag($langs->trans("All")).'" alt="'.dol_escape_htmltag($langs->trans("All")).'" href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("All")."</a>";
|
||||
print '/';
|
||||
print '<a title="'.dol_escape_htmltag($langs->trans("None")).'" alt="'.dol_escape_htmltag($langs->trans("None")).'" href="perms.php?id='.$fuser->id.'&action=delrights&entity='.$entity.'&module='.$obj->module.'#'.$objMod->getName().'">'.$langs->trans("None")."</a>";
|
||||
print '</td>';
|
||||
print '<td colspan="2"> </td>';
|
||||
print '</tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr '. $bc[$var].'>';
|
||||
print '<tr '. $bc[$var].'>';
|
||||
|
||||
// Picto and label of permission
|
||||
print '<td>'.img_object('',$picto).' '.$objMod->getName().'</td>';
|
||||
// Picto and label of permission
|
||||
print '<td>'.img_object('',$picto).' '.$objMod->getName().'</td>';
|
||||
|
||||
// Permission and tick
|
||||
if (! empty($fuser->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center">'.img_picto($langs->trans("Administrator"),'star').'</td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else if (in_array($obj->id, $permsuser)) // Permission own by user
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
// Permission and tick
|
||||
if (! empty($fuser->admin) && ! empty($objMod->rights_admin_allowed)) // Permission own because admin
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center">'.img_picto($langs->trans("Administrator"),'star').'</td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else if (in_array($obj->id, $permsuser)) // Permission own by user
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=delrights&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_remove($langs->trans("Remove")).'</a></td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
else if (is_array($permsgroupbyentity[$entity]))
|
||||
{
|
||||
if (in_array($obj->id, $permsgroupbyentity[$entity])) // Permission own by group
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->textwithtooltip($langs->trans("Inherited"),$langs->trans("PermissionInheritedFromAGroup"));
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not own permission
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not own permission
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
else if (is_array($permsgroupbyentity[$entity]))
|
||||
{
|
||||
if (in_array($obj->id, $permsgroupbyentity[$entity])) // Permission own by group
|
||||
{
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center">';
|
||||
print $form->textwithtooltip($langs->trans("Inherited"),$langs->trans("PermissionInheritedFromAGroup"));
|
||||
print '</td>';
|
||||
}
|
||||
print '<td align="center" class="nowrap">';
|
||||
print img_picto($langs->trans("Active"),'tick');
|
||||
print '</td>';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not own permission
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Do not own permission
|
||||
if ($caneditperms)
|
||||
{
|
||||
print '<td align="center"><a href="perms.php?id='.$fuser->id.'&action=addrights&entity='.$entity.'&rights='.$obj->id.'#'.$objMod->getName().'">'.img_edit_add($langs->trans("Add")).'</a></td>';
|
||||
}
|
||||
print '<td> </td>';
|
||||
}
|
||||
|
||||
$perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle));
|
||||
print '<td>'.$perm_libelle. '</td>';
|
||||
$perm_libelle=($conf->global->MAIN_USE_ADVANCED_PERMS && ($langs->trans("PermissionAdvanced".$obj->id)!=("PermissionAdvanced".$obj->id))?$langs->trans("PermissionAdvanced".$obj->id):(($langs->trans("Permission".$obj->id)!=("Permission".$obj->id))?$langs->trans("Permission".$obj->id):$obj->libelle));
|
||||
print '<td>'.$perm_libelle. '</td>';
|
||||
|
||||
print '</tr>'."\n";
|
||||
print '</tr>'."\n";
|
||||
|
||||
$i++;
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
else dol_print_error($db);
|
||||
print '</table>';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user