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

This commit is contained in:
Laurent Destailleur 2011-11-06 15:45:03 +01:00
commit 8193e8a54e
15 changed files with 909 additions and 789 deletions

View File

@ -34,11 +34,10 @@ require_once(DOL_DOCUMENT_ROOT."/core/lib/member.lib.php");
$langs->load("admin");
$langs->load("members");
if (!$user->admin)
accessforbidden();
if (! $user->admin) accessforbidden();
$typeconst=array('yesno','texte','chaine');
$type=array('yesno','texte','chaine');
$action = GETPOST("action");
@ -46,33 +45,31 @@ $action = GETPOST("action");
// Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add')
{
$const=GETPOST("constname");
$value=GETPOST("constvalue");
if (($const=='ADHERENT_CARD_TYPE' || $const=='ADHERENT_ETIQUETTE_TYPE')
&& $value == -1) $value='';
if ($const=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{
if ($value) $value=0;
else $value=1;
}
if (in_array($const,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $value=$_POST["constvalue".$const];
$type=$_POST["consttype"];
$constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>";
}
else
{
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>";
}
$constname=GETPOST("constname");
$constvalue=GETPOST("constvalue");
if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{
if ($constvalue) $constvalue=0;
else $constvalue=1;
}
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
$consttype=$_POST["consttype"];
$constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
$mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
}
else
{
$mesg = '<div class="error">'.$langs->trans("Error").'</div>';
}
}
// Action activation d'un sous module du module adherent
@ -211,11 +208,12 @@ if ($conf->global->ADHERENT_USE_MAILMAN)
$lien=img_picto($langs->trans("Active"),'tick').' ';
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
// Edition des varibales globales
$constantes=array('ADHERENT_MAILMAN_LISTS',
'ADHERENT_MAILMAN_ADMINPW',
'ADHERENT_MAILMAN_URL',
'ADHERENT_MAILMAN_UNSUB_URL'
);
$constantes=array(
'ADHERENT_MAILMAN_LISTS',
'ADHERENT_MAILMAN_ADMINPW',
'ADHERENT_MAILMAN_URL',
'ADHERENT_MAILMAN_UNSUB_URL'
);
print_fiche_titre("Mailman mailing list system",$lien,'');
// JQuery activity
@ -254,12 +252,14 @@ if ($conf->global->ADHERENT_USE_SPIP)
$lien=img_picto($langs->trans("Active"),'tick').' ';
$lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
// Edition des varibales globales
$constantes=array('ADHERENT_USE_SPIP_AUTO',
'ADHERENT_SPIP_SERVEUR',
'ADHERENT_SPIP_DB',
'ADHERENT_SPIP_USER',
'ADHERENT_SPIP_PASS'
);
$constantes=array(
'ADHERENT_USE_SPIP_AUTO',
'ADHERENT_SPIP_SERVEUR',
'ADHERENT_SPIP_DB',
'ADHERENT_SPIP_USER',
'ADHERENT_SPIP_PASS'
);
print_fiche_titre("SPIP CMS",$lien,'');
form_constantes($constantes);
print '<br>';
@ -282,7 +282,7 @@ $constantes=array(
'ADHERENT_CARD_TEXT',
'ADHERENT_CARD_TEXT_RIGHT',
'ADHERENT_CARD_FOOTER_TEXT'
);
);
print_fiche_titre($langs->trans("MembersCards"),'','');
@ -323,8 +323,8 @@ $constantes=array(
'ADHERENT_MAIL_RESIL_SUBJECT',
'ADHERENT_MAIL_RESIL',
'ADHERENT_MAIL_FROM',
);
);
print_fiche_titre($langs->trans("Other"),'','');
form_constantes($constantes);

File diff suppressed because it is too large Load Diff

View File

@ -46,7 +46,7 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
{
$element = GETPOST('element');
$table_element = GETPOST('table_element');
$field = GETPOST('field');
$field = substr(GETPOST('field'), 4); // remove prefix val_
$fk_element = GETPOST('fk_element');
$type = GETPOST('type');

View File

@ -47,7 +47,7 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
{
$element = GETPOST('element');
$table_element = GETPOST('table_element');
$field = GETPOST('field');
$field = substr(GETPOST('field'), 4); // remove prefix val_
$fk_element = GETPOST('fk_element');
$value = GETPOST('value');
$type = GETPOST('type');

View File

@ -79,19 +79,34 @@ class Form
*/
function editfieldkey($text,$htmlname,$preselected,$paramkey,$paramvalue,$perm,$typeofdata='string')
{
global $conf,$langs;
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) return $langs->trans($text);
else
{
$ret='';
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
$ret.=$langs->trans($text);
$ret.='</td>';
if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramkey.'='.$paramvalue.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
$ret.='</tr></table>';
return $ret;
global $conf,$langs;
$ret='';
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
{
if ($perm)
{
$tmp=explode(':',$typeofdata);
$ret.= '<div class="editkey_'.$tmp[0].'" id="'.$htmlname.'">';
$ret.= $langs->trans($text);
$ret.= '</div>'."\n";
}
else
{
$ret.= $langs->trans($text);
}
}
else
{
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
$ret.=$langs->trans($text);
$ret.='</td>';
if (GETPOST('action') != 'edit'.$htmlname && $perm) $ret.='<td align="right"><a href="'.$_SERVER["PHP_SELF"].'?action=edit'.$htmlname.'&amp;'.$paramkey.'='.$paramvalue.'">'.img_edit($langs->trans('Edit'),1).'</a></td>';
$ret.='</tr></table>';
}
return $ret;
}
/**
@ -222,9 +237,9 @@ class Form
}
}
$out.= '<div class="edit_'.$inputType.'" id="'.$htmlname.'">';
$out.= '<div class="editval_'.$inputType.'" id="val_'.$htmlname.'">';
$out.= $value;
$out.= '</div>';
$out.= '</div>'."\n";
}
else
{

View File

@ -11,7 +11,7 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html();
$('.edit_textarea').editable(urlSaveInPlace, {
$('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea',
rows : 4,
id : 'field',
@ -44,7 +44,19 @@ $(document).ready(function() {
}
}
});
$('.edit_ckeditor').editable(urlSaveInPlace, {
$('.editkey_textarea').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_textarea').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_ckeditor').editable(urlSaveInPlace, {
type : 'ckeditor',
id : 'field',
onblur : 'ignore',
@ -74,7 +86,19 @@ $(document).ready(function() {
}
}
});
$('.edit_text').editable(urlSaveInPlace, {
$('.editkey_ckeditor').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_ckeditor').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_text').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 300,
@ -100,7 +124,19 @@ $(document).ready(function() {
}
}
});
$('.edit_numeric').editable(urlSaveInPlace, {
$('.editkey_text').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_text').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_numeric').editable(urlSaveInPlace, {
type : 'text',
id : 'field',
width : 100,
@ -126,7 +162,19 @@ $(document).ready(function() {
}
}
});
$('.edit_datepicker').editable(urlSaveInPlace, {
$('.editkey_numeric').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_numeric').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_datepicker').editable(urlSaveInPlace, {
type : 'datepicker',
id : 'field',
onblur : 'ignore',
@ -155,7 +203,19 @@ $(document).ready(function() {
}
}
});
$('.edit_select').editable(urlSaveInPlace, {
$('.editkey_datepicker').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_datepicker').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.editval_select').editable(urlSaveInPlace, {
type : 'select',
id : 'field',
onblur : 'ignore',
@ -191,6 +251,18 @@ $(document).ready(function() {
}
}
});
$('.editkey_select').hover(
function () {
$( '#val_' + $(this).attr('id') ).addClass("editval_hover");
},
function () {
$( '#val_' + $(this).attr('id') ).removeClass("editval_hover");
}
);
$('.editkey_select').click(function() {
$( '#val_' + $(this).attr('id') ).click();
});
$('.edit_autocomplete').editable(urlSaveInPlace, {
type : 'autocomplete',
id : 'field',

View File

@ -100,7 +100,8 @@ if (! function_exists('json_decode'))
{
$comment = false;
for ($i=0; $i<strlen($json); $i++)
$strLength = dol_strlen($json);
for ($i=0; $i<$strLength; $i++)
{
if (! $comment)
{
@ -1466,8 +1467,6 @@ function isValidPhone($address)
*/
function dol_strlen($string,$stringencoding='UTF-8')
{
// print $stringencoding."xxx";
// $stringencoding='rrr';
if (function_exists('mb_strlen')) return mb_strlen($string,$stringencoding);
else return strlen($string);
}
@ -4205,7 +4204,8 @@ function dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensiti
function utf8_check($str)
{
// We must use here a binary strlen function (so not dol_strlen)
for ($i=0; $i<strlen($str); $i++)
$strLength = dol_strlen($str);
for ($i=0; $i<$strLength; $i++)
{
if (ord($str[$i]) < 0x80) continue; // 0bbbbbbb
elseif ((ord($str[$i]) & 0xE0) == 0xC0) $n=1; // 110bbbbb

View File

@ -767,7 +767,8 @@ function binhex($bin, $pad=false, $upper=false)
function hexbin($hexa)
{
$bin='';
for($i=0;$i<dol_strlen($hexa);$i++)
$strLength = dol_strlen($hexa);
for($i=0;$i<$strLength;$i++)
{
$bin.=str_pad(decbin(hexdec($hexa{$i})),4,'0',STR_PAD_LEFT);
}

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 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-2009 Regis Houssin <regis@dolibarr.fr>
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 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-2011 Regis Houssin <regis@dolibarr.fr>
*
* 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

View File

@ -375,7 +375,7 @@ class InterfaceLdapsynchro
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
{
# If status field is setup to be synchronized
// If status field is setup to be synchronized
if ($conf->global->LDAP_FIELD_MEMBER_STATUS)
{
$ldap=new Ldap();
@ -399,7 +399,7 @@ class InterfaceLdapsynchro
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
{
# If subscriptions fields are setup to be synchronized
// If subscriptions fields are setup to be synchronized
if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE
|| $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT
|| $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE
@ -458,7 +458,7 @@ class InterfaceLdapsynchro
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE)
{
# If password field is setup to be synchronized
// If password field is setup to be synchronized
if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
{
$ldap=new Ldap();

View File

@ -246,12 +246,12 @@ class Fournisseur extends Societe
}
/**
* Return a link on thirdparty (with picto)
*
* @param withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param option Target of link ('', 'customer', 'prospect', 'supplier')
* @param maxlen Max length of text
* @return string String with URL
* Return a link on thirdparty (with picto)
*
* @param int $withpicto Add picto into link (0=No picto, 1=Include picto with link, 2=Picto only)
* @param string $option Target of link ('', 'customer', 'prospect', 'supplier')
* @param int $maxlen Max length of text
* @return string String with URL
*/
function getNomUrl($withpicto=0,$option='supplier',$maxlen=0)
{

View File

@ -1625,16 +1625,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1,9 +1,9 @@
<?php
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
/* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2010 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -1844,16 +1844,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/bureau2crea/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1792,16 +1792,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right center no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/cameleo/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/cameleo/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/cameleo/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */

View File

@ -1704,16 +1704,25 @@ table.cal_event td { border: 0px; padding-<?php print $left; ?>: 0px; padding-<?
/* jQuery - jeditable */
/* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
.editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: url(<?php echo dol_buildpath($path.'/theme/eldy/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer;
}
.edit_datepicker:hover {
background: white url(<?php echo dol_buildpath($path.'/theme/eldy/img/calendar.png',1) ?>) right center no-repeat;
.editkey_datepicker {
background: url(<?php echo dol_buildpath($path.'/theme/eldy/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer;
}
.editval_textarea:hover, .editval_ckeditor:hover, .editval_text:hover, .editval_numeric:hover, .editval_select:hover, .editval_datepicker:hover {
background: white;
cursor: pointer;
}
.editval_hover {
background: white;
}
/* ============================================================================== */
/* Admin Menu */