Merge branch 'develop' of git+ssh://git@github.com/Dolibarr/dolibarr.git into develop

This commit is contained in:
Regis Houssin 2012-02-06 17:29:31 +01:00
commit f192c39851
13 changed files with 195 additions and 107 deletions

View File

@ -770,19 +770,19 @@ if ($action == 'create')
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:''); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td>'; print '<tr><td>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
} }
/* /*
// Third party Dolibarr // Third party Dolibarr
if ($conf->societe->enabled) if ($conf->societe->enabled)
{ {
@ -795,7 +795,8 @@ if ($action == 'create')
print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">'; print '<tr><td>'.$langs->trans("LinkedToDolibarrUser").'</td><td class="valeur">';
print $form->select_users($object->user_id,'userid',1); print $form->select_users($object->user_id,'userid',1);
print '</td></tr>'; print '</td></tr>';
*/ */
print "</table>\n"; print "</table>\n";
print '<br>'; print '<br>';
@ -848,8 +849,7 @@ if ($action == 'edit')
dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user'); dol_fiche_head($head, 'general', $langs->trans("Member"), 0, 'user');
dol_htmloutput_errors($errmsg,$errmsgs); dol_htmloutput_errors($errmsg,$errmsgs);
dol_htmloutput_mesg($mesg);
if ($mesg) print '<div class="ok">'.$mesg.'</div>';
if ($conf->use_javascript_ajax) if ($conf->use_javascript_ajax)
{ {
@ -991,15 +991,15 @@ if ($action == 'edit')
// Other attributes // Other attributes
$parameters=array(); $parameters=array();
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label."</td><td>"; print '<tr><td>'.$label.'</td><td>';
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print "</td></tr>\n"; print '</td></tr>'."\n";
} }
} }

View File

@ -80,7 +80,7 @@ if ($action == 'create')
exit; exit;
} }
$propal = new Propal($db); $object = new Propal($db);
$numpr=''; $numpr='';
$obj = $conf->global->PROPALE_ADDON; $obj = $conf->global->PROPALE_ADDON;
@ -90,7 +90,7 @@ if ($action == 'create')
{ {
require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php"); require_once(DOL_DOCUMENT_ROOT ."/core/modules/propale/".$conf->global->PROPALE_ADDON.".php");
$modPropale = new $obj; $modPropale = new $obj;
$numpr = $modPropale->getNextValue($soc,$propal); $numpr = $modPropale->getNextValue($soc,$object);
} }
} }
@ -175,12 +175,12 @@ if ($action == 'create')
// What trigger creation // What trigger creation
print '<tr><td>'.$langs->trans('Source').'</td><td>'; print '<tr><td>'.$langs->trans('Source').'</td><td>';
$form->select_demand_reason($propal->demand_reason,'demand_reason_id',"SRC_PROP",1); $form->select_demand_reason($object->demand_reason,'demand_reason_id',"SRC_PROP",1);
print '</td></tr>'; print '</td></tr>';
// Delivery delay // Delivery delay
print '<tr><td>'.$langs->trans('AvailabilityPeriod').'</td><td colspan="2">'; print '<tr><td>'.$langs->trans('AvailabilityPeriod').'</td><td colspan="2">';
$form->select_availability($propal->availability,'availability_id','',1); $form->select_availability($object->availability,'availability_id','',1);
print '</td></tr>'; print '</td></tr>';
// Delivery date (or manufacturing) // Delivery date (or manufacturing)
@ -240,10 +240,19 @@ if ($action == 'create')
print '</tr>'; print '</tr>';
} }
// Insert hooks // Other attributes
$parameters=array('socid'=>$socid); $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$object=new Propal($db);
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
print "</table>"; print "</table>";
print '<br>'; print '<br>';

View File

@ -1144,7 +1144,7 @@ if ($id > 0 || ! empty($ref))
if (! $formconfirm) if (! $formconfirm)
{ {
$parameters=array('lineid'=>$lineid); $parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
} }
// Print form confirm // Print form confirm
@ -1468,9 +1468,19 @@ if ($id > 0 || ! empty($ref))
print '</tr>'; print '</tr>';
} }
// Insert hooks // Other attributes
$parameters=array('colspan'=>' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Amount HT // Amount HT
print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>'; print '<tr><td height="10">'.$langs->trans('AmountHT').'</td>';

View File

@ -917,7 +917,7 @@ class Propal extends CommonObject
{ {
$parameters=array('objFrom'=>$objFrom); $parameters=array('objFrom'=>$objFrom);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }

View File

@ -825,7 +825,7 @@ class Commande extends CommonObject
{ {
$parameters=array('objFrom'=>$objFrom); $parameters=array('objFrom'=>$objFrom);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
@ -921,7 +921,7 @@ class Commande extends CommonObject
$parameters=array('objFrom'=>$object); $parameters=array('objFrom'=>$object);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
if (! $error) if (! $error)

View File

@ -303,7 +303,7 @@ if ($action == 'add' && $user->rights->commande->creer)
// Hooks // Hooks
$parameters=array('objFrom'=>$srcobject); $parameters=array('objFrom'=>$srcobject);
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
else else
@ -1366,13 +1366,23 @@ if ($action == 'create' && $user->rights->commande->creer)
print '</td></tr>'; print '</td></tr>';
} }
// Insert hooks // Other attributes
$parameters=array(); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Template to use by default
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
print '<td colspan="2">'; print '<td colspan="2">';
// pdf
include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'); include_once(DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php');
$liste=ModelePDFCommandes::liste_modeles($db); $liste=ModelePDFCommandes::liste_modeles($db);
print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF); print $form->selectarray('model',$liste,$conf->global->COMMANDE_ADDON_PDF);
@ -1643,7 +1653,7 @@ else
if (! $formconfirm) if (! $formconfirm)
{ {
$parameters=array('lineid'=>$lineid); $parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
} }
// Print form confirm // Print form confirm
@ -1908,11 +1918,19 @@ else
print '</td></tr>'; print '</td></tr>';
} }
// Insert hooks // Other attributes
$parameters=array('colspan'=>' colspan="2"'); $parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
// Lignes de 3 colonnes {
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Total HT // Total HT
print '<tr><td>'.$langs->trans('AmountHT').'</td>'; print '<tr><td>'.$langs->trans('AmountHT').'</td>';

View File

@ -856,7 +856,7 @@ if ($action == 'add' && $user->rights->facture->creer)
// Hooks // Hooks
$parameters=array('objFrom'=>$srcobject); $parameters=array('objFrom'=>$srcobject);
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('createFrom',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
else else
@ -1801,9 +1801,19 @@ if ($action == 'create')
print '</td></tr>'; print '</td></tr>';
} }
// Insert hooks // Other attributes
$parameters=array(); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Modele PDF // Modele PDF
print '<tr><td>'.$langs->trans('Model').'</td>'; print '<tr><td>'.$langs->trans('Model').'</td>';
@ -2197,7 +2207,7 @@ else
if (! $formconfirm) if (! $formconfirm)
{ {
$parameters=array('lineid'=>$lineid); $parameters=array('lineid'=>$lineid);
$formconfirm=$hookmanager->executeHooks('formconfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $formconfirm=$hookmanager->executeHooks('formConfirm',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
} }
// Print form confirm // Print form confirm
@ -2700,9 +2710,19 @@ else
print '</tr>'; print '</tr>';
} }
// Insert hooks // Other attributes
$parameters=array('colspan'=>' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
print '</table><br>'; print '</table><br>';

View File

@ -557,7 +557,7 @@ class Facture extends CommonObject
{ {
$parameters=array('objFrom'=>$objFrom); $parameters=array('objFrom'=>$objFrom);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
} }
@ -653,7 +653,7 @@ class Facture extends CommonObject
$parameters=array('objFrom'=>$object); $parameters=array('objFrom'=>$object);
$action=''; $action='';
$reshook=$hookmanager->executeHooks('createfrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks $reshook=$hookmanager->executeHooks('createFrom',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks
if ($reshook < 0) $error++; if ($reshook < 0) $error++;
if (! $error) if (! $error)

View File

@ -124,8 +124,8 @@ class HookManager
* @param array $parameters Array of parameters * @param array $parameters Array of parameters
* @param Object &$object Object to use hooks on * @param Object &$object Object to use hooks on
* @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) * @param string &$action Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...)
* @return mixed For doActions,showInputField,showOutputField: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO. * @return mixed For doActions,formObjectOptions: Return 0 if we want to keep standard actions, >0 if if want to stop standard actions, <0 means KO.
* For printSearchForm,printLeftBlock: Return HTML string. * For printSearchForm,printLeftBlock: Return HTML string.
* $this->error or this->errors are also defined by class called by this function if error. * $this->error or this->errors are also defined by class called by this function if error.
*/ */
function executeHooks($method, $parameters=false, &$object='', &$action='') function executeHooks($method, $parameters=false, &$object='', &$action='')
@ -148,30 +148,17 @@ class HookManager
$var=!$var; $var=!$var;
// Hooks that return int // Hooks that return int
if ($method == 'doActions' && method_exists($actioninstance,$method)) if (($method == 'doActions' || $method='formObjectOptions') && method_exists($actioninstance,$method))
{ {
$resaction+=$actioninstance->doActions($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example) $resaction+=$actioninstance->$method($parameters, $object, $action, $this); // $object and $action can be changed by method ($object->id during creation for example or $action to go back to other action for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
if ($action=='update') $action='edit'; // TODO this change must be inside the doActions
}
}
else if ($method == 'showInputFields' && method_exists($actioninstance,$method))
{
$resaction+=$actioninstance->showInputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
}
}
else if ($method == 'showOutputFields' && method_exists($actioninstance,$method))
{
$resaction+=$actioninstance->showOutputFields($parameters, $object, $action); // action can be changed by method (to go back to other action for example), socid can be changed/set by method (during creation for example)
if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0)) if ($resaction < 0 || ! empty($actioninstance->error) || (! empty($actioninstance->errors) && count($actioninstance->errors) > 0))
{ {
$this->error=$actioninstance->error; $this->errors=$actioninstance->errors; $this->error=$actioninstance->error; $this->errors=$actioninstance->errors;
if ($method == 'doActions')
{
if ($action=='add') $action='create'; // TODO this change must be inside the doActions
if ($action=='update') $action='edit'; // TODO this change must be inside the doActions
}
} }
} }
// Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...) // Generic hooks that return a string (printSearchForm, printLeftBlock, formBuilddocOptions, ...)
@ -184,7 +171,7 @@ class HookManager
} }
} }
if ($method == 'doActions' || $method == 'showInputFields' || $method == 'showOutputFields') return $resaction; if ($method == 'doActions' || $method == 'formObjectOptions') return $resaction;
return $resprint; return $resprint;
} }

View File

@ -1,6 +1,6 @@
<?php <?php
/* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org> /* Copyright (C) 2001-2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com> * Copyright (C) 2005 Eric Seigne <eric.seigne@ryxeo.com>
* Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2011 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr> * Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
@ -780,7 +780,21 @@ else
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
// Note (invisible sur facture, propales...) // Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note (private, no output on invoices, propales...)
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td>';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
$doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70); $doleditor=new DolEditor('note',$_POST["note"],'',180,'dolibarr_notes','',false,true,$conf->global->FCKEDITOR_ENABLE_PRODUCTDESC,8,70);
@ -970,6 +984,20 @@ else
if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1); if ($user->admin) print info_admin($langs->trans("YouCanChangeValuesForThisListFromDictionnarySetup"),1);
print '</td></tr>'; print '</td></tr>';
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note // Note
print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">'; print '<tr><td valign="top">'.$langs->trans("NoteNotVisibleOnBill").'</td><td colspan="2">';
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php"); require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
@ -1183,6 +1211,19 @@ else
// Origin country code // Origin country code
print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>'; print '<tr><td>'.$langs->trans("CountryOrigin").'</td><td colspan="2">'.getCountry($object->country_id,0,$db).'</td>';
// Other attributes
$parameters=array('colspan' => ' colspan="2"');
$reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook))
{
foreach($extrafields->attribute_label as $key=>$label)
{
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n";
}
}
// Note // Note
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>'; print '<tr><td valign="top">'.$langs->trans("Note").'</td><td colspan="2">'.(dol_textishtml($object->note)?$object->note:dol_nl2br($object->note,1,true)).'</td></tr>';

View File

@ -273,7 +273,8 @@ foreach ($conf->file->dol_document_root as $dirroot)
} }
else else
{ {
$disabled = ((is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true); $disabled = false;
if (! empty($conf->multicompany->enabled) && (is_object($mc) && ! empty($mc->sharings['referent']) && $mc->sharings['referent'] == $conf->entity) ? false : true);
print '<td align="center">'; print '<td align="center">';
if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&amp;value='.$file.'">'; if (! $disabled) print '<a href="'.$_SERVER['PHP_SELF'].'?action=setcodeclient&amp;value='.$file.'">';
print img_picto($langs->trans("Disabled"),'switch_off'); print img_picto($langs->trans("Disabled"),'switch_off');

View File

@ -940,13 +940,13 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_".$key])?$_POST["options_".$key]:''); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">'; print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print '</td></tr>'."\n"; print '</td></tr>'."\n";
} }
@ -1368,13 +1368,13 @@ else
// Other attributes // Other attributes
$parameters=array('colspan' => ' colspan="3"'); $parameters=array('colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showInputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=(isset($_POST["options_$key"])?$_POST["options_$key"]:$object->array_options["options_$key"]); $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label."</td><td colspan=\"3\">"; print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showInputField($key,$value); print $extrafields->showInputField($key,$value);
print "</td></tr>\n"; print "</td></tr>\n";
} }
@ -1717,13 +1717,13 @@ else
// Other attributes // Other attributes
$parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"'); $parameters=array('socid'=>$socid, 'colspan' => ' colspan="3"');
$reshook=$hookmanager->executeHooks('showOutputFields',$parameters,$object,$action); // Note that $action and $object may have been modified by hook $reshook=$hookmanager->executeHooks('formObjectOptions',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) if (empty($reshook))
{ {
foreach($extrafields->attribute_label as $key=>$label) foreach($extrafields->attribute_label as $key=>$label)
{ {
$value=$object->array_options["options_$key"]; $value=(isset($_POST["options_".$key])?$_POST["options_".$key]:$object->array_options["options_".$key]);
print "<tr><td>".$label.'</td><td colspan="3">'; print '<tr><td>'.$label.'</td><td colspan="3">';
print $extrafields->showOutputField($key,$value); print $extrafields->showOutputField($key,$value);
print "</td></tr>\n"; print "</td></tr>\n";
} }

View File

@ -57,8 +57,6 @@ if (GETPOST('theme')) $conf->theme=GETPOST('theme'); // If theme was forced on
$langs->load("main",0,1); $langs->load("main",0,1);
$right=($langs->trans("DIRECTION")=='rtl'?'left':'right'); $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
$left=($langs->trans("DIRECTION")=='rtl'?'right':'left'); $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
$fontsize=empty($conf->browser->phone)?'12':'14';
$fontsizesmaller=empty($conf->browser->phone)?'11':'14';
$path=''; // This value may be used in future for external module to overwrite theme $path=''; // This value may be used in future for external module to overwrite theme
@ -98,6 +96,8 @@ $colorbacklinepair1='255,255,255'; // line pair
$colorbacklinepair2='255,255,255'; // line pair $colorbacklinepair2='255,255,255'; // line pair
$colorbackbody='#ffffff url('.$img_head.') 0 0 no-repeat;'; $colorbackbody='#ffffff url('.$img_head.') 0 0 no-repeat;';
$colortext='40,40,40'; $colortext='40,40,40';
$fontsize=empty($conf->browser->phone)?'12':'14';
$fontsizesmaller=empty($conf->browser->phone)?'11':'14';
// Eldy colors // Eldy colors
if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED)) if (empty($conf->global->THEME_ELDY_ENABLE_PERSONALIZED))
@ -135,6 +135,8 @@ $colorbacklinepair1 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty(
$colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2); $colorbacklinepair2 =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_LINEPAIR2) ?$colorbacklinepair2:$conf->global->THEME_ELDY_LINEPAIR2) :(empty($user->conf->THEME_ELDY_LINEPAIR2)?$colorbacklinepair2:$user->conf->THEME_ELDY_LINEPAIR2);
$colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY); $colorbackbody =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_BACKBODY) ?$colorbackbody:$conf->global->THEME_ELDY_BACKBODY) :(empty($user->conf->THEME_ELDY_BACKBODY)?$colorbackbody:$user->conf->THEME_ELDY_BACKBODY);
$colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT); $colortext =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_TEXT) ?$colortext:$conf->global->THEME_ELDY_TEXT) :(empty($user->conf->THEME_ELDY_TEXT)?$colortext:$user->conf->THEME_ELDY_TEXT);
$fontsize =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE1) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE1) :(empty($user->conf->THEME_ELDY_FONT_SIZE1)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE1);
$fontsizesmaller =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_FONT_SIZE2) ?$fontsize:$conf->global->THEME_ELDY_FONT_SIZE2) :(empty($user->conf->THEME_ELDY_FONT_SIZE2)?$fontsize:$user->conf->THEME_ELDY_FONT_SIZE2);
// Set text color to black or white // Set text color to black or white
$tmppart=explode(',',$colorback1); $tmppart=explode(',',$colorback1);