<?php

/*
if ($modeErrCode == "DE") :
   $errCode[100] = "";
   $errCode[101] = getLngt("Die Authentifizierungsdaten sind nicht in Ordnung.");
   $errCode[102] = getLngt("Die notwendige ID des Auftraggebers ist nicht gesetzt.");
   $errCode[103] = getLngt("Der Auftraggeber wurde nicht im Datenbestand gefunden.");
   $errCode[104] = getLngt("Der Auftraggeber hat den Status eines Metakunden für einen anderen Auftraggeber.");
   $errCode[105] = getLngt("Der Auftraggeber hat mindestens einen Auftrag und kann daher nicht entfernt werden.");
   $errCode[106] = getLngt("Eine ID darf bei einer Neuanlage nicht existieren.");
   $errCode[107] = getLngt("Eine Neuanlage erfolgte nicht.");
   $errCode[108] = getLngt("Der Benutzername existiert schon. Eine Neuanlage fand nicht statt."");
   $errCode[109] = getLngt("Die Validierung des Passwortes schlug fehl. Eine Neuanlage fand nicht statt.");
   $errCode[110] = getLngt("");
   $errCode[111] = getLngt("");
   $errCode[112] = getLngt("");
   $errCode[113] = getLngt("");
   $errCode[114] = getLngt("");
   $errCode[115] = getLngt("");
   $errCode[116] = getLngt("");
   $errCode[117] = getLngt("");
   $errCode[118] = getLngt("");
else :
   $errCode[100] = getLngt("");
   $errCode[101] = getLngt("Authentication Data not correct.");
   $errCode[102] = getLngt("No customer defined for delete operation.");
   $errCode[103] = getLngt("Customer not found in database.");
   $errCode[104] = getLngt("Customer is meta customer of another customer. Delete operation not executed.");
   $errCode[105] = getLngt("At least one job does exist for customer. Delete operation not executed.");
   $errCode[106] = getLngt("Customer ID may not exist for insert operation.");
   $errCode[107] = getLngt("Insert operation failed.");
   $errCode[108] = getLngt("User account does exist. Insert operation not executed.");
   $errCode[109] = getLngt("Password validation failed. Insert operation not executed.");
   $errCode[110] = getLngt("");
   $errCode[111] = getLngt("");
   $errCode[112] = getLngt("");
   $errCode[113] = getLngt("");
   $errCode[114] = getLngt("");
   $errCode[115] = getLngt("");
   $errCode[116] = getLngt("");
   $errCode[117] = getLngt("");
   $errCode[118] = getLngt("");
endif;


// FELDER UND IHRE BEDEUTUNG
// Pefices: [cs = customer] [cmp = company] [csc = costcenter] [ad = address]
//          => cs has one cmp
//          => cs has one or more costcenters, but if no costcenter defined in request then the "root costcenter" would be created by tag data of user segment like user address
// Usage:   [mdtr = mandatory] [opt = optional] [doop = depends on operation] [fut = future]
<xml>
  <customer>                                                  // Auftraggeber
    <auth>                                                    // Abschnitt für Authentifikation des Requests
      <session_id>[mdtr]</session_id>                         // Zusätzliche Session-ID, die mit dem Kunden ausgehandelt wurde   [mandatory]
      <passphrase>[mdtr]</passphrase>                         // Per Algorithmus generierte Phrase, die per one-way-encryption ermittelt wird sowohl für den Versand als auch zum Abgleich bei Eingang
    </auth>                                                   
    <operation>[opt]</operation>                              // Operation on customer dataset (INS, INSERT, UPD, UPDATE, DEL, DELETE) [default = empty = INS(ERT)]
    <debug_on>[opt]</debug_on>                                // Activates debug output ("ON" or "YES")

    <cs_id>[doop]</cs_id>                                     // ID of the customer, needed for DEL or UPD
    <cs_eid>[opt]</cs_eid>                                    // EID of the customer, needed for INS (use explicitly if does not exist) or UPD (overwrite if does not exist)
    <cs_sid>[doop]</cs_sid>                                   // Commission no of the customer of remote system
    <hq_id>[fut]</hq_id>                                      // Headquarters {1, 2, ....} or {HB, HH, ....}. If numeric value then checked by database field "hq_id", otherwise by "hq_mnemonic"
    <cs_prov>[fut]</cs_prov>                                  // Provision [%]
    <cs_discount>[fut]</cs_discount>                          // Discount  [%]
    <cs_invmode>[opt]</cs_invmode>                            // Invoice mode
    <cs_cr_fav_only>[fut]</cs_cr_fav_only>                    // Favoured couriers only
                                                              
 	  <cs_jbstatusmail>[opt]</cs_jbstatusmail>                  // Mail per order being finished
 	  <cs_jbstatusmail2>[opt]</cs_jbstatusmail2>                // Mail per order being picked up
 	  <cs_jbstatusmail3>[opt]</cs_jbstatusmail3>                // Mail per order being created
 	  <cs_jbstatusmail_pdf>[opt]</cs_jbstatusmail_pdf>          // Generate PDF attachement for mail "finished order"
 	 	                                                          
 	 	<cs_filter>[opt]</cs_filter>                              // Classic filter regarding every order
 	 	<cs_group>[opt]</cs_group>                                // Customer can belong to a special group
 	 	<cs_tracking>[opt]</cs_tracking>                          // System is allowed to track the customer
                                                              
    <company>                                                 // COMPANY [1:1 CUSTOMER]
      <cmp_type>[fut]</cmp_type>                              // Type of the customer (default = 0 <=> active customer)
                                                              
      <cmp_comp>[doop]</cmp_comp>                             // Name field 1 [mandatory for insert]
      <cmp_comp2>[opt]</cmp_comp2>                            // Name field 2
      <cmp_comp3>[opt]</cmp_comp3>                            // Name field 3
      <cmp_comp4>[opt]</cmp_comp4>                            // Name field 4
                                                              
      <ad_street>[mdtr]</ad_street>                           // Street
      <ad_hsno>[mdtr]</ad_hsno>                               // House number
      <ad_zipcode>[mdtr]</ad_zipcode>                         // Zipcode
      <ad_city>[mdtr]</ad_city>                               // City
      <ad_country>[mdtr]</ad_country>                         // Country
                                                              
      <cmp_iln>[opt]</cmp_iln>                                // ILN (= GLN = Global Location Number)
      <cmp_tax_idno>[opt]</cmp_tax_idno>                      // Tax no
      <cmp_stax_idno>[mdtr]</cmp_stax_idno>                   // Sales tax no (Umsatzsteueridentifikationsnummer)
                                                              
      <cmp_bank>[opt]</cmp_bank>                              // Bank name
      <cmp_bankno>[opt]</cmp_bankno>                          // Bank no (BLZ)
      <cmp_bankacc>[opt]</cmp_bankacc>                        // bank account (in connection with the bank no)
      <cmp_iban>[mdtr]</cmp_iban>                             // IBAN  (either IBAN is mandatory or fields <cmp_bankno> and <cmp_bankacc> have to be set)
      <cmp_swift>[opt]</cmp_swift>                            // SWIFT
                                                              
      <cmp_logo>[opt]</cmp_logo>                              // Filename of the logo (The generated cs_id or cs_eid will be the prefix of the filename)
      <cmp_logo_width>[opt]</cmp_logo_width>                  // Width of the logo
      <cmp_logo_height>[opt]</cmp_logo_height>                // Height of the logo
                                                              
      <cmp_remark>[opt]</cmp_remark>                          // Public remark for the customer
      <cmp_remark2>[opt]</cmp_remark2>                        // Private (internal) remark for the customer
      <cmp_match>[opt]</cmp_match>                            // Freetext (200 chars) with space separated buzzword for search requests in customer master data
      <cmp_match2>[opt]</cmp_match2>                          // Freetext (50 chars) for internal categorization
                                                              
      <cmp_newsletter>[fut]</cmp_newsletter>                  // Flag for getting newsletter (default = 0)
      <cmp_pda_usage>[fut]</cmp_pda_usage>                    // Flag for using pda with app (default = 0)
    </company>                                                 

    <user>                                                    // USER [1:1 CUSTOMER] ("Root"-)User des Kunden bzw. Auftraggebers, der sich (in votian und/oder im (Börsen-)Portal) einloggen kann
      <usr_name>[opt]</usr_name>                              // Nachname
      <usr_firstname>[opt]</usr_firstname>                    // Vorname
      <usr_birthdate>[opt]</usr_birthdate>                    // Geburtsdatum ["Y-m-d" <=> "JJJJ-MM-TT"]

      <usr_email>[opt]</usr_email>                            // Email-Adresse (primäre Mailadresse)
      <usr_inv_email>[fut]</usr_inv_email>                    // Rechnungs-Email-Adresse [NICHT IN VERWENDUNG BEI CUSTOMER]
      <usr_phone>[opt]</usr_phone>                            // Telefon
      <usr_phone2>[opt]</usr_phone2>                          // Mobil
      <usr_fax>[opt]</usr_fax>                                // Fax
      
      <usr_account>[opt]</usr_account>                        // Account
      <usr_password>[opt]</usr_password>                      // Passwort (mind. 8-stellig, mind. eine Zahl, mind. ein Buchstabe)
    </user>

    <costcenters>                                             // COSTCENTERS
      <costcenter>
        <csc_operation>[opt]</csc_operation>                  // Ignored if tag <operation> != "UPD", otherwise <csc_operation> IN (INS, INSERT, UPD, UPDATE, DEL, DELETE) [default = empty = INS(ERT)]
        <csc_id>[opt]</csc_id>                                // Ignored if tag <operation> != "UPD" or <csc_operation> == "INS", otherwise delete or update costcenter

        <csc_id_parent>[mdtr]</csc_id_parent>                 // Parent ID for hierarchy (default = empty for root costcenter)
        <csc_name>[opt]</csc_name>                            // Name of the costcenter. If empty for root costcenter then company name will be used
    
        <costcenteraddresses>
         <costcenteraddress>
           <cscad_operation>[opt]</cscad_operation>           // Ignored if tag <operation> != "UPD" and <csc_operation> != "UPD" and <csc_id> == "" and <adt_id> == "", otherwise INS, INSERT, UPD, UPDATE, DEL, DELETE [default = empty = INS(ERT)]
           <adt_id>[opt]</adt_id>                             // Ignored if tag <operation> != "UPD" and <csc_operation> != "UPD" or <cscad_operation> == "INS", otherwise delete or update address for special address type

           <cscad_comp>[doop]</cscad_comp>                    // Name field 1 [mandatory for insert]
           <cscad_comp2>[opt]</cscad_comp2>                   // Name field 2
           <cscad_comp3>[opt]</cscad_comp3>                   // Name field 3
           <cscad_comp4>[opt]</cscad_comp4>                   // Name field 4

           <ad_street>[opt]</ad_street>                       // Street (<adt_id> has to be set for update)
           <ad_hsno>[opt]</ad_hsno>                           // House number (<adt_id> has to be set for update)
           <ad_floor>[opt]</ad_floor>                         // Floor (für address) (<adt_id> has to be set for update)
           <ad_zipcode>[opt]</ad_zipcode>                     // Zipcode (<adt_id> has to be set for update)
           <ad_city>[opt]</ad_city>                           // City (<adt_id> has to be set for update)
           <ad_country>[opt]</ad_country>                     // Country (<adt_id> has to be set for update)

           <cscad_person>[opt]</cscad_person>                 // Person for costcenter address
           <cscad_phone>[opt]</cscad_phone>                   // Phone for costcenter address
           <cscad_email>[opt]</cscad_email>                   // Email for costcenter address
           <cscad_remark>[opt]</cscad_remark>                 // Remark for costcenter address
         </costcenteraddress>

         <costcenteraddress>
           ....
         </costcenteraddress>         
         ....
        </costcenteraddresses>
      </costcenter>

      <costcenter>                                            // Next costcenter ....
        ....
      </costcenter>
      ....
    </costcenters>

    <skills>                                                   // Manuelle EVENTS
      <val>[fut]</val>
      <val>[fut]</val>
      <val>[fut]</val>
      ...
    </skills>

  </customer>
</xml>
*/



$req = "
<xml>
  <customer>
    <auth>
      <session_id>XXXX</session_id>
      <passphrase>YYYY</passphrase>
    </auth>
    <operation>GET</operation>
    <debug_on>YES</debug_on>

    <cs_id>839459</cs_id>
    <cs_sid>SID</cs_sid>
    <hq_id>2</hq_id>
    <cs_prov>5.55</cs_prov>
    <cs_discount>1.11</cs_discount>
    <cs_invmode>1</cs_invmode>
    <cs_cr_fav_only>0</cs_cr_fav_only>

 	  <cs_jbstatusmail>0</cs_jbstatusmail>
 	  <cs_jbstatusmail2>0</cs_jbstatusmail2>
 	  <cs_jbstatusmail3>0</cs_jbstatusmail3>
 	  <cs_jbstatusmail_pdf>0</cs_jbstatusmail_pdf>

 	 	<cs_filter></cs_filter>
 	 	<cs_group></cs_group>
 	 	<cs_tracking>0</cs_tracking>

    <company>
      <cmp_type>0</cmp_type>

      <cmp_comp>Comp_1</cmp_comp>
      <cmp_comp2>Comp_2</cmp_comp2>
      <cmp_comp3>Comp_3</cmp_comp3>
      <cmp_comp4>Comp_4</cmp_comp4>

      <ad_street>Am Ochsenzoll</ad_street>
      <ad_hsno>147</ad_hsno>
      <ad_zipcode>22851</ad_zipcode>
      <ad_city>Norderstedt</ad_city>
      <ad_country>DE</ad_country>

      <cmp_iln>ILN1234567890</cmp_iln>
      <cmp_tax_idno>ST1234567</cmp_tax_idno>
      <cmp_stax_idno>UST1234567</cmp_stax_idno>

      <cmp_bank>HASPA</cmp_bank>
      <cmp_bankno>200 505 50</cmp_bankno>
      <cmp_bankacc>1234 12 34 56</cmp_bankacc>
      <cmp_iban></cmp_iban>
      <cmp_swift>1234567890</cmp_swift>

      <cmp_logo>ins_logo.jpg</cmp_logo>
      <cmp_logo_width>300</cmp_logo_width>
      <cmp_logo_height>200</cmp_logo_height>

      <cmp_remark>BEMERKUNG_1</cmp_remark>
      <cmp_remark2>BEMERKUNG_1</cmp_remark2>
      <cmp_match>BUZZWORDS HERE</cmp_match>
      <cmp_match2>TEST</cmp_match2>

      <cmp_newsletter>0</cmp_newsletter>
      <cmp_pda_usage>1</cmp_pda_usage>
    </company>

    <user>
      <usr_name>Name</usr_name>
      <usr_firstname>Vorname</usr_firstname>
      <usr_birthdate>1972-02-01</usr_birthdate>

      <usr_email>test@test.de</usr_email>
      <usr_inv_email>inv.test@test.de</usr_inv_email>
      <usr_phone>040 4567890</usr_phone>
      <usr_phone2>0172 1234567</usr_phone2>
      <usr_fax></usr_fax>

      <usr_account>test</usr_account>
      <usr_password>plain</usr_password>
    </user>

    <costcenters>
      <costcenter>
        <csc_operation>[opt]</csc_operation>
        <csc_id>[opt]</csc_id>

        <csc_id_parent>[mdtr]</csc_id_parent>
        <csc_name>[opt]</csc_name>

        <costcenteraddresses>
         <costcenteraddress>
           <cscad_operation>[opt]</cscad_operation>
           <adt_id>[opt]</adt_id>

           <cscad_comp>[doop]</cscad_comp>
           <cscad_comp2>[opt]</cscad_comp2>
           <cscad_comp3>[opt]</cscad_comp3>
           <cscad_comp4>[opt]</cscad_comp4>

           <ad_street>[opt]</ad_street>
           <ad_hsno>[opt]</ad_hsno>
           <ad_floor>[opt]</ad_floor>
           <ad_zipcode>[opt]</ad_zipcode>
           <ad_city>[opt]</ad_city>
           <ad_country>[opt]</ad_country>

           <cscad_person>[opt]</cscad_person>
           <cscad_phone>[opt]</cscad_phone>
           <cscad_email>[opt]</cscad_email>
           <cscad_remark>[opt]</cscad_remark>
         </costcenteraddress>

         <costcenteraddress>

         </costcenteraddress>         

        </costcenteraddresses>
      </costcenter>

    </costcenters>

  </customer>
</xml>";

$reqEncoded = urlencode($req);
?>


<html>

<head>

</head>

<body>

  <form name="test_request" action="https://mps1.assecutor.de/test_sb/service/customer_request.php" method="post">
  
    <input type="hidden" name="customerReq" value="<?php echo $reqEncoded ?>">

    <input type="submit" value="Senden POST">


  </form>

</body>

</html>
