Files
votianng/html/include/copy_job.inc.php
2026-03-29 10:34:57 +02:00

78 lines
2.9 KiB
PHP

<?php
/*=======================================================================
*
* copy_job.inc.php
*
* Autor: Carsten Annacker
*
=======================================================================*/
include_once("../include/dbglobal.inc.php");
// echo "|$dbhost, $dbname, $dblogin, $dbpassword|<br>\n";
$db_geo = null; // für "../locating/xServer.inc.php", wird seit der BWV eingebunden
function copy_job($jb_id, $jb_storno = 0, $jb_status = 2, $_copy_jobs_flag_ori_val = false, $_get_tr_commission_no = false)
{
global $db, $jobList, $_copy_jobs_flag, $_copy_jobs_flag_ori /* wichtig für getTourData()*/, $hq_id, $phpVersion;
global $dblogin, $dbpassword, $db_geo; // für "../locating/xServer.inc.php", wird seit der BWV eingebunden
$tmpJobList = array();
$tmpJobListJoin = array();
for ($i = 0; $i < 6; $i++):
$tmpJobList[$i] = array();
for ($j = 0; $j < 11; $j++)
$tmpJobList[$i][$j] = "";
$tmpJobListJoin[$i] = implode("²", $tmpJobList[$i]);
endfor;
$jobList = implode("¹", $tmpJobListJoin);
$check_jb_permanent_flag = true;
$_copy_jobs_flag_ori = $_copy_jobs_flag_ori_val;
$_copy_jobs_flag = true;
$csc_id_orderer = $db->getOne("SELECT csc_id FROM job WHERE jb_id = " . $jb_id); // '0' = Zentralenmodus
if ($csc_id_orderer == 0)
include("../jobs/get_saved_tour.php");
else
include("../jobs2/get_saved_tour.php");
//echo "$jb_id, $csc_id, $vht_id, $jb_weight, $jb_ordertime, $jb_reserv, 3, $vht_id, " .
// "$cr_id_order, $jb_waitstorno, $jb_waittime, $jb_fixprice, $csc_id_payer </ br>\n";
$jobList = str_replace('\\"', "\"", str_replace('\\\'', '\'', $jobList));
//echo "'$jobList'\n<br>";
$cr_id_order = ""; // Kurier löschen
$jobListOri = $jobList;
// jetzt wird das Senden eines jobs "simuliert",
// woraufhin der Auftrag neu gespeichert wird
$toursubmit = "Senden"; // Senden simulieren
$getPriceOnly = 0; // Keine Nur-Preisabfrage
$jb_id_copy = $jb_id; // jetzt neuer Auftrag
$jb_id = ""; // jetzt neuer Auftrag
// Als emp_id (eingebender Mitarbeiter) wird 0 eingetragen,
// da niemand angemeldet ist
//echo "|$dbhost, $dbname, $dblogin, $dbpassword|<br>\n";
if ($csc_id_orderer == 0)
include("../jobs/job_options.php");
else
include("../jobs2/job_options.php");
// updateStmt("job", "jb_id", $jb_id_copy, array("jb_id_copy", $jb_id));
updateStmt("job", "jb_id", $jb_id, array("cr_id_permanent", $cr_id_permanent));
return $jb_id;
}
// Funktion wird in get_saved_tour.php benötigt
function setJobList($tourNo, $fldNo, $newVal)
{
global $jobList;
//echo "$tourNo, $fldNo, $newVal <br>\n";
$tmpJobListJoin = explode("¹", $jobList);
$tmpJobList = array();
if (isset($tmpJobListJoin[$tourNo - 1]))
$tmpJobList = explode("²", $tmpJobListJoin[$tourNo - 1]);
$tmpJobList[$fldNo] = $newVal;
$tmpJobListJoin[$tourNo - 1] = implode("²", $tmpJobList);
$jobList = implode("¹", $tmpJobListJoin);
}
?>