dolibarr 21.0.0-beta
format_cards.lib.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2006-2012 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
4 * Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
5 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
6 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 * or see https://www.gnu.org/
21 */
22
30global $_Avery_Labels;
35// Unit of metric are defined into field 'metric' in mm.
36// To get into inch, just /25.4
37// Size of pages available on: http://www.worldlabel.com/Pages/pageaverylabels.htm
38// _PosX = marginLeft+(_COUNTX*(width+SpaceX));
39
40$sql = "SELECT rowid, code, name, paper_size, orientation, metric, leftmargin, topmargin, nx, ny, spacex, spacey, width, height, font_size, custom_x, custom_y, active FROM ".MAIN_DB_PREFIX."c_format_cards WHERE active=1 ORDER BY code ASC";
41$resql = $db->query($sql);
42if ($resql) {
43 while ($row = $db->fetch_array($resql)) {
44 $_Avery_Labels[$row['code']]['name'] = $row['name'];
45 $_Avery_Labels[$row['code']]['paper-size'] = $row['paper_size'];
46 $_Avery_Labels[$row['code']]['orientation'] = $row['orientation'];
47 $_Avery_Labels[$row['code']]['metric'] = $row['metric'];
48 $_Avery_Labels[$row['code']]['marginLeft'] = $row['leftmargin'];
49 $_Avery_Labels[$row['code']]['marginTop'] = $row['topmargin'];
50 $_Avery_Labels[$row['code']]['NX'] = $row['nx'];
51 $_Avery_Labels[$row['code']]['NY'] = $row['ny'];
52 $_Avery_Labels[$row['code']]['SpaceX'] = $row['spacex'];
53 $_Avery_Labels[$row['code']]['SpaceY'] = $row['spacey'];
54 $_Avery_Labels[$row['code']]['width'] = $row['width'];
55 $_Avery_Labels[$row['code']]['height'] = $row['height'];
56 $_Avery_Labels[$row['code']]['font-size'] = $row['font_size'];
57 $_Avery_Labels[$row['code']]['custom_x'] = $row['custom_x'];
58 $_Avery_Labels[$row['code']]['custom_y'] = $row['custom_y'];
59 }
60} else {
61 dol_print_error($db);
62}
63
64// We add characteristics to the name
65foreach ($_Avery_Labels as $key => $val) {
66 $_Avery_Labels[$key]['name'] .= ' ('.$_Avery_Labels[$key]['paper-size'].' - '.$_Avery_Labels[$key]['NX'].'x'.$_Avery_Labels[$key]['NY'].')';
67}
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...