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("admin");
$langs->load("members"); $langs->load("members");
if (!$user->admin) if (! $user->admin) accessforbidden();
accessforbidden();
$typeconst=array('yesno','texte','chaine'); $type=array('yesno','texte','chaine');
$action = GETPOST("action"); $action = GETPOST("action");
@ -46,32 +45,30 @@ $action = GETPOST("action");
// Action mise a jour ou ajout d'une constante // Action mise a jour ou ajout d'une constante
if ($action == 'update' || $action == 'add') if ($action == 'update' || $action == 'add')
{ {
$const=GETPOST("constname"); $constname=GETPOST("constname");
$value=GETPOST("constvalue"); $constvalue=GETPOST("constvalue");
if (($const=='ADHERENT_CARD_TYPE' || $const=='ADHERENT_ETIQUETTE_TYPE') if (($constname=='ADHERENT_CARD_TYPE' || $constname=='ADHERENT_ETIQUETTE_TYPE') && $constvalue == -1) $constvalue='';
&& $value == -1) $value=''; if ($constname=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
if ($const=='ADHERENT_LOGIN_NOT_REQUIRED') // Invert choice
{ {
if ($value) $value=0; if ($constvalue) $constvalue=0;
else $value=1; else $constvalue=1;
} }
if (in_array($constname,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $constvalue=$_POST["constvalue".$constname];
if (in_array($const,array('ADHERENT_MAIL_VALID','ADHERENT_MAIL_COTIS','ADHERENT_MAIL_RESIL'))) $value=$_POST["constvalue".$const]; $consttype=$_POST["consttype"];
$type=$_POST["consttype"];
$constnote=GETPOST("constnote"); $constnote=GETPOST("constnote");
$res=dolibarr_set_const($db,$const,$value,$typeconst[$type],0,$constnote,$conf->entity); $res=dolibarr_set_const($db,$constname,$constvalue,$type[$consttype],0,$constnote,$conf->entity);
if (! $res > 0) $error++; if (! $res > 0) $error++;
if (! $error) if (! $error)
{ {
$mesg = "<font class=\"ok\">".$langs->trans("SetupSaved")."</font>"; $mesg = '<div class="ok">'.$langs->trans("SetupSaved").'</div>';
} }
else else
{ {
$mesg = "<font class=\"error\">".$langs->trans("Error")."</font>"; $mesg = '<div class="error">'.$langs->trans("Error").'</div>';
} }
} }
@ -211,7 +208,8 @@ if ($conf->global->ADHERENT_USE_MAILMAN)
$lien=img_picto($langs->trans("Active"),'tick').' '; $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>'; $lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_MAILMAN">'.$langs->trans("Disable").'</a>';
// Edition des varibales globales // Edition des varibales globales
$constantes=array('ADHERENT_MAILMAN_LISTS', $constantes=array(
'ADHERENT_MAILMAN_LISTS',
'ADHERENT_MAILMAN_ADMINPW', 'ADHERENT_MAILMAN_ADMINPW',
'ADHERENT_MAILMAN_URL', 'ADHERENT_MAILMAN_URL',
'ADHERENT_MAILMAN_UNSUB_URL' 'ADHERENT_MAILMAN_UNSUB_URL'
@ -254,12 +252,14 @@ if ($conf->global->ADHERENT_USE_SPIP)
$lien=img_picto($langs->trans("Active"),'tick').' '; $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>'; $lien.='<a href="'.$_SERVER["PHP_SELF"].'?action=unset&value=0&name=ADHERENT_USE_SPIP">'.$langs->trans("Disable").'</a>';
// Edition des varibales globales // Edition des varibales globales
$constantes=array('ADHERENT_USE_SPIP_AUTO', $constantes=array(
'ADHERENT_USE_SPIP_AUTO',
'ADHERENT_SPIP_SERVEUR', 'ADHERENT_SPIP_SERVEUR',
'ADHERENT_SPIP_DB', 'ADHERENT_SPIP_DB',
'ADHERENT_SPIP_USER', 'ADHERENT_SPIP_USER',
'ADHERENT_SPIP_PASS' 'ADHERENT_SPIP_PASS'
); );
print_fiche_titre("SPIP CMS",$lien,''); print_fiche_titre("SPIP CMS",$lien,'');
form_constantes($constantes); form_constantes($constantes);
print '<br>'; print '<br>';
@ -323,8 +323,8 @@ $constantes=array(
'ADHERENT_MAIL_RESIL_SUBJECT', 'ADHERENT_MAIL_RESIL_SUBJECT',
'ADHERENT_MAIL_RESIL', 'ADHERENT_MAIL_RESIL',
'ADHERENT_MAIL_FROM', 'ADHERENT_MAIL_FROM',
); );
print_fiche_titre($langs->trans("Other"),'',''); print_fiche_titre($langs->trans("Other"),'','');
form_constantes($constantes); form_constantes($constantes);

View File

@ -3,7 +3,7 @@
* Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org> * Copyright (C) 2003 Jean-Louis Bergamo <jlb@j1b.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copytight (C) 2004 Christophe Combelles <ccomb@free.fr> * Copytight (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copytight (C) 2005-2010 Regis Houssin <regis@dolibarr.fr> * Copytight (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copytight (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es> * Copytight (C) 2010-2011 Juanjo Menent <jmenent@@2byte.es>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -69,7 +69,6 @@ $dateop=-1;
if ($action == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier) if ($action == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->banque->modifier)
{ {
if (price2num($_POST["credit"]) > 0) if (price2num($_POST["credit"]) > 0)
{ {
$amount = price2num($_POST["credit"]); $amount = price2num($_POST["credit"]);
@ -96,7 +95,7 @@ if ($action == 'add' && $account && ! isset($_POST["cancel"]) && $user->rights->
$insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user); $insertid = $acct->addline($dateop, $operation, $label, $amount, $num_chq, $cat1, $user);
if ($insertid > 0) if ($insertid > 0)
{ {
Header("Location: account.php?account=" . $account."&action=addline"); Header("Location: ".$_SERVER['PHP_SELF']."?account=" . $account."&action=addline");
exit; exit;
} }
else else
@ -167,11 +166,11 @@ if ($account || $_GET["ref"])
$var=True; $var=True;
$num = $db->num_rows($result); $num = $db->num_rows($result);
$i = 0; $i = 0;
$options = "<option value=\"0\" selected=\"true\">&nbsp;</option>"; $options = '<option value="0" selected="true">&nbsp;</option>';
while ($i < $num) while ($i < $num)
{ {
$obj = $db->fetch_object($result); $obj = $db->fetch_object($result);
$options .= "<option value=\"$obj->rowid\">$obj->label</option>\n"; $options.= '<option value="'.$obj->rowid.'">'.$obj->label.'</option>'."\n";
$nbcategories++; $nbcategories++;
$i++; $i++;
} }
@ -184,13 +183,13 @@ if ($account || $_GET["ref"])
$mode_search = 0; $mode_search = 0;
if ($req_nb) if ($req_nb)
{ {
$sql_rech.= " AND b.num_chq like '%".$db->escape($req_nb)."%'"; $sql_rech.= " AND b.num_chq LIKE '%".$db->escape($req_nb)."%'";
$param.='&amp;req_nb='.urlencode($req_nb); $param.='&amp;req_nb='.urlencode($req_nb);
$mode_search = 1; $mode_search = 1;
} }
if ($_REQUEST["req_desc"]) if ($_REQUEST["req_desc"])
{ {
$sql_rech.= " AND b.label like '%".$db->escape($_REQUEST["req_desc"])."%'"; $sql_rech.= " AND b.label LIKE '%".$db->escape($_REQUEST["req_desc"])."%'";
$param.='&amp;req_desc='.urlencode($_REQUEST["req_desc"]); $param.='&amp;req_desc='.urlencode($_REQUEST["req_desc"]);
$mode_search = 1; $mode_search = 1;
} }
@ -232,7 +231,7 @@ if ($account || $_GET["ref"])
$sql.= " AND ba.entity = ".$conf->entity; $sql.= " AND ba.entity = ".$conf->entity;
$sql.= $sql_rech; $sql.= $sql_rech;
dol_syslog("account.php count transactions - sql=".$sql); dol_syslog("account.php count transactions - sql=".$sql, LOG_DEBUG);
$result=$db->query($sql); $result=$db->query($sql);
if ($result) if ($result)
{ {
@ -240,28 +239,20 @@ if ($account || $_GET["ref"])
$nbline = $obj->nb; $nbline = $obj->nb;
$total_lines = $nbline; $total_lines = $nbline;
if ($nbline > $viewline ) if ($nbline > $viewline ) $limit = $nbline - $viewline ;
{ else $limit = $viewline;
$limit = $nbline - $viewline ;
}
else
{
$limit = $viewline;
}
$db->free($result); $db->free($result);
} }
else { else
{
dol_print_error($db); dol_print_error($db);
} }
if ($page > 0) if ($page > 0)
{ {
$limitsql = $nbline - ($page * $viewline); $limitsql = $nbline - ($page * $viewline);
if ($limitsql < $viewline) if ($limitsql < $viewline) $limitsql = $viewline;
{
$limitsql = $viewline;
}
$nbline = $limitsql; $nbline = $limitsql;
} }
else else
@ -291,24 +282,19 @@ if ($account || $_GET["ref"])
print '<br>'; print '<br>';
if ($mesg) print '<div class="error">'.$mesg.'</div>'; dol_htmloutput_errors($mesg);
/** /**
* Search form * Search form
*/ */
$param.='&amp;account='.$acct->id; $param.='&amp;account='.$acct->id;
// Define transaction list navigation string // Define transaction list navigation string
$navig=''; $navig='';
$navig.='<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET">'; $navig.='<form action="'.$_SERVER["PHP_SELF"].'" name="newpage" method="GET">';
$nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total $nbpage=floor($total_lines/$viewline)+($total_lines % $viewline > 0?1:0); // Nombre de page total
//print 'nbpage='.$nbpage.' viewline='.$viewline.' limitsql='.$limitsql; //print 'nbpage='.$nbpage.' viewline='.$viewline.' limitsql='.$limitsql;
if ($limitsql > $viewline) if ($limitsql > $viewline) $navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>';
{
$navig.='<a href="account.php?'.$param.'&amp;page='.($page+1).'">'.img_previous().'</a>';
}
$navig.= $langs->trans("Page")." "; // ' Page '; $navig.= $langs->trans("Page")." "; // ' Page ';
$navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">'; $navig.='<input type="text" name="negpage" size="1" class="flat" value="'.($nbpage-$page).'">';
$navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">'; $navig.='<input type="hidden" name="req_nb" value="'.$req_nb.'">';
@ -334,7 +320,6 @@ if ($account || $_GET["ref"])
if ($ret == 'html') print '<br>'; if ($ret == 'html') print '<br>';
} }
print '<table class="notopnoleftnoright" width="100%">'; print '<table class="notopnoleftnoright" width="100%">';
// Show title // Show title
@ -343,7 +328,6 @@ if ($account || $_GET["ref"])
print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>'; print '<tr><td colspan="9" align="right">'.$navig.'</td></tr>';
} }
// Form to add a transaction with no invoice // Form to add a transaction with no invoice
if ($user->rights->banque->modifier && $action == 'addline') if ($user->rights->banque->modifier && $action == 'addline')
{ {
@ -391,12 +375,11 @@ if ($account || $_GET["ref"])
print '</td></tr>'; print '</td></tr>';
print "</form>"; print "</form>";
print "<tr class=\"noborder\"><td colspan=\"8\">&nbsp;</td></tr>\n"; print '<tr class="noborder"><td colspan="8">&nbsp;</td></tr>'."\n";
} }
/* /*
* Affiche tableau des transactions bancaires * Affiche tableau des transactions bancaires
*
*/ */
// Ligne de titre tableau des ecritures // Ligne de titre tableau des ecritures
@ -438,7 +421,8 @@ if ($account || $_GET["ref"])
print "</tr>\n"; print "</tr>\n";
print "</form>\n"; print "</form>\n";
/* Another solution /*
* Another solution
* create temporary table solde type=heap select amount from llx_bank limit 100 ; * create temporary table solde type=heap select amount from llx_bank limit 100 ;
* select sum(amount) from solde ; * select sum(amount) from solde ;
*/ */
@ -449,6 +433,7 @@ if ($account || $_GET["ref"])
{ {
$sql.= ", s.rowid as socid, s.nom as thirdparty"; $sql.= ", s.rowid as socid, s.nom as thirdparty";
} }
/*
if ($mode_search && $conf->adherent->enabled) if ($mode_search && $conf->adherent->enabled)
{ {
@ -457,6 +442,7 @@ if ($account || $_GET["ref"])
{ {
} }
*/
$sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba";
$sql.= ", ".MAIN_DB_PREFIX."bank as b"; $sql.= ", ".MAIN_DB_PREFIX."bank as b";
if ($mode_search) if ($mode_search)
@ -482,7 +468,7 @@ if ($account || $_GET["ref"])
$sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day $sql.= $db->order("b.datev, b.datec", "ASC"); // We add date of creation to have correct order when everything is done the same day
$sql.= $db->plimit($limitsql, 0); $sql.= $db->plimit($limitsql, 0);
dol_syslog("account.php get transactions - sql=".$sql); dol_syslog("account.php get transactions - sql=".$sql, LOG_DEBUG);
$result = $db->query($sql); $result = $db->query($sql);
if ($result) if ($result)
{ {
@ -514,12 +500,12 @@ if ($account || $_GET["ref"])
print '<tr class="liste_total"><td colspan="8">'; print '<tr class="liste_total"><td colspan="8">';
print $langs->trans("CurrentBalance"); print $langs->trans("CurrentBalance");
print '</td>'; print '</td>';
print "<td align=\"right\" nowrap><b>".price($total - $objp->amount)."</b></td>"; print '<td align="right" nowrap><b>'.price($total - $objp->amount).'</b></td>';
print "<td>&nbsp;</td>"; print "<td>&nbsp;</td>";
print '</tr>'; print '</tr>';
} }
print "<tr $bc[$var]>"; print '<tr '.$bc[$var].'>';
print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n"; print '<td nowrap="nowrap">'.dol_print_date($db->jdate($objp->do),"day")."</td>\n";
@ -554,16 +540,20 @@ if ($account || $_GET["ref"])
$links = $acct->get_url($objp->rowid); $links = $acct->get_url($objp->rowid);
foreach($links as $key=>$val) foreach($links as $key=>$val)
{ {
if ($links[$key]['type']=='payment') { if ($links[$key]['type']=='payment')
{
$paymentstatic->id=$links[$key]['url_id']; $paymentstatic->id=$links[$key]['url_id'];
print ' '.$paymentstatic->getNomUrl(2); print ' '.$paymentstatic->getNomUrl(2);
} }
else if ($links[$key]['type']=='payment_supplier') { else if ($links[$key]['type']=='payment_supplier')
{
$paymentsupplierstatic->id=$links[$key]['url_id']; $paymentsupplierstatic->id=$links[$key]['url_id'];
$paymentsupplierstatic->ref=$links[$key]['url_id']; $paymentsupplierstatic->ref=$links[$key]['url_id'];
print ' '.$paymentsupplierstatic->getNomUrl(2); print ' '.$paymentsupplierstatic->getNomUrl(2);
} }
else if ($links[$key]['type']=='company') { else if ($links[$key]['type']=='company')
{
} }
else if ($links[$key]['type']=='payment_sc') else if ($links[$key]['type']=='payment_sc')
{ {
@ -572,7 +562,6 @@ if ($account || $_GET["ref"])
print ' '.img_object($langs->trans('ShowPayment'),'payment').' '; print ' '.img_object($langs->trans('ShowPayment'),'payment').' ';
//print $langs->trans("SocialContributionPayment"); //print $langs->trans("SocialContributionPayment");
print '</a>'; print '</a>';
} }
else if ($links[$key]['type']=='payment_vat') else if ($links[$key]['type']=='payment_vat')
{ {
@ -580,14 +569,21 @@ if ($account || $_GET["ref"])
$paymentvatstatic->ref=$links[$key]['url_id']; $paymentvatstatic->ref=$links[$key]['url_id'];
print ' '.$paymentvatstatic->getNomUrl(2); print ' '.$paymentvatstatic->getNomUrl(2);
} }
else if ($links[$key]['type']=='banktransfert') { else if ($links[$key]['type']=='banktransfert')
{
// Do not show this link (avoid confusion). Can already be accessed from transaction detail // Do not show this link (avoid confusion). Can already be accessed from transaction detail
} }
else if ($links[$key]['type']=='member') { else if ($links[$key]['type']=='member')
{
} }
else if ($links[$key]['type']=='sc') { else if ($links[$key]['type']=='sc')
{
} }
else { // Show link with label $links[$key]['label'] else
{
// Show link with label $links[$key]['label']
if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - '; if (! empty($objp->label) && ! empty($links[$key]['label'])) print ' - ';
print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">'; print '<a href="'.$links[$key]['url'].$links[$key]['url_id'].'">';
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
@ -605,17 +601,19 @@ if ($account || $_GET["ref"])
} }
print '</td>'; print '</td>';
// Add third party column // Add third party column
print '<td>'; print '<td>';
foreach($links as $key=>$val) foreach($links as $key=>$val)
{ {
if ($links[$key]['type']=='company') { if ($links[$key]['type']=='company')
{
$societestatic->id=$links[$key]['url_id']; $societestatic->id=$links[$key]['url_id'];
$societestatic->nom=$links[$key]['label']; $societestatic->nom=$links[$key]['label'];
print $societestatic->getNomUrl(1,'',16); print $societestatic->getNomUrl(1,'',16);
} }
else if ($links[$key]['type']=='sc') { // sc=old value else if ($links[$key]['type']=='sc')
{
// sc=old value
$chargestatic->id=$links[$key]['url_id']; $chargestatic->id=$links[$key]['url_id'];
if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg)) if (preg_match('/^\((.*)\)$/i',$links[$key]['label'],$reg))
{ {
@ -629,7 +627,8 @@ if ($account || $_GET["ref"])
$chargestatic->ref=$chargestatic->lib; $chargestatic->ref=$chargestatic->lib;
print $chargestatic->getNomUrl(1,16); print $chargestatic->getNomUrl(1,16);
} }
else if ($links[$key]['type']=='member') { else if ($links[$key]['type']=='member')
{
$memberstatic->id=$links[$key]['url_id']; $memberstatic->id=$links[$key]['url_id'];
$memberstatic->ref=$links[$key]['label']; $memberstatic->ref=$links[$key]['label'];
print $memberstatic->getNomUrl(1,16,'card'); print $memberstatic->getNomUrl(1,16,'card');
@ -640,11 +639,11 @@ if ($account || $_GET["ref"])
// Amount // Amount
if ($objp->amount < 0) if ($objp->amount < 0)
{ {
print "<td align=\"right\" nowrap>".price($objp->amount * -1)."</td><td>&nbsp;</td>\n"; print '<td align="right" nowrap>'.price($objp->amount * -1).'</td><td>&nbsp;</td>'."\n";
} }
else else
{ {
print "<td>&nbsp;</td><td align=\"right\" nowrap>&nbsp;".price($objp->amount)."</td>\n"; print '<td>&nbsp;</td><td align="right" nowrap>&nbsp;'.price($objp->amount).'</td>'."\n";
} }
// Balance // Balance
@ -667,12 +666,12 @@ if ($account || $_GET["ref"])
// Transaction reconciliated or edit link // Transaction reconciliated or edit link
if ($objp->rappro && $acct->canBeConciliated() > 0) // If line not conciliated and account can be conciliated if ($objp->rappro && $acct->canBeConciliated() > 0) // If line not conciliated and account can be conciliated
{ {
print "<td align=\"center\" nowrap>"; print '<td align="center" nowrap>';
print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'&amp;page='.$page.'">'; print '<a href="'.DOL_URL_ROOT.'/compta/bank/ligne.php?rowid='.$objp->rowid.'&amp;account='.$acct->id.'&amp;page='.$page.'">';
print img_edit(); print img_edit();
print '</a>'; print '</a>';
print "&nbsp; "; print "&nbsp; ";
print "<a href=\"releve.php?num=$objp->num_releve&amp;account=$acct->id\">$objp->num_releve</a>"; print '<a href="releve.php?num='.$objp->num_releve.'&amp;account='.$acct->id.'">'.$objp->num_releve.'</a>';
print "</td>"; print "</td>";
} }
else else
@ -708,7 +707,6 @@ if ($account || $_GET["ref"])
} }
print "</tr>"; print "</tr>";
} }
$i++; $i++;
@ -732,7 +730,6 @@ if ($account || $_GET["ref"])
dol_print_error($db); dol_print_error($db);
} }
print "</table>"; print "</table>";
print "\n</div>\n"; print "\n</div>\n";
@ -753,7 +750,7 @@ if ($account || $_GET["ref"])
} }
else else
{ {
print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("Conciliate")."</a>"; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
} }
} }
@ -765,7 +762,7 @@ if ($account || $_GET["ref"])
} }
else else
{ {
print "<a class=\"butActionRefused\" title=\"".$langs->trans("NotEnoughPermissions")."\" href=\"#\">".$langs->trans("AddBankRecord")."</a>"; print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("AddBankRecord").'</a>';
} }
} }
@ -773,7 +770,6 @@ if ($account || $_GET["ref"])
} }
print '<br>'; print '<br>';
} }
else else
{ {

View File

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

View File

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

View File

@ -81,17 +81,32 @@ class Form
{ {
global $conf,$langs; global $conf,$langs;
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE)) return $langs->trans($text); $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 else
{ {
$ret='';
$ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">'; $ret.='<table class="nobordernopadding" width="100%"><tr><td nowrap="nowrap">';
$ret.=$langs->trans($text); $ret.=$langs->trans($text);
$ret.='</td>'; $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>'; 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>'; $ret.='</tr></table>';
return $ret;
} }
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.= $value;
$out.= '</div>'; $out.= '</div>'."\n";
} }
else else
{ {

View File

@ -11,7 +11,7 @@ $(document).ready(function() {
var table_element = $('#jeditable_table_element').html(); var table_element = $('#jeditable_table_element').html();
var fk_element = $('#jeditable_fk_element').html(); var fk_element = $('#jeditable_fk_element').html();
$('.edit_textarea').editable(urlSaveInPlace, { $('.editval_textarea').editable(urlSaveInPlace, {
type : 'textarea', type : 'textarea',
rows : 4, rows : 4,
id : 'field', 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', type : 'ckeditor',
id : 'field', id : 'field',
onblur : 'ignore', 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', type : 'text',
id : 'field', id : 'field',
width : 300, 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', type : 'text',
id : 'field', id : 'field',
width : 100, 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', type : 'datepicker',
id : 'field', id : 'field',
onblur : 'ignore', 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', type : 'select',
id : 'field', id : 'field',
onblur : 'ignore', 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, { $('.edit_autocomplete').editable(urlSaveInPlace, {
type : 'autocomplete', type : 'autocomplete',
id : 'field', id : 'field',

View File

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

View File

@ -1,9 +1,9 @@
<?php <?php
/* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org> * Copyright (C) 2004 Sebastien Di Cintio <sdicintio@ressource-toi.org>
* Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be> * Copyright (C) 2004 Benoit Mortier <benoit.mortier@opensides.be>
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * 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); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) 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) if ($conf->global->LDAP_FIELD_MEMBER_STATUS)
{ {
$ldap=new Ldap(); $ldap=new Ldap();
@ -399,7 +399,7 @@ class InterfaceLdapsynchro
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) 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 if ($conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_DATE
|| $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT || $conf->global->LDAP_FIELD_MEMBER_FIRSTSUBSCRIPTION_AMOUNT
|| $conf->global->LDAP_FIELD_MEMBER_LASTSUBSCRIPTION_DATE || $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); dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
if ($conf->ldap->enabled && $conf->global->LDAP_MEMBER_ACTIVE) 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) if ($conf->global->LDAP_FIELD_PASSWORD || $conf->global->LDAP_FIELD_PASSWORD_CRYPTED)
{ {
$ldap=new Ldap(); $ldap=new Ldap();

View File

@ -248,9 +248,9 @@ class Fournisseur extends Societe
/** /**
* Return a link on thirdparty (with picto) * 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 int $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 string $option Target of link ('', 'customer', 'prospect', 'supplier')
* @param maxlen Max length of text * @param int $maxlen Max length of text
* @return string String with URL * @return string String with URL
*/ */
function getNomUrl($withpicto=0,$option='supplier',$maxlen=0) 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 */ /* jQuery - jeditable */
/* ============================================================================== */ /* ============================================================================== */
.edit_textarea:hover, .edit_ckeditor:hover, .edit_text:hover, .edit_numeric:hover, .edit_select:hover { .editkey_textarea, .editkey_ckeditor, .editkey_text, .editkey_numeric, .editkey_select {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right center no-repeat; background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/edit.png',1) ?>) right top no-repeat;
cursor: pointer; cursor: pointer;
} }
.edit_datepicker:hover { .editkey_datepicker {
background: white url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat; background: url(<?php echo dol_buildpath($path.'/theme/auguria/img/calendar.png',1) ?>) right center no-repeat;
cursor: pointer; 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 */ /* Admin Menu */

View File

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

View File

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

View File

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