Better extrafield management
This commit is contained in:
parent
162ccf68b6
commit
7b080dec65
@ -1,34 +1,34 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
* Copyright (C) 2005 Marc Barilley / Ocebo <marc@ocebo.com>
|
||||
* Copyright (C) 2005-2013 Regis Houssin <regis.houssin@capnetworks.com>
|
||||
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||
* Copyright (C) 2010-2013 Juanjo Menent <jmenent@2byte.es>
|
||||
* Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com>
|
||||
* Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr>
|
||||
* Copyright (C) 2012 Marcos García <marcosgdf@gmail.com>
|
||||
* Copyright (C) 2013 Florian Henry <florian.henry@open-concept.pro>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file htdocs/commande/fiche.php
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
* \ingroup commande
|
||||
* \brief Page to show customer order
|
||||
*/
|
||||
|
||||
require '../main.inc.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
@ -1121,7 +1121,7 @@ else if ($action == 'print_file' AND $user->rights->printipp->use)
|
||||
{
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/dolprintipp.class.php';
|
||||
$printer = new dolPrintIPP($db,$conf->global->PRINTIPP_HOST,$conf->global->PRINTIPP_PORT,$user->login,$conf->global->PRINTIPP_USER,$conf->global->PRINTIPP_PASSWORD);
|
||||
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
|
||||
$printer->print_file(GETPOST('file','alpha'),GETPOST('printer','alpha'));
|
||||
}
|
||||
|
||||
else if ($action == 'update_extras')
|
||||
@ -2135,49 +2135,24 @@ else
|
||||
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||
{
|
||||
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
}
|
||||
|
||||
// TODO : use showOptionals($extrafields) function
|
||||
foreach($extrafields->attribute_label as $key=>$label)
|
||||
{
|
||||
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
|
||||
if ($extrafields->attribute_type[$key] == 'separate')
|
||||
{
|
||||
print $extrafields->showSeparator($key);
|
||||
}
|
||||
else
|
||||
{
|
||||
print '<tr><td';
|
||||
if (! empty($extrafields->attribute_required[$key])) print ' class="fieldrequired"';
|
||||
print '>'.$label.'</td><td colspan="3">';
|
||||
|
||||
// Convert date into timestamp format
|
||||
if (in_array($extrafields->attribute_type[$key],array('date','datetime')))
|
||||
{
|
||||
$value = isset($_POST["options_".$key])?dol_mktime($_POST["options_".$key."hour"], $_POST["options_".$key."min"], 0, $_POST["options_".$key."month"], $_POST["options_".$key."day"], $_POST["options_".$key."year"]):$object->array_options['options_'.$key];
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||
{
|
||||
print $extrafields->showInputField($key,$value);
|
||||
}
|
||||
else
|
||||
{
|
||||
print $extrafields->showOutputField($key,$value);
|
||||
}
|
||||
print '</td></tr>'."\n";
|
||||
}
|
||||
}
|
||||
|
||||
if(count($extrafields->attribute_label) > 0) {
|
||||
|
||||
if ($action == 'edit_extras')
|
||||
{
|
||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||
print '<input type="hidden" name="action" value="update_extras">';
|
||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer) {
|
||||
print $object->showOptionals($extrafields,'edit');
|
||||
}
|
||||
else {
|
||||
print $object->showOptionals($extrafields);
|
||||
}
|
||||
|
||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||
{
|
||||
print '<tr><td></td><td>';
|
||||
@ -2307,7 +2282,7 @@ else
|
||||
|
||||
/*
|
||||
* Boutons actions
|
||||
*/
|
||||
*/
|
||||
if ($action != 'presend')
|
||||
{
|
||||
if ($user->societe_id == 0 && $action <> 'editline')
|
||||
@ -2447,7 +2422,7 @@ else
|
||||
|
||||
/*
|
||||
* Documents generes
|
||||
*/
|
||||
*/
|
||||
$comref = dol_sanitizeFileName($object->ref);
|
||||
$file = $conf->commande->dir_output . '/' . $comref . '/' . $comref . '.pdf';
|
||||
$relativepath = $comref.'/'.$comref.'.pdf';
|
||||
@ -2461,7 +2436,7 @@ else
|
||||
|
||||
/*
|
||||
* Linked object block
|
||||
*/
|
||||
*/
|
||||
$somethingshown=$object->showLinkedObjectBlock();
|
||||
|
||||
print '</div><div class="fichehalfright"><div class="ficheaddleft">';
|
||||
@ -2473,7 +2448,7 @@ else
|
||||
$somethingshown=$formactions->showactions($object,'order',$socid);
|
||||
|
||||
//print '</td></tr></table>';
|
||||
print '</div></div></div>';
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user