Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
efd23e983c
@ -2,7 +2,7 @@
|
|||||||
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||||
* Copyright (C) 2005-2009 Regis Houssin <regis@dolibarr.fr>
|
* Copyright (C) 2005-2012 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
|
||||||
@ -36,14 +36,17 @@ $langs->load('banks');
|
|||||||
$langs->load('companies');
|
$langs->load('companies');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
$id=GETPOST("id");
|
$id=GETPOST('id','int');
|
||||||
$action=GETPOST("action");
|
$action=GETPOST('action','alpha');
|
||||||
|
$confirm=GETPOST('confirm','alpha');
|
||||||
if ($user->societe_id) $socid=$user->societe_id;
|
if ($user->societe_id) $socid=$user->societe_id;
|
||||||
// TODO ajouter regle pour restreindre acces paiement
|
// TODO ajouter regle pour restreindre acces paiement
|
||||||
//$result = restrictedArea($user, 'facture', $id,'');
|
//$result = restrictedArea($user, 'facture', $id,'');
|
||||||
|
|
||||||
$mesg='';
|
$mesg='';
|
||||||
|
|
||||||
|
$object = new Paiement($db);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Actions
|
* Actions
|
||||||
@ -53,9 +56,8 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
|
|||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new Paiement($db);
|
$object->fetch($id);
|
||||||
$paiement->fetch($id);
|
$result = $object->update_note(GETPOST('note'));
|
||||||
$result = $paiement->update_note(GETPOST('note'));
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -63,18 +65,17 @@ if ($action == 'setnote' && $user->rights->facture->paiement)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$mesg='<div class="error">'.$paiement->error.'</div>';
|
$mesg='<div class="error">'.$object->error.'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights->facture->paiement)
|
if ($action == 'confirm_delete' && $confirm == 'yes' && $user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new Paiement($db);
|
$object->fetch($id);
|
||||||
$paiement->fetch($id);
|
$result = $object->delete();
|
||||||
$result = $paiement->delete();
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
@ -84,18 +85,17 @@ if ($action == 'confirm_delete' && GETPOST('confirm') == 'yes' && $user->rights-
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans($paiement->error).'</div>';
|
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'confirm_valide' && GETPOST('confirm') == 'yes' && $user->rights->facture->paiement)
|
if ($action == 'confirm_valide' && $confirm == 'yes' && $user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
$db->begin();
|
$db->begin();
|
||||||
|
|
||||||
$paiement = new Paiement($db);
|
$object->fetch($id);
|
||||||
$paiement->fetch($id);
|
if ($object->valide() > 0)
|
||||||
if ($paiement->valide() > 0)
|
|
||||||
{
|
{
|
||||||
$db->commit();
|
$db->commit();
|
||||||
|
|
||||||
@ -115,22 +115,21 @@ if ($action == 'confirm_valide' && GETPOST('confirm') == 'yes' && $user->rights-
|
|||||||
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager);
|
if (empty($conf->global->MAIN_DISABLE_PDF_AUTOUPDATE)) facture_pdf_create($db, $fac, $fac->modelpdf, $outputlangs, $hookmanager);
|
||||||
}
|
}
|
||||||
|
|
||||||
Header('Location: fiche.php?id='.$paiement->id);
|
Header('Location: '.$_SERVER['PHP_SELF'].'?id='.$object->id);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$langs->load("errors");
|
$langs->load("errors");
|
||||||
$mesg='<div class="error">'.$langs->trans($paiement->error).'</div>';
|
$mesg='<div class="error">'.$langs->trans($object->error).'</div>';
|
||||||
$db->rollback();
|
$db->rollback();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setnum' && !empty($_POST['num']))
|
if ($action == 'setnum' && ! empty($_POST['num_paiement']))
|
||||||
{
|
{
|
||||||
$paiement = new Paiement($db);
|
$object->fetch($id);
|
||||||
$paiement->fetch($id);
|
$res = $object->update_num($_POST['num_paiement']);
|
||||||
$res = $paiement->update_num($_POST['num']);
|
|
||||||
if ($res === 0)
|
if ($res === 0)
|
||||||
{
|
{
|
||||||
$mesg = '<div class="ok">'.$langs->trans('PaymentNumberUpdateSucceeded').'</div>';
|
$mesg = '<div class="ok">'.$langs->trans('PaymentNumberUpdateSucceeded').'</div>';
|
||||||
@ -141,12 +140,11 @@ if ($action == 'setnum' && !empty($_POST['num']))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($action == 'setdate' && !empty($_POST['dateday']))
|
if ($action == 'setdate' && ! empty($_POST['datepday']))
|
||||||
{
|
{
|
||||||
$paiement = new Paiement($db);
|
$object->fetch($id);
|
||||||
$paiement->fetch($id);
|
$datepaye = dol_mktime(12, 0, 0, $_POST['datepmonth'], $_POST['datepday'], $_POST['datepyear']);
|
||||||
$datepaye = dol_mktime(12, 0, 0, $_POST['datemonth'], $_POST['dateday'], $_POST['dateyear']);
|
$res = $object->update_date($datepaye);
|
||||||
$res = $paiement->update_date($datepaye);
|
|
||||||
if ($res === 0)
|
if ($res === 0)
|
||||||
{
|
{
|
||||||
$mesg = '<div class="ok">'.$langs->trans('PaymentDateUpdateSucceeded').'</div>';
|
$mesg = '<div class="ok">'.$langs->trans('PaymentDateUpdateSucceeded').'</div>';
|
||||||
@ -166,8 +164,7 @@ llxHeader();
|
|||||||
|
|
||||||
$thirdpartystatic=new Societe($db);
|
$thirdpartystatic=new Societe($db);
|
||||||
|
|
||||||
$paiement = new Paiement($db);
|
$result=$object->fetch($id);
|
||||||
$result=$paiement->fetch($id);
|
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
dol_print_error($db,'Payement '.$id.' not found in database');
|
dol_print_error($db,'Payement '.$id.' not found in database');
|
||||||
@ -178,7 +175,7 @@ $form = new Form($db);
|
|||||||
|
|
||||||
$h=0;
|
$h=0;
|
||||||
|
|
||||||
$head[$h][0] = DOL_URL_ROOT.'/compta/paiement/fiche.php?id='.$id;
|
$head[$h][0] = $_SERVER['PHP_SELF'].'?id='.$id;
|
||||||
$head[$h][1] = $langs->trans("Card");
|
$head[$h][1] = $langs->trans("Card");
|
||||||
$hselected = $h;
|
$hselected = $h;
|
||||||
$h++;
|
$h++;
|
||||||
@ -195,7 +192,7 @@ dol_fiche_head($head, $hselected, $langs->trans("PaymentCustomerInvoice"), 0, 'p
|
|||||||
*/
|
*/
|
||||||
if ($action == 'delete')
|
if ($action == 'delete')
|
||||||
{
|
{
|
||||||
$ret=$form->form_confirm('fiche.php?id='.$paiement->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id, $langs->trans("DeletePayment"), $langs->trans("ConfirmDeletePayment"), 'confirm_delete','',0,2);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -205,7 +202,7 @@ if ($action == 'delete')
|
|||||||
if ($action == 'valide')
|
if ($action == 'valide')
|
||||||
{
|
{
|
||||||
$facid = $_GET['facid'];
|
$facid = $_GET['facid'];
|
||||||
$ret=$form->form_confirm('fiche.php?id='.$paiement->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
$ret=$form->form_confirm($_SERVER['PHP_SELF'].'?id='.$object->id.'&facid='.$facid, $langs->trans("ValidatePayment"), $langs->trans("ConfirmValidatePayment"), 'confirm_valide','',0,2);
|
||||||
if ($ret == 'html') print '<br>';
|
if ($ret == 'html') print '<br>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,37 +213,37 @@ dol_htmloutput_mesg($mesg);
|
|||||||
print '<table class="border" width="100%">';
|
print '<table class="border" width="100%">';
|
||||||
|
|
||||||
// Ref
|
// Ref
|
||||||
print '<tr><td valign="top" width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$paiement->id.'</td></tr>';
|
print '<tr><td valign="top" width="20%">'.$langs->trans('Ref').'</td><td colspan="3">'.$object->id.'</td></tr>';
|
||||||
|
|
||||||
// Date payment
|
// Date payment
|
||||||
print '<tr><td valign="top">'.$form->editfieldkey("Date",'date',$paiement->date,$paiement,$user->rights->facture->paiement).'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$form->editfieldkey("Date",'datep',$object->date,$object,$user->rights->facture->paiement).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Date",'date',$paiement->date,$paiement,$user->rights->facture->paiement,'day');
|
print $form->editfieldval("Date",'datep',$object->date,$object,$user->rights->facture->paiement,'datepicker','',null,$langs->trans('PaymentDateUpdateSucceeded'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Payment type (VIR, LIQ, ...)
|
// Payment type (VIR, LIQ, ...)
|
||||||
$labeltype=$langs->trans("PaymentType".$paiement->type_code)!=("PaymentType".$paiement->type_code)?$langs->trans("PaymentType".$paiement->type_code):$paiement->type_libelle;
|
$labeltype=$langs->trans("PaymentType".$object->type_code)!=("PaymentType".$object->type_code)?$langs->trans("PaymentType".$object->type_code):$object->type_libelle;
|
||||||
print '<tr><td valign="top">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('PaymentMode').'</td><td colspan="3">'.$labeltype.'</td></tr>';
|
||||||
|
|
||||||
// Payment numero
|
// Payment numero
|
||||||
print '<tr><td valign="top">'.$form->editfieldkey("Numero",'num',$paiement->numero,$paiement,$paiement->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$form->editfieldkey("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Numero",'num',$paiement->numero,$paiement,$paiement->statut == 0 && $user->rights->fournisseur->facture->creer,'string');
|
print $form->editfieldval("Numero",'num_paiement',$object->numero,$object,$object->statut == 0 && $user->rights->fournisseur->facture->creer,'string','',null,$langs->trans('PaymentNumberUpdateSucceeded'));
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Amount
|
// Amount
|
||||||
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($paiement->montant).' '.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
print '<tr><td valign="top">'.$langs->trans('Amount').'</td><td colspan="3">'.price($object->montant).' '.$langs->trans('Currency'.$conf->currency).'</td></tr>';
|
||||||
|
|
||||||
// Note
|
// Note
|
||||||
print '<tr><td valign="top">'.$form->editfieldkey("Note",'note',$paiement->note,$paiement,$user->rights->facture->paiement).'</td><td colspan="3">';
|
print '<tr><td valign="top">'.$form->editfieldkey("Note",'note',$object->note,$object,$user->rights->facture->paiement).'</td><td colspan="3">';
|
||||||
print $form->editfieldval("Note",'note',$paiement->note,$paiement,$user->rights->facture->paiement,'text');
|
print $form->editfieldval("Note",'note',$object->note,$object,$user->rights->facture->paiement,'textarea');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Bank account
|
// Bank account
|
||||||
if ($conf->banque->enabled)
|
if ($conf->banque->enabled)
|
||||||
{
|
{
|
||||||
if ($paiement->bank_account)
|
if ($object->bank_account)
|
||||||
{
|
{
|
||||||
$bankline=new AccountLine($db);
|
$bankline=new AccountLine($db);
|
||||||
$bankline->fetch($paiement->bank_line);
|
$bankline->fetch($object->bank_line);
|
||||||
|
|
||||||
print '<tr>';
|
print '<tr>';
|
||||||
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
print '<td>'.$langs->trans('BankTransactionLine').'</td>';
|
||||||
@ -270,7 +267,7 @@ $sql.= ' FROM '.MAIN_DB_PREFIX.'paiement_facture as pf,'.MAIN_DB_PREFIX.'facture
|
|||||||
$sql.= ' WHERE pf.fk_facture = f.rowid';
|
$sql.= ' WHERE pf.fk_facture = f.rowid';
|
||||||
$sql.= ' AND f.fk_soc = s.rowid';
|
$sql.= ' AND f.fk_soc = s.rowid';
|
||||||
$sql.= ' AND f.entity = '.$conf->entity;
|
$sql.= ' AND f.entity = '.$conf->entity;
|
||||||
$sql.= ' AND pf.fk_paiement = '.$paiement->id;
|
$sql.= ' AND pf.fk_paiement = '.$object->id;
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
@ -360,11 +357,11 @@ print '<div class="tabsAction">';
|
|||||||
|
|
||||||
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
if ($conf->global->BILL_ADD_PAYMENT_VALIDATION)
|
||||||
{
|
{
|
||||||
if ($user->societe_id == 0 && $paiement->statut == 0 && $_GET['action'] == '')
|
if ($user->societe_id == 0 && $object->statut == 0 && $_GET['action'] == '')
|
||||||
{
|
{
|
||||||
if ($user->rights->facture->paiement)
|
if ($user->rights->facture->paiement)
|
||||||
{
|
{
|
||||||
print '<a class="butAction" href="fiche.php?id='.$id.'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
print '<a class="butAction" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&facid='.$objp->facid.'&action=valide">'.$langs->trans('Valid').'</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,7 +372,7 @@ if ($user->societe_id == 0 && $action == '')
|
|||||||
{
|
{
|
||||||
if (! $disable_delete)
|
if (! $disable_delete)
|
||||||
{
|
{
|
||||||
print '<a class="butActionDelete" href="fiche.php?id='.$id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
print '<a class="butActionDelete" href="'.$_SERVER['PHP_SELF'].'?id='.$id.'&action=delete">'.$langs->trans('Delete').'</a>';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -386,7 +383,7 @@ if ($user->societe_id == 0 && $action == '')
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
$db->close();
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
/* Copyright (C) 2011-2012 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
|
||||||
@ -63,7 +63,8 @@ if((isset($_GET['field']) && ! empty($_GET['field']))
|
|||||||
if ($element == 'propal') $element = 'propale';
|
if ($element == 'propal') $element = 'propale';
|
||||||
else if ($element == 'fichinter') $element = 'ficheinter';
|
else if ($element == 'fichinter') $element = 'ficheinter';
|
||||||
|
|
||||||
if ($user->rights->$element->lire || $user->rights->$element->read
|
if (($element == 'payment' && $user->rights->facture->paiement)
|
||||||
|
|| $user->rights->$element->lire || $user->rights->$element->read
|
||||||
|| $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read)
|
|| $user->rights->$element->$subelement->lire || $user->rights->$element->$subelement->read)
|
||||||
{
|
{
|
||||||
if ($type == 'select')
|
if ($type == 'select')
|
||||||
|
|||||||
@ -69,7 +69,8 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
|||||||
if ($element == 'propal') $element = 'propale';
|
if ($element == 'propal') $element = 'propale';
|
||||||
else if ($element == 'fichinter') $element = 'ficheinter';
|
else if ($element == 'fichinter') $element = 'ficheinter';
|
||||||
|
|
||||||
if ($user->rights->$element->creer || $user->rights->$element->write
|
if (($element == 'payment' && $user->rights->facture->paiement)
|
||||||
|
|| $user->rights->$element->creer || $user->rights->$element->write
|
||||||
|| $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write)
|
|| $user->rights->$element->$subelement->creer || $user->rights->$element->$subelement->write)
|
||||||
{
|
{
|
||||||
// Clean parameters
|
// Clean parameters
|
||||||
|
|||||||
@ -118,9 +118,10 @@ class Form
|
|||||||
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height', 'select:xxx'...)
|
* @param string $typeofdata Type of data ('string' by default, 'email', 'numeric:99', 'text' or 'textarea', 'day' or 'datepicker', 'ckeditor:dolibarr_zzz:width:height', 'select:xxx'...)
|
||||||
* @param string $editvalue When in edit mode, use this value as $value instead of value
|
* @param string $editvalue When in edit mode, use this value as $value instead of value
|
||||||
* @param object $extObject External object
|
* @param object $extObject External object
|
||||||
|
* @param string $success Success message
|
||||||
* @return string HTML edit field
|
* @return string HTML edit field
|
||||||
*/
|
*/
|
||||||
function editfieldval($text,$htmlname,$value,$object,$perm,$typeofdata='string',$editvalue='',$extObject=false)
|
function editfieldval($text,$htmlname,$value,$object,$perm,$typeofdata='string',$editvalue='',$extObject=null,$success=null)
|
||||||
{
|
{
|
||||||
global $conf,$langs,$db;
|
global $conf,$langs,$db;
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ class Form
|
|||||||
// When option to edit inline is activated
|
// When option to edit inline is activated
|
||||||
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
if (! empty($conf->global->MAIN_USE_JQUERY_JEDITABLE))
|
||||||
{
|
{
|
||||||
$ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $extObject);
|
$ret.=$this->editInPlace($object, $value, $htmlname, $perm, $typeofdata, $extObject, $success);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -194,9 +195,10 @@ class Form
|
|||||||
* @param int $condition Condition to edit
|
* @param int $condition Condition to edit
|
||||||
* @param string $inputType Type of input ('numeric', 'datepicker', 'textarea', 'ckeditor:dolibarr_zzz', 'select:xxx')
|
* @param string $inputType Type of input ('numeric', 'datepicker', 'textarea', 'ckeditor:dolibarr_zzz', 'select:xxx')
|
||||||
* @param object $extObject External object
|
* @param object $extObject External object
|
||||||
|
* @param string $success Success message
|
||||||
* @return string HTML edit in place
|
* @return string HTML edit in place
|
||||||
*/
|
*/
|
||||||
private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $extObject=false)
|
private function editInPlace($object, $value, $htmlname, $condition, $inputType='textarea', $extObject=null, $success=null)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
@ -238,7 +240,7 @@ class Form
|
|||||||
$inputType=$tmp[0]; $inputOption=$tmp[1];
|
$inputType=$tmp[0]; $inputOption=$tmp[1];
|
||||||
if (! empty($tmp[2])) $savemethod=$tmp[2];
|
if (! empty($tmp[2])) $savemethod=$tmp[2];
|
||||||
}
|
}
|
||||||
if (preg_match('/^datepicker/',$inputType))
|
else if (preg_match('/^datepicker/',$inputType))
|
||||||
{
|
{
|
||||||
$tmp=explode(':',$inputType);
|
$tmp=explode(':',$inputType);
|
||||||
$inputType=$tmp[0]; $inputOption=$tmp[1];
|
$inputType=$tmp[0]; $inputOption=$tmp[1];
|
||||||
@ -276,6 +278,7 @@ class Form
|
|||||||
$out.= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
|
$out.= '<input id="loadmethod_'.$htmlname.'" value="'.$loadmethod.'" type="hidden"/>'."\n";
|
||||||
$out.= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
|
$out.= '<input id="savemethod_'.$htmlname.'" value="'.$savemethod.'" type="hidden"/>'."\n";
|
||||||
$out.= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
|
$out.= '<input id="ext_element_'.$htmlname.'" value="'.$ext_element.'" type="hidden"/>'."\n";
|
||||||
|
if (! empty($success)) $out.= '<input id="success_'.$htmlname.'" value="'.$success.'" type="hidden"/>'."\n";
|
||||||
//$out.= '<input id="ext_table_element_'.$htmlname.'" value="'.$ext_table_element.'" type="hidden"/>'."\n";
|
//$out.= '<input id="ext_table_element_'.$htmlname.'" value="'.$ext_table_element.'" type="hidden"/>'."\n";
|
||||||
//$out.= '<input id="ext_fk_element_'.$htmlname.'" value="'.$ext_fk_element.'" type="hidden"/>'."\n";
|
//$out.= '<input id="ext_fk_element_'.$htmlname.'" value="'.$ext_fk_element.'" type="hidden"/>'."\n";
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// Copyright (C) 2011 Regis Houssin <regis@dolibarr.fr>
|
// Copyright (C) 2011-2012 Regis Houssin <regis@dolibarr.fr>
|
||||||
// Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
// Copyright (C) 2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
//
|
//
|
||||||
// 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
|
||||||
@ -45,14 +45,7 @@ $(document).ready(function() {
|
|||||||
return getParameters('textarea', htmlname);
|
return getParameters('textarea', htmlname);
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
getResult(this, result);
|
||||||
|
|
||||||
if (obj.error) {
|
|
||||||
$(this).html(this.revert);
|
|
||||||
$.jnotify(obj.error, "error", true);
|
|
||||||
} else {
|
|
||||||
$(this).html(obj.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editkey_textarea').hover(
|
$('.editkey_textarea').hover(
|
||||||
@ -85,14 +78,7 @@ $(document).ready(function() {
|
|||||||
return getParameters('ckeditor', htmlname);
|
return getParameters('ckeditor', htmlname);
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
getResult(this, result);
|
||||||
|
|
||||||
if (obj.error) {
|
|
||||||
$(this).html(this.revert);
|
|
||||||
$.jnotify(obj.error, "error", true);
|
|
||||||
} else {
|
|
||||||
$(this).html(obj.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editkey_ckeditor').hover(
|
$('.editkey_ckeditor').hover(
|
||||||
@ -121,14 +107,7 @@ $(document).ready(function() {
|
|||||||
return getParameters('string', htmlname);
|
return getParameters('string', htmlname);
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
getResult(this, result);
|
||||||
|
|
||||||
if (obj.error) {
|
|
||||||
$(this).html(this.revert);
|
|
||||||
$.jnotify(obj.error, "error", true);
|
|
||||||
} else {
|
|
||||||
$(this).html(obj.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editkey_string').hover(
|
$('.editkey_string').hover(
|
||||||
@ -193,14 +172,7 @@ $(document).ready(function() {
|
|||||||
return getParameters('datepicker', htmlname);
|
return getParameters('datepicker', htmlname);
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
getResult(this, result);
|
||||||
|
|
||||||
if (obj.error) {
|
|
||||||
$(this).html(this.revert);
|
|
||||||
$.jnotify(obj.error, "error", true);
|
|
||||||
} else {
|
|
||||||
$(this).html(obj.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editkey_datepicker').hover(
|
$('.editkey_datepicker').hover(
|
||||||
@ -235,14 +207,7 @@ $(document).ready(function() {
|
|||||||
return getParameters('select', htmlname);
|
return getParameters('select', htmlname);
|
||||||
},
|
},
|
||||||
callback : function(result, settings) {
|
callback : function(result, settings) {
|
||||||
var obj = $.parseJSON(result);
|
getResult(this, result);
|
||||||
|
|
||||||
if (obj.error) {
|
|
||||||
$(this).html(this.revert);
|
|
||||||
$.jnotify(obj.error, "error", true);
|
|
||||||
} else {
|
|
||||||
$(this).html(obj.value);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('.editkey_select').hover(
|
$('.editkey_select').hover(
|
||||||
@ -282,6 +247,21 @@ $(document).ready(function() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getResult(obj, result) {
|
||||||
|
var res = $.parseJSON(result);
|
||||||
|
if (res.error) {
|
||||||
|
$(obj).html(obj.revert);
|
||||||
|
$.jnotify(res.error, "error", true);
|
||||||
|
} else {
|
||||||
|
var htmlname = $(obj).attr('id').substr(4);
|
||||||
|
var success = $( '#success_' + htmlname ).val();
|
||||||
|
if (success != undefined) {
|
||||||
|
$.jnotify(success, "ok");
|
||||||
|
}
|
||||||
|
$(obj).html(res.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$('.edit_autocomplete').editable(urlSaveInPlace, {
|
$('.edit_autocomplete').editable(urlSaveInPlace, {
|
||||||
type : 'autocomplete',
|
type : 'autocomplete',
|
||||||
id : 'field',
|
id : 'field',
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user