Dokumentenakt

- BugFix wenn Gemeinde nicht gesetzt
- Wenn Mimetype nicht unterstützt wird, wird dies im Akt ausgegeben
- Fehlermeldungen verbessert
This commit is contained in:
kindlm
2016-11-30 17:15:42 +01:00
parent 401aab6baa
commit a2ffa3267d
2 changed files with 89 additions and 53 deletions
+76 -52
View File
@@ -135,6 +135,7 @@ foreach($prestudent_ids as $pid)
$preDocs = array(); $preDocs = array();
$result = $db->db_query($query); $result = $db->db_query($query);
while($row = $db->db_fetch_object($result)) while($row = $db->db_fetch_object($result))
{ {
$docErrors = array(); $docErrors = array();
@@ -153,21 +154,21 @@ foreach($prestudent_ids as $pid)
if ($dms->mimetype != $row->mimetype) if ($dms->mimetype != $row->mimetype)
{ {
$docErrors[] = "Mimetype von Akte und DMS der DMS-ID ".$row->dms_id." stimmen nicht ueberein. Bitte kontaktieren Sie einen Administrator"; $docErrors[] = "Mimetype von Akte-ID ".$row->akte_id." \"".$row->mimetype."\" und DMS-ID ".$row->dms_id." \"".$dms->mimetype."\" stimmen nicht ueberein. Bitte kontaktieren Sie einen Administrator";
} }
$filename = DMS_PATH . $dms->filename; $filename = DMS_PATH . $dms->filename;
if(!file_exists($filename)) if(!file_exists($filename))
{ {
$docErrors[] = "'" . $filename . "': Datei nicht gefunden"; $docErrors[] = "".$row->dokument_kurzbz." '".$filename."': Datei nicht gefunden (DMS-ID ".$row->dms_id."; Akte-ID ".$row->akte_id.")";
} }
} }
// this should never happen // this should never happen
if($filename == "") if($filename == "" && $row->nachgereicht == 'f')
{ {
$docErrors[] = "'" . $row->akte_id . "': Diese Akte hat keinen Inhalt und keine dms_id"; $docErrors[] = "".$row->dokument_kurzbz." '".$row->akte_id."': Diese Akte hat keinen Inhalt und keine dms_id";
} }
if(empty($docErrors)) if(empty($docErrors))
@@ -186,7 +187,7 @@ foreach($prestudent_ids as $pid)
|| $row->mimetype == "image/jpeg" || $row->mimetype == "image/jpeg"
|| $row->mimetype == "image/jpg" || $row->mimetype == "image/jpg"
|| $row->mimetype == "image/pjpeg" || $row->mimetype == "image/pjpeg"
) )
{ {
$fullFilename = $tmpDir . "/".uniqid() . ".pdf"; $fullFilename = $tmpDir . "/".uniqid() . ".pdf";
if(!$pdf->jpegToPdf($filename, $fullFilename)) if(!$pdf->jpegToPdf($filename, $fullFilename))
@@ -267,11 +268,26 @@ foreach($prestudent_ids as $pid)
else else
$addString = "(DB)"; $addString = "(DB)";
if($convertSuccess) if($convertSuccess)
$docErrors[] = '"' . $row->titel . '":' . $addString . ' Dokument nicht gefunden'; $docErrors[] = '"$row->dokument_kurzbz: Akte-ID '.$row->akte_id.' '.$row->titel.'":' . $addString . ' Dokument nicht gefunden';
} }
} }
else else
$docErrors[] ="'$row->titel' hat einen nicht unterstützten mimetype: $row->mimetype"; {
$docErrors[] ="$row->dokument_kurzbz: Akte-ID $row->akte_id $row->titel hat einen nicht unterstützten mimetype: $row->mimetype";
$dokumente[]['dokument'] = array(
"name" => $row->bezeichnung,
"filename" => $row->aktbezeichnung,
"nachgereicht" => ($row->nachgereicht == 't'?'true':'false'),
"anmerkung" => $row->anmerkung,
"errormsg" => 'Dieses Dateiformat kann nicht in diesem PDF ausgegeben werden.');
}
}
if(!empty($docErrors))
{
if(!isset($errors[$pid]))
$errors[$pid] = array();
$errors[$pid] = array_merge($errors[$pid], $docErrors);
} }
} }
@@ -283,6 +299,8 @@ foreach($prestudent_ids as $pid)
$strasse = ''; $strasse = '';
$plz = ''; $plz = '';
$bundesland = ''; $bundesland = '';
$heimatBundesland = '';
$zustellBundesland = '';
$nation = new nation($prestudent->geburtsnation); $nation = new nation($prestudent->geburtsnation);
$geburtsnation = $nation->kurztext; $geburtsnation = $nation->kurztext;
@@ -292,7 +310,7 @@ foreach($prestudent_ids as $pid)
$zgvnation = $nation->kurztext; $zgvnation = $nation->kurztext;
$svnr = ($prestudent->svnr == '')?($prestudent->ersatzkennzeichen != ''?'Ersatzkennzeichen: '.$prestudent->ersatzkennzeichen:''):$prestudent->svnr; $svnr = ($prestudent->svnr == '')?($prestudent->ersatzkennzeichen != ''?'Ersatzkennzeichen: '.$prestudent->ersatzkennzeichen:''):$prestudent->svnr;
foreach($adresse->result as $row_adresse) foreach($adresse->result as $row_adresse)
{ {
if($row_adresse->heimatadresse) if($row_adresse->heimatadresse)
@@ -301,24 +319,31 @@ foreach($prestudent_ids as $pid)
$heimatPlz = $row_adresse->plz; $heimatPlz = $row_adresse->plz;
$heimatOrt = $row_adresse->ort; $heimatOrt = $row_adresse->ort;
// Bundesland ermitteln // Bundesland ermitteln
$qry= ' if ($row_adresse->gemeinde != '')
SELECT {
tbl_bundesland.bezeichnung AS bundesland $qry= '
FROM SELECT
bis.tbl_gemeinde tbl_bundesland.bezeichnung AS bundesland
JOIN FROM
bis.tbl_bundesland ON (tbl_gemeinde.bulacode = tbl_bundesland.bundesland_code) bis.tbl_gemeinde
WHERE JOIN
tbl_gemeinde.name='.$db->db_add_param($row_adresse->gemeinde).' bis.tbl_bundesland ON (tbl_gemeinde.bulacode = tbl_bundesland.bundesland_code)
LIMIT 1; WHERE
'; tbl_gemeinde.name='.$db->db_add_param($row_adresse->gemeinde).'
if(!$res = $db->db_query($qry)) LIMIT 1;
die("Es ist ein Fehler bei der Ermittlung des Bundeslandes aufgetreten"); ';
if ($res = $db->db_query($qry))
if(!$row = $db->db_fetch_object($res)) {
die("Es ist ein Fehler bei der Ermittlung des Bundeslandes aufgetreten"); if ($row = $db->db_fetch_object($res))
$heimatBundesland = $row->bundesland;
$heimatBundesland = $row->bundesland; else
$errors[$pid][] = "Es ist ein Fehler bei der Ermittlung des Bundeslandes der Heimatadresse aufgetreten";
}
else
$errors[$pid][] = "Es ist ein Fehler bei der Ermittlung des Bundeslandes der Heimatadresse aufgetreten";
}
else
$errors[$pid][] = "Heimat-Bundesland kann nicht ermittelt werden, da keine Gemeinde eingetragen ist";
} }
if($row_adresse->zustelladresse) if($row_adresse->zustelladresse)
{ {
@@ -326,24 +351,31 @@ foreach($prestudent_ids as $pid)
$zustellPlz = $row_adresse->plz; $zustellPlz = $row_adresse->plz;
$zustellOrt = $row_adresse->ort; $zustellOrt = $row_adresse->ort;
// Bundesland ermitteln // Bundesland ermitteln
$qry= ' if ($row_adresse->gemeinde != '')
SELECT {
tbl_bundesland.bezeichnung AS bundesland $qry= '
FROM SELECT
bis.tbl_gemeinde tbl_bundesland.bezeichnung AS bundesland
JOIN FROM
bis.tbl_bundesland ON (tbl_gemeinde.bulacode = tbl_bundesland.bundesland_code) bis.tbl_gemeinde
WHERE JOIN
tbl_gemeinde.name='.$db->db_add_param($row_adresse->gemeinde).' bis.tbl_bundesland ON (tbl_gemeinde.bulacode = tbl_bundesland.bundesland_code)
LIMIT 1; WHERE
'; tbl_gemeinde.name='.$db->db_add_param($row_adresse->gemeinde).'
if(!$res = $db->db_query($qry)) LIMIT 1;
die("Es ist ein Fehler bei der Ermittlung des Bundeslandes aufgetreten"); ';
if ($res = $db->db_query($qry))
if(!$row = $db->db_fetch_object($res)) {
die("Es ist ein Fehler bei der Ermittlung des Bundeslandes aufgetreten"); if ($row = $db->db_fetch_object($res))
$zustellBundesland = $row->bundesland;
$zustellBundesland = $row->bundesland; else
$errors[$pid][] = "Es ist ein Fehler bei der Ermittlung des Bundeslandes der Heimatadresse aufgetreten";
}
else
$errors[$pid][] = "Es ist ein Fehler bei der Ermittlung des Bundeslandes der Heimatadresse aufgetreten";
}
else
$errors[$pid][] = "Zustelladresse-Bundesland kann nicht ermittelt werden, da keine Gemeinde eingetragen ist";
//break; //break;
} }
} }
@@ -391,7 +423,6 @@ foreach($prestudent_ids as $pid)
$notiz_text_array[]['aufnahme_notiz'] = $value; $notiz_text_array[]['aufnahme_notiz'] = $value;
} }
$filename = $tmpDir . "/".uniqid();
$doc = new dokument_export($vorlage_kurzbz, $oe_kurzbz); $doc = new dokument_export($vorlage_kurzbz, $oe_kurzbz);
$doc->addDataArray(array( $doc->addDataArray(array(
'studiengang_kuerzel' => strtoupper($studiengang->typ.$studiengang->kurzbz), 'studiengang_kuerzel' => strtoupper($studiengang->typ.$studiengang->kurzbz),
@@ -434,15 +465,8 @@ foreach($prestudent_ids as $pid)
$allDocs = array_merge($allDocs, $preDocs); $allDocs = array_merge($allDocs, $preDocs);
unset($doc); unset($doc);
} }
if(!empty($docErrors) || !empty($preErrors))
{
$errors[$pid] = $preErrors;
$errors[$pid] = array_merge($errors[$pid], $docErrors);
}
} }
/* /*
* generate the merged PDF * generate the merged PDF
*/ */
+13 -1
View File
@@ -393,6 +393,12 @@
<style:paragraph-properties fo:text-align="center" style:justify-single-word="false" fo:background-color="#dddddd"/> <style:paragraph-properties fo:text-align="center" style:justify-single-word="false" fo:background-color="#dddddd"/>
<style:text-properties style:font-name="Arial" fo:font-size="10pt" fo:font-weight="bold" officeooo:rsid="001d0b51" officeooo:paragraph-rsid="001d0b51" style:font-size-asian="10pt" style:font-weight-asian="bold" style:font-size-complex="10pt" style:font-weight-complex="bold"/> <style:text-properties style:font-name="Arial" fo:font-size="10pt" fo:font-weight="bold" officeooo:rsid="001d0b51" officeooo:paragraph-rsid="001d0b51" style:font-size-asian="10pt" style:font-weight-asian="bold" style:font-size-complex="10pt" style:font-weight-complex="bold"/>
</style:style> </style:style>
<style:style style:name="P17" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties style:font-name="Arial" fo:font-size="8pt" officeooo:rsid="0020372f" officeooo:paragraph-rsid="0020372f" style:font-size-asian="8pt" style:font-size-complex="8pt"/>
</style:style>
<style:style style:name="P18" style:family="paragraph" style:parent-style-name="Table_20_Contents">
<style:text-properties fo:color="#ff0000" style:font-name="Arial" fo:font-size="8pt" officeooo:rsid="0020372f" officeooo:paragraph-rsid="0020372f" style:font-size-asian="8pt" style:font-size-complex="8pt"/>
</style:style>
<style:style style:name="T1" style:family="text"> <style:style style:name="T1" style:family="text">
<style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/> <style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/>
</style:style> </style:style>
@@ -902,10 +908,16 @@
<xsl:choose> <xsl:choose>
<xsl:when test="nachgereicht='true' and filename=''"> <xsl:when test="nachgereicht='true' and filename=''">
<text:p text:style-name="P10">Das Dokument wird nachgereicht</text:p> <text:p text:style-name="P10">Das Dokument wird nachgereicht</text:p>
<text:p text:style-name="P4"><xsl:value-of select="anmerkung"/></text:p> <text:p text:style-name="P17"><xsl:value-of select="anmerkung"/></text:p>
<xsl:if test="errormsg != ''">
<text:p text:style-name="P18"><xsl:value-of select="errormsg"/></text:p>
</xsl:if>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<text:p text:style-name="P4"><xsl:value-of select="filename"/></text:p> <text:p text:style-name="P4"><xsl:value-of select="filename"/></text:p>
<xsl:if test="errormsg != ''">
<text:p text:style-name="P18"><xsl:value-of select="errormsg"/></text:p>
</xsl:if>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</table:table-cell> </table:table-cell>