瀏覽代碼

NEW: Supplier template invoive extrafields (#26570)

* NEW: Supplier template invoive extrafields

* NEW: Supplier template invoive extrafields

* NEW: Supplier template invoive extrafields
sonikf 1 年之前
父節點
當前提交
0fbc5bd423

+ 109 - 0
htdocs/admin/supplierinvoice_rec_extrafields.php

@@ -0,0 +1,109 @@
+<?php
+/* Copyright (C) 2001-2002	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
+ * Copyright (C) 2003		Jean-Louis Bergamo		<jlb@j1b.org>
+ * Copyright (C) 2004-2013	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2012		Regis Houssin			<regis.houssin@inodbox.com>
+ * Copyright (C) 2012		Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2013-2018	Philippe Grand			<philippe.grand@atoo-net.com>
+ * Copyright (C) 2013		Juanjo Menent			<jmenent@2byte.es>
+ * Copyright (C) 2023 	    Nick Fragoulis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *      \file       htdocs/admin/supplierinvoice_rec_extrafields.php
+ *		\ingroup    fourn
+ *		\brief      Page to setup extra fields of recurring supplierinvoice
+ */
+
+// Load Dolibarr environment
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("admin", "other", "bills", "orders", "suppliers"));
+
+if (!$user->admin) {
+	accessforbidden();
+}
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) {
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
+
+$action = GETPOST('action', 'aZ09');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'facture_fourn_rec'; //Must be the $table_element of the class that manage extrafield
+
+if (!$user->admin) {
+	accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+$textobject = $langs->transnoentitiesnoconv("BillsSuppliers");
+
+llxHeader('', $langs->trans("SuppliersSetup"));
+
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
+print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
+print "<br>\n";
+
+$head = supplierorder_admin_prepare_head();
+
+print dol_get_fiche_head($head, 'attributesrec', $langs->trans("Suppliers"), -1, 'company');
+
+require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
+
+print dol_get_fiche_end();
+
+
+// Creation of an optional field
+if ($action == 'create') {
+	print '<br><div id="newattrib"></div>';
+	print load_fiche_titre($langs->trans('NewAttribute'));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+// Edition of an optional field
+if ($action == 'edit' && !empty($attrname)) {
+	print "<br>";
+	print load_fiche_titre($langs->trans("FieldEdition", $attrname));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 111 - 0
htdocs/admin/supplierinvoicedet_rec_extrafields.php

@@ -0,0 +1,111 @@
+<?php
+/* Copyright (C) 2001-2002	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
+ * Copyright (C) 2003		Jean-Louis Bergamo		<jlb@j1b.org>
+ * Copyright (C) 2004-2013	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2012		Regis Houssin			<regis.houssin@inodbox.com>
+ * Copyright (C) 2012		Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2013		Philippe Grand			<philippe.grand@atoo-net.com>
+ * Copyright (C) 2013		Juanjo Menent			<jmenent@2byte.es>
+ * Copyright (C) 2015 	    Claudio Aschieri 		<c.aschieri@19.coop>
+ * Copyright (C) 2023 	    Nick Fragoulis
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *      \file       htdocs/admin/supplierinvoicedet_rec_extrafields.php
+ *		\ingroup    fourn
+ *		\brief      Page to setup extra fields of recurring supplierinvoice line
+ */
+
+// Load Dolibarr environment
+require '../main.inc.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+
+
+if (!$user->admin) {
+	accessforbidden();
+}
+
+// Load translation files required by the page
+$langs->loadLangs(array('admin', 'other', 'bills', 'orders', 'suppliers'));
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) {
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
+
+$action = GETPOST('action', 'aZ09');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'facture_fourn_det_rec'; //Must be the $table_element of the class that manage extrafield
+
+if (!$user->admin) {
+	accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+$textobject = $langs->transnoentitiesnoconv("BillsSuppliers");
+
+llxHeader('', $langs->trans("SuppliersSetup"));
+
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
+print load_fiche_titre($langs->trans("SuppliersSetup"), $linkback, 'title_setup');
+print "<br>\n";
+
+$head = supplierorder_admin_prepare_head();
+
+print dol_get_fiche_head($head, 'attributeslinesrec', $langs->trans("Suppliers"), -1, 'company');
+
+require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
+
+print dol_get_fiche_end();
+
+
+// Creation of an optional field
+if ($action == 'create') {
+	print '<br><div id="newattrib"></div>';
+	print load_fiche_titre($langs->trans('NewAttribute'));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+// Edition of an optional field
+if ($action == 'edit' && !empty($attrname)) {
+	print "<br>";
+	print load_fiche_titre($langs->trans("FieldEdition", $attrname));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 21 - 0
htdocs/core/lib/fourn.lib.php

@@ -4,6 +4,7 @@
  * Copyright (C) 2006		Marc Barilley		<marc@ocebo.com>
  * Copyright (C) 2011-2013  Philippe Grand      <philippe.grand@atoo-net.com>
  * Copyright (C) 2022-2023  Frédéric France         <frederic.france@netlogic.fr>
+ * Copyright (C) 2023 	    Nick Fragoulis
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -258,6 +259,8 @@ function supplierorder_admin_prepare_head()
 	$extrafields->fetch_name_optionals_label('commande_fournisseurdet');
 	$extrafields->fetch_name_optionals_label('facture_fourn');
 	$extrafields->fetch_name_optionals_label('facture_fourn_det');
+	$extrafields->fetch_name_optionals_label('facture_fourn_rec');
+	$extrafields->fetch_name_optionals_label('facture_fourn_det_rec');
 
 	$h = 0;
 	$head = array();
@@ -315,6 +318,24 @@ function supplierorder_admin_prepare_head()
 	$head[$h][2] = 'supplierinvoicedet';
 	$h++;
 
+	$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoice_rec_extrafields.php';
+	$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesRec");
+	$nbExtrafields = $extrafields->attributes['facture_fourn_rec']['count'];
+	if ($nbExtrafields > 0) {
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
+	}
+	$head[$h][2] = 'attributesrec';
+	$h++;
+
+	$head[$h][0] = DOL_URL_ROOT.'/admin/supplierinvoicedet_rec_extrafields.php';
+	$head[$h][1] = $langs->trans("ExtraFieldsSupplierInvoicesLinesRec");
+	$nbExtrafields = $extrafields->attributes['facture_fourn_det_rec']['count'];
+	if ($nbExtrafields > 0) {
+		$head[$h][1] .= '<span class="badge marginleftonlyshort">'.$nbExtrafields.'</span>';
+	}
+	$head[$h][2] = 'attributeslinesrec';
+	$h++;
+
 	complete_head_from_modules($conf, $langs, null, $head, $h, 'supplierorder_admin', 'remove');
 
 	return $head;

+ 2 - 0
htdocs/langs/en_US/admin.lang

@@ -2427,3 +2427,5 @@ LargeModern=Large - Modern
 SpecialCharActivation=Enable the button to open a virtual keyboard to enter special characters
 DeleteExtrafield=Delete extrafield
 ConfirmDeleteExtrafield=Confirm delete %s extrafield ? All data is going to be lost
+ExtraFieldsSupplierInvoicesRec=Complementary attributes (templates invoices)
+ExtraFieldsSupplierInvoicesLinesRec=Complementary attributes (invoice lines)