Changed OrderFiles; name is now dropdown of predefined types; Certain

types send emails
This commit is contained in:
Frank Schubert
2022-06-21 18:58:02 +02:00
parent 43185a914f
commit 26b0a67d09
17 changed files with 263 additions and 194 deletions

View File

@@ -1,3 +1,4 @@
<?php //var_dump($address->parent->types);exit;?>
<?php include(realpath(dirname(__FILE__)."/../../$mfLayoutPackage")."/header.php"); ?>
<!-- start page title -->
@@ -170,6 +171,7 @@
<option value="customer" <?=(array_key_exists("customer", $address->types)) ? "selected='selected'" : ""?>><?=__("customer")?></option>
<option value="supplier" <?=(array_key_exists("supplier", $address->types)) ? "selected='selected'" : ""?>><?=__("supplier")?></option>
<option value="contact" <?=(array_key_exists("contact", $address->types)) ? "selected='selected'" : ""?>><?=__("contact")?></option>
<option value="techcontact" <?=(array_key_exists("techcontact", $address->types)) ? "selected='selected'" : ""?>><?=__("techcontact")?></option>
</select>
</div>

View File

@@ -389,11 +389,11 @@
<div class="input-group mb-3"> \
<div class="input-group-prepend"> \
<select class="form-control" name="links[' + linknum + '][type]"> \
<option value="link">Verknüpfung</option> \
<option value="upgrade">Upgrade</option> \
<option value="downgrade">Downgrade</option> \
<option value="relocation">Umzug</option> \
<option value="productchange">Produktwechsel</option> \
<option value="link">Verknüpfung mit</option> \
<option value="upgrade">Upgrade von</option> \
<option value="downgrade">Downgrade von</option> \
<option value="relocation">Umzug von</option> \
<option value="productchange">Produktwechsel von</option> \
</select> \
</div> \
<select class="form-control basicAutoComplete link-autocomplete" autocomplete="off" name="links[' + linknum + '][contract_id]" id="links_' + linknum + '_contract_id" data-linknum="' + linknum + '" data-url="<?=self::getUrl('Contract','api')?>?do=findContract&autocomplete=1" placeholder="Contact ID oder Suche nach Produkt, Matchcode, Kunde" data-noresults-text="Keine Suchergebnisse"> \

View File

@@ -0,0 +1,31 @@
<?php
$contacts = $order->owner->getChildrenByType("techcontact");
if(!is_array($contacts) || !count($contacts)) {
$contacts = [$order->owner];
}
$tos = [];
foreach($contacts as $contact) {
if($contact->email) {
$tos[] = $contact->email;
}
}
$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName());
$subject = "Ihr Übergabeprotokoll / Technikerstammblatt";
$this->setReturnValue([
'subject' => $subject,
'to' => $tos,
'from_email' => "support@xinon.at",
'from_email_name' => "XINON Kundenservice"
]);
?>
Sehr geehrte Damen und Herren,
im Anhang erhalten Sie das technische Übergabeprotokoll zum Anschluss des Kunden <?=$customer_string?> zur weiteren Verwendung.
Ihr XINON Team

View File

@@ -0,0 +1,19 @@
<?php
$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName())." [".$order->owner->customer_number."]";
$subject = "Neue PBX-Bestellung eingelangt ($customer_string)";
$this->setReturnValue([
'subject' => $subject,
'to' => "einkauf@xinon.at",
'from_email' => TT_OUTGOING_EMAIL,
'from_email_name' => TT_OUTGOING_EMAIL_NAME
]);
?>
<?=str_replace(["\r","\n"], " ", $file->creator->name)?> hat die Bestellung einer Telefonanlage für den Kunden <?=$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe.
TheTool OrderROBOT (-;
https://<?=$_SERVER['HTTP_HOST']?><?=self::getUrl("Order","Index",['id' => $order->id])?>

View File

@@ -0,0 +1,19 @@
<?php
$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName())." [".$order->owner->customer_number."]";
$subject = "Neue Projektbestellung eingelangt ($customer_string)";
$this->setReturnValue([
'subject' => $subject,
'to' => "einkauf@xinon.at",
'from_email' => TT_OUTGOING_EMAIL,
'from_email_name' => TT_OUTGOING_EMAIL_NAME
]);
?>
<?=str_replace(["\r","\n"], " ", $file->creator->name)?> hat eine Projektbestellung für den Kunden <?=$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um technische Prüfung und Materialabklärung bzw. Herstellungsfreigabe.
TheTool OrderROBOT (-;
https://<?=$_SERVER['HTTP_HOST']?><?=self::getUrl("Order","Index",['id' => $order->id])?>

View File

@@ -0,0 +1,19 @@
<?php
$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName())." [".$order->owner->customer_number."]";
$subject = "Neue Einzugsermächtigung eingelangt ($customer_string)";
$this->setReturnValue([
'subject' => $subject,
'to' => "billing@xinon.at",
'from_email' => TT_OUTGOING_EMAIL,
'from_email_name' => TT_OUTGOING_EMAIL_NAME
]);
?>
<?=str_replace(["\r","\n"], " ", $file->creator->name)?> hat soeben eine Einzugsermächtigung für den Kunden <?=$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um Prüfung und Aktualisierung der Bankdaten des Kunden.
TheTool OrderROBOT (-;
https://<?=$_SERVER['HTTP_HOST']?><?=self::getUrl("Order","Index",['id' => $order->id])?>

View File

@@ -0,0 +1,19 @@
<?php
$customer_string = str_replace(["\r","\n"], " ", $order->owner->getCompanyOrName())." [".$order->owner->customer_number."]";
$subject = "Neue Rufnummerportierung ($customer_string)";
$this->setReturnValue([
'subject' => $subject,
'to' => "portierung@xinon.at",
'from_email' => TT_OUTGOING_EMAIL,
'from_email_name' => TT_OUTGOING_EMAIL_NAME
]);
?>
<?=str_replace(["\r","\n"], " ", $file->creator->name)?> hat soeben eine Rufnummerportierung für den Kunden <?=$customer_string?> angelegt - siehe Dokument im Anhang. Bitte um Prüfung des Herstellungstermins und Einreichung.
TheTool OrderROBOT (-;
https://<?=$_SERVER['HTTP_HOST']?><?=self::getUrl("Order","Index",['id' => $order->id])?>

View File

@@ -681,9 +681,15 @@
<h4>Neues Dokument</h4>
<div class="form-group row">
<label class="col-lg-2 col-form-label" for="file_name">Name</label>
<label class="col-lg-2 col-form-label" for="file_name">Dateityp</label>
<div class="col-lg-10">
<input type="text" class="form-control" name="file_name" id="file_name" />
<?php if(defined("TT_ORDER_FILE_TYPES") && is_array(TT_ORDER_FILE_TYPES)): ?>
<select name="file_name" class="form-control">
<?php foreach(TT_ORDER_FILE_TYPES as $key => $type): ?>
<option value="<?=$key?>"><?=$type?></option>
<?php endforeach; ?>
</select>
<?php endif; ?>
</div>
</div>

View File

@@ -1090,6 +1090,8 @@
<?php if($addJournal): ?>
$('#new-journal-<?=$highlight?>').toggle();
$('#new-journal-<?=$highlight?> textarea[name=text]').focus();
<?php elseif($showDetail): ?>
$('.order-tab a[href="#order-detail-<?=$highlight?>-details"]').tab('show');
<?php endif; ?>
<?php endif; ?>

View File

@@ -219,179 +219,6 @@ foreach($networks as $networkname => $buildings) {
}
$i++;
//
// /*
// * Linework data
// */
// $sheet->setCellValue($col[$i].$line, ($term->getWorkflowvalue('pop_id')) ? (new Pop($term->getWorkflowvalue('pop_id')))->name : "");
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
// $i++;
// $sheet->setCellValue($col[$i].$line, ($term->getWorkflowvalue('ist_pop_id')) ? (new Pop($term->getWorkflowvalue('ist_pop_id')))->name : "");
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_LEFT);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_schrank'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_baugruppe'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_modul'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_ports'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_abschlusstyp'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_kabel_steps'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_bb_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_typ'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ist_kundenkabel_fasern'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('backbone_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_setup_date'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('bep_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_cable_injected'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_network'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('spliced_customer'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_deployed'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('ont_sn'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
// $sheet->setCellValue($col[$i].$line, $term->getWorkflowvalue('customer_passive_finished'))->getStyle($col[$i].$line)->getFont()->setName("monospace")->setSize(10);
// $sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setVertical(Alignment::VERTICAL_CENTER);
// $sheet->getStyle($col[$i].$line)->getAlignment()->setHorizontal(Alignment::HORIZONTAL_CENTER);
// $i++;
//
$sheet->setCellValue($col[$i].$line, $building->workflow_comment);
$sheet->getStyle($col[$i].$line)->getFill()->setFillType(\PhpOffice\PhpSpreadsheet\Style\Fill::FILL_SOLID)->getStartColor()->setARGB($lightgreen);

View File

@@ -3,6 +3,7 @@
class Address extends mfBaseModel {
protected $forcestr = ['street','company','zip','phone','fax','mobile','note'];
private $parent;
private $childaddresses;
private $types;
private $attributes;
private $permissions;
@@ -90,20 +91,29 @@ class Address extends mfBaseModel {
return false;
}
if(!$this->parent_id) {
$this->types = AddresstypeModel::search(['address_id' => $this->id], true);
} else {
// get types from parent
$parent = $this->getProperty("parent");
$types = $parent->getProperty("types");
$this->types = $types;
}
$all_types = AddresstypeModel::search(['address_id' => $this->id], true);
if($this->parent_id) {
// get types from parent
$parent_types = $this->getProperty("parent")->getProperty("types");
if($parent_types) {
$all_types = array_merge($all_types, $parent_types);
}
}
$this->types = $all_types;
return true;
}
public function getChildrenByType($type) {
if(!$this->id || !$type) {
return [];
}
$children = AddressModel::search(['addresstype' => [$type], "parent_id" => $this->id]);
return $children;
}
public function generateServicePin() {
if(!$this->customer_number) {
return false;
@@ -152,6 +162,11 @@ class Address extends mfBaseModel {
return $this->parent;
}
if($name == "childaddresses") {
$this->childaddresses = AddressModel::search(['parent' => $this->id]);
return $this->childaddresses;
}
$classname = ucfirst($name);
$idfield = $name."_id";
$this->$name = new $classname($this->$idfield);

View File

@@ -59,7 +59,6 @@ class Emailnotification {
public function setTo($email) {
$this->email_to = $email;
$this->to_name = $name;
}
public function send() {

View File

@@ -163,6 +163,65 @@ class Order extends mfBaseModel {
}
}
public function sendFileuploadEmail(OrderFile $file) {
$filetype = $file->name;
$this->log->debug("in sendFileuploadEmail(); filetype: $filetype");
if(!defined("TT_ORDER_FILE_TYPES") || ! is_array(TT_ORDER_FILE_TYPES )) {
return false;
}
if(!array_key_exists($filetype, TT_ORDER_FILE_TYPES)) {
return false;
}
$tpl = new Layout();
$tpl->setTemplate("Emailtemplates/order/fileupload/".$filetype);
if(!$tpl->templatePathExists()) {
$this->log->debug(__METHOD__.": tpl does not exist, not sending email.");
return true;
}
$tpl->set("order", $this);
$tpl->set("file", $file);
$body = $tpl->render();
$values = $tpl->getReturnedValue();
$subject = $values['subject'];
$from = $values['from_email'];
$from_name = $values['from_email_name'];
$to = $values['to'];
if(!$subject || !$from || !$from_name || !$to) {
$this->log->warn("Order Fileupload Email not sent. (subject: '$subject', from: '$from', from_email: '$from_email', to: '$to')");
} else {
$filepath = MFUPLOAD_FILE_SAVE_PATH;
if($file->file->subfolder) {
$filepath .= "/".$file->file->subfolder;
}
$filepath .= "/".$file->file->store_filename;
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mimetype = $finfo->file($filepath);
if(!$mimetype) {
$this->log->warning("File (orderfile->id: ".$file->id.") not a valid mimetype: $mimetype");
}
$email = new Emailnotification();
$email->setSubject($subject);
$email->setBody($body);
$email->setFrom($from, $from_name);
$email->setTo($to);
$email->setHeader("X-Xinon-Oid", $this->id);
$email->setHeader("X-Xinon-OFid", $file->id);
$email->addAttachment($filepath, null, $file->file->filename, $mimetype);
$email->send();
$this->log->info(__CLASS__."::save(): Sending Order Fileupload Email to '$to'");
return true;
}
return false;
}
public function getProperty($name) {
if($this->$name == null) {
@@ -194,6 +253,7 @@ class Order extends mfBaseModel {
if($name == "products") {
$this->products = OrderProductModel::search(["order_id" => $this->id]);
//var_dump($this->products);exit;
return $this->products;
}

View File

@@ -24,8 +24,43 @@ class OrderController extends mfBaseController {
$this->layout()->set("highlight", $this->request->id);
$this->layout()->set("mynetworks", NetworkModel::getAll());
if(!is_array($order->terminations) || !count($order->terminations)) {
$special_orders = [];
$voice_orders = [];
$has_bras = false;
$has_voice = false;
if(!is_array($order->products) || !count($order->products)) {
$this->layout()->set("lonelyOrders", [$order]);
$this->layout()->set("showLonelies", true);
} else {
foreach($order->products as $lop) {
//var_dump($lop);exit;
if(array_key_exists("bras_type", $lop->product->attributes) && $lop->product->attributes['bras_type']) {
$has_bras = true;
}
if(array_key_exists("voip_chan", $lop->product->attributes) && $lop->product->attributes['voip_chan']) {
$has_voice = true;
}
}
if(!$has_bras && !$has_voice) {
$this->layout()->set("special_orders", [$order]);
$this->layout()->set("showSpecial", true);
} elseif($has_voice && !$has_bras) {
$this->layout()->set("voice_orders", [$order]);
$this->layout()->set("showVoice", true);
} else {
$this->layout()->set("lonelyOrders", [$order]);
$this->layout()->set("showLonelies", true);
}
}
}
if($this->request->addJournal) {
$this->layout()->set("addJournal", true);
} else {
$this->layout()->set("showDetail", true);
}
return true;
@@ -761,7 +796,7 @@ class OrderController extends mfBaseController {
if(!$orderproduct_id) {
$product = OrderProductModel::create($product_data);
} else {
$product = new OrderProduct();
$product = new OrderProduct($orderproduct_id);
$product->update($product_data);
}
@@ -793,7 +828,6 @@ class OrderController extends mfBaseController {
// generate and send Service PIN
// only if owner_id wasn't changed
$this->log->debug("test");
if(!$owner->spin && (!property_exists($order->_old_data, "owner_id") || $order->owner_id == $order->_old_data->owner_id)) {
$this->log->debug(__CLASS__."::save(): creating new SPIN for ".$owner->getCompanyOrName()." (".$owner->id.")");
$spin = $owner->generateServicePin();
@@ -899,7 +933,11 @@ class OrderController extends mfBaseController {
$file->delete();
unlink($upload->getSavepath()."/".$upload->getFilename());
$this->layout()->setFlash("Dateiupload fehlgeschlagen", "warn");
} else {
// send email based on file type
$order->sendFileuploadEmail($orderfile);
}
}
}

View File

@@ -100,12 +100,16 @@ class OrderProductModel {
$db = FronkDB::singleton();
$where = self::getSqlFilter($filter);
$res = $db->select("OrderProduct", "*", "$where ORDER BY order_id, pos, product_id, description");
$sql = "SELECT * FROM OrderProduct WHERE $where ORDER BY order_id, pos, product_id, description";
//mfLoghandler::singleton()->debug($sql);
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new OrderProduct($data);
}
}
return $items;
}

View File

@@ -18,6 +18,7 @@ $l['customers'] = "Kunden";
$l['supplier'] = "Lieferant";
$l['suppliers'] = "Lieferanten";
$l['contact'] = "Kontakt";
$l['techcontact'] = "Technischer Kontakt";
$l['billing'] = "Rechnungsadresse";
$l['business'] = "Business";
$l['residential'] = "Residential";

View File

@@ -53,10 +53,18 @@ class mfLayout {
return $this->returnValue;
}
private function getTplPath() {
return VIEWDIR . "/" . $this->package . "/" . $this->template . ".php";
}
public function templatePathExists() {
return file_exists($this->getTplPath());
}
public function render() {
$this->defaultLayoutvariables();
$tpl_path = VIEWDIR . "/" . $this->package . "/" . $this->template . ".php";
$tpl_path = $this->getTplPath();
if(!is_file($tpl_path)) {
$tpl_path = VIEWDIR . "/default/" . $this->template . ".php";
}