diff --git a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php index e6f928d539f..53fafb0ce61 100644 --- a/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php +++ b/htdocs/comm/mailing/class/html.formadvtargetemailing.class.php @@ -339,72 +339,6 @@ class FormAdvTargetEmailing extends Form return $return; } - /** - * Return combo list with customer categories - * - * @param string $htmlname Name of categorie - * @param array $selected_array value selected - * @return string HTML combo - */ - public function multiselectCustomerCategories($htmlname = 'cust_cat', $selected_array = array()) - { - return $this->multiselectCategories($htmlname, $selected_array, 2); - } - - /** - * Return combo list with customer contact - * - * @param string $htmlname Name of categorie - * @param array $selected_array value selected - * @return string HTML combo - */ - public function multiselectContactCategories($htmlname = 'contact_cat', $selected_array = array()) - { - return $this->multiselectCategories($htmlname, $selected_array, 4); - } - - /** - * Return combo list of categories - * - * @param string $htmlname Name of categorie - * @param array $selected_array Value selected - * @param int $type Type - * @return string HTML combo - */ - public function multiselectCategories($htmlname = '', $selected_array = array(), $type = 0) - { - global $conf, $langs, $user; - $langs->load("dict"); - - $options_array = array(); - - $sql = "SELECT rowid, label FROM ".MAIN_DB_PREFIX."categorie"; - $sql .= " WHERE type=".$type; - - dol_syslog(__METHOD__, LOG_DEBUG); - $resql = $this->db->query($sql); - if ($resql) - { - $num = $this->db->num_rows($resql); - $i = 0; - if ($num) - { - while ($i < $num) - { - $obj = $this->db->fetch_object($resql); - - $options_array[$obj->rowid] = $obj->label; - - $i++; - } - } - } else { - dol_print_error($this->db); - } - - return $this->advMultiselectarray($htmlname, $options_array, $selected_array); - } - /** * Return a combo list to select emailing target selector * diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 7ae80f72842..277b55ddb90 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -313,15 +313,23 @@ if (empty($reshook)) if (($tmp_total_ht < 0 || $tmp_total_ht_devise < 0) && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) { - $langs->load("errors"); if ($object->type == $object::TYPE_DEPOSIT) { + $langs->load("errors"); // Using negative lines on deposit lead to headach and blocking problems when you want to consume them. setEventMessages($langs->trans("ErrorLinesCantBeNegativeOnDeposits"), null, 'errors'); + $error++; + $action = ''; } else { - setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate"), null, 'errors'); + $tmpvatratetoshow = explode('_', $vatrate); + $tmpvatratetoshow[0] = round($tmpvatratetoshow[0], 2); + + if ($tmpvatratetoshow[0] != 0) { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorLinesCantBeNegativeForOneVATRate", $tmpvatratetoshow[0]), null, 'errors'); + $error++; + $action = ''; + } } - $error++; - $action = ''; } } } @@ -3417,10 +3425,19 @@ if ($action == 'create') } // Other attributes - $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2'); + $parameters = array('objectsrc' => $objectsrc, 'colspan' => ' colspan="2"', 'cols' => '2', 'socid'=>$socid); $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (empty($reshook)) { + if (!empty($conf->global->THIRDPARTY_PROPAGATE_EXTRAFIELDS_TO_INVOICE)) { + // copy from thirdparty + $tpExtrafields = new Extrafields($db); + $tpExtrafieldLabels = $tpExtrafields->fetch_name_optionals_label($soc->table_element); + if ($soc->fetch_optionals() > 0) { + $object->array_options = array_merge($object->array_options, $soc->array_options); + } + }; + print $object->showOptionals($extrafields, 'edit', $parameters); } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 574b1f7d52a..d433a1ef042 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -448,6 +448,7 @@ if (!$sall) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.f if ($sall || $search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'facturedet as pd ON f.rowid=pd.fk_facture'; if ($search_product_category > 0) $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'categorie_product as cp ON cp.fk_product=pd.fk_product'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = f.fk_projet"; +$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; // We'll need this table joined to the select in order to filter by sale if ($search_sale > 0 || (!$user->rights->societe->client->voir && !$socid)) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; if ($search_user > 0) @@ -455,7 +456,7 @@ if ($search_user > 0) $sql .= ", ".MAIN_DB_PREFIX."element_contact as ec"; $sql .= ", ".MAIN_DB_PREFIX."c_type_contact as tc"; } -$sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user AS u ON f.fk_user_author = u.rowid'; + $sql .= ' WHERE f.fk_soc = s.rowid'; $sql .= ' AND f.entity IN ('.getEntity('invoice').')'; if (!$user->rights->societe->client->voir && !$socid) $sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".$user->id; diff --git a/htdocs/compta/paiement/class/paiement.class.php b/htdocs/compta/paiement/class/paiement.class.php index f0c24ab1b8a..f1cb1e078b8 100644 --- a/htdocs/compta/paiement/class/paiement.class.php +++ b/htdocs/compta/paiement/class/paiement.class.php @@ -498,8 +498,10 @@ class Paiement extends CommonObject { $accline = new AccountLine($this->db); - $result = $accline->fetch($bank_line_id); - if ($result == 0) $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url + $result=$accline->fetch($bank_line_id); + if ($result == 0) { + $accline->id = $accline->rowid = $bank_line_id; // If not found, we set artificially rowid to allow delete of llx_bank_url + } // Delete bank account url lines linked to payment $result = $accline->delete_urls($user); diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a8e8722007a..91ffaeffc4c 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5844,7 +5844,7 @@ abstract class CommonObject if ($type == 'date') { $morecss = 'minwidth100imp'; - } elseif ($type == 'datetime' || $type == 'link') + } elseif ($type == 'datetime' || $type == 'link') // link means an foreign key to another primary id { $morecss = 'minwidth200imp'; } elseif (in_array($type, array('int', 'integer', 'price')) || preg_match('/^double(\([0-9],[0-9]\)){0,1}/', $type)) @@ -6278,11 +6278,13 @@ abstract class CommonObject $param_list = array_keys($param['options']); // $param_list='ObjectName:classPath[:AddCreateButtonOrNot[:Filter]]' $param_list_array = explode(':', $param_list[0]); $showempty = (($required && $default != '') ? 0 : 1); + if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button + $morecss .= ' widthcentpercentminusx'; + } $out = $form->selectForForms($param_list[0], $keyprefix.$key.$keysuffix, $value, $showempty, '', '', $morecss, $moreparam, 0, empty($val['disabled']) ? 0 : 1); - if (!empty($param_list_array[2])) // If we set to add a create button - { + if (!empty($param_list_array[2])) { // If the entry into $fields is set to add a create button if (!GETPOSTISSET('backtopage') && empty($val['disabled']) && empty($nonewbutton)) // To avoid to open several times the 'Create Object' button and to avoid to have button if field is protected by a "disabled". { list($class, $classfile) = explode(':', $param_list[0]); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index efae43e02ee..6d73e117fd3 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5676,8 +5676,7 @@ class Form $minSelected = convertSecondToTime($iSecond, 'min'); } - if ($typehour == 'select') - { + if ($typehour == 'select') { $retstring .= '"; - } elseif ($typehour == 'text' || $typehour == 'textselect') - { - $retstring .= ''; - } else return 'BadValueForParameterTypeHour'; + } elseif ($typehour == 'text' || $typehour == 'textselect') { + $retstring .= ''; + } else { + return 'BadValueForParameterTypeHour'; + } if ($typehour != 'text') $retstring .= ' '.$langs->trans('HourShort'); else $retstring .= ':'; @@ -5713,7 +5713,7 @@ class Form $retstring .= ""; } elseif ($typehour == 'text') { - $retstring .= ''; + $retstring .= ''; } if ($typehour != 'text') $retstring .= ' '.$langs->trans('MinuteShort'); diff --git a/htdocs/core/lib/emailing.lib.php b/htdocs/core/lib/emailing.lib.php index 839be4c4e3d..8afbf7a654d 100644 --- a/htdocs/core/lib/emailing.lib.php +++ b/htdocs/core/lib/emailing.lib.php @@ -48,7 +48,7 @@ function emailing_prepare_head(Mailing $object) $h++; } - if (empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) + if (!empty($conf->global->EMAILING_USE_ADVANCED_SELECTOR)) { $head[$h][0] = DOL_URL_ROOT."/comm/mailing/advtargetemailing.php?id=".$object->id; $head[$h][1] = $langs->trans("MailAdvTargetRecipients"); diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 77f159512ff..673b904b743 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -462,7 +462,7 @@ function showWebsiteTemplates(Website $website) $colspan = 2; - print ''."\n"; + print ''."\n"; print '