Skip to content

Commit

Permalink
Now we can set a custom icon for a document format.
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoRazorX committed Oct 7, 2019
1 parent d4fbdd5 commit b65e885
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Core/Controller/ListFormatoDocumento.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected function createFormatView($viewName = 'ListFormatoDocumento')
{
$this->addView($viewName, 'FormatoDocumento', 'printing-formats', 'fas fa-print');
$this->addSearchFields($viewName, ['titulo', 'texto']);
$this->addOrderBy($viewName, ['id'], 'id');
$this->addOrderBy($viewName, ['tipodoc', 'id'], 'id');
$this->addOrderBy($viewName, ['titulo'], 'title');

/// Filters
Expand Down
3 changes: 2 additions & 1 deletion Core/Lib/PDF/PDFDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ protected function insertHeader($idempresa = null)
$lineText = $company->cifnif . ' - ' . $address . "\n" . $contactData;
$this->pdf->ezText($lineText, self::FONT_SIZE, ['justification' => 'right']);

$this->insertCompanyLogo($company->idlogo);
$idlogo = $this->format->idlogo ?? $company->idlogo;
$this->insertCompanyLogo($idlogo);
}
}
}
6 changes: 6 additions & 0 deletions Core/Model/FormatoDocumento.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class FormatoDocumento extends Base\ModelClass
*/
public $idempresa;

/**
*
* @var int
*/
public $idlogo;

/**
*
*
Expand Down
8 changes: 8 additions & 0 deletions Core/Table/formatos_documentos.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<name>idempresa</name>
<type>integer</type>
</column>
<column>
<name>idlogo</name>
<type>integer</type>
</column>
<column>
<name>texto</name>
<type>text</type>
Expand All @@ -43,4 +47,8 @@
<name>ca_formatos_documentos_empresas</name>
<type>FOREIGN KEY (idempresa) REFERENCES empresas (idempresa) ON DELETE CASCADE ON UPDATE CASCADE</type>
</constraint>
<constraint>
<name>ca_formatos_documentos_attached_files</name>
<type>FOREIGN KEY (idlogo) REFERENCES attached_files (idfile) ON DELETE SET NULL ON UPDATE CASCADE</type>
</constraint>
</table>
7 changes: 6 additions & 1 deletion Core/XMLView/EditFormatoDocumento.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,12 @@
<column name="title" order="140" >
<widget type="text" fieldname="titulo" />
</column>
<column name="additional-text" numcolumns="12" order="150">
<column name="logo" titleurl="ListAttachedFile" order="150">
<widget type="select" fieldname="idlogo" onclick="EditAttachedFile">
<values source="attached_files" fieldcode="idfile" fieldtitle="filename"></values>
</widget>
</column>
<column name="additional-text" numcolumns="12" order="160">
<widget type="textarea" fieldname="texto" />
</column>
</group>
Expand Down

0 comments on commit b65e885

Please sign in to comment.