New: add switch button on/off

Works on paypal module
This commit is contained in:
Regis Houssin
2011-05-17 10:36:53 +00:00
parent 00fea772ac
commit 61b3589fe0
17 changed files with 200 additions and 10 deletions

View File

@@ -11,4 +11,22 @@ PAYPAL_API_PASSWORD=API password
PAYPAL_API_SIGNATURE=API signature PAYPAL_API_SIGNATURE=API signature
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Offer payment "integral" (Credit card+Paypal) or "Paypal" only
PAYPAL_CSS_URL=Optionnal Url of CSS style sheet on payment page PAYPAL_CSS_URL=Optionnal Url of CSS style sheet on payment page
ThisIsTransactionId=This is id of transaction: <b>%s</b> ThisIsTransactionId=This is id of transaction: <b>%s</b>
PaypalTransactionDesc=This options allows you to import Paypal payments in Dolibarr as orders, invoices, etc ...
PaypalEnableThisTool=Enable this functionnality
# Paypal transaction fields
PAYERID=
PAYERSTATUS=
ADDRESSSTATUS=
TRANSACTIONID=
TRANSACTIONTYPE=
PAYMENTTYPE=
AMT=
FEEAMT=
TAXAMT=
PAYMENTSTATUS=
PENDINGREASON=
REASONCODE=
SHIPPINGMETHOD=
PROTECTIONELIGIBILITY=

View File

@@ -11,4 +11,22 @@ PAYPAL_API_PASSWORD=Mot de passe utilisateur API
PAYPAL_API_SIGNATURE=Signature API PAYPAL_API_SIGNATURE=Signature API
PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposer le paiement intégral (Carte+Paypal) ou Paypal seul PAYPAL_API_INTEGRAL_OR_PAYPALONLY=Proposer le paiement intégral (Carte+Paypal) ou Paypal seul
PAYPAL_CSS_URL=Url optionnelle de la feuille de style CSS de la page de paiement PAYPAL_CSS_URL=Url optionnelle de la feuille de style CSS de la page de paiement
ThisIsTransactionId=Voici l'identifiant de la transaction: <b>%s</b> ThisIsTransactionId=Voici l'identifiant de la transaction: <b>%s</b>
PaypalTransactionDesc=Ces options permettent d'importer des paiements Paypal dans Dolibarr en tant que commandes, factures, etc...
PaypalEnableThisTool=Activer ces fonctionnalités
# Paypal transaction fields
PAYERID=
PAYERSTATUS=
ADDRESSSTATUS=
TRANSACTIONID=
TRANSACTIONTYPE=
PAYMENTTYPE=
AMT=
FEEAMT=
TAXAMT=
PAYMENTSTATUS=
PENDINGREASON=
REASONCODE=
SHIPPINGMETHOD=
PROTECTIONELIGIBILITY=

View File

@@ -246,8 +246,8 @@ function ajax_constantonoff($code)
}); });
</script>'; </script>';
$out.= '<div id="set_'.$code.'" class="linkobject '.($conf->global->$code?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'off').'</div>'; $out.= '<span id="set_'.$code.'" class="linkobject '.($conf->global->$code?'hideobject':'').'">'.img_picto($langs->trans("Disabled"),'switch_off').'</span>';
$out.= '<div id="del_'.$code.'" class="linkobject '.($conf->global->$code?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'on').'</div>'; $out.= '<span id="del_'.$code.'" class="linkobject '.($conf->global->$code?'':'hideobject').'">'.img_picto($langs->trans("Enabled"),'switch_on').'</span>';
return $out; return $out;
} }

View File

@@ -2478,7 +2478,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title.png', $pictoisfullpath
$return.= "\n"; $return.= "\n";
$return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>'; $return.= '<table '.($id?'id="'.$id.'" ':'').'summary="" width="100%" border="0" class="notopnoleftnoright" style="margin-bottom: 2px;"><tr>';
if (empty($conf->browser->phone) && $picto && $titre) $return.= '<td class="nobordernopadding" width="40" align="left" valign="middle">'.img_picto('',$picto, 'id="pictotitle"', $pictoisfullpath).'</td>'; if (empty($conf->browser->phone) && $picto) $return.= '<td class="nobordernopadding" width="40" align="left" valign="middle">'.img_picto('',$picto, 'id="pictotitle"', $pictoisfullpath).'</td>';
$return.= '<td class="nobordernopadding" valign="middle">'; $return.= '<td class="nobordernopadding" valign="middle">';
$return.= '<div class="titre">'.$titre.'</div>'; $return.= '<div class="titre">'.$titre.'</div>';
$return.= '</td>'; $return.= '</td>';

128
htdocs/paypal/admin/import.php Executable file
View File

@@ -0,0 +1,128 @@
<?php
/* Copyright (C) 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/**
* \file htdocs/paypal/admin/import.php
* \ingroup paypal
* \brief Setup page for paypal module
* \version $Id$
*/
require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
if (!$user->admin)
accessforbidden();
$langs->load("paypal");
$langs->load("admin");
/*
* Actions
*/
if (preg_match('/set_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_set_const($db, $code, 1, 'chaine', 0, '', $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
if (preg_match('/del_(.*)/',$action,$reg))
{
$code=$reg[1];
if (dolibarr_del_const($db, $code, $conf->entity) > 0)
{
Header("Location: ".$_SERVER["PHP_SELF"]);
exit;
}
else
{
dol_print_error($db);
}
}
/*
* View
*/
$form=new Form($db);
llxHeader('',$langs->trans("PaypalSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal');
print '<br />';
$head=paypaladmin_prepare_head();
dol_fiche_head($head, 'import', $langs->trans("ModuleSetup"));
print '<table class="nobordernopadding" width="100%"><tr>';
print '<td>'.$langs->trans("PaypalTransactionDesc").'</td>';
print '<td align="right">'."\n";
if ($conf->use_javascript_ajax)
{
print ajax_constantonoff('PAYPAL_ENABLE_TRANSACTION_MANAGEMENT');
}
else
{
if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 0)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=set_PAYPAL_ENABLE_TRANSACTION_MANAGEMENT">'.img_picto($langs->trans("Disabled"),'off').'</a>';
}
else if($conf->global->PAYPAL_ENABLE_TRANSACTION_MANAGEMENT == 1)
{
print '<a href="'.$_SERVER['PHP_SELF'].'?action=del_PAYPAL_ENABLE_TRANSACTION_MANAGEMENT">'.img_picto($langs->trans("Enabled"),'on').'</a>';
}
}
print '</td></tr>';
print '</table>';
print '<br />';
print '<table class="nobordernopadding" width="100%">';
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").'</td>'."\n";
print '<td align="center" width="20">&nbsp;</td>';
print '<td align="center" width="100">'.$langs->trans("Value").'</td>'."\n";
print '</tr>';
print '</table>';
$db->close();
llxFooter('$Date$ - $Revision$');
?>

View File

@@ -25,6 +25,7 @@
*/ */
require("../../main.inc.php"); require("../../main.inc.php");
require_once(DOL_DOCUMENT_ROOT."/paypal/lib/paypal.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php"); require_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/lib/doleditor.class.php");
@@ -71,11 +72,16 @@ if ($_POST["action"] == 'setvalue' && $user->admin)
$form=new Form($db); $form=new Form($db);
llxHeader(); llxHeader('',$langs->trans("PaypalSetup"));
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>'; $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
print_fiche_titre($langs->trans("PaypalSetup"),$linkback,'setup'); print_fiche_titre(' - '.$langs->trans("ModuleSetup"),$linkback,'paypal_logo@paypal');
print '<br />';
$head=paypaladmin_prepare_head();
dol_fiche_head($head, 'paypalaccount', $langs->trans("ModuleSetup"));
print $langs->trans("PaypalDesc")."<br>\n"; print $langs->trans("PaypalDesc")."<br>\n";

View File

@@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2008-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 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
@@ -59,8 +59,6 @@ function llxFooterPaypal()
print "</html>\n"; print "</html>\n";
} }
/** /**
* Show footer of company in HTML pages * Show footer of company in HTML pages
* *
@@ -127,7 +125,29 @@ function html_print_paypal_footer($fromcompany,$langs)
print '</font></center>'."\n"; print '</font></center>'."\n";
} }
/**
* Define head array for tabs of paypal tools setup pages
* @return Array of head
*/
function paypaladmin_prepare_head()
{
global $langs;
$h = 0;
$head = array();
$head[$h][0] = DOL_URL_ROOT."/paypal/admin/paypal.php";
$head[$h][1] = $langs->trans("Account");
$head[$h][2] = 'paypalaccount';
$h++;
$head[$h][0] = DOL_URL_ROOT."/paypal/admin/import.php";
$head[$h][1] = $langs->trans("Import");
$head[$h][2] = 'import';
$h++;
return $head;
}
/** /**

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB