addition of philea module and helper class for admin
551
adm/helpers/HelperForm.php
Normal file
@ -0,0 +1,551 @@
|
||||
<?php
|
||||
|
||||
class HelperForm{
|
||||
|
||||
public $_forms = array();
|
||||
public $_debug = false;
|
||||
|
||||
public $_html;
|
||||
public $_object;
|
||||
public $_css;
|
||||
public $_script; // inc js
|
||||
public $_js; // user js
|
||||
public $_messages;
|
||||
|
||||
public $_selectCheck;
|
||||
public $_dateTime;
|
||||
|
||||
public function __construct(){
|
||||
$this->_html = '';
|
||||
$this->_object = NULL;
|
||||
$this->_css = '';
|
||||
$this->_script = '';
|
||||
$this->_js = '';
|
||||
$this->_messages = '';
|
||||
$this->_selectCheck = false;
|
||||
$this->_dateTime = false;
|
||||
}
|
||||
|
||||
public function renderForm($display = true, $action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){
|
||||
|
||||
$this->generateForms();
|
||||
|
||||
$this->_script .= '<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery-ui-1.8.20.custom.min.js"></script>';
|
||||
if ($this->_selectCheck)
|
||||
$this->includeSelectCheck();
|
||||
if ($this->_dateTime)
|
||||
$this->includeDateTime();
|
||||
$this->addFilters();
|
||||
$form =
|
||||
'<style type="text/css">
|
||||
@import url("'.__PS_BASE_URI__.'adm/helpers/includes/jquery-ui-1.8.20.custom.css");
|
||||
label.radio_label { float: none; }
|
||||
label.checkbox_label { float: none; }
|
||||
.margin-form.checkbox { padding-top: 3px; }
|
||||
' . $this->_css . '
|
||||
</style>' .
|
||||
$this->_script .
|
||||
($this->_messages ? implode("\n", $this->_messages) : '') .
|
||||
$this->_html .
|
||||
$this->_js; // display user js after render form
|
||||
|
||||
if ($display)
|
||||
echo $form;
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function generateForms($action = NULL, $method = 'POST', $enctype = 'multipart/form-data'){
|
||||
if (!$this->_forms || empty($this->_forms))
|
||||
return;
|
||||
|
||||
if (!$method)
|
||||
$method = 'POST';
|
||||
if (!$enctype)
|
||||
$enctype = 'multipart/form-data';
|
||||
|
||||
foreach ($this->_forms as $form) {
|
||||
$action = isset($form['action']) ? $form['action'] : $action;
|
||||
$method = isset($form['method']) ? $form['method'] : $method;
|
||||
$enctype = isset($form['enctype']) ? $form['enctype'] : $enctype;
|
||||
$css = isset($form['style']) ? $form['style'] : '';
|
||||
|
||||
// OPEN FORM
|
||||
$this->_html .= '<form action="'.$action.'" method="'.$method.'" enctype="'.$enctype.'">';
|
||||
$id = (isset($form['id']) && $form['id']) ? $form['id'] : false;
|
||||
$img = (isset($form['img']) && $form['img']) ? $form['img'] : false;
|
||||
$css = (isset($form['css']) && $form['css']) ? $form['css'] : false;
|
||||
|
||||
if (!isset($form['fieldsets'])){
|
||||
$form['fieldsets'] = array(
|
||||
array(
|
||||
'legend' => $form['legend'],
|
||||
'id' => $id,
|
||||
'img' => $img,
|
||||
'css' => $css,
|
||||
'inputs' => $form['inputs'],
|
||||
'actions' => $form['actions']
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($form['fieldsets'] as $fieldset) {
|
||||
|
||||
$id = (isset($fieldset['id']) && $fieldset['id']) ? $fieldset['id'] : false;
|
||||
$img = (isset($fieldset['img']) && $fieldset['img']) ? $fieldset['img'] : false;
|
||||
$css = (isset($fieldset['css']) && $fieldset['css']) ? $fieldset['css'] : false;
|
||||
|
||||
// OPEN FIELDSET
|
||||
$this->openFieldset($fieldset['legend'], $id, $img, $css);
|
||||
|
||||
foreach ($fieldset['inputs'] as $input)
|
||||
$this->addInput($input);
|
||||
|
||||
if (isset($fieldset['actions']) && $fieldset['actions']){
|
||||
$this->_html .= '<div class="margin-form">';
|
||||
foreach ($fieldset['actions'] as $action)
|
||||
$this->addAction($action);
|
||||
$this->_html .= '</div>';
|
||||
}
|
||||
$this->closeFieldset();
|
||||
}
|
||||
|
||||
$this->_html .= '</form>';
|
||||
}
|
||||
}
|
||||
|
||||
public function addJs($js){
|
||||
$this->_js .= $js;
|
||||
}
|
||||
|
||||
public function addCss($css){
|
||||
$this->_css .= $css;
|
||||
}
|
||||
|
||||
public function addInput($input){
|
||||
if (!isset($input['type']))
|
||||
return false;
|
||||
$html = (isset($input['html']) && $input['html']) ? $input['html'] : NULL;
|
||||
switch ($input['type']) {
|
||||
case 'text':
|
||||
$this->inputText($input);
|
||||
break;
|
||||
case 'select':
|
||||
$this->inputSelect($input);
|
||||
break;
|
||||
case 'bool':
|
||||
case 'radio':
|
||||
$this->inputBool($input);
|
||||
break;
|
||||
case 'checkbox':
|
||||
$this->inputCheckbox($input);
|
||||
break;
|
||||
case 'date':
|
||||
$this->inputDate($input);
|
||||
break;
|
||||
case 'textarea':
|
||||
$this->inputRte($input);
|
||||
break;
|
||||
case 'checkList':
|
||||
case 'selectCheck':
|
||||
$this->selectCheck($input);
|
||||
break;
|
||||
case 'file':
|
||||
$this->inputFile($input);
|
||||
break;
|
||||
case 'hidden':
|
||||
$this->inputHidden($input);
|
||||
break;
|
||||
case 'html':
|
||||
$this->_html .= $input['value'];
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function addAction($action){
|
||||
if (!isset($action['type']) || !isset($action['name']))
|
||||
return false;
|
||||
$css = (isset($action['css']) && $action['css']) ? $action['css'] : NULL;
|
||||
switch ($action['type']) {
|
||||
case 'button':
|
||||
$this->inputButton($action);
|
||||
break;
|
||||
case 'submit':
|
||||
$this->inputSubmit($action);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function includeSelectCheck(){
|
||||
$this->_css .= '
|
||||
a.multiSelect {
|
||||
background: #FFF url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown.gif) right -1px no-repeat;
|
||||
border: 1px solid #e0d0b1;
|
||||
padding-right: 20px;
|
||||
position: relative;
|
||||
cursor: default;
|
||||
text-decoration: none;
|
||||
color: black;
|
||||
display: -moz-inline-stack;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-top: 2px;
|
||||
}
|
||||
a.multiSelect:link, a.multiSelect:visited, a.multiSelect:hover, a.multiSelect:active {
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.multiSelect span {
|
||||
margin: 1px 0px 1px 3px;
|
||||
overflow: hidden;
|
||||
display: -moz-inline-stack;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
font-size: 12px;
|
||||
}
|
||||
a.multiSelect.hover {
|
||||
background-image: url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown_hover.gif);
|
||||
}
|
||||
a.multiSelect.active, a.multiSelect.focus {
|
||||
border: inset 1px #000000;
|
||||
}
|
||||
a.multiSelect.active {
|
||||
background-image: url('.__PS_BASE_URI__.'adm/helpers/includes/dropdown_active.gif);
|
||||
}
|
||||
.multiSelectOptions {
|
||||
margin-top: -1px;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden;
|
||||
border: solid 1px #b2b2b2;
|
||||
background: #ffffff;
|
||||
}
|
||||
.multiSelectOptions label {
|
||||
padding: 0px 2px;
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
float: none;
|
||||
text-align: left;
|
||||
width: auto;
|
||||
}
|
||||
.multiSelectOptions label.optGroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
.multiSelectOptions .optGroupContainer label {
|
||||
padding-left: 10px;
|
||||
font-size: 12px;
|
||||
color: #333333;
|
||||
padding: 2px 0px;
|
||||
}
|
||||
.multiSelectOptions.optGroupHasCheckboxes .optGroupContainer label {
|
||||
padding-left: 18px;
|
||||
}
|
||||
.multiSelectOptions input {
|
||||
vertical-align: middle;
|
||||
margin-right: 5px;
|
||||
}
|
||||
.multiSelectOptions label.checked {
|
||||
background-color: #dce5f8;
|
||||
}
|
||||
.multiSelectOptions label.optGroup {
|
||||
color: #000000;
|
||||
font-size: 12px;
|
||||
margin-bottom: 2px;
|
||||
}
|
||||
.multiSelectOptions label.selectAll {
|
||||
border-bottom: dotted 1px #cccccc;
|
||||
font-size: 12px;
|
||||
color: #333333;
|
||||
padding-top: 2px;
|
||||
margin: 0px 0px 6px;
|
||||
}
|
||||
.multiSelectOptions label.hover {
|
||||
background-color: #3399ff;
|
||||
color: #ffffff;
|
||||
}';
|
||||
$this->_script .= '
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery.multiSelect.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".multiSelectCheck").each(function(){
|
||||
var text = $(this).data("text");
|
||||
$(this).multiSelect({
|
||||
selectAllText: text,
|
||||
noneSelected: " ",
|
||||
oneOrMoreSelected: "*"
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function includeDateTime(){
|
||||
$this->_css .= '
|
||||
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
|
||||
.ui-timepicker-div dl { text-align: left; }
|
||||
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; }
|
||||
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; }
|
||||
.ui-timepicker-div td { font-size: 90%; }
|
||||
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }';
|
||||
$this->_script .= '
|
||||
<script type="text/javascript" src="'.__PS_BASE_URI__.'adm/helpers/includes/jquery-ui-timepicker-addon.js"></script>';
|
||||
$this->_js .= '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".date div input").datetimepicker({
|
||||
showSecond: true,
|
||||
timeFormat: "hh:mm:ss",
|
||||
dateFormat: "yy-mm-dd",
|
||||
addSliderAccess: true
|
||||
});
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function addFilters(){
|
||||
$this->_script .= '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {';
|
||||
// SELECT CHECK FILTERS
|
||||
$this->_script .= '
|
||||
$(".selectCheck_filter").bind("keyup", function() {
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == "") {
|
||||
$("#" + $(this).data("id") + "_selectCheck input[name=\"" + $(this).data("id") + "[]\"]").parent().show();
|
||||
$("#" + $(this).data("id") + "_selectCheck label.selectAll").show();
|
||||
} else {
|
||||
$("#" + $(this).data("id") + "_selectCheck input[name=\"" + $(this).data("id") + "[]\"]").parent().hide();
|
||||
$("#" + $(this).data("id") + "_selectCheck label.selectAll").hide();
|
||||
$("#" + $(this).data("id") + "_selectCheck input[name=\"" + $(this).data("id") + "[]\"][value=\""+$(this).val()+"\"]").parent().show();
|
||||
|
||||
$("#" + $(this).data("id") + "_selectCheck input[name=\"" + $(this).data("id") + "[]\"]").parent().filter(function(index) {
|
||||
return $(this).text().toLowerCase().indexOf(val) !== -1;
|
||||
}).show();
|
||||
}
|
||||
});
|
||||
';
|
||||
// @todo SELECT FILTERS
|
||||
$this->_script .= '
|
||||
$(".select_filter").bind("keyup", function() {
|
||||
var val = $(this).val().toLowerCase();
|
||||
if(val == "") {
|
||||
$("#" + $(this).data("id") + " option").show().addClass("shown");
|
||||
$("#filter_count_" + $(this).data("id")).text("");
|
||||
}
|
||||
else{
|
||||
$("#" + $(this).data("id") + " option").hide().removeClass("shown");
|
||||
$("#" + $(this).data("id") + " option[value=\""+$(this).val()+"\"]").show().attr("selected", true).addClass("shown");
|
||||
$("#" + $(this).data("id") + " option").filter(function(index) {
|
||||
return $(this).text().toLowerCase().indexOf(val) !== -1;
|
||||
}).show().attr("selected", true).addClass("shown");
|
||||
$("#filter_count_" + $(this).data("id")).text("(" + $("#" + $(this).data("id") + " option.shown").length + ")");
|
||||
}
|
||||
});
|
||||
';
|
||||
$this->_script .= '
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
|
||||
public function openFieldset($legend, $id = NULL, $img_src='../img/admin/edit.gif', $css = false){
|
||||
$this->_html .= '<fieldset' . ($id ? ' id="' . $id . '"' : '') .' class="space"' . ($css ? ' style="' . $css . '"' : '') .'>
|
||||
<legend><img src="'.$img_src.'" alt="" title="" /> '.$legend.'</legend>
|
||||
<div class="fieldset_content">';
|
||||
}
|
||||
|
||||
public function closeFieldset($legend, $img_src='../img/admin/edit.gif'){
|
||||
$this->_html .= '</div></fieldset>';
|
||||
}
|
||||
|
||||
public function inputText($p = array()){
|
||||
|
||||
if (isset($p['lang']) && $p['lang'] === true)
|
||||
return $this->inputTextL($p);
|
||||
$default_value = (isset($p['default']) ? $p['default'] : '');
|
||||
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form text' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<input type="text" ' . $disabled . ' name="'.$p['name'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'" value="'.($this->_object ? $this->_object->{$p['name']} : $default_value ).'"'.(isset($p['css']) ? 'style="'.$p['css'].'"' : '').'/>
|
||||
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="hint">'.$p['hint'].'</p>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputTextL($p = array()){
|
||||
$default_value = (isset($p['default']) ? $p['default'] : '');
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form translatable rte' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">';
|
||||
foreach ($this->_languages AS $language){
|
||||
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : $default_value;
|
||||
$this->_html .= '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<input type="text" name="'.$p['name'].'_'.$language['id_lang'].'" id="'.(isset($p['id']) ? $p['id'] : $p['name']).'_'.$language['id_lang'].'" value="'.($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang).'"' . (isset($p['css']) ? 'style="'.$p['css'].'"' : '') . '>
|
||||
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="hint">'.$p['hint'].'</p>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
</div>';
|
||||
}
|
||||
$this->_html .= '
|
||||
<p class="clear"></p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputFile($p = array()){
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<input type="file" name="'.$p['name'].'" id="'.$p['name'].'" value="" />
|
||||
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<p class="clear"></p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputSelect($p = array()){
|
||||
$disabled = ((isset($p['disabled']) && $p['disabled']) ? 'disabled="disabled"' : '');
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<select ' . $disabled . ' id="'.$p['name'].'" name="'.$p['name'].'">';
|
||||
foreach($p['options'] as $opt) {
|
||||
$selected = '';
|
||||
if (
|
||||
(isset($opt['selected']) && $opt['selected']) ||
|
||||
(isset($this->_object) && $this->_object->{$p['name']} == $opt['value'])
|
||||
)
|
||||
$selected = ' selected="selected"';
|
||||
$this->_html .= '<option id="' . $p['name'] . '_' . $opt['value'] . '" value="' . $opt['value'] . '"'. $selected .'>'.$opt['label'].'</option>';
|
||||
}
|
||||
$this->_html .= '
|
||||
</select>
|
||||
' . ((isset($p['filter']) && $p['filter']) ? '<div class="clear"></div><br/><input data-id="' . $p['name'] . '" class="select_filter" id="filter_' . $p['name'] . '" type="text" ' . ((isset($p['filter_text']) && $p['filter_text']) ? 'placeholder="' . $p['filter_text'] . '"' : '') . 'autocomplete="off" value="" /> <span class="filter_count" id="filter_count_' . $p['name'] . '"></span>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputBool($p = array()){
|
||||
$checked = ((isset($p['default']) && $p['default']) ? $p['default'] : false);
|
||||
if ($this->_object)
|
||||
$checked = $this->_object->{$p['name']};
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form bool' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<div id="'.$p['name'].'" style="float: left;">
|
||||
<input type="radio" name="'.$p['name'].'" value="1" id="'.$p['name'].'_on"'.($checked ? ' checked="checked"' : '').'/>' . (isset($p['label_on']) && $p['label_on'] ? ' <label class="radio_label" for="'.$p['name'].'_on">'.$p['label_on'].'</label>' : '') . '
|
||||
<input type="radio" name="'.$p['name'].'" value="0" id="'.$p['name'].'_off"'.($checked ? '' : ' checked="checked"').'/>' . (isset($p['label_off']) && $p['label_off'] ? ' <label class="radio_label" for="'.$p['name'].'_off">'.$p['label_off'].'</label>' : '') . '
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputCheckbox($p = array()){
|
||||
$checked = ((isset($p['checked']) && $p['checked']) ? $p['checked'] : false);
|
||||
if ($this->_object)
|
||||
$checked = $this->_object->{$p['name']};
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form checkbox' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<input type="checkbox" id="'.$p['name'].'" name="'.$p['name'].'" value="1" id="'.$p['name'].'"'.($checked ? ' checked="checked"' : '').'/>
|
||||
' . (isset($p['text']) && $p['text'] ? '<label class="checkbox_label" for="'.$p['name'].'">'.$p['text'].'</label>' : '') . '
|
||||
<div class="clear"></div>
|
||||
' . ((isset($p['hint']) && $p['hint']) ? '<p class="small">'.$p['hint'].'</p>' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputDate($p = array()){
|
||||
$this->_dateTime = true;
|
||||
$default = ((isset($p['default']) && $p['default']) ? $p['default'] : '');
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form date' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<div id="'.$p['name'].'" style="float: left;">
|
||||
<input class="datetimepicker" name="'.$p['name'].'" type="text" value="'.($this->_object ? $this->_object->{$p['name']} : $default).'" style="width: 150px;" />
|
||||
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
||||
</div>
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function inputRte($p = array()){
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form translatable rte' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">';
|
||||
foreach ($this->_languages AS $language){
|
||||
$default_lang = (is_array($p['default'])) ? $p['default'][(int)$language['id_lang']] : '';
|
||||
$this->_html .= '
|
||||
<div class="lang_'.$language['id_lang'].'" style="display: '.($language['id_lang'] == $this->_defaultFormLanguage ? 'block' : 'none').'; float: left;">
|
||||
<textarea name="'.$p['name'].'_'.$language['id_lang'].'" rows="4" cols="75">'.($this->_object ? $this->_object->{$p['name']}[(int)$language['id_lang']] : $default_lang).'</textarea>
|
||||
' . ((isset($p['required']) && $p['required']) ? '<sup> *</sup>' : '') . '
|
||||
</div>';
|
||||
}
|
||||
$this->_html .= '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<p class="clear"></p>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function selectCheck($p = array()){
|
||||
$this->_selectCheck = true;
|
||||
$size = ((isset($p['size']) && $p['size']) ? (int) $p['size'] : 5);
|
||||
$this->_html .= '<label' . (isset($p['class']) && $p['class'] ? ' class="' . $p['class'] . '"' : '') . '>'.$p['label'].'</label>
|
||||
<div class="margin-form' . (isset($p['class']) && $p['class'] ? ' ' . $p['class'] : '') . '">
|
||||
<div id="'.$p['name'].'_selectCheck" style="float: left;">
|
||||
<select data-text="' . $p['select_all_text'] . '" id="'.$p['name'].'" class="multiSelectCheck" name="'.$p['name'].'[]" multiple="multiple" size="'.$size.'">
|
||||
<option value=""></option>
|
||||
<optgroup label="'.$p['group_label'].'">';
|
||||
|
||||
foreach($p['options'] as $opt) {
|
||||
$selected = '';
|
||||
if (isset($opt['selected']) && $opt['selected'])
|
||||
$selected = ' selected="selected"';
|
||||
$this->_html .= '<option' .
|
||||
((isset($opt['class']) && $opt['class']) ? ' class="' . $opt['class'] . '"' : '') .
|
||||
' value="' . $opt['value'] . '"'. $selected . '>' . $opt['label'] .
|
||||
'</option>';
|
||||
}
|
||||
$this->_html .= '
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
' . ((isset($p['filter']) && $p['filter']) ? '<div class="clear"></div><br/><input data-id="' . $p['name'] . '" class="selectCheck_filter" id="filter_' . $p['name'] . '" type="text" ' . ((isset($p['filter_text']) && $p['filter_text']) ? 'placeholder="' . $p['filter_text'] . '"' : '') . 'autocomplete="off" value="" />' : '') . '
|
||||
' . ((isset($p['html']) && $p['html']) ? $p['html'] : '') . '
|
||||
<div class="clear"></div>
|
||||
</div>';
|
||||
}
|
||||
|
||||
|
||||
public function inputButton($p = array()){
|
||||
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
||||
$this->_html .= '
|
||||
<a '.($css ? 'style="'.$css.'"' : '').' href="'.$p['action'].'" class="button" name="'.$p['name'].'">'.$p['label'].'</a>
|
||||
';
|
||||
}
|
||||
public function inputSubmit($p = array()){
|
||||
$css = isset($p['css']) && $p['css'] ? $p['css'] : false;
|
||||
$this->_html .= '
|
||||
<input '.($css ? 'style="'.$css.'"' : '').' type="submit" class="button" name="'.$p['name'].'" value="'.$p['label'].'" />
|
||||
';
|
||||
}
|
||||
|
||||
public function inputHidden($p = array()){
|
||||
$id = ((isset($p['id']) && $p['id']) ? $p['id'] : $p['name']);
|
||||
$this->_html .= '
|
||||
<input type="hidden" id="'.$id.'" name="'.$p['name'].'" value="'.$p['value'].'" />';
|
||||
}
|
||||
|
||||
public function displayError($message){
|
||||
$this->_messages[] = '<div class="error">' . $message . '</div>';
|
||||
}
|
||||
|
||||
public function displayMessage($message){
|
||||
return $this->_messages[] = '<div class="message">' . $message . '</div>';
|
||||
}
|
||||
|
||||
public function displayConf($message){
|
||||
return $this->_messages[] = '<div class="conf">' . $message . '</div>';
|
||||
}
|
||||
}
|
333
adm/helpers/HelperList.php
Normal file
@ -0,0 +1,333 @@
|
||||
<?php
|
||||
|
||||
class HelperList{
|
||||
|
||||
public $_html = '';
|
||||
|
||||
public $_img = false;
|
||||
public $_js = false;
|
||||
public $_label = false;
|
||||
public $_current_index = false;
|
||||
public $_table_id = false;
|
||||
public $_orderby = false;
|
||||
public $_orderway = 'asc';
|
||||
public $_have_filters = false;
|
||||
public $_pagination = false;
|
||||
public $_filters = array();
|
||||
public $_filter_ajax_url = '../../ajax.php';
|
||||
|
||||
/*
|
||||
$this->actions = array(
|
||||
array(
|
||||
'identifier' => 'id_object'
|
||||
'action' => 'http://...'
|
||||
'img' => 'img/'
|
||||
'label' => 'update button'
|
||||
),
|
||||
...
|
||||
)
|
||||
*/
|
||||
public $_actions = array();
|
||||
|
||||
/*
|
||||
$this->_header = array(
|
||||
array(
|
||||
'name' => 'col1',
|
||||
'label' => 'column 1'
|
||||
'width' => '40'
|
||||
),
|
||||
array(
|
||||
'name' => 'col2',
|
||||
'label' => 'column 2'
|
||||
),
|
||||
...
|
||||
);*/
|
||||
|
||||
public $_header = array();
|
||||
/*
|
||||
$this->_rows = array(
|
||||
array(
|
||||
'col1' => array(
|
||||
'value' => 'cell 1'
|
||||
'class' => 'highlight'
|
||||
),
|
||||
'col2' => array(
|
||||
'value' => 'cell 2'
|
||||
),
|
||||
...
|
||||
),
|
||||
array(
|
||||
'col1' => array(
|
||||
...
|
||||
)
|
||||
),
|
||||
...
|
||||
);
|
||||
*/
|
||||
public $_rows = array();
|
||||
|
||||
public function renderList($display = true){
|
||||
$this->_html = '';
|
||||
$this->displayTable();
|
||||
|
||||
if ($this->_have_filters)
|
||||
$this->addFilterJs();
|
||||
$list = $this->_html;
|
||||
if (!$display)
|
||||
return $list;
|
||||
echo $list;
|
||||
}
|
||||
|
||||
public function addFilterJs(){
|
||||
$this->_js .= '
|
||||
<script type="text/javascript">
|
||||
$(document).delegate(".refresh_filters", "click", function(){
|
||||
$table = $(this).parent().parent().parent().parent();
|
||||
$table.html($filterCacheContent[$table.attr("id")]);
|
||||
});
|
||||
$(document).ready(function(){
|
||||
$filterCacheContent = [];
|
||||
$(".filter_table").each(function(){
|
||||
$filterCacheContent[$(this).attr("id")] = $(this).html();
|
||||
});
|
||||
$(".filter_header input.filter_input").live("keyup", function(){
|
||||
$this = $(this);
|
||||
$table = $(this).parent().parent().parent().parent();
|
||||
if (typeof $timer !== "undefined")
|
||||
clearTimeout($timer);
|
||||
$timer = setTimeout(function(){
|
||||
search($table);
|
||||
}, 500);
|
||||
});
|
||||
});
|
||||
|
||||
function search(table_filter){
|
||||
$table = table_filter;
|
||||
$filters = $table.find("input.filter_input");
|
||||
$filter_value = [];
|
||||
$filters.each(function(){
|
||||
if ($(this).val() != ""){
|
||||
$filter_value.push({"filter":$(this).attr("name"),"value":$(this).val()});
|
||||
}
|
||||
});
|
||||
if ($filter_value.length == 0)
|
||||
$table.html($filterCacheContent[$table.attr("id")]);
|
||||
else{
|
||||
$.ajax({
|
||||
url: "' . $this->_filter_ajax_url . '",
|
||||
data:{
|
||||
current_index: "' . $this->_current_index . '",
|
||||
filters: $filter_value
|
||||
},
|
||||
dataType: "json",
|
||||
success(data, textStatus, jqXHR){
|
||||
$data = data;
|
||||
if (!$data.hasError && $data.response){
|
||||
$table.children("tbody").html($data.response.html_body);
|
||||
if ($data.response.html_header)
|
||||
$table.children("thead").html($data.response.html_header);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$this->_html = $this->_js . $this->_html;
|
||||
}
|
||||
|
||||
public function displayTable(){
|
||||
## ADD NEW FIELDSET AND TABLE
|
||||
if (!$this->_img)
|
||||
$this->_img = '../img/admin/cms.gif';
|
||||
if (!$this->_label)
|
||||
$this->_label = 'List';
|
||||
$this->setHeader();
|
||||
$this->_html .= '
|
||||
<fieldset class="space">
|
||||
<legend><img src="' . $this->_img . '" alt="" title="" /> ' . $this->_label . '</legend>
|
||||
' . $this->displayPagination() . '
|
||||
<table' . ($this->_table_id ? ' id="' . $this->_table_id . '"' : '') . ' class="table' . ($this->_have_filters ? ' filter_table' : '') . '" style="width: 100%; clear:both; margin-top: 15px;">';
|
||||
## ORDER ROWS
|
||||
if ($this->_orderby)
|
||||
$this->orderRows();
|
||||
## ADD HEADER
|
||||
$this->displayHeader();
|
||||
## ADD BODY
|
||||
$this->displayBody();
|
||||
## CLOSE TABLME AND FIELDSET
|
||||
$this->_html .= '
|
||||
</table>
|
||||
' . $this->displayPagination() . '
|
||||
</fieldset>';
|
||||
}
|
||||
|
||||
public function displayPagination(){
|
||||
if (!$this->_pagination)
|
||||
return;
|
||||
$base_uri = ($this->_current_index ? $this->_current_index : '');
|
||||
$base_uri .= (strpos($base_uri, '?') === FALSE) ? '?' : '&';
|
||||
$nb_pages = ceil($this->_pagination['count'] / $this->_pagination['step']);
|
||||
|
||||
$range = isset($this->_pagination['range']) ? $this->_pagination['range'] : 2;
|
||||
$current = $this->_pagination['current'];
|
||||
$display_all = isset($this->_pagination['all']) ? $this->_pagination['all'] : false;
|
||||
$all_text = isset($this->_pagination['all_text']) ? $this->_pagination['all_text'] : 'Display all';
|
||||
|
||||
if ($current == 'all'){
|
||||
$all = true;
|
||||
$current = 1;
|
||||
}
|
||||
else{
|
||||
$all = false;
|
||||
$current = (int) $current;
|
||||
}
|
||||
|
||||
$href = $base_uri . ($this->_table_id ? $this->_table_id : '') . '_pagination=';
|
||||
$html = '<div style="display: inline-block; margin-top: 10px" class="pagination" id="' . ($this->_table_id ? $this->_table_id : '') . '_pagination">';
|
||||
if ($current - $range > 1){
|
||||
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . 1 . '">' . 1 . '</a>';
|
||||
if ($current - $range > 2)
|
||||
$html .= '<span style="margin: 0 5px;">...</span>';
|
||||
}
|
||||
for ($i=1; $i <= $nb_pages; $i++){
|
||||
if ($i < $current - $range || $i > $current + $range)
|
||||
continue;
|
||||
if ($i == $current && !$all)
|
||||
$html .= '<span style="margin: 0 5px;">' . (int) $i . '</span>';
|
||||
else
|
||||
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . (int) $i . '">' . (int) $i . '</a>';
|
||||
}
|
||||
if ($current + $range < $nb_pages){
|
||||
if ($current + $range < $nb_pages -1)
|
||||
$html .= '<span style="margin: 0 5px;">...</span>';
|
||||
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . (int) $nb_pages . '">' . (int) $nb_pages . '</a>';
|
||||
}
|
||||
|
||||
if ($display_all)
|
||||
if ($all)
|
||||
$html .= '<span style="margin: 0 5px;">' . $all_text . '</span>';
|
||||
else
|
||||
$html .= '<a style="margin: 0 5px;" class="button" href="' . $href . 'all' . '">' . $all_text . '</a>';
|
||||
$html .= '</div>';
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function displayHeader(){
|
||||
$this->_html .= $this->_html_header;
|
||||
}
|
||||
|
||||
public function setHeader(){
|
||||
## NEW HEADER ROW
|
||||
$this->_filters = '';
|
||||
$this->_html_header .= '
|
||||
<thead>
|
||||
<tr>';
|
||||
|
||||
## ADD HEADER DATA
|
||||
foreach ($this->_header as $field_header) {
|
||||
$width = '';
|
||||
if (isset($field_header['width']) && $field_header['width'])
|
||||
$width = 'style="width:' . $field_header['width'] . 'px;"';
|
||||
$this->_html_header .= '<th id="' . $field_header['name'] . '" ' . $width . '>' . $field_header['label'] . '</th>';
|
||||
$this->setFilter($field_header);
|
||||
}
|
||||
## ADD ACTIONS COLUMN
|
||||
if (isset($this->_actions) && is_array($this->_actions) && count($this->_actions)){
|
||||
if (isset($this->_actions_header)){
|
||||
$width = (isset($this->_actions_header['width']) && $this->_actions_header['width'] ? 'width=' . $this->_actions_header['width'] : '');
|
||||
}
|
||||
$this->_html_header .= '<th id="header_actions" ' . $width . '>' . (isset($this->_actions['label']) ? $this->_actions['label'] : 'Actions') . '</th>';
|
||||
}
|
||||
|
||||
## CLOSE HEADER ROW
|
||||
$this->_html_header .= '
|
||||
</tr>';
|
||||
|
||||
## ADD FILTERS
|
||||
if ($this->_have_filters){
|
||||
$this->_html_header .= '<tr>';
|
||||
$this->_html_header .= $this->_filters;
|
||||
if (isset($this->_actions) && is_array($this->_actions) && count($this->_actions))
|
||||
$this->_html_header .= '<th><a class="button refresh_filters">refresh</a></th>';
|
||||
$this->_html_header .= '</tr>';
|
||||
}
|
||||
|
||||
$this->_html_header .= '
|
||||
</thead>';
|
||||
$this->_html_header .= '';
|
||||
}
|
||||
|
||||
public function setFilter($header_row){
|
||||
if (!isset($header_row['filter']))
|
||||
return $this->_filters .= '<th>--</th>';
|
||||
$this->_have_filters = true;
|
||||
$filter = $header_row['filter'];
|
||||
$filter_type = isset($filter['type']) ? $filter['type'] : 'text';
|
||||
switch($filter_type){
|
||||
case 'text':
|
||||
default:
|
||||
$this->_filters .= '<th class="filter_header"><input type="text" class="filter_input filter_' . $filter['name'] . '" name="filter_' . $filter['name'] . '"' . (isset($filter['label']) ? 'placeholder="' . $filter['label'] . '"' : '') . ' /></th>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function displayBody(){
|
||||
$this->_html .= '<tbody>';
|
||||
|
||||
## NEW ROW
|
||||
foreach ($this->_rows as $row) {
|
||||
$this->_html .= '<tr>';
|
||||
## ADD ROW DATA
|
||||
foreach ($this->_header as $field_header) {
|
||||
$switch = (isset($field_header['type']) && $field_header['type'] == 'bool');
|
||||
$row_value = (isset($row[$field_header['name']]) ? $row[$field_header['name']] : '--');
|
||||
$class = ($switch ? ($row_value ? 'switch_on' : 'switch_off') : '');
|
||||
$class .= (isset($field_header['class']) && $field_header['class']) ? $field_header['class'] : '';
|
||||
$this->_html .= '<td' . ($class ? ' class="' . $class . '"' : '') . '>' . ($switch ? ($row_value ? '<img src="../img/admin/enabled.gif" />' : '<img src="../img/admin/disabled.gif" />') : $row_value) . '</td>';
|
||||
}
|
||||
|
||||
## ADD ACTIONS
|
||||
if (isset($this->_actions) && $this->_actions){
|
||||
$this->_html .= '<td>';
|
||||
$base_uri = ($this->_current_index ? $this->_current_index : '');
|
||||
$base_uri .= (strpos($base_uri, '?') === FALSE) ? '?' : '&';
|
||||
foreach ($this->_actions as $action) {
|
||||
$action_link = (isset($action['identifier']) && $action['identifier'] &&
|
||||
isset($row[$action['identifier']]) && $row[$action['identifier']] ?
|
||||
'id=' . $row[$action['identifier']] . '&' . $action['action']:
|
||||
$action['action']
|
||||
);
|
||||
if (isset($action['params'])){
|
||||
foreach ($action['params'] as $param_key => $param_field) {
|
||||
if (isset($row[$param_field]))
|
||||
$action_link .= '&' . $param_key . '=' . $row[$param_field];
|
||||
}
|
||||
}
|
||||
|
||||
$this->_html .= '
|
||||
<a href="' . $base_uri . $action_link . '"' . ($action['onclick'] ? 'onclick="' . $action['onclick'] . '"' : '') . '>
|
||||
<img src="' . $action['img'] . '" alt="' . $action['label'] . '" title="'. $action['label'] .'" />
|
||||
</a>';
|
||||
}
|
||||
$this->_html .= '</td>';
|
||||
}
|
||||
}
|
||||
$this->_html .= '</tbody>';
|
||||
}
|
||||
|
||||
public function orderRows(){
|
||||
if (!$this->_orderby || !$this->_rows)
|
||||
return false;
|
||||
$_tmp_rows = array();
|
||||
foreach ($this->_rows as $row) {
|
||||
if (!isset($row[$this->_orderby]))
|
||||
continue;
|
||||
$_tmp_rows[$row[$this->_orderby]] = $row;
|
||||
}
|
||||
if (strtolower($this->_orderway) == 'desc')
|
||||
krsort($_tmp_rows);
|
||||
else
|
||||
ksort($_tmp_rows);
|
||||
$this->_rows = $_tmp_rows;
|
||||
}
|
||||
}
|
BIN
adm/helpers/includes/dropdown.blue.active.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
adm/helpers/includes/dropdown.blue.hover.png
Normal file
After Width: | Height: | Size: 389 B |
BIN
adm/helpers/includes/dropdown.blue.png
Normal file
After Width: | Height: | Size: 298 B |
BIN
adm/helpers/includes/dropdown.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
adm/helpers/includes/dropdown_active.gif
Normal file
After Width: | Height: | Size: 61 B |
BIN
adm/helpers/includes/dropdown_hover.gif
Normal file
After Width: | Height: | Size: 61 B |
After Width: | Height: | Size: 260 B |
After Width: | Height: | Size: 251 B |
BIN
adm/helpers/includes/images/ui-bg_flat_10_000000_40x100.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
adm/helpers/includes/images/ui-bg_glass_100_f6f6f6_1x400.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
adm/helpers/includes/images/ui-bg_glass_100_fdf5ce_1x400.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
adm/helpers/includes/images/ui-bg_glass_65_ffffff_1x400.png
Normal file
After Width: | Height: | Size: 105 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 90 B |
After Width: | Height: | Size: 129 B |
BIN
adm/helpers/includes/images/ui-icons_222222_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/images/ui-icons_228ef1_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/images/ui-icons_ef8c08_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/images/ui-icons_ffd27a_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/images/ui-icons_ffffff_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
29
adm/helpers/includes/index.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9068 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require(dirname(__FILE__).'/config/config.inc.php');
|
||||
ControllerFactory::getController('IndexController')->run();
|
418
adm/helpers/includes/jquery-ui-1.8.20.custom.css
vendored
Normal file
@ -0,0 +1,418 @@
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.16
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Theming/API
|
||||
*/
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden { display: none; }
|
||||
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
||||
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
||||
.ui-helper-clearfix { display: inline-block; }
|
||||
/* required comment for clearfix to work in Opera \*/
|
||||
* html .ui-helper-clearfix { height:1%; }
|
||||
.ui-helper-clearfix { display:block; }
|
||||
/* end clearfix */
|
||||
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-disabled { cursor: default !important; }
|
||||
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
|
||||
|
||||
/*
|
||||
* jQuery UI CSS Framework 1.8.16
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Theming/API
|
||||
*
|
||||
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
|
||||
*/
|
||||
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
|
||||
.ui-widget .ui-widget { font-size: 1em; }
|
||||
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
|
||||
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
|
||||
.ui-widget-content a { color: #333333; }
|
||||
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
|
||||
.ui-widget-header a { color: #ffffff; }
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
|
||||
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
|
||||
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
|
||||
.ui-widget :active { outline: none; }
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
|
||||
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
|
||||
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
|
||||
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
|
||||
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
||||
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
||||
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
|
||||
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
|
||||
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
|
||||
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
|
||||
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
|
||||
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||
.ui-icon-extlink { background-position: -32px -80px; }
|
||||
.ui-icon-newwin { background-position: -48px -80px; }
|
||||
.ui-icon-refresh { background-position: -64px -80px; }
|
||||
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||
.ui-icon-document { background-position: -32px -96px; }
|
||||
.ui-icon-document-b { background-position: -48px -96px; }
|
||||
.ui-icon-note { background-position: -64px -96px; }
|
||||
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||
.ui-icon-comment { background-position: -128px -96px; }
|
||||
.ui-icon-person { background-position: -144px -96px; }
|
||||
.ui-icon-print { background-position: -160px -96px; }
|
||||
.ui-icon-trash { background-position: -176px -96px; }
|
||||
.ui-icon-locked { background-position: -192px -96px; }
|
||||
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||
.ui-icon-tag { background-position: -240px -96px; }
|
||||
.ui-icon-home { background-position: 0 -112px; }
|
||||
.ui-icon-flag { background-position: -16px -112px; }
|
||||
.ui-icon-calendar { background-position: -32px -112px; }
|
||||
.ui-icon-cart { background-position: -48px -112px; }
|
||||
.ui-icon-pencil { background-position: -64px -112px; }
|
||||
.ui-icon-clock { background-position: -80px -112px; }
|
||||
.ui-icon-disk { background-position: -96px -112px; }
|
||||
.ui-icon-calculator { background-position: -112px -112px; }
|
||||
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||
.ui-icon-search { background-position: -160px -112px; }
|
||||
.ui-icon-wrench { background-position: -176px -112px; }
|
||||
.ui-icon-gear { background-position: -192px -112px; }
|
||||
.ui-icon-heart { background-position: -208px -112px; }
|
||||
.ui-icon-star { background-position: -224px -112px; }
|
||||
.ui-icon-link { background-position: -240px -112px; }
|
||||
.ui-icon-cancel { background-position: 0 -128px; }
|
||||
.ui-icon-plus { background-position: -16px -128px; }
|
||||
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||
.ui-icon-minus { background-position: -48px -128px; }
|
||||
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||
.ui-icon-close { background-position: -80px -128px; }
|
||||
.ui-icon-closethick { background-position: -96px -128px; }
|
||||
.ui-icon-key { background-position: -112px -128px; }
|
||||
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||
.ui-icon-scissors { background-position: -144px -128px; }
|
||||
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||
.ui-icon-copy { background-position: -176px -128px; }
|
||||
.ui-icon-contact { background-position: -192px -128px; }
|
||||
.ui-icon-image { background-position: -208px -128px; }
|
||||
.ui-icon-video { background-position: -224px -128px; }
|
||||
.ui-icon-script { background-position: -240px -128px; }
|
||||
.ui-icon-alert { background-position: 0 -144px; }
|
||||
.ui-icon-info { background-position: -16px -144px; }
|
||||
.ui-icon-notice { background-position: -32px -144px; }
|
||||
.ui-icon-help { background-position: -48px -144px; }
|
||||
.ui-icon-check { background-position: -64px -144px; }
|
||||
.ui-icon-bullet { background-position: -80px -144px; }
|
||||
.ui-icon-radio-off { background-position: -96px -144px; }
|
||||
.ui-icon-radio-on { background-position: -112px -144px; }
|
||||
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||
.ui-icon-play { background-position: 0 -160px; }
|
||||
.ui-icon-pause { background-position: -16px -160px; }
|
||||
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||
.ui-icon-seek-start { background-position: -80px -160px; }
|
||||
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
||||
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||
.ui-icon-stop { background-position: -96px -160px; }
|
||||
.ui-icon-eject { background-position: -112px -160px; }
|
||||
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||
.ui-icon-power { background-position: 0 -176px; }
|
||||
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||
.ui-icon-signal { background-position: -32px -176px; }
|
||||
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Corner radius */
|
||||
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
|
||||
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*
|
||||
* jQuery UI Button 1.8.16
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Button#theming
|
||||
*/
|
||||
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
||||
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
||||
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
||||
.ui-button-icons-only { width: 3.4em; }
|
||||
button.ui-button-icons-only { width: 3.7em; }
|
||||
|
||||
/*button text element */
|
||||
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
||||
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
||||
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
||||
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
||||
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
||||
/* no icon support for input elements, provide padding by default */
|
||||
input.ui-button { padding: .4em 1em; }
|
||||
|
||||
/*button icon element(s) */
|
||||
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
||||
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
||||
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
|
||||
/*button sets*/
|
||||
.ui-buttonset { margin-right: 7px; }
|
||||
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
||||
|
||||
/* workarounds */
|
||||
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
||||
/*
|
||||
* jQuery UI Slider 1.8.16
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Slider#theming
|
||||
*/
|
||||
.ui-slider { position: relative; text-align: left; display: block; }
|
||||
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
||||
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
||||
|
||||
.ui-slider-horizontal { height: .8em; }
|
||||
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
||||
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
||||
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
||||
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
||||
|
||||
.ui-slider-vertical { width: .8em; height: 100px; }
|
||||
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
||||
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
||||
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
||||
.ui-slider-vertical .ui-slider-range-max { top: 0; }/*
|
||||
* jQuery UI Datepicker 1.8.16
|
||||
*
|
||||
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* http://docs.jquery.com/UI/Datepicker#theming
|
||||
*/
|
||||
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
||||
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
||||
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
||||
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
||||
.ui-datepicker .ui-datepicker-next { right:2px; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
||||
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
||||
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
||||
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
||||
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
||||
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
||||
.ui-datepicker select.ui-datepicker-month,
|
||||
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
||||
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
||||
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
||||
.ui-datepicker td { border: 0; padding: 1px; }
|
||||
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; display: block;}
|
||||
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
||||
|
||||
/* with multiple calendars */
|
||||
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
||||
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
||||
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
||||
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
||||
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
||||
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
||||
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
|
||||
|
||||
/* RTL support */
|
||||
.ui-datepicker-rtl { direction: rtl; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
|
||||
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
||||
.ui-datepicker-cover {
|
||||
display: none; /*sorry for IE5*/
|
||||
display/**/: block; /*sorry for IE5*/
|
||||
position: absolute; /*must have*/
|
||||
z-index: -1; /*must have*/
|
||||
filter: mask(); /*must have*/
|
||||
top: -4px; /*must have*/
|
||||
left: -4px; /*must have*/
|
||||
width: 200px; /*must have*/
|
||||
height: 200px; /*must have*/
|
||||
}
|
125
adm/helpers/includes/jquery-ui-1.8.20.custom.min.js
vendored
Normal file
47
adm/helpers/includes/jquery-ui-fr.js
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
/* French initialisation for the jQuery UI date picker plugin. */
|
||||
/* Written by Keith Wood (kbwood{at}iinet.com.au),
|
||||
Stéphane Nahmani (sholby@sholby.net),
|
||||
Stéphane Raimbault <stephane.raimbault@gmail.com> */
|
||||
jQuery(function($){
|
||||
$.datepicker.regional['fr'] = {
|
||||
closeText: 'Fermer',
|
||||
prevText: 'Précédent',
|
||||
nextText: 'Suivant',
|
||||
currentText: 'Aujourd\'hui',
|
||||
monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin',
|
||||
'Juillet','Août','Septembre','Octobre','Novembre','Décembre'],
|
||||
monthNamesShort: ['Janv.','Févr.','Mars','Avril','Mai','Juin',
|
||||
'Juil.','Août','Sept.','Oct.','Nov.','Déc.'],
|
||||
dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'],
|
||||
dayNamesShort: ['Dim.','Lun.','Mar.','Mer.','Jeu.','Ven.','Sam.'],
|
||||
dayNamesMin: ['D','L','M','M','J','V','S'],
|
||||
weekHeader: 'Sem.',
|
||||
dateFormat: 'dd/mm/yy',
|
||||
firstDay: 1,
|
||||
isRTL: false,
|
||||
showMonthAfterYear: false,
|
||||
yearSuffix: ''};
|
||||
$.datepicker.setDefaults($.datepicker.regional['fr']);
|
||||
});
|
||||
|
||||
|
||||
/* French translation for the jQuery Timepicker Addon */
|
||||
/* Written by Thomas Lété */
|
||||
(function($) {
|
||||
$.timepicker.regional['fr'] = {
|
||||
timeOnlyTitle: 'Choisir une heure',
|
||||
timeText: 'Heure',
|
||||
hourText: 'Heures',
|
||||
minuteText: 'Minutes',
|
||||
secondText: 'Secondes',
|
||||
millisecText: 'Millisecondes',
|
||||
timezoneText: 'Fuseau horaire',
|
||||
currentText: 'Maintenant',
|
||||
closeText: 'Terminé',
|
||||
timeFormat: 'hh:mm',
|
||||
amNames: ['AM', 'A'],
|
||||
pmNames: ['PM', 'P'],
|
||||
ampm: false
|
||||
};
|
||||
$.timepicker.setDefaults($.timepicker.regional['fr']);
|
||||
})(jQuery);
|
1416
adm/helpers/includes/jquery-ui-timepicker-addon.js
vendored
Normal file
543
adm/helpers/includes/jquery.multiSelect.js
Normal file
@ -0,0 +1,543 @@
|
||||
/*
|
||||
// jQuery multiSelect
|
||||
//
|
||||
// Version 1.2.2 beta
|
||||
//
|
||||
// Cory S.N. LaViska
|
||||
// A Beautiful Site (http://abeautifulsite.net/)
|
||||
// 09 September 2009
|
||||
//
|
||||
// Visit http://abeautifulsite.net/notebook/62 for more information
|
||||
//
|
||||
// (Amended by Andy Richmond, Letters & Science Deans' Office, University of California, Davis)
|
||||
//
|
||||
// Usage: $('#control_id').multiSelect( options, callback )
|
||||
//
|
||||
// Options: selectAll - whether or not to display the Select All option; true/false, default = true
|
||||
// selectAllText - text to display for selecting/unselecting all options simultaneously
|
||||
// noneSelected - text to display when there are no selected items in the list
|
||||
// oneOrMoreSelected - text to display when there are one or more selected items in the list
|
||||
// (note: you can use % as a placeholder for the number of items selected).
|
||||
// Use * to show a comma separated list of all selected; default = '% selected'
|
||||
// optGroupSelectable - whether or not optgroups are selectable if you use them; true/false, default = false
|
||||
// listHeight - the max height of the droptdown options
|
||||
//
|
||||
// Dependencies: jQuery 1.2.6 or higher (http://jquery.com/)
|
||||
//
|
||||
// Change Log:
|
||||
//
|
||||
// 1.0.1 - Updated to work with jQuery 1.2.6+ (no longer requires the dimensions plugin)
|
||||
// - Changed $(this).offset() to $(this).position(), per James' and Jono's suggestions
|
||||
//
|
||||
// 1.0.2 - Fixed issue where dropdown doesn't scroll up/down with keyboard shortcuts
|
||||
// - Changed '$' in setTimeout to use 'jQuery' to support jQuery.noConflict
|
||||
// - Renamed from jqueryMultiSelect.* to jquery.multiSelect.* per the standard recommended at
|
||||
// http://docs.jquery.com/Plugins/Authoring (does not affect API methods)
|
||||
//
|
||||
// 1.0.3 - Now uses the bgiframe plugin (if it exists) to fix the IE6 layering bug.
|
||||
// - Forces IE6 to use a min-height of 200px (this needs to be added to the options)
|
||||
//
|
||||
// 1.1.0 - Added the ability to update the options dynamically via javascript: multiSelectOptionsUpdate(JSON)
|
||||
// - Added a title that displays the whole comma delimited list when using oneOrMoreSelected = *
|
||||
// - Moved some of the functions to be closured to make them private
|
||||
// - Changed the way the keyboard navigation worked to more closely match how a standard dropdown works
|
||||
// - ** by Andy Richmond **
|
||||
//
|
||||
// 1.2.0 - Added support for optgroups
|
||||
// - Added the ability for selectable optgroups (i.e. select all for an optgroup)
|
||||
// - ** by Andy Richmond **
|
||||
//
|
||||
// 1.2.1 - Fixed bug where input text overlapped dropdown arrow in IE (i.e. when using oneOrMoreSelected = *)
|
||||
// - Added option "listHeight" for min-height of the dropdown
|
||||
// - Fixed bug where bgiframe was causing a horizontal scrollbar and on short lists extra whitespace below the options
|
||||
// - ** by Andy Richmond **
|
||||
//
|
||||
// 1.2.2 - Fixed bug where the keypress stopped showing the dropdown because in jQuery 1.3.2 they changed the way ':visible' works
|
||||
// - Fixed some other bugs in the way the keyboard interface worked
|
||||
// - Changed the main textbox to an <a> tag (with 'display: inline-block') to prevent the display text from being selected/highlighted
|
||||
// - Added the ability to jump to an option by typing the first character of that option (simular to a normal drop down)
|
||||
// - ** by Andy Richmond **
|
||||
// - Added [] to make each control submit an HTML array so $.serialize() works properly
|
||||
//
|
||||
// Licensing & Terms of Use
|
||||
//
|
||||
// This plugin is dual-licensed under the GNU General Public License and the MIT License and
|
||||
// is copyright 2008 A Beautiful Site, LLC.
|
||||
//
|
||||
*/
|
||||
if(jQuery) (function($){
|
||||
|
||||
// render the html for a single option
|
||||
function renderOption(id, option)
|
||||
{
|
||||
var html = '<label><input type="checkbox" name="' + id + '[]" value="' + option.value + '"';
|
||||
if( option.selected ){
|
||||
html += ' checked="checked"';
|
||||
}
|
||||
html += ' />' + option.text + '</label>';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
// render the html for the options/optgroups
|
||||
function renderOptions(id, options, o)
|
||||
{
|
||||
var html = "";
|
||||
|
||||
for(var i = 0; i < options.length; i++) {
|
||||
if(options[i].optgroup) {
|
||||
html += '<label class="optGroup">';
|
||||
|
||||
if(o.optGroupSelectable) {
|
||||
html += '<input type="checkbox" class="optGroup" />' + options[i].optgroup;
|
||||
}
|
||||
else {
|
||||
html += options[i].optgroup;
|
||||
}
|
||||
|
||||
html += '</label><div class="optGroupContainer">';
|
||||
|
||||
html += renderOptions(id, options[i].options, o);
|
||||
|
||||
html += '</div>';
|
||||
}
|
||||
else {
|
||||
html += renderOption(id, options[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
// Building the actual options
|
||||
function buildOptions(options)
|
||||
{
|
||||
var multiSelect = $(this);
|
||||
var multiSelectOptions = multiSelect.next('.multiSelectOptions');
|
||||
var o = multiSelect.data("config");
|
||||
var callback = multiSelect.data("callback");
|
||||
|
||||
// clear the existing options
|
||||
multiSelectOptions.html("");
|
||||
var html = "";
|
||||
|
||||
// if we should have a select all option then add it
|
||||
if( o.selectAll ) {
|
||||
html += '<label class="selectAll"><input type="checkbox" class="selectAll" />' + o.selectAllText + '</label>';
|
||||
}
|
||||
|
||||
// generate the html for the new options
|
||||
html += renderOptions(multiSelect.attr('id'), options, o);
|
||||
|
||||
multiSelectOptions.html(html);
|
||||
|
||||
// variables needed to account for width changes due to a scrollbar
|
||||
var initialWidth = multiSelectOptions.width();
|
||||
var hasScrollbar = false;
|
||||
|
||||
// set the height of the dropdown options
|
||||
if(multiSelectOptions.height() > o.listHeight) {
|
||||
multiSelectOptions.css("height", o.listHeight + 'px');
|
||||
hasScrollbar = true;
|
||||
} else {
|
||||
multiSelectOptions.css("height", '');
|
||||
}
|
||||
|
||||
// if the there is a scrollbar and the browser did not already handle adjusting the width (i.e. Firefox) then we will need to manaually add the scrollbar width
|
||||
var scrollbarWidth = hasScrollbar && (initialWidth == multiSelectOptions.width()) ? 17 : 0;
|
||||
|
||||
// set the width of the dropdown options
|
||||
if((multiSelectOptions.width() + scrollbarWidth) < multiSelect.outerWidth()) {
|
||||
multiSelectOptions.css("width", multiSelect.outerWidth() - 2/*border*/ + 'px');
|
||||
} else {
|
||||
multiSelectOptions.css("width", (multiSelectOptions.width() + scrollbarWidth) + 'px');
|
||||
}
|
||||
|
||||
// Apply bgiframe if available on IE6
|
||||
if( $.fn.bgiframe ) multiSelect.next('.multiSelectOptions').bgiframe( { width: multiSelectOptions.width(), height: multiSelectOptions.height() });
|
||||
|
||||
// Handle selectAll oncheck
|
||||
if(o.selectAll) {
|
||||
multiSelectOptions.find('INPUT.selectAll').click( function() {
|
||||
// update all the child checkboxes
|
||||
multiSelectOptions.find('INPUT:checkbox').attr('checked', $(this).attr('checked')).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
|
||||
});
|
||||
}
|
||||
|
||||
// Handle OptGroup oncheck
|
||||
if(o.optGroupSelectable) {
|
||||
multiSelectOptions.addClass('optGroupHasCheckboxes');
|
||||
|
||||
multiSelectOptions.find('INPUT.optGroup').click( function() {
|
||||
// update all the child checkboxes
|
||||
$(this).parent().next().find('INPUT:checkbox').attr('checked', $(this).attr('checked')).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
|
||||
});
|
||||
}
|
||||
|
||||
// Handle all checkboxes
|
||||
multiSelectOptions.find('INPUT:checkbox').click( function() {
|
||||
// set the label checked class
|
||||
$(this).parent("LABEL").toggleClass('checked', $(this).attr('checked'));
|
||||
|
||||
updateSelected.call(multiSelect);
|
||||
multiSelect.focus();
|
||||
if($(this).parent().parent().hasClass('optGroupContainer')) {
|
||||
updateOptGroup.call(multiSelect, $(this).parent().parent().prev());
|
||||
}
|
||||
if( callback ) {
|
||||
callback($(this));
|
||||
}
|
||||
});
|
||||
|
||||
// Initial display
|
||||
multiSelectOptions.each( function() {
|
||||
$(this).find('INPUT:checked').parent().addClass('checked');
|
||||
});
|
||||
|
||||
// Initialize selected and select all
|
||||
updateSelected.call(multiSelect);
|
||||
|
||||
// Initialize optgroups
|
||||
if(o.optGroupSelectable) {
|
||||
multiSelectOptions.find('LABEL.optGroup').each( function() {
|
||||
updateOptGroup.call(multiSelect, $(this));
|
||||
});
|
||||
}
|
||||
|
||||
// Handle hovers
|
||||
multiSelectOptions.find('LABEL:has(INPUT)').hover( function() {
|
||||
$(this).parent().find('LABEL').removeClass('hover');
|
||||
$(this).addClass('hover');
|
||||
}, function() {
|
||||
$(this).parent().find('LABEL').removeClass('hover');
|
||||
});
|
||||
|
||||
// Keyboard
|
||||
multiSelect.keydown( function(e) {
|
||||
|
||||
var multiSelectOptions = $(this).next('.multiSelectOptions');
|
||||
|
||||
// Is dropdown visible?
|
||||
if( multiSelectOptions.css('visibility') != 'hidden' ) {
|
||||
// Dropdown is visible
|
||||
// Tab
|
||||
if( e.keyCode == 9 ) {
|
||||
$(this).addClass('focus').trigger('click'); // esc, left, right - hide
|
||||
$(this).focus().next(':input').focus();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ESC, Left, Right
|
||||
if( e.keyCode == 27 || e.keyCode == 37 || e.keyCode == 39 ) {
|
||||
// Hide dropdown
|
||||
$(this).addClass('focus').trigger('click');
|
||||
}
|
||||
// Down || Up
|
||||
if( e.keyCode == 40 || e.keyCode == 38) {
|
||||
var allOptions = multiSelectOptions.find('LABEL');
|
||||
var oldHoverIndex = allOptions.index(allOptions.filter('.hover'));
|
||||
var newHoverIndex = -1;
|
||||
|
||||
// if there is no current highlighted item then highlight the first item
|
||||
if(oldHoverIndex < 0) {
|
||||
// Default to first item
|
||||
multiSelectOptions.find('LABEL:first').addClass('hover');
|
||||
}
|
||||
// else if we are moving down and there is a next item then move
|
||||
else if(e.keyCode == 40 && oldHoverIndex < allOptions.length - 1)
|
||||
{
|
||||
newHoverIndex = oldHoverIndex + 1;
|
||||
}
|
||||
// else if we are moving up and there is a prev item then move
|
||||
else if(e.keyCode == 38 && oldHoverIndex > 0)
|
||||
{
|
||||
newHoverIndex = oldHoverIndex - 1;
|
||||
}
|
||||
|
||||
if(newHoverIndex >= 0) {
|
||||
$(allOptions.get(oldHoverIndex)).removeClass('hover'); // remove the current highlight
|
||||
$(allOptions.get(newHoverIndex)).addClass('hover'); // add the new highlight
|
||||
|
||||
// Adjust the viewport if necessary
|
||||
adjustViewPort(multiSelectOptions);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Enter, Space
|
||||
if( e.keyCode == 13 || e.keyCode == 32 ) {
|
||||
var selectedCheckbox = multiSelectOptions.find('LABEL.hover INPUT:checkbox');
|
||||
|
||||
// Set the checkbox (and label class)
|
||||
selectedCheckbox.attr('checked', !selectedCheckbox.attr('checked')).parent("LABEL").toggleClass('checked', selectedCheckbox.attr('checked'));
|
||||
|
||||
// if the checkbox was the select all then set all the checkboxes
|
||||
if(selectedCheckbox.hasClass("selectAll")) {
|
||||
multiSelectOptions.find('INPUT:checkbox').attr('checked', selectedCheckbox.attr('checked')).parent("LABEL").addClass('checked').toggleClass('checked', selectedCheckbox.attr('checked'));
|
||||
}
|
||||
|
||||
updateSelected.call(multiSelect);
|
||||
|
||||
if( callback ) callback($(this));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Any other standard keyboard character (try and match the first character of an option)
|
||||
if( e.keyCode >= 33 && e.keyCode <= 126 ) {
|
||||
// find the next matching item after the current hovered item
|
||||
var match = multiSelectOptions.find('LABEL:startsWith(' + String.fromCharCode(e.keyCode) + ')');
|
||||
|
||||
var currentHoverIndex = match.index(match.filter('LABEL.hover'));
|
||||
|
||||
// filter the set to any items after the current hovered item
|
||||
var afterHoverMatch = match.filter(function (index) {
|
||||
return index > currentHoverIndex;
|
||||
});
|
||||
|
||||
// if there were no item after the current hovered item then try using the full search results (filtered to the first one)
|
||||
match = (afterHoverMatch.length >= 1 ? afterHoverMatch : match).filter("LABEL:first");
|
||||
|
||||
if(match.length == 1) {
|
||||
// if we found a match then move the hover
|
||||
multiSelectOptions.find('LABEL.hover').removeClass('hover');
|
||||
match.addClass('hover');
|
||||
|
||||
adjustViewPort(multiSelectOptions);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Dropdown is not visible
|
||||
if( e.keyCode == 38 || e.keyCode == 40 || e.keyCode == 13 || e.keyCode == 32 ) { //up, down, enter, space - show
|
||||
// Show dropdown
|
||||
$(this).removeClass('focus').trigger('click');
|
||||
multiSelectOptions.find('LABEL:first').addClass('hover');
|
||||
return false;
|
||||
}
|
||||
// Tab key
|
||||
if( e.keyCode == 9 ) {
|
||||
// Shift focus to next INPUT element on page
|
||||
multiSelectOptions.next(':input').focus();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Prevent enter key from submitting form
|
||||
if( e.keyCode == 13 ) return false;
|
||||
});
|
||||
}
|
||||
|
||||
// Adjust the viewport if necessary
|
||||
function adjustViewPort(multiSelectOptions)
|
||||
{
|
||||
// check for and move down
|
||||
var selectionBottom = multiSelectOptions.find('LABEL.hover').position().top + multiSelectOptions.find('LABEL.hover').outerHeight();
|
||||
|
||||
if(selectionBottom > multiSelectOptions.innerHeight()){
|
||||
multiSelectOptions.scrollTop(multiSelectOptions.scrollTop() + selectionBottom - multiSelectOptions.innerHeight());
|
||||
}
|
||||
|
||||
// check for and move up
|
||||
if(multiSelectOptions.find('LABEL.hover').position().top < 0){
|
||||
multiSelectOptions.scrollTop(multiSelectOptions.scrollTop() + multiSelectOptions.find('LABEL.hover').position().top);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the optgroup checked status
|
||||
function updateOptGroup(optGroup)
|
||||
{
|
||||
var multiSelect = $(this);
|
||||
var o = multiSelect.data("config");
|
||||
|
||||
// Determine if the optgroup should be checked
|
||||
if(o.optGroupSelectable) {
|
||||
var optGroupSelected = true;
|
||||
$(optGroup).next().find('INPUT:checkbox').each( function() {
|
||||
if( !$(this).attr('checked') ) {
|
||||
optGroupSelected = false;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
$(optGroup).find('INPUT.optGroup').attr('checked', optGroupSelected).parent("LABEL").toggleClass('checked', optGroupSelected);
|
||||
}
|
||||
}
|
||||
|
||||
// Update the textbox with the total number of selected items, and determine select all
|
||||
function updateSelected() {
|
||||
var multiSelect = $(this);
|
||||
var multiSelectOptions = multiSelect.next('.multiSelectOptions');
|
||||
var o = multiSelect.data("config");
|
||||
|
||||
var i = 0;
|
||||
var selectAll = true;
|
||||
var display = '';
|
||||
multiSelectOptions.find('INPUT:checkbox').not('.selectAll, .optGroup').each( function() {
|
||||
if( $(this).attr('checked') ) {
|
||||
i++;
|
||||
display = display + $(this).parent().text() + ', ';
|
||||
}
|
||||
else selectAll = false;
|
||||
});
|
||||
|
||||
// trim any end comma and surounding whitespace
|
||||
display = display.replace(/\s*\,\s*$/,'');
|
||||
|
||||
if( i == 0 ) {
|
||||
multiSelect.find("span").html( o.noneSelected );
|
||||
} else {
|
||||
if( o.oneOrMoreSelected == '*' ) {
|
||||
multiSelect.find("span").html( display );
|
||||
multiSelect.attr( "title", display );
|
||||
} else {
|
||||
multiSelect.find("span").html( o.oneOrMoreSelected.replace('%', i) );
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if Select All should be checked
|
||||
if(o.selectAll) {
|
||||
multiSelectOptions.find('INPUT.selectAll').attr('checked', selectAll).parent("LABEL").toggleClass('checked', selectAll);
|
||||
}
|
||||
}
|
||||
|
||||
$.extend($.fn, {
|
||||
multiSelect: function(o, callback) {
|
||||
// Default options
|
||||
if( !o ) o = {};
|
||||
if( o.selectAll == undefined ) o.selectAll = true;
|
||||
if( o.selectAllText == undefined ) o.selectAllText = "Select All";
|
||||
if( o.noneSelected == undefined ) o.noneSelected = 'Select options';
|
||||
if( o.oneOrMoreSelected == undefined ) o.oneOrMoreSelected = '% selected';
|
||||
if( o.optGroupSelectable == undefined ) o.optGroupSelectable = false;
|
||||
if( o.listHeight == undefined ) o.listHeight = 150;
|
||||
|
||||
// Initialize each multiSelect
|
||||
$(this).each( function() {
|
||||
var select = $(this);
|
||||
var html = '<a href="javascript:;" class="multiSelect"><span></span></a>';
|
||||
html += '<div class="multiSelectOptions" style="position: absolute; z-index: 99999; visibility: hidden;"></div>';
|
||||
$(select).after(html);
|
||||
|
||||
var multiSelect = $(select).next('.multiSelect');
|
||||
var multiSelectOptions = multiSelect.next('.multiSelectOptions');
|
||||
|
||||
// if the select object had a width defined then match the new multilsect to it
|
||||
multiSelect.find("span").css("width", $(select).width() + 'px');
|
||||
|
||||
// Attach the config options to the multiselect
|
||||
multiSelect.data("config", o);
|
||||
|
||||
// Attach the callback to the multiselect
|
||||
multiSelect.data("callback", callback);
|
||||
|
||||
// Serialize the select options into json options
|
||||
var options = [];
|
||||
$(select).children().each( function() {
|
||||
if(this.tagName.toUpperCase() == 'OPTGROUP')
|
||||
{
|
||||
var suboptions = [];
|
||||
options.push({ optgroup: $(this).attr('label'), options: suboptions });
|
||||
|
||||
$(this).children('OPTION').each( function() {
|
||||
if( $(this).val() != '' ) {
|
||||
suboptions.push({ text: $(this).html(), value: $(this).val(), selected: $(this).attr('selected') });
|
||||
}
|
||||
});
|
||||
}
|
||||
else if(this.tagName.toUpperCase() == 'OPTION')
|
||||
{
|
||||
if( $(this).val() != '' ) {
|
||||
options.push({ text: $(this).html(), value: $(this).val(), selected: $(this).attr('selected') });
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Eliminate the original form element
|
||||
$(select).remove();
|
||||
|
||||
// Add the id that was on the original select element to the new input
|
||||
multiSelect.attr("id", $(select).attr("id"));
|
||||
|
||||
// Build the dropdown options
|
||||
buildOptions.call(multiSelect, options);
|
||||
|
||||
// Events
|
||||
multiSelect.hover( function() {
|
||||
$(this).addClass('hover');
|
||||
}, function() {
|
||||
$(this).removeClass('hover');
|
||||
}).click( function() {
|
||||
// Show/hide on click
|
||||
if( $(this).hasClass('active') ) {
|
||||
$(this).multiSelectOptionsHide();
|
||||
} else {
|
||||
$(this).multiSelectOptionsShow();
|
||||
}
|
||||
return false;
|
||||
}).focus( function() {
|
||||
// So it can be styled with CSS
|
||||
$(this).addClass('focus');
|
||||
}).blur( function() {
|
||||
// So it can be styled with CSS
|
||||
$(this).removeClass('focus');
|
||||
});
|
||||
|
||||
// Add an event listener to the window to close the multiselect if the user clicks off
|
||||
$(document).click( function(event) {
|
||||
// If somewhere outside of the multiselect was clicked then hide the multiselect
|
||||
if(!($(event.target).parents().andSelf().is('.multiSelectOptions'))){
|
||||
multiSelect.multiSelectOptionsHide();
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
// Update the dropdown options
|
||||
multiSelectOptionsUpdate: function(options) {
|
||||
buildOptions.call($(this), options);
|
||||
},
|
||||
|
||||
// Hide the dropdown
|
||||
multiSelectOptionsHide: function() {
|
||||
$(this).removeClass('active').removeClass('hover').next('.multiSelectOptions').css('visibility', 'hidden');
|
||||
},
|
||||
|
||||
// Show the dropdown
|
||||
multiSelectOptionsShow: function() {
|
||||
var multiSelect = $(this);
|
||||
var multiSelectOptions = multiSelect.next('.multiSelectOptions');
|
||||
var o = multiSelect.data("config");
|
||||
|
||||
// Hide any open option boxes
|
||||
$('.multiSelect').multiSelectOptionsHide();
|
||||
multiSelectOptions.find('LABEL').removeClass('hover');
|
||||
multiSelect.addClass('active').next('.multiSelectOptions').css('visibility', 'visible');
|
||||
multiSelect.focus();
|
||||
|
||||
// reset the scroll to the top
|
||||
multiSelect.next('.multiSelectOptions').scrollTop(0);
|
||||
|
||||
// Position it
|
||||
var offset = multiSelect.position();
|
||||
multiSelect.next('.multiSelectOptions').css({ top: offset.top + $(this).outerHeight() + 'px' });
|
||||
multiSelect.next('.multiSelectOptions').css({ left: offset.left + 'px' });
|
||||
},
|
||||
|
||||
// get a coma-delimited list of selected values
|
||||
selectedValuesString: function() {
|
||||
var selectedValues = "";
|
||||
$(this).next('.multiSelectOptions').find('INPUT:checkbox:checked').not('.optGroup, .selectAll').each(function() {
|
||||
selectedValues += $(this).attr('value') + ",";
|
||||
});
|
||||
// trim any end comma and surounding whitespace
|
||||
return selectedValues.replace(/\s*\,\s*$/,'');
|
||||
}
|
||||
});
|
||||
|
||||
// add a new ":startsWith" search filter
|
||||
$.expr[":"].startsWith = function(el, i, m) {
|
||||
var search = m[3];
|
||||
if (!search) return false;
|
||||
return eval("/^[/s]*" + search + "/i").test($(el).text());
|
||||
};
|
||||
|
||||
})(jQuery);
|
BIN
adm/helpers/includes/ui/ui-bg_flat_0_aaaaaa_40x100.png
Normal file
After Width: | Height: | Size: 180 B |
BIN
adm/helpers/includes/ui/ui-bg_flat_75_ffffff_40x100.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_100_f6f6f6_1x400.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_100_fdf5ce_1x400.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_55_fbf9ee_1x400.png
Normal file
After Width: | Height: | Size: 120 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_65_ffffff_1x400.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_75_dadada_1x400.png
Normal file
After Width: | Height: | Size: 111 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_75_e6e6e6_1x400.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
adm/helpers/includes/ui/ui-bg_glass_95_fef1ec_1x400.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
adm/helpers/includes/ui/ui-bg_gloss-wave_35_f6a828_500x100.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 90 B |
BIN
adm/helpers/includes/ui/ui-bg_highlight-soft_75_cccccc_1x100.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
adm/helpers/includes/ui/ui-bg_highlight-soft_75_ffe45c_1x100.png
Normal file
After Width: | Height: | Size: 129 B |
BIN
adm/helpers/includes/ui/ui-icons_222222_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_2e83ff_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_454545_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_888888_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_cd0a0a_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_ef8c08_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
BIN
adm/helpers/includes/ui/ui-icons_ffffff_256x240.png
Normal file
After Width: | Height: | Size: 4.3 KiB |
29
adm/helpers/index.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/*
|
||||
* 2007-2011 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 9068 $
|
||||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
require(dirname(__FILE__).'/config/config.inc.php');
|
||||
ControllerFactory::getController('IndexController')->run();
|
561
modules/philea_magistor/AdminPhileaMagistor.php
Normal file
@ -0,0 +1,561 @@
|
||||
<?php
|
||||
|
||||
require_once(PS_ADMIN_DIR . '/helpers/HelperForm.php');
|
||||
require_once(PS_ADMIN_DIR . '/helpers/HelperList.php');
|
||||
|
||||
class AdminPhileaMagistor extends AdminTab {
|
||||
const TIME_DISPLAY = 0; // list displaying time in days. 0 to disable
|
||||
|
||||
static $_crrlist_cache = NULL;
|
||||
|
||||
public function postProcess() {
|
||||
if(Tools::isSubmit('submitPhilea')) {
|
||||
$id_sale = (int) Tools::getValue('id_sale');
|
||||
if($id_sale) {
|
||||
|
||||
if(!Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `status` = 0
|
||||
')) {
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
VALUES (
|
||||
DEFAULT,
|
||||
'.(int) $id_sale.',
|
||||
0,
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
|
||||
if (Tools::getValue('force_rec_file')){
|
||||
// get last sync order form for this sale
|
||||
$last_order_sync = Db::getInstance()->getRow(
|
||||
'SELECT * FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
|
||||
WHERE `id_sale` = ' . (int) $id_sale . '
|
||||
ORDER BY `date_add` DESC');
|
||||
|
||||
if ($last_order_sync && isset($last_order_sync['id_order_form'])){
|
||||
Db::getInstance()->execute('
|
||||
DELETE FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
|
||||
WHERE `id_sale` = ' . (int) $id_sale . '
|
||||
AND `id_order_form` = ' . (int) $last_order_sync['id_order_form'] . '
|
||||
ORDER BY `date_add` DESC
|
||||
LIMIT 1');
|
||||
}
|
||||
}
|
||||
|
||||
echo '<p class="conf">'.$this->l('Sale added to queue successfully').'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Sync already in progress for this sale').'</p><br />';
|
||||
}
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Invalid sale id').'</p><br />';
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('auto_sync') && Tools::isSubmit('active')){
|
||||
$id_sale = (int) Tools::getValue('id_sale');
|
||||
if($id_sale) {
|
||||
$active = (int) Tools::getValue('active');
|
||||
$sql = '
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_auto_sync`
|
||||
VALUES (
|
||||
'.(int) $id_sale.',
|
||||
'.(int) $active.',
|
||||
"0000-00-00 00:00:00"
|
||||
)
|
||||
ON DUPLICATE KEY
|
||||
UPDATE `active` = '.(int) $active;
|
||||
|
||||
if(Db::getInstance()->execute($sql)){
|
||||
echo '<p class="conf">'.$this->l('Export auto activé').'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Export auto désactivé').'</p><br />';
|
||||
}
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Invalid sale id').'</p><br />';
|
||||
}
|
||||
}
|
||||
elseif (Tools::isSubmit('addCDC') && Tools::getValue('id_sale')){
|
||||
$id_sale = (int) Tools::getValue('id_sale');
|
||||
if($id_sale) {
|
||||
if(Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND (`status` = 2
|
||||
OR `status` = 4)
|
||||
')) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
SET `status` = 3
|
||||
WHERE id_sale = '.(int) $id_sale.'
|
||||
LIMIT 1
|
||||
');
|
||||
|
||||
echo '<p class="conf">'.$this->l('Sale added to queue successfully').'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Sync already in progress for this sale').'</p><br />';
|
||||
}
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Invalid sale id').'</p><br />';
|
||||
}
|
||||
}
|
||||
elseif(Tools::isSubmit('getCsv') && Tools::getValue('id_sale') && Tools::getValue('filename')){
|
||||
$id_sale = (int) Tools::getValue('id_sale');
|
||||
$filename = Tools::getValue('filename');
|
||||
$this->exportCsv((int) $id_sale, $filename);
|
||||
}
|
||||
elseif(Tools::isSubmit('philea_archive_submit')){
|
||||
$id_sales = Tools::getValue('id_sales');
|
||||
if (count($id_sales)){
|
||||
$sql_values = array();
|
||||
$sql_insert = 'INSERT INTO `'._DB_PREFIX_.'philea_magistor_archive` (`id_sale`, `date_add`) VALUES';
|
||||
foreach ($id_sales as $id_sale)
|
||||
$sql_values[] = '(' . (int) $id_sale . ', NOW())';
|
||||
$sql_insert .= implode(', ', $sql_values) . ' ON DUPLICATE KEY UPDATE `date_add` = NOW()';
|
||||
if (Db::getInstance()->execute($sql_insert)){
|
||||
echo '<p class="conf">'.$this->l('Sales successfully archived').'</p><br />';
|
||||
}
|
||||
else{
|
||||
echo '<p class="conf">'.$this->l('Sales cannot be archived').'</p><br />';
|
||||
}
|
||||
}
|
||||
else{
|
||||
echo '<p class="error">'.$this->l('No sale selected.').'</p><br />';
|
||||
}
|
||||
}
|
||||
elseif(Tools::isSubmit('unarchiveSale') && Tools::getValue('id_sale_unarchive')){
|
||||
if (Db::getInstance()->executeS('
|
||||
DELETE FROM `' . _DB_PREFIX_ . 'philea_magistor_archive`
|
||||
WHERE `id_sale` = ' . (int) Tools::getValue('id_sale_unarchive') . '
|
||||
LIMIT 1
|
||||
')){
|
||||
echo '<p class="conf">'.$this->l('Vente désarchivée').'</p><br />';
|
||||
}
|
||||
else{
|
||||
echo '<p class="error">'.$this->l('La vente n\'a pas pu être désarchivée.').'</p><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function exportCsv($id_sale, $filename){
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_reception`
|
||||
WHERE `id_sale` = ' . (int) $id_sale . '
|
||||
AND `filename` LIKE "' . pSQL($filename) . '"';
|
||||
$recept = Db::getInstance()->getRow($sql);
|
||||
|
||||
if (!$recept)
|
||||
return;
|
||||
|
||||
$Y = date('Y', strtotime($recept['date_add']));
|
||||
$m = date('m', strtotime($recept['date_add']));
|
||||
$filepath = dirname(__FILE__).'/script/archives/IN/RECEPTION/';
|
||||
|
||||
$filepath .= $Y . '/' . $m . '/' . $recept['filename'];
|
||||
$content = file_get_contents( $filepath );
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
header('Pragma: public');
|
||||
header('Expires: 0');
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
header('Content-Description: File Transfer');
|
||||
header('Content-Type: application/csv; charset=utf-8');
|
||||
header('Content-Disposition: attachment; filename='.$filename.'_'.(int)$id_sale.'.csv;');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
$format = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'N_CDE' => array(31,20),
|
||||
'DATE_RECEP' => array(51,8),
|
||||
'CODE_ART' => array(59,50),
|
||||
'QTE' => array(109,10),
|
||||
'OTHER' => array(119, 28),
|
||||
);
|
||||
ob_clean();
|
||||
//open file pointer to standard output
|
||||
$fp = fopen('php://output', 'w');
|
||||
$delim = ';';
|
||||
|
||||
// first row
|
||||
$data=array();
|
||||
foreach ($format as $col_name => $array_def)
|
||||
$data[]=Tools::htmlentitiesDecodeUTF8($col_name);
|
||||
fputcsv ($fp,$data,$delim);
|
||||
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field => $value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
}
|
||||
fputcsv ($fp,array_map('utf8_decode',array_values($data)),$delim);
|
||||
}
|
||||
fclose($fp);
|
||||
exit;
|
||||
}
|
||||
|
||||
public function display() {
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$form = '<h2>'.$this->l('Philea').'</h2>';
|
||||
|
||||
$base_link = $currentIndex . '&token='.Tools::getAdminTokenLite('AdminPhileaMagistor');
|
||||
|
||||
$id_sale_options = array();
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT p.`id_sale`, c.`name`
|
||||
FROM `'._DB_PREFIX_.'privatesale` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` c ON (c.`id_category` = p.`id_category`)
|
||||
WHERE c.`id_lang` = '.$cookie->id_lang.'
|
||||
AND p.`date_start` > "2015-01-01 00:00:00"
|
||||
ORDER BY p.`id_sale` DESC
|
||||
') as $row) {
|
||||
$id_sale_options[] = array(
|
||||
'label' => (int) $row['id_sale'].' - '.$row['name'],
|
||||
'value' => (int) $row['id_sale']
|
||||
);
|
||||
}
|
||||
|
||||
$helperForm = new HelperForm();
|
||||
$helperForm->_forms = array(
|
||||
array(
|
||||
'action' => $base_link,
|
||||
'legend' => $this->l('Philea'),
|
||||
'inputs' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'id_sale',
|
||||
'label' => $this->l('Select a sale'),
|
||||
'options' => $id_sale_options,
|
||||
'filter' => true,
|
||||
'filter_text' => $this->l('Filter par vente')
|
||||
),
|
||||
array(
|
||||
'type' => 'checkbox',
|
||||
'name' => 'force_rec_file',
|
||||
'label' => $this->l('Forcer l\'envoi'),
|
||||
'text' => $this->l('Force un nouvel envoi du fichier REC.')
|
||||
)
|
||||
),
|
||||
'actions' => array(
|
||||
array(
|
||||
'type' => 'submit',
|
||||
'name' => 'submitPhilea',
|
||||
'label' => $this->l('Envoyer à Philea')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$form .= $helperForm->renderForm(false, NULL, NULL, true);
|
||||
|
||||
// $form .= '
|
||||
// <form action="' . $base_link . '" method="post" class="form"><div class="clear"> </div>
|
||||
// <fieldset><legend>'.$this->l('Philea').'</legend>
|
||||
// <p class="select">
|
||||
// <label for="id_sale">'.$this->l('Select a sale').'</label>
|
||||
// <select name="id_sale" id="id_sale">';
|
||||
|
||||
// foreach(Db::getInstance()->ExecuteS('
|
||||
// SELECT p.`id_sale`, c.`name`
|
||||
// FROM `'._DB_PREFIX_.'privatesale` p
|
||||
// LEFT JOIN `'._DB_PREFIX_.'category_lang` c
|
||||
// ON c.`id_category` = p.`id_category`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
// ON s.`id_sale` = p.`id_sale`
|
||||
// WHERE c.`id_lang` = 2
|
||||
// AND s.`id_shipping` = '.(int) self::ID_SHIPPING.'
|
||||
// AND p.`date_start` > "2015-01-01 00:00:00"
|
||||
// ORDER BY p.`id_sale` DESC
|
||||
// ') as $row) {
|
||||
// $form .= '<option value="'.(int) $row['id_sale'].'">'.(int) $row['id_sale'].' - '.$row['name'].'</option>';
|
||||
// }
|
||||
|
||||
// $form .= '</select>
|
||||
// </p>
|
||||
// <p class="center submit">
|
||||
// <input type="submit" class="button" title="'.$this->l('Envoi des fichiers ART et REC').'" value="'.$this->l('Envoyer à Philea').'" name="submitPhilea" />
|
||||
// </p>
|
||||
// </fieldset></form>';
|
||||
|
||||
//
|
||||
// <input type="submit" class="button" title="'.$this->l('Programmer l\'export automatique ART et REC').'" value="'.$this->l('Export automatique').'" name="submitPhileaAutoExport" />
|
||||
|
||||
$CRR_list = $this->getCRRList();
|
||||
|
||||
$form .= '
|
||||
<form id="upload_form" action="' . $base_link . '" method="post" class="form"><div class="clear"> </div>
|
||||
<fieldset><legend>'.$this->l('Orders CRR').'</legend>
|
||||
<p>'.$this->l('Historique des ventes envoyées à Philea'). (self::TIME_DISPLAY > 0 ? ' (' . self::TIME_DISPLAY . ' ' . $this->l('derniers jours') . ')' : '').'</p>
|
||||
<input type="hidden" id="id_sale_hidden" name="id_sale" value="" />
|
||||
<input type="hidden" name="addCDC"/>
|
||||
<p><input type="submit" class="btn button" name="philea_archive_submit" value="' . $this->l('Archiver la sélection') . '"/></p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2">' . $this->l('ID sale') . '</th>
|
||||
<th width="250">' . $this->l('Name') . '</th>
|
||||
<th>' . $this->l('Date envoi (ART + REC)') . '</th>
|
||||
<th>' . $this->l('Télécharger le CRR') . '</th>
|
||||
<th>' . $this->l('Date Reçu CRR') . '</th>
|
||||
<th>' . $this->l('Envoyer la commande') . '</th>
|
||||
<th>' . $this->l('Date envoi (CMD)') . '</th>
|
||||
<th>' . $this->l('Envoi auto') . '</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
$dowload_link = _MODULE_DIR_.'philea_magistor/script/archives/IN/RECEPTION/';
|
||||
$upload_link = $base_link;
|
||||
$now = date('Y-m-d H:i:s', mktime(date('H') -1));
|
||||
foreach ($CRR_list as $CRR) {
|
||||
$_recep = FALSE;
|
||||
if (isset($CRR['recep_date']) && $CRR['recep_date'] && isset($CRR['filename']) && $CRR['filename']){
|
||||
$_recep = TRUE;
|
||||
$Y = date('Y', strtotime($CRR['recep_date']));
|
||||
$m = date('m', strtotime($CRR['recep_date']));
|
||||
$dl_link = $dowload_link . $Y . '/' . $m . '/' . $CRR['filename'];
|
||||
$dl_csv = $base_link . '&getCsv&id_sale='.(int) $CRR['id_sale'].'&filename='.$CRR['filename'];
|
||||
$dl_link = '<a class="button" target="_blank" href="' . $dl_link . '" title="'.$this->l('Download CRR file').'"><img src="../img/admin/import.gif"/>'.$this->l('.DAT').'</a> ';
|
||||
$dl_link .= '<a class="button" target="_blank" href="' . $dl_csv . '" title="'.$this->l('Download CRR file').'"><img src="../img/admin/import.gif"/>'.$this->l('.CSV').'</a>';
|
||||
}
|
||||
else{
|
||||
$CRR['recep_date'] = '--';
|
||||
$dl_link = '--';
|
||||
}
|
||||
$auto_sync = (isset($CRR['auto_sync_active']) && $CRR['auto_sync_active']) ? true : false;
|
||||
$title = ($auto_sync ? $this->l('Désactiver l\'envoi automatique pour la vente') : $this->l('Activer l\'envoi automatique pour la vente') );
|
||||
|
||||
if (isset($CRR['date_end']) && $CRR['date_end'] >= $now)
|
||||
$auto_sync_btn = '<a title="' . $title . ' '. (int)$CRR['id_sale'] .'" data-id_sale = "' . (int) $CRR['id_sale'] . '" class="auto_sync_btn' . ($auto_sync ? ' active' : '') . '" href="' . $currentIndex . '&token=' . $this->token . '&auto_sync&id_sale=' . (int)$CRR['id_sale'] . '&active=' . (int) !$auto_sync . '"><img src="../img/admin/' . ($auto_sync ? 'module_install.png' : 'module_disabled.png') . '"/></a>';
|
||||
else
|
||||
$auto_sync_btn = '<span style="opacity: 0.4;" title="' . $this->l('La vente est terminée') .'"><img src="../img/admin/' . ($auto_sync ? 'module_install.png' : 'module_notinstall.png') . '"/></span>';
|
||||
|
||||
$submit_link = $upload_link;// . '&id_sale=' . (int) $CRR['id_sale'] . '&addCDC=1';
|
||||
$form .= '<tr>
|
||||
<td><input type="checkbox" id="check_sale_'.(int) $CRR['id_sale'].'" name="id_sales[]" value="'.(int) $CRR['id_sale'].'" /></td>
|
||||
<td><label style="float:none; width:auto; padding: 0; text-align: left; font-weight: normal;" for="check_sale_'.(int) $CRR['id_sale'].'">'.(int) $CRR['id_sale'].'</label></td>
|
||||
<td><label style="float:none; width:auto; padding: 0; text-align: left; font-weight: normal;" for="check_sale_'.(int) $CRR['id_sale'].'">'.$CRR['name'].'</label></td>
|
||||
<td style="text-align: center;">'.$CRR['sync_date'].'</td>
|
||||
<td style="text-align: center;">' . $dl_link . '</td>
|
||||
<td style="text-align: center;">'.$CRR['recep_date'].'</td>
|
||||
<td style="text-align: center;"><a title="'.$this->l('Envoi du fichier CDC').'" class="button upload_link" data-id="' . (int) $CRR['id_sale'] . '" href="'.$submit_link.'" title="'.$this->l('Upload CDC file').'"><img src="../img/admin/export.gif"/>'.$this->l('Envoyer à Philea').'</a></td>
|
||||
<td style="text-align: center;">'.$CRR['sent_date'].'</td>
|
||||
<td style="text-align: center;">'.$auto_sync_btn.'</td>
|
||||
</tr>';
|
||||
}
|
||||
$form .= '
|
||||
</tbody>
|
||||
</table>
|
||||
<p><input type="submit" class="btn button" name="philea_archive_submit" value="' . $this->l('Archiver la sélection') . '"/></p>
|
||||
</fieldset>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
$("document").ready(function(){
|
||||
$(".upload_link").click(function(e){
|
||||
e.preventDefault();
|
||||
$("#id_sale_hidden").val($(this).data("id"));
|
||||
$("#upload_form").submit();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
';
|
||||
|
||||
|
||||
$form .= $this->displayArchives();
|
||||
|
||||
echo $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get CRR files for not sent sales
|
||||
*/
|
||||
public function getCRRList(){
|
||||
if (isset(self::$_crrlist_cache) && self::$_crrlist_cache)
|
||||
return self::$_crrlist_cache;
|
||||
|
||||
// Get CRR if CDC has not been sent OR sync_date < TIME_DISPLAY DAYs
|
||||
$id_sales = array();
|
||||
$pm_sync = array();
|
||||
$sql = '
|
||||
SELECT
|
||||
pm_sync.`id_sale`,
|
||||
MAX(pm_sync.`date_add`) as `sync_date`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync` pm_sync
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_magistor_archive` pm_arch
|
||||
ON pm_arch.`id_sale` = pm_sync.`id_sale`
|
||||
WHERE 1
|
||||
AND `pm_arch`.`id_sale` IS NULL
|
||||
GROUP BY pm_sync.`id_sale`
|
||||
' . ((int) self::TIME_DISPLAY > 0 ? 'HAVING `sync_date` > DATE_SUB(NOW(), INTERVAL ' . self::TIME_DISPLAY . ' DAY)' : '') . '
|
||||
ORDER BY `sync_date` DESC';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row) {
|
||||
$id_sales[] = (int) $row['id_sale'];
|
||||
$pm_sync[(int) $row['id_sale']] = $row['sync_date'];
|
||||
}
|
||||
|
||||
$receptions = array();
|
||||
$sql = '
|
||||
SELECT
|
||||
pm_r.`id_sale`,
|
||||
pm_r.`filename`,
|
||||
MAX(pm_r.`date_add`) as `recep_date`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_reception` pm_r
|
||||
WHERE `id_sale` IN (' . implode(', ', $id_sales) . ')
|
||||
GROUP BY `id_sale`';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$receptions[$row['id_sale']] = $row;
|
||||
|
||||
$sales = array();
|
||||
$sql = '
|
||||
SELECT
|
||||
p.`id_sale`,
|
||||
c.`name`,
|
||||
p.`date_start`,
|
||||
p.`date_end`
|
||||
FROM `'._DB_PREFIX_.'privatesale` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` c
|
||||
ON c.`id_category` = p.`id_category`
|
||||
AND c.`id_lang` = 2
|
||||
WHERE p.`id_sale` IN (' .implode(', ', $id_sales) . ')';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$sales[(int) $row['id_sale']] = $row;
|
||||
|
||||
$pm_autosales = array();
|
||||
$sql = '
|
||||
SELECT
|
||||
pm_as.`id_sale`,
|
||||
pm_as.`active` as `auto_sync_active`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_auto_sync` pm_as
|
||||
WHERE `id_sale` IN (' . implode(', ', $id_sales) . ')
|
||||
AND pm_as.`active` = 1';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$pm_active[] = (int) $row['id_sale'];
|
||||
|
||||
$pm_sent = array();
|
||||
$sql = '
|
||||
SELECT
|
||||
pm_s.`id_sale`,
|
||||
MAX(pm_s.`date_add`) as `sent_date`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sent` pm_s
|
||||
WHERE pm_s.`id_sale` IN (' . implode(', ', $id_sales) . ')
|
||||
GROUP BY pm_s.`id_sale`';
|
||||
foreach (Db::getInstance()->executeS($sql) as $row)
|
||||
$pm_sent[(int) $row['id_sale']] = $row['sent_date'];
|
||||
|
||||
$CRR_list = array();
|
||||
foreach ($id_sales as $id_sale) {
|
||||
$sync_date = (isset($pm_sync[(int) $id_sale]) ? $pm_sync[(int) $id_sale] : '');
|
||||
$recep = (isset($receptions[(int) $id_sale]) ? $receptions[(int) $id_sale] : array('filename' => '', 'recep_date' => ''));
|
||||
$sale = (isset($sales[(int) $id_sale]) ? $sales[(int) $id_sale] : array('name' => '', 'date_start' => '', 'date_end' => ''));
|
||||
$sent_date = (isset($pm_sent[(int) $id_sale]) ? $pm_sent[(int) $id_sale] : '');
|
||||
$as_active = (isset($pm_active[(int) $id_sale])) ? 1 : 0;
|
||||
|
||||
$CRR_list[$id_sale] = array(
|
||||
'id_sale' => $id_sale,
|
||||
'sync_date' => $sync_date,
|
||||
'filename' => $recep['filename'],
|
||||
'recep_date' => $recep['recep_date'],
|
||||
'name' => $sale['name'],
|
||||
'sent_date' => $sent_date,
|
||||
'auto_sync_active' => $as_active,
|
||||
'date_start' => $sale['date_start'],
|
||||
'date_end' => $sale['date_end']
|
||||
);
|
||||
}
|
||||
self::$_crrlist_cache = $CRR_list;
|
||||
return self::$_crrlist_cache;
|
||||
|
||||
// $CRR_files = Db::getInstance()->executeS('
|
||||
// SELECT
|
||||
// pmsync.id_sale,
|
||||
// MAX(pmsync.`date_add`) as `sync_date`,
|
||||
// pmr.`filename`,
|
||||
// MAX(pmr.`date_add`) as `recep_date`,
|
||||
// c.`name`,
|
||||
// MAX(pms.date_add) as `sent_date`,
|
||||
// pmas.`active` as `auto_sync_active`,
|
||||
// p.date_start,
|
||||
// p.date_end
|
||||
// FROM `'._DB_PREFIX_.'philea_magistor_sync` pmsync
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_magistor_sent` pms
|
||||
// ON pms.`id_sale` = pmsync.`id_sale`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'privatesale` p
|
||||
// ON p.`id_sale` = pmsync.`id_sale`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'category_lang` c
|
||||
// ON c.`id_category` = p.`id_category`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_magistor_reception` pmr
|
||||
// ON pmsync.`id_sale` = pmr.`id_sale`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_magistor_auto_sync` pmas
|
||||
// ON pmas.`id_sale` = pmsync.`id_sale`
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_magistor_archive` pm_arch
|
||||
// ON pm_arch.`id_sale` = pmsync.`id_sale`
|
||||
// WHERE 1
|
||||
// AND c.id_lang = 2
|
||||
// AND `pm_arch`.id_sale IS NULL
|
||||
// ' . ((int) self::TIME_DISPLAY > 0 ? 'AND pmsync.`date_add` > DATE_SUB(NOW(), INTERVAL ' . self::TIME_DISPLAY . ' DAY)' : '') . '
|
||||
// GROUP BY pmsync.`id_sale`
|
||||
// ' . ((int) self::TIME_DISPLAY > 0 ? '
|
||||
// HAVING (
|
||||
// MAX(pms.date_add) IS NULL
|
||||
// OR MAX(pmsync.`date_add`) > DATE_SUB(NOW(), INTERVAL ' . self::TIME_DISPLAY . ' DAY)
|
||||
// OR pmsync.id_sale = 6304
|
||||
// )' : '') . '
|
||||
// ORDER BY `sync_date` DESC, `recep_date` DESC');
|
||||
// self::$_crrlist_cache = $CRR_files;
|
||||
// return self::$_crrlist_cache;
|
||||
}
|
||||
|
||||
public function displayArchives(){
|
||||
global $cookie, $currentIndex;
|
||||
|
||||
$base_link = $currentIndex . '&token='.Tools::getAdminTokenLite('AdminPhileaMagistor');
|
||||
|
||||
$archives_options = array();
|
||||
foreach(Db::getInstance()->executeS('
|
||||
SELECT a.`id_sale`, cl.`name`
|
||||
FROM `' . _DB_PREFIX_ . 'philea_magistor_archive` a
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'privatesale` p
|
||||
ON p.`id_sale` = a.`id_sale`
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'category_lang` cl
|
||||
ON cl.`id_category` = p.`id_category`
|
||||
AND cl.`id_lang` = ' . Configuration::get('PS_LANG_DEFAULT') . '
|
||||
') as $row){
|
||||
$archives_options[] = array(
|
||||
'label' => (int) $row['id_sale'].' - '.$row['name'],
|
||||
'value' => (int) $row['id_sale']
|
||||
);
|
||||
}
|
||||
|
||||
$helperForm = new HelperForm();
|
||||
$helperForm->_forms = array(
|
||||
array(
|
||||
'action' => $base_link,
|
||||
'legend' => $this->l('Archives'),
|
||||
'inputs' => array(
|
||||
array(
|
||||
'type' => 'select',
|
||||
'name' => 'id_sale_unarchive',
|
||||
'label' => $this->l('Désarchiver une vente'),
|
||||
'options' => $archives_options,
|
||||
'filter' => true,
|
||||
'filter_text' => $this->l('Filter par vente')
|
||||
)
|
||||
),
|
||||
'actions' => array(
|
||||
array(
|
||||
'type' => 'submit',
|
||||
'name' => 'unarchiveSale',
|
||||
'label' => $this->l('Désarchiver la vente')
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
return $helperForm->renderForm(false, NULL, NULL, true);
|
||||
}
|
||||
}
|
49
modules/philea_magistor/cron.php
Normal file
@ -0,0 +1,49 @@
|
||||
<?php
|
||||
//$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
include dirname(__FILE__).'/../../config/config.inc.php';
|
||||
|
||||
if(isset($_SERVER['REMOTE_ADDR'])) {
|
||||
exit;
|
||||
}
|
||||
set_time_limit(600);
|
||||
if($row = Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `status` = 0
|
||||
ORDER BY `date_add` ASC
|
||||
')) {
|
||||
// SEND ART01
|
||||
Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
SET `status` = 1
|
||||
WHERE `id_sync` = '.(int) $row['id_sync'].'
|
||||
LIMIT 1
|
||||
');
|
||||
system('cd '.dirname(__FILE__).'/script && php send_article.php '.(int) $row['id_sale']);
|
||||
sleep(20);
|
||||
|
||||
// SEND REC01 - pas de gestion recption fournisseur sur bbb
|
||||
/*Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
SET `status` = 2
|
||||
WHERE `id_sync` = '.(int) $row['id_sync'].'
|
||||
LIMIT 1
|
||||
');
|
||||
system('cd '.dirname(__FILE__).'/script && php send_recep_orderform.php '.(int) $row['id_sale']);*/
|
||||
}
|
||||
|
||||
if($row = Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `status` = 3
|
||||
ORDER BY `date_add` ASC
|
||||
')) {
|
||||
// SEND CDC02
|
||||
/*Db::getInstance()->ExecuteS('
|
||||
UPDATE `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
SET `status` = 4
|
||||
WHERE `id_sync` = '.(int) $row['id_sync'].'
|
||||
LIMIT 1
|
||||
');
|
||||
system('cd '.dirname(__FILE__).'/script && php send_commande.php '.(int) $row['id_sale']);*/
|
||||
}
|
52
modules/philea_magistor/cron_auto_sync.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
include dirname(__FILE__).'/../../config/config.inc.php';
|
||||
|
||||
if(isset($_SERVER['REMOTE_ADDR'])) {
|
||||
exit;
|
||||
}
|
||||
set_time_limit(600);
|
||||
$auto_sync_sales = Db::getInstance()->executeS('
|
||||
SELECT DISTINCT pmas.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_auto_sync` pmas
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_magistor_sync` pms
|
||||
ON pms.`id_sale` = pmas.`id_sale`
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale` p
|
||||
ON p.`id_sale` = pmas.`id_sale`
|
||||
WHERE pms.`status` >= 2
|
||||
AND pmas.active = 1
|
||||
AND p.date_start <= NOW()
|
||||
AND p.date_end >= DATE_SUB(NOW(), INTERVAL 1 HOUR)
|
||||
');
|
||||
if ($auto_sync_sales && count($auto_sync_sales))
|
||||
{
|
||||
foreach ($auto_sync_sales as $sale) {
|
||||
$id_sale = (int) $sale['id_sale'];
|
||||
|
||||
if (Db::getInstance()->getValue('
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `id_sale` = ' . (int) $id_sale . '
|
||||
AND `status` = 3
|
||||
')){
|
||||
continue;
|
||||
}
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
VALUES (
|
||||
DEFAULT,
|
||||
'.(int) $id_sale.',
|
||||
3,
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
$sql = '
|
||||
UPDATE `'._DB_PREFIX_.'philea_magistor_auto_sync`
|
||||
SET `last_sent` = NOW()
|
||||
WHERE `id_sale` = ' . (int) $id_sale . '
|
||||
LIMIT 1';
|
||||
Db::getInstance()->execute($sql);
|
||||
// system('cd '.dirname(__FILE__).'/script && php send_commande.php '.(int) $id_sale);
|
||||
// sleep(10);
|
||||
}
|
||||
}
|
533
modules/philea_magistor/philea_magistor.php
Normal file
@ -0,0 +1,533 @@
|
||||
<?php
|
||||
/*
|
||||
* 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 <contact@prestashop.com>
|
||||
* @copyright 2007-2011 PrestaShop SA
|
||||
* @version Release: $Revision: 8783 $
|
||||
* @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;
|
||||
|
||||
class philea_magistor extends Module
|
||||
{
|
||||
|
||||
const ID_SHIPPING = 4;
|
||||
|
||||
private $tab_carrier_magistor = array(
|
||||
'CHRONO13H_BtoC'=>'Chronopost 13h',
|
||||
'CHRONOCLA'=>'Chronopost europe',
|
||||
'COLIAF'=>'COLISSIMO ACCESS F SEI',
|
||||
'COLICO'=>'COLIECOMMERCE',
|
||||
'COLIEDOM'=>'COLISSIMO EXPERT OM',
|
||||
'COLIEF'=>'COLISSIMO EXPERT F SEI',
|
||||
'COLINT'=>'COLISSIMO INTERNATIONAL',
|
||||
'COLIEI'=>'COLISSIMO EXPERT INTERNATIONAL SEI',
|
||||
'COLIEY'=>'COLISSIMO EXPERT INTERNATIONAL KPG',
|
||||
'COLISF'=>'COLISSIMO SERVICE F SEI',
|
||||
'GLS'=>'GLS',
|
||||
'La Poste'=>'La Poste',
|
||||
'LAPOSTECR'=>'La Poste Contre Remboursement',
|
||||
'LETMAX'=>'Lettre Max',
|
||||
'LETSIMPLE'=>'Lettre Simple',
|
||||
'MDRY'=>'Mondial Relay',
|
||||
'MESSAGERIE'=>'MESSAGERIE',
|
||||
'RETSUPP'=>'Retrait Supplyweb',
|
||||
'SOCOLCITY'=>'SO COLISSIMO CITYSSIMO',
|
||||
'SOCOLMBP'=>'SO COLISSIMO MON BUREAU DE POSTE',
|
||||
'SOCOLMC'=>'SO COLISSIMO MON COMMMERCANT',
|
||||
'SOCOLMDS'=>'SO COLISSIMO MON DOMICILE AVEC SIGNATURE',
|
||||
'SOCOLMDSS'=>'SO COLISSIMO MON DOMICILE SANS SIGNATURE',
|
||||
'SOCOLMRRDV'=>'SO COLISSIMO MON RENDEZ VOUS (PARIS)',
|
||||
'TNT'=>'TNT',
|
||||
'EXAPAQ' => 'EXAPAQ',
|
||||
'DUCROS' => 'MESSAGERIE (DUCROS)',
|
||||
'DPD' => 'DPD',
|
||||
);
|
||||
public function __construct()
|
||||
{
|
||||
$this->name = 'philea_magistor';
|
||||
$this->tab = 'shipping_logistics';
|
||||
$this->version = '1.0';
|
||||
$this->author = 'Antadis';
|
||||
|
||||
parent::__construct();
|
||||
|
||||
$this->displayName = $this->l('Philea Magistor');
|
||||
$this->description = $this->l('Import and Export to Magistor');
|
||||
}
|
||||
|
||||
public function install()
|
||||
{
|
||||
Db::getInstance()->ExecuteS('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'philea_magistor_sent` (
|
||||
`id_order` INTEGER NOT NULL,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
INDEX (`id_order`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
');
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'philea_magistor_parcel` (
|
||||
`id_order` INTEGER NOT NULL,
|
||||
`shipping_number` VARCHAR(64) NOT NULL,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
INDEX (`id_order`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
');
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'philea_magistor_sync` (
|
||||
`id_sync` INTEGER NOT NULL AUTO_INCREMENT,
|
||||
`id_sale` INTEGER NOT NULL,
|
||||
`status` TINYINT NOT NULL,
|
||||
`date_add` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id_sync`),
|
||||
INDEX (`id_sale`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
');
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'philea_magistor_auto_sync` (
|
||||
`id_sale` INTEGER NOT NULL,
|
||||
`active` TINYINT NOT NULL,
|
||||
`last_sent` DATETIME NOT NULL,
|
||||
PRIMARY KEY (`id_sale`),
|
||||
INDEX (`id_sale`)
|
||||
) ENGINE=MyIsam DEFAULT CHARSET=utf8
|
||||
');
|
||||
|
||||
Db::getInstance()->execute('
|
||||
CREATE TABLE `'._DB_PREFIX_.'philea_magistor_archive` (
|
||||
`id_sale` int(11) NOT NULL,
|
||||
`date_add` datetime NOT NULL,
|
||||
PRIMARY KEY (`id_sale`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
');
|
||||
|
||||
if (parent::install() == false)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function displayForm()
|
||||
{
|
||||
global $cookie;
|
||||
|
||||
$order_states = OrderState::getOrderStates($cookie->id_lang);
|
||||
|
||||
$form = '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form"><div class="clear"> </div>';
|
||||
|
||||
$form .= '<form action="'.$_SERVER['REQUEST_URI'].'" method="post" class="form"><div class="clear"> </div>';
|
||||
|
||||
$form .= '<fieldset><legend>'.$this->l('Settings magistor FTP').'</legend>';
|
||||
$form .= '
|
||||
|
||||
<label for="philea_magistor_ftp_svr">'.$this->l('Serveur').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="philea_magistor_ftp_svr" name="CONFIG[PHILEA_MAGISTOR_FTP_SVR]" value="'.Configuration::get('PHILEA_MAGISTOR_FTP_SVR').'"/>
|
||||
</div>
|
||||
|
||||
<label for="philea_magistor_ftp_user">'.$this->l('Identifiant').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="philea_magistor_ftp_user" name="CONFIG[PHILEA_MAGISTOR_FTP_USER]" value="'.Configuration::get('PHILEA_MAGISTOR_FTP_USER').'"/>
|
||||
</div>
|
||||
|
||||
<label for="philea_magistor_ftp_pwd">'.$this->l('Mot de passe').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="philea_magistor_ftp_pwd" name="CONFIG[PHILEA_MAGISTOR_FTP_PWD]" value="'.Configuration::get('PHILEA_MAGISTOR_FTP_PWD').'"/>
|
||||
</div>
|
||||
|
||||
<label for="PHILEA_MAGISTOR_FTP_MODE">'.$this->l('Mode').'</label>
|
||||
<div class="margin-form">
|
||||
<select id="philea_magistor_ftp_mode" name="CONFIG[PHILEA_MAGISTOR_FTP_MODE]">
|
||||
<option value="active" '.(Configuration::get('PHILEA_MAGISTOR_FTP_MODE')=='active'? 'selected="selected"' : '').'>Active</option>
|
||||
<option value="passive" '.(Configuration::get('PHILEA_MAGISTOR_FTP_MODE')=='passive'? 'selected="selected"' : '').'>Passive</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
';
|
||||
$form .= '</fieldset><div class="clear"> </div>';
|
||||
|
||||
|
||||
$form .= '<fieldset><legend>'.$this->l('Settings').'</legend>';
|
||||
|
||||
$form.='
|
||||
<label for="PHILEA_MAGISTOR_STATUS_CRP">'.$this->l('Statut de préparation').'</label>
|
||||
<div class="margin-form">
|
||||
<select id="PHILEA_MAGISTOR_STATUS_CRP" name="CONFIG[PHILEA_MAGISTOR_STATUS_CRP]">';
|
||||
foreach($order_states as $order_state)
|
||||
$form .= '<option value="'.$order_state['id_order_state'].'" '.(Configuration::get('PHILEA_MAGISTOR_STATUS_CRP')==$order_state['id_order_state']?'selected="selected"':'').'>'.$order_state['name'].'</option>';
|
||||
$form .= '</select>
|
||||
</div>
|
||||
|
||||
<label for="PHILEA_MAGISTOR_STATUS_CRE">'.$this->l('Statut d\'expédition').'</label>
|
||||
<div class="margin-form">
|
||||
<select id="PHILEA_MAGISTOR_STATUS_CRE" name="CONFIG[PHILEA_MAGISTOR_STATUS_CRE]">';
|
||||
foreach($order_states as $order_state)
|
||||
$form .= '<option value="'.$order_state['id_order_state'].'" '.(Configuration::get('PHILEA_MAGISTOR_STATUS_CRE')==$order_state['id_order_state']?'selected="selected"':'').'>'.$order_state['name'].'</option>';
|
||||
$form .= '</select>
|
||||
</div>
|
||||
<label for="philea_magistor_assurance">'.$this->l('Activer l\'assurance à partir de').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="philea_magistor_assurance" name="CONFIG[PHILEA_MAGISTOR_ASSURANCE]" value="'.Configuration::get('PHILEA_MAGISTOR_ASSURANCE').'"/> €
|
||||
<p>'.$this->l('Laisser vide si vous ne souhaitez pas activer l\'assurance').'</p>
|
||||
</div>
|
||||
<label for="philea_magistor_code_ste">'.$this->l('Code Société').'</label>
|
||||
<div class="margin-form">
|
||||
<input type="text" id="philea_magistor_code_ste" name="CONFIG[PHILEA_MAGISTOR_CODE_STE]" value="'.Configuration::get('PHILEA_MAGISTOR_CODE_STE').'"/>
|
||||
</div>
|
||||
|
||||
<div class="margin-form">
|
||||
<table id="table_conv" style="border:1px solid #ccc;" cellpadding="3"><tbody>
|
||||
<tr>
|
||||
<th>'.$this->l('Id transporteur Prestashop').'</th>
|
||||
<th>'.$this->l('Transporteur PrestaShop').'</th>
|
||||
<th>'.$this->l('Transporteur Magistor associé').'</th>
|
||||
<th>'.$this->l('Statut transporteur Prestashop').'</th>
|
||||
</tr>';
|
||||
$cpt = 0;
|
||||
$tab = self::getTabState();
|
||||
$keys_tab = array_keys($tab);
|
||||
$id_associated = array();
|
||||
if(isset($keys_tab[0]) && !empty($keys_tab[0]))
|
||||
{
|
||||
foreach ($tab as $carrier_presta => $carrier_magistor)
|
||||
{
|
||||
$id_associated[] = (int) $temp[0];
|
||||
$temp = explode(':',$carrier_presta);
|
||||
$qCarrier = Db::getInstance()->getRow('SELECT id_carrier,name,active,deleted FROM '._DB_PREFIX_.'carrier WHERE id_carrier ='.$temp[0]);
|
||||
$form.='<tr id="'.$cpt.'">
|
||||
<td style="text-align:center;">'.$qCarrier['id_carrier'].'</td>
|
||||
<td>'.$qCarrier['name'].'<input type="hidden" value="'.$carrier_magistor.'" name="PHILEA_MAGISTOR_CARRIER['.stripslashes($carrier_presta).']"></td>
|
||||
<td>'.stripslashes($this->tab_carrier_magistor[$carrier_magistor]).'</td>
|
||||
<td>'.(($qCarrier['active'] AND !$qCarrier['deleted'])?'<font color="green">active</font>':'<font color="red">inactif</font>').'</td>
|
||||
<!--td><a href="javascript:delete_row('.$cpt.')">'.$this->l('supprimer').'</a></td//-->
|
||||
</tr>';
|
||||
$cpt++;
|
||||
}
|
||||
}
|
||||
$form.='</tbody></table>
|
||||
</div>
|
||||
<label for="carrier_magistor">'.$this->l('New carrier').'</label>
|
||||
<div class="margin-form">
|
||||
<select id="carrier_magistor">';
|
||||
foreach ($this->tab_carrier_magistor as $key => $value)
|
||||
{
|
||||
$form.='<option value="'.$key.'|'.$value.'">'.$value.'</option>';
|
||||
}
|
||||
$form.='</select>
|
||||
<select id="carrier_presta">';
|
||||
//$result = Db::getInstance()->ExecuteS('SELECT id_order_state, name FROM '._DB_PREFIX_.'order_state_lang WHERE id_lang ='.$cookie->id_lang);
|
||||
$result = Carrier::getCarriers($cookie->id_lang, false,false,false,NULL,5);
|
||||
foreach ($result as $carrier)
|
||||
{
|
||||
if(!in_array((int) $carrier['id_carrier'], $id_associated)) {
|
||||
$form.='<option value="'.$carrier['id_carrier'].'|'.$carrier['name'].'">'.$carrier['name'].'</option>';
|
||||
}
|
||||
}
|
||||
$form.='</select>
|
||||
<input type="button" class="button" onclick="add_carrier()" value="'.$this->l('Ajouter').'"/>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var cpt='.$cpt.';
|
||||
function add_carrier()
|
||||
{
|
||||
var temp = $("#carrier_presta").val();
|
||||
var temp2 = $("#carrier_magistor").val();
|
||||
|
||||
temp = temp.split("|");
|
||||
temp2 = temp2.split("|");
|
||||
|
||||
var add_html="<tr id=\""+cpt+"\"><td>"+temp2[1]+"</td>";
|
||||
add_html+=\'<td>\'+temp[1]+\'<input type="hidden" value="\'+temp2[0]+\'" name="PHILEA_MAGISTOR_CARRIER[\'+temp[0]+\':\'+getCompletedCodeCarrierMagistor(temp2[0])+\']"/></td><td><a href="javascript:delete_row(\'+cpt+\')">'.$this->l('supprimer').'</a></td></tr>\';
|
||||
cpt++;
|
||||
$("table#table_conv tbody").append(add_html);
|
||||
}
|
||||
function delete_row(id)
|
||||
{
|
||||
$("#"+id).remove();
|
||||
}
|
||||
function getCompletedCodeCarrierMagistor(code_carrier)
|
||||
{
|
||||
switch(code_carrier){
|
||||
/*case "SOCOLCITY":
|
||||
return "CIT";
|
||||
break;
|
||||
case "SOCOLMBP":
|
||||
return "BPR";
|
||||
break;
|
||||
case "SOCOLMC":
|
||||
return "A2P";
|
||||
break;
|
||||
case "SOCOLMDS":
|
||||
return "DOS";
|
||||
break;
|
||||
case "SOCOLMDSS":
|
||||
return "DOM";
|
||||
break;
|
||||
case "SOCOLMRRDV":
|
||||
return "RDV";
|
||||
break;*/
|
||||
default :
|
||||
return "";
|
||||
break;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<div class="margin-form">
|
||||
<input type="submit" name="submitSettings" value="'.$this->l('Enregistrer').'" class="button" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</form>';
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function getContent()
|
||||
{
|
||||
$output = '<h2>'.$this->displayName.'</h2>';
|
||||
if (!empty($_POST))
|
||||
{
|
||||
$output .= $this->_postProcess();
|
||||
}
|
||||
return $output.$this->displayForm();
|
||||
}
|
||||
|
||||
private function _postProcess()
|
||||
{
|
||||
if(Tools::isSubmit('submitSettings')) {
|
||||
if(isset($_POST['CONFIG']))
|
||||
{
|
||||
foreach($_POST['CONFIG'] as $key => $value)
|
||||
Configuration::updateValue($key, $value);
|
||||
}
|
||||
|
||||
if(isset($_POST['PHILEA_MAGISTOR_CARRIER']))
|
||||
Configuration::updateValue('PHILEA_MAGISTOR_CARRIER', self::setTabState($_POST['PHILEA_MAGISTOR_CARRIER']));
|
||||
return '<div class="conf confirm"><img src="' . _PS_IMG_ . 'admin/enabled.gif" alt="ok" /> '.$this->l('Settings updated').'</div>';
|
||||
} elseif(Tools::isSubmit('submitPhilea')) {
|
||||
$id_sale = (int) Tools::getValue('id_sale');
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `id_sale`
|
||||
FROM `'._DB_PREFIX_.'privatesale_shipping_sale`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `id_shipping` = '. (int) self::ID_SHIPPING.'
|
||||
')) {
|
||||
if(!Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
AND `status` = 0
|
||||
')) {
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_sync`
|
||||
VALUES (
|
||||
DEFAULT,
|
||||
'.(int) $id_sale.',
|
||||
0,
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
|
||||
echo '<p class="conf">'.$this->l('Sale added to queue successfully').'</p><br />';
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Sync already in progress for this sale').'</p><br />';
|
||||
}
|
||||
} else {
|
||||
echo '<p class="error">'.$this->l('Invalid sale id').'</p><br />';
|
||||
}
|
||||
}
|
||||
}
|
||||
static public function setTabState($tab)
|
||||
{
|
||||
$tabState = '';
|
||||
foreach ($tab as $key => $value)
|
||||
{
|
||||
$tabState .= $key.';'.$value.'|';
|
||||
}
|
||||
return substr($tabState,0,-1);
|
||||
}
|
||||
|
||||
static public function getTabState()
|
||||
{
|
||||
$tab=explode('|',Configuration::get('PHILEA_MAGISTOR_CARRIER'));
|
||||
$carrier_magistor=array();
|
||||
if(is_array($tab) AND sizeof($tab) > 0)
|
||||
{
|
||||
foreach ($tab as $ligne_carrier)
|
||||
{
|
||||
$temp=explode(';',$ligne_carrier);
|
||||
if(is_array($temp) AND sizeof($temp) > 1) {
|
||||
$carrier_magistor[$temp[0]]=$temp[1];
|
||||
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT `id_carrier`
|
||||
FROM `'._DB_PREFIX_.'carrier`
|
||||
WHERE `name` = (
|
||||
SELECT `name`
|
||||
FROM `'._DB_PREFIX_.'carrier`
|
||||
WHERE `id_carrier` = '.(int) str_replace(':', '', $temp[0]).'
|
||||
)
|
||||
AND `id_carrier` != '.(int) str_replace(':', '', $temp[0]).'
|
||||
AND `deleted` = 1
|
||||
') as $row) {
|
||||
$carrier_magistor[(int) $row['id_carrier'].':'] = $temp[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $carrier_magistor;
|
||||
}
|
||||
}
|
||||
|
||||
static public function getCompletedCodeCarrierMagistor($code_carrier)
|
||||
{
|
||||
switch($code_carrier){
|
||||
case 'SOCOLCITY':
|
||||
return 'CIT';
|
||||
break;
|
||||
case 'SOCOLMBP':
|
||||
return 'BPR';
|
||||
break;
|
||||
case 'SOCOLMC':
|
||||
return 'A2P';
|
||||
break;
|
||||
case 'SOCOLMDS':
|
||||
return 'DOM';
|
||||
break;
|
||||
case 'SOCOLMDSS':
|
||||
return 'DOS';
|
||||
break;
|
||||
case 'SOCOLMRRDV':
|
||||
return 'RDV';
|
||||
break;
|
||||
default :
|
||||
return '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getProductChild($by, $field) {
|
||||
if(!strlen(trim($field))) return false;
|
||||
$clause = 1;
|
||||
|
||||
if($by == 'reference')
|
||||
$clause = 'pa.`reference` = "'.pSql(addslashes($field)).'"';
|
||||
|
||||
if($by == 'ean')
|
||||
$clause = 'pa.`ean13` = "'.pSql(addslashes($field)).'"';
|
||||
|
||||
$sql = 'SELECT
|
||||
p.`id_product`
|
||||
,p.`price` as parent_price
|
||||
,pa.id_product_attribute
|
||||
,pa.`price`
|
||||
,pa.`quantity`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'product_attribute` as pa
|
||||
INNER JOIN
|
||||
`'._DB_PREFIX_.'product` as p
|
||||
ON
|
||||
p.`id_product` = pa.`id_product`
|
||||
WHERE
|
||||
'.$clause.'
|
||||
';
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
//echo "<br>".$sql;
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getProductId($by, $field) {
|
||||
if(!strlen(trim($field))) return false;
|
||||
$clause = 1;
|
||||
|
||||
if($by == 'reference')
|
||||
$clause = 'p.`reference` = "'.pSql(addslashes($field)).'"';
|
||||
|
||||
if($by == 'ean')
|
||||
$clause = 'p.`ean13` = "'.pSql(addslashes($field)).'"';
|
||||
|
||||
$sql = 'SELECT
|
||||
p.`id_product`
|
||||
,p.`quantity`
|
||||
FROM
|
||||
`'._DB_PREFIX_.'product` as p
|
||||
WHERE
|
||||
'.$clause.'
|
||||
';
|
||||
$result = Db::getInstance()->getRow($sql);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public static function getName($id_product,$id_lang, $id_product_attribute = False)
|
||||
{
|
||||
$name = DB::getInstance()->getValue('SELECT name FROM '._DB_PREFIX_.'product_lang WHERE id_product = '.$id_product.' AND id_lang = '.$id_lang);
|
||||
if($id_product_attribute)
|
||||
{
|
||||
$names_attribute = DB::getInstance()->ExecuteS('SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute`, pa.`unit_price_impact`
|
||||
FROM `'._DB_PREFIX_.'product_attribute` pa
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)($id_lang).')
|
||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)($id_lang).')
|
||||
WHERE pa.`id_product_attribute` = '.(int)($id_product_attribute).'
|
||||
ORDER BY pa.`id_product_attribute`');
|
||||
foreach ($names_attribute as $name_attribute)
|
||||
{
|
||||
$name .= ' - '.$name_attribute['group_name'].' : '.$name_attribute['attribute_name'];
|
||||
}
|
||||
}
|
||||
return $name;
|
||||
}
|
||||
|
||||
static public function getCarriersIdByRef($carrier_ref)
|
||||
{
|
||||
$tab = explode('|',Configuration::get('PHILEA_MAGISTOR_CARRIER'));
|
||||
$carriers = FALSE;
|
||||
$carrier_ids = array();
|
||||
if (is_array($tab) AND sizeof($tab) > 0)
|
||||
{
|
||||
foreach ($tab as $carrier)
|
||||
{
|
||||
$temp = explode(';',$carrier);
|
||||
if (is_array($temp) AND sizeof($temp) > 1) {
|
||||
|
||||
if ($temp[1] != $carrier_ref)
|
||||
continue;
|
||||
|
||||
$ids = explode(':', $temp[0]);
|
||||
$carrier_ids[] = (int) $ids[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($carrier_ids && count($carrier_ids)){
|
||||
$carriers = Db::getInstance()->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'carrier`
|
||||
WHERE `id_carrier` IN ('.implode(', ', $carrier_ids).')
|
||||
');
|
||||
return $carriers;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
0
modules/philea_magistor/script/ARTTEST.BAL
Normal file
139
modules/philea_magistor/script/ARTTEST.DAT
Normal file
@ -0,0 +1,139 @@
|
||||
ART01 78 74605 Trusquin de découpage Expert - 200 mm 0000000001 5055058173799000000034400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74606 Trusquin de marquage - 230 mm 0000000001 5024763014383000000017400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74607 Équerre de menuisier - 300 mm 0000000001 5055058130327000000035100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74608 Équerre de menuisier - 230 mm 0000000001 5024763014369000000030200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74609 Équerre de menuisier - 150 mm 0000000001 5055058130334000000022700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74610 Fausse équerre Expert - 230 mm 0000000001 5055058173775000000013200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74611 Fausse équerre Expert - 190 mm 0000000001 5055058173768000000012600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74612 Fausse équerre - 230 mm 0000000001 5024763014345000000014600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74613 Fausse équerre - 190 mm 0000000001 5024763014338000000013200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74614 Couteau de marquage - 180 mm 0000000001 5055058130358000000007800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74615 Ensemble de crayons de menuisier et taille - crayon - 13 pcs 0000000001 5024763032080000000018600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74616 Marqueurs de charnières - 106 mm 0000000001 5024763017018000000015300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74617 Marqueurs de charnières - 80 mm 0000000001 5024763016813000000010900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74618 Tenailles de menuisier Expert - 250 mm 0000000001 5055058142962000000052900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74619 Tenailles de menuisier Expert - 200 mm 0000000001 5055058142955000000037300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74620 Tenailles de menuisier Expert - 150 mm 0000000001 5055058142948000000024300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74621 Tenailles russes Expert - 250 mm 0000000001 5055058142986000000040900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74622 Tenailles russes Expert - 200 mm 0000000001 5055058142979000000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74623 Serre-joint à visser usage intensif - 1000 x 120 mm 0000000001 5060012952341000000266300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74624 Serre-joint à visser usage intensif - 800 x 120 mm 0000000001 5060012952334000000247600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74625 Serre-joint à visser usage intensif - 500 x 120 mm 0000000001 5060012952327000000199500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74626 Serre-joint à visser usage intensif - 300 x 120 mm 0000000001 5060012952310000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74627 Serre-joint à visser Euro - 1000 x 120 mm 0000000001 5055058195142000000163800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74628 Serre-joint robuste - 900 x 80 mm 0000000001 5055058188946000000150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74629 Serre-joint robuste - 600 x 80 mm 0000000001 5055058188922000000117500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74630 Serre-joint robuste - 450 x 80 mm 0000000001 5055058188915000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74631 Serre-joint robuste - 300 x 80 mm 0000000001 5055058188908000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74632 Serre-joint robuste - 150 x 80 mm 0000000001 5060012952297000000065200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74633 Serre-joint en F résistant - 200 x 100 mm 0000000001 5060012952303000000091500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74634 Serre-joint à visser Euro - 500 x 120 mm 0000000001 5055058195128000000112300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74635 Serre-joint à visser Euro - 300 x 120 mm 0000000001 5055058195104000000092500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74636 Serre-joint à visser Euro - 150 x 80 mm 0000000001 5055058195081000000043800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74637 Lot 2 serre-joints à visser - 150 x 50 mm 0000000001 5055058103444000000055400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74638 Presse rapide usage intensif - 600 mm 0000000001 5060012954666000000091900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74639 Presse rapide usage intensif - 450 mm 0000000001 5060012954659000000113800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74640 Presse rapide usage intensif - 300 mm 0000000001 5060012954635000000062600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74641 Presse rapide usage intensif - 150 mm 0000000001 5060012954628000000085100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74642 Presse rapide - 600 mm 0000000001 5024763018404000000092000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74643 Presse rapide - 450 mm 0000000001 5024763031786000000068400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74644 Presse rapide - 300 mm 0000000001 5024763018398000000067000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74645 Presse rapide - 150 mm 0000000001 5024763018381000000054600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74646 Presse "une main" - 150 mm 0000000001 5055058116390000000064800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74647 Pince à crémaillère - 50 x 60 mm 0000000001 5060012963026000000024800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74648 Lot de 2 mini presses rapides - 150 mm 0000000001 5024763031762000000017200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74649 Lot de 2 mini presses rapides - 100 mm 0000000001 5024763031724000000015100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74650 Scie à denture Hardpoint - 550 mm 7 TPI 0000000001 5055058126306000000043100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74651 Scie à denture Hardpoint - 500 mm 7 TPI 0000000001 5055058126290000000042500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74652 Scie à denture Hardpoint - 350 mm 7 TPI 0000000001 5055058126320000000032800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74653 Scie à dos denture Hardpoint - 250 mm 12 TPI 0000000001 5055058126337000000025600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74654 Scie à denture trempée - 400 mm 7 TPI 0000000001 5055058126313000000035500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74655 Scie à triple biseau - 550 mm 7 TPI 0000000001 5055058126269000000045500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74656 Scie doubles tranchants - 400 mm 7/13 TPI 0000000001 5055058126276000000031800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74657 Scie à triple biseau - 500 mm 7 TPI 0000000001 5055058126252000000041900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74658 Scie à triple biseau - 400 mm 7 TPI 0000000001 5055058126245000000033600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74659 Scie à triple biseau - 350 mm 7 TPI 0000000001 5055058126221000000032800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74660 Scie à triple biseau - 250 mm 12 TPI 0000000001 5055058126283000000026100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74661 Scie à onglets radiale à main - scie 600 mm 14 TPI 0000000001 5055058145550000000416300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74662 Lame pour scie à onglet de coupe profonde - lame 600 mm 14 TPI 0000000001 5060012964672000000017700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74663 Scie à onglets de précision - scie 550 mm, 14 TPI 0000000001 5024763013829000000399800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74664 Lame 550 mm, 14 TPI pour scie à onglet de précision 0000000001 5060012958220000000016800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74665 Boîte à onglets à base MDF - 325 x 180 mm 0000000001 5055058103949000000125700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74666 Boîte à onglets à base MDF - 365 x 110 mm 0000000001 5055058103956000000109400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74667 Boîte à onglets et scie - 300 x 90 mm 0000000001 5024763063107000000074500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74668 Boîte à onglets Expert - 300 x 90 mm 0000000001 5024763045318000000036300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74669 Boîte à onglets plastique - 300 x 100 mm 0000000001 5055058172877000000041000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74670 Boîte à onglets - 250 x 90 mm 0000000001 5060012962029000000048600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74671 Boîte à onglets - 190 x 25 mm 0000000001 5055058103918000000021900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74672 Scie multiusage à triple biseau - 230 mm 14 TPI 0000000001 5055058111586000000020500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74673 Scie à araser - 150 mm 22 TPI 0000000001 5055058125392000000015500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74674 Scie à chantourner + 5 lames - 170 mm 0000000001 5024763014796000000015000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74675 Scie à chantourner - 170 mm 0000000001 5024763040993000000016800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74676 Scie à guichet - 310 mm 7 TPI 0000000001 5055058126238000000018600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74677 Scie à guichet - 200 mm 0000000001 5024763016332000000013700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74678 Scie double tranchant pour plaques de plâtre - 150 mm 0000000001 5055058192394000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74679 Scie orientable - 350 mm 13 TPI 0000000001 5060012965600000000026000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74680 Scie pour plaques de plâtre poignée caoutchoutée - 150 mm 0000000001 5055058192370000000010400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74681 Scie à panneau - 300 mm 14 TPI 0000000001 5060012956073000000025500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74682 Jeu de 3 râpes - 200 mm 0000000001 5024763016158000000051900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74683 Râpe demi-ronde grain carbure - 150 mm 0000000001 5055058195876000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74684 Rabot à main n° 4 - Fer: 50 x 2 mm 0000000001 5060012956929000000175300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74685 Rabot à recaler n° 2 - 178 x 41 mm 0000000001 5055058130310000000073900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74686 Rabot à recaler - 45 x 165 mm 0000000001 5055058148568000000035500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74687 Rabot-lime compact métal - 300 mm 0000000001 5024763076640000000025500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74688 Rabot-lime compact moulé - 140 x 43 mm 0000000001 5024763073137000000007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74689 Râpe-lime à dégrossir - lame 250 mm 0000000001 5024763077906000000014500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74690 Serre-joint dormant profilé T - 1800 mm 0000000001 5024763006739000000428400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74691 Serre-joint dormant profilé T - 900 mm 0000000001 5024763006203000000277700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74692 Serre-joint dormant profilé T - 600 mm 0000000001 5024763006692000000241400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74693 Serre-joint dormant Expert - 1800 mm 0000000001 5055058145499000000401700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74694 Serre-joint dormant Expert - 1500 mm 0000000001 5055058145529000000354500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74695 Serre-joint dormant Expert - 1200 mm 0000000001 5055058145512000000312500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74696 Serre-joint dormant Expert - 900 mm 0000000001 5055058145505000000263000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74697 Serre-joint dormant Expert - 600 mm 0000000001 5055058145482000000403300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74698 Serre-joint guide dormant à bras de blocage - 1200 mm 0000000001 5024763024313000000145500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74699 Serre-joint/guide - 1270 mm 0000000001 5055058111470000000176300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74700 Serre-joint/guide - 900 mm 0000000001 5055058111463000000140100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74701 Serre-joint/guide - 600 mm 0000000001 5055058111456000000104100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74702 Ensemble de têtes de dormant - mâchoire 40 mm 0000000001 5055058173744000000128000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74703 Serre-joint dormant - 1500 mm 0000000001 5024763016325000000214900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74704 Serre-joint dormant - 1200 mm 0000000001 5024763016318000000192300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74705 Serre-joint dormant - 900 mm 0000000001 5024763016301000000089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74706 Serre-joint dormant - 600 mm 0000000001 5024763016295000000150900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74707 Outil d'installation de plancher/terrasse en bois - 600 mm 0000000001 5055058116147000000167400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74708 Serre-joint à sangle - 4 m 0000000001 5055058146618000000042200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74709 Presse à parquet - 130 mm 0000000001 5055058178602000000105000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74710 Presse à trois chants - 62 mm 0000000001 5024763042768000000020500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74711 Presse d'angle - 75 mm 0000000001 5024763029905000000016200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74712 Presse en C - 300 mm 0000000001 5024763010934000000102000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74713 Presse en C - 250 mm 0000000001 5024763010927000000225000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74714 Presse en C - 200 mm 0000000001 5024763010910000000168500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74715 Presse en C débrayable - 150 mm 0000000001 5055058185686000000118400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74716 Presse en C - 150 mm 0000000001 5024763015489000000125900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74717 Presse en C débrayable - 100 mm 0000000001 5055058185679000000108000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74718 Presse en C usage léger - 150 mm 0000000001 5055058171030000000075200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74719 Presse en C - 100 mm 0000000001 5024763015472000000076300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74720 Presse en C - 75 mm 0000000001 5024763015465000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74721 Presse en C usage léger - 100 mm 0000000001 5055058171023000000040900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74722 Lot de 5 presses à ressort - 210 mm 0000000001 5024763031854000000074800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74723 Vilebrequin - 280 mm 0000000001 5024763035951000000086300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74724 Chignole à manivelle à double pignon - 290 mm 0000000001 5060012956943000000076900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74725 Mini-rabot - 72 mm 0000000001 5055058130365000000013000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74726 Mini-guillaume - 72 mm 0000000001 5055058130372000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74727 Mini-rabot à racler - 80 mm 0000000001 5055058130389000000012800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74728 Mini-trusquin de marquage - 130 mm 0000000001 5055058130402000000007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74729 Etau d'ébéniste 9,5 kg - 180 mm 0000000001 5055058173751000000952900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74730 Presse d'établi 3,5 kg - 150 mm 0000000001 5060012966010000000348600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74731 Jeu de 12 ciseaux à bois de sculpteur - 200 mm 0000000001 5024763032271000000095500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74732 Jeu de 5 ciseaux à bois - 5 pcs 0000000001 5024763016219000000080200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74733 Jeu de 4 ciseaux à bois Expert - 6,13,19 et 25 mm 0000000001 5055058108548000000106200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74734 Jeu de 6 ciseaux à bois de ciseleur - 6 pcs 0000000001 5024763032264000000021400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74735 Ciseau d'angle - 70 mm 0000000001 5055058116154000000017300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74736 Ciseau à bois Expert - 25 mm 0000000001 5055058108586000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74737 Bloc diamant d'affûtage - 160 x 55 mm 0000000001 5024763031137000000057900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74738 Aiguiseur diamant pliant - grain 325/600 0000000001 5024763034725000000006900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74739 Affûteur Diamant pliable 100 x 20 mm - grain 600/1200 0000000001 5024763034732000000006900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74740 3 cartes diamant d'affûtage - 50 x 150 mm 0000000001 5060012965204000000023600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74741 Stylo aiguiseur diamant de poche - 80 mm 0000000001 5055058108975000000009300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74742 Pierre à affûter diamantée de poche - 25 x 75 x 6 mm 0000000001 5024763034787000000011500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74743 3 affûteuses diamant - 25 x 75 mm 0000000001 5024763034794000000006800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
139
modules/philea_magistor/script/ARTTEST_ARCHIVE.DAT
Normal file
@ -0,0 +1,139 @@
|
||||
ART01 78 74605 Trusquin de découpage Expert - 200 mm 0000000001 5055058173799000000034400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74606 Trusquin de marquage - 230 mm 0000000001 5024763014383000000017400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74607 Équerre de menuisier - 300 mm 0000000001 5055058130327000000035100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74608 Équerre de menuisier - 230 mm 0000000001 5024763014369000000030200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74609 Équerre de menuisier - 150 mm 0000000001 5055058130334000000022700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74610 Fausse équerre Expert - 230 mm 0000000001 5055058173775000000013200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74611 Fausse équerre Expert - 190 mm 0000000001 5055058173768000000012600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74612 Fausse équerre - 230 mm 0000000001 5024763014345000000014600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74613 Fausse équerre - 190 mm 0000000001 5024763014338000000013200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74614 Couteau de marquage - 180 mm 0000000001 5055058130358000000007800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74615 Ensemble de crayons de menuisier et taille - crayon - 13 pcs 0000000001 5024763032080000000018600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74616 Marqueurs de charnières - 106 mm 0000000001 5024763017018000000015300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74617 Marqueurs de charnières - 80 mm 0000000001 5024763016813000000010900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74618 Tenailles de menuisier Expert - 250 mm 0000000001 5055058142962000000052900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74619 Tenailles de menuisier Expert - 200 mm 0000000001 5055058142955000000037300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74620 Tenailles de menuisier Expert - 150 mm 0000000001 5055058142948000000024300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74621 Tenailles russes Expert - 250 mm 0000000001 5055058142986000000040900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74622 Tenailles russes Expert - 200 mm 0000000001 5055058142979000000028000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74623 Serre-joint à visser usage intensif - 1000 x 120 mm 0000000001 5060012952341000000266300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74624 Serre-joint à visser usage intensif - 800 x 120 mm 0000000001 5060012952334000000247600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74625 Serre-joint à visser usage intensif - 500 x 120 mm 0000000001 5060012952327000000199500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74626 Serre-joint à visser usage intensif - 300 x 120 mm 0000000001 5060012952310000000180000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74627 Serre-joint à visser Euro - 1000 x 120 mm 0000000001 5055058195142000000163800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74628 Serre-joint robuste - 900 x 80 mm 0000000001 5055058188946000000150000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74629 Serre-joint robuste - 600 x 80 mm 0000000001 5055058188922000000117500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74630 Serre-joint robuste - 450 x 80 mm 0000000001 5055058188915000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74631 Serre-joint robuste - 300 x 80 mm 0000000001 5055058188908000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74632 Serre-joint robuste - 150 x 80 mm 0000000001 5060012952297000000065200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74633 Serre-joint en F résistant - 200 x 100 mm 0000000001 5060012952303000000091500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74634 Serre-joint à visser Euro - 500 x 120 mm 0000000001 5055058195128000000112300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74635 Serre-joint à visser Euro - 300 x 120 mm 0000000001 5055058195104000000092500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74636 Serre-joint à visser Euro - 150 x 80 mm 0000000001 5055058195081000000043800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74637 Lot 2 serre-joints à visser - 150 x 50 mm 0000000001 5055058103444000000055400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74638 Presse rapide usage intensif - 600 mm 0000000001 5060012954666000000091900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74639 Presse rapide usage intensif - 450 mm 0000000001 5060012954659000000113800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74640 Presse rapide usage intensif - 300 mm 0000000001 5060012954635000000062600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74641 Presse rapide usage intensif - 150 mm 0000000001 5060012954628000000085100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74642 Presse rapide - 600 mm 0000000001 5024763018404000000092000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74643 Presse rapide - 450 mm 0000000001 5024763031786000000068400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74644 Presse rapide - 300 mm 0000000001 5024763018398000000067000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74645 Presse rapide - 150 mm 0000000001 5024763018381000000054600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74646 Presse "une main" - 150 mm 0000000001 5055058116390000000064800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74647 Pince à crémaillère - 50 x 60 mm 0000000001 5060012963026000000024800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74648 Lot de 2 mini presses rapides - 150 mm 0000000001 5024763031762000000017200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74649 Lot de 2 mini presses rapides - 100 mm 0000000001 5024763031724000000015100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74650 Scie à denture Hardpoint - 550 mm 7 TPI 0000000001 5055058126306000000043100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74651 Scie à denture Hardpoint - 500 mm 7 TPI 0000000001 5055058126290000000042500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74652 Scie à denture Hardpoint - 350 mm 7 TPI 0000000001 5055058126320000000032800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74653 Scie à dos denture Hardpoint - 250 mm 12 TPI 0000000001 5055058126337000000025600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74654 Scie à denture trempée - 400 mm 7 TPI 0000000001 5055058126313000000035500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74655 Scie à triple biseau - 550 mm 7 TPI 0000000001 5055058126269000000045500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74656 Scie doubles tranchants - 400 mm 7/13 TPI 0000000001 5055058126276000000031800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74657 Scie à triple biseau - 500 mm 7 TPI 0000000001 5055058126252000000041900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74658 Scie à triple biseau - 400 mm 7 TPI 0000000001 5055058126245000000033600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74659 Scie à triple biseau - 350 mm 7 TPI 0000000001 5055058126221000000032800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74660 Scie à triple biseau - 250 mm 12 TPI 0000000001 5055058126283000000026100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74661 Scie à onglets radiale à main - scie 600 mm 14 TPI 0000000001 5055058145550000000416300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74662 Lame pour scie à onglet de coupe profonde - lame 600 mm 14 TPI 0000000001 5060012964672000000017700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74663 Scie à onglets de précision - scie 550 mm, 14 TPI 0000000001 5024763013829000000399800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74664 Lame 550 mm, 14 TPI pour scie à onglet de précision 0000000001 5060012958220000000016800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74665 Boîte à onglets à base MDF - 325 x 180 mm 0000000001 5055058103949000000125700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74666 Boîte à onglets à base MDF - 365 x 110 mm 0000000001 5055058103956000000109400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74667 Boîte à onglets et scie - 300 x 90 mm 0000000001 5024763063107000000074500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74668 Boîte à onglets Expert - 300 x 90 mm 0000000001 5024763045318000000036300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74669 Boîte à onglets plastique - 300 x 100 mm 0000000001 5055058172877000000041000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74670 Boîte à onglets - 250 x 90 mm 0000000001 5060012962029000000048600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74671 Boîte à onglets - 190 x 25 mm 0000000001 5055058103918000000021900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74672 Scie multiusage à triple biseau - 230 mm 14 TPI 0000000001 5055058111586000000020500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74673 Scie à araser - 150 mm 22 TPI 0000000001 5055058125392000000015500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74674 Scie à chantourner + 5 lames - 170 mm 0000000001 5024763014796000000015000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74675 Scie à chantourner - 170 mm 0000000001 5024763040993000000016800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74676 Scie à guichet - 310 mm 7 TPI 0000000001 5055058126238000000018600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74677 Scie à guichet - 200 mm 0000000001 5024763016332000000013700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74678 Scie double tranchant pour plaques de plâtre - 150 mm 0000000001 5055058192394000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74679 Scie orientable - 350 mm 13 TPI 0000000001 5060012965600000000026000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74680 Scie pour plaques de plâtre poignée caoutchoutée - 150 mm 0000000001 5055058192370000000010400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74681 Scie à panneau - 300 mm 14 TPI 0000000001 5060012956073000000025500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74682 Jeu de 3 râpes - 200 mm 0000000001 5024763016158000000051900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74683 Râpe demi-ronde grain carbure - 150 mm 0000000001 5055058195876000000016000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74684 Rabot à main n° 4 - Fer: 50 x 2 mm 0000000001 5060012956929000000175300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74685 Rabot à recaler n° 2 - 178 x 41 mm 0000000001 5055058130310000000073900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74686 Rabot à recaler - 45 x 165 mm 0000000001 5055058148568000000035500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74687 Rabot-lime compact métal - 300 mm 0000000001 5024763076640000000025500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74688 Rabot-lime compact moulé - 140 x 43 mm 0000000001 5024763073137000000007000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74689 Râpe-lime à dégrossir - lame 250 mm 0000000001 5024763077906000000014500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74690 Serre-joint dormant profilé T - 1800 mm 0000000001 5024763006739000000428400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74691 Serre-joint dormant profilé T - 900 mm 0000000001 5024763006203000000277700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74692 Serre-joint dormant profilé T - 600 mm 0000000001 5024763006692000000241400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74693 Serre-joint dormant Expert - 1800 mm 0000000001 5055058145499000000401700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74694 Serre-joint dormant Expert - 1500 mm 0000000001 5055058145529000000354500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74695 Serre-joint dormant Expert - 1200 mm 0000000001 5055058145512000000312500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74696 Serre-joint dormant Expert - 900 mm 0000000001 5055058145505000000263000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74697 Serre-joint dormant Expert - 600 mm 0000000001 5055058145482000000403300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74698 Serre-joint guide dormant à bras de blocage - 1200 mm 0000000001 5024763024313000000145500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74699 Serre-joint/guide - 1270 mm 0000000001 5055058111470000000176300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74700 Serre-joint/guide - 900 mm 0000000001 5055058111463000000140100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74701 Serre-joint/guide - 600 mm 0000000001 5055058111456000000104100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74702 Ensemble de têtes de dormant - mâchoire 40 mm 0000000001 5055058173744000000128000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74703 Serre-joint dormant - 1500 mm 0000000001 5024763016325000000214900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74704 Serre-joint dormant - 1200 mm 0000000001 5024763016318000000192300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74705 Serre-joint dormant - 900 mm 0000000001 5024763016301000000089000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74706 Serre-joint dormant - 600 mm 0000000001 5024763016295000000150900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74707 Outil d'installation de plancher/terrasse en bois - 600 mm 0000000001 5055058116147000000167400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74708 Serre-joint à sangle - 4 m 0000000001 5055058146618000000042200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74709 Presse à parquet - 130 mm 0000000001 5055058178602000000105000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74710 Presse à trois chants - 62 mm 0000000001 5024763042768000000020500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74711 Presse d'angle - 75 mm 0000000001 5024763029905000000016200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74712 Presse en C - 300 mm 0000000001 5024763010934000000102000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74713 Presse en C - 250 mm 0000000001 5024763010927000000225000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74714 Presse en C - 200 mm 0000000001 5024763010910000000168500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74715 Presse en C débrayable - 150 mm 0000000001 5055058185686000000118400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74716 Presse en C - 150 mm 0000000001 5024763015489000000125900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74717 Presse en C débrayable - 100 mm 0000000001 5055058185679000000108000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74718 Presse en C usage léger - 150 mm 0000000001 5055058171030000000075200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74719 Presse en C - 100 mm 0000000001 5024763015472000000076300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74720 Presse en C - 75 mm 0000000001 5024763015465000000050000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74721 Presse en C usage léger - 100 mm 0000000001 5055058171023000000040900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74722 Lot de 5 presses à ressort - 210 mm 0000000001 5024763031854000000074800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74723 Vilebrequin - 280 mm 0000000001 5024763035951000000086300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74724 Chignole à manivelle à double pignon - 290 mm 0000000001 5060012956943000000076900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74725 Mini-rabot - 72 mm 0000000001 5055058130365000000013000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74726 Mini-guillaume - 72 mm 0000000001 5055058130372000000010100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74727 Mini-rabot à racler - 80 mm 0000000001 5055058130389000000012800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74728 Mini-trusquin de marquage - 130 mm 0000000001 5055058130402000000007300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74729 Etau d'ébéniste 9,5 kg - 180 mm 0000000001 5055058173751000000952900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74730 Presse d'établi 3,5 kg - 150 mm 0000000001 5060012966010000000348600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74731 Jeu de 12 ciseaux à bois de sculpteur - 200 mm 0000000001 5024763032271000000095500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74732 Jeu de 5 ciseaux à bois - 5 pcs 0000000001 5024763016219000000080200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74733 Jeu de 4 ciseaux à bois Expert - 6,13,19 et 25 mm 0000000001 5055058108548000000106200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74734 Jeu de 6 ciseaux à bois de ciseleur - 6 pcs 0000000001 5024763032264000000021400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74735 Ciseau d'angle - 70 mm 0000000001 5055058116154000000017300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74736 Ciseau à bois Expert - 25 mm 0000000001 5055058108586000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74737 Bloc diamant d'affûtage - 160 x 55 mm 0000000001 5024763031137000000057900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74738 Aiguiseur diamant pliant - grain 325/600 0000000001 5024763034725000000006900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74739 Affûteur Diamant pliable 100 x 20 mm - grain 600/1200 0000000001 5024763034732000000006900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74740 3 cartes diamant d'affûtage - 50 x 150 mm 0000000001 5060012965204000000023600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74741 Stylo aiguiseur diamant de poche - 80 mm 0000000001 5055058108975000000009300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74742 Pierre à affûter diamantée de poche - 25 x 75 x 6 mm 0000000001 5024763034787000000011500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
ART01 78 74743 3 affûteuses diamant - 25 x 75 mm 0000000001 5024763034794000000006800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
357
modules/philea_magistor/script/__send_commande.php
Normal file
@ -0,0 +1,357 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
|
||||
//include(dirname(__FILE__) . '/../../../config/settings.inc.php');
|
||||
include(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
ini_set('memory_limit', '4G');
|
||||
|
||||
// $id_sale = (int) $argv[1];
|
||||
$id_sale = 4814;
|
||||
|
||||
$_id_shipping = 4; // philea
|
||||
|
||||
if($id_sale == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
$id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
$tab_conversion_carrier = philea_magistor::getTabState();
|
||||
|
||||
$socol_to_magistor = array(
|
||||
'DOM' => 'SOCOLMDSS',
|
||||
'DOS' => 'SOCOLMDS',
|
||||
'RDV' => 'SOCOLMRDV',
|
||||
'CIT' => 'SOCOLCITY',
|
||||
'BPR' => 'SOCOLMBP',
|
||||
'CDI' => 'SOCOLMBP',
|
||||
'A2P' => 'SOCOLMC',
|
||||
'ACP' => 'SOCOLMBP',
|
||||
);
|
||||
|
||||
if($magistorModule->active) {
|
||||
global $regex_file_out;
|
||||
$regex_file_out = '@^CDC02(.*)\.(BAL|DAT)@';
|
||||
@set_time_limit(0);
|
||||
|
||||
$db = Db::getInstance();
|
||||
$id_order_state = 2;
|
||||
|
||||
/* @Override include orders */
|
||||
$include_orders = array();
|
||||
foreach($db->ExecuteS('
|
||||
SELECT DISTINCT o.`id_order`
|
||||
FROM `'._DB_PREFIX_.'order_state_current` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON o.`id_order` = d.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON d.`product_id` = c.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
ON s.`id_sale` = c.`id_sale`
|
||||
WHERE o.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
AND c.`id_sale` = '.(int) $id_sale.'
|
||||
AND s.`id_shipping` = '.(int) $_id_shipping.'
|
||||
AND CAST(d.`product_quantity` AS SIGNED) - CAST(d.`product_quantity_refunded` AS SIGNED) > 0
|
||||
') as $row) {
|
||||
$include_orders[] = (int) $row['id_order'];
|
||||
}
|
||||
if(count($include_orders) == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$exclude_orders = array();
|
||||
foreach($db->ExecuteS('
|
||||
SELECT DISTINCT `id_order`
|
||||
FROM `'._DB_PREFIX_.'philea_magistor_sent`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
') as $row) {
|
||||
$exclude_orders[] = (int) $row['id_order'];
|
||||
}
|
||||
|
||||
$orders = $db->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'orders`
|
||||
WHERE `date_add` > "2015-06-01 00:00:00"
|
||||
'.(count($exclude_orders) > 0? 'AND `id_order` NOT IN ('.implode(', ', $exclude_orders).')': '').'
|
||||
'.(count($include_orders) > 0? 'AND `id_order` IN ('.implode(', ', $include_orders).')': '').'
|
||||
');
|
||||
if(count($orders) == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `featured`
|
||||
FROM `'._DB_PREFIX_.'privatesale`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
')) {
|
||||
$code_societe = 78;//(int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
} else {
|
||||
$code_societe = (int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
}
|
||||
|
||||
$delai_livraison = (int)(Configuration::get('PHILEA_MAGISTOR_DELAI_LIVRAISON'));
|
||||
|
||||
|
||||
//@TODO rendre configurable le champs "reference" entre "reference" et "ean13"
|
||||
$referenceField = 'reference';//Configuration::get('PHILEA_MAGISTOR_REF_FIELD');
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/CDC02' . date('ymdHis');
|
||||
|
||||
$repo_archive = dirname(__FILE__) . '/archives/OUT/CMD/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$fileArchive = $repo_archive . 'CDC02' . date('ymdHis');
|
||||
|
||||
$data = '';
|
||||
foreach( $orders as $o ) {
|
||||
|
||||
$partialOrder = false;
|
||||
$order = new Order($o['id_order']);
|
||||
$products = $order->getProducts();
|
||||
|
||||
$nbProducts = 0;
|
||||
/*foreach($products as $product)
|
||||
{
|
||||
$productObj = new Product($product['product_id']);
|
||||
|
||||
if($productObj->send_philea)
|
||||
$nbProducts++;
|
||||
|
||||
unset($productObj);
|
||||
}*/
|
||||
// ANTADIS
|
||||
$products_ids = array();
|
||||
foreach($products as $product) {
|
||||
$products_ids[] = (int) $product['product_id'];
|
||||
}
|
||||
$nbProducts = (int) Db::getInstance()->getValue('
|
||||
SELECT COUNT(s.`id_shipping`)
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
ON s.`id_sale` = c.`id_sale`
|
||||
WHERE c.`id_product` IN ('.implode(', ', $products_ids).')
|
||||
AND s.`id_shipping` = '. (int) $_id_shipping.'
|
||||
AND s.`id_sale` = '.(int) $id_sale.'
|
||||
');
|
||||
//
|
||||
|
||||
if($nbProducts)
|
||||
{
|
||||
if(!Db::getInstance()->getValue('
|
||||
SELECT SUM(`product_quantity`)
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON c.`id_product` = d.`product_id`
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
ON s.`id_sale` = c.`id_sale`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
AND d.`product_quantity` - GREATEST(d.`product_quantity_return`, d.`product_quantity_refunded`) > 0
|
||||
AND s.`id_shipping` = '.(int) $_id_shipping.'
|
||||
AND s.`id_sale` = '.(int) $id_sale.'
|
||||
')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
$address_invoice = new Address($order->id_address_invoice);
|
||||
$address_delivery = new Address($order->id_address_delivery);
|
||||
$code_socolissimo = $db->getValue('SELECT delivery_mode FROM `'._DB_PREFIX_.'socolissimo_delivery_info` WHERE id_cart = '.$order->id_cart);
|
||||
$id_relais = $db->getValue('SELECT prid FROM `'._DB_PREFIX_.'socolissimo_delivery_info` WHERE id_cart = '.$order->id_cart);
|
||||
$key_carrier = $order->id_carrier.':'.($code_socolissimo?$code_socolissimo:'');
|
||||
|
||||
if($code_socolissimo && isset($socol_to_magistor[$code_socolissimo])) {
|
||||
$carrier_value = $socol_to_magistor[$code_socolissimo];
|
||||
} else {
|
||||
if(!isset($tab_conversion_carrier[$key_carrier])) {
|
||||
$carrier_value = 'EXAPAQ_B2B';//$socol_to_magistor['DOM'];
|
||||
} else {
|
||||
$carrier_value = $tab_conversion_carrier[$key_carrier];
|
||||
}
|
||||
}
|
||||
|
||||
if(($carrier_value == 'EXAPAQ_B2B' || $carrier_value == 'EXAPAQ') && (Db::getInstance()->getValue('
|
||||
SELECT `id_country`
|
||||
FROM `'._DB_PREFIX_.'address`
|
||||
WHERE `id_address` = '.(int) $order->id_address_delivery.'
|
||||
') != 8)) {
|
||||
$carrier_value = 'EXAPAQ_EXPORT';
|
||||
}
|
||||
|
||||
$data .= str_pad( 'E01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $order->id_customer, 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( date('Ymd',strtotime($order->date_add)+86400*$delai_livraison), 8, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 4, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $carrier_value , 50, ' ', STR_PAD_RIGHT );//$db->getValue('SELECT name FROM `'._DB_PREFIX_.'carrier` WHERE id_carrier = '.$order->id_carrier)
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->other)),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_invoice->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (!empty($address_invoice->phone_mobile)?$address_invoice->phone_mobile:$address_invoice->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($customer->email), 0, 50), 50, ' ', STR_PAD_RIGHT );
|
||||
if($code_socolissimo == 'DOM' OR !$code_socolissimo)
|
||||
{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->firstname.' '.$address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (!empty($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
if(!$code_socolissimo)
|
||||
{
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( '', 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
if($code_socolissimo == 'DOM')
|
||||
{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->firstname.' '.$address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
else
|
||||
{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (!empty($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_1
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_2
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_3
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_4
|
||||
$data .= str_pad( ($id_relais?$id_relais:''), 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_5
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_6
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_7
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_8
|
||||
if(Configuration::get('PHILEA_MAGISTOR_ASSURANCE') AND Configuration::get('PHILEA_MAGISTOR_ASSURANCE') <= ($order->total_paid_real - $order->total_shipping) AND Configuration::get('PHILEA_MAGISTOR_ASSURANCE') > 0)
|
||||
$data .= str_pad( str_replace('.',',',($order->total_paid_real - $order->total_shipping)), 50, ' ', STR_PAD_RIGHT ); // VALEUR DE COMMANDE
|
||||
else
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); // VALEUR DE COMMANDE
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );// ZONE_10
|
||||
$data .= str_pad( utf8_decode(cleanChar($address_delivery->other)), 400, ' ', STR_PAD_RIGHT );
|
||||
$data .= PHP_EOL;
|
||||
$products = $order->getProducts();
|
||||
|
||||
$nb_ligne = 0;
|
||||
foreach($products as $product)
|
||||
{
|
||||
$productObj = new Product($product['product_id']);
|
||||
|
||||
// ANTADIS
|
||||
$product_shipping = (int) Db::getInstance()->getValue('
|
||||
SELECT s.`id_shipping`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
ON s.`id_sale` = c.`id_sale`
|
||||
WHERE c.`id_product` = '.(int) $productObj->id.'
|
||||
AND s.`id_sale` = '.(int) $id_sale.'
|
||||
');
|
||||
//
|
||||
|
||||
if($product_shipping === $_id_shipping)
|
||||
{
|
||||
$nb_ligne++;
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['product_ean13'])? $product['product_ean13']: $product['product_supplier_reference'];
|
||||
} else {
|
||||
$ref = ($product['product_attribute_id']?$product['product_id'].'_'.$product['product_attribute_id']:$product['product_id']);
|
||||
}
|
||||
|
||||
$data .= str_pad( 'L01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $nb_ligne, 4, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $ref, 50, ' ', STR_PAD_RIGHT ); //$product['product_supplier_reference'], 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0), 8, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($product['product_name'])),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
else
|
||||
$partialOrder = true;
|
||||
}
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_sent`
|
||||
VALUES (
|
||||
'.(int) $order->id.',
|
||||
'.(int) $id_sale.',
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
|
||||
// ANTADIS
|
||||
/*if(isset($partialOrder) AND $partialOrder)
|
||||
{
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
// 17 --> Status of partial order
|
||||
$new_history->changeIdOrderState(17, $order->id);
|
||||
$new_history->addWithemail();
|
||||
unset($partialOrder);
|
||||
}*/
|
||||
} //End if nbproducts
|
||||
}//End foreach
|
||||
|
||||
|
||||
if($orders and is_array($orders))
|
||||
{
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
|
||||
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
|
||||
// require_once('connection_ftp.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cleanChar($string)
|
||||
{
|
||||
$string = str_replace(chr(13),' ',$string);
|
||||
$string = str_replace(chr(10),' ',$string);
|
||||
$string = str_replace(chr(13).chr(10),' ',$string);
|
||||
$string = str_replace(chr(10).chr(13),' ',$string);
|
||||
return $string;
|
||||
|
||||
}
|
2619
modules/philea_magistor/script/articles.dat
Normal file
67
modules/philea_magistor/script/connection_ftp.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php
|
||||
$dir = dirname(__FILE__);
|
||||
|
||||
include_once($dir.'/../../../config/config.inc.php');
|
||||
|
||||
$host = Configuration::get('PHILEA_MAGISTOR_FTP_SVR');
|
||||
$username = Configuration::get('PHILEA_MAGISTOR_FTP_USER');
|
||||
$password = Configuration::get('PHILEA_MAGISTOR_FTP_PWD');
|
||||
$mode = Configuration::get('PHILEA_MAGISTOR_FTP_MODE'); // "active" ou "passive"
|
||||
$namefilelocal = 'local.txt';
|
||||
|
||||
global $regex_file_in,$regex_file_out;
|
||||
|
||||
$handle = fopen($namefilelocal,'r');
|
||||
echo 'debut du traitement '.date('G:i:s d/m/Y').chr(10);
|
||||
|
||||
// connection au serveur ftp de Magistor
|
||||
|
||||
$id_ftp = ftp_connect($host) or die("Couldn't connect to $host"); ;
|
||||
//identification
|
||||
if(!ftp_login($id_ftp,$username,$password))
|
||||
die('erreur lors de l\'identification FTP'.chr(10).chr(10));
|
||||
|
||||
//activation du mode passif
|
||||
if($mode)
|
||||
if(!ftp_pasv($id_ftp,true))
|
||||
die('erreur lors de l\'activation du mode passif'.chr(10).chr(10));
|
||||
|
||||
//récupération des fichiers de sortie magistor
|
||||
$list=ftp_nlist($id_ftp,'./OUT');
|
||||
if(isset($regex_file_in))
|
||||
{
|
||||
foreach($list as $file)
|
||||
{
|
||||
$name_file = str_replace('./OUT/','',$file);
|
||||
if(!preg_match($regex_file_in, $name_file))
|
||||
continue;
|
||||
touch($dir.'/IN/'.$name_file);
|
||||
chmod($dir.'/IN/'.$name_file,0777);
|
||||
$handle = fopen($dir.'/IN/'.$name_file,'w+');
|
||||
if(!ftp_fget($id_ftp,$handle,$file,1))
|
||||
print('erreur lors de l\'ouverture du fichier : '.$file.chr(10));
|
||||
else
|
||||
{
|
||||
// ftp_fput($id_ftp,'archives/'.$name_file,$handle,FTP_BINARY);
|
||||
ftp_delete($id_ftp,$file);
|
||||
}
|
||||
fclose($handle);
|
||||
}
|
||||
}
|
||||
//envoie des fichiers d'entré magistor
|
||||
$list = scandir('OUT/');
|
||||
if(isset($regex_file_out))
|
||||
{
|
||||
foreach($list as $file)
|
||||
{
|
||||
if(!preg_match($regex_file_out, $file))
|
||||
continue;
|
||||
if($file == '.' || $file == '..')
|
||||
continue;
|
||||
if(!ftp_put ($id_ftp,'IN/'.$file,'OUT/'.$file,FTP_BINARY))
|
||||
print('erreur lors de l\'ouverture du fichier : '.$file.chr(10));
|
||||
else
|
||||
unlink('OUT/'.$file);
|
||||
}
|
||||
}
|
||||
?>
|
0
modules/philea_magistor/script/local.txt
Normal file
367
modules/philea_magistor/script/recept_expedition.php
Normal file
@ -0,0 +1,367 @@
|
||||
<?php
|
||||
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
|
||||
$_SERVER['SERVER_PORT'] = 80;
|
||||
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRE(.*)\.(BAL|DAT)@';
|
||||
@ini_set('display_errors', 'on');
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
|
||||
$id_shipping = 4; // PHILEA
|
||||
|
||||
$CRE = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'NO_CLIENT' => array(31,8),
|
||||
'N_CDE' => array(39,50),
|
||||
'NO_COLIS' => array(89,50),
|
||||
'NO_TRACKING' => array(139,50),
|
||||
'NO_EXPEDITION' => array(189,50),
|
||||
'DATE_EXPED' => array(239,8),
|
||||
'TRANSPORTEUR' => array(247,50),
|
||||
);
|
||||
|
||||
$tab_conversion_carrier = philea_magistor::getTabState();
|
||||
|
||||
$socol_to_magistor = array(
|
||||
'DOM' => 'SOCOLMDSS',
|
||||
'DOS' => 'SOCOLMDS',
|
||||
'RDV' => 'SOCOLMRDV',
|
||||
'CIT' => 'SOCOLCITY',
|
||||
'BPR' => 'SOCOLMBP',
|
||||
'CDI' => 'SOCOLMBP',
|
||||
'A2P' => 'SOCOLMC',
|
||||
'ACP' => 'SOCOLMBP',
|
||||
);
|
||||
|
||||
$mr_to_magistor = array(
|
||||
'24R' => 'MRMDSS', // Point relais
|
||||
'DRI' => 'MRMDS', // Colis drive
|
||||
'LD1' => 'MRMRDV', // Domicile RDC (1 pers)
|
||||
'LDS' => 'MRCITY', // Domicile spé (2 pers)
|
||||
'HOM' => 'MRMBP', // Domicile spé
|
||||
);
|
||||
|
||||
$format = $CRE;
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Checking for ".bal" files with a "CRE" prefix that has an equivalent ".dat" file and process them...
|
||||
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
$id_order_state = Configuration::get('PHILEA_MAGISTOR_STATUS_CRE');
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
|
||||
if ($fileinfo->isFile()) {
|
||||
if( preg_match( '@^CRE(.*)\.BAL@', $fileinfo->getFilename() ) ) {
|
||||
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
if( file_exists( $datFile ) ) {
|
||||
|
||||
$content = file_get_contents( $datFile );
|
||||
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
if( !empty($lines) ) {
|
||||
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field=>$value)
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
|
||||
if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
continue;
|
||||
|
||||
$id_sale = 0;
|
||||
$id_order = (string) $data[3];
|
||||
if(substr($id_order, 0, 2) == 'OP') {
|
||||
$id_order = explode('-', $id_order);
|
||||
if(count($id_order) < 2) {
|
||||
continue;
|
||||
}
|
||||
$id_sale = (int) str_replace('OP', '', $id_order[0]);
|
||||
$id_order = (int) $id_order[1];
|
||||
} else {
|
||||
$id_order = (int) $id_order;
|
||||
}
|
||||
|
||||
$order = new Order((int) ($id_order));
|
||||
|
||||
if(Validate::isLoadedObject($order))
|
||||
{
|
||||
$order->shipping_number = trim($data[5]);
|
||||
$order->id_sale_shipping = $id_sale;
|
||||
|
||||
$new_id_order_state = $id_order_state;
|
||||
|
||||
## GET SHIPPING CARRIER ID
|
||||
$id_active_carrier = FALSE;
|
||||
$id_inactive_carrier = FALSE;
|
||||
$carrier_found = FALSE;
|
||||
if (trim($data[5]) && isset($data[8]) && $data[8]){
|
||||
$carrier_name = trim($data[8]);
|
||||
|
||||
if ($carrier_name == '315')
|
||||
$carrier_name = 'DUCROS';
|
||||
|
||||
$carriers = philea_magistor::getCarriersIdByRef($carrier_name);
|
||||
if ($carriers){
|
||||
foreach ($carriers as $carrier) {
|
||||
if ($carrier['name'] == 'GLS' && $carrier_name == 'DPD')
|
||||
continue;
|
||||
if ($carrier['active'] == 1 && $carrier['deleted'] == 0)
|
||||
$id_active_carrier = (int) $carrier['id_carrier'];
|
||||
if ($carrier['active'] == 0 && $carrier['deleted'] == 0)
|
||||
$id_inactive_carrier = (int) $carrier['id_carrier'];
|
||||
if ((int) $order->id_carrier == (int) $carrier['id_carrier']){
|
||||
$carrier_found = (int) $order->id_carrier;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($carrier_found)
|
||||
$id_carrier = (int) $carrier_found;
|
||||
elseif ($id_active_carrier)
|
||||
$id_carrier = (int) $id_active_carrier;
|
||||
elseif ($id_inactive_carrier)
|
||||
$id_carrier = (int) $id_inactive_carrier;
|
||||
else
|
||||
$id_carrier = (int) $order->id_carrier;
|
||||
$order->id_carrier_shipping = (int) $id_carrier;
|
||||
|
||||
$order->update();
|
||||
|
||||
if (version_compare(_PS_VERSION_,'1.5','<'))
|
||||
$last_order_state = $order->getCurrentState();
|
||||
else
|
||||
$last_order_state = $order->getCurrentOrderState();
|
||||
|
||||
// ANTADIS
|
||||
$is_single = !((bool) Db::getInstance()->getRow('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`product_id` = c.`id_product`)
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
'));
|
||||
|
||||
// PRODUCTS FROM OTHER SALES
|
||||
if(!$is_single) {
|
||||
$sent = TRUE;
|
||||
|
||||
// GET QUANTITIES - SENT BY LAPOSTE
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`id_order_detail`, d.`product_id`, d.`product_attribute_id`, SUM(d.`product_quantity` - GREATEST(d.`product_quantity_return`, d.`product_quantity_refunded`) - IFNULL(l.`quantity`, 0)) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT JOIN `'._DB_PREFIX_.'lapostews` l
|
||||
ON d.`id_order_detail` = l.`id_order_detail`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
GROUP BY d.`id_order_detail`
|
||||
') as $row) {
|
||||
// GET QUANTITIES - SENT BY LAPOSTE - SENT BY EXAPAQ
|
||||
$row['quantity'] -= (int) Db::getInstance()->getValue('
|
||||
SELECT SUM(`quantity`)
|
||||
FROM `'._DB_PREFIX_.'exapaqws`
|
||||
WHERE `id_order_detail` = '.(int) $row['id_order_detail'].'
|
||||
');
|
||||
|
||||
// IF QTIES > 0 (NOT ALL SENT) GET IF PRODUCT HAS BEEN SENT
|
||||
// order has been registered in shipping_history for another shipping methode
|
||||
if((int) $row['quantity'] > 0) {
|
||||
if(!Db::getInstance()->getRow('
|
||||
SELECT c.`id_sale`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'shipping_history` h
|
||||
ON h.`id_sale` = c.`id_sale`
|
||||
WHERE c.`id_product` = '.(int) $row['product_id'].'
|
||||
AND h.`id_order` = '.(int) $order->id.'
|
||||
')) {
|
||||
$sent = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$sent) {
|
||||
$new_id_order_state = 17;
|
||||
}
|
||||
}
|
||||
|
||||
$products_sent = '';
|
||||
|
||||
mail('marion@antadis.com', 'philea id op', serialize($data[3]));
|
||||
|
||||
|
||||
if(substr((string) $data[3], 0, 2) == 'OP') {
|
||||
$id_sale = explode('-', substr((string) $data[3], 2));
|
||||
if(count($id_sale) < 2) {
|
||||
mail('marion@antadis.com', '[BBB] Philea erreur', serialize($data));
|
||||
exit;
|
||||
}
|
||||
$id_sale = (int) $id_sale[0];
|
||||
} else {
|
||||
$id_sale = 0;
|
||||
}
|
||||
|
||||
foreach(Db::getInstance()->ExecuteS('
|
||||
SELECT d.`product_name`, d.`product_quantity` - GREATEST(d.`product_quantity_return`, d.`product_quantity_refunded`) AS `quantity`
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON c.`id_product` = d.`product_id`
|
||||
WHERE c.`id_sale` = '.(int) $id_sale.'
|
||||
AND d.`id_order` = '.(int) $id_order.'
|
||||
') as $p) {
|
||||
if((int) $p['quantity'] > 0) {
|
||||
$products_sent .= '<br />'."\r\n".$p['quantity'].' x '.$p['product_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$templateVars = array(
|
||||
'{product_list}' => !empty($products_sent)? '<strong>Contenu du colis :</strong>'.$products_sent: '',
|
||||
'{product_list_txt}' => !empty($products_sent)? 'Contenu du colis :'.strip_tags($products_sent): '',
|
||||
);
|
||||
|
||||
if(/*$last_order_state->id*/ $last_order_state != $new_id_order_state && $last_order_state != 5 && ($new_id_order_state != 17 || $last_order_state != 4))
|
||||
{
|
||||
$id_order = (int)$order->id;
|
||||
$new_history = new OrderHistory();
|
||||
$new_history->id_order = (int)$order->id;
|
||||
$new_history->changeIdOrderState((int)$new_id_order_state, $id_order);
|
||||
$new_history->addWithemail(TRUE, $templateVars);
|
||||
}
|
||||
|
||||
Db::getInstance()->Execute('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_parcel`
|
||||
VALUES (
|
||||
'.(int) $order->id.',
|
||||
"'.pSQl(trim($order->shipping_number)).'",
|
||||
'.(int) $id_sale.',
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
|
||||
if ($data[5])
|
||||
{
|
||||
// $code_socolissimo = Db::getInstance()->getValue('SELECT delivery_mode FROM `'._DB_PREFIX_.'socolissimo_delivery_info` WHERE id_cart = '.$order->id_cart);
|
||||
// $key_carrier = $order->id_carrier.':'.($code_socolissimo? $code_socolissimo: '');
|
||||
// if($code_socolissimo && isset($socol_to_magistor[$code_socolissimo])) {
|
||||
// $carrier_value = $socol_to_magistor[$code_socolissimo];
|
||||
// } else {
|
||||
// if(!isset($tab_conversion_carrier[$key_carrier])) {
|
||||
// $carrier_value = $socol_to_magistor['DOM'];
|
||||
// } else {
|
||||
// $carrier_value = $tab_conversion_carrier[$key_carrier];
|
||||
// }
|
||||
// }
|
||||
|
||||
// $code_socolissimo = FALSE;
|
||||
// $code_mr = FALSE;
|
||||
// $relay_code = FALSE;
|
||||
|
||||
// // GET DELIVERY METHOD
|
||||
// $code_socolissimo = Db::getInstance()->getValue('SELECT delivery_mode FROM `'._DB_PREFIX_.'socolissimo_delivery_info` WHERE id_cart = '.$order->id_cart);
|
||||
// // Socolissimo delivery method
|
||||
// if ($code_socolissimo){
|
||||
// $relay_code = $code_socolissimo;
|
||||
// }
|
||||
// elseif (Module::isInstalled('mondialrelay')){
|
||||
// $code_mr = Db::getInstance()->getValue('
|
||||
// SELECT mr_m.`dlv_mode`
|
||||
// FROM `'._DB_PREFIX_.'mr_selected` mr_s
|
||||
// LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m
|
||||
// ON (mr_m.id_mr_method = mr_s.id_method)
|
||||
// WHERE mr_s.`id_cart` = ' . (int) $order->id_cart
|
||||
// );
|
||||
// // Mondial Relay delivery method
|
||||
// if ($code_mr)
|
||||
// $relay_code = $code_mr;
|
||||
// }
|
||||
// $key_carrier = $order->id_carrier.':'.($relay_code? $relay_code: '');
|
||||
// if($code_socolissimo && isset($socol_to_magistor[$code_socolissimo])) {
|
||||
// $carrier_value = $socol_to_magistor[$code_socolissimo];
|
||||
// } elseif($code_mr && isset($mr_to_magistor[$code_mr])) {
|
||||
// $carrier_value = $mr_to_magistor[$code_mr];
|
||||
// } else {
|
||||
// if(!isset($tab_conversion_carrier[$key_carrier])) {
|
||||
// $carrier_value = $socol_to_magistor['DOM'];
|
||||
// } else {
|
||||
// $carrier_value = $tab_conversion_carrier[$key_carrier];
|
||||
// }
|
||||
// }
|
||||
// if($code_socolissimo && isset($socol_to_magistor[$code_socolissimo])) {
|
||||
// $carrier_value = $socol_to_magistor[$code_socolissimo];
|
||||
// } else {
|
||||
// if(!isset($tab_conversion_carrier[$key_carrier])) {
|
||||
// $carrier_value = $socol_to_magistor['DOM'];
|
||||
// } else {
|
||||
// $carrier_value = $tab_conversion_carrier[$key_carrier];
|
||||
// }
|
||||
// }
|
||||
|
||||
## GET DELIVERY METHOD
|
||||
// $carrier = new Carrier((int)($order->id_carrier));
|
||||
$customer = new Customer((int) $order->id_customer);
|
||||
$carrier = new Carrier((int) $order->id_carrier_shipping);
|
||||
if (!Validate::isLoadedObject($customer) OR !Validate::isLoadedObject($carrier))
|
||||
die(Tools::displayError());
|
||||
|
||||
if((int) $order->id_lang == 3) {
|
||||
if(preg_match('/colissimo/i', $carrier->name)) {
|
||||
$carrier->url .= '&language=es_ES';
|
||||
}
|
||||
$content_html = '<strong>Contenido del paquete:</strong>';
|
||||
$content_txt = 'Contenido del paquete:';
|
||||
} else {
|
||||
$content_html = '<strong>Contenu du colis :</strong>';
|
||||
$content_txt = 'Contenu du colis :';
|
||||
}
|
||||
|
||||
$templateVars = array(
|
||||
'{product_list}' => !empty($products_sent)? $content_html.$products_sent: '',
|
||||
'{product_list_txt}' => !empty($products_sent)? $content_txt.strip_tags($products_sent): '',
|
||||
'{followup}' => str_replace('@', trim($order->shipping_number), $carrier->url),
|
||||
'{firstname}' => $customer->firstname,
|
||||
'{lastname}' => $customer->lastname,
|
||||
'{id_order}' => (int)($order->id)
|
||||
);
|
||||
|
||||
$title = array(
|
||||
2 => 'Livraison en cours',
|
||||
3 => 'Paquete en transito',
|
||||
5 => 'Consegna in corso'
|
||||
);
|
||||
|
||||
Mail::Send((int)($order->id_lang), 'in_transit', $title[(int)$order->id_lang], $templateVars,
|
||||
$customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL, NULL,
|
||||
_PS_MAIL_DIR_, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$repo_archive = './archives/IN/LIVRAISON/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo 'fin';
|
127
modules/philea_magistor/script/recept_preparation.php
Normal file
@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
|
||||
@ini_set('display_errors', 'on');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRP(.*)\.(BAL|DAT)@';
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
$CRP = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'N_CDE' => array(31,50),
|
||||
'NO_CLIENT' => array(81,8), // NO_VENTE
|
||||
'DATE_PREP' => array(89,8),
|
||||
'NO_LIGNE' => array(97,4),
|
||||
'NO_COLIS' => array(101,50), // N_CDE
|
||||
'CODE_ART' => array(151,50),
|
||||
'QTE' => array(201,10)
|
||||
);
|
||||
|
||||
$format = $CRP;
|
||||
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Checking for ".bal" files with a "CRP" prefix that has an equivalent ".dat" file and process them...
|
||||
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
|
||||
if ($fileinfo->isFile()) {
|
||||
|
||||
if( preg_match( '@^CRP(.*)\.BAL@', $fileinfo->getFilename() ) ) {
|
||||
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
if( file_exists( $datFile ) ) {
|
||||
|
||||
$content = file_get_contents( $datFile );
|
||||
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
// ANTADIS
|
||||
if( !empty($lines) ) {
|
||||
|
||||
foreach( $lines as $line ) {
|
||||
// $data = array();
|
||||
// foreach($format as $field => $value) {
|
||||
// $data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
// }
|
||||
|
||||
// if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
// continue;
|
||||
|
||||
// // UPDATE SUPPLIER_ORDER
|
||||
|
||||
// // GET ORDER
|
||||
// $order = (string) trim($data[2]);
|
||||
// if(substr($order, 0, 2) == 'OP') {
|
||||
// $order = explode('-', $order);
|
||||
// if(count($order) < 2)
|
||||
// continue;
|
||||
// $id_sale = (int) str_replace('OP', '', $order[0]);
|
||||
// $id_order = (int) $order[1];
|
||||
// } else {
|
||||
// $id_order = (int) $order;
|
||||
// }
|
||||
|
||||
// // GET PRODUCT
|
||||
// $product = trim($data[7]);
|
||||
// $product = explode('_', $product);
|
||||
// $id_product = (int) $product[0];
|
||||
// $id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
|
||||
|
||||
// // GET QTY
|
||||
// if (!isset($data[8]) || !$data[8])
|
||||
// continue;
|
||||
// $qty = (int) trim($data[8]);
|
||||
// if (!$qty)
|
||||
// continue;
|
||||
|
||||
// $id_order_form = Db::getInstance()->getValue('
|
||||
// SELECT `id_order_form`
|
||||
// FROM `' . _DB_PREFIX_ . 'supplier_order`
|
||||
// WHERE `id_sale` = ' . (int) $id_sale);
|
||||
// if (!$id_order_form)
|
||||
// continue;
|
||||
|
||||
// $update_sql = '
|
||||
// UPDATE `' . _DB_PREFIX_ . 'supplier_order_detail`
|
||||
// SET `quantity_accepted` = `quantity_accepted` + ' . (int)$qty . '
|
||||
// WHERE `id_order_form` = ' . (int) $id_order_form . '
|
||||
// AND `id_product` = ' . (int) $id_product . '
|
||||
// AND `id_product_attribute` = ' . (int) $id_product_attribute . '
|
||||
// LIMIT 1';
|
||||
// Db::getInstance()->execute($update_sql);
|
||||
}
|
||||
}
|
||||
|
||||
$repo_archive = './archives/IN/PREPARATION/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
169
modules/philea_magistor/script/recept_reception.php
Normal file
@ -0,0 +1,169 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
@ini_set('display_errors', 'on');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^CRR(.*)\.(BAL|DAT)@';
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
## FILE FORMAT
|
||||
/**
|
||||
* CHAMPS VALEURS COMMENTAIRES DEBUT LONGUEUR
|
||||
* OP_CODE « REC01 » « REC01 » : balise fichier de réception 1 10
|
||||
* CODE_SOC ALPHA-NUMERIQUE Code société gestionnaire à définir 11 20
|
||||
* N_PIECE ALPHA-NUMERIQUE Numéro de réception ou numéro de commande d’achat 31 20
|
||||
* DATE_RECEP NUMERIQUE (YYYYMMDD) Date de réception 51 8
|
||||
* CODE_ART ALPHA-NUMERIQUE Code Article 59 50
|
||||
* QTE NUMERIQUE Quantité réellement réceptionnée 109 10
|
||||
* NO_LOT NUMERIQUE Numéro de lot 119 20
|
||||
* DATE_DLV NUMERIQUE (YYYYMMDD) Date limite de vente ou date de fabrication 139 8
|
||||
* COMMT ALPHA-NUMERIQUE Commentaires / Litige 147 100
|
||||
* NUM_BL ALPHA-NUMERIQUE Numéro du BL fournisseur si connu 247 50
|
||||
*/
|
||||
$CRR = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'N_PIECE' => array(31,20),
|
||||
'DATE_RECEP' => array(51,8),
|
||||
'CODE_ART' => array(59,50),
|
||||
'QTE' => array(109,10),
|
||||
'NO_LOT' => array(119, 20),
|
||||
'DATE_DLV' => array(139, 8),
|
||||
'COMMT' => array(147, 100),
|
||||
'NUM_BL' => array(247, 50),
|
||||
);
|
||||
|
||||
$format = $CRR;
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
if(is_object($iterator) && count($iterator)) {
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
if (!$fileinfo->isFile() || $fileinfo->getFilename() == '..' || $fileinfo->getFilename() == '.')
|
||||
continue;
|
||||
if( !preg_match( '@^CRR(.*)\.BAL@', $fileinfo->getFilename() ) )
|
||||
continue;
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
if( !file_exists( $datFile ) )
|
||||
continue;
|
||||
|
||||
$content = file_get_contents( $datFile );
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
if( empty($lines) )
|
||||
continue;
|
||||
// get DATA
|
||||
$sales = array();
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field => $value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
if (isset($data[2]) && $data[2])
|
||||
$sales[] = (int) str_replace('OP', '', $data[2]);
|
||||
}
|
||||
|
||||
|
||||
## UPDATE SUPPLIER_ORDER
|
||||
// GET SALE ID
|
||||
if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
continue;
|
||||
$id_sale = (int) str_replace('OP', '', (string) trim($data[2]));
|
||||
|
||||
// GET PRODUCT
|
||||
$product = trim($data[4]);
|
||||
$product = explode('_', $product);
|
||||
$id_product = (int) $product[0];
|
||||
$id_product_attribute = (isset($product[1]) ? (int) $product[1] : 0);
|
||||
|
||||
// GET QTY
|
||||
if (!isset($data[5]) || !$data[5])
|
||||
continue;
|
||||
$qty = (int) $data[5];
|
||||
if (!$qty)
|
||||
continue;
|
||||
|
||||
// GET ORDER FORM ID
|
||||
// get id in file
|
||||
$id_order_form = false;
|
||||
// if (isset($data[9]) && $data[9])
|
||||
// $id_order_form = (int) trim($data[9]);
|
||||
// else get id from sale id
|
||||
if (!$id_order_form){
|
||||
$id_order_form = Db::getInstance()->getValue('
|
||||
SELECT `id_order_form`
|
||||
FROM `' . _DB_PREFIX_ . 'supplier_order`
|
||||
WHERE `id_sale` = ' . (int) $id_sale);
|
||||
}
|
||||
if (!$id_order_form)
|
||||
continue;
|
||||
|
||||
$update_sql = '
|
||||
UPDATE `' . _DB_PREFIX_ . 'supplier_order_detail`
|
||||
SET `quantity_accepted` = `quantity_accepted` + ' . (int)$qty . '
|
||||
WHERE `id_order_form` = ' . (int) $id_order_form . '
|
||||
AND `id_product` = ' . (int) $id_product . '
|
||||
AND `id_product_attribute` = ' . (int) $id_product_attribute . '
|
||||
LIMIT 1';
|
||||
Db::getInstance()->execute($update_sql);
|
||||
unset($data);
|
||||
}
|
||||
|
||||
$sales = array_unique($sales);
|
||||
|
||||
## LOG RECEPTION FILE
|
||||
$fp = fopen("reception.txt", "w");
|
||||
fputs ($fp, $content);
|
||||
fclose ($fp);
|
||||
|
||||
// $email = Configuration::get('PS_SHOP_EMAIL');
|
||||
$email = 'coppee@antadis.com';
|
||||
Mail::Send(
|
||||
Configuration::get('PS_LANG_DEFAULT'),
|
||||
'philea_reception',
|
||||
'Fichier de rŽception',
|
||||
array('{date}' => date('d/m/Y H:i:s')),
|
||||
$email,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
array(
|
||||
'name' => 'reception.txt',
|
||||
'mime' => 'text/plain',
|
||||
'content' => file_get_contents('reception.txt')
|
||||
)
|
||||
);
|
||||
|
||||
// SAVE INTO ARCHIVE
|
||||
$repo_archive = dirname(__FILE__) . '/archives/IN/RECEPTION/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$datfile_name = preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
$sql_insert = array();
|
||||
foreach ($sales as $id_sale)
|
||||
$sql_insert[] = '(' . (int) $id_sale . ', "' . pSQL($datfile_name) . '", NOW())';
|
||||
$sql = 'INSERT INTO `'._DB_PREFIX_.'philea_magistor_reception` VALUES ' . implode(',', $sql_insert);
|
||||
Db::getInstance()->execute($sql);
|
||||
|
||||
// CLEAN FILE
|
||||
copy($datFile, $repo_archive . $datfile_name);
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
85
modules/philea_magistor/script/recept_stocks.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
include('../../../config/settings.inc.php');
|
||||
include('../../../config/config.inc.php');
|
||||
|
||||
@ini_set('display_errors', 'on');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
global $regex_file_in;
|
||||
$regex_file_in = '@^STK(.*)\.(BAL|DAT)@';
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
|
||||
$STK = array(
|
||||
'OP_CODE' => array(1,10),
|
||||
'CODE_SOC' => array(11,20),
|
||||
'CODE_ART' => array(31,50),
|
||||
'QTE' => array(81,10),
|
||||
);
|
||||
|
||||
$format = $STK;
|
||||
|
||||
if($magistorModule->active) {
|
||||
require_once('connection_ftp.php');
|
||||
@set_time_limit(0);
|
||||
|
||||
// Checking for ".bal" files with a "STK" prefix that has an equivalent ".dat" file and process them...
|
||||
|
||||
$inFolder = dirname(__FILE__) . '/IN/';
|
||||
|
||||
$iterator = new DirectoryIterator($inFolder);
|
||||
|
||||
foreach ($iterator as $fileinfo) {
|
||||
|
||||
if ($fileinfo->isFile()) {
|
||||
|
||||
if( preg_match( '@^STK(.*)\.BAL@', $fileinfo->getFilename() ) ) {
|
||||
|
||||
$datFile = $fileinfo->getPath() . '/' . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() );
|
||||
|
||||
if( file_exists( $datFile ) ) {
|
||||
|
||||
$content = file_get_contents( $datFile );
|
||||
|
||||
$lines = preg_split( '@\n@', $content );
|
||||
|
||||
// ANTADIS
|
||||
if( !empty($lines) ) {
|
||||
|
||||
foreach( $lines as $line ) {
|
||||
$data = array();
|
||||
foreach($format as $field => $value) {
|
||||
$data[] = substr($line, ($value[0]-1), $value[1]);
|
||||
}
|
||||
|
||||
if( !isset($data[2]) || (isset($data[2]) && !$data[2]) )
|
||||
continue;
|
||||
|
||||
$ids = explode('_', trim($data[2]));
|
||||
$id_product = (int)$ids[0];
|
||||
if (isset($ids[1]) && (int) $ids[1])
|
||||
$id_product_attribute = (int) $ids[1];
|
||||
else
|
||||
$id_product_attribute = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$repo_archive = './archives/IN/STOCK/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
copy($datFile, $repo_archive . preg_replace( '@BAL$@', 'DAT', $fileinfo->getFilename() ));
|
||||
|
||||
unlink($inFolder.$fileinfo->getFilename());
|
||||
unlink($datFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
0
modules/philea_magistor/script/reception.txt
Normal file
165
modules/philea_magistor/script/send_article.php
Normal file
@ -0,0 +1,165 @@
|
||||
<?php
|
||||
/*$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_PORT'] = 80;*/
|
||||
|
||||
include(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
|
||||
$id_sale = (int) $argv[1];
|
||||
|
||||
//$_id_shipping = 4; // philea
|
||||
|
||||
if($id_sale == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
@ini_set('display_errors', 'on');
|
||||
|
||||
if($magistorModule->active) {
|
||||
global $regex_file_out;
|
||||
$regex_file_out = '@^ART01(.*)\.(BAL|DAT)@';
|
||||
@set_time_limit(0);
|
||||
|
||||
$db = Db::getInstance();
|
||||
|
||||
$products = $db->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'product` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON (
|
||||
p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).'
|
||||
)
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON c.`id_product` = p.`id_product`
|
||||
WHERE c.`id_sale` = '.(int) $id_sale.'
|
||||
ORDER BY p.`id_product` ASC
|
||||
');
|
||||
if (!$products)
|
||||
$products = array();
|
||||
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `featured`
|
||||
FROM `'._DB_PREFIX_.'privatesale`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
')) {
|
||||
$code_societe = 101; // 78
|
||||
} else {
|
||||
$code_societe = (int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
}
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/ART01' . date('ymdHis');
|
||||
|
||||
$repo_archive = dirname(__FILE__) . '/archives/OUT/ARTICLES/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$fileArchive = $repo_archive . 'ART01' . date('ymdHis');
|
||||
|
||||
$data = '';
|
||||
|
||||
foreach( $products as $product ) {
|
||||
/*if($product['send_philea'])*/
|
||||
// ANTADIS
|
||||
// continue;
|
||||
|
||||
/**
|
||||
* @Override
|
||||
* Get image link
|
||||
*/
|
||||
$link = new Link();
|
||||
$cover = Db::getInstance()->getValue('
|
||||
SELECT `id_image`
|
||||
FROM `'._DB_PREFIX_.'image`
|
||||
WHERE id_product = ' . (int) $product['id_product'] . '
|
||||
AND `cover` = 1');
|
||||
$ids = (int) $product['id_product'] . '-' . (int) $cover;
|
||||
$img_link = 'http://'.$link->getImageLink($product['link_rewrite'], $ids, 'thickbox');
|
||||
|
||||
$attributes = $db->ExecuteS('SELECT * FROM '._DB_PREFIX_.'product_attribute WHERE id_product = '.$product['id_product']);
|
||||
if(count($attributes)>0)
|
||||
{
|
||||
foreach($attributes as $attribute)
|
||||
{
|
||||
if(isset($attribute['ean13']) && !empty($attribute['ean13']))
|
||||
$ean = $attribute['ean13'];
|
||||
else
|
||||
//$ean = '';
|
||||
$ean = substr(!empty($attribute['supplier_reference'])? $attribute['supplier_reference']: $product['supplier_reference'], 0, 13);
|
||||
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($attribute['ean13'])? $attribute['ean13']: $attribute['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'].'_'.$attribute['id_product_attribute'];
|
||||
}
|
||||
|
||||
$data .= str_pad('ART01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $ref)),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $magistorModule->getName($product['id_product'],Configuration::get('PS_LANG_DEFAULT'),$attribute['id_product_attribute']))),0,80), 80, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 1, 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ean), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( str_replace('.',',',($product['weight']+$attribute['weight'])/**1000*/), 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $product['width']*$product['height']*$product['depth'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( substr($img_link, 0, 150), 150, ' ', STR_PAD_RIGHT );
|
||||
// $data .= str_pad( '', 14, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 14, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($product['ean13']) && !empty($product['ean13']))
|
||||
$ean = $product['ean13'];
|
||||
else
|
||||
//$ean = '';
|
||||
$ean = substr($product['supplier_reference'], 0, 13);
|
||||
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'];
|
||||
}
|
||||
|
||||
$data .= str_pad('ART01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ref), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $product['name'])),0,80), 80, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 1, 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ean), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( str_replace('.',',',$product['weight']/**1000*/), 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $product['width']*$product['height']*$product['depth'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( substr($img_link, 0, 150), 150, ' ', STR_PAD_RIGHT );
|
||||
// $data .= str_pad( '', 14, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 14, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
// $data .= str_pad( '', 10, '0', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
} //End if send_philea
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
unset($data);
|
||||
|
||||
chmod($fileName . '.DAT', 0755);
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
chmod($fileName . '.BAL', 0755);
|
||||
require_once('connection_ftp.php');
|
||||
echo 'fin';
|
||||
}
|
498
modules/philea_magistor/script/send_commande.php
Normal file
@ -0,0 +1,498 @@
|
||||
<?php
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['HTTP_HOST'] = 'www.bebeboutik.com';
|
||||
|
||||
//include(dirname(__FILE__) . '/../../../config/settings.inc.php');
|
||||
include(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
ini_set('memory_limit', '4G');
|
||||
|
||||
$id_sale = (int) $argv[1];
|
||||
|
||||
//$_id_shipping = 4; // philea
|
||||
|
||||
if($id_sale == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
$id_lang = Configuration::get('PS_LANG_DEFAULT');
|
||||
|
||||
$tab_conversion_carrier = philea_magistor::getTabState();
|
||||
|
||||
$socol_to_magistor = array(
|
||||
'DOM' => 'SOCOLMDSS', // Livraison à domicile
|
||||
'DOS' => 'SOCOLMDS',
|
||||
'RDV' => 'SOCOLMRDV', // Livraison sur Rendez-vous
|
||||
'CIT' => 'SOCOLCITY', // Livraison en Cityssimo
|
||||
'BPR' => 'SOCOLMBP', // Livraison en Bureau de Poste
|
||||
'CDI' => 'SOCOLMBP', // Centre de distribution
|
||||
'A2P' => 'SOCOLMC', // Livraison Commerce de proximité
|
||||
'ACP' => 'SOCOLMBP', // Agence ColiPoste
|
||||
);
|
||||
|
||||
$mr_to_magistor = array(
|
||||
'24R' => 'MRMDSS', // Point relais
|
||||
'DRI' => 'MRMDS', // Colis drive
|
||||
'LD1' => 'MRMRDV', // Domicile RDC (1 pers)
|
||||
'LDS' => 'MRCITY', // Domicile spé (2 pers)
|
||||
'HOM' => 'MRMBP', // Domicile spé
|
||||
);
|
||||
|
||||
if($magistorModule->active) {
|
||||
global $regex_file_out;
|
||||
$regex_file_out = '@^CDC02(.*)\.(BAL|DAT)@';
|
||||
@set_time_limit(0);
|
||||
|
||||
$db = Db::getInstance();
|
||||
$id_order_state = 2;
|
||||
|
||||
/* @Override include orders */
|
||||
$include_orders = array();
|
||||
foreach($db->ExecuteS('
|
||||
SELECT DISTINCT o.`id_order`
|
||||
FROM `'._DB_PREFIX_.'order_state_current` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` d
|
||||
ON o.`id_order` = d.`id_order`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON d.`product_id` = c.`id_product`
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_magistor_sent` pms
|
||||
ON pms.`id_sale` = c.`id_sale` AND pms.`id_order` = o.`id_order`
|
||||
WHERE o.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
AND pms.`id_order` IS NULL
|
||||
AND c.`id_sale` = '.(int) $id_sale.'
|
||||
AND CAST(d.`product_quantity` AS SIGNED) - CAST(d.`product_quantity_refunded` AS SIGNED) > 0
|
||||
') as $row) {
|
||||
$include_orders[] = (int) $row['id_order'];
|
||||
}
|
||||
if(count($include_orders) == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// get all "not-relay" carriers for the sale
|
||||
$relay_carriers = Carrier::getShippingTypes();
|
||||
$relay_carriers = $relay_carriers[Carrier::SHIPPING_TYPE_RELAY];
|
||||
|
||||
$sale_carriers_full = array();
|
||||
$sale_carriers_wo_relay = array();
|
||||
foreach (Db::getInstance()->executeS('SELECT `id_carrier` FROM `' . _DB_PREFIX_ . 'privatesale_carrier` WHERE `id_sale` = ' . (int) $id_sale) as $carrier){
|
||||
$sale_carriers_full[] = (int) $carrier['id_carrier'];
|
||||
if (!in_array((int) $carrier['id_carrier'], $relay_carriers))
|
||||
$sale_carriers_wo_relay[] = (int) $carrier['id_carrier'];
|
||||
}
|
||||
|
||||
$exclude_orders = array();
|
||||
// foreach($db->ExecuteS('
|
||||
// SELECT DISTINCT `id_order`
|
||||
// FROM `'._DB_PREFIX_.'philea_magistor_sent`
|
||||
// WHERE `id_sale` = '.(int) $id_sale.'
|
||||
// ') as $row) {
|
||||
// $exclude_orders[] = (int) $row['id_order'];
|
||||
// }
|
||||
|
||||
$orders = $db->ExecuteS('
|
||||
SELECT o.*, h.`date_add` as `history_date`
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_history` h
|
||||
ON h.`id_order` = o.`id_order`
|
||||
AND h.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
WHERE o.`date_add` > "2015-06-01 00:00:00"
|
||||
AND h.`id_order_history` = (
|
||||
SELECT `id_order_history`
|
||||
FROM `'._DB_PREFIX_.'order_history` oh
|
||||
WHERE oh.`id_order` = o.`id_order`
|
||||
AND oh.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
ORDER BY oh.`date_add` ASC
|
||||
LIMIT 1
|
||||
)
|
||||
'.(count($exclude_orders) > 0? 'AND o.`id_order` NOT IN ('.implode(', ', $exclude_orders).')': '').'
|
||||
'.(count($include_orders) > 0? 'AND o.`id_order` IN ('.implode(', ', $include_orders).')': '').'
|
||||
ORDER BY `history_date` ASC
|
||||
');
|
||||
|
||||
// $orders = $db->ExecuteS('
|
||||
// SELECT * FROM `'._DB_PREFIX_.'orders` o
|
||||
// WHERE o.`date_add` > "2015-06-01 00:00:00"
|
||||
// '.(count($exclude_orders) > 0? 'AND o.`id_order` NOT IN ('.implode(', ', $exclude_orders).')': '').'
|
||||
// '.(count($include_orders) > 0? 'AND o.`id_order` IN ('.implode(', ', $include_orders).')': '').'
|
||||
// ');
|
||||
|
||||
if(count($orders) == 0) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if((int) Db::getInstance()->getValue('
|
||||
SELECT `featured`
|
||||
FROM `'._DB_PREFIX_.'privatesale`
|
||||
WHERE `id_sale` = '.(int) $id_sale.'
|
||||
')) {
|
||||
$code_societe = 78;//(int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
} else {
|
||||
$code_societe = (int)(Configuration::get('PHILEA_MAGISTOR_CODE_STE'));
|
||||
}
|
||||
|
||||
$delai_livraison = (int)(Configuration::get('PHILEA_MAGISTOR_DELAI_LIVRAISON'));
|
||||
|
||||
|
||||
//@TODO rendre configurable le champs "reference" entre "reference" et "ean13"
|
||||
$referenceField = 'reference';//Configuration::get('PHILEA_MAGISTOR_REF_FIELD');
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/CDC02' . date('ymdHis');
|
||||
|
||||
$repo_archive = dirname(__FILE__) . '/archives/OUT/CMD/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$fileArchive = $repo_archive . 'CDC02' . date('ymdHis');
|
||||
|
||||
$data = '';
|
||||
foreach( $orders as $o ) {
|
||||
|
||||
$partialOrder = false;
|
||||
$order = new Order($o['id_order']);
|
||||
$products = $order->getProducts();
|
||||
|
||||
|
||||
if (!in_array($order->id_carrier, $relay_carriers)){ // not a relay carrier
|
||||
$sale_carriers = $sale_carriers_wo_relay;
|
||||
}
|
||||
else{ // relay carrier
|
||||
$sale_carriers = $sale_carriers_full;
|
||||
}
|
||||
|
||||
$nbProducts = 0;
|
||||
/*foreach($products as $product)
|
||||
{
|
||||
$productObj = new Product($product['product_id']);
|
||||
|
||||
if($productObj->send_philea)
|
||||
$nbProducts++;
|
||||
|
||||
unset($productObj);
|
||||
}*/
|
||||
// ANTADIS
|
||||
$products_ids = array();
|
||||
foreach($products as $product) {
|
||||
$products_ids[] = (int) $product['product_id'];
|
||||
}
|
||||
$nbProducts = (int) Db::getInstance()->getValue('
|
||||
SELECT COUNT(s.`id_shipping`)
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
WHERE c.`id_product` IN ('.implode(', ', $products_ids).')
|
||||
AND c.`id_sale` = '.(int) $id_sale.'
|
||||
');
|
||||
//
|
||||
|
||||
if($nbProducts)
|
||||
{
|
||||
if(!Db::getInstance()->getValue('
|
||||
SELECT SUM(`product_quantity`)
|
||||
FROM `'._DB_PREFIX_.'order_detail` d
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_ps_cache` c
|
||||
ON c.`id_product` = d.`product_id`
|
||||
WHERE d.`id_order` = '.(int) $order->id.'
|
||||
AND d.`product_quantity` - GREATEST(d.`product_quantity_return`, d.`product_quantity_refunded`) > 0
|
||||
AND c.`id_sale` = '.(int) $id_sale.'
|
||||
')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$customer = new Customer($order->id_customer);
|
||||
$address_invoice = new Address($order->id_address_invoice);
|
||||
$address_delivery = new Address($order->id_address_delivery);
|
||||
|
||||
## GET KEY CARRIER
|
||||
/**
|
||||
* @Override
|
||||
* MR relay point
|
||||
*/
|
||||
$relay_point = array(
|
||||
'code' => FALSE,
|
||||
'id' => FALSE
|
||||
);
|
||||
$socol_relay = FALSE;
|
||||
$mr_relay = FALSE;
|
||||
|
||||
// SOCOLISSIMO RELAY POINT
|
||||
$socol_relay = $db->getRow('
|
||||
SELECT `delivery_mode`, `prid`
|
||||
FROM `'._DB_PREFIX_.'socolissimo_delivery_info`
|
||||
WHERE `id_cart` = ' . (int) $order->id_cart
|
||||
);
|
||||
if ($socol_relay){
|
||||
$relay_point['code'] = (isset($socol_relay['delivery_mode']) ? $socol_relay['delivery_mode'] : false);
|
||||
$relay_point['id'] = (isset($socol_relay['prid']) ? $socol_relay['prid'] : false);
|
||||
}
|
||||
else{
|
||||
// MONDIAL RELAY RELAY POINT
|
||||
// check if MR_Selected_Num is registered AND if Order->carrier eq mr_selected_method->carrier
|
||||
$mr_relay = $db->getRow('
|
||||
SELECT mr_m.`col_mode`, mr_m.`dlv_mode`, mr_s.`MR_Selected_Num`
|
||||
FROM `'._DB_PREFIX_.'mr_selected` mr_s
|
||||
LEFT JOIN `'._DB_PREFIX_.'mr_method` mr_m
|
||||
ON (mr_m.id_mr_method = mr_s.id_method)
|
||||
WHERE mr_s.`id_cart` = ' . (int) $order->id_cart . '
|
||||
AND mr_m.`id_carrier` = ' . (int) $order->id_carrier . '
|
||||
AND `MR_Selected_Num` IS NOT NULL
|
||||
');
|
||||
if ($mr_relay){
|
||||
$relay_point['code'] = (isset($mr_relay['dlv_mode']) ? $mr_relay['dlv_mode'] : false);
|
||||
$relay_point['id'] = (isset($mr_relay['MR_Selected_Num']) ? substr($mr_relay['MR_Selected_Num'], -5) : false);
|
||||
}
|
||||
}
|
||||
|
||||
// DEFAULT KEY CARRIER
|
||||
$key_carrier = $order->id_carrier . ':';
|
||||
// RELAY POINT DELIVERY
|
||||
if (isset($relay_point['code']) && $relay_point['code'])
|
||||
$key_carrier = $order->id_carrier . ':' . ((isset($relay_point['code']) && $relay_point['code']) ? $relay_point['code'] : '');
|
||||
// NOT A RELAY POINT DELIVERY : GET SALE CARRIER
|
||||
else{
|
||||
|
||||
// SALE HAVE ONLY ONE CARRIER : GET IT
|
||||
if (count($sale_carriers) == 1)
|
||||
$key_carrier = $order->id_carrier . ':' . ((isset($relay_point['code']) && $relay_point['code']) ? $relay_point['code'] : '');
|
||||
// SALE HAVE MANY CARRIERS
|
||||
elseif (count($sale_carriers) > 1){
|
||||
|
||||
// get customer groups
|
||||
$groups = $customer->getGroups();
|
||||
if (!is_array($groups) || empty($groups))
|
||||
$groups = array(1);
|
||||
|
||||
// get available carriers for delivery address
|
||||
$id_zone = (int) Db::getInstance()->getValue('
|
||||
SELECT `id_zone`
|
||||
FROM `' . _DB_PREFIX_ . 'country`
|
||||
WHERE `id_country` = ' . (int) $address_delivery->id_country);
|
||||
$carriers = Carrier::getCarriers((int)$order->id_lang, true, false, (int) $id_zone, $groups/*, Carrier::PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE*/);
|
||||
|
||||
// Get availbale carriers in sale_carriers
|
||||
$_carriers = array();
|
||||
foreach ($carriers as $carrier) {
|
||||
if (in_array( (int) $carrier['id_carrier'], $sale_carriers)){
|
||||
if ((int) $carrier['id_carrier'] == $order->id_carrier){
|
||||
$_carriers = array($carrier);
|
||||
break;
|
||||
}
|
||||
$_carriers[] = $carrier;
|
||||
}
|
||||
}
|
||||
// @todo find another way to get carrier
|
||||
// get first carrier
|
||||
if (count($_carriers))
|
||||
$key_carrier = (int) $_carriers[0]['id_carrier'] . ':';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## GET CARRIER VALUE
|
||||
if ($socol_relay && $relay_point['code'] && isset($socol_to_magistor[$relay_point['code']])) {
|
||||
$carrier_value = $socol_to_magistor[$relay_point['code']];
|
||||
}
|
||||
elseif ($mr_relay && $relay_point['code'] && isset($mr_to_magistor[$relay_point['code']])) {
|
||||
$carrier_value = $mr_to_magistor[$relay_point['code']];
|
||||
} else {
|
||||
if(!isset($tab_conversion_carrier[$key_carrier])) {
|
||||
$carrier_value = $socol_to_magistor['DOM']; // 'EXAPAQ_B2B'
|
||||
} else {
|
||||
$carrier_value = $tab_conversion_carrier[$key_carrier];
|
||||
}
|
||||
}
|
||||
|
||||
if ($carrier_value == 'EXAPAQ_B2B' || $carrier_value == 'EXAPAQ')
|
||||
$carrier_value = 'DPD';
|
||||
|
||||
## ASSIGN DATA
|
||||
$data .= str_pad( 'E01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $order->id_customer, 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( date('Ymd',strtotime($order->date_add)+86400*$delai_livraison), 8, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 4, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $carrier_value , 50, ' ', STR_PAD_RIGHT );//$db->getValue('SELECT name FROM `'._DB_PREFIX_.'carrier` WHERE id_carrier = '.$order->id_carrier)
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_invoice->other)),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_invoice->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (!empty($address_invoice->phone_mobile)?$address_invoice->phone_mobile:$address_invoice->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($customer->email), 0, 50), 50, ' ', STR_PAD_RIGHT );
|
||||
|
||||
if ($socol_relay && $relay_point['code'] && !in_array($relay_point['code'], array('DOM')))
|
||||
{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
// LIVRAISON RELAIS MONDIAL RELAY
|
||||
elseif($mr_relay && $relay_point['code'] && !in_array($relay_point['code'], array('LD1', 'LDS', 'HOM'))){
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
// LIVRAISON DOMICILE
|
||||
else{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->firstname.' '.$address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (!empty($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
// LIVRAISON SOCOL
|
||||
if ($socol_relay && $relay_point['code']){
|
||||
// SOCOL DOMICILE
|
||||
if (in_array($relay_point['code'], array('DOM'))){
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->firstname.' '.$address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
else{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (isset($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
// LIVRAISON MONDIAL RELAY
|
||||
elseif ($mr_relay && $relay_point['code']){
|
||||
// MR DOMICILE
|
||||
if (in_array($relay_point['code'], array('LD1', 'LDS', 'HOM'))){
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->firstname.' '.$address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->company),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
else{
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_invoice->firstname.' '.$address_invoice->lastname),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address1),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->address2),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($address_delivery->other)),0,50), 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->postcode),0,8), 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( substr(utf8_decode($address_delivery->city),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( utf8_decode($db->getValue('SELECT iso_code FROM `'._DB_PREFIX_.'country` WHERE id_country = '.$address_delivery->id_country)), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( (isset($address_delivery->phone_mobile)?$address_delivery->phone_mobile:$address_delivery->phone), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
// LIVRAISON DOMICILE
|
||||
else{
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//ADRESSE 3
|
||||
$data .= str_pad( '', 8, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );
|
||||
}
|
||||
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_1
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_2
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_3
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_4
|
||||
$data .= str_pad( ($relay_point['id']?$relay_point['id']:''), 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_5
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_6
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_7
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );//INFO_RELAIS_8
|
||||
if(Configuration::get('PHILEA_MAGISTOR_ASSURANCE') AND Configuration::get('PHILEA_MAGISTOR_ASSURANCE') <= ($order->total_paid_real - $order->total_shipping) AND Configuration::get('PHILEA_MAGISTOR_ASSURANCE') > 0)
|
||||
$data .= str_pad( str_replace('.',',',($order->total_paid_real - $order->total_shipping)), 50, ' ', STR_PAD_RIGHT ); // VALEUR DE COMMANDE
|
||||
else
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT ); // VALEUR DE COMMANDE
|
||||
$data .= str_pad( '', 50, ' ', STR_PAD_RIGHT );// ZONE_10
|
||||
$data .= str_pad( utf8_decode(cleanChar($address_delivery->other)), 400, ' ', STR_PAD_RIGHT );
|
||||
$data .= PHP_EOL;
|
||||
$products = $order->getProducts();
|
||||
|
||||
$nb_ligne = 0;
|
||||
foreach($products as $product)
|
||||
{
|
||||
$productObj = new Product($product['product_id']);
|
||||
|
||||
// ANTADIS
|
||||
$product_shipping = (int) Db::getInstance()->getValue('
|
||||
SELECT s.`id_shipping`
|
||||
FROM `'._DB_PREFIX_.'product_ps_cache` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'privatesale_shipping_sale` s
|
||||
ON s.`id_sale` = c.`id_sale`
|
||||
WHERE c.`id_product` = '.(int) $productObj->id.'
|
||||
AND s.`id_sale` = '.(int) $id_sale.'
|
||||
');
|
||||
//
|
||||
|
||||
if($product_shipping === $_id_shipping)
|
||||
{
|
||||
$nb_ligne++;
|
||||
|
||||
$ean = !empty($product['product_ean13'])? $product['product_ean13']: substr($product['product_supplier_reference'],0 ,13);
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['product_ean13'])? $product['product_ean13']: $product['product_supplier_reference'];
|
||||
} else {
|
||||
$ref = ($product['product_attribute_id']?$product['product_id'].'_'.$product['product_attribute_id']:$product['product_id']);
|
||||
}
|
||||
|
||||
$data .= str_pad( 'L01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale.'-'.$order->id, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $nb_ligne, 4, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $ref, 50, ' ', STR_PAD_RIGHT ); //$product['product_supplier_reference'], 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( max($product['product_quantity'] - max($product['product_quantity_return'], $product['product_quantity_refunded']), 0), 8, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( substr(utf8_decode(cleanChar($product['product_name'])),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ean), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
else
|
||||
$partialOrder = true;
|
||||
}
|
||||
|
||||
Db::getInstance()->ExecuteS('
|
||||
INSERT INTO `'._DB_PREFIX_.'philea_magistor_sent`
|
||||
VALUES (
|
||||
'.(int) $order->id.',
|
||||
'.(int) $id_sale.',
|
||||
NOW()
|
||||
)
|
||||
');
|
||||
} //End if nbproducts
|
||||
}//End foreach
|
||||
|
||||
|
||||
if($orders and is_array($orders))
|
||||
{
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
|
||||
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
|
||||
require_once('connection_ftp.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cleanChar($string)
|
||||
{
|
||||
$string = str_replace(chr(13),' ',$string);
|
||||
$string = str_replace(chr(10),' ',$string);
|
||||
$string = str_replace(chr(13).chr(10),' ',$string);
|
||||
$string = str_replace(chr(10).chr(13),' ',$string);
|
||||
return $string;
|
||||
|
||||
}
|
230
modules/philea_magistor/script/send_recep_orderform.php
Normal file
@ -0,0 +1,230 @@
|
||||
<?php
|
||||
|
||||
$_SERVER['HTTP_HOST'] = 'www.bricoprive.com';
|
||||
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
|
||||
$_SERVER['SERVER_PORT'] = 80;
|
||||
|
||||
include(dirname(__FILE__) . '/../../../config/config.inc.php');
|
||||
include( dirname(__FILE__) . '/../philea_magistor.php');
|
||||
|
||||
// $id_order_form = (int) $argv[1];
|
||||
|
||||
// $id_sale = (int)Db::getInstance()->getValue('
|
||||
// SELECT `id_sale`
|
||||
// FROM `'._DB_PREFIX_.'supplier_order`
|
||||
// WHERE `id_order_form` = '.(int) $id_order_form.'
|
||||
// ');
|
||||
|
||||
// if($id_order_form == 0) {
|
||||
// exit;
|
||||
// }
|
||||
|
||||
$id_sale = (int) $argv[1];
|
||||
if($id_sale == 0)
|
||||
exit;
|
||||
|
||||
## FILE FORMAT
|
||||
/**
|
||||
* CHAMPS VALEURS COMMENTAIRES DEBUT LONGUEUR
|
||||
* OP_CODE « REC01 » « REC01 » : balise fichier de réception 1 10
|
||||
* CODE_SOC ALPHA-NUMERIQUE Code société gestionnaire à définir 11 20
|
||||
* N_PIECE ALPHA-NUMERIQUE Numéro de réception ou numéro de commande d’achat 31 20
|
||||
* DATE_ATTENDUE NUMERIQUE (YYYYMMDD) Date de réception attendue 51 8
|
||||
* CODE_ART ALPHA-NUMERIQUE Code Article 59 50
|
||||
* QTE NUMERIQUE Quantité 109 10
|
||||
* QTE_MONO NUMERIQUE Quantité prévue dans des commandes mono-lignes 119 10
|
||||
* COMMENTAIRE ALPHA-NUMERIQUE Commentaires ou instructions de réception 129 250
|
||||
* NUM_BL ALPHA-NUMERIQUE Numéro du BL fournisseur 379 50
|
||||
* EAN_UVC NUMERIQUE Code ean de l'article (pour l'unité ou pièce) 429 14
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$magistorModule = new philea_magistor();
|
||||
@ini_set('display_errors', 'on');
|
||||
|
||||
if($magistorModule->active) {
|
||||
global $regex_file_out;
|
||||
$regex_file_out = '@^REC01(.*)\.(BAL|DAT)@';
|
||||
@set_time_limit(0);
|
||||
|
||||
$db = Db::getInstance();
|
||||
|
||||
|
||||
// $sent_order_forms = array();
|
||||
// $supplier_order_sent = Db::getInstance()->executeS('
|
||||
// SELECT `id_order_form`, `id_sale`, `date_add`
|
||||
// FROM `' . _DB_PREFIX_ . 'philea_supplier_order_sync` so
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale . '
|
||||
// GROUP BY `id_order_form`
|
||||
// ORDER BY `date_add` DESC');
|
||||
// if ($supplier_order_sent && count($supplier_order_sent)){
|
||||
// foreach ($supplier_order_sent as $row)
|
||||
// $sent_order_forms[] = (int) $row['id_order_form'];
|
||||
// if (count($sent_order_forms) >= 1)
|
||||
// $last_sent = array_shift($sent_order_forms);
|
||||
// }
|
||||
|
||||
## GET ALL ORDER FORMS FOR THIS SALE
|
||||
$order_forms = $db->executeS('
|
||||
SELECT DISTINCT(so.`id_order_form`)
|
||||
FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
LEFT JOIN `'._DB_PREFIX_.'philea_supplier_order_sync` psos
|
||||
ON psos.`id_order_form` = so.`id_order_form`
|
||||
WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
AND so.`id_order_state` IN (3,4,5,6,7)
|
||||
AND psos.`id_order_form` IS NULL
|
||||
');
|
||||
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// LEFT JOIN `'._DB_PREFIX_.'philea_supplier_order_sync` psos
|
||||
// ON psos.`id_order_form` = so.`id_order_form`
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
// '.(isset($sent_order_forms) && count($sent_order_forms) ? 'AND psos.`id_order_form` NOT IN ('.implode(',', $sent_order_forms).')' : '').'
|
||||
// ');
|
||||
|
||||
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// WHERE so.`id_sale` = ' . (int) $id_sale .'
|
||||
// ');
|
||||
|
||||
|
||||
## GET TOTAL QTY FOR MONO PRODUCT ORDERS
|
||||
$mono_sale_qties = array();
|
||||
// Only one product of the current sale in the order
|
||||
$sql = 'SELECT
|
||||
od.`id_order`,
|
||||
od.`product_id`,
|
||||
od.`product_attribute_id`,
|
||||
SUM(od.`product_quantity` - od.`product_quantity_refunded`) as `qty`
|
||||
FROM `' . _DB_PREFIX_ . 'order_detail` od
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'product_ps_cache` ppc
|
||||
ON ppc.`id_product` = od.`product_id`
|
||||
LEFT JOIN `' . _DB_PREFIX_ . 'order_state_current` osc
|
||||
ON osc.`id_order` = od.`id_order`
|
||||
WHERE ppc.`id_sale` = ' . (int) $id_sale . '
|
||||
AND osc.`id_order_state` IN (2, 3, 4, 9, 13, 17)
|
||||
GROUP BY od.`id_order`
|
||||
HAVING COUNT(od.`id_order`) = 1
|
||||
AND `qty` = 1';
|
||||
|
||||
foreach (Db::getInstance()->executeS($sql) as $mono_sale_detail) {
|
||||
$index = (int) $mono_sale_detail['product_id'] . '-' . (int) $mono_sale_detail['product_attribute_id'];
|
||||
// init index to 0
|
||||
if (!isset($mono_sale_qties[$index]))
|
||||
$mono_sale_qties[$index] = 0;
|
||||
if ((int) $mono_sale_detail['qty'] < 0)
|
||||
$mono_sale_detail['qty'] = 0;
|
||||
$mono_sale_qties[$index] += (int) $mono_sale_detail['qty'];
|
||||
}
|
||||
// $order_forms = $db->executeS('
|
||||
// SELECT DISTINCT(so.`id_order_form`)
|
||||
// FROM `'._DB_PREFIX_.'supplier_order` so
|
||||
// WHERE so.id_sale = ' . (int) $id_sale
|
||||
// );
|
||||
|
||||
$code_societe = 90;
|
||||
|
||||
$fileName = dirname(__FILE__) . '/OUT/REC01' . date('ymdHis');
|
||||
|
||||
$repo_archive = dirname(__FILE__) . '/archives/OUT/RECEP/';
|
||||
$repo_paths = array(date('Y'), date('m'));
|
||||
foreach ($repo_paths as $repo_path) {
|
||||
$repo_archive .= $repo_path . '/';
|
||||
if (!file_exists($repo_archive))
|
||||
mkdir($repo_archive);
|
||||
}
|
||||
|
||||
$fileArchive = $repo_archive . 'REC01' . date('ymdHis');
|
||||
|
||||
$data = '';
|
||||
$orderform_insert = array();
|
||||
foreach ($order_forms as $order_form) {
|
||||
|
||||
$id_order_form = (int)$order_form['id_order_form'];
|
||||
|
||||
$products = $db->ExecuteS('
|
||||
SELECT * FROM `'._DB_PREFIX_.'supplier_order_detail` p
|
||||
LEFT JOIN `'._DB_PREFIX_.'supplier_order_detail_lang` pl
|
||||
ON (
|
||||
p.`id_order_detail` = pl.`id_order_detail`
|
||||
AND pl.`id_lang` = '.(int)(Configuration::get('PS_LANG_DEFAULT')).'
|
||||
)
|
||||
WHERE p.`id_order_form` = '.(int) $id_order_form.'
|
||||
ORDER BY p.`id_product` ASC
|
||||
');
|
||||
|
||||
foreach( $products as $product ) {
|
||||
if($product['quantity'] > 0) {
|
||||
if(isset($product['ean13']) && !empty($product['ean13']))
|
||||
$ean = $product['ean13'];
|
||||
else
|
||||
//$ean = '';
|
||||
$ean = substr($product['supplier_reference'], 0, 13);
|
||||
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
|
||||
|
||||
/* @Override Brico */
|
||||
if (isset($product['id_product_attribute']) && $product['id_product_attribute']){
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'].'_'.$product['id_product_attribute'];
|
||||
}
|
||||
}
|
||||
else{
|
||||
if($code_societe == 78) {
|
||||
$ref = !empty($product['ean13'])? $product['ean13']: $product['supplier_reference'];
|
||||
} else {
|
||||
$ref = $product['id_product'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
## GET TOTAL QTY FOR MONO PRODUCT ORDERS
|
||||
// Total ordered qty for order regarding only this product in this sale
|
||||
$id_product_attribute = ((isset($product['id_product_attribute']) && $product['id_product_attribute']) ? (int) $product['id_product_attribute'] : 0);
|
||||
$index = (int) $product['id_product'] . '-' . (int) $id_product_attribute;
|
||||
$qty_mono = (isset($mono_sale_qties[$index]) && $mono_sale_qties[$index]) ? (int) $mono_sale_qties[$index] : 0;
|
||||
|
||||
$data .= str_pad('REC01', 10, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $code_societe, 20, ' ', STR_PAD_RIGHT );
|
||||
// $data .= str_pad( (int) $id_order_form, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( 'OP'.(int) $id_sale, 20, ' ', STR_PAD_RIGHT );
|
||||
$data .= date('Ymd', time() + 86400*3);
|
||||
$data .= str_pad( substr(utf8_decode(str_replace(array("\r", "\n"), "", $ref)),0,50), 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( $product['quantity'], 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( $qty_mono, 10, '0', STR_PAD_LEFT );
|
||||
$data .= str_pad( '', 250, ' ', STR_PAD_LEFT );
|
||||
$data .= str_pad( (int) $id_order_form, 50, ' ', STR_PAD_RIGHT );
|
||||
$data .= str_pad( str_replace(array("\r", "\n"), "", $ean), 14, ' ', STR_PAD_LEFT );
|
||||
$data .= PHP_EOL;
|
||||
}
|
||||
} //End if send_philea
|
||||
|
||||
$orderform_insert[] = '(' . (int) $id_order_form . ', ' . (int) $id_sale . ', NOW())';
|
||||
}
|
||||
|
||||
if (count($orderform_insert)){
|
||||
file_put_contents($fileName . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
file_put_contents($fileName . '.BAL', '');
|
||||
file_put_contents($fileArchive . '.DAT', "\xEF\xBB\xBF".utf8_encode($data));
|
||||
|
||||
chmod($fileName . '.DAT', 0755);
|
||||
chmod($fileName . '.BAL', 0755);
|
||||
|
||||
unset($data);
|
||||
|
||||
require_once('connection_ftp.php');
|
||||
Db::getInstance()->execute('
|
||||
INSERT INTO `' . _DB_PREFIX_ . 'philea_supplier_order_sync`
|
||||
VALUES ' . implode(', ', $orderform_insert) . '
|
||||
');
|
||||
}
|
||||
echo 'fin';
|
||||
}
|