+ {include file="$tpl_dir./modules/blocksearch/blocksearch-top.tpl"} + {/if} +{/if} +{if isset($smarty.get.id_product) && $page_name == 'cart' && isset($errors) && $errors} + {include file="$tpl_dir./errors.tpl"} +{/if} \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/header.tpl b/modules/mobile_theme/prestashop_mobile/header.tpl new file mode 100755 index 00000000..bdc9d16d --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/header.tpl @@ -0,0 +1,67 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + {$meta_title|escape:'htmlall':'UTF-8'} +{if isset($meta_description) AND $meta_description} + +{/if} +{if isset($meta_keywords) AND $meta_keywords} + +{/if} + + + + + + +{if isset($css_files_mobile)} + {foreach from=$css_files_mobile key=css_uri item=media} + + {/foreach} +{/if} + +{if isset($translate_nopayment)}{$translate_nopayment}{/if} + +{if isset($js_files_mobile)} + {foreach from=$js_files_mobile item=js_uri} + + {/foreach} +{/if} + +{if isset($HOOK_HEADER_MOBILE)} + {$HOOK_HEADER_MOBILE} +{/if} + + + diff --git a/modules/mobile_theme/prestashop_mobile/history.tpl b/modules/mobile_theme/prestashop_mobile/history.tpl new file mode 100755 index 00000000..95523c2f --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/history.tpl @@ -0,0 +1,74 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{include file="$tpl_dir./header-page.tpl"} + +{capture name=path}{l s='My account'}{$navigationPipe}{l s='Order history'}{/capture} +{include file="$tpl_dir./breadcrumb.tpl"} +{include file="$tpl_dir./errors.tpl"} + +{if $slowValidation}

{l s='If you have just placed an order, it may take a few minutes for it to be validated. If your order does not appear please refresh the page.'}

{/if} + +{if $orders && count($orders)} +
    +
  • + + + + + + +
    {l s='Order'}{l s='Date'}{l s='Status'}
    +
  • +{foreach from=$orders item=order name=myLoop} +
  • + + + + + + + + + + + + +
    + {if isset($order.invoice) && $order.invoice && isset($order.virtual) && $order.virtual}{l s='Products to download'}{/if} + {l s='#'}{$order.id_order|string_format:"%06d"} + {dateFormat date=$order.date_add full=0}{if isset($order.order_state)}{$order.order_state|escape:'htmlall':'UTF-8'}{/if}
    {l s='Total:'} {displayPrice price=$order.total_paid_real currency=$order.id_currency no_utf8=false convert=false}
    {l s='Payment method:'} {$order.payment|escape:'htmlall':'UTF-8'} + {if (isset($order.invoice) && $order.invoice && isset($order.invoice_number) && $order.invoice_number) && isset($invoiceAllowed) && $invoiceAllowed == true} + - {l s='Invoice'} + {/if} +
    +
  • +{/foreach} +
+{else} +

{l s='You have not placed any orders.'}

+{/if} + +{include file="$tpl_dir./footer-page.tpl"} \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/identity.tpl b/modules/mobile_theme/prestashop_mobile/identity.tpl new file mode 100755 index 00000000..c00240ab --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/identity.tpl @@ -0,0 +1,148 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{include file="$tpl_dir./header-page.tpl"} + +{capture name=path}{l s='My account'}{$navigationPipe}{l s='Your personal information'}{/capture} +{include file="$tpl_dir./breadcrumb.tpl"} + + +{include file="$tpl_dir./errors.tpl"} + +{if isset($confirmation) && $confirmation} +
+ {l s='Your personal information has been successfully updated.'} + {if isset($pwd_changed)}
{l s='Your password has been sent to your e-mail:'} {$email|escape:'htmlall':'UTF-8'}{/if} +
+{else} +

{l s='Please do not hesitate to update your personal information if it has changed.'}

+ + +
+
+ + +
+
+ {l s='Title'} + + + + +
+
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +{* The following lines allow translations in back-office and has to stay commented + + {l s='Monday'} + {l s='Tuesday'} + {l s='Wednesday'} + {l s='Thursday'} + {l s='Friday'} + {l s='Saturday'} + {l s='Sunday'} +*} + + +
+
+ {l s='Date of Birth'} + + + + + + + + + +
+
+ + {if isset($newsletter) && $newsletter} +
+
+ + + + + +
+
+ {/if} + + + *{l s='Required field'} +
+
+{/if} + +{include file="$tpl_dir./footer-page.tpl"} \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/img/pagination-bg-current.gif b/modules/mobile_theme/prestashop_mobile/img/pagination-bg-current.gif new file mode 100755 index 00000000..210590a2 Binary files /dev/null and b/modules/mobile_theme/prestashop_mobile/img/pagination-bg-current.gif differ diff --git a/modules/mobile_theme/prestashop_mobile/img/pagination-next-border.gif b/modules/mobile_theme/prestashop_mobile/img/pagination-next-border.gif new file mode 100755 index 00000000..275f9ad3 Binary files /dev/null and b/modules/mobile_theme/prestashop_mobile/img/pagination-next-border.gif differ diff --git a/modules/mobile_theme/prestashop_mobile/img/pagination-prev-border.gif b/modules/mobile_theme/prestashop_mobile/img/pagination-prev-border.gif new file mode 100755 index 00000000..903d7afa Binary files /dev/null and b/modules/mobile_theme/prestashop_mobile/img/pagination-prev-border.gif differ diff --git a/modules/mobile_theme/prestashop_mobile/img/pagination-prevnext-bg.gif b/modules/mobile_theme/prestashop_mobile/img/pagination-prevnext-bg.gif new file mode 100755 index 00000000..d1444845 Binary files /dev/null and b/modules/mobile_theme/prestashop_mobile/img/pagination-prevnext-bg.gif differ diff --git a/modules/mobile_theme/prestashop_mobile/img/pagination_bg.gif b/modules/mobile_theme/prestashop_mobile/img/pagination_bg.gif new file mode 100755 index 00000000..824748ea Binary files /dev/null and b/modules/mobile_theme/prestashop_mobile/img/pagination_bg.gif differ diff --git a/modules/mobile_theme/prestashop_mobile/index.tpl b/modules/mobile_theme/prestashop_mobile/index.tpl new file mode 100755 index 00000000..f20966b5 --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/index.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{include file="$tpl_dir./header-page.tpl"} + +{include file="$tpl_dir./modules/homefeatured/homefeatured.tpl"} +{include file="$tpl_dir./modules/blockcategories/blockcategories.tpl"} + +
+ +
+{include file="$tpl_dir./footer-page.tpl"} \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/js/cms.js b/modules/mobile_theme/prestashop_mobile/js/cms.js new file mode 100755 index 00000000..43e75bcb --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/js/cms.js @@ -0,0 +1,40 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function submitPublishCMS(url, redirect) +{ + var id_cms = $('#admin-action-cms-id').val(); + + $.ajaxSetup({async: false}); + $.post(url+'/ajax.php', { submitPublishCMS: '1', id_cms: id_cms, status: 1, redirect: redirect }, + function(data) + { + if (data.indexOf('error') === -1) + document.location.href = data; + } + ); + + return true; +} \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/js/global.js b/modules/mobile_theme/prestashop_mobile/js/global.js new file mode 100755 index 00000000..54f27672 --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/js/global.js @@ -0,0 +1,64 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function jqm_change_currency(id_currency, url) +{ + $.ajax({ + type: 'POST', + headers: { "cache-control": "no-cache" }, + url: baseDir + 'changecurrency.php' + '?rand=' + new Date().getTime(), + data: 'id_currency=' + parseInt(id_currency), + success: function(msg) + { + location.replace(url); + } + }); +} + +function jqm_toggle_search_bar() { + $('.jqm_search_block_top').toggle(); +} + +$('#jqm_page_authentication_login').live('pageshow', function() { + $('.link_page_authenticate_login').addClass('ui-btn-active'); + $('.link_page_authenticate_register').removeClass('ui-btn-active'); +}); + +$('#jqm_page_authentication_register').live('pageshow', function() { + $('.link_page_authenticate_login').removeClass('ui-btn-active'); + $('.link_page_authenticate_register').addClass('ui-btn-active'); +}); + +$('#jqm_page_order').live('pageshow', function() { + $('#payment_paypal_express_checkout').click(function() { $('#paypal_payment_form').submit(); }); +}); + +$(document).bind('pageshow', function() { + $('form').attr('data-ajax', 'false'); + $('#HOOK_PAYMENT a').attr('data-ajax', 'false'); +}); + +$('#jqm_page_p404, #jqm_page_index').live('pageshow', jqm_toggle_search_bar); \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/js/jquery.min.js b/modules/mobile_theme/prestashop_mobile/js/jquery.min.js new file mode 100755 index 00000000..16ad06c5 --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/js/jquery.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.2 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cu(a){if(!cj[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),b.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write((f.support.boxModel?"":"")+""),cl.close();d=cl.createElement(a),cl.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ck)}cj[a]=e}return cj[a]}function ct(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function cs(){cq=b}function cr(){setTimeout(cs,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;e=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?+d:j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a!=null&&a==a.window},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){if(typeof c!="string"||!c)return null;var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=p.getElementsByTagName("*"),e=p.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=p.getElementsByTagName("input")[0],b={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:p.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},f.boxModel=b.boxModel=c.compatMode==="CSS1Compat",i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete p.test}catch(r){b.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",function(){b.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),i.setAttribute("name","t"),p.appendChild(i),j=c.createDocumentFragment(),j.appendChild(p.lastChild),b.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,j.removeChild(i),j.appendChild(p);if(p.attachEvent)for(n in{submit:1,change:1,focusin:1})m="on"+n,o=m in p,o||(p.setAttribute(m,"return;"),o=typeof p[m]=="function"),b[n+"Bubbles"]=o;j.removeChild(p),j=g=h=p=i=null,f(function(){var d,e,g,h,i,j,l,m,n,q,r,s,t,u=c.getElementsByTagName("body")[0];!u||(m=1,t="padding:0;margin:0;border:",r="position:absolute;top:0;left:0;width:1px;height:1px;",s=t+"0;visibility:hidden;",n="style='"+r+t+"5px solid #000;",q="
"+""+"
",d=c.createElement("div"),d.style.cssText=s+"width:0;height:0;position:static;top:0;margin-top:"+m+"px",u.insertBefore(d,u.firstChild),p=c.createElement("div"),d.appendChild(p),p.innerHTML="
t
",k=p.getElementsByTagName("td"),o=k[0].offsetHeight===0,k[0].style.display="",k[1].style.display="none",b.reliableHiddenOffsets=o&&k[0].offsetHeight===0,a.getComputedStyle&&(p.innerHTML="",l=c.createElement("div"),l.style.width="0",l.style.marginRight="0",p.style.width="2px",p.appendChild(l),b.reliableMarginRight=(parseInt((a.getComputedStyle(l,null)||{marginRight:0}).marginRight,10)||0)===0),typeof p.style.zoom!="undefined"&&(p.innerHTML="",p.style.width=p.style.padding="1px",p.style.border=0,p.style.overflow="hidden",p.style.display="inline",p.style.zoom=1,b.inlineBlockNeedsLayout=p.offsetWidth===3,p.style.display="block",p.style.overflow="visible",p.innerHTML="
",b.shrinkWrapBlocks=p.offsetWidth!==3),p.style.cssText=r+s,p.innerHTML=q,e=p.firstChild,g=e.firstChild,i=e.nextSibling.firstChild.firstChild,j={doesNotAddBorder:g.offsetTop!==5,doesAddBorderForTableAndCells:i.offsetTop===5},g.style.position="fixed",g.style.top="20px",j.fixedPosition=g.offsetTop===20||g.offsetTop===15,g.style.position=g.style.top="",e.style.overflow="hidden",e.style.position="relative",j.subtractsBorderForOverflowNotVisible=g.offsetTop===-5,j.doesNotIncludeMarginInBodyOffset=u.offsetTop!==m,a.getComputedStyle&&(p.style.marginTop="1%",b.pixelMargin=(a.getComputedStyle(p,null)||{marginTop:0}).marginTop!=="1%"),typeof d.style.zoom!="undefined"&&(d.style.zoom=1),u.removeChild(d),l=p=d=null,f.extend(b,j))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e1,null,!1)},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,b){a&&(b=(b||"fx")+"mark",f._data(a,b,(f._data(a,b)||0)+1))},_unmark:function(a,b,c){a!==!0&&(c=b,b=a,a=!1);if(b){c=c||"fx";var d=c+"mark",e=a?0:(f._data(b,d)||1)-1;e?f._data(b,d,e):(f.removeData(b,d,!0),n(b,c,"mark"))}},queue:function(a,b,c){var d;if(a){b=(b||"fx")+"queue",d=f._data(a,b),c&&(!d||f.isArray(c)?d=f._data(a,b,f.makeArray(c)):d.push(c));return d||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e={};d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),f._data(a,b+".run",e),d.call(a,function(){f.dequeue(a,b)},e)),c.length||(f.removeData(a,b+"queue "+b+".run",!0),n(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){var d=2;typeof a!="string"&&(c=a,a="fx",d--);if(arguments.length1)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,f.prop,a,b,arguments.length>1)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(p);for(c=0,d=this.length;c-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.type]||f.valHooks[this.nodeName.toLowerCase()];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.type]||f.valHooks[g.nodeName.toLowerCase()];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h,i=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;i=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/(?:^|\s)hover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function( +a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")};f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler,g=p.selector),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&j.push({elem:this,matches:d.slice(e)});for(k=0;k0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));o.match.globalPOS=p;var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/]","i"),bd=/checked\s*(?:[^=]|=\s*.checked.)/i,be=/\/(java|ecma)script/i,bf=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){return f.access(this,function(a){return a===b?f.text(this):this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a))},null,a,arguments.length)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f +.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){return f.access(this,function(a){var c=this[0]||{},d=0,e=this.length;if(a===b)return c.nodeType===1?c.innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(;d1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||f.isXMLDoc(a)||!bc.test("<"+a.nodeName+">")?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g,h,i,j=[];b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);for(var k=0,l;(l=a[k])!=null;k++){typeof l=="number"&&(l+="");if(!l)continue;if(typeof l=="string")if(!_.test(l))l=b.createTextNode(l);else{l=l.replace(Y,"<$1>");var m=(Z.exec(l)||["",""])[1].toLowerCase(),n=bg[m]||bg._default,o=n[0],p=b.createElement("div"),q=bh.childNodes,r;b===c?bh.appendChild(p):U(b).appendChild(p),p.innerHTML=n[1]+l+n[2];while(o--)p=p.lastChild;if(!f.support.tbody){var s=$.test(l),t=m==="table"&&!s?p.firstChild&&p.firstChild.childNodes:n[1]===""&&!s?p.childNodes:[];for(i=t.length-1;i>=0;--i)f.nodeName(t[i],"tbody")&&!t[i].childNodes.length&&t[i].parentNode.removeChild(t[i])}!f.support.leadingWhitespace&&X.test(l)&&p.insertBefore(b.createTextNode(X.exec(l)[0]),p.firstChild),l=p.childNodes,p&&(p.parentNode.removeChild(p),q.length>0&&(r=q[q.length-1],r&&r.parentNode&&r.parentNode.removeChild(r)))}var u;if(!f.support.appendChecked)if(l[0]&&typeof (u=l.length)=="number")for(i=0;i1)},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=by(a,"opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=bu.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(by)return by(a,c)},swap:function(a,b,c){var d={},e,f;for(f in b)d[f]=a.style[f],a.style[f]=b[f];e=c.call(a);for(f in b)a.style[f]=d[f];return e}}),f.curCSS=f.css,c.defaultView&&c.defaultView.getComputedStyle&&(bz=function(a,b){var c,d,e,g,h=a.style;b=b.replace(br,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b))),!f.support.pixelMargin&&e&&bv.test(b)&&bt.test(c)&&(g=h.width,h.width=c,c=e.width,h.width=g);return c}),c.documentElement.currentStyle&&(bA=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f==null&&g&&(e=g[b])&&(f=e),bt.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),by=bz||bA,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){if(c)return a.offsetWidth!==0?bB(a,b,d):f.swap(a,bw,function(){return bB(a,b,d)})},set:function(a,b){return bs.test(b)?b+"px":b}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bq.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bp,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bp.test(g)?g.replace(bp,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){return f.swap(a,{display:"inline-block"},function(){return b?by(a,"margin-right"):a.style.marginRight})}})}),f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)}),f.each({margin:"",padding:"",border:"Width"},function(a,b){f.cssHooks[a+b]={expand:function(c){var d,e=typeof c=="string"?c.split(" "):[c],f={};for(d=0;d<4;d++)f[a+bx[d]+b]=e[d]||e[d-2]||e[0];return f}}});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV,bW=["*/"]+["*"];try{bU=e.href}catch(bX){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b$(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b$(a,b);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bW},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bY(bS),ajaxTransport:bY(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?ca(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cb(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bZ(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bW+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bZ(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=typeof b.data=="string"&&/^application\/x\-www\-form\-urlencoded/.test(b.contentType);if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n);try{m.text=h.responseText}catch(a){}try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(ct("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(a,c){var d=/Y/.test(c);f.fn[a]=function(e){return f.access(this,function(a,e,g){var h=cy(a);if(g===b)return h?c in h?h[c]:f.support.boxModel&&h.document.documentElement[e]||h.document.body[e]:a[e];h?h.scrollTo(d?f(h).scrollLeft():g,d?g:f(h).scrollTop()):a[e]=g},a,e,arguments.length,null)}}),f.each({Height:"height",Width:"width"},function(a,c){var d="client"+a,e="scroll"+a,g="offset"+a;f.fn["inner"+a]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,c,"padding")):this[c]():null},f.fn["outer"+a]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,c,a?"margin":"border")):this[c]():null},f.fn[c]=function(a){return f.access(this,function(a,c,h){var i,j,k,l;if(f.isWindow(a)){i=a.document,j=i.documentElement[d];return f.support.boxModel&&j||i.body&&i.body[d]||j}if(a.nodeType===9){i=a.documentElement;if(i[d]>=i[e])return i[d];return Math.max(a.body[e],i[e],a.body[g],i[g])}if(h===b){k=f.css(a,c),l=parseFloat(k);return f.isNumeric(l)?l:k}f(a).css(c,h)},c,a,arguments.length,null)}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); \ No newline at end of file diff --git a/modules/mobile_theme/prestashop_mobile/js/jquery.mobile.min.js b/modules/mobile_theme/prestashop_mobile/js/jquery.mobile.min.js new file mode 100755 index 00000000..16ebb5f4 --- /dev/null +++ b/modules/mobile_theme/prestashop_mobile/js/jquery.mobile.min.js @@ -0,0 +1,2 @@ +/*! jQuery Mobile vGit Build: SHA1: cc5e61cd05507694745978822e1cf22ebbd0d61b <> Date: Tue Sep 4 15:35:37 2012 -0700 jquerymobile.com | jquery.org/license !*/ +(function(a,b,c){typeof define=="function"&&define.amd?define(["jquery"],function(d){return c(d,a,b),d.mobile}):c(a.jQuery,a,b)})(this,document,function(a,b,c,d){(function(a,b,d){var e={};a.mobile=a.extend({},{version:"1.2.0-beta.1",ns:"",subPageUrlKey:"ui-page",activePageClass:"ui-page-active",activeBtnClass:"ui-btn-active",focusClass:"ui-focus",ajaxEnabled:!0,hashListeningEnabled:!0,linkBindingEnabled:!0,defaultPageTransition:"fade",maxTransitionWidth:!1,minScrollBack:250,touchOverflowEnabled:!1,defaultDialogTransition:"pop",pageLoadErrorMessage:"Error Loading Page",pageLoadErrorMessageTheme:"e",autoInitializePage:!0,pushStateEnabled:!0,ignoreContentEnabled:!1,orientationChangeEnabled:!0,buttonMarkup:{hoverDelay:200},keyCode:{ALT:18,BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},silentScroll:function(d){a.type(d)!=="number"&&(d=a.mobile.defaultHomeScroll),a.event.special.scrollstart.enabled=!1,setTimeout(function(){b.scrollTo(0,d),a(c).trigger("silentscroll",{x:0,y:d})},20),setTimeout(function(){a.event.special.scrollstart.enabled=!0},150)},nsNormalizeDict:e,nsNormalize:function(b){if(!b)return;return e[b]||(e[b]=a.camelCase(a.mobile.ns+b))},getInheritedTheme:function(a,b){var c=a[0],d="",e=/ui-(bar|body|overlay)-([a-z])\b/,f,g;while(c){f=c.className||"";if(f&&(g=e.exec(f))&&(d=g[2]))break;c=c.parentNode}return d||b||"a"},closestPageData:function(a){return a.closest(':jqmData(role="page"), :jqmData(role="dialog")').data("page")},enhanceable:function(a){return this.haveParents(a,"enhance")},hijackable:function(a){return this.haveParents(a,"ajax")},haveParents:function(b,c){if(!a.mobile.ignoreContentEnabled)return b;var d=b.length,e=a(),f,g,h;for(var i=0;i").text(a(this).text()).html()},a.fn.jqmEnhanceable=function(){return a.mobile.enhanceable(this)},a.fn.jqmHijackable=function(){return a.mobile.hijackable(this)};var f=a.find,g=/:jqmData\(([^)]*)\)/g;a.find=function(b,c,d,e){return b=b.replace(g,"[data-"+(a.mobile.ns||"")+"$1]"),f.call(this,b,c,d,e)},a.extend(a.find,f),a.find.matches=function(b,c){return a.find(b,null,null,c)},a.find.matchesSelector=function(b,c){return a.find(c,null,null,[b]).length>0}})(a,this),function(a,b){var c=0,d=Array.prototype.slice,e=a.cleanData;a.cleanData=function(b){for(var c=0,d;(d=b[c])!=null;c++)try{a(d).triggerHandler("remove")}catch(f){}e(b)},a.widget=function(b,c,d){var e,f,g,h,i=b.split(".")[0];b=b.split(".")[1],e=i+"-"+b,d||(d=c,c=a.Widget),a.expr[":"][e]=function(b){return!!a.data(b,e)},a[i]=a[i]||{},f=a[i][b],g=a[i][b]=function(a,b){if(!this._createWidget)return new g(a,b);arguments.length&&this._createWidget(a,b)},a.extend(g,f,{version:d.version,_proto:a.extend({},d),_childConstructors:[]}),h=new c,h.options=a.widget.extend({},h.options),a.each(d,function(b,e){a.isFunction(e)&&(d[b]=function(){var a=function(){return c.prototype[b].apply(this,arguments)},d=function(a){return c.prototype[b].apply(this,a)};return function(){var b=this._super,c=this._superApply,f;return this._super=a,this._superApply=d,f=e.apply(this,arguments),this._super=b,this._superApply=c,f}}())}),g.prototype=a.widget.extend(h,{widgetEventPrefix:b},d,{constructor:g,namespace:i,widgetName:b,widgetBaseClass:e,widgetFullName:e}),f?(a.each(f._childConstructors,function(b,c){var d=c.prototype;a.widget(d.namespace+"."+d.widgetName,g,c._proto)}),delete f._childConstructors):c._childConstructors.push(g),a.widget.bridge(b,g)},a.widget.extend=function(c){var e=d.call(arguments,1),f=0,g=e.length,h,i;for(;f",options:{disabled:!1,create:null},_createWidget:function(b,d){d=a(d||this.defaultElement||this)[0],this.element=a(d),this.uuid=c++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=a.widget.extend({},this.options,this._getCreateOptions(),b),this.bindings=a(),this.hoverable=a(),this.focusable=a(),d!==this&&(a.data(d,this.widgetName,this),a.data(d,this.widgetFullName,this),this._on({remove:"destroy"}),this.document=a(d.style?d.ownerDocument:d.document||d),this.window=a(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:a.noop,_getCreateEventData:a.noop,_create:a.noop,_init:a.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(a.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:a.noop,widget:function(){return this.element},option:function(c,d){var e=c,f,g,h;if(arguments.length===0)return a.widget.extend({},this.options);if(typeof c=="string"){e={},f=c.split("."),c=f.shift();if(f.length){g=e[c]=a.widget.extend({},this.options[c]);for(h=0;h"+""+"

"+"
",fakeFixLoader:function(){var b=a("."+a.mobile.activeBtnClass).first();this.element.css({top:a.support.scrollTop&&f.scrollTop()+f.height()/2||b.length&&b.offset().top||100})},checkLoaderPosition:function(){var b=this.element.offset(),c=f.scrollTop(),d=a.mobile.getScreenHeight();if(b.topd)this.element.addClass("ui-loader-fakefix"),this.fakeFixLoader(),f.unbind("scroll",this.checkLoaderPosition).bind("scroll",this.fakeFixLoader)},resetHtml:function(){this.element.html(a(this.defaultHtml).html())},show:function(b,g,h){var i,j,k,l;this.resetHtml(),a.type(b)==="object"?(l=a.extend({},this.options,b),b=l.theme||a.mobile.loadingMessageTheme):(l=this.options,b=b||a.mobile.loadingMessageTheme||l.theme),j=g||a.mobile.loadingMessage||l.text,e.addClass("ui-loading");if(a.mobile.loadingMessage!==!1||l.html)a.mobile.loadingMessageTextVisible!==d?i=a.mobile.loadingMessageTextVisible:i=l.textVisible,this.element.attr("class",c+" ui-corner-all ui-body-"+b+" ui-loader-"+(i||g||b.text?"verbose":"default")+(l.textonly||h?" ui-loader-textonly":"")),l.html?this.element.html(l.html):this.element.find("h1").text(j),this.element.appendTo(a.mobile.pageContainer),this.checkLoaderPosition(),f.bind("scroll",a.proxy(this.checkLoaderPosition,this))},hide:function(){e.removeClass("ui-loading"),a.mobile.loadingMessage&&this.element.removeClass("ui-loader-fakefix"),a(b).unbind("scroll",a.proxy(this.fakeFixLoader,this)),a(b).unbind("scroll",a.proxy(this.checkLoaderPosition,this))}}),f.bind("pagecontainercreate",function(){a.mobile.loaderWidget=a.mobile.loaderWidget||a(a.mobile.loader.prototype.defaultHtml).loader()})}(a,this),function(a,b,c,d){function x(a){while(a&&typeof a.originalEvent!="undefined")a=a.originalEvent;return a}function y(b,c){var e=b.type,f,g,i,k,l,m,n,o,p;b=a.Event(b),b.type=c,f=b.originalEvent,g=a.event.props,e.search(/^(mouse|click)/)>-1&&(g=j);if(f)for(n=g.length,k;n;)k=g[--n],b[k]=f[k];e.search(/mouse(down|up)|click/)>-1&&!b.which&&(b.which=1);if(e.search(/^touch/)!==-1){i=x(f),e=i.touches,l=i.changedTouches,m=e&&e.length?e[0]:l&&l.length?l[0]:d;if(m)for(o=0,p=h.length;oe||Math.abs(c.pageY-n)>e,o&&!d&&H("vmousecancel",b,f),H("vmousemove",b,f),F()}function M(a){if(r)return;C();var b=z(a.target),c;H("vmouseup",a,b);if(!o){var d=H("vclick",a,b);d&&d.isDefaultPrevented()&&(c=x(a).changedTouches[0],p.push({touchID:v,x:c.clientX,y:c.clientY}),q=!0)}H("vmouseout",a,b),o=!1,F()}function N(b){var c=a.data(b,e),d;if(c)for(d in c)if(c[d])return!0;return!1}function O(){}function P(b){var c=b.substr(1);return{setup:function(d,f){N(this)||a.data(this,e,{});var g=a.data(this,e);g[b]=!0,k[b]=(k[b]||0)+1,k[b]===1&&t.bind(c,I),a(this).bind(c,O),s&&(k.touchstart=(k.touchstart||0)+1,k.touchstart===1&&t.bind("touchstart",J).bind("touchend",M).bind("touchmove",L).bind("scroll",K))},teardown:function(d,f){--k[b],k[b]||t.unbind(c,I),s&&(--k.touchstart,k.touchstart||t.unbind("touchstart",J).unbind("touchmove",L).unbind("touchend",M).unbind("scroll",K));var g=a(this),h=a.data(this,e);h&&(h[b]=!1),g.unbind(c,O),N(this)||g.removeData(e)}}}var e="virtualMouseBindings",f="virtualTouchID",g="vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split(" "),h="clientX clientY pageX pageY screenX screenY".split(" "),i=a.event.mouseHooks?a.event.mouseHooks.props:[],j=a.event.props.concat(i),k={},l=0,m=0,n=0,o=!1,p=[],q=!1,r=!1,s="addEventListener"in c,t=a(c),u=1,v=0,w;a.vmouse={moveDistanceThreshold:10,clickDistanceThreshold:10,resetTimerDuration:1500};for(var Q=0;Qa.event.special.swipe.scrollSupressionThreshold&&b.preventDefault()}var e=b.originalEvent.touches?b.originalEvent.touches[0]:b,f={time:(new Date).getTime(),coords:[e.pageX,e.pageY],origin:a(b.target)},g;c.bind(i,j).one(h,function(b){c.unbind(i,j),f&&g&&g.time-f.timea.event.special.swipe.horizontalDistanceThreshold&&Math.abs(f.coords[1]-g.coords[1])g.coords[0]?"swipeleft":"swiperight"),f=g=d})})}},a.each({scrollstop:"scrollstart",taphold:"tap",swipeleft:"swipe",swiperight:"swipe"},function(b,c){a.event.special[b]={setup:function(){a(this).bind(c,a.noop)}}})}(a,this),function(a,c){a.extend(a.support,{orientation:"orientation"in b&&"onorientationchange"in b})}(a),function(a){a.event.special.throttledresize={setup:function(){a(this).bind("resize",c)},teardown:function(){a(this).unbind("resize",c)}};var b=250,c=function(){f=(new Date).getTime(),g=f-d,g>=b?(d=f,a(this).trigger("throttledresize")):(e&&clearTimeout(e),e=setTimeout(c,b-g))},d=0,e,f,g}(a),function(a,b){function o(){var a=g();a!==h&&(h=a,d.trigger(e))}var d=a(b),e="orientationchange",f,g,h,i,j,k={0:!0,180:!0};if(a.support.orientation){var l=b.innerWidth||a(b).width(),m=b.innerHeight||a(b).height(),n=50;i=l>m&&l-m>n,j=k[b.orientation];if(i&&j||!i&&!j)k={"-90":!0,90:!0}}a.event.special.orientationchange=a.extend({},a.event.special.orientationchange,{setup:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;h=g(),d.bind("throttledresize",o)},teardown:function(){if(a.support.orientation&&!a.event.special.orientationchange.disabled)return!1;d.unbind("throttledresize",o)},add:function(a){var b=a.handler;a.handler=function(a){return a.orientation=g(),b.apply(this,arguments)}}}),a.event.special.orientationchange.orientation=g=function(){var d=!0,e=c.documentElement;return a.support.orientation?d=k[b.orientation]:d=e&&e.clientWidth/e.clientHeight<1.1,d?"portrait":"landscape"},a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.attrFn&&(a.attrFn[e]=!0)}(a,this),function(a,d){var e=a(b),f=a("html");a.mobile.media=function(){var b={},d=a("
"),e=a("").append(d);return function(a){if(!(a in b)){var g=c.createElement("style"),h="@media "+a+" { #jquery-mediatest { position:absolute; } }";g.type="text/css",g.styleSheet?g.styleSheet.cssText=h:g.appendChild(c.createTextNode(h)),f.prepend(e).prepend(g),b[a]=d.css("position")==="absolute",e.add(g).remove()}return b[a]}}()}(a),function(a,d){function l(a){var b=a.charAt(0).toUpperCase()+a.substr(1),c=(a+" "+g.join(b+" ")+b).split(" ");for(var e in c)if(f[c[e]]!==d)return!0}function m(a,b,d){var e=c.createElement("div"),f=function(a){return a.charAt(0).toUpperCase()+a.substr(1)},h=function(a){return"-"+a.charAt(0).toLowerCase()+a.substr(1)+"-"},i=function(c){var d=h(c)+a+": "+b+";",g=f(c),i=g+f(a);e.setAttribute("style",d),!e.style[i]||(k=!0)},j=d?[d]:g,k;for(var l=0;l",{href:b}).appendTo("head"),g=a("").prependTo(e),h=g[0].href,c[0].href=f||location.pathname,d&&d.remove(),h.indexOf(b)===0}function p(){var a=c.createElement("x"),d=c.documentElement,e=b.getComputedStyle,f;return"pointerEvents"in a.style?(a.style.pointerEvents="auto",a.style.pointerEvents="x",d.appendChild(a),f=e&&e(a,"").pointerEvents==="auto",d.removeChild(a),!!f):!1}var e=a("").prependTo("html"),f=e[0].style,g=["Webkit","Moz","O"],h="palmGetResource"in b,i=b.opera,j=b.operamini&&{}.toString.call(b.operamini)==="[object OperaMini]",k=b.blackberry;a.extend(a.mobile,{browser:{}}),a.mobile.browser.ie=function(){var a=3,b=c.createElement("div"),d=b.all||[];do b.innerHTML="";while(d[0]);return a>4?a:!a}(),a.extend(a.support,{cssTransitions:"WebKitTransitionEvent"in b||m("transition","height 100ms linear")&&!i,pushState:"pushState"in history&&"replaceState"in history,mediaquery:a.mobile.media("only all"),cssPseudoElement:!!l("content"),touchOverflow:!!l("overflowScrolling"),cssTransform3d:n(),boxShadow:!!l("boxShadow")&&!k,scrollTop:("pageXOffset"in b||"scrollTop"in c.documentElement||"scrollTop"in e[0])&&!h&&!j,dynamicBaseTag:o(),cssPointerEvents:p()}),e.remove();var q=function(){var a=b.navigator.userAgent;return a.indexOf("Nokia")>-1&&(a.indexOf("Symbian/3")>-1||a.indexOf("Series60/5")>-1)&&a.indexOf("AppleWebKit")>-1&&a.match(/(BrowserNG|NokiaBrowser)\/7\.[0-3]/)}();a.mobile.gradeA=function(){return a.support.mediaquery||a.mobile.browser.ie&&a.mobile.browser.ie>=7},a.mobile.ajaxBlacklist=b.blackberry&&!b.WebKitPoint||j||q,q&&a(function(){a("head link[rel='stylesheet']").attr("rel","alternate stylesheet").attr("rel","stylesheet")}),a.support.boxShadow||a("html").addClass("ui-mobile-nosupport-boxshadow")}(a),function(a,b){a.widget("mobile.page",a.mobile.widget,{options:{theme:"c",domCache:!1,keepNativeDefault:":jqmData(role='none'), :jqmData(role='nojs')"},_create:function(){var a=this;if(a._trigger("beforecreate")===!1)return!1;a.element.attr("tabindex","0").addClass("ui-page ui-body-"+a.options.theme).bind("pagebeforehide",function(){a.removeContainerBackground()}).bind("pagebeforeshow",function(){a.setContainerBackground()})},removeContainerBackground:function(){a.mobile.pageContainer.removeClass("ui-overlay-"+a.mobile.getInheritedTheme(this.element.parent()))},setContainerBackground:function(b){this.options.theme&&a.mobile.pageContainer.addClass("ui-overlay-"+(b||this.options.theme))},keepNativeSelector:function(){var b=this.options,c=b.keepNative&&a.trim(b.keepNative);return c&&b.keepNative!==b.keepNativeDefault?[b.keepNative,b.keepNativeDefault].join(", "):b.keepNativeDefault}})}(a),function(a,b,d){function k(a){return a=a||location.href,"#"+a.replace(/^[^#]*#?(.*)$/,"$1")}var e="hashchange",f=c,g,h=a.event.special,i=f.documentMode,j="on"+e in b&&(i===d||i>7);a.fn[e]=function(a){return a?this.bind(e,a):this.trigger(e)},a.fn[e].delay=50,h[e]=a.extend(h[e],{setup:function(){if(j)return!1;a(g.start)},teardown:function(){if(j)return!1;a(g.stop)}}),g=function(){function n(){var c=k(),d=m(h);c!==h?(l(h=c,d),a(b).trigger(e)):d!==h&&(location.href=location.href.replace(/#.*/,"")+d),g=setTimeout(n,a.fn[e].delay)}var c={},g,h=k(),i=function(a){return a},l=i,m=i;return c.start=function(){g||n()},c.stop=function(){g&&clearTimeout(g),g=d},a.browser.msie&&!j&&function(){var b,d;c.start=function(){b||(d=a.fn[e].src,d=d&&d+k(),b=a(' +

+ + + {else} +
+ + {/if} +{/if} + + + + + + + + + + + + + + {if ($billing_address->id_state != 0)} + + {/if} + + + + + + + + + {if ($delivery_address->id_state != 0)} + + {/if} + + + + + + + + + + + + + + + + + + + + + + +{if $payment_hss_solution == $smarty.const.PAYPAL_HSS_IFRAME} +{literal} + +{/literal} +{/if} diff --git a/modules/paypal/views/templates/hook/paypal.js b/modules/paypal/views/templates/hook/paypal.js new file mode 100755 index 00000000..e449f4e8 --- /dev/null +++ b/modules/paypal/views/templates/hook/paypal.js @@ -0,0 +1,138 @@ +{literal} + +$(document).ready( function() { + + $('#payment_paypal_express_checkout').click(function() { + $('#paypal_payment_form').submit(); + return false; + }); + + $('#paypal_payment_form').live('submit', function() { + var nb = $('#quantity_wanted').val(); + var id = $('#idCombination').val(); + + $('#paypal_payment_form input[name=quantity]').val(nb); + $('#paypal_payment_form input[name=id_p_attr]').val(id); + }); + + function displayExpressCheckoutShortcut() { + var id_product = $('input[name="id_product"]').val(); + var id_product_attribute = $('input[name="id_product_attribute"]').val(); + + $.ajax({ + type: "GET", + url: baseDir+'/modules/paypal/express_checkout/ajax.php', + data: { get_qty: "1", id_product: id_product, id_product_attribute: id_product_attribute }, + cache: false, + success: function(result) { + if (result == '1') { + $('#container_express_checkout').slideDown(); + } else { + $('#container_express_checkout').slideUp(); + } + return true; + } + }); + } + + $('select[name^="group_"]').change(function () { + displayExpressCheckoutShortcut(); + }); + + $('.color_pick').click(function () { + displayExpressCheckoutShortcut(); + }); + + {/literal} + {if isset($paypal_authorization)} + {literal} + + /* 1.5 One page checkout*/ + var qty = $('.qty-field.cart_quantity_input').val(); + $('.qty-field.cart_quantity_input').after(qty); + $('.qty-field.cart_quantity_input, .cart_total_bar, .cart_quantity_delete, #cart_voucher *').remove(); + + var br = $('.cart > a').prev(); + br.prev().remove(); + br.remove(); + $('.cart.ui-content > a').remove(); + + var gift_fieldset = $('#gift_div').prev(); + var gift_title = gift_fieldset.prev(); + $('#gift_div, #gift_mobile_div').remove(); + gift_fieldset.remove(); + gift_title.remove(); + + {/literal} + {/if} + {if isset($paypal_confirmation)} + {literal} + + $('#container_express_checkout').hide(); + + $('#cgv').live('click', function() { + if ($('#cgv:checked').length != 0) + $(location).attr('href', '{/literal}{$paypal_confirmation}{literal}'); + }); + + // old jQuery compatibility + $('#cgv').click(function() { + if ($('#cgv:checked').length != 0) + $(location).attr('href', '{/literal}{$paypal_confirmation}{literal}'); + }); + + {/literal} + {else if isset($paypal_order_opc)} + {literal} + + $('#cgv').live('click', function() { + if ($('#cgv:checked').length != 0) + checkOrder(); + }); + + // old jQuery compatibility + $('#cgv').click(function() { + if ($('#cgv:checked').length != 0) + checkOrder(); + }); + + {/literal} + {/if} + {literal} + + var modulePath = 'modules/paypal'; + var subFolder = '/integral_evolution'; + var fullPath = baseDir + modulePath + subFolder; + var confirmTimer = false; + + if ($('form[target="hss_iframe"]').length == 0) { + if ($('select[name^="group_"]').length > 0) + displayExpressCheckoutShortcut(); + return false; + } else { + checkOrder(); + } + + function checkOrder() { + if(confirmTimer == false) + confirmTimer = setInterval(getOrdersCount, 1000); + } + + {/literal}{if isset($id_cart)}{literal} + function getOrdersCount() { + clearInterval(confirmTimer); + $.get( + fullPath + '/confirm.php', + { id_cart: '{/literal}{$id_cart}{literal}' }, + function (data) { + if ((typeof(data) != 'undefined') && (data > 0)) { + window.location.replace(fullPath + '/submit.php?id_cart={/literal}{$id_cart}{literal}'); + $('p.payment_module, p.cart_navigation').hide(); + } + } + ); + } + {/literal}{/if}{literal} +}); + +{/literal} diff --git a/modules/paypal/views/templates/index.php b/modules/paypal/views/templates/index.php new file mode 100755 index 00000000..236beedd --- /dev/null +++ b/modules/paypal/views/templates/index.php @@ -0,0 +1,35 @@ + +* @copyright 2007-2014 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/paysafecard/Disposition.php b/modules/paysafecard/Disposition.php new file mode 100755 index 00000000..7f805ff2 --- /dev/null +++ b/modules/paysafecard/Disposition.php @@ -0,0 +1,82 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7887 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +class PSCDisposition +{ + const TABLE_NAME = 'disposition'; + + public static function create($id_cart, $mtid, $amount, $currency) + { + return Db::getInstance()->Execute( + 'INSERT INTO `'._DB_PREFIX_.self::TABLE_NAME.'` (`id_cart`, `mtid`, `amount`, `currency`) + VALUES ('.(int)($id_cart).',\''.pSQL($mtid).'\','.(float)($amount).',\''.pSQL($currency).'\')'); + } + + public static function delete($id) + { + return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.self::TABLE_NAME.'` WHERE `id_disposition` = '.(int)($id)); + } + + public static function deleteByCartId($id_cart) + { + return Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.self::TABLE_NAME.'` WHERE `id_cart` = '.(int)($id_cart)); + } + + public static function getByCartId($id_cart) + { + return Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.self::TABLE_NAME.'` WHERE `id_cart` = '.(int)($id_cart)); + } + + public static function createTable() + { + return Db::getInstance()->Execute( + 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.self::TABLE_NAME.'` ( + `id_disposition` int(11) NOT NULL AUTO_INCREMENT, + `id_cart` int(11) NOT NULL, + `mtid` varchar(20) NOT NULL, + `amount` float NOT NULL, + `currency` varchar(3) NOT NULL, + PRIMARY KEY (`id_disposition`), + UNIQUE KEY `id_cart` (`id_cart`) + ) ENGINE = '._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8'); + } + + public static function dropTable() + { + return Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.self::TABLE_NAME.'`'); + } + + public static function updateAmount($id_disposition, $amount) + { + return Db::getInstance()->Execute( + 'UPDATE `'._DB_PREFIX_.self::TABLE_NAME.'` SET `amount` = `amount` - '.(float)($amount).' WHERE `id_disposition` = '.(int)($id_disposition)); + } + + +} + + diff --git a/modules/paysafecard/PrepaidServices.php b/modules/paysafecard/PrepaidServices.php new file mode 100755 index 00000000..35de708a --- /dev/null +++ b/modules/paysafecard/PrepaidServices.php @@ -0,0 +1,675 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8925 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +$module_name = 'paysafecard'; + +include(_PS_MODULE_DIR_.$module_name.'/Disposition.php'); +include(_PS_MODULE_DIR_.$module_name.'/PrepaidServicesAPI.php'); + +abstract class PSCPrepaidServices extends PaymentModule +{ + protected $max_amount = 1000; + protected $max_amount_currency = 'EUR'; + protected $default_language = 'en'; + + protected $prefix = ''; + + protected $environments = array('P' => 'Production', + 'T' => 'Test'); + + protected $business_types = array('I' => 'Intangible', + 'T' => 'Tangible'); + + // abstract + protected $supported_languages; + protected $allowed_currencies; + protected $supported_currencies; + protected $payment_url; + protected $prepaid_api_configuration; + protected $register_url; + + public function __construct() + { + parent::__construct(); + + if ($this->active AND !extension_loaded('curl')) + $this->warning = $this->getL('curl_required'); + } + + public function install() + { + $ps_ct_immediat_payment = Configuration::get($this->prefix.'IMMEDIAT_PAYMENT') ? Configuration::get($this->prefix.'IMMEDIAT_PAYMENT') : '1'; + $ps_ct_salt = Configuration::get($this->prefix.'SALT') ? Configuration::get($this->prefix.'SALT') : strtoupper(Tools::passwdGen(8)); + $ps_ct_business_type = Configuration::get($this->prefix.'BUSINESS_TYPE') ? Configuration::get($this->prefix.'BUSINESS_TYPE') : 'I'; + $ps_ct_environment = Configuration::get($this->prefix.'ENVIRONMENT') ? Configuration::get($this->prefix.'ENVIRONMENT') : 'T'; + + return parent::install() AND PSCDisposition::createTable() AND $this->_createOrderState() AND + $this->registerHook('payment') AND $this->registerHook('paymentReturn') AND $this->registerHook('adminOrder') + AND Configuration::updateValue($this->prefix.'IMMEDIAT_PAYMENT', $ps_ct_immediat_payment) + AND Configuration::updateValue($this->prefix.'SALT', $ps_ct_salt) + AND Configuration::updateValue($this->prefix.'BUSINESS_TYPE', $ps_ct_business_type) + AND Configuration::updateValue($this->prefix.'ENVIRONMENT', $ps_ct_environment); + } + + private function _createOrderState() + { + + if (Configuration::get($this->prefix.'ORDER_STATE_ID') && Configuration::get($this->prefix.'ORDER_STATE_PART_ID')) return true; + + // Awaiting payment + $os = new OrderState(); + $os->name = array('1' => 'Awaiting '.$this->displayName.' payment', + '2' => 'En attente du paiement par '.$this->displayName, + '3' => 'En espera de pago por '.$this->displayName); + + $os->invoice = false; + $os->color = 'lightblue'; + $os->logable = true; + + if ($os->save()) + { + Configuration::updateValue($this->prefix.'ORDER_STATE_ID', $os->id); + + copy(_PS_MODULE_DIR_.$this->name.'/logo.gif',_PS_IMG_DIR_.'os/'.$os->id.'.gif'); + } else + return false; + + // Partially paid + $os1 = new OrderState(); + $os1->name = array('1' => 'Partially paid by '.$this->displayName, + '2' => 'Payé partiellement via '.$this->displayName, + '3' => 'Pagado parcialmente con '.$this->displayName); + + $os1->invoice = false; + $os1->color = 'lightblue'; + $os1->logable = true; + + if ($os1->save()) + { + Configuration::updateValue($this->prefix.'ORDER_STATE_PART_ID', $os1->id); + copy(_PS_MODULE_DIR_.$this->name.'/logo.gif',_PS_IMG_DIR_.'os/'.$os1->id.'.gif'); + return true; + } + + return false; + } + + private function _deleteOrderState() + { + DB::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'order_state` WHERE `id_order_state` = '.(int)(Configuration::get($this->prefix.'ORDER_STATE_ID'))); + DB::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'order_state_lang` WHERE `id_order_state` = '.(int)(Configuration::get($this->prefix.'ORDER_STATE_ID'))); + + DB::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'order_state` WHERE `id_order_state` = '.(int)(Configuration::get($this->prefix.'ORDER_STATE_PART_ID'))); + DB::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'order_state_lang` WHERE `id_order_state` = '.(int)(Configuration::get($this->prefix.'ORDER_STATE_PART_ID'))); + + return true; + } + + public function getPaymentUrlBase() + { + return $this->payment_url[Configuration::get($this->prefix.'ENVIRONMENT')]; + } + + private function _getSupportedLanguageIsoById($id_lang) + { + $lang = Language::getIsoById((int)($id_lang)); + + return in_array($lang, $this->supported_languages) ? $lang : $this->default_language; + } + + private function _getRegisterLink($id_lang) + { + $lang = Language::getIsoById((int)($id_lang)); + return array_key_exists($lang, $this->register_url) ? $this->register_url[$lang] : $this->register_url[$this->default_language]; + } + + private function _getAllowedCurrencies() + { + if (empty($this->allowed_currencies)) + $this->allowed_currencies = DB::getInstance()->ExecuteS( + 'SELECT c.id_currency, c.iso_code, c.name, c.sign + FROM '._DB_PREFIX_.'currency c + WHERE c.deleted = 0 + AND iso_code IN (\''.implode('\',\'', $this->supported_currencies).'\')'); + + return $this->allowed_currencies; + } + + public function isCurrencyActive($currency_iso_code) + { + $mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency_iso_code); + return ($mid && file_exists($this->certificat_dir.$mid.'.pem') && Configuration::get($this->prefix.'KEYRING_PW_'.$currency_iso_code)); + } + + public function createDisposition($cart) + { + global $cookie; + + $currency = new Currency((int)($cart->id_currency)); + $language = $this->_getSupportedLanguageIsoById((int)($cookie->id_lang)); + $mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code); + $mtid = $cart->id.'-'.time(); + $amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.',''); + $currency_iso = $currency->iso_code; + $business_type = Configuration::get($this->prefix.'BUSINESS_TYPE'); + $reporting_criteria = ''; + + $hash = md5(Configuration::get($this->prefix.'SALT') + $amount + $currency_iso); + + $ok_url = Tools::getShopDomainSsl(true, true)._MODULE_DIR_.$this->name.'/payment.php?hash='.$hash; + $nok_url = Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'/order.php?step=3'; + + list($return_code, $error_code, $message) = PSCPrepaidServicesAPI::createDisposition($this->getAPIConfiguration($currency_iso), $mid, $mtid, $amount, $currency_iso, $ok_url, $nok_url, $business_type, $reporting_criteria); + + if ($return_code == 0) + { + PSCDisposition::deleteByCartId((int)($cart->id)); // Avoid duplicate disposition (canceled orders in CT for example) + PSCDisposition::create((int)($cart->id), $mtid, $amount, $currency_iso); + $message = $this->getPaymentUrlBase().'?currency='.$currency->iso_code.'&mid='.$mid.'&mtid='.$mtid.'&amount='.$amount.'&language='.$language; + } + + return array('return_code' => $return_code, 'message' => $message); + } + + public function getDispositionState($id_cart) + { + $disposition = PSCDisposition::getByCartId((int)($id_cart)); + + if (!array_key_exists('id_disposition', $disposition)) + die(Tools::displayError()); + + return PSCPrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']); + } + + public function executeDebit($id_cart, $amount = NULL, $close_flag = 1) + { + $disposition = PSCDisposition::getByCartId((int)($id_cart)); + if (!array_key_exists('id_disposition', $disposition)) + die(Tools::displayError()); + + if (!isset($amount) || $amount === '') + $amount = $disposition['amount']; + + $result = PSCPrepaidServicesAPI::executeDebit($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], number_format($amount, 2, '.', ''), $disposition['currency'], $close_flag); + + if ($result[0] == 0) + { + if ($amount == $disposition['amount'] || $close_flag) + PSCDisposition::delete((int)($disposition['id_disposition'])); + else + PSCDisposition::updateAmount((int)($disposition['id_disposition']), (float)($amount)); + } + + return $result; + } + + + public function getContent() + { + $out = '

'.$this->displayName.'

'; + $err_req = false; + + // check requirements + if (!extension_loaded('curl')) + { + $out .= $this->displayError($this->getL('curl_required')); + $err_req = true; + } + + + if (!is_writable($this->certificat_dir)) + { + $out .= $this->displayError($this->certificat_dir.' '.$this->getL('not_writable')); + $err_req = true; + } + + $id_currency = Currency::getIdByIsoCode($this->max_amount_currency); + if (empty($id_currency)) + { + $out .= $this->displayError($this->getL('currency_required').'['.$this->max_amount_currency.']'); + $err_req = true; + } + + if (!$err_req && Tools::isSubmit('submitCtConfiguration')) + { + $errors = $this->_validateForm(); + + if (empty($errors)) + $out .= $this->_postProcess(); + else + $out .= $errors; + } + + $out .= $this->_displayStyleAndJS(); + $out .= $this->_displayInfos(); + $out .= $this->_displayForm(); + + return $out; + } + + private function _displayStyleAndJS() + { + return ' + '; + } + + private function _displayForm() + { + $business_type_options = ''; + foreach ($this->business_types AS $key => $value) + $business_type_options .= ''; + + $currencies_configuration = '

'.$this->getL('configure_currency').'

+

'.$this->getL('payment_not_displayed').'

+
'; + + $environment_radio = ''; + foreach ($this->environments AS $key => $value) + $environment_radio .= 'prefix.'ENVIRONMENT') == $key ? 'checked' : '').'>'. $value. '
'; + + foreach ($this->_getAllowedCurrencies() AS $currency) + { + $mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency['iso_code']); + $certificate = ''; + $passwordExist = ''; + if (file_exists($this->certificat_dir.$mid.'.pem')) + $certificate = '
'.$this->l('A certificate has been found for this configuration').' : '.$mid.'.pem'.'

'; + if (Configuration::get($this->prefix.'KEYRING_PW_'.$currency['iso_code'])) + $passwordExist = '
'.$this->l('A password has already been saved'); + + $currencies_configuration .= ' +
+ + + '; + } + $currencies_configuration .= '
'.$this->getL('configuration_in').' '.$currency['name'].' '.$currency['sign'].' + +
+ +
+
+ +
+ +
+ '.$certificate.' + +
+ +
+ '.$passwordExist.' +
'; + + return '
+
+ '.$this->getL('configuration').' + +
+ '.$environment_radio.' +
+
+ +
+ +
+
+ +
+ prefix.'IMMEDIAT_PAYMENT') ? 'checked' : '').' /> +
+
+
+ '.$currencies_configuration.' +
+
+ +
+ +
+
'; + } + + private function _displayInfos() + { + global $cookie; + + return '
+ '.$this->displayName.' +
+ '.$this->getL('introduction').' +

+
'.$this->getL('register').' +
+

'; + } + + private function _validateForm() + { + $errors = ''; + + foreach ($this->_getAllowedCurrencies() AS $currency) + { + $mid = trim(Tools::getValue('ct_merchant_id_'.$currency['iso_code'])); + + if (preg_match('/^[0-9]{10}$/', $mid)) + { + $mid_certificat = $_FILES['ct_keyring_certificate_'.$currency['iso_code']]; + + if (!$mid_certificat || $mid_certificat['error'] == 4 || $mid_certificat['error'] == 3) + { + if (!file_exists($this->certificat_dir.$mid.'.pem')) + $errors .= $this->displayError($this->getL('certificate_required').' ['.$currency['iso_code'].']'); + } + else + { + if ($mid_certificat['error']) + { + switch ($mid_certificat['error']) + { + case 3: // UPLOAD_ERR_PARTIAL + $errors .= $this->displayError($this->getL('file_partialy_uploaded')); + break; + + case 4: // UPLOAD_ERR_NO_FILE + $errors .= $this->displayError($this->getL('file_empty')); + break; + } + } + + if (substr($mid_certificat['name'], -4) != '.pem') + $errors .= $this->displayError($this->getL('invalid_file').' ['.$currency['iso_code'].']'); + } + } + elseif (!empty($mid)) + { + $errors .= $this->displayError($this->getL('invalid_merchant_id').' ['.$currency['iso_code'].']'); + } + } + + if (!array_key_exists(Tools::getValue('ct_business_type'), $this->business_types)) + $errors .= $this->getL('invalid_business_type'); + + if (!array_key_exists(Tools::getValue('ct_environment'), $this->environments)) + $errors .= $this->getL('invalid_environment'); + + return $errors; + } + + private function _acceptPayment($order, $disposition, $currency_sign, $amount = NULL) + { + $isCorrect = true; + if (!$disposition) + die(Tools::displayError()); + + if (!isset($amount) || $amount === '') + $amount = $disposition['amount']; + + $amount = number_format($amount, 2, '.', ''); + $close_flag = (int)($amount == $disposition['amount']); + + list($resultcode, $errorcode, $errormessage) = $this->executeDebit($disposition['id_cart'], $amount, $close_flag); + + $param = ''; + if ($resultcode != 0) + { + $message = $this->getL('payment_error').' '.$errormessage; + $isCorrect = false; + } + else + $message = $this->getL('payment_accepted') .'('.$amount.' '.$currency_sign.') '.($close_flag ? $this->getL('disposition_consumed') : '') ; + + $msg = new Message(); + $msg->message = $message; + $msg->id_order = (int)($order->id); + $msg->private = 1; + $msg->add(); + + if ($isCorrect) + { + if ($order->total_paid == $order->total_paid_real) + $order->total_paid_real = $amount; + else + $order->total_paid_real += $amount; + + $os = Configuration::get('PS_OS_PAYMENT'); + if ($order->total_paid != $order->total_paid_real) + $os = Configuration::get($this->prefix.'ORDER_STATE_PART_ID'); + + $history = new OrderHistory(); + $history->id_order = (int)($order->id); + $history->changeIdOrderState($os, (int)($order->id)); + $history->save(); + + $order->save(); + } + + return $isCorrect; + } + + public function _releasePayment($order, $disposition) + { + if (!$disposition) + die(Tools::displayError()); + + list($resultcode, $errorcode, $errormessage) = $this->executeDebit($disposition['id_cart'], 0, 1); + + $param = ''; + if ($resultcode != 0) + { + $message = $this->getL('release_error').' '.$errormessage; + $isCorrect = false; + } + else + $message = $this->getL('payment_released'); + + $msg = new Message(); + $msg->message = $message; + $msg->id_order = (int)($order->id); + $msg->private = 1; + $msg->add(); + + return $errorcode; + } + + private function _postProcess() + { + Configuration::updateValue($this->prefix.'BUSINESS_TYPE', Tools::getValue('ct_business_type')); + Configuration::updateValue($this->prefix.'ENVIRONMENT', Tools::getValue('ct_environment')); + + $immediat_payment = Tools::getValue('ct_immediat_payment'); + if (Configuration::get($this->prefix.'BUSINESS_TYPE') == 'I') + $immediat_payment = 1; + + Configuration::updateValue($this->prefix.'IMMEDIAT_PAYMENT', $immediat_payment); + + $params = ''; + $dataSync = ''; + $delim = '?'; + $key = 1; + foreach ($this->_getAllowedCurrencies() AS $currency) + { + $mid = trim(Tools::getValue('ct_merchant_id_'.$currency['iso_code'])); + + Configuration::updateValue($this->prefix.'MERCHANT_ID_'.$currency['iso_code'], $mid); + $pass = Tools::getValue('ct_keyring_pw_'.$currency['iso_code']); + if (!empty($pass)) + Configuration::updateValue($this->prefix.'KEYRING_PW_'.$currency['iso_code'], Tools::getValue('ct_keyring_pw_'.$currency['iso_code'])); + + if (isset($_FILES['ct_keyring_certificate_'.$currency['iso_code']])) + move_uploaded_file($_FILES['ct_keyring_certificate_'.$currency['iso_code']]['tmp_name'], $this->certificat_dir.$mid.'.pem'); + + if ($mid) + { + $params .= $delim.'mid'.$key.'='.urlencode($mid).'¤cy'.$key.'='.urlencode($currency['iso_code']); + $delim = '&'; + $key++; + } + } + + if (!empty($params)) + $dataSync = ''; + + return $this->displayConfirmation($this->getL('settings_updated').$dataSync); + } + + public function hookPayment($params) + { + global $smarty; + + // check currency + $currency = new Currency((int)($params['cart']->id_currency)); + + if (!$this->isCurrencyActive($currency->iso_code)) + return false; + + // check max amount + $amount = (float)($params['cart']->getOrderTotal(true, Cart::BOTH)); + $id_currency_max = Currency::getIdByIsoCode($this->max_amount_currency); + + if ($currency->id != $id_currency_max) + { + $amount = $amount / $currency->conversion_rate; + $amount = Tools::convertPrice($amount, new Currency((int)($id_currency_max))); + } + + if ($amount > $this->max_amount) + return false; + + $smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', + 'payment_name' => $this->displayName, + 'module_name' => $this->name)); + + return $this->display(_MODULE_DIR_.'/'.$this->name.'/', 'payment.tpl'); + } + + + public function hookPaymentReturn($params) + { + global $smarty, $cookie; + + if ($params['objOrder']->module != $this->name) + return; + + $smarty->assign('payment_name', $this->displayName); + return $this->display(_MODULE_DIR_.'/'.$this->name.'/', $this->name.'-confirmation.tpl'); + } + + + public function hookAdminOrder($params) + { + global $smarty, $cookie; + $error = 0; + $order = new Order((int)($params['id_order'])); + + if (!Validate::isLoadedObject($order)) + die(Tools::displayError()); + + if ($order->module != $this->name) + return false; + + $disposition = PSCDisposition::getByCartId((int)($order->id_cart)); + if (!$disposition) // No disposition = Order paid + return false; + + // check disposition state + $res = PSCPrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']); + $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + + // if the disposition is not "active" + if ($res[5] != PSCPrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PSCPrepaidServicesAPI::DISPOSITION_DEBITED) + { + $smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment)); + return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl'); + } + + if (Tools::isSubmit('acceptPayment')) + { + $amount = Tools::getValue('ps_amount'); + if (isset($amount) && !empty($amount) && $amount <= $res[3] && $amount > 0) + { + if (!$this->_acceptPayment($order, $disposition, $currency->getSign('right'), $amount)) + $error = 1; + } + else + $error = 2; + + $query_string = $error ? self::changeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error', (int)($error)) : self::removeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error'); + Tools::redirectAdmin(Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$query_string); + } elseif (Tools::isSubmit('releasePayment')) { + if (!$this->_releasePayment($order, $disposition)) + $error = 1; + + $query_string = $error ? self::changeQueryStringParameter($_SERVER['QUERY_STRING'], 'pp_error', (int)($error)) : $_SERVER['QUERY_STRING']; + Tools::redirectAdmin(Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$query_string); + } + + $error_msg = ''; + if (Tools::getIsset('pp_error')) + $error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error')); + + $smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], + 'payment_name' => $order->payment, + 'error' => $error_msg, + 'currency' => $currency->getSign('right'), + 'amount' => $res[3] + )); + + return $this->display($this->module_dir.'/'.$this->name, $this->name.'-accept-payment.tpl'); + } + + public function getAPIConfiguration($iso_currency) + { + return array('keyring_file' => $this->certificat_dir.Configuration::get($this->prefix.'MERCHANT_ID_'.strtoupper($iso_currency)).'.pem', + 'keyring_pw' => Configuration::get($this->prefix.'KEYRING_PW_'.strtoupper($iso_currency)), + 'keyring_prepaid' => $this->certificat_dir.'paysafecard-CA.pem', + 'env' => Configuration::get($this->prefix.'ENVIRONMENT')); + } + + public static function changeQueryStringParameter($query_string, $param, $value) + { + parse_str($query_string, $output); + $output[$param] = $value; + return http_build_query($output); + } + + public static function removeQueryStringParameter($query_string, $param) + { + parse_str($query_string, $output); + unset($output[$param]); + return http_build_query($output); + } + +} + diff --git a/modules/paysafecard/PrepaidServicesAPI.php b/modules/paysafecard/PrepaidServicesAPI.php new file mode 100755 index 00000000..f2d115f7 --- /dev/null +++ b/modules/paysafecard/PrepaidServicesAPI.php @@ -0,0 +1,193 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7887 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +class PSCPrepaidServicesAPI +{ + const DISPOSITION_CREATED = 'R'; + const DISPOSITION_DISPOSED = 'S'; + const DISPOSITION_DEBITED = 'E'; + const DISPOSITION_CONSUMED = 'O'; + const DISPOSITION_CANCELLED = 'L'; + const DISPOSITION_INVALID = 'I'; + const DISPOSITION_EXPIRED = 'X'; + + // Test & Production environment (shared between CT & PSC) + private static $base_url = array('T' => array('create_disposition_url' => 'https://shops.test.at.paysafecard.com/pscmerchant/CreateDispositionServlet', + 'get_disposition_state_url' => 'https://shops.test.at.paysafecard.com/pscmerchant/GetDispositionStateServlet', + 'execute_debit_url' => 'https://shops.test.at.paysafecard.com/pscmerchant/DebitServlet', + 'get_serial_number_url' => 'https://shops.test.at.paysafecard.com/pscmerchant/GetSerialNumbersServlet' + ), + 'P' => array('create_disposition_url' => 'https://shops.cc.at.paysafecard.com/pscmerchant/CreateDispositionServlet', + 'get_disposition_state_url' => 'https://shops.cc.at.paysafecard.com/pscmerchant/GetDispositionStateServlet', + 'execute_debit_url' => 'https://shops.cc.at.paysafecard.com/pscmerchant/DebitServlet', + 'get_serial_number_url' => 'https://shops.cc.at.paysafecard.com/pscmerchant/GetSerialNumbersServlet' + )); + + public static function getBaseUrl($key, $env) + { + $base_url = self::$base_url[$env]; + + if (array_key_exists($key, $base_url)) + return $base_url[$key]; + + return ''; + } + + public static function createDisposition($configuration, $mid, $mtid, $amount, $currency, $okurl, $nokurl, $businesstype, $reportingcriteria) + { + $language = 'en'; + $params = 'currency='.$currency.'&mid='.$mid.'&mtid='.$mtid.'&amount='.$amount.'&businesstype='.$businesstype. + '&reportingcriteria='.$reportingcriteria.'&okurl='.$okurl.'&nokurl='.$nokurl.'&language='.$language; + + + list ($rc, $msg, $data) = self::_doHttpRequest(self::getBaseUrl('create_disposition_url', $configuration['env']), $params, $configuration['keyring_file'], $configuration['keyring_pw'], $configuration['keyring_prepaid']); + + if ($rc == 0) { + $data_array = explode("\n", $data,7); + $resultcode = trim($data_array[0]); + $errorcode = trim($data_array[1]); + //$errormessage = trim($data_array[2]); + // Todo : Find a way to have translation + $errormessage = 'Transaction could not be initiated due to connection problems. If the problem persists, please contact our support.'; + return array($resultcode, $errorcode, $errormessage); + } else { + $resultcode = '9001'; + $errorcode = $rc; + $errormessage = 'libcurl error: '.$msg; + + return array($resultcode,$errorcode,$errormessage); + } + } + + public static function getDispositionState($configuration, $mid, $mtid, $currency_iso_code) + { + $language = 'en'; + $params = 'mid='.$mid.'&mtid='.$mtid.'&language='.$language; + + list ($rc, $msg, $data) = self::_doHttpRequest(self::getBaseUrl('get_disposition_state_url', $configuration['env']), $params, $configuration['keyring_file'], $configuration['keyring_pw'], $configuration['keyring_prepaid']); + + if ($rc == 0) { + $dataarray = explode("\n", $data,7); + $resultcode = trim($dataarray[0]); + $errorcode = trim($dataarray[1]); + $errormessage = trim($dataarray[2]); + $amount = trim($dataarray[3]); + $currency = trim($dataarray[4]); + $state = trim($dataarray[5]); + + return array($resultcode, $errorcode, $errormessage, $amount, $currency, $state); + } else { + $resultcode = '9001'; + $errorcode = $rc; + $errormessage = 'libcurl error: '.$msg; + + return array($resultcode, $errorcode, $errormessage); + } + } + + public static function getSerialNumbers($configuration, $mid, $mtid, $currency_iso_code) + { + $language = 'en'; + $params = 'mid='.$mid.'&mtid='.$mtid.'&language='.$language; + + list ($rc, $msg, $data) = self::_doHttpRequest(self::getBaseUrl('get_serial_number_url', $configuration['env']), $params, $configuration['keyring_file'], $configuration['keyring_pw'], $configuration['keyring_prepaid']); + if ($rc == 0) { + /* read and return data from paysafecard server */ + $dataarray = explode("\n", $data,7); + $resultcode = trim($dataarray[0]); + $errorcode = trim($dataarray[1]); + $errormessage = trim($dataarray[2]); + $amount = trim($dataarray[3]); + $currency = trim($dataarray[4]); + $state = trim($dataarray[5]); + $snamount = trim($dataarray[6]); + return array ($resultcode, $errorcode, $errormessage, $amount, $currency, $state, $snamount); + } else { + $resultcode = '9001'; + $errorcode = $rc; + $errormessage = 'libcurl error: '.$msg; + + return array ($resultcode, $errorcode, $errormessage); + } + } + + public static function executeDebit($configuration, $mid, $mtid, $amount, $currency, $close_flag = 1) + { + $language = 'en'; + $params = 'currency='.$currency.'&mid='.$mid.'&mtid='.$mtid.'&amount='.$amount.'&close='.$close_flag.'&language='.$language; + + list ($rc, $msg, $data) = self::_doHttpRequest(self::getBaseUrl('execute_debit_url', $configuration['env']), $params, $configuration['keyring_file'], $configuration['keyring_pw'], $configuration['keyring_prepaid']); + + if ($rc == 0) { + $dataarray=explode("\n", $data,7); + $resultcode=trim($dataarray[0]); + $errorcode=trim($dataarray[1]); + //$errormessage=trim($dataarray[2]); + + $errormessage = 'The transaction could not be completed. This may have happened due to a temporary connection problem.'. + ' Please press the "reload" button in your browser or the link below to reload this page to retry completing your transaction. '; + return array ($resultcode, $errorcode, $errormessage); + } else { + $resultcode = '9001'; + $errorcode = $rc; + $errormessage = 'libcurl error: '.$msg; + + return array ($resultcode, $errorcode, $errormessage); + } + } + + private static function _doHttpRequest($url, $urlparam, $keyringfile, $keyringpw, $cakeyringfile) + { + /* some prerquisites for the connection */ + $ch = curl_init($url); + curl_setopt($ch, CURLOPT_POST, 1); // a non-zero parameter tells the library to do a regular HTTP post. + curl_setopt($ch, CURLOPT_POSTFIELDS, $urlparam); // add POST fields + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0); // don't allow redirects + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // return into a variable + curl_setopt($ch, CURLOPT_TIMEOUT, 240); // maximum time, in seconds, that you'll allow the CURL functions to take + curl_setopt($ch, CURLOPT_SSLCERT, $keyringfile); // filename of PEM formatted certificate + curl_setopt($ch, CURLOPT_SSLCERTTYPE, "PEM"); // format of certificate, "PEM" or "DER" + curl_setopt($ch, CURLOPT_SSLCERTPASSWD, $keyringpw); // password required to use the CURLOPT_SSLCERT certificate + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); // verify the peer's certificate + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); // verify the Common name from the peer certificate + curl_setopt($ch, CURLOPT_CAINFO, $cakeyringfile); // file holding one or more certificates to verify the peer with + + $data = curl_exec($ch); + $errno = curl_errno($ch); + $errmsg = curl_error($ch); + + /* bug fix for PHP 4.1.0/4.1.2 (curl_errno() returns high negative + * value in case of successful termination) */ + if ($errno < 0) $errno = 0; + + curl_close($ch); + + return array ($errno,$errmsg,$data); + } +} + + diff --git a/modules/paysafecard/de.php b/modules/paysafecard/de.php new file mode 100755 index 00000000..dcad7dbd --- /dev/null +++ b/modules/paysafecard/de.php @@ -0,0 +1,55 @@ +disposition-error_393988def796f78c4b673b90548f3afa'] = 'Der Dispositionsstatus ist ungültig'; +$_MODULE['<{paysafecard}prestashop>disposition-error_5db89f2bf67f2c7dbd86cac101c3c1b8'] = 'Sie sind nicht berechtigt, die Zahlung durchzuführen.'; +$_MODULE['<{paysafecard}prestashop>payment_da9c72b9e543135f3f59e3c8ac68ef35'] = 'Bezahlen Sie mit'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_330bf06fb43e715e5d03c9fd016df4cd'] = 'Die Zahlung wurde noch nicht akzeptiert:'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_486cb12e1ec3c8b28b80a8eb9f2db2c0'] = 'Zahlung akzeptieren '; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_e9b3579d8e877bcd29ab436f2ef87cc8'] = 'Betrag freigeben'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2e2117b7c81aa9ea6931641ea2c6499f'] = 'Ihre Bestellung vom'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_75fbf512d744977d62599cc3f0ae2bb4'] = 'ist abgeschlossen.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_91675397c13245179e4bc959514fc2ca'] = 'Sie haben die '; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2c987f462c2ab7fc63e061e871e6a97d'] = '-Methode gewählt.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_e6dc7945b557a1cd949bea92dd58963e'] = 'Ihre Bestellung wird sehr bald geschickt werden.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_0db71da7150c27142eef9d22b843b4a9'] = 'Bei Fragen oder für weitere Informationen, kontaktieren Sie bitte unseren'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_64430ad2835be8ad60c59e7d44e4b0b1'] = 'Kunden-Support'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_3e8e30e75887d2f3b02da669ebd5b380'] = 'Ein Zertifikat für diese Konfiguration wurde gefunden'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_515f3d11e66f6fc5f7bb453e6030241a'] = 'Ein Kennwort existiert bereits.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9240e3ec97017ab6af036384ff7199'] = 'PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b3e93e632edfb4fa64c3c0949c5eb56d'] = 'Zahlungen per Paysafecard akzeptieren'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bed51f5187d4bf98e08f44d93f3098d9'] = 'Disposition erstellt. Warten auf Belastung.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_894f0316a71ef67255369c82bf8a0e5b'] = 'Ungültiger Dispositionsstatus:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c1c25198721552ea8ddd963c7278d4ab'] = 'Ein Fehler ist bei der Zahlung aufgetreten:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_36ec50c0e914dd2fb48a1b27540512ce'] = 'Zahlung akzeptiert.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d6ca44369efe062cec0c09f392465f55'] = 'Dieses Modul erfordert das ordnungsgemäße Funktionieren der CURL PHP-Erweiterung.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_8e9647b486000683917484190b68ac8a'] = 'ist nicht beschreibbar!'; +$_MODULE['<{paysafecard}prestashop>paysafecard_139cfa047b503ac5b9a6b4b1b03090ad'] = 'Dieses Modul erfordert die Währung:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ef5d34b04ab3b2eaaf7cb9d0f51267ed'] = 'Konfigurieren Sie jede Währung einzeln:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9c8794db26bbef6bd2aaa68c15211d'] = '(Das Zahlungsmodul wird nicht für Kunden angezeigt, die nicht konfigurierte Währung benutzen.)'; +$_MODULE['<{paysafecard}prestashop>paysafecard_7d3d009ac1b9d1e826a1a72c046ea635'] = 'Konfiguration in'; +$_MODULE['<{paysafecard}prestashop>paysafecard_229a7ec501323b94db7ff3157a7623c9'] = 'Händler-ID'; +$_MODULE['<{paysafecard}prestashop>paysafecard_845314022daaa8b665e718c4b51738aa'] = 'Keyring Zertifikat'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a01813de717585e9ac9458bbfc54485a'] = 'Keyring PW'; +$_MODULE['<{paysafecard}prestashop>paysafecard_254f642527b45bc260048e30704edb39'] = 'Konfiguration'; +$_MODULE['<{paysafecard}prestashop>paysafecard_0ba29c6a1afacf586b03a26162c72274'] = 'Umgebung'; +$_MODULE['<{paysafecard}prestashop>paysafecard_1d5ad3d37f236c9eebda547690373bba'] = 'Geschäftsart'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b024248d9fecf8c34f629e89a9fb93b4'] = 'Sofortige Zahlung'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c80a51a60c5ee43553c3881459b8f431'] = 'Konfiguration aktualisieren'; +$_MODULE['<{paysafecard}prestashop>paysafecard_86f28c996ee9075e9fc9a97dc8d5f254'] = 'Sie müssen ein Zertifikat für die Händler-ID vorweisen'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bbced877c13c763f0141ff906c8ed0e5'] = 'Ungültige Datei'; +$_MODULE['<{paysafecard}prestashop>paysafecard_97e5793f511c7930ab295997cb28553a'] = 'Ungültige Händler-ID'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c888438d14855d7d96a2724ee9c306bd'] = 'Einstellungen aktualisiert'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c7c32346a2f800fc49f79d52f3f37f90'] = 'Die Datei wurde teilweise hochgeladen'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f09bc49e98e94cb04dc058087fbb3878'] = 'Die Datei ist leer'; +$_MODULE['<{paysafecard}prestashop>paysafecard_e9185d874b4244d6f13619cf77dca0aa'] = 'Die Transaktion konnte wegen Problemen mit der Verbindung nicht initiiert werden. Wenn das Problem weiterhin besteht, wenden Sie sich bitte an unseren Support.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_99f6765a05b697eb78e8c2e5e228f2fc'] = 'Disposition verbraucht'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c3e260f43a99b6fd907538953fe700d0'] = 'Disposition freigegeben'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f6a62a622cbba2c1b8cd0be062deff96'] = 'Ein Fehler ist während der Freigabe aufgetreten '; +$_MODULE['<{paysafecard}prestashop>paysafecard_315e941f57cf90350aea15d968e190f8'] = 'paysafecard ist Europas erste Prepaid-Lösung für Zahlungen im Internet in Übereinstimmung mit Bankgesetzen. In den letzten Jahren hat sich paysafecard zu einer der führenden alternativen europäischen Online-Payment-Lösungen entwickelt.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d59048f21fd887ad520398ce677be586'] = 'Erfahren Sie mehr'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ee363d108ef0c9c5a599d3afe04b9e32'] = 'Ein Fehler ist aufgetreten, überprüfen Sie die Mitteilungen, um mehr zu erfahren'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a9ced76f2dd6907220fa95b3a136b04a'] = 'Ungültiger Betrag'; + +?> \ No newline at end of file diff --git a/modules/paysafecard/disposition-error.tpl b/modules/paysafecard/disposition-error.tpl new file mode 100755 index 00000000..b3f87368 --- /dev/null +++ b/modules/paysafecard/disposition-error.tpl @@ -0,0 +1,37 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
+
+ {$payment_name} + +

+ {l s='The disposition state is invalid' mod='paysafecard'} ({$disposition_state}) + {l s='. You are not allowed to perform the payment.' mod='paysafecard'} + +

+
+ diff --git a/modules/paysafecard/en.php b/modules/paysafecard/en.php new file mode 100755 index 00000000..601358d4 --- /dev/null +++ b/modules/paysafecard/en.php @@ -0,0 +1,4 @@ +prepaidservices_3e8e30e75887d2f3b02da669ebd5b380'] = 'Se ha encontrado un certificado para esta configuración'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_515f3d11e66f6fc5f7bb453e6030241a'] = 'Ya se ha guardado una clave'; +$_MODULE['<{paysafecard}prestashop>disposition-error_393988def796f78c4b673b90548f3afa'] = 'La disposición se encuentra en un estado no válido'; +$_MODULE['<{paysafecard}prestashop>disposition-error_5db89f2bf67f2c7dbd86cac101c3c1b8'] = 'No está autorizado a recuperar el pago.'; +$_MODULE['<{paysafecard}prestashop>payment_da9c72b9e543135f3f59e3c8ac68ef35'] = 'Pagar con'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_330bf06fb43e715e5d03c9fd016df4cd'] = 'El pago aún no ha sido aceptado'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_486cb12e1ec3c8b28b80a8eb9f2db2c0'] = 'Aceptar el pago'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_e9b3579d8e877bcd29ab436f2ef87cc8'] = 'Rechazar el pago'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2e2117b7c81aa9ea6931641ea2c6499f'] = 'Su pedido en'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_75fbf512d744977d62599cc3f0ae2bb4'] = 'ha sido registrado.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_91675397c13245179e4bc959514fc2ca'] = 'Ha elegido pagar con'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2c987f462c2ab7fc63e061e871e6a97d'] = 'método.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_e6dc7945b557a1cd949bea92dd58963e'] = 'Su pedido será enviado rápidamente'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_0db71da7150c27142eef9d22b843b4a9'] = 'Para cualquier pregunta o información suplementaria, póngase en contacto con nuestro'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_64430ad2835be8ad60c59e7d44e4b0b1'] = 'servicio clientela'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9240e3ec97017ab6af036384ff7199'] = 'PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b3e93e632edfb4fa64c3c0949c5eb56d'] = 'Aceptar los pagos a través de PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bed51f5187d4bf98e08f44d93f3098d9'] = 'Disposición creada. En espera del débito.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_894f0316a71ef67255369c82bf8a0e5b'] = 'El estado de la disposición no es válido:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c1c25198721552ea8ddd963c7278d4ab'] = 'Se ha producido un error durante el pago:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_36ec50c0e914dd2fb48a1b27540512ce'] = 'Pago aceptado'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d6ca44369efe062cec0c09f392465f55'] = 'Este módulo necesita la librería PHP cURL para funcionar correctamente.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_8e9647b486000683917484190b68ac8a'] = 'no tiene los derechos en escritura.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_139cfa047b503ac5b9a6b4b1b03090ad'] = 'Para funcionar correctamente, este módulo necesita la divisa:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ef5d34b04ab3b2eaaf7cb9d0f51267ed'] = 'Configurar cada divisa independientemente:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9c8794db26bbef6bd2aaa68c15211d'] = '(El módulo de pago no se mostrará a los clientes que utilicen una divisa no configurada)'; +$_MODULE['<{paysafecard}prestashop>paysafecard_7d3d009ac1b9d1e826a1a72c046ea635'] = 'Configuración en'; +$_MODULE['<{paysafecard}prestashop>paysafecard_229a7ec501323b94db7ff3157a7623c9'] = 'ID vendedor'; +$_MODULE['<{paysafecard}prestashop>paysafecard_845314022daaa8b665e718c4b51738aa'] = 'Keyring Certificado'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a01813de717585e9ac9458bbfc54485a'] = 'Keyring PW'; +$_MODULE['<{paysafecard}prestashop>paysafecard_254f642527b45bc260048e30704edb39'] = 'Configuración'; +$_MODULE['<{paysafecard}prestashop>paysafecard_0ba29c6a1afacf586b03a26162c72274'] = 'Entorno'; +$_MODULE['<{paysafecard}prestashop>paysafecard_1d5ad3d37f236c9eebda547690373bba'] = 'Tipo negocio'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b024248d9fecf8c34f629e89a9fb93b4'] = 'Pago inmediato'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c80a51a60c5ee43553c3881459b8f431'] = 'Actualizar la configuración'; +$_MODULE['<{paysafecard}prestashop>paysafecard_86f28c996ee9075e9fc9a97dc8d5f254'] = 'Debe indicar un certificado para el ID vendedor'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bbced877c13c763f0141ff906c8ed0e5'] = 'Archivo no válido'; +$_MODULE['<{paysafecard}prestashop>paysafecard_97e5793f511c7930ab295997cb28553a'] = 'ID del vendedor no válido'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c888438d14855d7d96a2724ee9c306bd'] = 'Configuración actualizada'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c7c32346a2f800fc49f79d52f3f37f90'] = 'El archivo no se ha cargado correctamente'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f09bc49e98e94cb04dc058087fbb3878'] = 'El archivo está vacío'; +$_MODULE['<{paysafecard}prestashop>paysafecard_e9185d874b4244d6f13619cf77dca0aa'] = 'La transacción no ha podido inicializarse por problemas de conexión. Si el problema persiste, contacte con nosotros.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_99f6765a05b697eb78e8c2e5e228f2fc'] = 'Disposición consumida'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c3e260f43a99b6fd907538953fe700d0'] = 'Disposición abandonada'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f6a62a622cbba2c1b8cd0be062deff96'] = 'Se ha producido un error en el momento de abandonar.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_315e941f57cf90350aea15d968e190f8'] = 'Todo el mundo puede utilizar Paysafecard ya que no necesita ni tarjeta de crédito ni cuenta bancaria. En los últimos años, Paysafecard se ha convertido en uno de los líderes de los modos de pago en línea alternativos.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d59048f21fd887ad520398ce677be586'] = 'Más información'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ee363d108ef0c9c5a599d3afe04b9e32'] = 'Se ha producido un error. Consulte el apartado \"Mensajes\" para más información.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a9ced76f2dd6907220fa95b3a136b04a'] = 'Importe incorrecto'; diff --git a/modules/paysafecard/fr.php b/modules/paysafecard/fr.php new file mode 100755 index 00000000..d876d3dd --- /dev/null +++ b/modules/paysafecard/fr.php @@ -0,0 +1,53 @@ +prepaidservices_3e8e30e75887d2f3b02da669ebd5b380'] = 'Un certificat a été trouvé pour cette configuration'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_515f3d11e66f6fc5f7bb453e6030241a'] = 'Un mot de passe a déjà été enregistré'; +$_MODULE['<{paysafecard}prestashop>disposition-error_393988def796f78c4b673b90548f3afa'] = 'La disposition est dans un état invalide'; +$_MODULE['<{paysafecard}prestashop>disposition-error_5db89f2bf67f2c7dbd86cac101c3c1b8'] = '. Vous n\'êtes pas authorisé à récupérer le paiement.'; +$_MODULE['<{paysafecard}prestashop>payment_da9c72b9e543135f3f59e3c8ac68ef35'] = 'Payer avec'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_330bf06fb43e715e5d03c9fd016df4cd'] = 'Le paiement n\'a pas encore été accepté : '; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_486cb12e1ec3c8b28b80a8eb9f2db2c0'] = 'Accepter le paiement'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_e9b3579d8e877bcd29ab436f2ef87cc8'] = 'Relacher le paiement'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2e2117b7c81aa9ea6931641ea2c6499f'] = 'Votre commande sur'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_75fbf512d744977d62599cc3f0ae2bb4'] = 'a bien été enregistrée.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_91675397c13245179e4bc959514fc2ca'] = 'Vous avez choisi de payer avec '; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2c987f462c2ab7fc63e061e871e6a97d'] = ' '; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_e6dc7945b557a1cd949bea92dd58963e'] = 'Votre commande va être expediée rapidement.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_0db71da7150c27142eef9d22b843b4a9'] = 'Pour toutes questions ou informations complémentaires, contactez notre'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_64430ad2835be8ad60c59e7d44e4b0b1'] = 'service client'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9240e3ec97017ab6af036384ff7199'] = 'PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b3e93e632edfb4fa64c3c0949c5eb56d'] = 'Accepter les paiements via PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bed51f5187d4bf98e08f44d93f3098d9'] = 'Disposition crée. En attente du débit.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_894f0316a71ef67255369c82bf8a0e5b'] = 'L\'état de la disposition est invalide :'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c1c25198721552ea8ddd963c7278d4ab'] = 'Une erreur est survenue pendant le paiement :'; +$_MODULE['<{paysafecard}prestashop>paysafecard_36ec50c0e914dd2fb48a1b27540512ce'] = 'Paiement accepté.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d6ca44369efe062cec0c09f392465f55'] = 'Ce module requiert la librairie PHP cURL pour fonctionner correctement.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_8e9647b486000683917484190b68ac8a'] = 'n\'a pas les droits en écriture.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_139cfa047b503ac5b9a6b4b1b03090ad'] = 'Ce module pour fonctionner correctement requiert la devise :'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ef5d34b04ab3b2eaaf7cb9d0f51267ed'] = 'Configurer chaque devise indépendament :'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9c8794db26bbef6bd2aaa68c15211d'] = '(Le module de paiement ne sera pas affiché pour les clients qui utilisent une devise non configurée)'; +$_MODULE['<{paysafecard}prestashop>paysafecard_7d3d009ac1b9d1e826a1a72c046ea635'] = 'Configuration en'; +$_MODULE['<{paysafecard}prestashop>paysafecard_229a7ec501323b94db7ff3157a7623c9'] = 'ID Marchand'; +$_MODULE['<{paysafecard}prestashop>paysafecard_845314022daaa8b665e718c4b51738aa'] = 'Keyring Certificat'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a01813de717585e9ac9458bbfc54485a'] = 'Keyring PW'; +$_MODULE['<{paysafecard}prestashop>paysafecard_254f642527b45bc260048e30704edb39'] = 'Configuration'; +$_MODULE['<{paysafecard}prestashop>paysafecard_0ba29c6a1afacf586b03a26162c72274'] = 'Environement'; +$_MODULE['<{paysafecard}prestashop>paysafecard_1d5ad3d37f236c9eebda547690373bba'] = 'Business Type'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b024248d9fecf8c34f629e89a9fb93b4'] = 'Paiement immédiat'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c80a51a60c5ee43553c3881459b8f431'] = 'Mettre à jour la configuration'; +$_MODULE['<{paysafecard}prestashop>paysafecard_86f28c996ee9075e9fc9a97dc8d5f254'] = 'Vous devez fournir un certificat pour l\'ID marchand'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bbced877c13c763f0141ff906c8ed0e5'] = 'Fichier invalide'; +$_MODULE['<{paysafecard}prestashop>paysafecard_97e5793f511c7930ab295997cb28553a'] = 'ID marchand invalide'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c888438d14855d7d96a2724ee9c306bd'] = 'Configuration mise à jour'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c7c32346a2f800fc49f79d52f3f37f90'] = 'Le fichier n\'a pas été téléchargé correctement'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f09bc49e98e94cb04dc058087fbb3878'] = 'Le fichier est vide'; +$_MODULE['<{paysafecard}prestashop>paysafecard_e9185d874b4244d6f13619cf77dca0aa'] = 'La transaction n\'a pu être initialisée du à des problèmes de connexions. Si le problème persiste, merci de nous contacter.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_99f6765a05b697eb78e8c2e5e228f2fc'] = 'Disposition consommée'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c3e260f43a99b6fd907538953fe700d0'] = 'Disposition relachée'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f6a62a622cbba2c1b8cd0be062deff96'] = 'Une erreur est survenue au moment de la relache.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_315e941f57cf90350aea15d968e190f8'] = 'Tout le monde peut utiliser paysafecard puisqu’elle ne nécessite ni carte de crédit ni compte bancaire. Aux cours des dernières années, Paysafecard est devenu l\'un des leaders des moyens de paiement en ligne alternatifs. '; +$_MODULE['<{paysafecard}prestashop>paysafecard_d59048f21fd887ad520398ce677be586'] = 'En savoir plus'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ee363d108ef0c9c5a599d3afe04b9e32'] = 'Une erreur est survenue. Consulter la partie \"Messages\" ci-dessous pour plus d\'informations'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a9ced76f2dd6907220fa95b3a136b04a'] = 'Montant incorrect'; diff --git a/modules/paysafecard/img/index.php b/modules/paysafecard/img/index.php new file mode 100755 index 00000000..b559f985 --- /dev/null +++ b/modules/paysafecard/img/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7233 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/paysafecard/img/payment-logo.png b/modules/paysafecard/img/payment-logo.png new file mode 100755 index 00000000..49e8da84 Binary files /dev/null and b/modules/paysafecard/img/payment-logo.png differ diff --git a/modules/paysafecard/img/payment-small.png b/modules/paysafecard/img/payment-small.png new file mode 100755 index 00000000..f045c566 Binary files /dev/null and b/modules/paysafecard/img/payment-small.png differ diff --git a/modules/paysafecard/img/payment.png b/modules/paysafecard/img/payment.png new file mode 100755 index 00000000..a9bb989f Binary files /dev/null and b/modules/paysafecard/img/payment.png differ diff --git a/modules/paysafecard/index.php b/modules/paysafecard/index.php new file mode 100755 index 00000000..b559f985 --- /dev/null +++ b/modules/paysafecard/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7233 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/paysafecard/it.php b/modules/paysafecard/it.php new file mode 100755 index 00000000..78032d08 --- /dev/null +++ b/modules/paysafecard/it.php @@ -0,0 +1,55 @@ +disposition-error_393988def796f78c4b673b90548f3afa'] = 'Lo stato di disposizione non è valido'; +$_MODULE['<{paysafecard}prestashop>disposition-error_5db89f2bf67f2c7dbd86cac101c3c1b8'] = '. Non hai i permessi per effettuare il pagamento.'; +$_MODULE['<{paysafecard}prestashop>payment_da9c72b9e543135f3f59e3c8ac68ef35'] = 'Paga con'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_330bf06fb43e715e5d03c9fd016df4cd'] = 'Il pagamento non è stato ancora accettato:'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_486cb12e1ec3c8b28b80a8eb9f2db2c0'] = 'Accetta il pagamento'; +$_MODULE['<{paysafecard}prestashop>paysafecard-accept-payment_e9b3579d8e877bcd29ab436f2ef87cc8'] = 'Rilascia l\'importo'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2e2117b7c81aa9ea6931641ea2c6499f'] = 'Il tuo ordine'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_75fbf512d744977d62599cc3f0ae2bb4'] = 'è completo.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_91675397c13245179e4bc959514fc2ca'] = 'Hai scelto il'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_2c987f462c2ab7fc63e061e871e6a97d'] = 'metodo.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_e6dc7945b557a1cd949bea92dd58963e'] = 'Il tuo ordine verrà inviato al più presto.'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_0db71da7150c27142eef9d22b843b4a9'] = 'Per eventuali domande o per ulteriori informazioni, contatta la nostra'; +$_MODULE['<{paysafecard}prestashop>paysafecard-confirmation_64430ad2835be8ad60c59e7d44e4b0b1'] = 'assistenza clienti'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_3e8e30e75887d2f3b02da669ebd5b380'] = 'Un certificato è stato trovato per questa configurazione'; +$_MODULE['<{paysafecard}prestashop>prepaidservices_515f3d11e66f6fc5f7bb453e6030241a'] = 'Una password è già stato salvato'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9240e3ec97017ab6af036384ff7199'] = 'PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b3e93e632edfb4fa64c3c0949c5eb56d'] = 'Si accettano pagamenti con PaysafeCard'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bed51f5187d4bf98e08f44d93f3098d9'] = 'Disposizione creata. In attesa di addebito.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_894f0316a71ef67255369c82bf8a0e5b'] = 'Stato della disposizione non valido:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c1c25198721552ea8ddd963c7278d4ab'] = 'Si è verificato un errore durante il pagamento:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_36ec50c0e914dd2fb48a1b27540512ce'] = 'Pagamento accettato.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d6ca44369efe062cec0c09f392465f55'] = 'Questo modulo richiede che l\'estensione curl di PHP funzioni correttamente.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_8e9647b486000683917484190b68ac8a'] = 'non è scrivibile!'; +$_MODULE['<{paysafecard}prestashop>paysafecard_139cfa047b503ac5b9a6b4b1b03090ad'] = 'Questo modulo richiede la valuta:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ef5d34b04ab3b2eaaf7cb9d0f51267ed'] = 'Configurare ogni valuta singolarmente:'; +$_MODULE['<{paysafecard}prestashop>paysafecard_be9c8794db26bbef6bd2aaa68c15211d'] = '(Il modulo di pagamento non sarà visualizzato per i clienti che utilizzano una valuta non configurata.)'; +$_MODULE['<{paysafecard}prestashop>paysafecard_7d3d009ac1b9d1e826a1a72c046ea635'] = 'Configurazione in'; +$_MODULE['<{paysafecard}prestashop>paysafecard_229a7ec501323b94db7ff3157a7623c9'] = 'ID commerciante'; +$_MODULE['<{paysafecard}prestashop>paysafecard_845314022daaa8b665e718c4b51738aa'] = 'Certificato Keyring'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a01813de717585e9ac9458bbfc54485a'] = 'PW Keyring'; +$_MODULE['<{paysafecard}prestashop>paysafecard_254f642527b45bc260048e30704edb39'] = 'Configurazione'; +$_MODULE['<{paysafecard}prestashop>paysafecard_0ba29c6a1afacf586b03a26162c72274'] = 'Ambiente'; +$_MODULE['<{paysafecard}prestashop>paysafecard_1d5ad3d37f236c9eebda547690373bba'] = 'Tipo di Business'; +$_MODULE['<{paysafecard}prestashop>paysafecard_b024248d9fecf8c34f629e89a9fb93b4'] = 'Pagamento immediato'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c80a51a60c5ee43553c3881459b8f431'] = 'Aggiornare la configurazione'; +$_MODULE['<{paysafecard}prestashop>paysafecard_86f28c996ee9075e9fc9a97dc8d5f254'] = 'È necessario fornire un certificato per ID commerciante'; +$_MODULE['<{paysafecard}prestashop>paysafecard_bbced877c13c763f0141ff906c8ed0e5'] = 'File non valido'; +$_MODULE['<{paysafecard}prestashop>paysafecard_97e5793f511c7930ab295997cb28553a'] = 'ID commerciante non valido'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c888438d14855d7d96a2724ee9c306bd'] = 'Impostazioni aggiornate'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c7c32346a2f800fc49f79d52f3f37f90'] = 'Il file è stato parzialmente caricato'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f09bc49e98e94cb04dc058087fbb3878'] = 'Il file è vuoto'; +$_MODULE['<{paysafecard}prestashop>paysafecard_e9185d874b4244d6f13619cf77dca0aa'] = 'Operazione non avviata a causa di problemi di connessione. Se il problema persiste, contatta il nostro supporto.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_99f6765a05b697eb78e8c2e5e228f2fc'] = 'Disposizione consumata'; +$_MODULE['<{paysafecard}prestashop>paysafecard_c3e260f43a99b6fd907538953fe700d0'] = 'Disposizione rilasciata'; +$_MODULE['<{paysafecard}prestashop>paysafecard_f6a62a622cbba2c1b8cd0be062deff96'] = 'È verificato un errore durante il rilascio'; +$_MODULE['<{paysafecard}prestashop>paysafecard_315e941f57cf90350aea15d968e190f8'] = 'paysafecard è la prima soluzione prepagata d\'Europa per i pagamenti su Internet che rispetta le leggi bancarie. Negli ultimi anni, paysafecard è diventato una delle soluzioni alternative di pagamento online leader in Europa.'; +$_MODULE['<{paysafecard}prestashop>paysafecard_d59048f21fd887ad520398ce677be586'] = 'Per saperne di più'; +$_MODULE['<{paysafecard}prestashop>paysafecard_ee363d108ef0c9c5a599d3afe04b9e32'] = 'Si è verificato un errore, controlla Messaggi per maggiori informazioni'; +$_MODULE['<{paysafecard}prestashop>paysafecard_a9ced76f2dd6907220fa95b3a136b04a'] = 'Importo non valido'; + +?> \ No newline at end of file diff --git a/modules/paysafecard/keyring/index.php b/modules/paysafecard/keyring/index.php new file mode 100755 index 00000000..b559f985 --- /dev/null +++ b/modules/paysafecard/keyring/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7233 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/paysafecard/keyring/paysafecard-CA.pem b/modules/paysafecard/keyring/paysafecard-CA.pem new file mode 100755 index 00000000..2df56c61 --- /dev/null +++ b/modules/paysafecard/keyring/paysafecard-CA.pem @@ -0,0 +1,227 @@ +-----BEGIN CERTIFICATE----- +MIIFszCCBJugAwIBAgIBADANBgkqhkiG9w0BAQQFADCB7zEhMB8GCSqGSIb3DQEJ +ARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UECBMGVmll +bm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJkIFJvb3Qg +Q0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEnMCUGA1UE +AxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBQMB4XDTAyMDExMDE2NDU0 +M1oXDTM4MDExMDE2NDU0M1owge8xITAfBgkqhkiG9w0BCQEWEmNhQHBheXNhZmVj +YXJkLmNvbTELMAkGA1UEBhMCQVQxDzANBgNVBAgTBlZpZW5uYTEPMA0GA1UEBxMG +Vmllbm5hMRwwGgYDVQQLExNwYXlzYWZlY2FyZCBSb290IENBMSwwKgYDVQQLEyNw +YXlzYWZlY2FyZCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEmMCQGA1UEChMdcGF5 +c2FmZWNhcmQuY29tIFdlcnRrYXJ0ZW4gQUcxJzAlBgNVBAMTHnBheXNhZmVjYXJk +IFJvb3QgQ0EgLSBTeXN0ZW0gUDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALRAMIFNZR16P4ggPR6hlyXGSONVOklx7U3Xg9zihKA4vmzVMwXUJPP+lHCU +OKiYUSU+cQ+BMfTJCJPvJlqOHH36+ugyGQLI2M9Lq7ILxkGJ3+iQJx4ON1Yf3lJh +uyPLMjvRVCOoN29fUOROfdBxlAGNG33kKYNEh+VJ+ibxX5DmZApsMu6lJJ7LUZvs +2Rho6r9wKQVZaPNeWzJb+7dgLlW7XLIQIv6Fp/bMhZDPhCrX4rN0iiR7I9o5DZiJ +OXwRmWhroRUEo9pPf44XMfdEyaWDK6tbnIsEa7gTOPY3Zt5SMFeSYw1E0OjkUyFo +WL0NoAT7beVqJar+zzwvOjVaeMUCAwEAAaOCAVYwggFSMA8GA1UdEwEB/wQFMAMB +Af8wHQYDVR0OBBYEFCgXaDOdI1dXvmnxpQ1ZM3M/BK07MIIBHgYDVR0jBIIBFTCC +ARGAFCgXaDOdI1dXvmnxpQ1ZM3M/BK07oYH1pIHyMIHvMSEwHwYJKoZIhvcNAQkB +FhJjYUBwYXlzYWZlY2FyZC5jb20xCzAJBgNVBAYTAkFUMQ8wDQYDVQQIEwZWaWVu +bmExDzANBgNVBAcTBlZpZW5uYTEcMBoGA1UECxMTcGF5c2FmZWNhcmQgUm9vdCBD +QTEsMCoGA1UECxMjcGF5c2FmZWNhcmQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx +JjAkBgNVBAoTHXBheXNhZmVjYXJkLmNvbSBXZXJ0a2FydGVuIEFHMScwJQYDVQQD +Ex5wYXlzYWZlY2FyZCBSb290IENBIC0gU3lzdGVtIFCCAQAwDQYJKoZIhvcNAQEE +BQADggEBAEkGu19kW0cROxNmEIhlF2LMFA8Jj9Y5aPPDwM1tMIoZtFWCH1g1g0Zl +PDrp9+ihDFimiXfhIosGvnrclbQ5yIJnxoNmDptkCKTAB+4rPoHSIz8rjCHHTOU2 +rJMVdFvS8hcVkallN1g9o8g7ryA2vRltum5NZUBwAFq986Cur4l2koRzz1UyOkrT +0G0i8cQIR9trGuCaUbhIFTBe/QvSNkIEqDWRDPLfBQnYnBFSwObH5uXiToUXlTnM +/aOuY+p2D8Oh6MneD6nh8turvFTMkLqLS7DzjQAYmF7HWGkRFPsHi2EtLFVIwM9q +FioR7mWBcKh2lZr18AtzGIkKQSQWQkI= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIFujCCBKKgAwIBAgIEIAAABjANBgkqhkiG9w0BAQQFADCB7zEhMB8GCSqGSIb3 +DQEJARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UECBMG +Vmllbm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJkIFJv +b3QgQ0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0aG9y +aXR5MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEnMCUG +A1UEAxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBQMB4XDTAyMDExNjEy +MTUxN1oXDTM0MDExNjEyMTUxN1owgfMxCzAJBgNVBAYTAkFUMQ8wDQYDVQQIEwZW +aWVubmExDzANBgNVBAcTBlZpZW5uYTEmMCQGA1UEChMdcGF5c2FmZWNhcmQuY29t +IFdlcnRrYXJ0ZW4gQUcxHjAcBgNVBAsTFXBheXNhZmVjYXJkIFNlcnZlciBDQTEs +MCoGA1UECxMjcGF5c2FmZWNhcmQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxKTAn +BgNVBAMTIHBheXNhZmVjYXJkIFNlcnZlciBDQSAtIFN5c3RlbSBQMSEwHwYJKoZI +hvcNAQkBFhJjYUBwYXlzYWZlY2FyZC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQDGbD6yVmszQYpuUX0zVyam8DdqPXfY5c8OSQK7u8I7mPoEw0SG +lxSbHy7Aywlx5rhSr6j1k0HgmnOsO6j6bup5CXGvGBWkiahN1TrUN8qAZvIdorUz ++YrZyg/EkddrOqkgZpaqyEEJ2wGdM3Lhbg8oBWufVh/TX0sA9K0NCSrl3UzKLw0n +mEVbUnBxRUGbctnOkmLiIWqX7o8jmupvE7lIvRPLHUyFKGp0Wn2oKosr3fhCQxEU +4dQdH9Uwf53kPt0Ct0MML1p1u8OAN4e6bYL1T86YA/bnaaPFI5D4cVP66X1gcamM ++ro//XJOee2d1FM7lWoyA03ypt54SRB1N6aVAgMBAAGjggFWMIIBUjAPBgNVHRMB +Af8EBTADAQH/MB0GA1UdDgQWBBSB6bcBOjQU0y5+rr8pbTyHYFxKbjCCAR4GA1Ud +IwSCARUwggERgBQoF2gznSNXV75p8aUNWTNzPwStO6GB9aSB8jCB7zEhMB8GCSqG +SIb3DQEJARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UE +CBMGVmllbm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJk +IFJvb3QgQ0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEn +MCUGA1UEAxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBQggEAMA0GCSqG +SIb3DQEBBAUAA4IBAQAwuR+OYbQh8+2A8Ya48pGbEbggbYfJYZAcfZlTxVeilkXb +jhinDfG4mBuvsW8RG7CW1fnHYlytyN9AVJFHchB57SkfDDxhPYI6WBsJTnDaxROa +QzW0r6Pi3e5XAtqC221vKYYC5OoMBq+S+LWUc9kSYX7PAm3ObCEPNBirJMDDwSLm +iovY3UHByFeJ8dYM5u7wKM+WRBzIEi4dMk5VWWx7KO7fieGTxqVCPa1Bd1GQV3yq +Z5P0lzduqD2M1oUr1BCwiivxpHO4aMYo9lVz7ZMFhbyDLiiQqcR3unVKpSpN4oAq +TW3iZ32LXHkLFSCEFinOO43/uWk8+RzNR0N+XZ1F +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIFszCCBJugAwIBAgIBADANBgkqhkiG9w0BAQQFADCB7zEhMB8GCSqGSIb3DQEJ +ARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UECBMGVmll +bm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJkIFJvb3Qg +Q0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0aG9yaXR5 +MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEnMCUGA1UE +AxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBNMB4XDTAyMDExMDE1MDUx +M1oXDTM4MDExMDE1MDUxM1owge8xITAfBgkqhkiG9w0BCQEWEmNhQHBheXNhZmVj +YXJkLmNvbTELMAkGA1UEBhMCQVQxDzANBgNVBAgTBlZpZW5uYTEPMA0GA1UEBxMG +Vmllbm5hMRwwGgYDVQQLExNwYXlzYWZlY2FyZCBSb290IENBMSwwKgYDVQQLEyNw +YXlzYWZlY2FyZCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEmMCQGA1UEChMdcGF5 +c2FmZWNhcmQuY29tIFdlcnRrYXJ0ZW4gQUcxJzAlBgNVBAMTHnBheXNhZmVjYXJk +IFJvb3QgQ0EgLSBTeXN0ZW0gTTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBALtYbwxejm8ZTdZmvLG1TtVHMGyIVnTFeyIbt7SUP4GjycrFs0GiWCJzYHAX +gEtwzIX3ibt3bIR62/itJ4ra/pkIUBDd1ARNM1F9R/MyE3Ci1SGmp1IyaFK2tQRX +dxHqIBZtH6hUSK750mxE9Ln+YjHjbkEnvXB49qIyJsvgQSPrvzldj+bBDpNyCppf +H16U55azIpq7gWvyqsFe/NeAp8iW8quhgZQWqXhPFMA/dypcwBwSTJSW/jVqfqhd +iRhEfZEeV6pBPtaZeeUUvWBgBccr39sQd3FUADH7d7AepxsiIxTDm971wn9bNiOM +YwCdfQlEYLlAhEc3XMRv5Mifnp8CAwEAAaOCAVYwggFSMA8GA1UdEwEB/wQFMAMB +Af8wHQYDVR0OBBYEFEdDEuV3HVe81QNu5wgYE/h2K14EMIIBHgYDVR0jBIIBFTCC +ARGAFEdDEuV3HVe81QNu5wgYE/h2K14EoYH1pIHyMIHvMSEwHwYJKoZIhvcNAQkB +FhJjYUBwYXlzYWZlY2FyZC5jb20xCzAJBgNVBAYTAkFUMQ8wDQYDVQQIEwZWaWVu +bmExDzANBgNVBAcTBlZpZW5uYTEcMBoGA1UECxMTcGF5c2FmZWNhcmQgUm9vdCBD +QTEsMCoGA1UECxMjcGF5c2FmZWNhcmQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkx +JjAkBgNVBAoTHXBheXNhZmVjYXJkLmNvbSBXZXJ0a2FydGVuIEFHMScwJQYDVQQD +Ex5wYXlzYWZlY2FyZCBSb290IENBIC0gU3lzdGVtIE2CAQAwDQYJKoZIhvcNAQEE +BQADggEBACJ9nG6+DmSxJKoqyCDaBUTCeVWk1jpBAvxR1Nwq68L25VYqWp8M0x74 +/Wd/rcut532BaStABiba+P5V4/VpV4cYlExPb2CCr1E3BWd9nMaJEqjFOdNfy2Aq +OZhTeKqKZ0oALhk61AdX7OmimW2DGe7jwEbZxtjcUBUMo+olSAqDD/oVmOLooQOE +oCHQ7U/+PFHtzO9Im7Jlq0fJESJSRheSbjItZSJxl18neu3xN58Ku9Pnu4pInyM+ +ObX4TJxmBbyRXlBkWfDWljih9MANqE/XkwOE3BlAt2haymRs/GSYiIWqNwTd2Rbx +NwdV0sBoOmFmSMNt7/NhXIT6GO3hFK4= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIFujCCBKKgAwIBAgIEEAAAAzANBgkqhkiG9w0BAQQFADCB7zEhMB8GCSqGSIb3 +DQEJARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UECBMG +Vmllbm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJkIFJv +b3QgQ0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0aG9y +aXR5MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEnMCUG +A1UEAxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBNMB4XDTAyMDExMDE1 +MjE1OVoXDTM0MDExMDE1MjE1OVowgfMxITAfBgkqhkiG9w0BCQEWEmNhQHBheXNh +ZmVjYXJkLmNvbTELMAkGA1UEBhMCQVQxDzANBgNVBAgTBlZpZW5uYTEPMA0GA1UE +BxMGVmllbm5hMR4wHAYDVQQLExVwYXlzYWZlY2FyZCBTZXJ2ZXIgQ0ExLDAqBgNV +BAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MSYwJAYDVQQK +Ex1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEpMCcGA1UEAxMgcGF5c2Fm +ZWNhcmQgU2VydmVyIENBIC0gU3lzdGVtIE0wggEiMA0GCSqGSIb3DQEBAQUAA4IB +DwAwggEKAoIBAQCySPf9dV1J73WgihZzq6PuFZw8G+5YgCG7KVvmm/unkabEHzQ7 +PKfHT0awGRfZgfsRzbLxnohaXDHE8e2whWjV5ZROXKpeYb7MhFcmPdPAuxx6lPD9 +jocbEA530vTonL3WrAPY9P4v48Upd8xTKy+HmdruBn80tOwnvJeSH+2Itm2Qo6cU +JslOxJYqmIu76aNbh/Is37rZV37zegkNr7RVpE82tUZR8CRnY46f+FrYEJYpZRVc +hg9NOM6fmswG7BAP4oLXOjOERR79Rom/ACZZNcz1PSBJRIarm2eXLUptlTfTR1lb +92wX+KGtYvcLFnr/2RkHDT2Wdcb8s3pI7bhxAgMBAAGjggFWMIIBUjAPBgNVHRMB +Af8EBTADAQH/MB0GA1UdDgQWBBTNjfh4N1yNw7Bo/E0sMOrdcZbJ8TCCAR4GA1Ud +IwSCARUwggERgBRHQxLldx1XvNUDbucIGBP4diteBKGB9aSB8jCB7zEhMB8GCSqG +SIb3DQEJARYSY2FAcGF5c2FmZWNhcmQuY29tMQswCQYDVQQGEwJBVDEPMA0GA1UE +CBMGVmllbm5hMQ8wDQYDVQQHEwZWaWVubmExHDAaBgNVBAsTE3BheXNhZmVjYXJk +IFJvb3QgQ0ExLDAqBgNVBAsTI3BheXNhZmVjYXJkIENlcnRpZmljYXRpb24gQXV0 +aG9yaXR5MSYwJAYDVQQKEx1wYXlzYWZlY2FyZC5jb20gV2VydGthcnRlbiBBRzEn +MCUGA1UEAxMecGF5c2FmZWNhcmQgUm9vdCBDQSAtIFN5c3RlbSBNggEAMA0GCSqG +SIb3DQEBBAUAA4IBAQAZ7naLoETGD8TW6lAbuZ7ntd9zNqutizAtPzC5bJRq2sL3 +AyIsSDO6jQnJgvHsW3XiBfYP0R8MGbMg5cLvgcyKHjnpkzcGEXFuvOeeh50oWSTl +aJ9VNTvvGK6nY4rQ710I6qCollj+pqlSq4sak/zYJ87lKc8TXEzvzyncYAfrRp3G +XIA5zG3TniBIYC/cuiXjBupmWelFCKRK8/Uhm0vbg71wAWrouJKcBkSMYgZCdEC6 +3g0EBmD94j9FBEiW7q4sUgqYxGTjeOv1Wb4EsHJhq2eBzOKLp+NHYbPzI++50nQU +AjKavlzdAr9PVC8BBS74M567rtIooeIgEDqqi/7J +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDfjCCAuegAwIBAgIQAdAC7XDZlmGZ84pH2aljUjANBgkqhkiG9w0BAQUFADCB +zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ +Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE +CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh +d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl +cnZlckB0aGF3dGUuY29tMB4XDTA2MTAyNTAwMDAwMFoXDTA4MTAyNDIzNTk1OVow +gYIxCzAJBgNVBAYTAkFUMQ8wDQYDVQQIEwZWaWVubmExDzANBgNVBAcTBlZpZW5u +YTEmMCQGA1UEChMdcGF5c2FmZWNhcmQuY29tIFdlcnRrYXJ0ZW4gQUcxKTAnBgNV +BAMTIGN1c3RvbWVyLnRlc3QuYXQucGF5c2FmZWNhcmQuY29tMIGfMA0GCSqGSIb3 +DQEBAQUAA4GNADCBiQKBgQDgay0tcil7faWjhcRYg4HvOt9DA6llt87cxZtkGalY +Fvxr+tKLg2U031cbmQjRpCEXIWeZjIqOreZLK3PNYfQJi7C3m7bU2D8owt6xijt4 +reOsNH5nTy4NNt9J+tUVaRO0YCWG7O2v1T1L4QMwdHjHcsvpoO9NnFM/Sqmo8tSz +EwIDAQABo4GmMIGjMAwGA1UdEwEB/wQCMAAwQAYDVR0fBDkwNzA1oDOgMYYvaHR0 +cDovL2NybC50aGF3dGUuY29tL1RoYXd0ZVNlcnZlclByZW1pdW1DQS5jcmwwHQYD +VR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMDIGCCsGAQUFBwEBBCYwJDAiBggr +BgEFBQcwAYYWaHR0cDovL29jc3AudGhhd3RlLmNvbTANBgkqhkiG9w0BAQUFAAOB +gQBzovJPMRON4GSrPeAZ93nDYHHfZMV2yUY0+8Kfi+5smLfV3VaurPjL8WSYA2mY +F1vI2tkNhAbELQwm/6RqrU7AG1wKnoyljzZ9V0Uk7Mfcw3Wg/uCTEtes9NNz6KbW +RM9X8CWd8gJGwTODZy4JU0qMWiETqPvbvzXTX0oihp2nEQ== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDfDCCAuWgAwIBAgIQWAYuIHYD1tplIr6DdfOxoDANBgkqhkiG9w0BAQUFADCB +zjELMAkGA1UEBhMCWkExFTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJ +Q2FwZSBUb3duMR0wGwYDVQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UE +CxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhh +d3RlIFByZW1pdW0gU2VydmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNl +cnZlckB0aGF3dGUuY29tMB4XDTA2MTAyNTAwMDAwMFoXDTA4MTAyNDIzNTk1OVow +gYAxCzAJBgNVBAYTAkFUMQ8wDQYDVQQIEwZWaWVubmExDzANBgNVBAcTBlZpZW5u +YTEmMCQGA1UEChMdcGF5c2FmZWNhcmQuY29tIFdlcnRrYXJ0ZW4gQUcxJzAlBgNV +BAMTHmN1c3RvbWVyLmNjLmF0LnBheXNhZmVjYXJkLmNvbTCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEAs1G3ieyBRUxgDLUAlqipvBtnlsb7W0TqcXYY9MF/XOyp +1KoS6xKcH6dV1PYGUi8roITcEPB2VBnR2lCpqjUwhmeJcXf2sJLIInf0J0ld05qE +G8I6tHh8DOylkN+G9NdbdWsHyQLxiqQ1TkLIAX28ioJziLVSJ0AU/Vw5MSj3x+UC +AwEAAaOBpjCBozAMBgNVHRMBAf8EAjAAMEAGA1UdHwQ5MDcwNaAzoDGGL2h0dHA6 +Ly9jcmwudGhhd3RlLmNvbS9UaGF3dGVTZXJ2ZXJQcmVtaXVtQ0EuY3JsMB0GA1Ud +JQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjAyBggrBgEFBQcBAQQmMCQwIgYIKwYB +BQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0ZS5jb20wDQYJKoZIhvcNAQEFBQADgYEA +dLrNu1On6Vp5JWdeFmA0wZjrvbVSXmH3fGuuY5pw+RDDq5AVZ0ug5AoNO90DkAn5 +7s1zOelLs1imjS1MpPKOs7jgC+kbzW/PRFfY1oYSHZdSQGfmTjdz3PtT3XVWMmne +z4cv4RYpEiZrkrxL/fdd36E/Lo0GctmhlXBT7SiNM0g= +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy +dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t +MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB +MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG +A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl +cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE +VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ +ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR +uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG +9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI +hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM +pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIICPDCCAaUCEHC65B0Q2Sk0tjjKewPMur8wDQYJKoZIhvcNAQECBQAwXzELMAkG +A1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFz +cyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTk2 +MDEyOTAwMDAwMFoXDTI4MDgwMTIzNTk1OVowXzELMAkGA1UEBhMCVVMxFzAVBgNV +BAoTDlZlcmlTaWduLCBJbmMuMTcwNQYDVQQLEy5DbGFzcyAzIFB1YmxpYyBQcmlt +YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIGfMA0GCSqGSIb3DQEBAQUAA4GN +ADCBiQKBgQDJXFme8huKARS0EN8EQNvjV69qRUCPhAwL0TPZ2RHP7gJYHyX3KqhE +BarsAx94f56TuZoAqiN91qyFomNFx3InzPRMxnVx0jnvT0Lwdd8KkMaOIG+YD/is +I19wKTakyYbnsZogy1Olhec9vn2a/iRFM9x2Fe0PonFkTGUugWhFpwIDAQABMA0G +CSqGSIb3DQEBAgUAA4GBALtMEivPLCYATxQT3ab7/AoRhIzzKBxnki98tsX63/Do +lbwdj2wsqFHMc9ikwFPwTtYmwHYBV4GSXiHx0bH/59AhWM1pF+NEHJwZRDmJXNyc +AA9WjQKZ7aKQRUzkuxCkPfAyAw7xzvjoyVGM5mKf5p/AfbdynMk2OmufTqj/ZA1k +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIDhjCCAu+gAwIBAgIQeO5I3hhbIHHJycO1HXvdwTANBgkqhkiG9w0BAQUFADBfMQswCQYD +VQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xNzA1BgNVBAsTLkNsYXNzIDMgUHVi +bGljIFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNOTcwNDE3MDAwMDAwWhcN +MTExMDI0MjM1OTU5WjCBujEfMB0GA1UEChMWVmVyaVNpZ24gVHJ1c3QgTmV0d29yazEXMBUG +A1UECxMOVmVyaVNpZ24sIEluYy4xMzAxBgNVBAsTKlZlcmlTaWduIEludGVybmF0aW9uYWwg +U2VydmVyIENBIC0gQ2xhc3MgMzFJMEcGA1UECxNAd3d3LnZlcmlzaWduLmNvbS9DUFMgSW5j +b3JwLmJ5IFJlZi4gTElBQklMSVRZIExURC4oYyk5NyBWZXJpU2lnbjCBnzANBgkqhkiG9w0B +AQEFAAOBjQAwgYkCgYEA2IKA6NYZAn0fhRg5JaJlK+G/1AXTvOY2O6rwTGxbtueqPHNFVbLx +veqXQu2aNAoV1Klc9UAl3dkHwTKydWzEyruj/lYncUOqY/UwPpMo5frxCTvzt01OOfdcSVq4 +wR3Tsor+cDCVQsv+K1GLWjw6+SJPkLICp1OcTzTnqwSye28CAwEAAaOB5jCB4zAPBgNVHRME +CDAGAQH/AgEAMEQGA1UdIAQ9MDswOQYLYIZIAYb4RQEHAQEwKjAoBggrBgEFBQcCARYcaHR0 +cHM6Ly93d3cudmVyaXNpZ24uY29tL0NQUzA0BgNVHR8ELTArMCmgJ6AlhiNodHRwOi8vY3Js +LnZlcmlzaWduLmNvbS9wY2EzLWcyLmNybDA0BgNVHSUELTArBggrBgEFBQcDAQYIKwYBBQUH +AwIGCWCGSAGG+EIEAQYKYIZIAYb4RQEIATALBgNVHQ8EBAMCAQYwEQYJYIZIAYb4QgEBBAQD +AgEGMA0GCSqGSIb3DQEBBQUAA4GBACNd7qYkBf1202oa1rpGBqpqDwOQZrKwpsKeyR6jVVOv +PkX93Iwn3VM4Cbt8Syu6lUr+cE4badY8908HxfIXWkyij6wLigbbudRrxR1Y2hdS4yHx0tda +1eWrWXsheoZq1P4XETpTDZxgoErZXuQdDCmqEwdlhh+/tMmCU5wsAo8j +-----END CERTIFICATE----- + diff --git a/modules/paysafecard/logo.gif b/modules/paysafecard/logo.gif new file mode 100755 index 00000000..68596385 Binary files /dev/null and b/modules/paysafecard/logo.gif differ diff --git a/modules/paysafecard/payment.php b/modules/paysafecard/payment.php new file mode 100755 index 00000000..aeb658ed --- /dev/null +++ b/modules/paysafecard/payment.php @@ -0,0 +1,102 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8108 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +include(dirname(__FILE__).'/../../config/config.inc.php'); +include(dirname(__FILE__).'/../../init.php'); +include(dirname(__FILE__).'/paysafecard.php'); + +$module = new PaysafeCard(); + +if (!$cart->id OR $cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$module->active) + Tools::redirect('order.php?step=3'); + +$currency = new Currency($cart->id_currency); +if (!$module->isCurrencyActive($currency->iso_code)) + Tools::redirect('order.php?step=3'); + +$amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.',''); +if (Tools::getValue('hash') != md5(Configuration::get($module->prefix.'SALT') + $amount + $currency->iso_code)) + die(Tools::displayError()); + +$result = $module->getDispositionState((int)($cart->id)); +$state = Configuration::get('PS_OS_ERROR'); + +$disposition = PSCDisposition::getByCartId((int)($cart->id)); + +$message = 'Transaction ID #'.$disposition['mtid'].': '.$disposition['amount'].$disposition['currency'].'
'. date('Y-m-d').' '; +if ($result[0] == 0) +{ + list ($rc, $errorcode, $error_message, $amount, $used_currency, $state) = $result; + + if ($state == PSCPrepaidServicesAPI::DISPOSITION_DISPOSED || $state == PSCPrepaidServicesAPI::DISPOSITION_DEBITED) + { + $state = Configuration::get('PS_OS_PAYMENT'); + $message .= $module->getL('disposition_created'); + } else { + $message .= $module->getL('disposition_invalid').' '.$state; + } +} else { + $message .= 'payment_error'.' '.$result[2]; +} + +if ($state != Configuration::get('PS_OS_ERROR')) +{ + $state = (int)(Configuration::get($module->prefix.'ORDER_STATE_ID')); + + if (Configuration::get($module->prefix.'IMMEDIAT_PAYMENT')) + { + $message .= '
'.date('Y-m-d').' '; + $result = $module->executeDebit((int)($cart->id)); + + if ($result[0] != 0) + { + $message .= $module->getL('payment_error').' '.$result[2]; + $state = Configuration::get('PS_OS_ERROR'); + } + else + { + $message .= $module->getL('payment_accepted'); + $state = Configuration::get('PS_OS_PAYMENT'); + } + } +} + +$module->validateOrder((int)($cart->id), $state, (float)($cart->getOrderTotal(true, Cart::BOTH)), $module->displayName, $message, NULL, (int)($currency->id), false, $cart->secure_key); + +if ($state == Configuration::get('PS_OS_ERROR')) +{ + include(dirname(__FILE__).'/../../header.php'); + echo $message; + include(dirname(__FILE__).'/../../footer.php'); +} +else +{ + $order = new Order($module->currentOrder); + Tools::redirect('order-confirmation.php?id_cart='.(int)($cart->id).'&id_module='.(int)($module->id).'&id_order='.(int)($module->currentOrder).'&key='.$order->secure_key); +} + + + diff --git a/modules/paysafecard/payment.tpl b/modules/paysafecard/payment.tpl new file mode 100755 index 00000000..a9ef6f73 --- /dev/null +++ b/modules/paysafecard/payment.tpl @@ -0,0 +1,32 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +

+ + + {l s='Pay with' mod='paysafecard'} {$payment_name} + +

diff --git a/modules/paysafecard/paysafecard-accept-payment.tpl b/modules/paysafecard/paysafecard-accept-payment.tpl new file mode 100755 index 00000000..df20bf7b --- /dev/null +++ b/modules/paysafecard/paysafecard-accept-payment.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
+
+ {$payment_name} + {if $error} + {$error} + {/if} + +

{l s='Payment has not been accepted yet:' mod='paysafecard'}

+

+

+ {$currency} + + +
+

+
+ diff --git a/modules/paysafecard/paysafecard-confirmation.tpl b/modules/paysafecard/paysafecard-confirmation.tpl new file mode 100755 index 00000000..0d871132 --- /dev/null +++ b/modules/paysafecard/paysafecard-confirmation.tpl @@ -0,0 +1,32 @@ +{* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +

{l s='Your order on' mod='paysafecard'} {$shop_name} {l s='is complete.' mod='paysafecard'} +

+ {l s='You have chosen the' mod='paysafecard'} {$payment_name} {l s='method.' mod='paysafecard'} +

{l s='Your order will be sent very soon.' mod='paysafecard'} +

{l s='For any questions or for further information, please contact our' mod='paysafecard'} {l s='customer support' mod='paysafecard'}. +

diff --git a/modules/paysafecard/paysafecard.php b/modules/paysafecard/paysafecard.php new file mode 100755 index 00000000..4690b1e9 --- /dev/null +++ b/modules/paysafecard/paysafecard.php @@ -0,0 +1,127 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 8063 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +if (!defined('_PS_VERSION_')) + exit; + +include_once(_PS_MODULE_DIR_.'paysafecard/PrepaidServices.php'); + +class PaysafeCard extends PSCPrepaidServices +{ + public $prefix = 'PS_PSC_'; + protected $supported_languages = array('de', 'en', 'gr', 'el', 'es', 'it', 'fr', 'nl', 'pl', 'pt', 'si', 'sk', 'tr'); + protected $allowed_currencies = array(); + + protected $environments = array('P' => 'Production', + 'T' => 'Test'); + + protected $business_types = array('I' => 'Intangible', + 'T' => 'Tangible'); + + protected $payment_url = array('T' =>'https://customer.test.at.paysafecard.com/psccustomer/GetCustomerPanelServlet', + 'P' => 'https://customer.cc.at.paysafecard.com/psccustomer/GetCustomerPanelServlet'); + + protected $supported_currencies = array('EUR', 'GBP', 'CHF', 'USD', 'PLN', 'CZK', 'SEK', 'DKK', 'RON', 'NOK', 'ARS'); + + protected $register_url = array('en' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=8', + 'fr' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=3', + 'es' => 'http://www.prestashop.com/partner/url.php?to=http://www.paysafecard.com/index.php?id=947&L=9'); + + + protected $certificat_dir; + + public function __construct() + { + $this->name = 'paysafecard'; + $this->tab = 'payments_gateways'; + $this->version = '1.3'; + $this->module_dir = dirname(__FILE__); + $this->certificat_dir = dirname(__FILE__).'/keyring/'; + $this->need_instance = 0; + + parent::__construct(); + + $this->displayName = $this->l('PaysafeCard'); + $this->description = $this->l('Accepts payments by PaysafeCard.'); + + /* For 1.4.3 and less compatibility */ + $updateConfig = array('PS_OS_CHEQUE', 'PS_OS_PAYMENT', 'PS_OS_PREPARATION', 'PS_OS_SHIPPING', 'PS_OS_CANCELED', 'PS_OS_REFUND', 'PS_OS_ERROR', 'PS_OS_OUTOFSTOCK', 'PS_OS_BANKWIRE', 'PS_OS_PAYPAL', 'PS_OS_WS_PAYMENT'); + if (!Configuration::get('PS_OS_PAYMENT')) + foreach ($updateConfig as $u) + if (!Configuration::get($u) && defined('_'.$u.'_')) + Configuration::updateValue($u, constant('_'.$u.'_')); + } + + public function getL($key) + { + $translations = array( + 'disposition_created' => $this->l('Disposition created. Waiting for debit.'), + 'disposition_invalid' => $this->l('Invalid disposition state:'), + 'payment_error' => $this->l('An error has occurred during payment:'), + 'payment_accepted' => $this->l('Payment accepted.'), + 'curl_required' => $this->l('This module requires the curl PHP extension to function properly.'), + 'not_writable' => $this->l('Not writable!'), + 'currency_required' => $this->l('This module requires the currency: '), + 'configure_currency' => $this->l('Configure each currency individually:'), + 'payment_not_displayed' => $this->l('(The payment module will not be displayed for customers using non configured currency.)'), + 'configuration_in' => $this->l('Configuration in '), + 'merchant_id' => $this->l('Merchant ID'), + 'keyring_certificate' => $this->l('Keyring Certificate'), + 'keyring_pw' => $this->l('Keyring PW'), + 'configuration' => $this->l('Configuration'), + 'environment' => $this->l('Environment'), + 'business_type' => $this->l('Business Type'), + 'immediat_payment' => $this->l('Immediate Payment'), + 'update_configuration' => $this->l('Update configuration'), + 'certificate_required' => $this->l('You must provide a certificate for MERCHANT ID'), + 'invalid_file' => $this->l('Invalid file'), + 'invalid_merchant_id' => $this->l('Invalid Merchant ID'), + 'invalid_business_type' => $this->displayError('Invalid business type'), + 'invalid_environment' => $this->displayError('Invalid environment'), + 'settings_updated' => $this->l('Settings updated'), + 'file_partialy_uploaded' => $this->l('The file was partially uploaded.'), + 'file_empty' => $this->l('The file is empty.'), + 'cant_create_dispo' => $this->l('Transaction could not be initiated due to connection problems. If the problem persists, please contact support.'), + 'disposition_consumed' => $this->l('Disposition consumed'), + 'payment_released' => $this->l('Disposition released'), + 'release_error' => $this->l('An error has occurred during the release'), + 'introduction' => $this->l('Paysafecard is Europe’s first prepaid solution for payments over the Internet to comply with banking laws. Over the past years, paysafecard has become one of Europe’s leading alternative online payment solutions.'), + 'register' => $this->l('Learn more') + ); + + return $translations[$key]; + } + + protected function _getErrorMsgFromErrorCode($error_code) + { + $error_msg = array(1 => $this->l('An error has occurred, check Messages for more info'), + 2 => $this->l('Invalid amount')); + + return $error_msg[$error_code]; + } +} + diff --git a/modules/paysafecard/prepaidservices.js b/modules/paysafecard/prepaidservices.js new file mode 100755 index 00000000..cd5a5dd5 --- /dev/null +++ b/modules/paysafecard/prepaidservices.js @@ -0,0 +1,38 @@ +/* +* 2007-2011 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +function toggleImediatPayment() +{ + if ($('#ct_business_type').val() == 'I') + $('#imediat_payment').hide(); + else + $('#imediat_payment').show(); +} + +$(document).ready(function() { + toggleImediatPayment(); +}); + diff --git a/modules/paysafecard/redirect.php b/modules/paysafecard/redirect.php new file mode 100755 index 00000000..cfe8e7a5 --- /dev/null +++ b/modules/paysafecard/redirect.php @@ -0,0 +1,50 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 6594 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ +include(dirname(__FILE__).'/../../config/config.inc.php'); +include(dirname(__FILE__).'/../../init.php'); +include(dirname(__FILE__).'/paysafecard.php'); + +$module = new PaysafeCard(); + +if (!$cart->id OR $cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$module->active) + Tools::redirect('order.php?step=3'); + +$currency = new Currency($cart->id_currency); +if (!$module->isCurrencyActive($currency->iso_code)) + Tools::redirect('order.php?step=3'); + +$result = $module->createDisposition($cart); + +if ($result['return_code'] != 0) +{ + include(dirname(__FILE__).'/../../header.php'); + echo $module->getL('cant_create_dispo'); + include(dirname(__FILE__).'/../../footer.php'); +} +else + Tools::redirectLink($result['message']); + diff --git a/modules/prestafraud/de.php b/modules/prestafraud/de.php new file mode 100755 index 00000000..eafbc585 --- /dev/null +++ b/modules/prestafraud/de.php @@ -0,0 +1,65 @@ +prestafraud_eed029a9cfe78c1230a654e58fe8b6f8'] = 'PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_95d311a37e934646eec0c79c4f266feb'] = 'Schützen Sie Ihr Shop gegen betrügerischen Zahlungen'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4d0a6a9777a818ecc3b59b9a8ecd0c43'] = '- Bitte wählen Sie Ihre Haupttätigkeit -'; +$_MODULE['<{prestafraud}prestashop>prestafraud_5a600f5b88f416c470991c6831add13a'] = 'Erwachsene'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0fe4ca3df29658482098bb33a2ff66e5'] = 'Tiere und Haustiere'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9e4359f35054190eba36e09466e39d01'] = 'Kunst und Kultur'; +$_MODULE['<{prestafraud}prestashop>prestafraud_066cd752c82ddc6231a9723b5822a945'] = 'Babys'; +$_MODULE['<{prestafraud}prestashop>prestafraud_41a081c3f3042ac40117cf295350870d'] = 'Schönheit und Körperpflege'; +$_MODULE['<{prestafraud}prestashop>prestafraud_f2b545a8abb14f8706f808a79277c061'] = 'KFZ'; +$_MODULE['<{prestafraud}prestashop>prestafraud_39bb2fdc532f8984d8348863c86ebfca'] = 'Computer Hardware und Software'; +$_MODULE['<{prestafraud}prestashop>prestafraud_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Download'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8bdd8b2357d516da5b81eb16746ba9a9'] = 'Mode und Accessoires'; +$_MODULE['<{prestafraud}prestashop>prestafraud_33cb31c5505618a808d3bcd7490a793c'] = 'Blumen, Geschenke und Kunsthandwerk'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0570b6d9de5c37a026e69c6987fc27f6'] = 'Nahrungsmittel und Getränke'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4b73b8913afcdf06d9f49c176306d950'] = 'HiFi, Foto und Video'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2e9d6500d9b2a65985a621f0f0afdeb3'] = 'Haus und Garten'; +$_MODULE['<{prestafraud}prestashop>prestafraud_83dd3493957bcd92a37bc39111f670b8'] = 'Haushaltsgeräte'; +$_MODULE['<{prestafraud}prestashop>prestafraud_565631402af79df42f22a117b0d6f1a5'] = 'Schmuck'; +$_MODULE['<{prestafraud}prestashop>prestafraud_18848d605251b3627014c6a58c14c449'] = 'Mobile Geräte und Telekommunikation'; +$_MODULE['<{prestafraud}prestashop>prestafraud_992a0f0542384f1ee5ef51b7cf4ae6c4'] = 'Dienstleistungen'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4ef7205b13f6821177d0dbc2fb90f79e'] = 'Schuhe und Zubehör'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9503054261b8aeed48e0a3902019b579'] = 'Sport und Unterhaltung'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1fb0f99b55e6c2be35aed72ebe38c245'] = 'Reisen'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3e0deb2f1df28a6a13c9c18cc0e1c755'] = 'Scheck'; +$_MODULE['<{prestafraud}prestashop>prestafraud_35b4b09d5d0686ec5c2e2cc9f3d9039c'] = 'Banküberweisung'; +$_MODULE['<{prestafraud}prestashop>prestafraud_e7f9e382dc50889098cbe56f2554c77b'] = 'Kreditkarte'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1cf575079afed29675c47e822bc3d493'] = 'mehrere Kreditkarten'; +$_MODULE['<{prestafraud}prestashop>prestafraud_75b95ea268cb6b5baf7483aafa80d5ad'] = 'Prepaid-Konto (Moneybookers, PayPal, ...)'; +$_MODULE['<{prestafraud}prestashop>prestafraud_688000bea2f79c9ca3d2d1755456024f'] = 'Bitte akzeptieren Sie die Nutzungsbedingungen.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8dc42e0ea3bedd2c1cc400141540cf62'] = 'PrestaShop Security Konfiguration'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7e97953add2f27fce07653151ba3e862'] = 'Mein Shop hat noch kein Konto auf PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3b2aee63259f6dc9b94914884474f8de'] = 'Ich habe bereits ein Konto'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9d5c4ae518b30bacdb69912d87b3406a'] = 'Ihre E-Mail:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_6c3b9b51615d1d57773f25903da2018c'] = 'Shop URL:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_432dc11f749f7a5ea483a3c71e34e119'] = 'Ich bin mit den Prestashop Datenschutzbestimmungen einverstanden'; +$_MODULE['<{prestafraud}prestashop>prestafraud_42369faa6a6b243aac58683f3874bf99'] = 'Konto erstellen'; +$_MODULE['<{prestafraud}prestashop>prestafraud_212713efb37cd2f521ee584f1dbb5f0b'] = 'Shop-ID:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c6b84387320705147af2f9e79d72c6fc'] = 'Shop SCHLÜSSEL:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b51cb26e6b60a3ff585ab9f757495c52'] = 'Shop-Aktivität:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ab8cba13a061fe8d4a330bcc8d6b0175'] = 'Lieferanten:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_914419aa32f04011357d3b604a86d7eb'] = 'Lieferant'; +$_MODULE['<{prestafraud}prestashop>prestafraud_fecb07f7ab46e23e9b520a9a9af7b97b'] = 'Lieferantenart'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b04ad61ad875f6e7149fdd51c2e60ce2'] = 'Wählen Sie eine Lieferantenart...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2edfe3cd8034975c073e23158e976428'] = 'Zahlungen:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ec51b543e5a38f6044c83f21dce2b23d'] = 'Zahlungs-Modul'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7c9a3504dd4ce74b8021267ae1802968'] = 'Zahlungsart'; +$_MODULE['<{prestafraud}prestashop>prestafraud_827638f0be5ae74be04ed494087de714'] = 'Wählen Sie eine Zahlungsart ...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c9cc8cce247e49bae79f15173ce97354'] = 'Speichern'; +$_MODULE['<{prestafraud}prestashop>prestafraud_16648260e58b4cf9d458e1a197ef43f1'] = 'E-Mail ist ungültig'; +$_MODULE['<{prestafraud}prestashop>prestafraud_cb18f4dc13847e2ed5d69cb936f9b26c'] = 'Shop-URL ist ungültig'; +$_MODULE['<{prestafraud}prestashop>prestafraud_950c093b260d7c7709f8ff96e10a6fe0'] = 'Diese Bestellung wurde hat nicht an PrestaShop Security gesandt.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_d0c6a2fa938df84c0ce628de99c97e16'] = 'Wertung:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_88183b946cc5f0e8c96b2e66e1c74a7e'] = 'Unbekannt'; +$_MODULE['<{prestafraud}prestashop>prestafraud_240f3031f25601fa128bd4e15f0a37de'] = 'Kommentar:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b88011726eba59d6bf37f0fdec202edc'] = 'Diese Bestellung als Betrug an PrestaShop melden'; +$_MODULE['<{prestafraud}prestashop>prestafraud_a8bbb000124c9697aa5d63e7e758b64d'] = 'Geschäftsabholung'; +$_MODULE['<{prestafraud}prestashop>prestafraud_08eb31af908e2244867f6e812f82e935'] = 'Abholungspunkt'; +$_MODULE['<{prestafraud}prestashop>prestafraud_880f973e4ddae42c6bebd2c31bb977f8'] = 'Langsamer Versand mehr als 3 Tage'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b61de91e556aee84e83c3fde8ef67ddc'] = 'Express-Versand'; + +?> \ No newline at end of file diff --git a/modules/prestafraud/en.php b/modules/prestafraud/en.php new file mode 100755 index 00000000..601358d4 --- /dev/null +++ b/modules/prestafraud/en.php @@ -0,0 +1,4 @@ +prestafraud_eed029a9cfe78c1230a654e58fe8b6f8'] = 'PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_95d311a37e934646eec0c79c4f266feb'] = 'Proteja su tienda de pagos fraudulentos'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4d0a6a9777a818ecc3b59b9a8ecd0c43'] = '- Por favor, elija su actividad principal -'; +$_MODULE['<{prestafraud}prestashop>prestafraud_5a600f5b88f416c470991c6831add13a'] = 'Adultos'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0fe4ca3df29658482098bb33a2ff66e5'] = 'Animales y animales domésticos'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9e4359f35054190eba36e09466e39d01'] = 'Arte y Cultura'; +$_MODULE['<{prestafraud}prestashop>prestafraud_066cd752c82ddc6231a9723b5822a945'] = 'Bebés'; +$_MODULE['<{prestafraud}prestashop>prestafraud_41a081c3f3042ac40117cf295350870d'] = 'Belleza e higiene personal'; +$_MODULE['<{prestafraud}prestashop>prestafraud_f2b545a8abb14f8706f808a79277c061'] = 'Automóviles'; +$_MODULE['<{prestafraud}prestashop>prestafraud_39bb2fdc532f8984d8348863c86ebfca'] = 'Material informático y softwares'; +$_MODULE['<{prestafraud}prestashop>prestafraud_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Descargas'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8bdd8b2357d516da5b81eb16746ba9a9'] = 'Moda y complementos'; +$_MODULE['<{prestafraud}prestashop>prestafraud_33cb31c5505618a808d3bcd7490a793c'] = 'Flores, regalos y artesanía'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0570b6d9de5c37a026e69c6987fc27f6'] = 'Alimentación y bebidas'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4b73b8913afcdf06d9f49c176306d950'] = 'HiFi, Foto y Vídeo'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2e9d6500d9b2a65985a621f0f0afdeb3'] = 'Casa y Jardín'; +$_MODULE['<{prestafraud}prestashop>prestafraud_83dd3493957bcd92a37bc39111f670b8'] = 'Home Appliances'; +$_MODULE['<{prestafraud}prestashop>prestafraud_565631402af79df42f22a117b0d6f1a5'] = 'Joyas'; +$_MODULE['<{prestafraud}prestashop>prestafraud_18848d605251b3627014c6a58c14c449'] = 'Móviles y Telefonía'; +$_MODULE['<{prestafraud}prestashop>prestafraud_992a0f0542384f1ee5ef51b7cf4ae6c4'] = 'Servicios'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4ef7205b13f6821177d0dbc2fb90f79e'] = 'Calzado y Complementos'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9503054261b8aeed48e0a3902019b579'] = 'Deporte y Ocio'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1fb0f99b55e6c2be35aed72ebe38c245'] = 'Viajes'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3e0deb2f1df28a6a13c9c18cc0e1c755'] = 'Cheque'; +$_MODULE['<{prestafraud}prestashop>prestafraud_35b4b09d5d0686ec5c2e2cc9f3d9039c'] = 'Transferencia bancaria'; +$_MODULE['<{prestafraud}prestashop>prestafraud_e7f9e382dc50889098cbe56f2554c77b'] = 'Tarjeta de crédito'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1cf575079afed29675c47e822bc3d493'] = 'Tarjeta de crédito en varias veces'; +$_MODULE['<{prestafraud}prestashop>prestafraud_75b95ea268cb6b5baf7483aafa80d5ad'] = 'Cuenta prepagada (MoneyBookers, PayPal,...)'; +$_MODULE['<{prestafraud}prestashop>prestafraud_688000bea2f79c9ca3d2d1755456024f'] = 'Debe aceptar las condiciones del servicio'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8dc42e0ea3bedd2c1cc400141540cf62'] = 'Confuguración de PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7e97953add2f27fce07653151ba3e862'] = 'Mi tienda aún no dispone de cuenta en PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3b2aee63259f6dc9b94914884474f8de'] = 'Ya tengo una cuenta'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9d5c4ae518b30bacdb69912d87b3406a'] = 'Su email:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_6c3b9b51615d1d57773f25903da2018c'] = 'URL de la tienda:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_432dc11f749f7a5ea483a3c71e34e119'] = 'He leido las condiciones de servicio PrestaShop Security y las acepto sin condiciones'; +$_MODULE['<{prestafraud}prestashop>prestafraud_42369faa6a6b243aac58683f3874bf99'] = 'Crear una cuenta'; +$_MODULE['<{prestafraud}prestashop>prestafraud_212713efb37cd2f521ee584f1dbb5f0b'] = 'ID de la tienda:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c6b84387320705147af2f9e79d72c6fc'] = 'Clave de la tienda:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b51cb26e6b60a3ff585ab9f757495c52'] = 'Actividad de la tienda:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ab8cba13a061fe8d4a330bcc8d6b0175'] = 'Transportistas:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_914419aa32f04011357d3b604a86d7eb'] = 'Transportista'; +$_MODULE['<{prestafraud}prestashop>prestafraud_fecb07f7ab46e23e9b520a9a9af7b97b'] = 'Tipo de transportista'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b04ad61ad875f6e7149fdd51c2e60ce2'] = 'Elija un tipo de transportista...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2edfe3cd8034975c073e23158e976428'] = 'Pagos:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ec51b543e5a38f6044c83f21dce2b23d'] = 'Módulo de pago'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7c9a3504dd4ce74b8021267ae1802968'] = 'Tipo de pago'; +$_MODULE['<{prestafraud}prestashop>prestafraud_827638f0be5ae74be04ed494087de714'] = 'Elija un tipo de pago'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; +$_MODULE['<{prestafraud}prestashop>prestafraud_16648260e58b4cf9d458e1a197ef43f1'] = 'El email no es válido'; +$_MODULE['<{prestafraud}prestashop>prestafraud_cb18f4dc13847e2ed5d69cb936f9b26c'] = 'URL de la tienda no válido'; +$_MODULE['<{prestafraud}prestashop>prestafraud_950c093b260d7c7709f8ff96e10a6fe0'] = 'Este pedido no se ha enviado a PrestaShop Security.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_d0c6a2fa938df84c0ce628de99c97e16'] = 'Nota:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_88183b946cc5f0e8c96b2e66e1c74a7e'] = 'Desconocido'; +$_MODULE['<{prestafraud}prestashop>prestafraud_240f3031f25601fa128bd4e15f0a37de'] = 'Comentario:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b88011726eba59d6bf37f0fdec202edc'] = 'Notificar este pedido como un fraude a PrestaShop'; +$_MODULE['<{prestafraud}prestashop>prestafraud_a8bbb000124c9697aa5d63e7e758b64d'] = 'Recoger en tienda'; +$_MODULE['<{prestafraud}prestashop>prestafraud_08eb31af908e2244867f6e812f82e935'] = 'Punto de recogida'; +$_MODULE['<{prestafraud}prestashop>prestafraud_880f973e4ddae42c6bebd2c31bb977f8'] = 'Envío lento superior a 3 días'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b61de91e556aee84e83c3fde8ef67ddc'] = 'Envío express'; diff --git a/modules/prestafraud/fr.php b/modules/prestafraud/fr.php new file mode 100755 index 00000000..01c661ec --- /dev/null +++ b/modules/prestafraud/fr.php @@ -0,0 +1,63 @@ +prestafraud_eed029a9cfe78c1230a654e58fe8b6f8'] = 'PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_95d311a37e934646eec0c79c4f266feb'] = 'Protégez votre magasin des paiements frauduleux'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4d0a6a9777a818ecc3b59b9a8ecd0c43'] = '- Merci de choisir votre activité principale -'; +$_MODULE['<{prestafraud}prestashop>prestafraud_5a600f5b88f416c470991c6831add13a'] = 'Adultes'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0fe4ca3df29658482098bb33a2ff66e5'] = 'Animaux et animaux domestiques'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9e4359f35054190eba36e09466e39d01'] = 'Art et Culture'; +$_MODULE['<{prestafraud}prestashop>prestafraud_066cd752c82ddc6231a9723b5822a945'] = 'Bébés'; +$_MODULE['<{prestafraud}prestashop>prestafraud_41a081c3f3042ac40117cf295350870d'] = 'Beauté et soins personnels'; +$_MODULE['<{prestafraud}prestashop>prestafraud_f2b545a8abb14f8706f808a79277c061'] = 'Voitures'; +$_MODULE['<{prestafraud}prestashop>prestafraud_39bb2fdc532f8984d8348863c86ebfca'] = 'Matériel informatique et logiciel'; +$_MODULE['<{prestafraud}prestashop>prestafraud_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Téléchargement'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8bdd8b2357d516da5b81eb16746ba9a9'] = 'Mode et accessoires'; +$_MODULE['<{prestafraud}prestashop>prestafraud_33cb31c5505618a808d3bcd7490a793c'] = 'Fleurs, cadeaux et artisanat'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0570b6d9de5c37a026e69c6987fc27f6'] = 'Aliments et boissons'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4b73b8913afcdf06d9f49c176306d950'] = 'Hi-fi, Photo et Vidéo'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2e9d6500d9b2a65985a621f0f0afdeb3'] = 'Maison et jardin'; +$_MODULE['<{prestafraud}prestashop>prestafraud_83dd3493957bcd92a37bc39111f670b8'] = 'Home Appliances'; +$_MODULE['<{prestafraud}prestashop>prestafraud_565631402af79df42f22a117b0d6f1a5'] = 'Bijoux'; +$_MODULE['<{prestafraud}prestashop>prestafraud_18848d605251b3627014c6a58c14c449'] = 'Mobile et Telecom'; +$_MODULE['<{prestafraud}prestashop>prestafraud_992a0f0542384f1ee5ef51b7cf4ae6c4'] = 'Services'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4ef7205b13f6821177d0dbc2fb90f79e'] = 'Chaussures et accessoires'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9503054261b8aeed48e0a3902019b579'] = 'Sport et Loisirs'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1fb0f99b55e6c2be35aed72ebe38c245'] = 'Voyage'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3e0deb2f1df28a6a13c9c18cc0e1c755'] = 'Chèque'; +$_MODULE['<{prestafraud}prestashop>prestafraud_35b4b09d5d0686ec5c2e2cc9f3d9039c'] = 'Virement bancaire'; +$_MODULE['<{prestafraud}prestashop>prestafraud_e7f9e382dc50889098cbe56f2554c77b'] = 'Carte de crédit'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1cf575079afed29675c47e822bc3d493'] = 'Carte de crédit en plusieurs fois'; +$_MODULE['<{prestafraud}prestashop>prestafraud_75b95ea268cb6b5baf7483aafa80d5ad'] = 'Compte prépayé (MoneyBookers, PayPal ...)'; +$_MODULE['<{prestafraud}prestashop>prestafraud_688000bea2f79c9ca3d2d1755456024f'] = 'Merci d\'accepter les termes du service.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8dc42e0ea3bedd2c1cc400141540cf62'] = 'Configuration de PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7e97953add2f27fce07653151ba3e862'] = 'Mon magasin n\'a pas encore de compte sur Prestashop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3b2aee63259f6dc9b94914884474f8de'] = 'J\'ai déjà un compte'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9d5c4ae518b30bacdb69912d87b3406a'] = 'Votre email:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_6c3b9b51615d1d57773f25903da2018c'] = 'URL de la boutique:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_432dc11f749f7a5ea483a3c71e34e119'] = 'Je suis d\'accord avec les conditions de service PrestaShop Security et y adhére sans condition.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_42369faa6a6b243aac58683f3874bf99'] = 'Créer un compte'; +$_MODULE['<{prestafraud}prestashop>prestafraud_212713efb37cd2f521ee584f1dbb5f0b'] = 'Shop ID:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c6b84387320705147af2f9e79d72c6fc'] = 'Shop Key:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b51cb26e6b60a3ff585ab9f757495c52'] = 'Activité de la boutique:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ab8cba13a061fe8d4a330bcc8d6b0175'] = 'Transporteurs:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_914419aa32f04011357d3b604a86d7eb'] = 'Transporteur'; +$_MODULE['<{prestafraud}prestashop>prestafraud_fecb07f7ab46e23e9b520a9a9af7b97b'] = 'Type de transporteur'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b04ad61ad875f6e7149fdd51c2e60ce2'] = 'Choisissez un type de transporteur...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2edfe3cd8034975c073e23158e976428'] = 'Paiements:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ec51b543e5a38f6044c83f21dce2b23d'] = 'Module de paiement'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7c9a3504dd4ce74b8021267ae1802968'] = 'Type de paiement'; +$_MODULE['<{prestafraud}prestashop>prestafraud_827638f0be5ae74be04ed494087de714'] = 'Choisissez un type de paiement ...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c9cc8cce247e49bae79f15173ce97354'] = 'Enregistrer'; +$_MODULE['<{prestafraud}prestashop>prestafraud_16648260e58b4cf9d458e1a197ef43f1'] = 'Email est invalide'; +$_MODULE['<{prestafraud}prestashop>prestafraud_cb18f4dc13847e2ed5d69cb936f9b26c'] = 'URL de la boutique n\'est pas valide'; +$_MODULE['<{prestafraud}prestashop>prestafraud_950c093b260d7c7709f8ff96e10a6fe0'] = 'Cette commande n\'a pas été envoyé à PrestaShop Security.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_d0c6a2fa938df84c0ce628de99c97e16'] = 'Notation:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_88183b946cc5f0e8c96b2e66e1c74a7e'] = 'Inconnu'; +$_MODULE['<{prestafraud}prestashop>prestafraud_240f3031f25601fa128bd4e15f0a37de'] = 'Commentaire:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b88011726eba59d6bf37f0fdec202edc'] = 'Rapporter cette commande comme une fraude à PrestaShop'; +$_MODULE['<{prestafraud}prestashop>prestafraud_a8bbb000124c9697aa5d63e7e758b64d'] = 'Retrait en magasin'; +$_MODULE['<{prestafraud}prestashop>prestafraud_08eb31af908e2244867f6e812f82e935'] = 'Point de retrait, point relais'; +$_MODULE['<{prestafraud}prestashop>prestafraud_880f973e4ddae42c6bebd2c31bb977f8'] = 'Livraison lente de plus de 3 jours'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b61de91e556aee84e83c3fde8ef67ddc'] = 'Livraison express'; diff --git a/modules/prestafraud/index.php b/modules/prestafraud/index.php new file mode 100755 index 00000000..b559f985 --- /dev/null +++ b/modules/prestafraud/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 7233 $ +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; \ No newline at end of file diff --git a/modules/prestafraud/it.php b/modules/prestafraud/it.php new file mode 100755 index 00000000..18a4319a --- /dev/null +++ b/modules/prestafraud/it.php @@ -0,0 +1,65 @@ +prestafraud_eed029a9cfe78c1230a654e58fe8b6f8'] = 'PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_95d311a37e934646eec0c79c4f266feb'] = 'Proteggi il tuo negozio da pagamenti fraudolenti'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4d0a6a9777a818ecc3b59b9a8ecd0c43'] = '- Scegli la tua attività principale -'; +$_MODULE['<{prestafraud}prestashop>prestafraud_5a600f5b88f416c470991c6831add13a'] = 'Adulti'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0fe4ca3df29658482098bb33a2ff66e5'] = 'Animali'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9e4359f35054190eba36e09466e39d01'] = 'Arte e Cultura'; +$_MODULE['<{prestafraud}prestashop>prestafraud_066cd752c82ddc6231a9723b5822a945'] = 'Neonati'; +$_MODULE['<{prestafraud}prestashop>prestafraud_41a081c3f3042ac40117cf295350870d'] = 'Bellezza e cura della persona'; +$_MODULE['<{prestafraud}prestashop>prestafraud_f2b545a8abb14f8706f808a79277c061'] = 'Auto'; +$_MODULE['<{prestafraud}prestashop>prestafraud_39bb2fdc532f8984d8348863c86ebfca'] = 'Computer Hardware e Software'; +$_MODULE['<{prestafraud}prestashop>prestafraud_801ab24683a4a8c433c6eb40c48bcd9d'] = 'Download'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8bdd8b2357d516da5b81eb16746ba9a9'] = 'Moda e Accessori'; +$_MODULE['<{prestafraud}prestashop>prestafraud_33cb31c5505618a808d3bcd7490a793c'] = 'Fiori, regali e oggettistica'; +$_MODULE['<{prestafraud}prestashop>prestafraud_0570b6d9de5c37a026e69c6987fc27f6'] = 'Alimenti e bevande'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4b73b8913afcdf06d9f49c176306d950'] = 'Hi-Fi, Foto e Video'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2e9d6500d9b2a65985a621f0f0afdeb3'] = 'Casa e Giardino'; +$_MODULE['<{prestafraud}prestashop>prestafraud_83dd3493957bcd92a37bc39111f670b8'] = 'Elettrodomestici'; +$_MODULE['<{prestafraud}prestashop>prestafraud_565631402af79df42f22a117b0d6f1a5'] = 'Gioielli'; +$_MODULE['<{prestafraud}prestashop>prestafraud_18848d605251b3627014c6a58c14c449'] = 'Telefonia mobile'; +$_MODULE['<{prestafraud}prestashop>prestafraud_992a0f0542384f1ee5ef51b7cf4ae6c4'] = 'Servizi'; +$_MODULE['<{prestafraud}prestashop>prestafraud_4ef7205b13f6821177d0dbc2fb90f79e'] = 'Scarpe e accessori'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9503054261b8aeed48e0a3902019b579'] = 'Sport e Spettacolo'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1fb0f99b55e6c2be35aed72ebe38c245'] = 'Viaggi'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3e0deb2f1df28a6a13c9c18cc0e1c755'] = 'Assegno'; +$_MODULE['<{prestafraud}prestashop>prestafraud_35b4b09d5d0686ec5c2e2cc9f3d9039c'] = 'Bonifico bancario'; +$_MODULE['<{prestafraud}prestashop>prestafraud_e7f9e382dc50889098cbe56f2554c77b'] = 'Carta di credito'; +$_MODULE['<{prestafraud}prestashop>prestafraud_1cf575079afed29675c47e822bc3d493'] = 'Carte di credito multiple'; +$_MODULE['<{prestafraud}prestashop>prestafraud_75b95ea268cb6b5baf7483aafa80d5ad'] = 'Conto prepagato (Moneybookers, PayPal ...)'; +$_MODULE['<{prestafraud}prestashop>prestafraud_688000bea2f79c9ca3d2d1755456024f'] = 'Si prega di accettare i termini del servizio.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_8dc42e0ea3bedd2c1cc400141540cf62'] = 'Configurazione PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7e97953add2f27fce07653151ba3e862'] = 'Il mio negozio non ha ancora account su PrestaShop Security'; +$_MODULE['<{prestafraud}prestashop>prestafraud_3b2aee63259f6dc9b94914884474f8de'] = 'Ho già un account'; +$_MODULE['<{prestafraud}prestashop>prestafraud_9d5c4ae518b30bacdb69912d87b3406a'] = 'Il tuo indirizzo email:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_6c3b9b51615d1d57773f25903da2018c'] = 'Url negozio'; +$_MODULE['<{prestafraud}prestashop>prestafraud_432dc11f749f7a5ea483a3c71e34e119'] = 'Sono d\'accordo con i termini di PrestaShop Servizio di sicurezza e io aderisco incondizionatamente.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_42369faa6a6b243aac58683f3874bf99'] = 'Crea un account'; +$_MODULE['<{prestafraud}prestashop>prestafraud_212713efb37cd2f521ee584f1dbb5f0b'] = 'ID negozio:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c6b84387320705147af2f9e79d72c6fc'] = 'KEY negozio:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b51cb26e6b60a3ff585ab9f757495c52'] = 'Attività negozio:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ab8cba13a061fe8d4a330bcc8d6b0175'] = 'Corrieri:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_914419aa32f04011357d3b604a86d7eb'] = 'Corriere'; +$_MODULE['<{prestafraud}prestashop>prestafraud_fecb07f7ab46e23e9b520a9a9af7b97b'] = 'Tipo di corriere'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b04ad61ad875f6e7149fdd51c2e60ce2'] = 'Scegli un tipo di corriere...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_2edfe3cd8034975c073e23158e976428'] = 'Pagamenti:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_ec51b543e5a38f6044c83f21dce2b23d'] = 'Modulo Pagamento'; +$_MODULE['<{prestafraud}prestashop>prestafraud_7c9a3504dd4ce74b8021267ae1802968'] = 'Tipo di pagamento'; +$_MODULE['<{prestafraud}prestashop>prestafraud_827638f0be5ae74be04ed494087de714'] = 'Scegli un tipo di pagamento ...'; +$_MODULE['<{prestafraud}prestashop>prestafraud_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; +$_MODULE['<{prestafraud}prestashop>prestafraud_16648260e58b4cf9d458e1a197ef43f1'] = 'E-mail non è valida'; +$_MODULE['<{prestafraud}prestashop>prestafraud_cb18f4dc13847e2ed5d69cb936f9b26c'] = 'URL Shop non è valido'; +$_MODULE['<{prestafraud}prestashop>prestafraud_950c093b260d7c7709f8ff96e10a6fe0'] = 'Questo ordine non è stato inviato a PrestaShop Security.'; +$_MODULE['<{prestafraud}prestashop>prestafraud_d0c6a2fa938df84c0ce628de99c97e16'] = 'Punteggio:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_88183b946cc5f0e8c96b2e66e1c74a7e'] = 'Sconosciuto'; +$_MODULE['<{prestafraud}prestashop>prestafraud_240f3031f25601fa128bd4e15f0a37de'] = 'Commento:'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b88011726eba59d6bf37f0fdec202edc'] = 'Segnala questo ordine come una frode a PrestaShop'; +$_MODULE['<{prestafraud}prestashop>prestafraud_a8bbb000124c9697aa5d63e7e758b64d'] = 'Ritiro nel negozio'; +$_MODULE['<{prestafraud}prestashop>prestafraud_08eb31af908e2244867f6e812f82e935'] = 'Punto di ritiro'; +$_MODULE['<{prestafraud}prestashop>prestafraud_880f973e4ddae42c6bebd2c31bb977f8'] = 'Spedizione lenta oltre 3 giorni'; +$_MODULE['<{prestafraud}prestashop>prestafraud_b61de91e556aee84e83c3fde8ef67ddc'] = 'Spedizione express'; + +?> \ No newline at end of file diff --git a/modules/prestafraud/logo.gif b/modules/prestafraud/logo.gif new file mode 100755 index 00000000..3cb4e257 Binary files /dev/null and b/modules/prestafraud/logo.gif differ diff --git a/modules/prestafraud/prestafraud.php b/modules/prestafraud/prestafraud.php new file mode 100755 index 00000000..f6bfb50a --- /dev/null +++ b/modules/prestafraud/prestafraud.php @@ -0,0 +1,596 @@ + +* @copyright 2007-2011 PrestaShop SA +* @version Release: $Revision: 9260 $ +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registred Trademark & Property of PrestaShop SA +*/ + +if (!defined('_PS_VERSION_')) + exit; + +class PrestaFraud extends Module +{ + + private $_html; + public $_errors; + private $_trustUrl; + + private $_activities; + private $_payment_types; + + public function __construct() + { + $this->name = 'prestafraud'; + $this->tab = 'payment_security'; + $this->version = '0.99'; + $this->author = 'PrestaShop'; + $this->need_instance = 0; + + parent::__construct(); + + $this->displayName = $this->l('PrestaShop Security'); + $this->description = $this->l('Protect your store from fraudulent payments'); + + $this->_activities = array(0 => $this->l('-- Please choose your main activity --'), + 1 => $this->l('Adult'), + 2 => $this->l('Animals and Pets'), + 3 => $this->l('Art and Culture'), + 4 => $this->l('Babies'), + 5 => $this->l('Beauty and Personal Care'), + 6 => $this->l('Cars'), + 7 => $this->l('Computer Hardware and Software'), + 8 => $this->l('Download'), + 9 => $this->l('Fashion and accessories'), + 10 => $this->l('Flowers, Gifts and Crafts'), + 11 => $this->l('Food and beverage'), + 12 => $this->l('HiFi, Photo and Video'), + 13 => $this->l('Home and Garden'), + 14 => $this->l('Home Appliances'), + 15 => $this->l('Jewelry'), + 16 => $this->l('Mobile and Telecom'), + 17 => $this->l('Services'), + 18 => $this->l('Shoes and accessories'), + 19 => $this->l('Sport and Entertainment'), + 20 => $this->l('Travel')); + + $this->_payment_types = array(0 => $this->l('Cheque'), + 1 => $this->l('Bankwire'), + 2 => $this->l('Credit card'), + 3 => $this->l('Credit card multiple'), + 4 => $this->l('Prepaid account (MoneyBookers, PayPal...)')); + + $this->_trustUrl = 'http'.(extension_loaded('openssl') ? 's' : '').'://trust.prestashop.com/'; + } + + public function install() + { + if (!parent::install() OR + !$this->registerHook('updatecarrier') OR + !$this->registerHook('newOrder') OR + !$this->registerHook('adminOrder') OR + !$this->registerHook('cart')) + return false; + + if (!$sql = file_get_contents(dirname(__FILE__).'/install.sql')) + die(Tools::displayError('File install.sql is not readable')); + $sql = str_replace(array('PREFIX_', 'ENGINE_TYPE'), array(_DB_PREFIX_, _MYSQL_ENGINE_), $sql); + $sql = preg_split("/;\s*[\r\n]+/", $sql); + + foreach ($sql as $query) + if ($query AND sizeof($query) AND !Db::getInstance()->Execute(trim($query))) + return false; + return true; + } + + public function uninstall() + { + parent::uninstall(); + } + + public function getContent() + { + $this->postProcess(); + $this->_displayConfiguration(); + + return $this->_html; + } + + private function _displayConfiguration() + { + global $cookie; + $this->_html .= ' +
'.$this->l('PrestaShop Security configuration').' +
+
+
+ '.$this->l('My shop does not have a PrestaShop Security account yet').'    + '.$this->l('I already have an account').' +
+
+
+
 
+
+
+ +
+ +
+ +
+ +
+
+ '.$this->l('I agree with the terms of PrestaShop Security service and I adhere to them unconditionally.').' +
+
'; + $terms = file_get_contents($this->_trustUrl.'terms.php?lang='.Language::getIsoById((int)$cookie->id_lang)); + $this->_html .= $terms; + $this->_html .= '
+
+ +
+
+
 
+
+
+
+ +
+ +
+ +
+ +
+
 
+
+
'; + return $this->_html; + } + + public function postProcess() + { + if (Tools::isSubmit('submitSettings')) + { + if (isset($_POST['login'])) + Configuration::updateValue('PS_TRUST_EMAIL', $_POST['email']); + if (isset($_POST['passwd'])) + Configuration::updateValue('PS_TRUST_PASSWD', $_POST['passwd']); + if ($activity = Tools::getValue('shop_activity')) + Configuration::updateValue('PS_SHOP_ACTIVITY', $activity); + $carriers_configuration = array(); + $payments_configuration = array(); + foreach($_POST AS $field => $val) + { + if (preg_match('/^carrier_([0-9]+)/Ui', $field, $res)) + $carriers_configuration[$res[1]] = $val; + elseif (preg_match('/^paymentmodule_([0-9]+)/Ui', $field, $pay_res)) + $payments_configuration[$pay_res[1]] = $val; + } + + $this->_setCarriersConfiguration($carriers_configuration); + $this->_setPaymentsConfiguration($payments_configuration); + } + elseif (Tools::isSubmit('submitCreateAccount')) + $this->_html .= $this->_createAccount(); + + if (sizeof($this->_errors)) + { + $err = ''; + foreach ($this->_errors AS $error) + $err .= $error.'
'; + $this->_html .= $this->displayError($err); + } + } + + private function _createAccount() + { + if (!$email = Tools::getValue('email') OR !Validate::isEmail($email)) + $this->_errors[] = $this->l('Email is invalid'); + if (!$shop_url = Tools::getValue('shop_url') OR !Validate::isAbsoluteUrl($shop_url)) + $this->_errors[] = $this->l('Shop URL is invalid'); + + if (sizeof($this->_errors)) + return false; + + $root = new SimpleXMLElement(""); + $xml = $root->addChild('create_account'); + $xml->addChild('email', $email); + $xml->addChild('shop_url', $shop_url); + $result = $this->_pushDatas($root->asXml()); + $xml_result = simplexml_load_string($result); + if (!(int)$xml_result->create_account->result) + { + $this->_errors[] = (string)$xml_result->create_account->errors; + return false; + } + Configuration::updateValue('PS_TRUST_SHOP_ID', (string)$xml_result->create_account->shop_id); + Configuration::updateValue('PS_TRUST_SHOP_KEY', (string)$xml_result->create_account->shop_key); + + $this->_html .= $this->displayConfirmation('Account successfull created'); + } + + public function hookUpdateCarrier($params) + { + $this->_updateConfiguredCarrier((int)$params['id_carrier'], (int)$params['carrier']->id); + } + + public function hookNewOrder($params) + { + if (!Configuration::get('PS_SHOP_ENABLE') OR !Configuration::get('PS_TRUST_SHOP_ID') OR !Configuration::get('PS_TRUST_SHOP_KEY')) + return; + $customer = new Customer((int)$params['order']->id_customer); + + $address_delivery = new Address((int)$params['order']->id_address_delivery); + $address_invoice = new Address((int)$params['order']->id_address_invoice); + $root = new SimpleXMLElement(""); + $xml = $root->addChild('new_order'); + $shop_configuration = $xml->addChild('shop'); + + $default_country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT')); + $default_currency = new Currency((int)Configuration::get('PS_CURRENCY_DEFAULT')); + $shop_configuration->addChild('default_country', $default_country->iso_code); + $shop_configuration->addChild('default_currency', $default_currency->iso_code); + $shop_configuration->addChild('shop_id', Configuration::get('PS_TRUST_SHOP_ID')); + $shop_configuration->addChild('shop_password', Configuration::get('PS_TRUST_SHOP_KEY')); + + if ($activity = Configuration::get('PS_SHOP_ACTIVITY')) + $shop_configuration->addChild('shop_activity', $activity); + $customer_infos = $xml->addChild('customer'); + $customer_infos->addChild('customer_id', $customer->id); + $customer_infos->addChild('lastname', $customer->lastname); + $customer_infos->addChild('firstname', $customer->firstname); + $customer_infos->addChild('email', $customer->email); + $customer_infos->addChild('is_guest', (int)$customer->is_guest); + $customer_infos->addChild('birthday', $customer->birthday); + + $delivery = $xml->addChild('delivery'); + $delivery->addChild('lastname', $address_delivery->lastname); + $delivery->addChild('firstname', $address_delivery->firstname); + $delivery->addChild('company', $address_delivery->company); + $delivery->addChild('dni', $address_delivery->dni); + $delivery->addChild('address1', $address_delivery->address1); + $delivery->addChild('address2', $address_delivery->address2); + $delivery->addChild('phone', $address_delivery->phone); + $delivery->addChild('phone_mobile', $address_delivery->phone_mobile); + $delivery->addChild('city', $address_delivery->city); + $delivery->addChild('postcode', $address_delivery->postcode); + if ($address_delivery->id_state !== NULL OR $address_delivery->id_state != '') + { + $State = new State((int)$address_delivery->id_state); + $delivery->addChild('state', $State->iso_code); + } + $delivery->addChild('country', Country::getIsoById((int)$address_delivery->id_country)); + + $invoice = $xml->addChild('invoice'); + $invoice->addChild('lastname', $address_invoice->lastname); + $invoice->addChild('firstname', $address_invoice->firstname); + $invoice->addChild('company', $address_invoice->company); + $invoice->addChild('dni', $address_invoice->dni); + $invoice->addChild('address1', $address_invoice->address1); + $invoice->addChild('address2', $address_invoice->address2); + $invoice->addChild('phone', $address_invoice->phone); + $invoice->addChild('phone_mobile', $address_invoice->phone_mobile); + $invoice->addChild('city', $address_invoice->city); + $invoice->addChild('postcode', $address_invoice->postcode); + if ($address_invoice->id_state !== NULL OR $address_invoice->id_state != '') + { + $State = new State((int)$address_invoice->id_state); + $invoice->addChild('state', $State->iso_code); + } + $invoice->addChild('country', Country::getIsoById((int)$address_invoice->id_country)); + + $infos = $this->_getCustomerInfos($params['order']); + $history = $xml->addChild('customer_history'); + $history->addChild('customer_date_last_order', $infos['customer_date_last_order']); + $history->addChild('customer_orders_valid_count', (int)$infos['customer_orders_valid_count']); + $history->addChild('customer_orders_valid_sum', (float)$infos['customer_orders_valid_sum']); + $history->addChild('customer_orders_unvalid_count', (int)$infos['customer_orders_unvalid_count']); + $history->addChild('customer_orders_unvalid_sum', (float)$infos['customer_orders_unvalid_sum']); + $history->addChild('customer_ip_addresses_history', $infos['customer_ip_addresses_history']); + + $history->addChild('customer_date_add', $customer->date_add); + + $product_list = $params['order']->getProductsDetail(); + + $order = $xml->addChild('order_detail'); + $order->addChild('order_id', (int)$params['order']->id); + $order->addChild('order_amount', $params['order']->total_paid); + $currency = new Currency((int)$params['order']->id_currency); + $order->addChild('currency', $currency->iso_code); + $products = $order->addChild('products'); + foreach ($product_list AS $p) + { + $products->addChild('name', $p['product_name']); + $products->addChild('price', $p['product_price']); + $products->addChild('quantity', $p['product_quantity']); + $products->addChild('is_virtual', (int)!empty($p['download_hash'])); + } + + $sources = ConnectionsSource::getOrderSources($params['order']->id); + $referers = array(); + if ($sources) + foreach ($sources AS $source) + $referers[] = $source['http_referer']; + if (sizeof($referers)) + $order->addChild('order_referers', serialize($referers)); + + $configured_payments = $this->_getConfiguredPayments(); + $paymentModule = Module::getInstanceByName($params['order']->module); + $order->addChild('payment_name', $paymentModule->displayName); + $order->addChild('payment_type', (int)$configured_payments[$paymentModule->id]); + $order->addChild('order_date', $params['order']->date_add); + $order->addChild('order_ip_address', $this->_getIpByCart((int)$params['order']->id_cart)); + + $carrier = new Carrier((int)$params['order']->id_carrier); + $carrier_infos = $order->addChild('carrier_infos'); + $carrier_infos->addChild('name', $carrier->name); + $carriers_type = $this->_getConfiguredCarriers(); + + $carrier_infos->addChild('type', $carriers_type[$carrier->id]); + if ($this->_pushDatas($root->asXml()) !== false) + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'prestafraud_orders (id_order) VALUES('.(int)$params['order']->id.')'); + return true; + } + + public function hookCart($params) + { + if ($_SERVER['REMOTE_ADDR'] == '0.0.0.0' OR $_SERVER['REMOTE_ADDR'] == '' OR $_SERVER['REMOTE_ADDR'] === false OR $_SERVER['REMOTE_ADDR'] === '::1') + return; + if (!$params['cart']->id) + return; + $res = Db::getInstance()->getValue(' + SELECT `id_cart` + FROM '._DB_PREFIX_.'prestafraud_carts + WHERE id_cart='.(int)($params['cart']->id)); + if ($res) + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'prestafraud_carts` + SET `ip_address` = '.ip2long($_SERVER['REMOTE_ADDR']).', `date` = \''.pSQL(date('Y-m-d H:i:s')).'\' + WHERE `id_cart` = '.(int)($params['cart']->id).' LIMIT 1'); + else + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'prestafraud_carts` (`id_cart`, `ip_address`, `date`) + VALUES ('.(int)($params['cart']->id).', '.ip2long($_SERVER['REMOTE_ADDR']).',\''.date('Y-m-d H:i:s').'\')'); + return true; + } + + private function _getCustomerInfos($order) + { + $last_order = Db::getInstance()->getValue('SELECT date_add + FROM '._DB_PREFIX_.'orders + WHERE id_customer='.(int)$order->id_customer.' AND id_order != '.(int)$order->id.' + ORDER BY date_add DESC'); + + $orders_valid = Db::getInstance()->getRow(' + SELECT COUNT(*) nb_valid, SUM(total_paid) sum_valid + FROM '._DB_PREFIX_.'orders + WHERE valid=1 AND id_order!='.(int)$order->id.' AND id_customer = '.(int)$order->id_customer); + + $orders_unvalid = Db::getInstance()->getRow(' + SELECT COUNT(*) nb_unvalid, SUM(total_paid) sum_unvalid + FROM '._DB_PREFIX_.'orders + WHERE valid=0 AND id_order!='.(int)$order->id.' AND id_customer = '.(int)$order->id_customer); + + $ip_addresses = Db::getInstance()->ExecuteS(' + SELECT c.ip_address + FROM '._DB_PREFIX_.'guest g + LEFT JOIN '._DB_PREFIX_.'connections c ON (c.id_guest = g.id_guest) + WHERE g.id_customer='.(int)$order->id_customer.' + ORDER BY c.id_connections DESC'); + $address_list = array(); + foreach ($ip_addresses AS $ip) + $address_list[] = $ip['ip_address']; + + return array( + 'customer_date_last_order' => $last_order, + 'customer_orders_valid_count' => $orders_valid['nb_valid'], + 'customer_orders_valid_sum' => $orders_valid['sum_valid'], + 'customer_orders_unvalid_count' => $orders_unvalid['nb_unvalid'], + 'customer_orders_unvalid_sum' => $orders_unvalid['sum_unvalid'], + 'customer_ip_addresses_history' => serialize($address_list) + ); + } + + private static function _getIpByCart($id_cart) + { + return long2ip(Db::getInstance()->getValue(' + SELECT `ip_address` + FROM '._DB_PREFIX_.'prestafraud_carts + WHERE id_cart = '.(int)$id_cart)); + } + + public function hookAdminOrder($params) + { + global $cookie; + $id_order = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'prestafraud_orders WHERE id_order = '.(int)$params['id_order']); + $this->_html .= '
'.$this->l('PrestaShop Security').''; + if (!$id_order) + $this->_html .= $this->l('This order has not been sent to PrestaShop Security.'); + else + { + $scoring = $this->_getScoring((int)$id_order, $cookie->id_lang); + $this->_html .= '

'.$this->l('Scoring:').' '.($scoring['scoring'] < 0 ? $this->l('Unknown') : (float)$scoring['scoring']).'

+

'.$this->l('Comment:').' '.htmlentities($scoring['comment']).'

+

'.$this->l('Report this order as a fraud to PrestaShop').'

'; + } + $this->_html .= '
'; + return $this->_html; + } + + + + private function _getScoring($id_order, $id_lang) + { + if (!$scoring = Db::getInstance()->getRow('SELECT * FROM '._DB_PREFIX_.'prestafraud_orders WHERE scoring IS NOT NULL AND id_order = '.(int)$id_order)) + { + $root = new SimpleXMLElement(""); + $xml = $root->addChild('get_scoring'); + $xml->addChild('shop_id', Configuration::get('PS_TRUST_SHOP_ID')); + $xml->addChild('shop_password', Configuration::get('PS_TRUST_SHOP_KEY')); + $xml->addChild('id_order', (int)$id_order); + $xml->addChild('lang', Language::getIsoById((int)$id_lang)); + $result = $this->_pushDatas($root->asXml()); + if (!$result) + return false; + $xml = simplexml_load_string($result); + if ((int)$xml->check_scoring->status != -1) + Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'prestafraud_orders SET scoring = '.(float)$xml->check_scoring->scoring.', comment = \''.pSQL($xml->check_scoring->comment).'\' WHERE id_order='.(int)$id_order); + $scoring = array('scoring' => (float)$xml->check_scoring->scoring, 'comment' => (string)$xml->check_scoring->comment); + } + return $scoring; + } + + private function _getPrestaTrustCarriersType() + { + return array( + '1' => $this->l('Pick up in-store'), + '2' => $this->l('Withdrawal point'), + '3' => $this->l('Slow shipping more than 3 days'), + '4' => $this->l('Shipping express')); + } + + private function _getConfiguredCarriers() + { + $res = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'prestafraud_carrier'); + $carriers = array(); + foreach ($res AS $row) + $carriers[$row['id_carrier']] = $row['id_prestafraud_carrier_type']; + + return $carriers; + } + + private function _getConfiguredPayments() + { + $res = Db::getInstance()->ExecuteS('SELECT * FROM '._DB_PREFIX_.'prestafraud_payment'); + $payments = array(); + foreach ($res AS $row) + $payments[$row['id_module']] = $row['id_prestafraud_payment_type']; + + return $payments; + } + + private function _setCarriersConfiguration($carriers) + { + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'prestafraud_carrier'); + foreach ($carriers AS $id_carrier => $id_carrier_type) + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'prestafraud_carrier (id_carrier, id_prestafraud_carrier_type) VALUES ('.(int)$id_carrier.', '.(int)$id_carrier_type.')'); + } + + private function _setPaymentsConfiguration($payments) + { + Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.'prestafraud_payment'); + foreach ($payments AS $id_module => $id_payment_type) + Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'prestafraud_payment (id_module, id_prestafraud_payment_type) VALUES ('.(int)$id_module.', '.(int)$id_payment_type.')'); + } + + private function _updateConfiguredCarrier($old, $new) + { + return Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'prestafraud_carrier SET id_carrier='.(int)$new.' WHERE id_carrier='.(int)$old); + } + + private function _pushDatas($datas) + { + if (function_exists('curl_init')) + { + $ch = curl_init($this->_trustUrl); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, array('xml' => $datas)); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_HEADER, false); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + $content = curl_exec($ch); + curl_close($ch); + return $content; + } + elseif (function_exists('file_get_contents')) + { + $stream_context = @stream_context_create(array('http' => array('timeout' => 5))); + return file_get_contents($this->_trustUrl.'?xml='.urlencode(str_replace("\r", "\n", '', $datas)), $stream_context); + } + else + return false; + } +} diff --git a/modules/privatesale_mail_delay/AdminPrivateSaleMailDelay.php b/modules/privatesale_mail_delay/AdminPrivateSaleMailDelay.php new file mode 100755 index 00000000..5339e151 --- /dev/null +++ b/modules/privatesale_mail_delay/AdminPrivateSaleMailDelay.php @@ -0,0 +1,278 @@ +Vérifier le formulaire
'; + } else { + $sale = Sale::getSaleFromCategory((int) $id_category); + $category = new Category($id_category, $cookie->id_lang); + + $orders_single = $sale->getOrdersFromSale(NULL, TRUE); + $orders_multiple = $sale->getOrdersFromSale(NULL, FALSE); + + if($type_envoi == 0) { + $orders = array_merge($orders_multiple, $orders_single); + } else if($type_envoi == 1) { + $orders = $orders_multiple; + } else if($type_envoi == 2) { + $orders = $orders_single; + } + + $orders = array_unique($orders); + + if(Tools::isSubmit('submitEnvoi')) { + $this->displayConfirmationForm($category, $type_envoi, $contenu_mail, count($orders), $sale, $objet_mail, $envoi_remise, $montant_remise, $prefix_remise); + } else if(Tools::isSubmit('confirmationEnvoi')) { + $contenu_mail = str_replace("%marque%", $category->name , $contenu_mail); + + $mail = 0; + $mails_errors = array(); + + foreach ($orders as $key => $order) { + $data = new Order($order); + + if($envoi_remise == 1){ + $params = array( + 'id_customer' => $data->id_customer, + 'currency' => 1, + 'description' => Configuration::get('MAIL_PS_DESC'), + 'value' => (int) $montant_remise, + 'prefix' => $prefix_remise + ); + + $discount = $this->_register_discount($params); + $contenu_mail = str_replace("%montant%", (int)$montant_remise , $contenu_mail); + $contenu_mail = str_replace("%discount%", $discount->name , $contenu_mail); + } + + $customer = new Customer($discount->id_customer); + $send = Mail::Send( + $cookie->id_lang, + 'ps_delay', + $objet_mail, + array( + '{message}' => $contenu_mail + ), + $customer->email, + $customer->firstname.' '.$customer->lastname, + strval(Configuration::get('PS_SHOP_EMAIL')), + strval(Configuration::get('PS_SHOP_NAME')), + NULL, + NULL, + dirname(__FILE__).'/mails/' + ); + $send = true; + + if(!$send){ + $mails_errors[] = $order->id; + } + + $mail++; + } + + if( count($mails_errors) > 0) { + echo '
Soucis sur les commandes ' . implode(',', $mails_errors) .'
'; + } + + echo '
Envoi réussi : '. $mail.' mails(s) envoyés
'; + } + } + } + } + + private function _register_discount($params) { + $discount = new Discount(); + $discount->id_customer = $params['id_customer']; + $discount->id_discount_type = 2; + $discount->cumulable = 1; + $discount->cumulable_reduction = 1; + $discount->minimal = 0; + $discount->include_tax = 0; + $discount->cart_display = 1; + $discount->active = 1; + $discount->quantity = 1; + $discount->quantity_per_user = 1; + $discount->date_from = date('Y-m-d H:i:s'); + $discount->date_to = date('Y-m-d H:i:s', time() + 365 * 86400); + + $name = $params['prefix'] . '-' . Tools::passwdGen(8); + if(Discount::discountExists($name)) { + // It should not happen, but who knows... + $name = $params['prefix'] . '-' . Tools::passwdGen(8); + } + $discount->name = $name; + + $title[2] = $params['description']; + $discount->description = $title; + if(isset($params['value']) && isset($params['currency'])) { + $discount->id_currency = $params['currency']; + $discount->value = $params['value']; + } + $discount->add(true, false, array(1)); + // assoc only accueil catégorie + return $discount; + } + + public function displayConfirmationForm($category, $type_envoi, $contenu_mail, $nb_envoi, $sale, $objet_mail, $envoi_remise, $montant_remise = 0, $prefix_remise) { + if($type_envoi == 0) { + $type_envoi_text = "Toutes"; + } else if($type_envoi == 1) { + $type_envoi_text = "Multi"; + } else if($type_envoi == 2) { + $type_envoi_text = "Simple"; + } + + $output .= '
+
Confirmation envoi'; + $output.= ''; + $output.= ''; + $output.= ''; + $output.= ''; + $output.= ''; + $output.= ''; + $output.= ''; + + $output .= '

Vous allez envoyer '. $nb_envoi .' mails pour un retard concernant la vente '. $category->name .' +
Segmentation des commandes : '. $type_envoi_text .'

+
+ +
+
+


'; + echo $output; + } + + public function display(){ + global $cookie; + + $mail_delay_sql = 'SELECT value FROM ps_configuration WHERE name = "MAIL_PS_DELAY"'; + $mail_delay = DB::getInstance()->getValue($mail_delay_sql); + + $montant = Configuration::get('REMISE_PS_DELAY'); + + $output .= ' +
+
'.$this->l('Alerte mail').' + +
+ +
+ +
+ + + +
'; + + $output .= ' +
+ +
+ + +

Si vous cochez non, la variable %montant% et %value% ne doit pas être présente dans le mail ci-dessous

+
+ +
+ € +
+ +
+ +

Exemple : TEST pour avoir un bon sous la forme TEST-AAAAA

+
+
+ +
+ +
+ +
+ +

+ Les données suivantes seront remplacés avant l\'envoi du mail : +

    +
  1. %montant% : Montant de la remise
  2. +
  3. %discount% : Code de réduction
  4. +
  5. %marque% : Nom de la vente
  6. +
+

+
+
+ +
+

Nb : Un récapitulatif de l\'envoi sera disponible avant le définitif

+
+
+
'; + + // TinyMCE + global $cookie; + $iso = Language::getIsoById((int)($cookie->id_lang)); + $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); + $ad = dirname($_SERVER["PHP_SELF"]); + $output.= ' + + + + '; + + $output.= ''; + $output.= ''; + $output.= ''; + + echo $output; + } + + +} \ No newline at end of file diff --git a/modules/privatesale_mail_delay/en.php b/modules/privatesale_mail_delay/en.php new file mode 100644 index 00000000..e69de29b diff --git a/modules/privatesale_mail_delay/es.php b/modules/privatesale_mail_delay/es.php new file mode 100644 index 00000000..e69de29b diff --git a/modules/privatesale_mail_delay/fr.php b/modules/privatesale_mail_delay/fr.php new file mode 100755 index 00000000..e69de29b diff --git a/modules/privatesale_mail_delay/logo.gif b/modules/privatesale_mail_delay/logo.gif new file mode 100755 index 00000000..c42ced4c Binary files /dev/null and b/modules/privatesale_mail_delay/logo.gif differ diff --git a/modules/privatesale_mail_delay/privatesale_mail_delay.php b/modules/privatesale_mail_delay/privatesale_mail_delay.php new file mode 100755 index 00000000..19987d7a --- /dev/null +++ b/modules/privatesale_mail_delay/privatesale_mail_delay.php @@ -0,0 +1,103 @@ +name = 'privatesale_mail_delay'; + $this->tab = 'administration'; + $this->version = '1.0'; + + parent::__construct(); + + $this->displayName = $this->l('Mail retard vente privée'); + $this->description = $this->l('Envoie un mail pour prévenir du retard de livraison d\'une VP'); + } + + public function install() { + if(!parent::install() ) { + return FALSE; + } + + return TRUE; + } + + public function getContent(){ + if(Tools::isSubmit('saveConfiguration')){ + $montant = Tools::getValue('remise_ps_delay'); + + if( !Validate::isInt($montant) ) { + $this->_html .= "
Le montant de la remise doit être un nombre
"; + }else{ + Configuration::updateValue(self::DATA_REMISE, $montant); + $this->_html .= "
Montant mis à jour
"; + } + + Configuration::updateValue(self::DATA_DESC, Tools::getValue('remise_description')); + $this->_html .= "
Description mis à jour
"; + + Configuration::updateValue(self::DATA_MAIL, Tools::getValue('mail_ps_delay'), true); + $this->_html .= "
Mail mis à jour
"; + } + + $this->_html .= self::displayForm(); + echo $this->_html; + } + + public static function displayForm(){ + $mail_delay_sql = 'SELECT value FROM ps_configuration WHERE name = "'. self::DATA_MAIL.'"'; + $mail_delay = DB::getInstance()->getValue($mail_delay_sql); + + $data .= '

Alerte mail retard de livraison

+
+
'; + $data .= "Configuration du module"; + $data .= ' +
+ +
'; + $data .= ' +
+ +
'; + $data .= '
+ +
+ +

+ Les données suivantes seront remplacés avant l\'envoi du mail : +

    +
  1. %montant% : Montant de la remise
  2. +
  3. %discount% : Code de réduction
  4. +
  5. %marque% : Nom de la vente
  6. +
+

+
'; + $data .= '
+ +
+
+
'; + + // TinyMCE + global $cookie; + $iso = Language::getIsoById((int)($cookie->id_lang)); + $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); + $ad = dirname($_SERVER["PHP_SELF"]); + $data .= ' + + + + + '; + return $data; + } + +} diff --git a/modules/privatesales/.hg/00changelog.i b/modules/privatesales/.hg/00changelog.i new file mode 100755 index 00000000..d3a83110 Binary files /dev/null and b/modules/privatesales/.hg/00changelog.i differ diff --git a/modules/privatesales/.hg/branch b/modules/privatesales/.hg/branch new file mode 100755 index 00000000..4ad96d51 --- /dev/null +++ b/modules/privatesales/.hg/branch @@ -0,0 +1 @@ +default diff --git a/modules/privatesales/.hg/cache/branchheads b/modules/privatesales/.hg/cache/branchheads new file mode 100755 index 00000000..f907b2a9 --- /dev/null +++ b/modules/privatesales/.hg/cache/branchheads @@ -0,0 +1,2 @@ +ce0a13d9b6fc2b97d932a265ec436ff5a411015b 32 +ce0a13d9b6fc2b97d932a265ec436ff5a411015b default diff --git a/modules/privatesales/.hg/cache/tags b/modules/privatesales/.hg/cache/tags new file mode 100755 index 00000000..704f6b09 --- /dev/null +++ b/modules/privatesales/.hg/cache/tags @@ -0,0 +1,2 @@ +32 ce0a13d9b6fc2b97d932a265ec436ff5a411015b + diff --git a/modules/privatesales/.hg/dirstate b/modules/privatesales/.hg/dirstate new file mode 100755 index 00000000..b1ad242c Binary files /dev/null and b/modules/privatesales/.hg/dirstate differ diff --git a/modules/privatesales/.hg/hgrc b/modules/privatesales/.hg/hgrc new file mode 100755 index 00000000..bda213ea --- /dev/null +++ b/modules/privatesales/.hg/hgrc @@ -0,0 +1,2 @@ +[paths] +default = ssh://ewen@localhost//hg/privatesales diff --git a/modules/privatesales/.hg/requires b/modules/privatesales/.hg/requires new file mode 100755 index 00000000..c1674f2d --- /dev/null +++ b/modules/privatesales/.hg/requires @@ -0,0 +1,4 @@ +revlogv1 +fncache +store +dotencode diff --git a/modules/privatesales/.hg/store/00changelog.i b/modules/privatesales/.hg/store/00changelog.i new file mode 100755 index 00000000..84b4c9e4 Binary files /dev/null and b/modules/privatesales/.hg/store/00changelog.i differ diff --git a/modules/privatesales/.hg/store/00manifest.i b/modules/privatesales/.hg/store/00manifest.i new file mode 100755 index 00000000..7677b47b Binary files /dev/null and b/modules/privatesales/.hg/store/00manifest.i differ diff --git a/modules/privatesales/.hg/store/data/_admin_private_sales.gif.i b/modules/privatesales/.hg/store/data/_admin_private_sales.gif.i new file mode 100755 index 00000000..72bf2cd0 Binary files /dev/null and b/modules/privatesales/.hg/store/data/_admin_private_sales.gif.i differ diff --git a/modules/privatesales/.hg/store/data/_admin_private_sales.php.i b/modules/privatesales/.hg/store/data/_admin_private_sales.php.i new file mode 100755 index 00000000..6a844b71 Binary files /dev/null and b/modules/privatesales/.hg/store/data/_admin_private_sales.php.i differ diff --git a/modules/privatesales/.hg/store/data/_admin_private_sales_sales.php.i b/modules/privatesales/.hg/store/data/_admin_private_sales_sales.php.i new file mode 100755 index 00000000..135dd57b Binary files /dev/null and b/modules/privatesales/.hg/store/data/_admin_private_sales_sales.php.i differ diff --git a/modules/privatesales/.hg/store/data/_sale.php.i b/modules/privatesales/.hg/store/data/_sale.php.i new file mode 100755 index 00000000..d395449e Binary files /dev/null and b/modules/privatesales/.hg/store/data/_sale.php.i differ diff --git a/modules/privatesales/.hg/store/data/add.png.i b/modules/privatesales/.hg/store/data/add.png.i new file mode 100755 index 00000000..0584760c Binary files /dev/null and b/modules/privatesales/.hg/store/data/add.png.i differ diff --git a/modules/privatesales/.hg/store/data/atom.tpl.i b/modules/privatesales/.hg/store/data/atom.tpl.i new file mode 100755 index 00000000..5adc5bed Binary files /dev/null and b/modules/privatesales/.hg/store/data/atom.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/category.tpl.i b/modules/privatesales/.hg/store/data/category.tpl.i new file mode 100755 index 00000000..3d4404e7 Binary files /dev/null and b/modules/privatesales/.hg/store/data/category.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/config.xml.i b/modules/privatesales/.hg/store/data/config.xml.i new file mode 100755 index 00000000..214eecb9 Binary files /dev/null and b/modules/privatesales/.hg/store/data/config.xml.i differ diff --git a/modules/privatesales/.hg/store/data/cron.php.i b/modules/privatesales/.hg/store/data/cron.php.i new file mode 100755 index 00000000..7ffb2073 Binary files /dev/null and b/modules/privatesales/.hg/store/data/cron.php.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown.blue.active.png.i b/modules/privatesales/.hg/store/data/dropdown.blue.active.png.i new file mode 100755 index 00000000..8fa35a03 Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown.blue.active.png.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown.blue.hover.png.i b/modules/privatesales/.hg/store/data/dropdown.blue.hover.png.i new file mode 100755 index 00000000..fe670aff Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown.blue.hover.png.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown.blue.png.i b/modules/privatesales/.hg/store/data/dropdown.blue.png.i new file mode 100755 index 00000000..3d84bc91 Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown.blue.png.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown.gif.i b/modules/privatesales/.hg/store/data/dropdown.gif.i new file mode 100755 index 00000000..719f9978 Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown.gif.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown__active.gif.i b/modules/privatesales/.hg/store/data/dropdown__active.gif.i new file mode 100755 index 00000000..a6292bf4 Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown__active.gif.i differ diff --git a/modules/privatesales/.hg/store/data/dropdown__hover.gif.i b/modules/privatesales/.hg/store/data/dropdown__hover.gif.i new file mode 100755 index 00000000..39de2998 Binary files /dev/null and b/modules/privatesales/.hg/store/data/dropdown__hover.gif.i differ diff --git a/modules/privatesales/.hg/store/data/featured.php.i b/modules/privatesales/.hg/store/data/featured.php.i new file mode 100755 index 00000000..bdc82191 Binary files /dev/null and b/modules/privatesales/.hg/store/data/featured.php.i differ diff --git a/modules/privatesales/.hg/store/data/featured.tpl.i b/modules/privatesales/.hg/store/data/featured.tpl.i new file mode 100755 index 00000000..f40a54af Binary files /dev/null and b/modules/privatesales/.hg/store/data/featured.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/featured__brand.tpl.i b/modules/privatesales/.hg/store/data/featured__brand.tpl.i new file mode 100755 index 00000000..d7923dc7 Binary files /dev/null and b/modules/privatesales/.hg/store/data/featured__brand.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/feed.php.i b/modules/privatesales/.hg/store/data/feed.php.i new file mode 100755 index 00000000..5e825070 Binary files /dev/null and b/modules/privatesales/.hg/store/data/feed.php.i differ diff --git a/modules/privatesales/.hg/store/data/footer.tpl.i b/modules/privatesales/.hg/store/data/footer.tpl.i new file mode 100755 index 00000000..b4be81f6 Binary files /dev/null and b/modules/privatesales/.hg/store/data/footer.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/fr.php.i b/modules/privatesales/.hg/store/data/fr.php.i new file mode 100755 index 00000000..c996a265 Binary files /dev/null and b/modules/privatesales/.hg/store/data/fr.php.i differ diff --git a/modules/privatesales/.hg/store/data/header.tpl.i b/modules/privatesales/.hg/store/data/header.tpl.i new file mode 100755 index 00000000..3a3d6531 Binary files /dev/null and b/modules/privatesales/.hg/store/data/header.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/home.tpl.i b/modules/privatesales/.hg/store/data/home.tpl.i new file mode 100755 index 00000000..7764aa3b Binary files /dev/null and b/modules/privatesales/.hg/store/data/home.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/img/index.html.i b/modules/privatesales/.hg/store/data/img/index.html.i new file mode 100755 index 00000000..2431023a Binary files /dev/null and b/modules/privatesales/.hg/store/data/img/index.html.i differ diff --git a/modules/privatesales/.hg/store/data/j_query.tubeplayer.min.js.i b/modules/privatesales/.hg/store/data/j_query.tubeplayer.min.js.i new file mode 100755 index 00000000..46aaec92 Binary files /dev/null and b/modules/privatesales/.hg/store/data/j_query.tubeplayer.min.js.i differ diff --git a/modules/privatesales/.hg/store/data/jquery.multi_select.js.i b/modules/privatesales/.hg/store/data/jquery.multi_select.js.i new file mode 100755 index 00000000..bfff673f Binary files /dev/null and b/modules/privatesales/.hg/store/data/jquery.multi_select.js.i differ diff --git a/modules/privatesales/.hg/store/data/logo.gif.i b/modules/privatesales/.hg/store/data/logo.gif.i new file mode 100755 index 00000000..72bf2cd0 Binary files /dev/null and b/modules/privatesales/.hg/store/data/logo.gif.i differ diff --git a/modules/privatesales/.hg/store/data/prefs.gif.i b/modules/privatesales/.hg/store/data/prefs.gif.i new file mode 100755 index 00000000..3efe7722 Binary files /dev/null and b/modules/privatesales/.hg/store/data/prefs.gif.i differ diff --git a/modules/privatesales/.hg/store/data/privatesale.js.i b/modules/privatesales/.hg/store/data/privatesale.js.i new file mode 100755 index 00000000..0bfb2016 Binary files /dev/null and b/modules/privatesales/.hg/store/data/privatesale.js.i differ diff --git a/modules/privatesales/.hg/store/data/privatesales.php.i b/modules/privatesales/.hg/store/data/privatesales.php.i new file mode 100755 index 00000000..b354cca7 Binary files /dev/null and b/modules/privatesales/.hg/store/data/privatesales.php.i differ diff --git a/modules/privatesales/.hg/store/data/product.tpl.i b/modules/privatesales/.hg/store/data/product.tpl.i new file mode 100755 index 00000000..1958da7f Binary files /dev/null and b/modules/privatesales/.hg/store/data/product.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/rss.tpl.i b/modules/privatesales/.hg/store/data/rss.tpl.i new file mode 100755 index 00000000..ca08738c Binary files /dev/null and b/modules/privatesales/.hg/store/data/rss.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/salechange.php.i b/modules/privatesales/.hg/store/data/salechange.php.i new file mode 100755 index 00000000..c47ec5b8 Binary files /dev/null and b/modules/privatesales/.hg/store/data/salechange.php.i differ diff --git a/modules/privatesales/.hg/store/data/salechange.tpl.i b/modules/privatesales/.hg/store/data/salechange.tpl.i new file mode 100755 index 00000000..0e93cc33 Binary files /dev/null and b/modules/privatesales/.hg/store/data/salechange.tpl.i differ diff --git a/modules/privatesales/.hg/store/data/showsale.php.i b/modules/privatesales/.hg/store/data/showsale.php.i new file mode 100755 index 00000000..b715c74f Binary files /dev/null and b/modules/privatesales/.hg/store/data/showsale.php.i differ diff --git a/modules/privatesales/.hg/store/data/table.png.i b/modules/privatesales/.hg/store/data/table.png.i new file mode 100755 index 00000000..34f5b670 Binary files /dev/null and b/modules/privatesales/.hg/store/data/table.png.i differ diff --git a/modules/privatesales/.hg/store/data/trailer.php.i b/modules/privatesales/.hg/store/data/trailer.php.i new file mode 100755 index 00000000..eaee023a Binary files /dev/null and b/modules/privatesales/.hg/store/data/trailer.php.i differ diff --git a/modules/privatesales/.hg/store/data/trailer.tpl.i b/modules/privatesales/.hg/store/data/trailer.tpl.i new file mode 100755 index 00000000..bd0c6071 Binary files /dev/null and b/modules/privatesales/.hg/store/data/trailer.tpl.i differ diff --git a/modules/privatesales/.hg/store/fncache b/modules/privatesales/.hg/store/fncache new file mode 100755 index 00000000..217e2bb1 --- /dev/null +++ b/modules/privatesales/.hg/store/fncache @@ -0,0 +1,38 @@ +data/featured.php.i +data/AdminPrivateSalesSales.php.i +data/showsale.php.i +data/featured_brand.tpl.i +data/dropdown.gif.i +data/AdminPrivateSales.php.i +data/home.tpl.i +data/dropdown_hover.gif.i +data/trailer.tpl.i +data/img/index.html.i +data/atom.tpl.i +data/product.tpl.i +data/dropdown_active.gif.i +data/category.tpl.i +data/Sale.php.i +data/AdminPrivateSales.gif.i +data/fr.php.i +data/feed.php.i +data/dropdown.blue.active.png.i +data/privatesale.js.i +data/header.tpl.i +data/privatesales.php.i +data/cron.php.i +data/prefs.gif.i +data/salechange.php.i +data/jQuery.tubeplayer.min.js.i +data/table.png.i +data/config.xml.i +data/featured.tpl.i +data/dropdown.blue.hover.png.i +data/dropdown.blue.png.i +data/rss.tpl.i +data/add.png.i +data/jquery.multiSelect.js.i +data/salechange.tpl.i +data/trailer.php.i +data/footer.tpl.i +data/logo.gif.i diff --git a/modules/privatesales/.hg/store/undo b/modules/privatesales/.hg/store/undo new file mode 100755 index 00000000..c2a8c004 Binary files /dev/null and b/modules/privatesales/.hg/store/undo differ diff --git a/modules/privatesales/.hg/undo.bookmarks b/modules/privatesales/.hg/undo.bookmarks new file mode 100755 index 00000000..e69de29b diff --git a/modules/privatesales/.hg/undo.branch b/modules/privatesales/.hg/undo.branch new file mode 100755 index 00000000..331d858c --- /dev/null +++ b/modules/privatesales/.hg/undo.branch @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/modules/privatesales/.hg/undo.desc b/modules/privatesales/.hg/undo.desc new file mode 100755 index 00000000..38cea45d --- /dev/null +++ b/modules/privatesales/.hg/undo.desc @@ -0,0 +1,3 @@ +0 +pull +ssh://ewen@localhost//hg/privatesales diff --git a/modules/privatesales/.hg/undo.dirstate b/modules/privatesales/.hg/undo.dirstate new file mode 100755 index 00000000..e69de29b diff --git a/modules/privatesales/AdminPrivateSales.gif b/modules/privatesales/AdminPrivateSales.gif new file mode 100755 index 00000000..ce6a5d4e Binary files /dev/null and b/modules/privatesales/AdminPrivateSales.gif differ diff --git a/modules/privatesales/AdminPrivateSales.php b/modules/privatesales/AdminPrivateSales.php new file mode 100755 index 00000000..b087656e --- /dev/null +++ b/modules/privatesales/AdminPrivateSales.php @@ -0,0 +1,305 @@ +ExecuteS(' + SELECT * + FROM `'._DB_PREFIX_.'privatesale_module` + '); + + echo ' +
+
+ '.$this->l('Frais de port par marque').' +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
'; + + echo ' +
+
+ '.$this->l('EMARSYS - Titre newsletter').' +
+ +
+ +
+
+
+ +
+ +
+
+
'; + + echo ' +
+ '.$this->l('Available Modules').' +
    '; + foreach($modules as $module) { + echo '
  • '.$module['modulename'].'
  • '; + } + echo '
+
+
'; + + echo '
+
+ '.$this->l('Private Sales Configuration').' +
+ +
+ + * +
+
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +

'.$this->l('WARNING: Changing this parameter may require some modifications in your theme.').'

+
+
+
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+
+ '.$this->l('days').' * +

'.$this->l('Sales starting within this limit will be displayed.').'
'.$this->l('Set to 0 to show all future sales.').'

+
+
+ +
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+
+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+ +
+ +
+



+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+

+ '.$this->l('No').' '.$this->l('Yes').' * +
+
+
+ +
+
+ * +
+
+
+ +
+

+ * +
+
+ +
+ +
+
'; + + if(Configuration::get('PS_REWRITING_SETTINGS')) { + $langs = Language::getLanguages(); + echo '

+ +
+ '.$this->l('URL Rewriting settings').' + +

'.$this->l('Add the following text to the custom rewriting rules (Tools > Generators):').'

+

+ +
+
'; + } + } +} diff --git a/modules/privatesales/AdminPrivateSalesSales.php b/modules/privatesales/AdminPrivateSalesSales.php new file mode 100755 index 00000000..bdf04e3f --- /dev/null +++ b/modules/privatesales/AdminPrivateSalesSales.php @@ -0,0 +1,875 @@ +lang = TRUE; + parent::__construct(); + $this->imagelist = array( + 'thumb' => array($this->l('Thumbnail'), '260x108'), + 'liston' => array($this->l('Listing image (on)'), '380x178'), + 'listoff' => array($this->l('Listing image (off)'), '380x178'), + 'fb' => array($this->l('Facebook image'), '100x100'), + 'trailerbg' => array($this->l('Trailer background'), '*x*'), + 'trailercenter' => array($this->l('Trailer center background'), '560x*'), + ); + } + + public function displayForm($isMainTab=TRUE) { + global $currentIndex, $cookie; + parent::displayForm(); + + $iso = Language::getIsoById((int)($cookie->id_lang)); + $images = array(); + foreach(array_keys($this->imagelist) as $img) { + $images[] = 'img_'.$img; + } + $divLangName = 'description¤video¤'.implode('¤', $images); + + echo ' + + + +
+
+ '.$this->l('Edit a sale').''; + + $categories = Db::getInstance()->ExecuteS(' + SELECT c.`id_category`, l.`name`, l.`link_rewrite` + FROM `'._DB_PREFIX_.'category` c, `'._DB_PREFIX_.'category_lang` l + WHERE c.`id_category` = l.`id_category` AND l.`id_lang` = '.intval($cookie->id_lang).' AND c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' + ORDER BY c.`id_category` + '); + + $used_categories = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT p.`id_category` + FROM `'._DB_PREFIX_.'privatesale_category` p + WHERE `id_category` IN ( + SELECT c.`id_category` + FROM `'._DB_PREFIX_.'category` c + WHERE c.`id_parent` = '.Configuration::get('PRIVATESALES_ROOT').' + ) + ') as $cat) { + $used_categories[] = $cat['id_category']; + } + $categories_ordered = array(); + echo ' + +
+ + * +

'.$this->l('Categories already affected to other sales are greyed.').'

+
+ + '; + + echo ' +
+
+ +

'.$this->l('This value is set by the name of the root category for this sale.').'

+
+
+
'; + + echo ' +
+
+ +

'.$this->l('This value is set by the alias of the root category for this sale.').'

+
+
+
'; + + echo ' +
+
+ + * +
+
+
'; + + echo ' +
+
+ + * +
+
+
'; + + echo ' +
+
+ cursale!==NULL?($this->cursale->enabled==0?' checked="checked"': ''):'').' /> '.$this->l('Disabled').'   cursale!==NULL?($this->cursale->enabled==1?' checked="checked"': ''):'checked="checked"').' /> '.$this->l('Enabled').' + * +
+
+
'; + + echo ' +
+
+ cursale!==NULL? ($this->cursale->logout==0? ' checked="checked"': ''):' ').' /> '.$this->l('Only for logged in users').'   cursale!==NULL? ($this->cursale->logout==1? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Show to guests too').' + * +
+
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->pub==0? ' checked="checked"': ''): ' checked="checked"').' /> '.$this->l('No').'   cursale!==NULL && $this->cursale->pub==1? ' checked="checked"': '').' /> '.$this->l('Yes').' + * +
+
+
'; + + echo ' +
+ +
+
'; + + echo ' +
+ + * +
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->new==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->new==1?' checked="checked"': '').' /> '.$this->l('Oui').' + * +
+
+
'; + + + echo ' +
+
+ cursale!==NULL? ($this->cursale->forward_news==0? ' checked="checked"': ''):' checked="checked"').' /> '.$this->l('Non').'   cursale!==NULL && $this->cursale->forward_news==1?' checked="checked"': '').' /> '.$this->l('Oui').' + * +
+
+
'; + + + echo ' +
+
+ + * +
+
+
'; + + $groups = Db::getInstance()->ExecuteS(' + SELECT l.`id_group`, l.`name`'.($this->cursale !== NULL? ', ( + SELECT IFNULL(g.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_group` g WHERE l.`id_group` = g.`id_group` AND g.`id_sale` = '.$this->cursale->id.' + ) AS `id_sale`': '').' + FROM `'._DB_PREFIX_.'group_lang` l + WHERE l.`id_lang` = '.$cookie->id_lang + ); + echo ' +
+
+ +
+ +
+
'; + + $site_versions = array('fr', 'es'/*, 'it'*/); + echo ' +
+
+ +
+ +
+
'; + + // if(Configuration::get('PRIVATESALES_CARRIERFENCE')) { + $carriers = Db::getInstance()->ExecuteS(' + SELECT c.`id_carrier`, IF(c.`name` = "0", "'.Configuration::get('PS_SHOP_NAME').'", c.`name`) AS `name`'.($this->cursale !== NULL? ', ( + SELECT IFNULL(p.`id_sale`, NULL) FROM `'._DB_PREFIX_.'privatesale_carrier` p WHERE c.`id_carrier` = p.`id_carrier` AND p.`id_sale` = '.$this->cursale->id.' + ) AS `id_sale`': '').' + FROM `'._DB_PREFIX_.'carrier` c + WHERE c.`deleted` != 1 + '); + + $carriers_default = array(33, 22, 37, 45); + + echo ' +
+
+ +
+ +
+
'; + // } + + // echo ' + //
+ //
+ // '.$this->l('SALETYPE1').' cursale->sale_type) && in_array(1,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="1"> + // '.$this->l('SALETYPE2').' cursale->sale_type) && in_array(2,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="2"> + // '.$this->l('SALETYPE3').' cursale->sale_type) && in_array(3,$this->cursale->sale_type) ? ' checked': '') .' type="checkbox" name="sale_type[]" value="3"> + //
+ //
'; + + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ +
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'description'); + echo '
+
'; + + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ cursale !== NULL? ' value="'.htmlentities($this->cursale->video[$language['id_lang']]).'"': '').' />'; + echo '
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'video'); + echo '
+

'.$this->l('Youtube full URL').'

+
'; + + foreach($this->imagelist as $k => $v) { + echo ' +
'; + foreach($this->_languages as $language) { + echo '
+ +

'.$this->l('Size:').' '.$v[1].'

'; + if($this->cursale !== NULL && file_exists(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$this->cursale->id.'/'.$k.'_'.$language['id_lang'].'.jpg')) { + echo '

'.$this->l('Preview').'

'; + } + echo ' +
'; + } + $this->displayFlags($this->_languages, $this->_defaultFormLanguage, $divLangName, 'img_'.$k); + echo '
+
'; + } + + Module::hookExec('privatesales_edit', array('sale' => $this->cursale)); + + echo '
+
+ + cursale !== NULL ? 'disabled=disabled': '').' name="submitSaleAdd" value="'.$this->l('Add this sale').'" /> + cursale !== NULL? '': ' disabled="disabled"').' id="submitSaleUpdate" /> +
'; + + echo '
+
'; + } + + public function display() { + global $cookie, $currentIndex; + $this->cursale = NULL; + if($id = Tools::getValue('id')) { + $this->cursale = new Sale($id); + if($this->cursale->id === NULL) { + Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); + } + } + + // // ANTADIS INSERT TYPE + // $ventes = Sale::getSales(NULL, NULL, NULL, NULL , FALSE, FALSE, 'position ASC'); + // foreach ($ventes as $key => $vente) { + // global $cookie; + // if($cookie->id_employee == 1){ + // Db::getInstance()->autoExecute('ps_privatesale_type', array( + // 'id_sale' => $vente->id, + // 'id_sale_type' => $vente->sale_type, + // ), 'INSERT'); + // } + // } + + $this->displayForm(); + + $export = Module::isInstalled('exports'); + + $employees = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_employee`, `firstname`, `lastname` + FROM `'._DB_PREFIX_.'employee` + ') as $row) { + $employees[(int) $row['id_employee']] = $row['firstname'].' '.$row['lastname']; + } + + //ANTADIS + echo '
'; + echo 'Tri des ventes'; + echo ''; + echo ''; + echo ''; + echo '
'; + + ?> + + + + + '; + + + echo '
+ '.$this->l('Sales list').' + + + + + + + + + + + + + + + + + + '; + echo ' '; + + $sales = Sale::getSales(NULL, NULL, NULL, 'not_ended', FALSE, FALSE, '`position` DESC'); + $ids = array(); + foreach ($sales as $key => $sale) { + $ids[] = $sale->id; + } + $extrafields = PrivateSales_ExtraFields::getFieldsForSale($ids); + + foreach($sales as $key => $sale) { + echo ' + + + + + + '; + + if($sale->new == 0){ + echo ""; + } + else if($sale->new == 1){ + echo ""; + } + else if($sale->new == 3){ + echo ""; + } + + echo ' + + + + + + + + + '; + } + echo ' + +
'.$this->l('ID').''.$this->l('Title').''.$this->l('Start').''.$this->l('End').''.$this->l('Enabled').''.$this->l('Nouveau').''.$this->l('Employee').''.$this->l('FR').''.$this->l('ES').''.$this->l('News').''.$this->l('Position').''.$this->l('Actions').'
'.$sale->id.''.$sale->title[intval($cookie->id_lang)].'
'.$extrafields[$sale->id][1].'
'.$sale->date_start.''.$sale->date_end.''.($sale->enabled?$this->l('Yes'):$this->l('No')).'".$this->l('No')."".$this->l('Yes')."".$this->l('Non défini')."'.((int) $sale->id_employee != 0? $employees[(int) $sale->id_employee]: '--').'versions) ? 'class="green"' : 'class="red"').'>FRversions) ? 'class="green"' : 'class="red"').'>ES'. $sale->forward_news .''; + if($key != 0){ + echo 'Haut'; + } + if($key + 1 != count($sales)){ + echo 'Bas'; + } + $category_link = Link::getCategoryLink($sale->id_category); + echo ' + '.($export? '': '').' + + + + + +
+
'; + + } + public static function getSaleType($sale_type){ + $type = ""; + + if(in_array(1, $sale_type)){ + $type.= "Bébé "; + } + if(in_array(2, $sale_type)){ + $type.= "Enfant "; + } + if(in_array(3, $sale_type)){ + $type.= "Maman "; + } + + if(empty($type)){ + return "undefined"; + } + return $type; + } + + public function postProcess() { + global $cookie, $currentIndex; + + if(Tools::isSubmit('submitSaleAdd')) { + if (Sale::getSaleFromCategory(Tools::getValue('id_category'))) { + return false; + } + + $sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale'; + $position = Db::getInstance()->getValue($sql_position); + + $sale = new Sale(); + $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); + $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); + $sale->enabled = Tools::getValue('enabled', 0); + $sale->featured = Tools::getValue('featured', 0); + $sale->logout = Tools::getValue('logout', 0); + $sale->new = Tools::getValue('new', 0); + $sale->forward_news = Tools::getValue('forward_news', 0); + $sale->pub = Tools::getValue('pub', 0); + $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); + $sale->id_employee = (int) Tools::getValue('id_employee'); + $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); + $sale->sale_type = array(); + $sale->versions = array(); + foreach(Tools::getValue('sale_type', array()) as $sale_type) { + $sale->sale_type[] = (int) $sale_type; + } + + foreach(Language::getLanguages(FALSE) as $language) { + if($description = Tools::getValue('description_'.$language['id_lang'])) { + $sale->description[$language['id_lang']] = $description; + } else { + $sale->description[$language['id_lang']] = ''; + } + if($video = Tools::getValue('video_'.$language['id_lang'])) { + $sale->video[$language['id_lang']] = $video; + } else { + $sale->video[$language['id_lang']] = ''; + } + } + foreach(Tools::getValue('m_groups', array()) as $group) { + $sale->groups[] = (int) $group; + } + + foreach(Tools::getValue('m_versions', array()) as $version) { + $sale->versions[] = pSql($version); + } + + foreach(Tools::getValue('m_carriers', array()) as $carrier) { + $sale->carriers[] = (int) $carrier; + } + + if( empty($sale->carriers)) { + echo '
'.Tools::displayError($this->l('Impossible de créer une vente sans transporteur.')).'
'; + exit; + } + + $sale->save(); + $sale->buildCategoryCache(); + + if( empty($sale->carriers)) { + mail('valentin@bebeboutik.com', 'Vente sans transporteur', + 'La vente '. $sale->id.' est sans transporteur', + 'Content-Type: text/plain; charset="utf-8"'."\r\n".'From: contact@bebeboutik.com'."\r\n".'Reply-To: thibault@antadis.com'."\r\n".'Return-Path: thibault@antadis.com'."\r\n"); + } + + if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { + mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); + } + + foreach(Language::getLanguages(FALSE) as $language) { + foreach(array_keys($this->imagelist) as $img) { + if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { + if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { + echo $this->displayError($this->l('An error occured during the image upload.')); + } + } + } + } + } elseif(Tools::isSubmit('submitSaleUpdate') && $id_sale = (int) Tools::getValue('id_sale')) { + $sale = new Sale($id_sale); + $sale->date_start = Tools::getValue('date_start', '0000-00-00 00:00:00'); + $sale->date_end = Tools::getValue('date_end', '0000-00-00 00:00:00'); + $sale->enabled = Tools::getValue('enabled', 0); + $sale->featured = Tools::getValue('featured', 0); + $sale->logout = Tools::getValue('logout', 0); + $sale->pub = Tools::getValue('pub', 0); + $sale->new = Tools::getValue('new', 0); + $sale->forward_news = Tools::getValue('forward_news', 0); + $sale->id_category = Tools::getValue('id_category', Configuration::get('PRIVATESALES_ROOT')); + $sale->id_employee = (int) Tools::getValue('id_employee'); + $sale->delivery_delay = (int) Tools::getValue('delivery_delay'); + $sale->sale_type = array(); + $sale->description = array(); + $sale->video = array(); + $sale->groups = array(); + $sale->carriers = array(); + $sale->versions = array(); + foreach(Language::getLanguages(FALSE) as $language) { + if($description = Tools::getValue('description_'.$language['id_lang'])) { + $sale->description[$language['id_lang']] = $description; + } else { + $sale->description[$language['id_lang']] = ''; + } + if($video = Tools::getValue('video_'.$language['id_lang'])) { + $sale->video[$language['id_lang']] = $video; + } else { + $sale->video[$language['id_lang']] = ''; + } + } + foreach(Tools::getValue('m_groups', array()) as $group) { + $sale->groups[] = (int) $group; + } + foreach(Tools::getValue('m_carriers', array()) as $carrier) { + $sale->carriers[] = (int) $carrier; + } + foreach(Tools::getValue('m_versions', array()) as $version) { + $sale->versions[] = pSql($version); + } + foreach(Tools::getValue('sale_type', array()) as $sale_type) { + $sale->sale_type[] = (int) $sale_type; + } + + if( empty($sale->carriers)) { + echo '
'.Tools::displayError($this->l('Impossible d\'éditer une vente sans transporteur.')).'
'; + exit; + } + + $sale->save(); + $sale->buildCategoryCache(); + + if(!is_dir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id)) { + mkdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id, 0775); + } + + foreach(Language::getLanguages(FALSE) as $language) { + foreach(array_keys($this->imagelist) as $img) { + if(isset($_FILES['img_'.$img.'_'.$language['id_lang']]) && $_FILES['img_'.$img.'_'.$language['id_lang']]['name'] != '') { + if(!copy($_FILES['img_'.$img.'_'.$language['id_lang']]['tmp_name'], _PS_ROOT_DIR_.'/modules/privatesales/img/'.$sale->id.'/'.$img.'_'.$language['id_lang'].'.jpg')) { + echo $this->displayError($this->l('An error occured during the image upload.')); + } + } + } + } + } elseif(isset($_GET['delete']) && $id_sale = Tools::getValue('id')) { + Sale::deleteSale($id_sale); + Tools::redirectAdmin($currentIndex.'&token='.Tools::getAdminTokenLite('AdminPrivateSalesSales')); + } + } +} diff --git a/modules/privatesales/Sale.php b/modules/privatesales/Sale.php new file mode 100755 index 00000000..d68a6baa --- /dev/null +++ b/modules/privatesales/Sale.php @@ -0,0 +1,1572 @@ +id = $id; + $this->date_start = $sale['date_start']; + $this->date_end = $sale['date_end']; + $this->date_upd = $sale['date_upd']; + $this->enabled = $sale['enabled']; + $this->featured = $sale['featured']; + $this->logout = $sale['logout']; + $this->pub = $sale['pub']; + $this->new = $sale['new']; + $this->forward_news = $sale['forward_news']; + $this->id_category = $sale['id_category']; + $this->id_employee = $sale['id_employee']; + $this->title = $sale['title']; + $this->alias = $sale['alias']; + $this->groups = $sale['groups']; + $this->carriers = $sale['carriers']; + $this->description = $sale['description']; + $this->video = $sale['video']; + $this->timelaps = $sale['timelaps']; + $this->sale_type = $sale['sale_type']; + $this->position = $sale['position']; + $this->delivery_delay = $sale['delivery_delay']; + $this->versions = $sale['versions']; + } + } + } + + public function getMobileMenu() { + include_once dirname(__FILE__).'/../blockprivatesalescategories/blockprivatesalescategories.php'; + + $blockprivatesalescategories = new BlockPrivateSalesCategories(); + return $blockprivatesalescategories->buildSelector(array('sale' => $this)); + } + + public function isFinished($check_enabled=FALSE) { + if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_end) < mktime()) { + return TRUE; + } + return FALSE; + } + + public function isStarted($check_enabled=FALSE) { + if(($check_enabled === TRUE && $this->enabled || $check_enabled === FALSE) && strtotime($this->date_start) < mktime()) { + return TRUE; + } + return FALSE; + } + + public function save() { + if($this->id !== NULL) { + + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'privatesale` SET + `date_start` = "'.pSQL($this->date_start).'", + `date_end` = "'.pSQL($this->date_end).'", + `enabled` = '.(int) $this->enabled.', + `featured` = '.(int) $this->featured.', + `logout` = '.(int) $this->logout.', + `new` = '.(int) $this->new.', + `forward_news` = '.(int) $this->forward_news.', + `public` = '.(int) $this->pub.', + `id_category` = '.(int) $this->id_category.', + `id_employee` = '.(int) $this->id_employee.', + `delivery_delay` = '.(int) $this->delivery_delay.', + `date_upd` = NOW() + WHERE `id_sale` = '.(int) $this->id.' + '); + + // Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_type` WHERE `id_sale` = '.(int) $this->id); + // foreach($this->sale_type as $k => $sale_type) { + // Db::getInstance()->Execute(' + // INSERT INTO `'._DB_PREFIX_.'privatesale_type` VALUES ( + // '. (int)$this->id.', + // '. (int)$sale_type.' + // ) + // '); + // } + + Db::getInstance()->ExecuteS('DELETE FROM `'._DB_PREFIX_.'privatesale_site_version`WHERE `id_sale` = '.(int) $this->id.''); + foreach($this->versions as $version) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_site_version` VALUES ( + '.$this->id.', + "'.pSQL($version).'" + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_lang` WHERE `id_sale` = '.(int) $this->id); + $sale_i18n = array(); + foreach($this->description as $k => $v) { + if(!isset($sale_i18n[$k])) { + $sale_i18n[$k] = array(); + } + $sale_i18n[$k]['description'] = $v; + } + foreach($this->video as $k => $v) { + if(!isset($sale_i18n[$k])) { + $sale_i18n[$k] = array(); + } + $sale_i18n[$k]['video'] = $v; + } + foreach($sale_i18n as $lang => $values) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_lang` VALUES ( + '.$this->id.', + '.$lang.', + "'.(isset($values['description'])? pSQL($values['description'], TRUE): '').'", + "'.(isset($values['video'])? pSQL($values['video']): '').'" + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_group` WHERE `id_sale` = '.(int) $this->id); + foreach($this->groups as $group) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_group` VALUES ( + '.$this->id.', + '.$group.' + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_carrier` WHERE `id_sale` = '.(int) $this->id); + foreach($this->carriers as $carrier) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_carrier` VALUES ( + '.$this->id.', + '.$carrier.' + ) + '); + } + + Module::hookExec('privatesales_update', array('sale' => $this)); + } else { + if(Sale::getSaleFromCategory($this->id_category) !== NULL) { + $this->enabled = FALSE; + } + + $sql_position = 'SELECT MAX(position) FROM '. _DB_PREFIX_.'privatesale'; + $position = Db::getInstance()->getValue($sql_position); + + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale` VALUES ( + DEFAULT, + "'.pSQL($this->date_start).'", + "'.pSQL($this->date_end).'", + '.(int) $this->enabled.', + '.(int) $this->featured.', + '.(int) $this->logout.', + '.(int) $this->pub.', + '.(int) $this->new.', + '.(int) $this->forward_news.', + '.(int) $this->id_category.', + '.(int) $this->id_employee.', + NOW(), + '.(int) $this->sale_type.', + '.(int) $this->delivery_delay.', + '.($position+1).' + ) + '); + $this->id = Db::getInstance()->Insert_ID(); + + + // Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_type` WHERE `id_sale` = '.(int) $this->id); + // foreach($this->sale_type as $k => $sale_type) { + // Db::getInstance()->Execute(' + // INSERT INTO `'._DB_PREFIX_.'privatesale_type` VALUES ( + // '. (int)$this->id.', + // '. (int)$sale_type.' + // ) + // '); + // } + + foreach($this->versions as $version) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_site_version` VALUES ( + '.$this->id.', + "'.pSQL($version).'" + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_lang` WHERE `id_sale` = '.(int) $this->id); + $sale_i18n = array(); + foreach($this->description as $k => $v) { + if(!isset($sale_i18n[$k])) { + $sale_i18n[$k] = array(); + } + $sale_i18n[$k]['description'] = $v; + } + foreach($this->video as $k => $v) { + if(!isset($sale_i18n[$k])) { + $sale_i18n[$k] = array(); + } + $sale_i18n[$k]['video'] = $v; + } + foreach($sale_i18n as $lang => $values) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_lang` VALUES ( + '.$this->id.', + '.$lang.', + "'.(isset($values['description'])? pSQL($values['description'], TRUE): '').'", + "'.(isset($values['video'])? pSQL($values['video']): '').'" + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_group` WHERE `id_sale` = '.(int) $this->id); + foreach($this->groups as $group) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_group` VALUES ( + '.$this->id.', + '.$group.' + ) + '); + } + + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_carrier` WHERE `id_sale` = '.(int) $this->id); + foreach($this->carriers as $carrier) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_carrier` VALUES ( + '.$this->id.', + '.$carrier.' + ) + '); + } + + Module::hookExec('privatesales_create', array('sale' => $this)); + } + } + + public static function deleteSale($id) { + if($sale = Sale::getSale($id)) { + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_lang` WHERE `id_sale` = '.(int) $id); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_group` WHERE `id_sale` = '.(int) $id); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale` WHERE `id_sale` = '.(int) $id); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_category` WHERE `id_sale` = '.(int) $id); + Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'privatesale_carrier` WHERE `id_sale` = '.(int) $id); + Sale::rrmdir(_PS_ROOT_DIR_.'/modules/privatesales/img/'.$id); + Module::hookExec('privatesales_delete', array('sale' => $this)); + } + } + + public static function rrmdir($dir) { + if(is_dir($dir)) { + $objects = scandir($dir); + foreach($objects as $object) { + if($object != '.' && $object != '..') { + if(filetype($dir.'/'.$object) == 'dir') { + rrmdir($dir.'/'.$object); + } else { + unlink($dir."/".$object); + } + } + } + reset($objects); + rmdir($dir); + } + } + + public static function getSale($id) { + if(!($ps = Db::getInstance()->ExecuteS(' + SELECT * + FROM `'._DB_PREFIX_.'privatesale` + WHERE `id_sale` = '.(int) $id + )) || count($ps) == 0) { + return false; + } + + $d1 = new DateTime(date('Y-m-d H:i:s')); + $d2 = new DateTime($ps[0]['date_end']); + $diff = $d1->diff($d2); + + $result = array( + 'id_sale' => $ps[0]['id_sale'], + 'date_start' => $ps[0]['date_start'], + 'date_end' => $ps[0]['date_end'], + 'date_upd' => $ps[0]['date_upd'], + 'timelaps' => $diff, + 'enabled' => $ps[0]['enabled'], + 'featured' => $ps[0]['featured'], + 'logout' => $ps[0]['logout'], + 'pub' => $ps[0]['public'], + 'new' => $ps[0]['new'], + 'forward_news' => $ps[0]['forward_news'], + 'position' => $ps[0]['position'], + 'id_category' => $ps[0]['id_category'], + 'id_employee' => $ps[0]['id_employee'], + 'delivery_delay' => $ps[0]['delivery_delay'], + 'sale_type' => array(), + 'title' => array(), + 'alias' => array(), + 'groups' => array(), + 'carriers' => array(), + 'description' => array(), + 'versions' => array(), + 'video' => array(), + ); + + // $types = Db::getInstance()->ExecuteS(' + // SELECT * + // FROM `'._DB_PREFIX_.'privatesale_type` + // WHERE `id_sale` = '.(int) $id + // ); + // foreach ($types as $key => $type) { + // $result['sale_type'][$key] = $type['id_sale_type']; + // } + + + $psl = Db::getInstance()->ExecuteS(' + SELECT * + FROM `'._DB_PREFIX_.'privatesale_lang` + WHERE `id_sale` = '.(int) $id + ); + foreach($psl as $l) { + $result['description'][$l['id_lang']] = $l['description']; + $result['video'][$l['id_lang']] = $l['video']; + } + + $category_i18n = Db::getInstance()->ExecuteS(' + SELECT `id_lang`, `name`, `link_rewrite` + FROM `'._DB_PREFIX_.'category_lang` + WHERE `id_category` = '.$ps[0]['id_category'] + ); + foreach($category_i18n as $c) { + $result['title'][$c['id_lang']] = $c['name']; + $result['alias'][$c['id_lang']] = $c['link_rewrite']; + } + + $sale_groups = Db::getInstance()->ExecuteS(' + SELECT `id_group` + FROM `'._DB_PREFIX_.'privatesale_group` + WHERE `id_sale` = '.(int) $id + ); + foreach($sale_groups as $group) { + $result['groups'][] = $group['id_group']; + } + + $sale_carriers = Db::getInstance()->ExecuteS(' + SELECT `id_carrier` + FROM `'._DB_PREFIX_.'privatesale_carrier` + WHERE `id_sale` = '.(int) $id + ); + foreach($sale_carriers as $carrier) { + $result['carriers'][] = $carrier['id_carrier']; + } + + foreach(Db::getInstance()->ExecuteS(' + SELECT `version` + FROM `'._DB_PREFIX_.'privatesale_site_version` + WHERE `id_sale` = '.(int) $id + ) as $version) { + $result['versions'][] = $version['version']; + } + + return $result; + } + + public function getOrders() { + $orders = array(); + $products = $this->getProducts(); + + if(count($products) > 0) { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $this->getProducts()).') + ') as $order) { + $orders[] = $order['id_order']; + } + } + + return $orders; + } + + public function getMultiForStats($orders = array(), $nb_sale) + { + $products = $this->getProducts(); + + if(count($products) > 0) { + if (count($orders) > 0) { + $_orders = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity` + FROM `'._DB_PREFIX_.'privatesale_category` c + LEFT JOIN `'._DB_PREFIX_.'product` p + ON c.`id_category` = p.`id_category_default` + LEFT JOIN `'._DB_PREFIX_.'order_detail` d + ON d.`product_id` = p.`id_product` + WHERE d.`id_order` IN ('.implode(', ', $orders).') + ORDER BY d.`product_quantity` ASC + ') as $row) { + if(!isset($_orders[(int)$row['id_order']])) { + $_orders[(int)$row['id_order']] = array(); + } + if( !isset($_orders[(int)$row['id_order']][$row['id_sale']]) ){ + $_orders[(int)$row['id_order']][$row['id_sale']] = 1; + } + } + + $multi = array(); + foreach ($_orders as $key => $order) { + if(count($order) >= (int)$nb_sale) { + $multi[] = $key; + } + } + return $multi; + } + } else { + return array(); + } + } + + public function getOrdersFromSaleMulti($id_status=NULL, $nb_sale = 2) { + $orders = array(); + $products = $this->getProducts(); + + if(count($products) > 0) { + if($id_status === NULL) { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } else { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT h1.`id_order` AS `id_order` + FROM `'._DB_PREFIX_.'order_history` h1 + LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + WHERE h2.`id_order_history` IS NULL + AND h1.`id_order_state` IN ('.implode(',', $id_status).') + AND h1.`id_order` IN ( + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ) + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } + + $orders_not_sended = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT(o.`id_order`) AS `id_order` + FROM `'._DB_PREFIX_.'order_detail` od + LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order` + WHERE o.`id_order` IN ('.implode(', ', $orders).') + AND od.`product_id` IN ('.implode(', ', $products).') + AND od.`id_order_detail` NOT IN ( + SELECT `id_order_detail` + FROM `'._DB_PREFIX_.'lapostews` la + WHERE la.`quantity` = (od.`product_quantity` - od.`product_quantity_refunded`) + )' + ) as $order) { + $orders_not_sended[] = $order['id_order']; + }; + + $orders2 = array(); + if(count($orders) > 0) { + $_orders = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity` + FROM `'._DB_PREFIX_.'privatesale_category` c + LEFT JOIN `'._DB_PREFIX_.'product` p + ON c.`id_category` = p.`id_category_default` + LEFT JOIN `'._DB_PREFIX_.'order_detail` d + ON d.`product_id` = p.`id_product` + WHERE d.`id_order` IN ('.implode(', ', $orders_not_sended).') + ORDER BY d.`product_quantity` ASC + ') as $row) { + if(!isset($_orders[(int)$row['id_order']])) { + $_orders[(int)$row['id_order']] = array(); + } + if( !isset($_orders[(int)$row['id_order']][$row['id_sale']]) ){ + $_orders[(int)$row['id_order']][$row['id_sale']] = 1; + } + } + + $order_print = array(); + foreach ($_orders as $key => $order) { + // M2 + if($nb_sale == 2) { + if( count($order) == $nb_sale) { + $order_print[] = $key; + } + } + } + + $order_print_range = array(); + foreach ($order_print as $key => $order) { + $total = Db::getInstance()->getValue(' + SELECT COUNT(d.`id_order_detail`) as total_ref + FROM `'._DB_PREFIX_.'order_detail` d + WHERE `id_order` = '. (int)$order .' + AND `id_order_detail` NOT IN ( + SELECT DISTINCT `id_order_detail` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ) + ORDER BY total_ref ASC' + ); + $order_print_range[$order] = $total; + } + + unset($order_print); + asort($order_print_range); + $order_print = array_keys($order_print_range); + } + } + + if(count($order_print) > 0) { + $printed = array(); + foreach($order_print as $order) { + $printed[] = '('.(int) $order.')'; + } + + Db::getInstance()->ExecuteS(' + INSERT IGNORE INTO `'._DB_PREFIX_.'privatesale_printedinvoices` + VALUES '.implode(', ', $printed).' + '); + } + + return $order_print; + } + + + // public function getOrdersFromSaleMulti($id_status=NULL, $nb_sale = 2) { + // $orders = array(); + // $products = $this->getProducts(); + + // if(count($products) > 0) { + // if($id_status === NULL) { + // foreach(Db::getInstance()->ExecuteS(' + // SELECT DISTINCT `id_order` + // FROM `'._DB_PREFIX_.'order_detail` + // WHERE `product_id` IN ('.implode(', ', $products).') + // ') as $order) { + // $orders[] = (int) $order['id_order']; + // } + // } else { + // foreach(Db::getInstance()->ExecuteS(' + // SELECT DISTINCT h1.`id_order` AS `id_order` + // FROM `'._DB_PREFIX_.'order_history` h1 + // LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + // ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + // WHERE h2.`id_order_history` IS NULL + // AND h1.`id_order_state` IN ('.implode(',', $id_status).') + // AND h1.`id_order` IN ( + // SELECT DISTINCT `id_order` + // FROM `'._DB_PREFIX_.'order_detail` + // WHERE `product_id` IN ('.implode(', ', $products).') + // ) + // ') as $order) { + // $orders[] = (int) $order['id_order']; + // } + // } + + // $orders_not_sended = array(); + // foreach(Db::getInstance()->ExecuteS(' + // SELECT DISTINCT(o.`id_order`) AS `id_order` + // FROM `'._DB_PREFIX_.'order_detail` od + // LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order` + // WHERE o.`id_order` IN ('.implode(', ', $orders).') + // AND od.`product_id` IN ('.implode(', ', $products).') + // AND od.`id_order_detail` NOT IN ( + // SELECT `id_order_detail` + // FROM `'._DB_PREFIX_.'lapostews` la + // WHERE la.`quantity` = (od.`product_quantity` - od.`product_quantity_refunded`) + // )' + // ) as $order) { + // $orders_not_sended[] = $order['id_order']; + // }; + + // $orders2 = array(); + // if(count($orders) > 0) { + // $_orders = array(); + // foreach(Db::getInstance()->ExecuteS(' + // SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity` + // FROM `'._DB_PREFIX_.'privatesale_category` c + // LEFT JOIN `'._DB_PREFIX_.'product` p + // ON c.`id_category` = p.`id_category_default` + // LEFT JOIN `'._DB_PREFIX_.'order_detail` d + // ON d.`product_id` = p.`id_product` + // WHERE d.`id_order` IN ('.implode(', ', $orders_not_sended).') + // ORDER BY d.`product_quantity` ASC + // ') as $row) { + // if(!isset($_orders[(int)$row['id_order']])) { + // $_orders[(int)$row['id_order']] = array(); + // } + // if( !isset($_orders[(int)$row['id_order']][$row['id_sale']]) ){ + // $_orders[(int)$row['id_order']][$row['id_sale']] = 1; + // } + // } + + // $order_print = array(); + // foreach ($_orders as $key => $order) { + // // M2 + // if($nb_sale == 2) { + // if( count($order) == $nb_sale) { + // $order_print[] = $key; + // } + // } + // } + // } + // } + + // if(count($order_print) > 0) { + // $printed = array(); + // foreach($order_print as $order) { + // $printed[] = '('.(int) $order.')'; + // } + + // Db::getInstance()->ExecuteS(' + // INSERT IGNORE INTO `'._DB_PREFIX_.'privatesale_printedinvoices` + // VALUES '.implode(', ', $printed).' + // '); + // } + + // return $order_print; + // } + + /** + * @param $id_status + * @param array $id_sales + * @param date $date_from, $date_to + * @param boolean $multi_only (if true, check only sales past in params) + * @return array order_print + */ + public static function getOrdersM3($id_status=NULL, $id_sales = array(), $date_from, $date_to, $multi_only = false) { + if($id_sales < 3) { + return false; + } + + $orders = array(); + + foreach ($id_sales as $key => $id_sale) { + $sale = new Sale($id_sale); + $products = $sale->getProducts(); + + if(count($products) > 0) { + if($id_status === NULL) { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT d.`id_order` + FROM `'._DB_PREFIX_.'order_detail` d + LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = d.`id_order` + WHERE `product_id` IN ('.implode(', ', $products).') + AND o.`invoice_date` >= "'.pSQL($date_from).' 00:00:00" + AND o.`invoice_date` <= "'.pSQL($date_to).' 23:59:59" + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } else { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT h1.`id_order` AS `id_order` + FROM `'._DB_PREFIX_.'order_history` h1 + LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = h1.`id_order` + LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + WHERE h2.`id_order_history` IS NULL + AND h1.`id_order_state` IN ('.implode(',', $id_status).') + AND o.`invoice_date` >= "'.pSQL($date_from).' 00:00:00" + AND o.`invoice_date` <= "'.pSQL($date_to).' 23:59:59" + AND h1.`id_order` IN ( + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ) + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } + } + } + + + $orders = array_unique($orders); + + if(count($orders) > 0) { + $_orders = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity` + FROM `'._DB_PREFIX_.'privatesale_category` c + LEFT JOIN `'._DB_PREFIX_.'product` p + ON c.`id_category` = p.`id_category_default` + LEFT JOIN `'._DB_PREFIX_.'order_detail` d + ON d.`product_id` = p.`id_product` + WHERE d.`id_order` IN ('.implode(', ', $orders).') + ORDER BY d.`product_quantity` ASC + ') as $row) { + if(!isset($_orders[(int)$row['id_order']])) { + $_orders[(int)$row['id_order']] = array(); + } + if(!isset($_orders[(int)$row['id_order']][$row['id_sale']]) ) { + $_orders[(int)$row['id_order']][$row['id_sale']] = 1; + } + } + + $order_print = array(); + + foreach ($_orders as $key => $order) { + + // supprime les orders avec plus de 2 ventes pour les multi only + if($multi_only) { + if (count($order) > 2) { + continue; + } + } + + // exclu les ventes avec des id_sales non selectionnes + $sales_order = array_keys($order); + foreach ($sales_order as $sale) { + if (!in_array($sale, $id_sales)) { + continue 2; + } + } + + $diff = array_intersect($sales_order, $id_sales); + if ($multi_only) { + // si multionly, test différence exacte + if (count($diff) == 2) { + $order_print[] = $key; + } + } else { + if (count($diff) >= 3) { + $order_print[] = $key; + } + } + } + } + + if(count($order_print) > 0) { + $printed = array(); + foreach($order_print as $order) { + $printed[] = '('.(int) $order.')'; + } + + Db::getInstance()->ExecuteS(' + INSERT IGNORE INTO `'._DB_PREFIX_.'privatesale_printedinvoices` + VALUES '.implode(', ', $printed).' + '); + } + + if ($multi_only) { + return $order_print; + } else { + // tri par date pour les M3+ + sort($order_print); + return $order_print; + } + + return $order_print; + } + + + public function getOrdersFromSale($id_status=NULL, $single_only=TRUE, $send_test = FALSE) { + $orders = array(); + $products = $this->getProducts(); + + if(count($products) > 0) { + if($id_status === NULL) { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } else { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT h1.`id_order` AS `id_order` + FROM `'._DB_PREFIX_.'order_history` h1 + LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + WHERE h2.`id_order_history` IS NULL + AND h1.`id_order_state` IN ( '.implode(',', $id_status) .') + AND h1.`id_order` IN ( + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `product_id` IN ('.implode(', ', $products).') + ) + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } + + // TEST pour les commandes en 48h + if ($send_test) { + $orders_not_sended = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT(o.`id_order`) AS `id_order` + FROM `'._DB_PREFIX_.'order_detail` od + LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order` + WHERE o.`id_order` IN ('.implode(', ', $orders).') + AND od.`product_id` IN ('.implode(', ', $products).') + AND od.`id_order_detail` NOT IN ( + SELECT `id_order_detail` + FROM `'._DB_PREFIX_.'lapostews` la + WHERE la.`quantity` = (od.`product_quantity` - od.`product_quantity_refunded`) + )' + ) as $order) { + $orders_not_sended[] = $order['id_order']; + }; + + // tri orders par nb product + $order_ordered = array(); + foreach ($orders_not_sended as $key => $order) { + $total_ref = Db::getInstance()->getValue(' + SELECT COUNT(`id_order_detail`) + FROM `'._DB_PREFIX_.'order_detail` + WHERE `id_order` = '.(int) $order + ); + $order_ordered[(int) $order] = $total_ref; + } + asort($order_ordered); + return array_keys($order_ordered); + // return $orders_not_sended; + } + + if(!$single_only) { + return $orders; + } + + $orders2 = array(); + + if(count($orders) > 0) { + $_orders = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_order` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `id_order` IN ('.implode(', ', $orders).') + AND `product_quantity` - `product_quantity_return` != 0 + ORDER BY `product_name` ASC + ') as $order) { + if(!isset($_orders[$order['id_order']])) { + $_orders[$order['id_order']] = 1; + } else { + $_orders[$order['id_order']]++; + } + } + + $__orders = array(); + foreach($_orders as $id_order => $count) { + if(!isset($__orders[$count])) { + $__orders[$count] = array(); + } + $__orders[$count][] = $id_order; + } + + $keys = array_keys($__orders); + asort($keys); + foreach($keys as $key) { + // tri les commandes avec 1 produit + if ($key == 1) { + $tmp_order = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_order` + FROM `ps_order_detail` + WHERE `id_order` IN ('.implode(',', $__orders[$key]).') + ORDER BY `product_reference` + ') as $value) { + $tmp_order[] = $value['id_order']; + } + $__orders[$key] = $tmp_order; + } + + foreach($__orders[$key] as $order) { + $orders2[$order] = TRUE; + } + } + + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_order`, `product_id` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `id_order` IN ('.implode(', ', $orders).') + ') as $order) { + $orders2[(int) $order['id_order']] = $orders2[(int) $order['id_order']] && in_array($order['product_id'], $products); + } + } + + $orders = array(); + + foreach($orders2 as $k => $v) { + if($v) { + $orders[] = $k; + } + } + } + + if(count($orders) > 0) { + $printed = array(); + foreach($orders as $order) { + $printed[] = '('.(int) $order.')'; + } + + Db::getInstance()->ExecuteS(' + INSERT IGNORE INTO `'._DB_PREFIX_.'privatesale_printedinvoices` + VALUES '.implode(', ', $printed).' + '); + } + + return $orders; + } + + public static function _recurse_sort($product_sales, $product_orders, $sales, $index, &$result) { + set_time_limit(180); + $sale_orders = array(); + + foreach($product_sales[$sales[$index]] as $product) { + foreach($product_orders[$product] as $order) { + if(!in_array($order, $sale_orders)) { + $sale_orders[] = $order; + } + } + } + + foreach($sale_orders as $order) { + if(!isset($result[$order])) { + $result[$order] = array(); + } + if(!in_array(sprintf('%05d', $index + 1), $result[$order])) { + $result[$order][] = sprintf('%05d', $index + 1); + } + } + + for($i=$index+1, $l=count($sales); $i < $l; $i++) { + self::_recurse_sort($product_sales, $product_orders, $sales, $i, $result); + } + + return $result; + } + + public static function getSalesByDate($id_status = array(), $date_start=NULL, $date_end=NULL) { + $sales_ids = array(); + $result = array(); + + if($date_start != NULL) { + $where[] = ' `invoice_date` >= "'.pSQL($date_start).' 00:00:00"'; + } + if($date_end != NULL) { + $where[] = ' `invoice_date` <= "'.pSQL($date_end).' 23:59:59"'; + } + + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT h1.`id_order` AS `id_order` + FROM `'._DB_PREFIX_.'order_history` h1 + LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + WHERE h2.`id_order_history` IS NULL + AND h1.`id_order_state` IN ('. implode(',', $id_status).') + AND h1.`id_order` IN ( + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'orders` + '.(count($where) > 0? 'WHERE '.implode(' AND ', $where): '').' + ) + ') as $order) { + $orders[] = (int) $order['id_order']; + } + + $total_orders = count($orders); + $_orders = array_chunk($orders, 150); + + foreach ($_orders as $key => $order_ids) { + foreach (Db::getInstance()->ExecuteS(' + SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity`, ps.`date_start` + FROM `'._DB_PREFIX_.'privatesale_category` c + LEFT JOIN `'._DB_PREFIX_.'product` p + ON c.`id_category` = p.`id_category_default` + LEFT JOIN `'._DB_PREFIX_.'privatesale` ps + ON ps.`id_sale` = c.`id_sale` + LEFT JOIN `'._DB_PREFIX_.'order_detail` d + ON d.`product_id` = p.`id_product` + WHERE d.`id_order` IN ('.implode(', ', $order_ids).') + ORDER BY ps.`date_start` ASC + ') as $row) { + if (!in_array($row['id_sale'], $sales_ids)) { + $sales_ids[] = $row['id_sale']; + } + } + } + + // tri par date de début + $sales_ids_bis = array(); + foreach (Db::getInstance()->ExecuteS(' + SELECT `id_sale` + FROM `'._DB_PREFIX_.'privatesale` + WHERE `id_sale` IN ('.implode(', ', $sales_ids).') + ORDER BY `date_start` ASC') as $row ) { + if (!in_array($row['id_sale'], $sales_ids_bis)) { + $sales_ids_bis[] = $row['id_sale']; + } + } + + foreach ($sales_ids_bis as $key => $sale_id) { + $data = self::_getInfoSale((int)$sale_id); + $sale = new Sale($sale_id); + $total_products = $sale->getProducts(); + $total_products_wh_ean = self::_getNbNoEANProduct($total_products); + $data[0]['percent_ean'] = number_format(count($total_products_wh_ean) * 100 / count($total_products), 2); + $result[] = $data[0]; + } + + + return $result; + } + + private static function _getNbNoEANProduct($products) { + return Db::getInstance()->executeS(' + SELECT `id_product` + FROM `'._DB_PREFIX_.'product` + WHERE `id_product` IN ('.implode(',', $products).') + AND `ean13` != "" + '); + } + + + private static function _getInfoSale($id_sale) { + return Db::getInstance()->executeS(' + SELECT + p.`id_sale`, + p.`date_start`, + l.`name` as title, + p.`delivery_delay` as delivery_delay + FROM `ps_privatesale` p + LEFT JOIN `ps_privatesale_category` c ON c.`id_sale` = p.`id_sale` + LEFT JOIN `ps_category_lang` l ON l.`id_category` = p.`id_category` + WHERE p.`id_sale` = '.(int) $id_sale.' + AND l.`id_lang` = '. (int) Context::getContext()->language->id.' + LIMIT 1'); + } + + public static function getOrdersByDate($crossed_only=TRUE, $date_start=NULL, $date_end=NULL, $id_status=NULL) { + set_time_limit(180); + global $cookie; + $product_sales = array(); + + $orders = array(); + $where = array(); + + if($date_start != NULL) { + $where[] = ' `invoice_date` >= "'.pSQL($date_start).' 00:00:00"'; + } + if($date_end != NULL) { + $where[] = ' `invoice_date` <= "'.pSQL($date_end).' 23:59:59"'; + } + + if($id_status === NULL) { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'orders` + '.(count($where) > 0? 'WHERE '.implode(' AND ', $where): '').' + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } else { + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT h1.`id_order` AS `id_order` + FROM `'._DB_PREFIX_.'order_history` h1 + LEFT JOIN `'._DB_PREFIX_.'order_history` h2 + ON (h1.`id_order` = h2.`id_order` AND h1.`id_order_history` < h2.`id_order_history`) + WHERE h2.`id_order_history` IS NULL + AND h1.`id_order_state` = '.(int) $id_status.' + AND h1.`id_order` IN ( + SELECT DISTINCT `id_order` + FROM `'._DB_PREFIX_.'orders` + '.(count($where) > 0? 'WHERE '.implode(' AND ', $where): '').' + ) + ') as $order) { + $orders[] = (int) $order['id_order']; + } + } + + if($crossed_only) { + $_orders = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT DISTINCT `id_order`, COUNT(*) AS `total` + FROM `'._DB_PREFIX_.'order_detail` + WHERE `id_order` IN ('.implode(', ', $orders).') + GROUP BY `id_order` + ') as $row) { + if($row['total'] > 1) { + $_orders[] = (int) $row['id_order']; + } + } + + $orders = $_orders; + } + + if(count($orders) > 0) { + $product_orders = array(); + + foreach(Db::getInstance()->ExecuteS(' + SELECT d.`id_order`, p.`id_product`, c.`id_sale`, GREATEST(d.`product_quantity` - d.`product_quantity_return`, 0) AS `product_quantity` + FROM `'._DB_PREFIX_.'privatesale_category` c + LEFT JOIN `'._DB_PREFIX_.'product` p + ON c.`id_category` = p.`id_category_default` + LEFT JOIN `'._DB_PREFIX_.'order_detail` d + ON d.`product_id` = p.`id_product` + WHERE d.`id_order` IN ('.implode(', ', $orders).') + ORDER BY d.`product_quantity` ASC + ') as $row) { + if(!isset($product_sales[(int) $row['id_sale']])) { + $product_sales[(int) $row['id_sale']] = array(); + } + if(!in_array((int) $row['id_product'], $product_sales[(int) $row['id_sale']])) { + $product_sales[(int) $row['id_sale']][] = (int) $row['id_product']; + } + + if(!isset($product_orders[(int) $row['id_product']])) { + $product_orders[(int) $row['id_product']] = array(); + } + $product_orders[(int) $row['id_product']][] = (int) $row['id_order']; + } + + // order sales by end date + $sales = array(); + + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_sale` + FROM `'._DB_PREFIX_.'privatesale` p + LEFT JOIN `'._DB_PREFIX_.'category_lang` c + ON p.`id_category` = c.`id_category` + WHERE p.`id_sale` IN ('.implode(', ', array_keys($product_sales)).') + AND c.`id_lang` = '.(int) $cookie->id_lang.' + ORDER BY p.`date_end` ASC, c.`name` ASC + ') as $sale) { + $sales[] = (int) $sale['id_sale']; + } + + $sorted_orders = array(); + $orders = array(); + + // NEW // + $sale_orders = array(); + $order_sales = array(); + foreach($sales as $id_sale) { + foreach($product_sales[$id_sale] as $id_product) { + foreach($product_orders[$id_product] as $id_order) { + if(!isset($sale_orders[$id_sale])) { + $sale_orders[$id_sale] = array(); + } + if(!isset($order_sales[$id_order])) { + $order_sales[$id_order] = array(); + } + + if(!in_array($id_order, $sale_orders[$id_sale])) { + $sale_orders[$id_sale][] = $id_order; + } + if(!in_array($id_sale, $order_sales[$id_order])) { + $order_sales[$id_order][] = $id_sale; + } + } + } + } + + $orders = array(); + + for($i=0, $l=count($sale_orders); $i < $l; $i++) { + //echo $i."\n"; + //echo $sales[$i]."\n"; + foreach($sale_orders[$sales[$i]] as $id_order) { + //echo "\t".$id_order."\n"; + if(!$crossed_only || $crossed_only && count($order_sales[$id_order]) > 1) { + for($j=$i+1; $j < $l; $j++) { + if(count($order_sales[$id_order]) == 2) { + if(in_array($sales[$j], $order_sales[$id_order]) && !in_array($id_order, $orders)) { + $orders[] = $id_order; + } + } else { + for($k=$j+1; $k < $l; $k++) { + if(in_array($sales[$k], $order_sales[$id_order]) && !in_array($id_order, $orders)) { + $orders[] = $id_order; + } + } + } + } + } + } + } + + //var_dump($orders);exit; + + // + + //foreach(self::_recurse_sort($product_sales, $product_orders, $sales, 0, $sorted_orders) as $order => $ids) { + // if(!$crossed_only || ($crossed_only && count($ids) > 1)) { + // $orders[$order] = implode('-', $ids); + // } + //} + + asort($orders); + } + + /*$orders = array_keys($orders);*/ + + if(count($orders) > 0) { + $printed = array(); + foreach($orders as $order) { + $printed[] = '('.(int) $order.')'; + } + + Db::getInstance()->ExecuteS(' + INSERT IGNORE INTO `'._DB_PREFIX_.'privatesale_printedinvoices` + VALUES '.implode(', ', $printed).' + '); + } + + return $orders; + } + + public static function getSales($enabled=NULL, $logout=NULL, $featured=NULL, $future=NULL, $lite=FALSE, $pub=FALSE, $order_by='`date_end` ASC', $limit=NULL, $sale_type=NULL, $site_version=FALSE) { + global $cookie; + $result = array(); + $where = array(); + + $query = ' + SELECT p.`id_sale` + FROM `'._DB_PREFIX_.'privatesale` p + '; + + // if($sale_type !== NULL){ + // $query.= ' LEFT JOIN `'._DB_PREFIX_.'privatesale_type` pt ON(pt.id_sale = p.id_sale AND pt.id_sale_type = '. $sale_type.')'; + // } + + if($site_version !== FALSE) { + $query .= ' + LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` sv + ON p.`id_sale` = sv.`id_sale` + '; + $where[] = 'sv.`version` = "'.pSQL($site_version).'"'; + } + + if($enabled !== NULL OR $logout !== NULL OR $featured !== NULL OR $future !== NULL) { + $enabled !== null? $where[] = '`enabled` = '.(int) $enabled: TRUE; + $logout !== null? $where[] = '`logout` = '.(int) $logout: TRUE; + $pub != FALSE? '': $where[] = '`public` = 0'; + $featured !== null? $where[] = '`featured` = '.(int) $featured: TRUE; + // $sale_type !== NULL? $where[] = '`sale_type` = '.(int) $sale_type: TRUE; + + if($future === 'current') { + $where[] = '`date_start` < NOW() AND `date_end` > NOW()'; + } elseif($future === 'not_ended') { + $where[] = '`date_end` > NOW()';} + elseif($future === 'all') { + $where[] = ' 1 = 1'; + } elseif ($future === 'today') { + $where[] = 'CAST(`date_start` AS DATE) = CAST(NOW() AS DATE)'; + } elseif ($future === 'last') { + $where[] = 'CAST(`date_end` AS DATE) = CAST(NOW() AS DATE)'; + } elseif(is_int($future)) { + $where[] = '(`date_start` > NOW() AND `date_start` < DATE_ADD(NOW(), INTERVAL '.$future.' DAY))'; + } elseif($future === TRUE) { + $where[] = '`date_start` > NOW()'; + } elseif($future === FALSE) { + $where[] = '`date_start` < NOW() AND `date_end` < NOW()'; + } + $query .= 'WHERE '.implode(' AND ', $where); + } + + // if($sale_type !== NULL){ + // $query.= ' AND pt.id_sale_type = '. $sale_type; + // } + + $query .= ' ORDER BY '.$order_by; + + if($limit !== NULL) { + $query .= ' LIMIT '.$limit; + } + + if($sales = Db::getInstance()->ExecuteS($query)) { + if($lite) { + foreach($sales AS $sale) { + $result[] = $sale['id_sale']; + } + } else { + foreach($sales AS $sale) { + $result[] = new Sale($sale['id_sale']); + } + } + } + return $result; + } + + + public static function getOthersSales($enabled=NULL, $logout=NULL, $featured=NULL, $future=NULL, $lite=FALSE, $pub=FALSE, $order_by='`date_end` ASC', $site_version) { + global $cookie; + + $id_sales = array(); + $result = array(); + $query = ' + SELECT p.`id_sale` + FROM `'._DB_PREFIX_.'privatesale` p + LEFT JOIN `'._DB_PREFIX_.'privatesale_site_version` cv ON (cv.`id_sale` = p.`id_sale`) + '; + $where = array(); + $enabled !== null? $where[] = '`enabled` = '.(int) $enabled: TRUE; + $pub != FALSE? '': $where[] = '`public` = 0'; + + if ($site_version) { + $where[] = ' cv.`version` = "'.pSQL($site_version).'"'; + } + + if($future === 'current') { + $where[] = '`date_start` < NOW() AND `date_end` > NOW()'; + } + $query .= 'WHERE '.implode(' AND ', $where); + + // if($sale_type !== NULL){ + // $query.= ' AND pt.id_sale_type = '. $sale_type; + // } + $query .= ' ORDER BY '.$order_by; + + if($sales = Db::getInstance()->ExecuteS($query)) { + foreach($sales AS $sale) { + $id_sales[] = $sale['id_sale']; + } + $result = Db::getInstance()->ExecuteS(' + SELECT s.id_sale, s.id_category, s.date_end, c.link_rewrite, c.name + FROM `'._DB_PREFIX_.'privatesale` s + LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON ( c.id_category = s.id_category ) + WHERE c.id_lang = '. (int)$cookie->id_lang .' + AND s.id_sale IN ('. implode(',', $id_sales).')'); + } + return $result; + } + + + public function getCarriers() { + $carriers = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_carrier` + FROM `'._DB_PREFIX_.'privatesale_carrier` + WHERE `id_sale` = '.$this->id + ) as $carrier) { + $carriers[] = $carrier['id_carrier']; + } + return $carriers; + } + + public static function flatRecurseCategory($id_category, $children=array()) { + $children[] = (int) $id_category; + $_children = Db::getInstance()->ExecuteS(' + SELECT `id_category` + FROM `'._DB_PREFIX_.'category` + WHERE `id_parent` = '.(int) $id_category + ); + foreach($_children as $child) { + $children = Sale::flatRecurseCategory($child['id_category'], $children); + } + return $children; + } + + public static function getCategoriesFromCache($id_sale) { + $categories = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_category` + FROM `'._DB_PREFIX_.'privatesale_category` + WHERE `id_sale` = '.$id_sale + ) as $category) { + $categories[] = $category['id_category']; + } + return $categories; + } + + public function buildCategoryCache() { + $categories = Sale::flatRecurseCategory($this->id_category); + Db::getInstance()->Execute(' + DELETE FROM `'._DB_PREFIX_.'privatesale_category` + WHERE `id_sale` = '.$this->id + ); + foreach($categories as $category) { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_category` VALUES ( + '.$this->id.', + '.$category.' + ) + '); + } + } + + public static function getSaleFromCategory($id=0, $use_cache=TRUE) { + if($use_cache) { + $id_sale = Db::getInstance()->ExecuteS(' + SELECT `id_sale` + FROM `'._DB_PREFIX_.'privatesale_category` + WHERE `id_category` = '.$id + ); + } else { + $current = $id; + $parent = $id; + $root = Configuration::get('PRIVATESALES_ROOT'); + while($parent > $root) { + $current = $parent; + $result = Db::getInstance()->ExecuteS(' + SELECT `id_parent` + FROM `'._DB_PREFIX_.'category` + WHERE `id_category` = '.$current + ); + $parent = $result[0]['id_parent']; + } + $id_sale = Db::getInstance()->ExecuteS(' + SELECT `id_sale` + FROM `'._DB_PREFIX_.'privatesale` + WHERE `id_category` = '.$current + ); + } + if(count($id_sale) > 0) { + return new Sale((int) $id_sale[0]['id_sale']); + } + } + + public function getProducts($order = FALSE) { + $categories = Sale::flatRecurseCategory($this->id_category); + + $products = array(); + foreach(Db::getInstance()->ExecuteS(' + SELECT `id_product` + FROM `'._DB_PREFIX_.'product` + WHERE `id_category_default` IN ('.implode(', ', $categories).') + '.(($order) ? ' ORDER BY `reference` ASC' : '') + ) as $product) { + $products[] = $product['id_product']; + } + + return $products; + } + + public function end($run_hook=FALSE) { + if ($this->id_category == 1) { + return FALSE; + } + + $this->enabled = FALSE; + $this->save(); + + $categories = Sale::flatRecurseCategory($this->id_category); + + $products = $this->getProducts(); + + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'product` + SET `active` = 0 + WHERE `id_product` IN ('.implode(', ', $products).') + '); + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'category` + SET `active` = 0 + WHERE `id_category` IN ('.implode(', ', $categories).') + '); + + if($run_hook) { + Module::hookExec('privatesales_end', array('sale' => $this)); + } + } + + public function subscribe($email=NULL) { + if($email !== NULL) { + $customer = new Customer(); + $customer->getByEmail($email); + + if(count(Db::getInstance()->ExecuteS(' + SELECT `email` + FROM `'._DB_PREFIX_.'privatesale_notify` + WHERE `email` = "'.pSQL($email).'" + AND `id_sale` = '.$this->id.' + ')) > 0) { + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'privatesale_notify` + SET `deleted` = 0 + WHERE `email` = "'.pSQL($email).'" + AND `id_sale` = '.$this->id.' + '); + } else { + Db::getInstance()->Execute(' + INSERT INTO `'._DB_PREFIX_.'privatesale_notify` + VALUES ( + '.$this->id.', + "'.pSQL($email).'", + '.($customer->id? $customer->id: 0).', + 0 + ) + '); + } + } + } + + public function isSubscribed($email=NULL) { + if($email !== NULL) { + if(count(Db::getInstance()->ExecuteS(' + SELECT `email` + FROM `'._DB_PREFIX_.'privatesale_notify` + WHERE `email` = "'.pSQL($email).'" + AND `id_sale` = '.$this->id.' + AND `deleted` = 0 + ')) > 0) { + return TRUE; + } + } + return FALSE; + } + + public function unsubscribe($email=NULL, $real_delete=FALSE) { + if($email !== NULL) { + if($real_delete === TRUE) { + Db::getInstance()->Execute(' + DELETE FROM `'._DB_PREFIX_.'privatesale_notify` + WHERE `email` = "'.pSQL($email).'" + AND `id_sale` = '.$this->id.' + '); + } else { + Db::getInstance()->Execute(' + UPDATE `'._DB_PREFIX_.'privatesale_notify` + SET `deleted` = 1 + WHERE `email` = "'.pSQL($email).'" + AND `id_sale` = '.$this->id.' + '); + } + } + } + + static public function getNbSales(){ + $sql = 'SELECT count(id_sale) + FROM `'._DB_PREFIX_.'privatesale` p'; + return Db::getInstance()->getValue($sql); + } + + public static function getByPosition($position = 0){ + $sql = 'SELECT id_sale + FROM `'._DB_PREFIX_.'privatesale` p + WHERE position = '. $position; + $id_sale = Db::getInstance()->getValue($sql); + + if(!empty($id_sale)){ + return $sale = new Sale($id_sale); + } + return false; + } +} + + +} diff --git a/modules/privatesales/Sale_.php b/modules/privatesales/Sale_.php new file mode 100755 index 00000000..e69de29b diff --git a/modules/privatesales/add.png b/modules/privatesales/add.png new file mode 100755 index 00000000..00be352c Binary files /dev/null and b/modules/privatesales/add.png differ diff --git a/modules/privatesales/atom.tpl b/modules/privatesales/atom.tpl new file mode 100755 index 00000000..d5ff45ad --- /dev/null +++ b/modules/privatesales/atom.tpl @@ -0,0 +1,26 @@ + + + <![CDATA[{l s='Upcoming sales on' mod='privatesales'} {$shop_name|escape:html:'UTF-8'}]]> + + {$date} + + {$base_dir_ssl} + + {$base_dir_ssl}{if $rewriting}{$feed_url}{else}modules/privatesales/feed.php{/if}?format={$format}&id_lang={$lang} + +{foreach $sales as $sale} + + <![CDATA[{$sale->title[$lang]|escape:html:'UTF-8'}]]> + + {$base_dir_ssl}{if $rewriting}{$base_url}/{$sale->id}-{$sale->title[$lang]|str2url}{else}modules/privatesales/trailer.php?id_sale={$sale->id}{/if} + {$sale->date_upd|strtotime|date_format:'Y-m-d\TH:i:sP'} + + {$sale->title[$lang]|escape:html:'UTF-8'} +
+

{$sale->title[$lang]|escape:html:'UTF-8'}

+

{l s='To' mod='privatesales'} {$sale->date_end|date_format:'%A %e %b %H:%M'}

+
+