Blame | Letzte Änderung | Log anzeigen | RSS feed
<?php/*** @package php_share* @author Lars Tiefland <tiefland@weban.de>* @copyright 2010 Webagentur Niewerth* @license propietary http://www.weban.de* @version $Rev: 439 $* @filesource**//**** @package php_share* @author Lars Tiefland <tiefland@weban.de>* @copyright 2010 Webagentur Niewerth*/// SVN: $Id: creditcard.interface.php 439 2011-03-10 07:59:29Z tiefland $require_once "lieferantenbase.class.php";require_once "File.php";require_once "module/shop/html_mails/mail_func.php";class Frankana extends LieferantenBase{private $filename;private $k_nr;public function export( $k_nr ){$this->k_nr = $k_nr;$site = __SITE__;$text = "";if ( serverCheck() === "local." ){$basis = "../../" . __SITE__ . "/images/dokumente/";}else{$basis = "../httpdocs/images/dokumente/";}$basis_2 = "bestellexport/" . date( "Y" ) . "/" . date( "m" );if ( !file_exists( $basis . $basis_2 ) ){mkdir( $basis . $basis_2, 0777, true );}if ( $GLOBALS["INI"]["dbConnect"]["order_db"] ){$db = $GLOBALS["INI"]["dbConnect"]["order_db"] . ".";}$table = $db . "dokumente";if ( $this->bestellungen ){switch ( $this->bestellungen[0]["lager_id"] ){case 1:$to = "bestellung@frankana.de";break;case 2:$to = "ost@frankana.de";break;case 3:$to = "info@freiko.de";break;}//$to = "tiefland@weban.de";$subject = "Bestellung von Artikeln über das Lager " . $this->bestellungen[0]["lager_name"];foreach ( $this->bestellungen as $b_id => $bestellung ){if ( $b_id == 0 ){$text = $bestellung["text"];$zeile = "";$bestellung_id = $bestellung["id"];$order_id = $bestellung["order_id"];$p_zeile = "Bestelldatum: " . date( "d.m.Y H:i" ) ."\nBestellnummer: " . $order_id . "\nKundennummer: " .$this->k_nr . "\n\n";}if ( $bestellung["text"] != $text ){$body = "Kommentar:\n\n";$body .= $text . "\n\n";$e_body = $body;$body .= $p_zeile;$this->attach = $basis . create_pdf( $bestellung["order_id"],"", "", $body, "LB", generate_LN( $bestellung["id"],"LB" ), __SITE__, "", $GLOBALS["INI"]["dbConnect"]["order_db"], true );$f_name = "/frankana_export_" . date( "Y-m-d_H-i-s" ) ."_" . gen_password( 20 ) . ".txt";$this->save_file( $basis . $basis_2 . $f_name, $zeile );$e_body .= file_get_contents( $this->filename );$this->send_order_mail( $to, $text, $e_body, $bestellung_id,$subject );$text = $bestellung["text"];$zeile = "";$bestellung_id = $bestellung["id"];$order_id = $bestellung["order_id"];$p_zeile = "Bestelldatum: " . date( "d.m.Y H:i" ) ."\nBestellnummer: " . $order_id . "\nKundennummer: " .$this->k_nr . "\n\n";}$zeile .= "0;0;" . $text . ";" . $bestellung["menge"] .";" . $this->k_nr . ";" . $bestellung["lieferanten_artnr"] .";\n";$p_zeile .= "Menge: " . $bestellung["menge"] . "\n" ."Artikelnummer: " . $bestellung["lieferanten_artnr"] ."\n";if ( $b_id == count( $this->bestellungen ) - 1 ){$body = "Kommentar:\n\n";$body .= $text . "\n\n";$e_body = $body;$body .= $p_zeile;$this->attach = $basis . create_pdf( $bestellung["order_id"],"", "", $body, "LB", generate_LN( $bestellung["id"],"LB" ), __SITE__, "", $GLOBALS["INI"]["dbConnect"]["order_db"], true );$f_name = "/frankana_export_" . date( "Y-m-d_H-i-s" ) ."_" . gen_password( 20 ) . ".txt";$this->save_file( $basis . $basis_2 . $f_name, $zeile );$e_body .= file_get_contents( $this->filename );$this->send_order_mail( $to, $text, $e_body, $bestellung_id,$subject );}save_document( $basis_2 . $f_name, $bestellung["id"], $table,"artikel_to_lieferantenbestellung" );updateBetellung( $bestellung["id"] );}}}function send_order_mail( $to, $text, $body, $bestellung_id, $subject ){$extra["shops_ID"] = $GLOBALS["INI"]["shops_ID"];$extra["site"] = __SITE__;$extra["headers"] = array( "From" => "info@pieper-freizeit.de" );$extra["files"] = array( $this->attach );send_email( $to, $subject, $body, $extra );}function save_file( $f_name, $zeile ){$this->filename = $f_name;$file = new File( $this->filename, "w" );$file->write( $this->filename, "SD-061057;\nFLEVER: SD.02.01\nFLDNAME: KZ_DS_BIM\nFLDTYP: NUM()\nFLDCMT: DB_TYPE :FT_SHORT\nFLDNAME: bel_nr\nFLDTYP: NUM()\nFLDCMT: DB_TYPE :FT_LONG\nFLDNAME: Bel_refnr\nFLDTYP: NUM()\nFLDCMT: DB_TYPE :FT_STRING\nFLDNAME: pos_bestellme\nFLDTYP: NUM()\nFLDCMT: DB_TYPE :FT_DOUBLE\nFLDNAME: kdn_kontonr\nFLDTYP: NUM()\nFLDCMT: DB_TYPE :FT_LONG\nFLDNAME: art_nr\nFLDTYP: STR(WIN)\nFLDCMT: DB_TYPE :FT_STRING\n" );$file->write( $this->filename, "DATEN:\n" );$file->write( $this->filename, $zeile );$file->close( $this->filename, "w" );}}?>