Skip to content

Commit

Permalink
Merge pull request #3239 from devlab-oy/mika/ulk_kerays_asana
Browse files Browse the repository at this point in the history
Ulkoisen järjestelmän keräyssanoma
  • Loading branch information
jonikanerva authored Jul 12, 2016
2 parents 3d45f75 + 92b5ad8 commit 51df1b7
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 31 deletions.
37 changes: 30 additions & 7 deletions inc/functions.inc
Original file line number Diff line number Diff line change
Expand Up @@ -27677,7 +27677,7 @@ if (!function_exists('posten_outbounddelivery')) {

$_nimi = substr(trim($looprow['nimi'].' '.$looprow['nimitark']), 0, 50);
$_osoite = substr($looprow['osoite'], 0, 50);

$_postitp = substr($looprow['postitp'], 0, 30);
$_maa = substr($looprow['maa'], 0, 10);
$_postino = substr($looprow['postino'], 0, 10);
Expand Down Expand Up @@ -27734,12 +27734,7 @@ if (!function_exists('posten_outbounddelivery')) {

$_line_i = 1;

$posten_itemnumberfield = "tuoteno";
$alt_posten_itemnumberfield = t_avainsana("POSTEN_TKOODI", '', " and avainsana.selite = 'ItemNumber' ", '', '', "selitetark");

if (!empty($alt_posten_itemnumberfield)) {
$posten_itemnumberfield = $alt_posten_itemnumberfield;
}
$posten_itemnumberfield = posten_field('ItemNumber');

while ($looprow = mysql_fetch_assoc($loopres)) {

Expand Down Expand Up @@ -33316,3 +33311,31 @@ if (!function_exists('pupesoft_a2ps')) {
return $out_file;
}
}

if (!function_exists('posten_field')) {
function posten_field($column_name) {

switch ($column_name) {
case 'ItemNumber':
$key = t_avainsana('POSTEN_TKOODI', '', " and avainsana.selite = 'ItemNumber' ", '', '', 'selitetark');

if (empty($key)) {
$key = 'tuoteno';
}

break;
case 'ProdGroup2':
$key = t_avainsana('POSTEN_TKOODI', '', " and avainsana.selite = 'ProdGroup2' ", '', '', 'selitetark');

if (empty($key)) {
$key = '';
}

break;
default:
die(t('Annettu arvo ei ole k�yt�ss�'));
}

return mysql_real_escape_string($key);
}
}
16 changes: 6 additions & 10 deletions kerayksen_kuittaus_ulkoisesta_jarjestelmasta_cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@

if (!isset($tilausrivit[$tilausrivin_tunnus])) {
$tilausrivit[$tilausrivin_tunnus] = array(
'eankoodi' => mysql_real_escape_string($line->ItemNumber),
'keratty' => (float) $line->DeliveredQuantity
'item_number' => mysql_real_escape_string($line->ItemNumber),
'keratty' => (float) $line->DeliveredQuantity
);
}
else {
Expand All @@ -155,15 +155,11 @@

foreach ($tilausrivit as $tilausrivin_tunnus => $data) {

$eankoodi = $data['eankoodi'];
$keratty = $data['keratty'];
$item_number = $data['item_number'];
$keratty = $data['keratty'];

if ($hhv) {
$tuotelisa = "AND tuote.tuoteno = '{$eankoodi}'";
}
else {
$tuotelisa = "AND tuote.eankoodi = '{$eankoodi}'";
}
$posten_itemnumberfield = posten_field('ItemNumber');
$tuotelisa = "AND tuote.{$posten_itemnumberfield} = '{$item_number}'";

$query = "SELECT tilausrivi.*
FROM tilausrivi
Expand Down
17 changes: 3 additions & 14 deletions synkronoi_tuotteet_ulkoiseen_jarjestelmaan.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,24 +132,13 @@
$yksikko = substr($row['yksikko'], 0, 10);
$tuoteno = substr($row['tuoteno'], 0, 100);

$posten_itemnumberfield = "tuoteno";
$alt_posten_itemnumberfield = t_avainsana("POSTEN_TKOODI", '', " and avainsana.selite = 'ItemNumber' ", '', '', "selitetark");

if (!empty($alt_posten_itemnumberfield)) {
$posten_itemnumberfield = $alt_posten_itemnumberfield;
}

$posten_prodgroup2field = "";
$alt_posten_prodgroup2field = t_avainsana("POSTEN_TKOODI", '', " and avainsana.selite = 'ProdGroup2' ", '', '', "selitetark");

if (!empty($alt_posten_prodgroup2field)) {
$posten_prodgroup2field = utf8_encode($row[$alt_posten_prodgroup2field]);
}
$posten_itemnumberfield = posten_field('ItemNumber');
$posten_prodgroup2field = posten_field('ProdGroup2');

$line->addChild('ItemNumber', utf8_encode(substr($row[$posten_itemnumberfield], 0, 20)));
$line->addChild('ItemName', utf8_encode($nimitys));
$line->addChild('ProdGroup1', utf8_encode($try));
$line->addChild('ProdGroup2', $posten_prodgroup2field);
$line->addChild('ProdGroup2', utf8_encode($row[$posten_prodgroup2field]));
$line->addChild('SalesPrice', '');
$line->addChild('Unit1', utf8_encode($yksikko));
$line->addChild('Unit2', '');
Expand Down

0 comments on commit 51df1b7

Please sign in to comment.