my $buysell = $form->{vc} eq 'customer' ? "buy" : "sell";
my $arap = $form->{arap} eq "ar" ? "ar" : "ap";
- my $curr_null = $form->{curreny} ? '' : ' OR a.curr IS NULL'; # fix: after sql-injection fix, curr is inserted as NULL, before that as ''
-
my $query =
qq|SELECT a.id, a.invnumber, a.transdate, a.amount, a.paid, a.curr | .
qq|FROM $arap a | .
- qq|WHERE (a.${vc}_id = ?) AND (a.curr = ? $curr_null) AND NOT (a.amount = paid)| .
+ qq|WHERE (a.${vc}_id = ?) AND (COALESCE(a.curr, '') = ?) AND NOT (a.amount = a.paid)| .
qq|ORDER BY a.id|;
my $sth = prepare_execute_query($form, $dbh, $query,
conv_i($form->{"${vc}_id"}),
- $form->{currency});
+ "$form->{currency}");
$form->{PR} = [];
while (my $ref = $sth->fetchrow_hashref("NAME_lc")) {
}
$sth->finish;
+
+ $query = <<SQL;
+ SELECT COUNT(*)
+ FROM $arap
+ WHERE (${vc}_id = ?)
+ AND (COALESCE(curr, '') <> ?)
+ AND (amount <> paid)
+SQL
+ ($form->{openinvoices_other_currencies}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{"${vc}_id"}), "$form->{currency}");
+
$dbh->disconnect;
$main::lxdebug->leave_sub();
# Hier werden negativen Zahlungseingänge abgefangen
# Besser: in Oberfläche schon prüfen
# Zahlungsein- und ausgänge sind immer positiv
- $dbh->rollback;
+ $dbh->rollback;
$rc = 0;
}
if ($form->round_amount($paymentamount, 2) == 0) {
qq|SELECT
a.id, a.ordnumber, a.transdate, a.invnumber, a.amount,
ct.name AS customername, a.customer_id, a.duedate,
+ a.amount - a.paid AS open_amount,
cfg.dunning_description, cfg.dunning_level,
my ($count) = selectrow_query($self, $dbh, $query);
# build selection list
- if ($count < $myconfig->{vclimit}) {
+ if ($count <= $myconfig->{vclimit}) {
$query = qq|SELECT id, name, salesman_id
FROM $table WHERE NOT obsolete
ORDER BY name|;
$jsscript
|;
+ if ($form->{openinvoices_other_currencies}) {
+ my $warning = $form->{vc} eq 'customer' ? $::locale->text('There are #1 more open invoices for this customer with other currencies.', $form->{openinvoices_other_currencies})
+ : $::locale->text('There are #1 more open invoices from this vendor with other currencies.', $form->{openinvoices_other_currencies});
+
+ print qq|
+
+ <input type="hidden" name="openinvoices_other_currencies" value="| . H($form->{openinvoices_other_currencies}) . qq|">
+ <tr>
+ <td><b>| . $::locale->text('Note') . qq|: $warning</b></td>
+ </tr>
+|;
+ }
+
$lxdebug->leave_sub();
}
if ($row->{next_dunning_config_id}) {
map { $_->{SELECTED} = $_->{id} == $row->{next_dunning_config_id} } @{ $row->{DUNNING_CONFIG } };
}
- map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount fee interest);
+ map { $row->{$_} = $form->format_amount(\%myconfig, $row->{$_} * 1, -2) } qw(amount open_amount fee interest);
}
$form->get_lists('printers' => 'printers',
my $do_base_qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
- if ($do_base_qty != $row_sum_base_qty) {
- push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no stock at all or the full quantity of #2 #3.',
- $i, $form->{"qty_$i"}, $form->{"unit_$i"});
- }
+# if ($do_base_qty != $row_sum_base_qty) {
+# push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no stock at all or the full quantity of #2 #3.',
+# $i, $form->{"qty_$i"}, $form->{"unit_$i"});
+# }
}
if (@{ $form->{ERRORS} }) {
my $do_base_qty = $form->parse_amount(\%myconfig, $form->{"qty_$i"}) * $units->{$form->{"unit_$i"}}->{factor} / $base_unit_factor;
- if ($do_base_qty != $row_sum_base_qty) {
- push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
- $i, $form->{"qty_$i"}, $form->{"unit_$i"});
- }
+# if ($do_base_qty != $row_sum_base_qty) {
+# push @{ $form->{ERRORS} }, $locale->text('Error in position #1: You must either assign no transfer at all or the full quantity of #2 #3.',
+# $i, $form->{"qty_$i"}, $form->{"unit_$i"});
+# }
}
if (%request_map) {
zugeordneten Zahlungskonditionen korrekt geladen, wenn der Kunde keine
Zahlungsonditionen zugeordnet hatte, wird auch auf keine Zahlungskondition
gewechselt.
+ - Die Beschränkung in Lieferscheinen immer genau die Menge auszulagern, die
+ angegeben wurde, wurde aufgehoben. Der Lieferschein ist nach der
+ Lagerbuchung weiterhin nicht mehr editierbar, also Vorsicht.
Wichtige Änderungen für Administratoren:
922 940 1017 1024 1025 1028 1030 1031 1034 1035 1036 1037 1040 1043 1044 1046
1051 1055 1057 1058 1072 1073 1077 1079 1081 1082 1095 1098 1100 1101 1108
1110 1118 1125 1127 1130 1133 1135 1136 1138 1144 1146 1147 1150 1151 1155
- 1164 1173 1177 1186 1188 1190 1191 1195 1197 1198 1199 1200 1201 1209 1213
- 1243 1248 1250 1262 1286 1287 1289 1290 1291 1294 1299 1331 1334 1336 1339
- 1340 1341 1342 1343 1350 1399
+ 1164 1170 1173 1177 1186 1188 1190 1191 1195 1197 1198 1199 1200 1201 1209
+ 1213 1243 1248 1250 1262 1286 1287 1289 1290 1291 1294 1299 1331 1334 1336
+ 1339 1340 1341 1342 1343 1350 1352 1399
2009-06-02 - Version 2.6.0
'One or more Perl modules missing' => 'Ein oder mehr Perl-Module fehlen',
'Only due follow-ups' => 'Nur fällige Wiedervorlagen',
'Open' => 'Offen',
+ 'Open Amount' => 'Offener Betrag',
'Open amount' => 'offener Betrag',
'OpenDocument/OASIS' => 'OpenDocument/OASIS',
'Openings' => 'Öffnungszeiten',
'The wrong taxkeys for AP and AR transactions have been fixed.' => 'Die Probleme mit falschen Steuerschlüssel bei Kreditoren- und Debitorenbuchungen wurden behoben.',
'The wrong taxkeys for inventory transactions for sales and purchase invoices have been fixed.' => 'Die falschen Steuerschlüssel für Warenbestandsbuchungen bei Einkaufs- und Verkaufsrechnungen wurden behoben.',
'The wrong taxkeys have been fixed.' => 'Die Steuerschlüssel wurden nach Ihrer Auswahl korrigiert.',
+ 'There are #1 more open invoices for this customer with other currencies.' => 'Es gibt #1 weitere offene Rechnungen für diesen Kunden, die in anderen Währungen ausgestellt wurden.',
+ 'There are #1 more open invoices from this vendor with other currencies.' => 'Es gibt #1 weitere offene Rechnungen von diesem Lieferanten, die in anderen Währungen ausgestellt wurden.',
'There are #1 unfinished follow-ups of which #2 are due.' => 'Es gibt #1 Wiedervorlage(n), von denen #2 fällig ist/sind.',
'There are four tax zones.' => 'Es gibt vier Steuerzonen.',
'There are no items in stock.' => 'Dieser Artikel ist nicht eingelagert.',
'No or an unknown authenticantion module specified in "config/authentication.pl".' => 'Es wurde kein oder ein unbekanntes Authentifizierungsmodul in "config/authentication.pl" angegeben.',
'No part was found matching the search parameters.' => 'Es wurde kein Artikel gefunden, auf den die Suchparameter zutreffen.',
'No vendor has been selected yet.' => 'Es wurde noch kein Lieferant ausgewählt.',
+ 'Note' => 'Hinweis',
'Number' => 'Nummer',
'Others' => 'Andere',
'PAYMENT POSTED' => 'Rechung gebucht',
'The connection to the authentication database failed:' => 'Die Verbindung zur Authentifizierungsdatenbank schlug fehl:',
'The connection to the template database failed:' => 'Die Verbindung zur Vorlagendatenbank schlug fehl:',
'The creation of the authentication database failed:' => 'Das Anlegen der Authentifizierungsdatenbank schlug fehl:',
+ 'There are #1 more open invoices for this customer with other currencies.' => 'Es gibt #1 weitere offene Rechnungen für diesen Kunden, die in anderen Währungen ausgestellt wurden.',
+ 'There are #1 more open invoices from this vendor with other currencies.' => 'Es gibt #1 weitere offene Rechnungen von diesem Lieferanten, die in anderen Währungen ausgestellt wurden.',
'To (email)' => 'An',
'Transactions, AR transactions, AP transactions' => 'Dialogbuchen, Debitorenrechnungen, Kreditorenrechnungen',
'Trying to call a sub without a name' => 'Es wurde versucht, eine Unterfunktion ohne Namen aufzurufen.',
--- /dev/null
+#!/usr/bin/perl
+
+$self->{texts} = {
+ 'Database update error:' => 'Fehler beim Datenbankupgrade:',
+};
+
+$self->{subs} = {
+ 'do_query' => 'do_query',
+ 'do_update' => 'do_update',
+ 'mydberror' => 'mydberror',
+};
+
+1;
echo "Abbruch: $txt<br>";
exit(1);
}
-
+$dir = "../users/";
clearstatcache ();
//print_r($_FILES);
$test=$_POST["test"];
if (!empty($_FILES["Datei"]["name"])) {
$file=$_POST["ziel"];
- if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file.".csv")) {
+ if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) {
$file=false;
echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")<br>";
}
-} else if (is_file($_POST["ziel"].".csv")) {
+} else if (is_file($dir.$_POST["ziel"].".csv")) {
$file=$_POST["ziel"];
} else {
$file=false;
if (!$file) ende ("Kein Datenfile");
$trenner=($_POST["trenner"])?$_POST["trenner"]:",";
+if ($trenner=="other") {
+ $trenner=trim($trennzeichen);
+ if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1));
+}
-if (!file_exists("$file.csv")) ende("$file.csv nicht im Ordner oder leer");
+if (!file_exists($dir.$file.".csv")) ende("$file.csv nicht im Ordner oder leer");
if (!$db->chkcol($file)) ende("Importspalte kann nicht angelegt werden");
$kunde_fld = array_keys($address);
-$f=fopen("$file.csv","r");
+ //Zeichencodierung des Servers
+ $tmpcode = $db->getServerCode();
+ //Leider sind die Benennungen vom Server anders als von mb_detect_encoding
+ if ($tmpcode == "UTF8") {
+ define("ServerCode","UTF-8");
+ } else if ($tmpcode == "LATIN9") {
+ define("ServerCode","ISO-8859-15");
+ } else if ($tmpcode == "LATIN1") {
+ define("ServerCode","ISO-8859-1");
+ } else {
+ define("ServerCode",$tmpcode);
+ }
+ //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos
+ //DB und LxO müssen ja nicht auf der gleichen Maschiene sein.
+ if($tmpcode<>$db->getClientCode()) {
+ $rc = $db->setClientCode($tmpcode);
+ }
+
+ // Zeichenkodierung File
+ if ($_POST["encoding"] == "auto") {
+ define("Auto",true);
+ define("Translate",true);
+ } else {
+ define("Auto",false);
+ if ($_POST["encoding"] == ServerCode) {
+ define("Translate",false);
+ } else {
+ define("Translate",true);
+ define("FileCode",$_POST["encoding"]);
+ }
+ }
+
+$f=fopen($dir.$file.".csv","r");
$zeile=fgets($f,1200);
$infld=split($trenner,strtolower($zeile));
$first=true;
$data=trim($data);
// seit 2.6 ist die DB-Kodierung UTF-8 @holger Ansonsten einmal vorher die DB-Encoding auslesen
// Falls die Daten ISO-kodiert kommen entsprechend wandeln
+ // done!
// UTF-8 MUSS als erstes stehen, da ansonsten die Prüfung bei ISO-8859-1 aufhört ...
+ // die blöde mb_detect... tut leider nicht immer, daher die Möglichkeit der Auswahl
// TODO Umlaute am Anfang wurden bei meinem Test nicht übernommen (Österreich). S.a.:
// http://forum.de.selfhtml.org/archiv/2007/1/t143904/
- $encoding = mb_detect_encoding($data,"UTF-8,ISO-8859-1,ISO-8859-15");
- if ($encoding != "UTF-8"){
- $data=mb_convert_encoding($data, "UTF-8","$encoding");
- }
+ if (Translate) translate($data);
+
//$data=htmlentities($data);
$data=addslashes($data);
if ($in_fld[$i]==$file."number") { // customernumber || vendornumber
} else if ($in_fld[$i]=="taxincluded"){
$data=strtolower(substr($data,0,1));
if ($data!="f" && $data!="t") $data="f";
- } /*else if ($in_fld[$i]=="ustid"){
- Was passiert hier:
- $data=strtr(" ","",$data);
- SUCHE IN ' ' nach dem Vorkommen von '' mit der BOOLEAN-Interpretation von $data
- demnach gibt es immer eine leere Zeichenkette zurück.
- }*/ /*else if ($in_fld[$i]=="matchcode") {
+ } else if ($in_fld[$i]=="ustid"){
+ $data=strtr($data," ","");
+ } /*else if ($in_fld[$i]=="matchcode") {
$matchcode=$data;
$i++;
continue;
<table>
<tr><td></td><td><input type="submit" name="ok" value="Hilfe"></td></tr>
<tr><td>Zieltabelle</td><td><input type="radio" name="ziel" value="customer" checked>customer <input type="radio" name="ziel" value="vendor">vendor</td></tr>
-<tr><td>Trennzeichen</td><td><input type="text" size="2" maxlength="1" name="trenner" value=";"></td></tr>
+<tr><td>Trennzeichen</td><td>
+ <input type="radio" name="trenner" value=";" checked>Semikolon
+ <input type="radio" name="trenner" value=",">Komma
+ <input type="radio" name="trenner" value="#9" checked>Tabulator
+ <input type="radio" name="trenner" value=" ">Leerzeichen
+ <input type="radio" name="trenner" value="other">
+ <input type="text" size="2" name="trennzeichen" value="">
+</td></tr>
<tr><td>Test</td><td><input type="checkbox" name="test" value="1">ja</td></tr>
<tr><td>Daten</td><td><input type="file" name="Datei"></td></tr>
+<tr><td>Verwendete<br />Zeichecodierung</td><td>
+ <select name="encoding">
+ <option value="auto">Automatisch (versuchen)</option>
+ <option value="UTF-8">UTF-8</option>
+ <option value="ISO-8859-1">ISO-8859-1</option>
+ <option value="ISO-8859-15">ISO-8859-15</option>
+ <option value="Windows-1252">Windows-1252</option>
+ <option value="ASCII">ASCII</option>
+ </select>
+</td></tr>
<tr><td></td><td><input type="submit" name="ok" value="Import"></td></tr>
</table>
</form>
$crm=checkCRM();
if ($_POST["ok"]) {
+ $dir = "../users/";
+
$test=$_POST["test"];
if ($crm) {
clearstatcache ();
$trenner=($_POST["trenner"])?$_POST["trenner"]:",";
+ if ($trenner=="other") {
+ $trenner=trim($trennzeichen);
+ if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1));
+ }
+
if (!empty($_FILES["Datei"]["name"])) {
$file=$_POST["ziel"];
- if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file."_contact.csv")) {
+ if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file."_contact.csv")) {
$file=false;
echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")<br>";
}
-} else if (is_file($_POST["ziel"]."_contact.csv")) {
+} else if (is_file($dir.$_POST["ziel"]."_contact.csv")) {
$file=$_POST["ziel"];
} else {
$file=false;
if (!$file) ende (2);
-if (!file_exists($file."_contact.csv")) ende(5);
+if (!file_exists($dir.$file."_contact.csv")) ende(5);
-$prenumber=$_POST["prenumber"];
+//$prenumber=$_POST["prenumber"];
$employee=chkUsr($_SESSION["employee"]);
if (!$employee) ende(4);
if (!$db->chkcol($file)) ende(6);
-$f=fopen($file."_contact.csv","r");
+ //Zeichencodierung des Servers
+ $tmpcode = $db->getServerCode();
+ //Leider sind die Benennungen vom Server anders als von mb_detect_encoding
+ if ($tmpcode == "UTF8") {
+ define("ServerCode","UTF-8");
+ } else if ($tmpcode == "LATIN9") {
+ define("ServerCode","ISO-8859-15");
+ } else if ($tmpcode == "LATIN1") {
+ define("ServerCode","ISO-8859-1");
+ } else {
+ define("ServerCode",$tmpcode);
+ }
+ //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos
+ //DB und LxO müssen ja nicht auf der gleichen Maschiene sein.
+ if($tmpcode<>$db->getClientCode()) {
+ $rc = $db->setClientCode($tmpcode);
+ }
+
+ // Zeichenkodierung File
+ if ($_POST["encoding"] == "auto") {
+ define("Auto",true);
+ define("Translate",true);
+ } else {
+ define("Auto",false);
+ if ($_POST["encoding"] == ServerCode) {
+ define("Translate",false);
+ } else {
+ define("Translate",true);
+ define("FileCode",$_POST["encoding"]);
+ }
+ }
+
+
+$f=fopen($dir.$file."_contact.csv","r");
$zeile=fgetcsv($f,2000,$trenner);
$first=true;
}
$data=addslashes(trim($data));
if ($in_fld[$i]=="firma" && $data) {
+ if (Translate) translate($data);
$data=suchFirma($file,$data);
if ($data) {
$id=$data["cp_cv_id"];
if ($data==false or empty($data) or !$data) {
$vals.="null,";
} else {
- if (in_array($in_fld[$i],array("cp_fax","cp_phone1","cp_phone2"))) {
- $data=$prenumber.$data;
- } else if ($in_fld[$i]=="cp_country" && $data) {
- $data=mkland($data);
- }
- if ($in_fld[$i]=="cp_name") $name=true;
- $vals.="'".$data."',";
- // bei jedem gefuellten Datenfeld erhoehen
- $val_count++;
+
+ if (Translate) translate($data);
+
+ /*if (in_array($in_fld[$i],array("cp_fax","cp_phone1","cp_phone2"))) {
+ $data=$prenumber.$data;
+ } else if ($in_fld[$i]=="cp_country" && $data) {
+ $data=mkland($data);
+ } */
+ if ($in_fld[$i]=="cp_name") $name=true;
+ $vals.="'".$data."',";
+ // bei jedem gefuellten Datenfeld erhoehen
+ $val_count++;
}
}
if (!$name) {
<table>
<tr><td></td><td><input type="submit" name="ok" value="Hilfe"></td></tr>
<tr><td>Zieltabelle</td><td><input type="radio" name="ziel" value="customer" checked>customer <input type="radio" name="ziel" value="vendor">vendor</td></tr>
-<tr><td>Trennzeichen</td><td><input type="text" size="2" maxlength="1" name="trenner" value=";"></td></tr>
-<tr><td>Telefonvorwahl</td><td><input type="text" size="4" maxlength="1" name="prenumber" value=""></td></tr>
+<tr><td>Trennzeichen</td><td>
+ <input type="radio" name="trenner" value=";" checked>Semikolon
+ <input type="radio" name="trenner" value=",">Komma
+ <input type="radio" name="trenner" value="#9" checked>Tabulator
+ <input type="radio" name="trenner" value=" ">Leerzeichen
+ <input type="radio" name="trenner" value="other">
+ <input type="text" size="2" name="trennzeichen" value="">
+</td></tr>
+<!--tr><td>Telefonvorwahl</td><td><input type="text" size="4" maxlength="1" name="prenumber" value=""></td></tr-->
<tr><td>Test</td><td><input type="checkbox" name="test" value="1">ja</td></tr>
<tr><td>Daten</td><td><input type="file" name="Datei"></td></tr>
+<tr><td>Verwendete<br />Zeichecodierung</td><td>
+ <select name="encoding">
+ <option value="auto">Automatisch (versuchen)</option>
+ <option value="UTF-8">UTF-8</option>
+ <option value="ISO-8859-1">ISO-8859-1</option>
+ <option value="ISO-8859-15">ISO-8859-15</option>
+ <option value="Windows-1252">Windows-1252</option>
+ <option value="ASCII">ASCII</option>
+ </select>
+</td></tr>
<tr><td></td><td><input type="submit" name="ok" value="Import"></td></tr>
</table>
</form>
} else { return true; };
}
+ /**
+ * Zeichekodirung der DB ermitteln
+ *
+ * @return String
+ */
+ function getServerCode() {
+ $sql="SHOW server_encoding";
+ $rs = $this->getAll($sql);
+ return $rs[0]["server_encoding"];
+ }
+ function getClientCode() {
+ $sql="SHOW client_encoding";
+ $rs = $this->getAll($sql);
+ return $rs[0]["client_encoding"];
+ }
+ function setClientCode($encoding) {
+ $sql="SET client_encoding = '$encoding'";
+ $rc = $this->query($sql);
+ return $rc;
+ }
}
?>
"partsgroup2" => "3.Warengruppenbezeichnung",
"partsgroup3" => "4.Warengruppenbezeichnung",
"partsgroup4" => "5.Warengruppenbezeichnung",
+ "shop" => "Shopexport vorghesehen",
);
$contactscrm = array(
$db->query($sql,"authuser_3");
return $auth;
}
+/**
+ * Zeichencode übersetzen
+ *
+ * @param String $txt
+ */
+function translate(&$txt) {
+ if (Auto) {
+ $encoding = mb_detect_encoding($data,"UTF-8,ISO-8859-1,ISO-8859-15,Windows-1252,ASCII");
+ $txt = iconv("$encoding",ServerCode."//TRANSLIT",$txt);
+ //$txt = mb_convert_encoding($txt, ServerCode,"$encoding");
+ } else {
+ $txt = iconv(FileCode,ServerCode."//TRANSLIT",$txt);
+ //$txt = mb_convert_encoding($txt, ServerCode,FileCode);
+ }
+}
?>
/* get DB instance */
$db=$_SESSION["db"]; //new myDB($login);
-
/* just display page or do real import? */
if ($_POST["ok"]) {
require ("parts_import.php");
+ //Zeichencodierung des Servers
+ $tmpcode = $db->getServerCode();
+ //Leider sind die Benennungen vom Server anders als von mb_detect_encoding
+ if ($tmpcode == "UTF8") {
+ define("ServerCode","UTF-8");
+ } else if ($tmpcode == "LATIN9") {
+ define("ServerCode","ISO-8859-15");
+ } else if ($tmpcode == "LATIN1") {
+ define("ServerCode","ISO-8859-1");
+ } else {
+ define("ServerCode",$tmpcode);
+ }
+ //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos
+ //DB und LxO müssen ja nicht auf der gleichen Maschiene sein.
+ if($tmpcode<>$db->getClientCode()) {
+ $rc = $db->setClientCode($tmpcode);
+ }
+
+ // Zeichenkodierung File
+ if ($_POST["encoding"] == "auto") {
+ define("Auto",true);
+ define("Translate",true);
+ } else {
+ define("Auto",false);
+ if ($_POST["encoding"] == ServerCode) {
+ define("Translate",false);
+ } else {
+ define("Translate",true);
+ define("FileCode",$_POST["encoding"]);
+ }
+ }
/* display help */
if ($_POST["ok"]=="Hilfe") {
$precision = $_POST["precision"];
$quotation = $_POST["quotation"];
$quottype = $_POST["quottype"];
- $file = "../users/parts.csv";
- $table = "parts";
+ $file = "parts";
/* no data? */
if (empty($_FILES["Datei"]["name"]))
ende ("Kein Datenfile angegeben");
/* copy file */
- if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file)) {
+ $dir="../users/";
+ if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) {
ende ("Upload von Datei fehlerhaft.".$_FILES["Datei"]["error"]);
}
/* check if file is really there */
- if (!file_exists("$file") or filesize("$file")==0)
- ende("Datenfile ($file) nicht im Ordner gefunden oder leer");
+ if (!file_exists($dir.$file.'.csv') or filesize($dir.$file.'.csv')==0)
+ ende("Datenfile ($file.csv) nicht im Ordner gefunden oder leer");
/* Zu diesem Zeitpunkt wurde der Artikel Importiert */
- if (!$db->chkcol($table))
+ if (!$db->chkcol($file))
ende("Importspalte konnte nicht angelegt werden");
/* first check all elements */
$_test["lagerplatz"]=$_POST["lagerplatz"];
/* just print data or insert it, if test is false */
- import_parts($db, $file, $trenner, $trennzeichen, $parts, FALSE, !$test, $_POST["show"],$_POST);
+ import_parts($db, $dir.$file, $trenner, $trennzeichen, $parts, FALSE, !$test, $_POST["show"],$_POST);
} else {
$bugrus=getAllBG($db);
<tr><td>Test</td><td><input type="checkbox" name="test" value="1">ja</td></tr>
<tr><td>Textupdate</td><td><input type="checkbox" name="TextUpd" value="1">ja</td></tr>
<tr><td>Warengruppen<br>verbinder</td><td><input type="text" name="wgtrenner" value="!" size="3"></td></tr>
-<tr><td>Shopartikel,<br>falls Feld leer</td><td><input type="radio" name="shop" value="t">ja <input type="radio" name="shop" value="f" checked>nein</td></tr>
+<tr><td>Shopartikel<br />falls nicht übergeben</td><td><input type="radio" name="shop" value="t">ja <input type="radio" name="shop" value="f" checked>nein</td></tr>
<tr><td>Art</td><td><input type="Radio" name="ware" value="W" checked>Ware
<input type="Radio" name="ware" value="D">Dienstleistung
<input type="Radio" name="ware" value="G">gemischt (Spalte 'art' vorhanden)</td></tr>
<input type="radio" name="bugrufix" value="2">für Artikel ohne passende Bugru
</td></tr>
<tr><td>Daten</td><td><input type="file" name="Datei"></td></tr>
+<tr><td>Verwendete<br />Zeichecodierung</td><td>
+ <select name="encoding">
+ <option value="auto">Automatisch (versuchen)</option>
+ <option value="UTF-8">UTF-8</option>
+ <option value="ISO-8859-1">ISO-8859-1</option>
+ <option value="ISO-8859-15">ISO-8859-15</option>
+ <option value="Windows-1252">Windows-1252</option>
+ <option value="ASCII">ASCII</option>
+ </select>
+</td></tr>
<tr><td></td><td><input type="submit" name="ok" value="Import"></td></tr>
</table>
</form>
-<?
+<?php
//Henry Margies <h.margies@maxina.de>
//Holger Lindemann <hli@lx-system.de>
$parts_fld = array_keys($fields);
/* open csv file */
- $f=fopen("$file","r");
+ $f=fopen($file.'.csv',"r");
/*
* read first line with table descriptions
show("weight"); show("image"); show("partsgroup_id");
show("bg"); show("income_accno"); show("expense_accno");
show("inventory_accno"); show("microfiche");show("drawing");show("rop");
- show("assembly");show("makemodel");show("shop"); show("");
+ show("assembly");show("makemodel"); show("shop"); show("");
show("</tr>\n",false);
}
while ( ($zeile=fgetcsv($f,120000,$trenner)) != FALSE) {
$m++; /* increase line */
$unit=false;
-
unset($pgroup);
+ unset($partsgroup_id);
unset($notes);
unset($rop);
unset($weight);
/* Langtext zusammenbauen */
if ($zeile[$fldpos["notes"]]) {
- $notes = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes"]]);
- $notes = addslashes($notes);
+ //Kundenspezifisch:
+ //$notes = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes"]]);
+ $notes = addslashes($zeile[$fldpos["notes"]]);
+ if (Translate) translate($notes);
}
if ($zeile[$fldpos["notes1"]]) {
- $notes1 = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes1"]]);
+ //Kundenspezifisch:
+ //$notes1 = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes1"]]);
+ $notes1 = addslashes($zeile[$fldpos["notes1"]]);
+echo "!".$notes1."!<br>";
+ if (Translate) translate($notes1);
+echo "!".$notes1."!<br>";
if ($notes) {
- $notes = "\n".addslashes($notes1);
+ $notes .= "\n".$notes1;
} else {
- $notes = addslashes($notes1);
+ $notes = $notes1;
}
}
if ($fldpos["partsgroup4"]>0 and $zeile[$fldpos["partsgroup4"]]) $pgroup[]=$zeile[$fldpos["partsgroup4"]];
if (count($pgroup)>0) {
$pgname = implode($wgtrenner,$pgroup);
+ if (Translate) translate($pgname);
$partsgroup_id = getPartsgroupId($db, $pgname, $insert);
}
/* sind Hersteller und Modelnummer hinterlegt
wenn ja, erfolgt er insert später */
if (!empty($zeile[$fldpos["makemodel"]]) and !$artikel) {
- $hersteller=suchFirma("vendor",$zeile[$fldpos["makemodel"]]);
+ $mm = $zeile[$fldpos["makemodel"]];
+ if (Translate) translate($mm);
+ $hersteller=suchFirma("vendor",$mm);
$hersteller=$hersteller["cp_cv_id"];
if (!empty($zeile[$fldpos["model"]])) {
- $model = $zeile[$fldpos["model"]];
+ $mo = $zeile[$fldpos["model"]];
+ if (Translate) translate($mo);
+ $model = $mo;
$makemodel = 't';
} else {
unset($hersteller);
$description = preg_replace('/""[^ ]/','"',$zeile[$fldpos["description"]]);
$description = addslashes($description);
+ if (Translate) translate($description);
// rop und weight müssen null oder Zahl sein
if ($zeile[$fldpos["rop"]]) $rop = 1 * str_replace(",", ".",$zeile[$fldpos["rop"]]);
// Shop-Artikel
if ($zeile[$fldpos["shop"]]) {
- $shop = ($zeile[$fldpos["shop"]] > 0)?'t':'f';
+ $shop = (strtolower($zeile[$fldpos["shop"]]=='t'))?'t':'f';
} else {
$shop = $maske["shop"];
}
// Artikel updaten
+
if (getPartsid($db,trim($zeile[$fldpos["partnumber"]]))) {
/* es gibt die Artikelnummer */
if ($Update) {
$crm=checkCRM();
if ($_POST["ok"] == "Import") {
+ $dir = "../users/";
+
$test=$_POST["test"];
$shipto_fld = array_keys($shiptos);
clearstatcache ();
$trenner=($_POST["trenner"])?$_POST["trenner"]:",";
+ if ($trenner=="other") {
+ $trenner=trim($trennzeichen);
+ if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1));
+ };
if (!empty($_FILES["Datei"]["name"])) {
$file=$_POST["ziel"];
- if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file."_shipto.csv")) {
+ if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file."_shipto.csv")) {
$file=false;
echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")<br>";
}
- } else if (is_file($_POST["ziel"]."_shipto.csv")) {
+ } else if (is_file($dir.$_POST["ziel"]."_shipto.csv")) {
$file=$_POST["ziel"];
} else {
$file=false;
}
if (!$file) ende ("Kein Datenfile");
- if (!file_exists($file."_shipto.csv")) ende($file."_shipto.csv nicht im Ordner gefunden oder leer");
+ if (!file_exists($dir.$file."_shipto.csv")) ende($file."_shipto.csv nicht im Ordner gefunden oder leer");
$employee=chkUsr($_SESSION["employee"]);
if (!$employee) ende("Benutzer unbekannt");
if (!$db->chkcol($file)) ende("Importspalte konnte nicht angelegt werden");
+ //Zeichencodierung des Servers
+ $tmpcode = $db->getServerCode();
+ //Leider sind die Benennungen vom Server anders als von mb_detect_encoding
+ if ($tmpcode == "UTF8") {
+ define("ServerCode","UTF-8");
+ } else if ($tmpcode == "LATIN9") {
+ define("ServerCode","ISO-8859-15");
+ } else if ($tmpcode == "LATIN1") {
+ define("ServerCode","ISO-8859-1");
+ } else {
+ define("ServerCode",$tmpcode);
+ }
+ //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos
+ //DB und LxO müssen ja nicht auf der gleichen Maschiene sein.
+ if($tmpcode<>$db->getClientCode()) {
+ $rc = $db->setClientCode($tmpcode);
+ }
+
+ // Zeichenkodierung File
+ if ($_POST["encoding"] == "auto") {
+ define("Auto",true);
+ define("Translate",true);
+ } else {
+ define("Auto",false);
+ if ($_POST["encoding"] == ServerCode) {
+ define("Translate",false);
+ } else {
+ define("Translate",true);
+ define("FileCode",$_POST["encoding"]);
+ }
+ }
- $f=fopen($file."_shipto.csv","r");
+ $f=fopen($dir.$file."_shipto.csv","r");
$zeile=fgetcsv($f,1000,$trenner);
$first=true;
}
$j=0;
$n=0;
- $prenumber=$_POST["prenumber"];
+ //$prenumber=$_POST["prenumber"];
$zeile=fgetcsv($f,1000,$trenner);
while (!feof($f)){
}
if ($in_fld[$i]=="firma") {
if ($id) continue;
+ if (Translate) translate($data);
$data=suchFirma($file,$data);
if ($data) {
$id=$data["cp_cv_id"];
if ($data==false or empty($data) or !$data) {
$vals.="null,";
} else {
- if (in_array($in_fld[$i],array("shiptofax","shiptophone"))) {
+ /*if (in_array($in_fld[$i],array("shiptofax","shiptophone"))) {
$data=$prenumber.$data;
- }
+ } */
+ if (Translate) translate($data);
$vals.="'".$data."',";
// bei jedem gefuellten Datenfeld erhoehen
$val_count++;
<table>
<tr><td></td><td><input type="submit" name="ok" value="Hilfe"></td></tr>
<tr><td>Zieltabelle</td><td><input type="radio" name="ziel" value="customer" checked>customer <input type="radio" name="ziel" value="vendor">vendor</td></tr>
-<tr><td>Trennzeichen</td><td><input type="text" size="2" maxlength="1" name="trenner" value=";"></td></tr>
-<tr><td>Telefonvorwahl</td><td><input type="text" size="4" maxlength="10" name="prenumber" value=""></td></tr>
+<tr><td>Trennzeichen</td><td>
+ <input type="radio" name="trenner" value=";" checked>Semikolon
+ <input type="radio" name="trenner" value=",">Komma
+ <input type="radio" name="trenner" value="#9" checked>Tabulator
+ <input type="radio" name="trenner" value=" ">Leerzeichen
+ <input type="radio" name="trenner" value="other">
+ <input type="text" size="2" name="trennzeichen" value="">
+</td></tr>
+<!--tr><td>Telefonvorwahl</td><td><input type="text" size="4" maxlength="10" name="prenumber" value=""></td></tr-->
<tr><td>Test</td><td><input type="checkbox" name="test" value="1">ja</td></tr>
<tr><td>Daten</td><td><input type="file" name="Datei"></td></tr>
+<tr><td>Verwendete<br />Zeichecodierung</td><td>
+ <select name="encoding">
+ <option value="auto">Automatisch (versuchen)</option>
+ <option value="UTF-8">UTF-8</option>
+ <option value="ISO-8859-1">ISO-8859-1</option>
+ <option value="ISO-8859-15">ISO-8859-15</option>
+ <option value="Windows-1252">Windows-1252</option>
+ <option value="ASCII">ASCII</option>
+ </select>
+</td></tr>
<tr><td></td><td><input type="submit" name="ok" value="Import"></td></tr>
</table>
</form>
<th class="listheading">Rechnungsdatum</th>
<th class="listheading">Rg. Fälligkeit</th>
<th class="listheading">Betrag</th>
+ <th class="listheading">Offener Betrag</th>
<th class="listheading">Zahlbar bis</th>
<th class="listheading">Kumulierte Gebühren</th>
<th class="listheading">Zinsen</th>
<td><input type="checkbox" name="active_[% loop.count %]" value="1" [% IF row.active %]checked[% END %]></td>
<td><input type="checkbox" name="email_[% loop.count %]" value="1" [% IF row.email %]checked[% END %]></td>
<td><input type="hidden" name="customername_[% loop.count %]" size="6" value="[% HTML.escape(row.customername) %]">[% HTML.escape(row.customername) %]</td>
- <td><input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">[% HTML.escape(row.invnumber) %]</td>
+ <td>
+ <input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">
+ <a href="is.pl?action=edit&type=invoice&id=[% row.id | url %]">[% HTML.escape(row.invnumber) %]</a>
+ </td>
<td><input type="hidden" name="invdate_[% loop.count %]" size="6" value="[% HTML.escape(row.transdate) %]">[% HTML.escape(row.transdate) %]</td>
<td><input type="hidden" name="inv_duedate_[% loop.count %]" size="6" value="[% HTML.escape(row.duedate) %]">[% HTML.escape(row.duedate) %]</td>
<td align="right"><input type="hidden" name="amount_[% loop.count %]" size="6" value="[% HTML.escape(row.amount) %]">[% HTML.escape(row.amount) %]</td>
+ <td align="right"><input type="hidden" name="open_amount_[% loop.count %]" size="6" value="[% HTML.escape(row.open_amount) %]">[% HTML.escape(row.open_amount) %]</td>
<td>[% HTML.escape(row.next_duedate) %]</td>
<td align="right"><input type="hidden" name="fee_[% loop.count %]" size="6" value="[% HTML.escape(row.fee) %]">[% HTML.escape(row.fee) %]</td>
<td align="right"><input type="hidden" name="interest_[% loop.count %]" size="6" value="[% HTML.escape(row.interest) %]">[% HTML.escape(row.interest) %]</td>
<th class="listheading"><translate>Invdate</translate></th>
<th class="listheading"><translate>Inv. Duedate</translate></th>
<th class="listheading"><translate>Amount</translate></th>
+ <th class="listheading"><translate>Open Amount</translate></th>
<th class="listheading"><translate>Dunning Duedate</translate></th>
<th class="listheading"><translate>Total Fees</translate></th>
<th class="listheading"><translate>Interest</translate></th>
<td><input type="checkbox" name="active_[% loop.count %]" value="1" [% IF row.active %]checked[% END %]></td>
<td><input type="checkbox" name="email_[% loop.count %]" value="1" [% IF row.email %]checked[% END %]></td>
<td><input type="hidden" name="customername_[% loop.count %]" size="6" value="[% HTML.escape(row.customername) %]">[% HTML.escape(row.customername) %]</td>
- <td><input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">[% HTML.escape(row.invnumber) %]</td>
+ <td>
+ <input type="hidden" name="invnumber_[% loop.count %]" size="6" value="[% HTML.escape(row.invnumber) %]">
+ <a href="is.pl?action=edit&type=invoice&id=[% row.id | url %]">[% HTML.escape(row.invnumber) %]</a>
+ </td>
<td><input type="hidden" name="invdate_[% loop.count %]" size="6" value="[% HTML.escape(row.transdate) %]">[% HTML.escape(row.transdate) %]</td>
<td><input type="hidden" name="inv_duedate_[% loop.count %]" size="6" value="[% HTML.escape(row.duedate) %]">[% HTML.escape(row.duedate) %]</td>
<td align="right"><input type="hidden" name="amount_[% loop.count %]" size="6" value="[% HTML.escape(row.amount) %]">[% HTML.escape(row.amount) %]</td>
+ <td align="right"><input type="hidden" name="open_amount_[% loop.count %]" size="6" value="[% HTML.escape(row.open_amount) %]">[% HTML.escape(row.open_amount) %]</td>
<td>[% HTML.escape(row.next_duedate) %]</td>
<td align="right"><input type="hidden" name="fee_[% loop.count %]" size="6" value="[% HTML.escape(row.fee) %]">[% HTML.escape(row.fee) %]</td>
<td align="right"><input type="hidden" name="interest_[% loop.count %]" size="6" value="[% HTML.escape(row.interest) %]">[% HTML.escape(row.interest) %]</td>
<tr>
<td>Optionaler Kommentar:</td>
- <td><input name="comment" size="20"></td>
+ <td><input name="comment" size="60"></td>
</tr>
</table>
</p>
<tr>
<td><translate>Optional comment</translate>:</td>
- <td><input name="comment" size="20"></td>
+ <td><input name="comment" size="60"></td>
</tr>
</table>
</p>
<tr>
<th align="right" nowrap>Optionaler Kommentar</th>
- <td><input name="comment" size="30" value="[% HTML.escape(comment) %]"></td>
+ <td><input name="comment" size="60" value="[% HTML.escape(comment) %]"></td>
</tr>
</table>
<tr>
<th align="right" nowrap><translate>Optional comment</translate></th>
- <td><input name="comment" size="30" value="[% HTML.escape(comment) %]"></td>
+ <td><input name="comment" size="60" value="[% HTML.escape(comment) %]"></td>
</tr>
</table>