Merge branch '7.0' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2018-02-25 15:01:19 +01:00
commit 003827eb06
28 changed files with 54 additions and 37 deletions

View File

@ -35,6 +35,7 @@ class AdherentType extends CommonObject
public $table_element = 'adherent_type';
public $element = 'adherent_type';
public $picto = 'group';
public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe
/**
* @var string
@ -307,7 +308,7 @@ class AdherentType extends CommonObject
$sql = "SELECT rowid, libelle as label";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql.= " WHERE entity IN (".getEntity('adherent').")";
$sql.= " WHERE entity IN (".getEntity('member_type').")";
$resql=$this->db->query($sql);
if ($resql)

View File

@ -97,7 +97,7 @@ class MembersTypes extends DolibarrApi
$sql = "SELECT t.rowid";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= ' WHERE t.entity IN ('.getEntity('adherent').')';
$sql.= ' WHERE t.entity IN ('.getEntity('member_type').')';
// Add sql filters
if ($sqlfilters)

View File

@ -65,7 +65,7 @@ $sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."adherent as d";
$sql.= " ON t.rowid = d.fk_adherent_type";
$sql.= " AND d.entity IN (".getEntity('adherent').")";
$sql.= " WHERE t.entity IN (".getEntity('adherent').")";
$sql.= " WHERE t.entity IN (".getEntity('member_type').")";
$sql.= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members by type", LOG_DEBUG);

View File

@ -574,7 +574,7 @@ if (! empty($arrayfields['d.datefin']['checked'])) print_liste_field_titr
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['d.datec']['checked'])) print_liste_field_titre($arrayfields['d.datec']['label'],$_SERVER["PHP_SELF"],"d.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -216,7 +216,7 @@ if (! $rowid && $action != 'create' && $action != 'edit')
$sql = "SELECT d.rowid, d.libelle as label, d.subscription, d.vote";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type as d";
$sql.= " WHERE d.entity IN (".getEntity('adherent').")";
$sql.= " WHERE d.entity IN (".getEntity('member_type').")";
$result = $db->query($sql);
if ($result)

View File

@ -1316,7 +1316,7 @@ class Propal extends CommonObject
function fetch($rowid,$ref='')
{
$sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql = "SELECT p.rowid, p.ref, p.entity, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
$sql.= ", p.datec";
$sql.= ", p.date_valid as datev";
@ -1362,6 +1362,7 @@ class Propal extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;

View File

@ -614,7 +614,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -1567,7 +1567,7 @@ class Commande extends CommonOrder
// Check parameters
if (empty($id) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT c.rowid, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
$sql = 'SELECT c.rowid, c.entity, c.date_creation, c.ref, c.fk_soc, c.fk_user_author, c.fk_user_valid, c.fk_statut';
$sql.= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason';
$sql.= ', c.fk_account';
$sql.= ', c.date_commande';
@ -1597,12 +1597,14 @@ class Commande extends CommonOrder
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
{
$obj = $this->db->fetch_object($result);
if ($obj)
{
$this->id = $obj->rowid;
if ($result)
{
$obj = $this->db->fetch_object($result);
if ($obj)
{
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->ref_client = $obj->ref_client;
$this->ref_customer = $obj->ref_client;

View File

@ -701,7 +701,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['c.datec']['checked'])) print_liste_field_titre($arrayfields['c.datec']['label'],$_SERVER["PHP_SELF"],"c.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -1237,7 +1237,7 @@ class Facture extends CommonInvoice
if (empty($rowid) && empty($ref) && empty($ref_ext) && empty($ref_int)) return -1;
$sql = 'SELECT f.rowid,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql = 'SELECT f.rowid,f.entity,f.facnumber,f.ref_client,f.ref_ext,f.ref_int,f.type,f.fk_soc,f.amount';
$sql.= ', f.tva, f.localtax1, f.localtax2, f.total, f.total_ttc, f.revenuestamp';
$sql.= ', f.remise_percent, f.remise_absolue, f.remise';
$sql.= ', f.datef as df, f.date_pointoftax';
@ -1274,6 +1274,8 @@ class Facture extends CommonInvoice
$obj = $this->db->fetch_object($result);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->facnumber;
$this->ref_client = $obj->ref_client;
$this->ref_ext = $obj->ref_ext;
@ -3840,6 +3842,7 @@ class Facture extends CommonInvoice
// Initialize parameters
$this->id=0;
$this->entity = 1;
$this->ref = 'SPECIMEN';
$this->specimen=1;
$this->socid = 1;

View File

@ -862,7 +862,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -46,7 +46,7 @@ if (! empty($massaction) && count($toselect) < 1)
$error++;
setEventMessages($langs->trans("NoRecordSelected"), null, "warnings");
}
if (! $error && count($toselect) > $maxformassaction)
if (! $error && is_array($toselect) && count($toselect) > $maxformassaction)
{
setEventMessages($langs->trans('TooManyRecordForMassAction',$maxformassaction), null, 'errors');
$error++;

View File

@ -88,7 +88,7 @@ class box_members extends ModeleBoxes
$sql.= " a.datec, a.tms, a.statut as status, a.datefin as date_end_subscription,";
$sql.= " t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as a, ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE a.entity = ".$conf->entity;
$sql.= " WHERE a.entity IN (".getEntity('member').")";
$sql.= " AND a.fk_adherent_type = t.rowid";
$sql.= " ORDER BY a.tms DESC";
$sql.= $db->plimit($max, 0);

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (c) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2010 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2010-2018 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
@ -194,9 +194,12 @@ class FormActions
$projectid = $object->fk_project;
if ($typeelement == 'project') $projectid = $object->id;
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
$buttontoaddnewevent.= $langs->trans("AddEvent");
$buttontoaddnewevent.= '</a>';
if (! empty($conf->agenda->enabled))
{
$buttontoaddnewevent = '<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&datep='.dol_print_date(dol_now(),'dayhourlog').'&origin='.$typeelement.'&originid='.$object->id.($object->socid>0?'&socid='.$object->socid:'').($projectid>0?'&projectid='.$projectid:'').'&backtopage='.urlencode($urlbacktopage).'">';
$buttontoaddnewevent.= $langs->trans("AddEvent");
$buttontoaddnewevent.= '</a>';
}
print '<!-- formactions->showactions -->'."\n";
print load_fiche_titre($title, $buttontoaddnewevent, '', 0, 0, '', $morehtmlright);

View File

@ -127,7 +127,7 @@ class mailing_fraise extends MailingTargets
$s.='<select name="filter_type" class="flat">';
$sql = "SELECT rowid, libelle, statut";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent_type";
$sql.= " WHERE entity = ".$conf->entity;
$sql.= " WHERE entity IN (".getEntity('member_type').")";
$sql.= " ORDER BY rowid";
$resql = $this->db->query($sql);
if ($resql)

View File

@ -290,7 +290,7 @@ class modAdherent extends DolibarrModules
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'subscription as c ON c.fk_adherent = a.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON a.state_id = d.rowid';
$this->export_sql_end[$r] .=' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co ON a.country = co.rowid';
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('adherent').') ';
$this->export_sql_end[$r] .=' WHERE a.fk_adherent_type = ta.rowid AND ta.entity IN ('.getEntity('member_type').') ';
$this->export_dependencies_array[$r]=array('subscription'=>'c.rowid'); // To add unique key if we ask a field of a child to avoid the DISTINCT to discard them
// Imports

View File

@ -218,7 +218,7 @@ class CommandeFournisseur extends CommonOrder
// Check parameters
if (empty($id) && empty($ref)) return -1;
$sql = "SELECT c.rowid, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,";
$sql = "SELECT c.rowid, c.entity, c.ref, ref_supplier, c.fk_soc, c.fk_statut, c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_vat,";
$sql.= " c.localtax1, c.localtax2, ";
$sql.= " c.date_creation, c.date_valid, c.date_approve, c.date_approve2,";
$sql.= " c.fk_user_author, c.fk_user_valid, c.fk_user_approve, c.fk_user_approve2,";
@ -253,6 +253,8 @@ class CommandeFournisseur extends CommonOrder
}
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->ref_supplier = $obj->ref_supplier;
$this->socid = $obj->fk_soc;

View File

@ -914,7 +914,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['cf.datec']['checked'])) print_liste_field_titre($arrayfields['cf.datec']['label'],$_SERVER["PHP_SELF"],"cf.date_creation","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -762,7 +762,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['f.datec']['checked'])) print_liste_field_titre($arrayfields['f.datec']['label'],$_SERVER["PHP_SELF"],"f.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -242,7 +242,7 @@ UPDATE llx_bank_account SET accountancy_journal = 'OD' WHERE accountancy_journal
ALTER TABLE llx_bank_account ADD COLUMN fk_accountancy_journal integer;
ALTER TABLE llx_bank_account ADD INDEX idx_fk_accountancy_journal (fk_accountancy_journal);
UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
UPDATE llx_bank_account AS ba SET fk_accountancy_journal = (SELECT rowid FROM llx_accounting_journal AS aj WHERE ba.accountancy_journal = aj.code AND aj.entity = ba.entity) WHERE accountancy_journal NOT IN ('1', '2', '3', '4', '5', '6', '5', '8', '9', '10', '11', '12', '13', '14', '15');
ALTER TABLE llx_bank_account ADD CONSTRAINT fk_bank_account_accountancy_journal FOREIGN KEY (fk_accountancy_journal) REFERENCES llx_accounting_journal (rowid);
--Update general ledger for FEC format & harmonization

View File

@ -422,7 +422,7 @@ foreach($object->fields as $key => $val)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n";

View File

@ -654,7 +654,7 @@ else
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['p.datec']['checked'])) print_liste_field_titre($arrayfields['p.datec']['label'],$_SERVER["PHP_SELF"],"p.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -1177,7 +1177,7 @@ else
// Address
print '<tr><td class="tdtop">'.fieldLabel('Address','address').'</td>';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="'._ROWS_2.'" wrap="soft">';
print '<td colspan="3"><textarea name="address" id="address" class="quatrevingtpercent" rows="'.ROWS_2.'" wrap="soft">';
print $object->address;
print '</textarea></td></tr>';

View File

@ -222,7 +222,8 @@ if ($id > 0 || ! empty($ref))
$sql.= " t.libelle as type, t.subscription";
$sql.= " FROM ".MAIN_DB_PREFIX."adherent as d";
$sql.= ", ".MAIN_DB_PREFIX."adherent_type as t";
$sql.= " WHERE d.fk_soc=".$id;
$sql.= " WHERE d.fk_soc = ".$id;
$sql.= " AND d.fk_adherent_type = t.rowid";
dol_syslog("get list sql=".$sql);
$resql = $db->query($sql);

View File

@ -1127,7 +1127,7 @@ class SupplierProposal extends CommonObject
{
global $conf;
$sql = "SELECT p.rowid, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql = "SELECT p.rowid, p.entity, p.ref, p.remise, p.remise_percent, p.remise_absolue, p.fk_soc";
$sql.= ", p.total, p.tva, p.localtax1, p.localtax2, p.total_ht";
$sql.= ", p.datec";
$sql.= ", p.date_valid as datev";
@ -1161,6 +1161,7 @@ class SupplierProposal extends CommonObject
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->entity = $obj->entity;
$this->ref = $obj->ref;
$this->remise = $obj->remise;

View File

@ -599,7 +599,7 @@ if ($resql)
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['sp.datec']['checked'])) print_liste_field_titre($arrayfields['sp.datec']['label'],$_SERVER["PHP_SELF"],"sp.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);

View File

@ -67,6 +67,9 @@ if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS))
$canreadgroup=(! empty($user->admin) || $user->rights->user->group_advance->read);
$caneditgroup=(! empty($user->admin) || $user->rights->user->group_advance->write);
}
if(! empty($conf->multicompany->enabled) && ! empty($conf->global->MULTICOMPANY_TRANSVERSE_MODE)) {
$caneditgroup = ($conf->entity == 1) && ! empty($user->admin) && empty($user->entity);
}
// Define value to know what current user can do on properties of edited user
if ($id)
{
@ -1795,7 +1798,7 @@ else
}
else
{
print '<tr '.$bc[false].'><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
}
}

View File

@ -406,7 +406,7 @@ if (! empty($arrayfields['u.datepreviouslogin']['checked'])) print_liste_field_t
// Extra fields
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
// Hook fields
$parameters=array('arrayfields'=>$arrayfields);
$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder);
$reshook=$hookmanager->executeHooks('printFieldListTitle',$parameters); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (! empty($arrayfields['u.datec']['checked'])) print_liste_field_titre("DateCreationShort",$_SERVER["PHP_SELF"],"u.datec","",$param,'align="center" class="nowrap"',$sortfield,$sortorder);