Merge remote-tracking branch 'origin/3.7' into develop

Conflicts:
	htdocs/core/lib/functions.lib.php
This commit is contained in:
Laurent Destailleur 2014-12-07 19:19:48 +01:00
commit 634a9d8402
26 changed files with 58 additions and 45 deletions

View File

@ -57,7 +57,7 @@ class ActionComm extends CommonObject
var $datef; // Date action end (datep2)
var $durationp = -1; // -1=Unkown duration // deprecated
var $fulldayevent = 0; // 1=Event on full day
var $punctual = 1; // Milestone // TODO Not sure we need this. Milestone is already event with end date = start date
var $punctual = 1; // Milestone // deprecated. Milestone is already event with end date = start date
var $percentage; // Percentage
var $location; // Location

View File

@ -180,7 +180,7 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as ut ON a.fk_user_action = ut.rowid";
if ($usergroup > 0) $sql.= ", ".MAIN_DB_PREFIX."usergroup_user as ugu";
$sql.= " WHERE c.id = a.fk_action";
$sql.= ' AND a.fk_user_author = u.rowid';
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; // To limit to entity
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
if ($actioncode) $sql.=" AND c.code='".$db->escape($actioncode)."'";
if ($pid) $sql.=" AND a.fk_project=".$db->escape($pid);
if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND (a.fk_soc IS NULL OR sc.fk_user = " .$user->id . ")";

View File

@ -610,7 +610,7 @@ else
$sql = "SELECT u.rowid, u.lastname as lastname, u.firstname, u.statut, u.login, u.admin, u.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."user as u";
if ($usergroup > 0) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."usergroup_user as ug ON u.rowid = ug.fk_user";
$sql.= " WHERE u.entity IN (".getEntity('user').")";
$sql.= " WHERE u.entity IN (".getEntity('user',1).")";
if ($usergroup > 0) $sql.= " AND ug.fk_usergroup = ".$usergroup;
if (GETPOST("usertodo","int",3) > 0) $sql.=" AND u.rowid = ".GETPOST("usertodo","int",3);
//print $sql;

View File

@ -1,7 +1,7 @@
<?php
/* Copyright (C) 2001-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2003 Eric Seigne <erics@rycks.com>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2014 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
*
* This program is free software; you can redistribute it and/or modify
@ -55,6 +55,7 @@ $result = restrictedArea($user, 'agenda', $socid, '', 'myactions');
/*
* Actions
*/
if ($action == 'builddoc')
{
$cat = new CommActionRapport($db, $month, $year);
@ -79,7 +80,7 @@ $sql.= " date_format(a.datep, '%Y') as year";
$sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a,";
$sql.= " ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE a.fk_user_author = u.rowid";
$sql.= " AND a.entity = ".$conf->entity;
$sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')';
//$sql.= " AND percent = 100";
$sql.= " GROUP BY year, month, df";
$sql.= " ORDER BY year DESC, month DESC, df DESC";

View File

@ -50,7 +50,7 @@ echo $this->control->tpl['ajax_selectcountry']; ?>
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("ThirdParty"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>

View File

@ -59,7 +59,7 @@ echo $this->control->tpl['ajax_selectcountry'];
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("ThirdParty"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>

View File

@ -44,7 +44,7 @@ dol_htmloutput_errors($this->control->tpl['error'],$this->control->tpl['errors']
</tr>
<tr>
<td><?php echo $langs->trans("Company"); ?></td>
<td><?php echo $langs->trans("ThirdParty"); ?></td>
<td colspan="3"><?php echo $this->control->tpl['company']; ?></td>
</tr>

View File

@ -456,7 +456,7 @@ else
{
if ($socid > 0)
{
print '<tr><td><label for="socid">'.$langs->trans("Company").'</label></td>';
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $objsoc->getNomUrl(1);
print '</td>';
@ -464,7 +464,7 @@ else
print '</td></tr>';
}
else {
print '<tr><td><label for="socid">'.$langs->trans("Company").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td><td colspan="3" class="maxwidthonsmartphone">';
print $form->select_company($socid,'socid','',1);
print '</td></tr>';
}
@ -690,7 +690,7 @@ else
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
print '<tr><td><label for="socid">'.$langs->trans("Company").'</label></td>';
print '<tr><td><label for="socid">'.$langs->trans("ThirdParty").'</label></td>';
print '<td colspan="3" class="maxwidthonsmartphone">';
print $form->select_company(GETPOST('socid','int')?GETPOST('socid','int'):($object->socid?$object->socid:-1),'socid','',1);
print '</td>';
@ -924,7 +924,7 @@ else
// Company
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
{
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
if ($object->socid > 0)
{
$objsoc->fetch($object->socid);

View File

@ -77,11 +77,11 @@ if (empty($conf->global->SOCIETE_DISABLE_CONTACTS))
$objsoc = new Societe($db);
$objsoc->fetch($contact->socid);
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
print '<tr><td width="15%">'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td width="15%">'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td width="15%">'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}

View File

@ -105,11 +105,11 @@ if ($contact->socid > 0)
$objsoc = new Societe($db);
$objsoc->fetch($contact->socid);
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
print '<tr><td width="20%">'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td width="20%">'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td width="20%">'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}

View File

@ -300,7 +300,7 @@ if ($result)
print_liste_field_titre($langs->trans("Lastname"),$_SERVER["PHP_SELF"],"p.lastname", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Firstname"),$_SERVER["PHP_SELF"],"p.firstname", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("PostOrFunction"),$_SERVER["PHP_SELF"],"p.poste", $begin, $param, '', $sortfield,$sortorder);
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("Company"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) print_liste_field_titre($langs->trans("ThirdParty"),$_SERVER["PHP_SELF"],"s.nom", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Phone"),$_SERVER["PHP_SELF"],"p.phone", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);

View File

@ -98,12 +98,12 @@ if ($id > 0)
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}

View File

@ -111,11 +111,11 @@ if ($action == 'edit')
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td>';
}
else
{
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}
@ -179,12 +179,12 @@ else
$objsoc = new Societe($db);
$objsoc->fetch($object->socid);
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">'.$objsoc->getNomUrl(1).'</td></tr>';
}
else
{
print '<tr><td>'.$langs->trans("Company").'</td><td colspan="3">';
print '<tr><td>'.$langs->trans("ThirdParty").'</td><td colspan="3">';
print $langs->trans("ContactNotLinkedToCompany");
print '</td></tr>';
}

View File

@ -827,7 +827,7 @@ class Form
{
if (count($events)) // Add management of event
{
print '<script type="text/javascript">
$out.='<script type="text/javascript">
$(document).ready(function() {
jQuery("#'.$htmlname.'").change(function () {
var obj = '.json_encode($events).';

View File

@ -271,13 +271,13 @@ class FormFile
if (! empty($iconPDF)) {
return $this->getDocumentsLink($modulepart, $modulesubdir, $filedir);
}
$printer=0;
if (in_array($modulepart,array('facture','propal','proposal','order','commande'))) // This feature is implemented only for such elements
{
$printer = (!empty($user->rights->printipp->read) && !empty($conf->printipp->enabled))?true:false;
}
$hookmanager->initHooks(array('formfile'));
$forname='builddoc';
$out='';
@ -1101,6 +1101,8 @@ class FormFile
global $bc;
global $sortfield, $sortorder;
$langs->load("link");
require_once DOL_DOCUMENT_ROOT . '/core/class/link.class.php';
$link = new Link($this->db);
$links = array();
@ -1162,7 +1164,7 @@ class FormFile
$nboflinks = count($links);
if ($nboflinks > 0) include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
$var = false;
$var = true;
foreach ($links as $link)
{
$var =! $var;

View File

@ -71,12 +71,12 @@ if (! empty($useragent))
// Check PHP version
if (versioncompare(versionphparray(),array(4,3,10)) < 0) // Minimum to use (error if lower)
if (versioncompare(versionphparray(),array(5,2,3)) < 0) // Minimum to use (error if lower)
{
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'4.3.10');
print '<img src="../theme/eldy/img/error.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'5.2.3');
$checksok=0; // 0=error, 1=warning
}
else if (versioncompare(versionphparray(),array(5,3,0)) < 0) // Minimum supported (error if lower)
else if (versioncompare(versionphparray(),array(5,3,0)) < 0) // Minimum supported (warning if lower)
{
print '<img src="../theme/eldy/img/warning.png" alt="Error"> '.$langs->trans("ErrorPHPVersionTooLow",'5.3.0');
$checksok=0; // 0=error, 1=warning

View File

@ -1140,6 +1140,8 @@ ALTER TABLE llx_facture_rec ADD COLUMN revenuestamp double(24,8) DEFAULT 0;
ALTER TABLE llx_facturedet_rec MODIFY COLUMN tva_tx double(6,3);
ALTER TABLE llx_facturedet_rec ADD COLUMN fk_contract_line integer NULL;
ALTER TABLE llx_resource MODIFY COLUMN entity integer DEFAULT 1 NOT NULL;
-- This request make mysql drop (mysql bug, so we add it at end):
--ALTER TABLE llx_product ADD CONSTRAINT fk_product_barcode_type FOREIGN KEY (fk_barcode_type) REFERENCES llx_c_barcode_type(rowid);

View File

@ -51,10 +51,10 @@ create table llx_actioncomm
priority smallint,
fulldayevent smallint NOT NULL default 0,
punctual smallint NOT NULL default 1,
punctual smallint NOT NULL default 1, -- deprecated. milestone is event with date start = date end
percent smallint NOT NULL default 0,
location varchar(128),
durationp real, -- duree planifiee
durationp real, -- planed duration
durationa real, -- deprecated
note text,

View File

@ -17,7 +17,7 @@
CREATE TABLE llx_resource
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
entity integer,
entity integer DEFAULT 1 NOT NULL,
ref varchar(255),
description text,
fk_code_type_resource varchar(32),

View File

@ -783,6 +783,7 @@ DictionaryOrderMethods=Ordering methods
DictionarySource=Origin of proposals/orders
DictionaryAccountancyplan=Chart of accounts
DictionaryAccountancysystem=Models for chart of accounts
DictionaryEMailTemplates=Emails templates
SetupSaved=Setup saved
BackToModuleList=Back to modules list
BackToDictionaryList=Back to dictionaries list

View File

@ -31,6 +31,4 @@ ConfirmDeleteResource=Confirm to delete this resource
RessourceSuccessfullyDeleted=Resource successfully deleted
DictionaryResourceType=Type of resources
DictionaryEMailTemplates=Modèles d'Emails
SelectResource=Select resource

View File

@ -123,7 +123,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= " WHERE p.entity = ".getEntity('survey');
$sql.= " WHERE p.entity = ".getEntity('survey',1);
if ($status == 'expired') $sql.=" AND date_fin < '".$db->idate($now)."'";
if ($status == 'opened') $sql.=" AND date_fin >= '".$db->idate($now)."'";
if ($surveytitle) $sql.=" AND titre LIKE '%".$db->escape($surveytitle)."%'";

View File

@ -298,7 +298,7 @@ class Project extends CommonObject
else if (! empty($ref))
{
$sql.= " WHERE ref='".$this->db->escape($ref)."'";
$sql.= " AND entity IN (".getEntity('project').")";
$sql.= " AND entity IN (".getEntity('project',1).")";
}
dol_syslog(get_class($this)."::fetch", LOG_DEBUG);
@ -910,7 +910,7 @@ class Project extends CommonObject
$sql.= ", " . MAIN_DB_PREFIX . "element_contact as ec";
$sql.= ", " . MAIN_DB_PREFIX . "c_type_contact as ctc";
}
$sql.= " WHERE p.entity IN (".getEntity('project').")";
$sql.= " WHERE p.entity IN (".getEntity('project',1).")";
// Internal users must see project he is contact to even if project linked to a third party he can't see.
//if ($socid || ! $user->rights->societe->client->voir) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = ".$socid.")";
if ($socid > 0) $sql.= " AND (p.fk_soc IS NULL OR p.fk_soc = 0 OR p.fk_soc = " . $socid . ")";

View File

@ -388,7 +388,7 @@ class Resource extends CommonObject
$sql.= " ty.label as type_label";
$sql.= " FROM ".MAIN_DB_PREFIX."resource as t";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_type_resource as ty ON ty.code=t.fk_code_type_resource";
//$sql.= " WHERE t.entity IN (".getEntity('resource').")";
$sql.= " WHERE t.entity IN (".getEntity('resource',1).")";
//Manage filter
if (!empty($filter)){
@ -402,7 +402,7 @@ class Resource extends CommonObject
}
}
$sql.= " GROUP BY t.rowid";
$sql.= " ORDER BY $sortfield $sortorder ";
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
@ -462,7 +462,7 @@ class Resource extends CommonObject
$sql.= " t.fk_user_create,";
$sql.= " t.tms";
$sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t ';
//$sql.= " WHERE t.entity IN (".getEntity('resource').")";
$sql.= " WHERE t.entity IN (".getEntity('resource',1).")";
//Manage filter
if (!empty($filter)){
@ -476,7 +476,8 @@ class Resource extends CommonObject
}
}
$sql.= " GROUP BY t.rowid";
$sql.= " ORDER BY $sortfield $sortorder " . $this->db->plimit($limit+1,$offset);
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
$resql=$this->db->query($sql);
@ -547,7 +548,7 @@ class Resource extends CommonObject
$sql.= " t.fk_user_create,";
$sql.= " t.tms";
$sql.= ' FROM '.MAIN_DB_PREFIX .'element_resources as t ';
//$sql.= " WHERE t.entity IN (".getEntity('resource').")";
$sql.= " WHERE t.entity IN (".getEntity('resource',1).")";
//Manage filter
if (!empty($filter)){
@ -561,7 +562,8 @@ class Resource extends CommonObject
}
}
$sql.= " GROUP BY t.resource_id";
$sql.= " ORDER BY " . $sortfield . " " . $sortorder . " " . $this->db->plimit($limit+1,$offset);
$sql.= $this->db->order($sortfield,$sortorder);
if ($limit) $sql.= $this->db->plimit($limit+1,$offset);
dol_syslog(get_class($this)."::fetch_all", LOG_DEBUG);
$resql=$this->db->query($sql);

View File

@ -76,11 +76,18 @@ $langs->load("orders");
$langs->load("suppliers");
$langs->load("propal");
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('consumptionthirdparty'));
/*
* Actions
*/
$parameters=array('id'=>$socid);
$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
/*

View File

@ -147,7 +147,7 @@ if ($object->id)
print '</table>';
print '</div>';
dol_fiche_end();
$modulepart = 'societe';
$permission = $user->rights->societe->creer;