Merge pull request #939 from FHenry/3.4
Fix bug [ bug #885 ] silent pgsql errors with click2dial
This commit is contained in:
commit
e67bb18062
@ -931,9 +931,10 @@ else
|
|||||||
$adht->fetch($object->typeid);
|
$adht->fetch($object->typeid);
|
||||||
|
|
||||||
// We set country_id, and country_code, country of the chosen country
|
// We set country_id, and country_code, country of the chosen country
|
||||||
if (isset($_POST["country"]) || $object->country_id)
|
$country=GETPOST('country','int');
|
||||||
|
if (!empty($country) || $object->country_id)
|
||||||
{
|
{
|
||||||
$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(isset($_POST["country"])?$_POST["country"]:$object->country_id);
|
$sql = "SELECT rowid, code, libelle as label from ".MAIN_DB_PREFIX."c_pays where rowid = ".(!empty($country)?$country:$object->country_id);
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1834,33 +1834,58 @@ else
|
|||||||
$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) && ! empty($extrafields->attribute_label))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($action == 'edit_extras')
|
if ($action == 'edit_extras')
|
||||||
{
|
{
|
||||||
print '</table>';
|
|
||||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
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="action" value="update_extras">';
|
||||||
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
print $object->showOptionals($extrafields,'edit');
|
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="5">';
|
||||||
|
// 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(count($extrafields->attribute_label) > 0) {
|
||||||
|
|
||||||
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
if ($action == 'edit_extras' && $user->rights->propal->creer)
|
||||||
{
|
{
|
||||||
print '<tr><td width="25%"></td><td>';
|
print '<tr><td></td><td colspan="5">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
print '</table></form>';
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($object->statut == 0 && $user->rights->propal->creer)
|
if ($object->statut == 0 && $user->rights->propal->creer)
|
||||||
{
|
{
|
||||||
print '<tr><td width="25%"></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
|
print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1923,6 +1948,7 @@ else
|
|||||||
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
include DOL_DOCUMENT_ROOT.'/core/tpl/bloc_showhide.tpl.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lines
|
* Lines
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -2135,8 +2135,6 @@ else
|
|||||||
$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) && ! empty($extrafields->attribute_label))
|
if (empty($reshook) && ! empty($extrafields->attribute_label))
|
||||||
{
|
{
|
||||||
if(count($extrafields->attribute_label) > 0) {
|
|
||||||
|
|
||||||
if ($action == 'edit_extras')
|
if ($action == 'edit_extras')
|
||||||
{
|
{
|
||||||
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
print '<form enctype="multipart/form-data" action="'.$_SERVER["PHP_SELF"].'" method="post" name="formsoc">';
|
||||||
@ -2145,24 +2143,48 @@ else
|
|||||||
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
print '<input type="hidden" name="id" value="'.$object->id.'">';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($extrafields->attribute_label as $key=>$label)
|
||||||
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>';
|
$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="5">';
|
||||||
|
// 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->commande->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' && $user->rights->commande->creer)
|
||||||
|
{
|
||||||
|
print '<tr><td></td><td colspan="5">';
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
print '<input type="submit" class="button" value="'.$langs->trans('Modify').'">';
|
||||||
print '</form>';
|
print '</form>';
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ($object->statut == 0 && $user->rights->propal->creer)
|
if ($object->statut == 0 && $user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
|
print '<tr><td></td><td><a href="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'&action=edit_extras">'.img_picto('','edit').' '.$langs->trans('Modify').'</a></td></tr>';
|
||||||
}
|
}
|
||||||
|
|||||||
@ -374,3 +374,5 @@ create table llx_facture_fourn_extrafields
|
|||||||
import_key varchar(14) -- import key
|
import_key varchar(14) -- import key
|
||||||
) ENGINE=innodb;
|
) ENGINE=innodb;
|
||||||
ALTER TABLE llx_facture_fourn_extrafields ADD INDEX idx_facture_fourn_extrafields (fk_object);
|
ALTER TABLE llx_facture_fourn_extrafields ADD INDEX idx_facture_fourn_extrafields (fk_object);
|
||||||
|
|
||||||
|
ALTER TABLE llx_user_clicktodial ADD COLUMN url varchar(255) AFTER fk_user;
|
||||||
|
|||||||
@ -220,6 +220,15 @@ class User extends CommonObject
|
|||||||
$this->fk_member = $obj->fk_member;
|
$this->fk_member = $obj->fk_member;
|
||||||
$this->fk_user = $obj->fk_user;
|
$this->fk_user = $obj->fk_user;
|
||||||
|
|
||||||
|
// Retreive all extrafield for thirdparty
|
||||||
|
// fetch optionals attributes and labels
|
||||||
|
require_once(DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php');
|
||||||
|
$extrafields=new ExtraFields($this->db);
|
||||||
|
$extralabels=$extrafields->fetch_name_optionals_label($this->table_element,true);
|
||||||
|
if (count($extralabels)>0) {
|
||||||
|
$this->fetch_optionals($this->id,$extralabels);
|
||||||
|
}
|
||||||
|
|
||||||
$this->db->free($result);
|
$this->db->free($result);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user