Start to remove too low level permission. Philisophy of dolibarr is

having a minum of permission. Starting to include one permission for
each field we manage should not be into core.
Also activation of "skype" field in a future should probably be
rewritten to support as several communication id (chat, skype,
hanghout) with only one feature.
This commit is contained in:
Laurent Destailleur 2013-12-14 20:58:03 +01:00
commit fbeb61861a
20 changed files with 180 additions and 132 deletions

View File

@ -141,6 +141,10 @@ parameter. All methods addline in this case were modified to remove this paramet
5) Property ->tel on objects is now ->phone
6) Trigger LINEPROPAL_MODIFY is renamed into LINEPROPAL_UPDATE and
Trigger CONTRACT_LINE_DELETE rnamed into LINECONTRACT_DELETE to match naming rules.
***** ChangeLog for 3.4.2 compared to 3.4.1 *****
Fix: field's problem into company's page (RIB)

View File

@ -285,7 +285,7 @@ if ($action == 'update' && ! $_POST["cancel"] && $user->rights->adherent->creer)
$object->phone_perso = trim($_POST["phone_perso"]);
$object->phone_mobile= trim($_POST["phone_mobile"]);
$object->email = trim($_POST["email"]);
$object->skype = trim($_POST["skype"]);
$object->skype = trim($_POST["skype"]);
$object->birth = $birthdate;
$object->typeid = $_POST["typeid"];
@ -428,7 +428,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$phone=$_POST["phone"];
$phone_perso=$_POST["phone_perso"];
$phone_mobile=$_POST["phone_mobile"];
$skype=$_POST["member_skype"];
$skype=$_POST["member_skype"];
$email=$_POST["member_email"];
$login=$_POST["member_login"];
$pass=$_POST["password"];
@ -453,7 +453,7 @@ if ($action == 'add' && $user->rights->adherent->creer)
$object->phone = $phone;
$object->phone_perso = $phone_perso;
$object->phone_mobile= $phone_mobile;
$object->skype = $skype;
$object->skype = $skype;
$object->email = $email;
$object->login = $login;
$object->pass = $pass;
@ -861,11 +861,11 @@ else
// Tel mobile
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(GETPOST('phone_mobile','alpha')?GETPOST('phone_mobile','alpha'):$object->phone_mobile).'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="member_skype" size="40" value="'.(GETPOST('member_skype','alpha')?GETPOST('member_skype','alpha'):$object->skype).'"></td></tr>';
}
// Skype
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="member_skype" size="40" value="'.(GETPOST('member_skype','alpha')?GETPOST('member_skype','alpha'):$object->skype).'"></td></tr>';
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
@ -1103,11 +1103,11 @@ else
// Tel mobile
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td><input type="text" name="phone_mobile" size="20" value="'.(isset($_POST["phone_mobile"])?$_POST["phone_mobile"]:$object->phone_mobile).'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" size="40" value="'.(isset($_POST["skype"])?$_POST["skype"]:$object->skype).'"></td></tr>';
}
// Skype
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td><input type="text" name="skype" size="40" value="'.(isset($_POST["skype"])?$_POST["skype"]:$object->skype).'"></td></tr>';
}
// Birthday
print "<tr><td>".$langs->trans("Birthday")."</td><td>\n";
@ -1328,7 +1328,7 @@ else
/*
* Confirm add in spip
*/
*/
if ($action == 'add_spip')
{
print $form->formconfirm("fiche.php?rowid=".$rowid, $langs->trans('AddIntoSpip'), $langs->trans('AddIntoSpipConfirmation'), 'confirm_add_spip');
@ -1336,7 +1336,7 @@ else
/*
* Confirm removed from spip
*/
*/
if ($action == 'del_spip')
{
print $form->formconfirm("fiche.php?rowid=$rowid", $langs->trans('DeleteIntoSpip'), $langs->trans('DeleteIntoSpipConfirmation'), 'confirm_del_spip');
@ -1345,6 +1345,7 @@ else
$rowspan=17;
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) $rowspan++;
if (! empty($conf->societe->enabled)) $rowspan++;
if (! empty($conf->skype->enabled)) $rowspan++;
print '<table class="border" width="100%">';
@ -1427,12 +1428,12 @@ else
// Tel mobile
print '<tr><td>'.$langs->trans("PhoneMobile").'</td><td class="valeur">'.dol_print_phone($object->phone_mobile,$object->country_code,0,$object->fk_soc,1).'</td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
print '<tr><td>'.$langs->trans("Skype").'</td><td class="valeur">'.dol_print_skype($object->skype,0,$object->fk_soc,1).'</td></tr>';
}
// Skype
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td class="valeur">'.dol_print_skype($object->skype,0,$object->fk_soc,1).'</td></tr>';
}
// Birthday
print '<tr><td>'.$langs->trans("Birthday").'</td><td class="valeur">'.dol_print_date($object->birth,'day').'</td></tr>';

View File

@ -159,7 +159,7 @@ foreach ($modulesdir as $dir)
if ($objMod->version == 'experimental' && (empty($conf->global->$const_name) && ($conf->global->MAIN_FEATURES_LEVEL < 1))) $modulequalified=0;
// We discard modules according to property disabled
if (isset($objMod->hidden) && $objMod->hidden) $modulequalified=false;
// Define array $categ with categ with at least one qualified module
if ($modulequalified)
{

View File

@ -267,11 +267,11 @@ if ($id > 0)
// Fax
print '<td>'.$langs->trans('Fax').'</td><td style="min-width: 25%;">'.dol_print_phone($object->fax,$object->country_code,0,$object->id,'AC_FAX').'</td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
print '<td>'.$langs->trans('Skype').'</td><td colspan="3">'.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'</td></tr>';
}
// Skype
if (! empty($conf->skype->enabled))
{
print '<td>'.$langs->trans('Skype').'</td><td colspan="3">'.dol_print_skype($object->skype,0,$object->id,'AC_SKYPE').'</td></tr>';
}
// Assujeti a TVA ou pas
print '<tr>';

View File

@ -60,6 +60,8 @@ if ($search_status=='') $search_status=1; // always display activ customer first
$search_sale = GETPOST("search_sale");
$search_categ = GETPOST("search_categ",'int');
$catid = GETPOST("catid",'int');
// If the internal user must only see his customers, force searching by him
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// Initialize technical object to manage hooks of thirdparties. Note that conf->hooks_modules contains array array
$hookmanager->initHooks(array('customerlist'));
@ -104,17 +106,15 @@ llxHeader('',$langs->trans("ThirdParty"),$help_url);
$sql = "SELECT s.rowid, s.nom as name, s.client, s.zip, s.town, st.libelle as stcomm, s.prefix_comm, s.code_client, s.code_compta, s.status as status,";
$sql.= " s.datec, s.datea, s.canvas";
// We'll need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user";
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql.= " FROM ".MAIN_DB_PREFIX."societe as s";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
// We'll need this table joined to the select in order to filter by sale
if ($search_sale || !$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client IN (1, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if (!$user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = ".$socid;
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
@ -149,8 +149,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit +1, $offset);
dol_syslog('comm:list.php: sql='.$sql,LOG_DEBUG);
dol_syslog('comm/list.php: sql='.$sql,LOG_DEBUG);
$result = $db->query($sql);
if ($result)
{

View File

@ -701,7 +701,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
$price_base_type = (GETPOST('price_base_type', 'alpha')?GETPOST('price_base_type', 'alpha'):'HT');
$db->begin();
// Ecrase $pu par celui du produit
// Ecrase $desc par celui du produit
// Ecrase $txtva par celui du produit
@ -861,7 +861,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
if ($result > 0)
{
$db->commit();
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
@ -903,7 +903,7 @@ else if (($action == 'addline' || $action == 'addline_predef') && $user->rights-
else
{
$db->rollback();
setEventMessage($object->error, 'errors');
}
}
@ -984,11 +984,11 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
$error++;
}
}
if (! $error)
{
$db->begin();
$result = $object->updateline(
GETPOST('lineid'),
$pu_ht,
@ -1015,7 +1015,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
if ($result >= 0)
{
$db->commit();
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE))
{
// Define output language
@ -1046,7 +1046,7 @@ else if ($action == 'updateligne' && $user->rights->propal->creer && GETPOST('sa
else
{
$db->rollback();
setEventMessage($object->error, 'errors');
}
}
@ -1980,8 +1980,8 @@ else
// Amount HT
print '<tr><td height="10" width="25%">'.$langs->trans('AmountHT').'</td>';
print '<td align="right" class="nowrap"><b>'.price($object->total_ht).'</b></td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td>';
print '<td align="right" class="nowrap"><b>'.price($object->total_ht,'',$langs,0,-1,-1,$conf->currency).'</b></td>';
print '<td></td>';
// Margin Infos
if (! empty($conf->margin->enabled)) {
@ -1993,28 +1993,28 @@ else
// Amount VAT
print '<tr><td height="10">'.$langs->trans('AmountVAT').'</td>';
print '<td align="right" class="nowrap">'.price($object->total_tva).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" class="nowrap">'.price($object->total_tva,'',$langs,0,-1,-1,$conf->currency).'</td>';
print '<td></td></tr>';
// Amount Local Taxes
if ($mysoc->localtax1_assuj=="1") //Localtax1
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT1",$mysoc->country_code).'</td>';
print '<td align="right" class="nowrap">'.price($object->total_localtax1).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" class="nowrap">'.price($object->total_localtax1,'',$langs,0,-1,-1,$conf->currency).'</td>';
print '<td></td></tr>';
}
if ($mysoc->localtax2_assuj=="1") //Localtax2
{
print '<tr><td height="10">'.$langs->transcountry("AmountLT2",$mysoc->country_code).'</td>';
print '<td align="right" class="nowrap">'.price($object->total_localtax2).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" class="nowrap">'.price($object->total_localtax2,'',$langs,0,-1,-1,$conf->currency).'</td>';
print '<td></td></tr>';
}
// Amount TTC
print '<tr><td height="10">'.$langs->trans('AmountTTC').'</td>';
print '<td align="right" class="nowrap">'.price($object->total_ttc).'</td>';
print '<td>'.$langs->trans("Currency".$conf->currency).'</td></tr>';
print '<td align="right" class="nowrap">'.price($object->total_ttc,'',$langs,0,-1,-1,$conf->currency).'</td>';
print '<td></td></tr>';
// Statut
print '<tr><td height="10">'.$langs->trans('Status').'</td><td align="left" colspan="2">'.$object->getLibStatut(4).'</td></tr>';

View File

@ -144,7 +144,7 @@ else dol_print_error($db);
// Load sale and categ filters
$search_sale = GETPOST('search_sale');
$search_categ = GETPOST('search_categ');
// If the user must only see his prospect, force searching by him
// If the internal user must only see his prospect, force searching by him
if (!$user->rights->societe->client->voir && !$socid) $search_sale = $user->id;
// List of avaible states; we'll need that for each lines (quick changing prospect states) and for search bar (filter by prospect state)
@ -180,18 +180,17 @@ $form=new Form($db);
$sql = "SELECT s.rowid, s.nom, s.zip, s.town, s.datec, s.datea, s.status as status, s.code_client, s.client,";
$sql.= " st.libelle as stcomm, s.prefix_comm, s.fk_stcomm, s.fk_prospectlevel,";
$sql.= " d.nom as departement";
// Updated by Matelli
if ($search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
$sql .= " FROM ".MAIN_DB_PREFIX."c_stcomm as st";
if ($search_sale || !$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_departements as d on (d.rowid = s.fk_departement)";
if (! empty($search_categ) || ! empty($catid)) $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX."categorie_societe as cs ON s.rowid = cs.fk_societe"; // We need this table joined to the select in order to filter by categ
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
$sql.= " WHERE s.fk_stcomm = st.id";
$sql.= " AND s.client IN (2, 3)";
$sql.= ' AND s.entity IN ('.getEntity('societe', 1).')';
if ($user->societe_id) $sql.= " AND s.rowid = " .$user->societe_id;
if ($search_sale) $sql.= " AND s.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
if ((!$user->rights->societe->client->voir && !$socid) || $search_sale) $sql.= " AND s.rowid = sc.fk_soc";
if ($socid) $sql.= " AND s.rowid = " .$socid;
if (isset($stcomm) && $stcomm != '') $sql.= " AND s.fk_stcomm=".$stcomm;
if ($catid > 0) $sql.= " AND cs.fk_categorie = ".$catid;
if ($catid == -2) $sql.= " AND cs.fk_categorie IS NULL";
@ -224,7 +223,6 @@ if ($socname) {
$sortfield = "s.nom";
$sortorder = "ASC";
}
// Count total nb of records
$nbtotalofrecords = 0;
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
@ -232,9 +230,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
}
$sql.= " ORDER BY $sortfield $sortorder, s.nom ASC";
$sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog('comm/prospect/list.php sql='.$sql,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)

View File

@ -2908,19 +2908,21 @@ class Facture extends CommonInvoice
$sql .= ' (fk_facture, amount, date_demande, fk_user_demande, code_banque, code_guichet, number, cle_rib)';
$sql .= ' VALUES ('.$this->id;
$sql .= ",'".price2num($resteapayer)."'";
$sql .= ",'".$this->db->idate($now)."',";
$sql .= ",'".$this->db->idate($now)."'";
$sql .= ",".$user->id;
$sql .= ",'".$bac->code_banque."'";
$sql .= ",'".$bac->code_guichet."'";
$sql .= ",'".$bac->number."'";
$sql .= ",'".$bac->cle_rib."')";
if ( $this->db->query($sql))
dol_syslog(get_class($this)."::demande_prelevement sql=".$sql);
if ($this->db->query($sql))
{
return 1;
}
else
{
$this->error=$this->db->error();
{
$this->error=$this->db->lasterror();
dol_syslog(get_class($this).'::demandeprelevement Erreur');
return -1;
}

View File

@ -526,7 +526,7 @@ else
print '<tr><td>'.$langs->trans("IM").'</td><td colspan="3"><input name="jabberid" type="text" size="50" maxlength="80" value="'.(isset($_POST["jabberid"])?$_POST["jabberid"]:$object->jabberid).'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td colspan="3"><input name="skype" type="text" size="50" maxlength="80" value="'.(isset($_POST["skype"])?$_POST["skype"]:$object->skype).'"></td></tr>';
}
@ -733,7 +733,7 @@ else
print '</tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td><input name="skype" type="text" size="40" maxlength="80" value="'.(isset($_POST["skype"])?$_POST["skype"]:$object->skype).'"></td></tr>';
}
@ -952,7 +952,7 @@ else
print '</tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans("Skype").'</td><td colspan="3">'.dol_print_skype($object->skype,0,$object->fk_soc,1).'</td></tr>';
}

View File

@ -5,7 +5,7 @@
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2013 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
* Copyright (C) 2013 Cédric Salvador <csalvador@gpcsolutions.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -274,7 +274,7 @@ if ($result)
print $moreforfilter;
print '</div>';
}
if ($sall)
{
print $langs->trans("Filter")." (".$langs->trans("Lastname").", ".$langs->trans("Firstname")." ".$langs->trans("or")." ".$langs->trans("EMail")."): ".$sall;
@ -292,7 +292,7 @@ if ($result)
print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mob", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax", $begin, $param, '', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email", $begin, $param, '', $sortfield,$sortorder);
if (! empty($conf->skype->enabled) && $user->rights->skype->view) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); }
if (! empty($conf->skype->enabled)) { print_liste_field_titre($langs->trans("Skype"),$_SERVER["PHP_SELF"],"p.skype", $begin, $param, '', $sortfield,$sortorder); }
print_liste_field_titre($langs->trans("DateModificationShort"),$_SERVER["PHP_SELF"],"p.tms", $begin, $param, 'align="center"', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("ContactVisibility"),$_SERVER["PHP_SELF"],"p.priv", $begin, $param, 'align="center"', $sortfield,$sortorder);
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut", $begin, $param, 'align="center"', $sortfield,$sortorder);
@ -328,12 +328,12 @@ if ($result)
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_email" size="8" value="'.$search_email.'">';
print '</td>';
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<td class="liste_titre">';
print '<input class="flat" type="text" name="search_skype" size="8" value="'.$search_skype.'">';
print '</td>';
}
}
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre" align="center">';
$selectarray=array('0'=>$langs->trans("ContactPublic"),'1'=>$langs->trans("ContactPrivate"));
@ -353,7 +353,7 @@ if ($result)
while ($i < min($num,$limit))
{
$obj = $db->fetch_object($result);
$var=!$var;
print "<tr ".$bc[$var].">";
@ -397,14 +397,14 @@ if ($result)
// EMail
print '<td>'.dol_print_email($obj->email,$obj->cidp,$obj->socid,'AC_EMAIL',18).'</td>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view) { print '<td>'.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).'</td>'; }
if (! empty($conf->skype->enabled)) { print '<td>'.dol_print_skype($obj->skype,$obj->cidp,$obj->socid,'AC_SKYPE',18).'</td>'; }
// Date
print '<td align="center">'.dol_print_date($db->jdate($obj->tms),"day").'</td>';
// Private/Public
print '<td align="center">'.$contactstatic->LibPubPriv($obj->priv).'</td>';
// Status
print '<td align="center">'.$contactstatic->getLibStatut(3).'</td>';

View File

@ -1269,7 +1269,7 @@ class Contrat extends CommonObject
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('CONTRACT_LINE_DELETE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('LINECONTRACT_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
@ -2118,7 +2118,7 @@ class ContratLigne
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('CONTRACT_LINE_MODIFY',$this,$user,$langs,$conf);
$result=$interface->run_triggers('LINECONTRACT_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}

View File

@ -6,7 +6,7 @@
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
* Copyright (C) 2013 Juanjo Menent <jmenent@2byte.es>
* Copyright (C) 2013 Christophe Battarel <contact@altairis.fr>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
* Copyright (C) 2013 Alexandre Spangaro <alexandre.spangaro@gmail.com>
*
* 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
@ -524,16 +524,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
global $bc;
$form= new Form($db);
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$search_status = GETPOST("search_status",'int');
if ($search_status=='') $search_status=1; // always display activ customer first
$search_name = GETPOST("search_name",'alpha');
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="p.lastname";
$i=-1;
$contactstatic = new Contact($db);
@ -559,16 +559,16 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print "\n".'<table class="noborder" width="100%">'."\n";
$param="socid=".$object->id;
if ($search_status != '') $param.='&amp;search_status='.$search_status;
if ($search_name != '') $param.='&amp;search_name='.urlencode($search_name);
print '<form method="GET" action="'.$_SERVER["PHP_SELF"].'" name="formfilter">';
print '<input type="hidden" name="socid" value="'.$object->id.'">';
print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
$colspan=8;
print '<tr class="liste_titre">';
print_liste_field_titre($langs->trans("Name"),$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder);
@ -577,10 +577,10 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print_liste_field_titre($langs->trans("PhoneMobile"),$_SERVER["PHP_SELF"],"p.phone_mobile","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("Fax"),$_SERVER["PHP_SELF"],"p.fax","",$param,'',$sortfield,$sortorder);
print_liste_field_titre($langs->trans("EMail"),$_SERVER["PHP_SELF"],"p.email","",$param,'',$sortfield,$sortorder);
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
$colspan++;
print '<td>'.$langs->trans("Skype").'</td>';
if (! empty($conf->skype->enabled))
{
$colspan++;
print '<td>'.$langs->trans("Skype").'</td>';
}
print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"p.statut","",$param,'',$sortfield,$sortorder);
print "<td>&nbsp;</td>";
@ -595,44 +595,44 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<td>&nbsp;</td>';
}
print "</tr>";
print '<tr class="liste_titre">';
print '<td class="liste_titre">';
print '<input type="text" class="flat" name="search_name" size="20" value="'.$search_name.'">';
print '</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
print '<td>&nbsp;</td>';
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
{
$colspan++;
print '<td>&nbsp;</td>';
if (! empty($conf->skype->enabled))
{
$colspan++;
print '<td>&nbsp;</td>';
}
print '<td class="liste_titre">';
print $form->selectarray('search_status', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')),$search_status);
print '</td>';
print "<td>&nbsp;</td>";
if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create)
{
$colspan++;
print '<td>&nbsp;</td>';
}
print '<td class="liste_titre" align="right">';
print '<input type="image" class="liste_titre" name="button_search" src="'.DOL_URL_ROOT.'/theme/'.$conf->theme.'/img/search.png" value="'.dol_escape_htmltag($langs->trans("Search")).'" title="'.dol_escape_htmltag($langs->trans("Search")).'">';
print '</td>';
print "</tr>";
$sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays, p.poste, p.phone, p.phone_mobile, p.fax, p.email, p.skype, p.statut ";
$sql .= ", p.civilite, p.address, p.zip, p.town";
@ -682,12 +682,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='')
print '<td>';
print dol_print_email($obj->email,$obj->rowid,$object->id,'AC_EMAIL');
print '</td>';
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<td>';
print dol_print_skype($obj->skype,$obj->rowid,$object->id,'AC_SKYPE');
print '</td>';
}
}
print '<td>'.$contactstatic->getLibStatut(5).'</td>';

View File

@ -83,18 +83,6 @@ class modSkype extends DolibarrModules
//------
$this->boxes = array();
// Permissions
//------------
$this->rights = array(); // Permission array used by this module
$this->rights_class = 'skype';
$r=0;
$this->rights[$r][0] = 3101;
$this->rights[$r][1] = 'View skype link';
$this->rights[$r][3] = 1;
$this->rights[$r][4] = 'view';
$r++;
// Main menu entries
//------------------
$this->menu = array();

View File

@ -243,6 +243,10 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
@ -265,6 +269,18 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_DISPATCH')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEORDER_SUPPLIER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Proposals
elseif ($action == 'PROPAL_CREATE')
@ -307,7 +323,7 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEPROPAL_MODIFY')
elseif ($action == 'LINEPROPAL_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
@ -337,6 +353,14 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINECONTRACT_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINECONTRACT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Bills
elseif ($action == 'BILL_CREATE')
@ -378,12 +402,28 @@ class InterfaceDemo
elseif ($action == 'LINEBILL_INSERT')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEBILL_SUPPLIER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Payments
elseif ($action == 'PAYMENT_CUSTOMER_CREATE')
{
@ -419,7 +459,19 @@ class InterfaceDemo
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_CREATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_UPDATE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'LINEFICHINTER_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
// Members
elseif ($action == 'MEMBER_CREATE')
{

View File

@ -251,7 +251,7 @@ class Fichinter extends CommonObject
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('FICHINTER_UPDATE',$this,$user,$langs,$conf);
$result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf);
if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
@ -1148,7 +1148,7 @@ class FichinterLigne
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$resulttrigger=$interface->run_triggers('FICHINTERDET_CREATE',$this,$user,$langs,$conf);
$resulttrigger=$interface->run_triggers('LINEFICHINTER_CREATE',$this,$user,$langs,$conf);
if ($resulttrigger < 0) {
$error++; $this->errors=$interface->errors;
}
@ -1210,7 +1210,7 @@ class FichinterLigne
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$resulttrigger=$interface->run_triggers('FICHINTERDET_UPDATE',$this,$user,$langs,$conf);
$resulttrigger=$interface->run_triggers('LINEFICHINTER_UPDATE',$this,$user,$langs,$conf);
if ($resulttrigger < 0) {
$error++; $this->errors=$interface->errors;
}
@ -1324,7 +1324,7 @@ class FichinterLigne
// Appel des triggers
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
$interface=new Interfaces($this->db);
$resulttrigger=$interface->run_triggers('FICHINTERDET_DELETE',$this,$user,$langs,$conf);
$resulttrigger=$interface->run_triggers('LINEFICHINTER_DELETE',$this,$user,$langs,$conf);
if ($resulttrigger < 0) {
$error++; $this->errors=$interface->errors;
}

View File

@ -87,7 +87,7 @@ $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st";
if (!$user->rights->societe->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
$sql.= " WHERE s.fk_stcomm = st.id AND s.fournisseur = 1";
$sql.= " AND s.entity IN (".getEntity('societe', 1).")";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id;
if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc";
if ($socid) $sql .= " AND s.rowid = ".$socid;
if ($socname) {
$sql .= natural_search('s.nom', $socname);
@ -118,6 +118,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$sql.= $db->order($sortfield,$sortorder);
$sql.= $db->plimit($conf->liste_limit+1, $offset);
dol_syslog('fourn/liste.php: sql='.$sql,LOG_DEBUG);
$resql = $db->query($sql);
if ($resql)
{

View File

@ -410,6 +410,5 @@ PDFCrabeDescription=Invoice PDF template Crabe. A complete invoice template (rec
PDFOursinDescription=Invoice PDF template Oursin. A complete invoice template (alternative Template)
# NumRef Modules
TerreNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
MarsNumRefModelDesc1=Return number with format %syymm-nnnn for standard invoices, %syymm-nnnn for replacement invoices, %syymm-nnnn for credit notes and %syymm-nnnn for credit notes where yy is year, mm is month and nnnn is a sequence with no break and no return to 0
TerreNumRefModelError=A bill starting with $syymm already exists and is not compatible with this model of sequence. Remove it or rename it to activate this module.

View File

@ -33,7 +33,7 @@ $action = GETPOST('action');
$langs->load("companies");
// Security check
$id = GETPOST('id','int');
$id = GETPOST('id')?GETPOST('id','int'):GETPOST('socid','int');
if ($user->societe_id) $id=$user->societe_id;
$result = restrictedArea($user, 'societe', $id, '&societe');

View File

@ -878,7 +878,7 @@ else
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3"><input type="text" name="url" size="32" value="'.$object->url.'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans('Skype').'</td><td colspan="3"><input type="text" name="skype" size="32" value="'.$object->skype.'"></td></tr>';
}
@ -1302,7 +1302,7 @@ else
print '<tr><td>'.$langs->trans('Web').'</td><td colspan="3"><input type="text" name="url" size="32" value="'.$object->url.'"></td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans('Skype').'</td><td colspan="3"><input type="text" name="skype" size="32" value="'.$object->skype.'"></td></tr>';
}
@ -1616,7 +1616,7 @@ else
print '</td></tr>';
// Skype
if (! empty($conf->skype->enabled) && $user->rights->skype->view)
if (! empty($conf->skype->enabled))
{
print '<tr><td>'.$langs->trans('Skype').'</td><td colspan="3">';
print dol_print_skype($object->skype,0,$object->id,'AC_SKYPE');
@ -1737,7 +1737,7 @@ else
// Capital
print '<tr><td>'.$langs->trans('Capital').'</td><td colspan="3">';
if ($object->capital) print $object->capital.' '.$langs->trans("Currency".$conf->currency);
if ($object->capital) print price($object->capital,'',$langs,0,-1,-1, $conf->currency);
else print '&nbsp;';
print '</td></tr>';

View File

@ -243,6 +243,10 @@ class FactureTest extends PHPUnit_Framework_TestCase
print __METHOD__." localobject->date_creation=".$localobject->date_creation."\n";
$this->assertNotEquals($localobject->date_creation, '');
$result=$localobject->demande_prelevement($user);
print __METHOD__." result=".$result."\n";
$this->assertLessThan($result, 0);
return $localobject->id;
}