Start implement

This commit is contained in:
Andrelec1 2014-08-11 18:14:40 +02:00
parent e18caccdc9
commit 3548f72d8a
3 changed files with 49 additions and 3 deletions

View File

@ -261,6 +261,24 @@ if ($action == 'setforcedate')
}
}
if ($action == 'set_FAC_AUTO_FILLJS')
{
$freetext = GETPOST('FAC_AUTO_FILLJS'); // No alpha here, we want exact string
$res = dolibarr_set_const($db, "FAC_AUTO_FILLJS",$freetext,'chaine',0,'',$conf->entity);
if (! $res > 0) $error++;
if (! $error)
{
setEventMessage($langs->trans("SetupSaved"));
}
else
{
setEventMessage($langs->trans("Error"),'errors');
}
}
/*
* View
@ -765,6 +783,20 @@ print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" /
print "</td></tr>\n";
print '</form>';
// Add js auto fill amount on paiement form
$var=! $var;
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'" />';
print '<input type="hidden" name="action" value="set_FAC_AUTO_FILLJS" />';
print '<tr '.$bc[$var].'><td>';
print $langs->trans("JSOnPaimentBill");
print '</td><td width="60" align="center">';
print $form->selectyesno("FAC_AUTO_FILLJS",$conf->global->FAC_AUTO_FILLJS,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'" />';
print "</td></tr>\n";
print '</form>';
print '</table>';

View File

@ -5,6 +5,7 @@
* Copyright (C) 2004 Christophe Combelles <ccomb@free.fr>
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@capnetworks.com>
* Copyright (C) 2014 Teddy Andreotti <125155@supinfo.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
@ -328,9 +329,19 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
{
$i = 0;
print '<br>';
print $langs->trans('Invoices').'<br>';
print '<table class="noborder" width="100%">';
if(!empty($conf->global->FAC_AUTO_FILLJS)){
//Addjs for AutoFill
print "\n".'<script type="text/javascript" language="javascript">';
print ' $(document).ready(function () {';
print ' $(".AutoFillAmout").on(\'click touchstart\', function(){
$("input[name="+$(this).data(\'rowname\')+"]").val($(this).data("value"));
});';
print ' });'."\n";
print ' </script>'."\n";
}
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans('Ref').'</td>';
print '<td>'.$langs->trans('RefSupplier').'</td>';
@ -370,8 +381,10 @@ if ($action == 'create' || $action == 'confirm_paiement' || $action == 'add_paie
print '<td align="right">'.price($objp->total_ttc - $objp->am).'</td>';
print '<td align="center">';
$namef = 'amount_'.$objp->facid;
if(!empty($conf->global->FAC_AUTO_FILLJS))
print img_picto("Auto fill",'1rightarrow_selected', "class='AutoFillAmout' data-rowname='".$namef."' data-value='".($objp->total_ttc - $objp->am)."'"); // TODO ADD lang
print '<input type="text" size="8" name="'.$namef.'" value="'.GETPOST($namef).'">';
print "</td></tr>\n";
print "</td></tr>\n";
$total+=$objp->total_ht;
$total_ttc+=$objp->total_ttc;
$totalrecu+=$objp->am;

View File

@ -1075,6 +1075,7 @@ NotificationsDesc=La fonction des notifications par emails permet d'envoyer auto
ModelModules=Modèle de documents
DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT ou .ODS OpenOffice, KOffice, TextEdit…)
WatermarkOnDraft=Filigrane sur les documents brouillons
JSOnPaimentBill=Ajout surcouche js
CompanyIdProfChecker=Règles sur les Identifiants professionnels
MustBeUnique=Doit être unique ?
MustBeMandatory=Obligatoire pour creer tiers ?