diff --git a/ChangeLog b/ChangeLog index 2a72296477c..be3e87bfa6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -276,6 +276,12 @@ Following changes may create regressions for some external modules, but were nec and add 'td.' to the beginning of the dragHandle match string. * IE8 and earlier and Firefox 12 and earlier (< 2012) are no more supported. +* If you use the external module "multicompany", you must also upgrade the module. Multicompany module for + Dolibarr v7 is required because with Dolibarr v7, payment modes and payment conditions are management as data + that are dedicated to each company. If you keep your old version of multicompany module, mode and + condition of payments will appears empty in all companies that are not the first one. By upgrading the + multicompany module to a version that support Dolibarr v7, everything should work as expected. + ***** ChangeLog for 6.0.5 compared to 6.0.4 ***** FIX: security vulnerability reported by ADLab of Venustech diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 8ecf04fdbc8..0a4db2f84e4 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -99,7 +99,7 @@ $form = new Form($db); if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page','int') == '' && ! GETPOST('noreset','int')) { $query = "SELECT date_start, date_end from ".MAIN_DB_PREFIX."accounting_fiscalyear "; - $query.= " where date_start < '".$this->idate(dol_now())."' and date_end > '".$this->idate(dol_now())."' limit 1"; + $query.= " where date_start < '".$db->idate(dol_now())."' and date_end > '".$db->idate(dol_now())."' limit 1"; $res = $db->query($query); if ($res->num_rows > 0) { $fiscalYear = $db->fetch_object($res); diff --git a/htdocs/adherents/agenda.php b/htdocs/adherents/agenda.php index 61cb960f05c..927bd22f7fa 100644 --- a/htdocs/adherents/agenda.php +++ b/htdocs/adherents/agenda.php @@ -148,10 +148,10 @@ if ($object->id > 0) //print ''; - $morehtmlcenter = ''; + $createbutton = ''; if (! empty($conf->agenda->enabled)) { - $morehtmlcenter.=''.$langs->trans("AddAction").''; + $createbutton.=''.$langs->trans("AddAction").''; } if (! empty($conf->agenda->enabled) && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read) )) @@ -162,7 +162,7 @@ if ($object->id > 0) if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, $morehtmlcenter, 0, -1, '', '', '', '', 0, 1, 1); + print_barre_liste($langs->trans("ActionsOnMember"), 0, $_SERVER["PHP_SELF"], '', $sortfield, $sortorder, '', 0, -1, '', '', $createbutton, '', 0, 1, 1); // List of all actions $filters=array(); diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 08b384d7ac5..d508d1edceb 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -453,24 +453,36 @@ if (is_array($blocks)) if (empty($search_showonlyerrors) || ! $checkresult[$block->id]) { print ''; + // ID print ''.$block->id.''; + // Date print ''.dol_print_date($block->date_creation,'dayhour').''; + // User print ''; + //print $block->getUser() print $block->user_fullname; print ''; + // Action print ''.$langs->trans('log'.$block->action).''; + // Ref print ''.$block->ref_object.''; + // Link to source object print ''.$object_link.''; + + // Amount print ''.price($block->amounts).''; + + // Details link print ''.img_info($langs->trans('ShowDetails')).''; + // Fingerprint print ''; print $form->textwithpicto(dol_trunc($block->signature, '12'), $block->signature, 1, 'help', '', 0, 2, 'fingerprint'); print ''; diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index 2f3c5d60640..3dc3ade52e5 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -149,11 +149,10 @@ class BlockedLog if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_MODIFY']='logMEMBER_SUBSCRIPTION_MODIFY'; if ($conf->adherent->enabled) $this->trackedevents['MEMBER_SUBSCRIPTION_DELETE']='logMEMBER_SUBSCRIPTION_DELETE'; - /* - $trackedevents['PAYMENT_VARIOUS_CREATE']='BlockedLogVariousPaymentCreate'; - $trackedevents['PAYMENT_VARIOUS_MODIFY']='BlockedLogVariousPaymentModify'; - $trackedevents['PAYMENT_VARIOUS_DELETE']='BlockedLogVariousPaymentDelete'; - */ + + if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_CREATE']='logPAYMENT_VARIOUS_CREATE'; + if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_MODIFY']='logPAYMENT_VARIOUS_MODIFY'; + if ($conf->banque->enabled) $this->trackedevents['PAYMENT_VARIOUS_DELETE']='logPAYMENT_VARIOUS_DELETE'; } /** @@ -218,6 +217,17 @@ class BlockedLog $this->error++; } } + else if($this->element === 'payment_various') { + require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; + + $object = new PaymentVarious($this->db); + if ($object->fetch($this->fk_object)>0) { + return $object->getNomUrl(1); + } + else{ + $this->error++; + } + } else if($this->element === 'don' || $this->element === 'donation') { require_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; @@ -299,7 +309,7 @@ class BlockedLog { $this->date_object = $object->datev; } - elseif ($object->element == 'payment_donation') + elseif ($object->element == 'payment_donation' || $object->element == 'payment_various') { $this->date_object = $object->datepaid?$object->datepaid:$object->datep; } @@ -401,21 +411,26 @@ class BlockedLog if (! empty($object->newref)) $this->object_data->ref = $object->newref; } - elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation') + elseif ($this->element == 'payment' || $this->element == 'payment_supplier' || $this->element == 'payment_donation' || $this->element == 'payment_various') { $datepayment = $object->datepaye?$object->datepaye:($object->datepaid?$object->datepaid:$object->datep); - $paymenttypeid = $object->paiementid?$object->paiementid:$object->paymenttype; + $paymenttypeid = $object->paiementid?$object->paiementid:($object->paymenttype?$object->paymenttype:$object->type_payment); $this->object_data->ref = $object->ref; $this->object_data->date = $datepayment; $this->object_data->type_code = dol_getIdFromCode($this->db, $paymenttypeid, 'c_paiement', 'id', 'code'); - $this->object_data->payment_num = $object->num_paiement; + $this->object_data->payment_num = ($object->num_paiement?$object->num_paiement:$object->num_payment); //$this->object_data->fk_account = $object->fk_account; $this->object_data->note = $object->note; //var_dump($this->object_data);exit; $totalamount=0; + if (! is_array($object->amounts) && $object->amount) + { + $object->amounts=array($object->id => $object->amount); + } + $paymentpartnumber=0; foreach($object->amounts as $objid => $amount) { @@ -439,26 +454,41 @@ class BlockedLog include_once DOL_DOCUMENT_ROOT.'/don/class/don.class.php'; $tmpobject = new Don($this->db); } + elseif ($this->element == 'payment_various') + { + include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/paymentvarious.class.php'; + $tmpobject = new PaymentVarious($this->db); + } + if (! is_object($tmpobject)) { continue; } $result = $tmpobject->fetch($objid); + if ($result <= 0) { $this->error = $tmpobject->error; $this->errors = $tmpobject->errors; + dol_syslog("Failed to fetch object with id ".$objid, LOG_ERR); return -1; } $paymentpart = new stdClass(); $paymentpart->amount = $amount; - if ($this->element != 'payment_donation') + if (! in_array($this->element, array('payment_donation', 'payment_various'))) { $result = $tmpobject->fetch_thirdparty(); - if ($result <= 0) + if ($result == 0) + { + $this->error='Failed to fetch thirdparty for object with id '.$tmpobject->id; + $this->errors[] = $this->error; + dol_syslog("Failed to fetch thirdparty for object with id ".$tmpobject->id, LOG_ERR); + return -1; + } + elseif ($result < 0) { $this->error = $tmpobject->error; $this->errors = $tmpobject->errors; @@ -481,21 +511,25 @@ class BlockedLog if ($this->element == 'payment_donation') $paymentpart->donation = new stdClass(); else $paymentpart->invoice = new stdClass(); - foreach($tmpobject as $key=>$value) + if ($this->element != 'payment_various') { - if (in_array($key, array('fields'))) continue; // Discard some properties - if (! in_array($key, array( - 'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' - ))) continue; // Discard if not into a dedicated list - if (!is_object($value)) + foreach($tmpobject as $key=>$value) { - if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value; - else $paymentpart->invoice->{$key} = $value; + if (in_array($key, array('fields'))) continue; // Discard some properties + if (! in_array($key, array( + 'ref','facnumber','ref_client','ref_supplier','date','datef','type','total_ht','total_tva','total_ttc','localtax1','localtax2','revenuestamp','datepointoftax','note_public' + ))) continue; // Discard if not into a dedicated list + if (!is_object($value)) + { + if ($this->element == 'payment_donation') $paymentpart->donation->{$key} = $value; + elseif ($this->element == 'payment_various') $paymentpart->various->{$key} = $value; + else $paymentpart->invoice->{$key} = $value; + } } - } - $paymentpartnumber++; - $this->object_data->payment_part[$paymentpartnumber] = $paymentpart; + $paymentpartnumber++; // first payment will be 1 + $this->object_data->payment_part[$paymentpartnumber] = $paymentpart; + } } $this->object_data->amount = $totalamount; diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 87594b2031f..5658460927c 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -825,7 +825,7 @@ class Categorie extends CommonObject $sql = "SELECT c.fk_" . $this->MAP_CAT_FK[$type]; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as c"; $sql .= ", " . MAIN_DB_PREFIX . $this->MAP_OBJ_TABLE[$type] . " as o"; - $sql .= " WHERE o.entity IN (" . getEntity( $obj->element, 1).")"; + $sql .= " WHERE o.entity IN (" . getEntity( $obj->element).")"; $sql.= " AND c.fk_categorie = ".$this->id; $sql .= " AND c.fk_" . $this->MAP_CAT_FK[$type] . " = o.rowid"; @@ -1066,7 +1066,7 @@ class Categorie extends CommonObject if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ", t.label as label_trans, t.description as description_trans"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie as c"; if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."categorie_lang as t ON t.fk_category=c.rowid AND t.lang='".$current_lang."'"; - $sql .= " WHERE c.entity IN (" . getEntity( 'category', 1 ) . ")"; + $sql .= " WHERE c.entity IN (" . getEntity( 'category') . ")"; $sql .= " AND c.type = " . $type; dol_syslog(get_class($this)."::get_full_arbo get category list", LOG_DEBUG); @@ -1481,7 +1481,7 @@ class Categorie extends CommonObject $sql = "SELECT ct.fk_categorie, c.label, c.rowid"; $sql .= " FROM " . MAIN_DB_PREFIX . "categorie_" . $this->MAP_CAT_TABLE[$type] . " as ct, " . MAIN_DB_PREFIX . "categorie as c"; $sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . (int) $id . " AND c.type = " . $this->MAP_ID[$type]; - $sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")"; + $sql .= " AND c.entity IN (" . getEntity( 'category') . ")"; $res = $this->db->query($sql); if ($res) @@ -1542,7 +1542,7 @@ class Categorie extends CommonObject // Generation requete recherche $sql = "SELECT rowid FROM " . MAIN_DB_PREFIX . "categorie"; $sql .= " WHERE type = " . $this->MAP_ID[$type]; - $sql .= " AND entity IN (" . getEntity( 'category', 1 ) . ")"; + $sql .= " AND entity IN (" . getEntity( 'category') . ")"; if ($nom) { if (! $exact) diff --git a/htdocs/comm/card.php b/htdocs/comm/card.php index fa2af2dc3eb..902b49a8231 100644 --- a/htdocs/comm/card.php +++ b/htdocs/comm/card.php @@ -1245,7 +1245,7 @@ if ($object->id > 0) print ''; - if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_CUSTOMER_CARD)) { // List of contacts show_contacts($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 9edad60f400..c394ef69d8d 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -470,7 +470,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; - $sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")"; + $sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = $socid"; $sql .= " ORDER BY s.tms DESC"; @@ -534,7 +534,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; - $sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")"; + $sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; if (! $user->rights->societe->client->voir && ! $user->societe_id) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = ".$socid; $sql.= " ORDER BY s.datec DESC"; diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index cedd04c46c1..db19e943b4b 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -156,6 +156,7 @@ if (empty($reshook)) $sql = "SELECT mc.rowid, mc.fk_mailing, mc.lastname, mc.firstname, mc.email, mc.other, mc.source_url, mc.source_id, mc.source_type, mc.tag"; $sql .= " FROM ".MAIN_DB_PREFIX."mailing_cibles as mc"; $sql .= " WHERE mc.statut < 1 AND mc.fk_mailing = ".$object->id; + $sql .= " ORDER BY mc.statut DESC"; // first status 0, then status -1 dol_syslog("card.php: select targets", LOG_DEBUG); $resql=$db->query($sql); @@ -840,7 +841,7 @@ else if (! empty($conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS)) setEventMessages($langs->trans("MailSendSetupIs3", $conf->global->MAILING_SMTP_SETUP_EMAILS_FOR_QUESTIONS), null, 'warnings'); $_GET["action"]=''; } - else if ($conf->global->MAILING_LIMIT_SENDBYWEB == '-1') + else if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) { if (! empty($conf->global->MAILING_LIMIT_WARNING_PHPMAIL) && $sendingmode == 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_PHPMAIL), null, 'warnings'); if (! empty($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL) && $sendingmode != 'mail') setEventMessages($langs->transnoentitiesnoconv($conf->global->MAILING_LIMIT_WARNING_NOPHPMAIL), null, 'warnings'); @@ -875,7 +876,16 @@ else $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; - if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + $nbtry = $nbok = 0; + if ($object->statut == 2 || $object->statut == 3) + { + $nbtry = $object->countNbOfTargets('alreadysent'); + $nbko = $object->countNbOfTargets('alreadysentko'); + + $morehtmlright.=' ('.$nbtry.'/'.$object->nbemail; + if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlright.=')   '; + } dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); @@ -903,11 +913,11 @@ else print ''; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); - if ($object->statut != 3 && is_numeric($nbemail)) + $nbemail = ($object->nbemail?$object->nbemail:0); + if (is_numeric($nbemail)) { $text=''; - if (! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) { if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) { @@ -915,9 +925,10 @@ else } else { - $text.=$langs->trans('NotEnoughPermissions'); + $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed'); } } + if (empty($nbemail)) $nbemail.=' '.img_warning('').' '.$langs->trans("NoTargetYet").''; if ($text) { print $form->textwithpicto($nbemail,$text,1,'warning'); @@ -1008,7 +1019,11 @@ else if (($object->statut == 1 || $object->statut == 2) && $object->nbemail > 0 && $user->rights->mailing->valider) { - if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send)) + if ($conf->global->MAILING_LIMIT_SENDBYWEB < 0) + { + print ''.$langs->trans("SendMailing").''; + } + else if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! $user->rights->mailing->mailing_advance->send) { print ''.$langs->trans("SendMailing").''; } @@ -1183,15 +1198,30 @@ else print ''; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - $nbemail = ($object->nbemail?$object->nbemail:img_warning('').' '.$langs->trans("NoTargetYet").''); - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && is_numeric($nbemail) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) + $nbemail = ($object->nbemail?$object->nbemail:0); + if (is_numeric($nbemail)) { - $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - else - { - print $nbemail; + $text=''; + if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) + { + if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) + { + $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); + } + else + { + $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed'); + } + } + if (empty($nbemail)) $nbemail.=' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + if ($text) + { + print $form->textwithpicto($nbemail,$text,1,'warning'); + } + else + { + print $nbemail; + } } print ''; diff --git a/htdocs/comm/mailing/cibles.php b/htdocs/comm/mailing/cibles.php index 7729c2737cc..57af9f5c601 100644 --- a/htdocs/comm/mailing/cibles.php +++ b/htdocs/comm/mailing/cibles.php @@ -171,6 +171,7 @@ if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x', /* * View */ + llxHeader('',$langs->trans("Mailing"),'EN:Module_EMailing|FR:Module_Mailing|ES:Módulo_Mailing'); $form = new Form($db); @@ -185,7 +186,16 @@ if ($object->fetch($id) >= 0) $linkback = ''.$langs->trans("BackToList").''; $morehtmlright=''; - if ($object->statut == 2) $morehtmlright.=' ('.$object->countNbOfTargets('alreadysent').'/'.$object->nbemail.') '; + $nbtry = $nbok = 0; + if ($object->statut == 2 || $object->statut == 3) + { + $nbtry = $object->countNbOfTargets('alreadysent'); + $nbko = $object->countNbOfTargets('alreadysentko'); + + $morehtmlright.=' ('.$nbtry.'/'.$object->nbemail; + if ($nbko) $morehtmlright.=' - '.$nbko.' '.$langs->trans("Error"); + $morehtmlright.=')   '; + } dol_banner_tab($object, 'id', $linkback, 1, 'rowid', 'ref', '', '', 0, '', $morehtmlright); @@ -206,15 +216,30 @@ if ($object->fetch($id) >= 0) print ''; print $langs->trans("TotalNbOfDistinctRecipients"); print ''; - $nbemail = ($object->nbemail?$object->nbemail:'0'); - if (!empty($conf->global->MAILING_LIMIT_SENDBYWEB) && ($conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || $object->statut == 2)) + $nbemail = ($object->nbemail?$object->nbemail:0); + if (is_numeric($nbemail)) { - $text=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); - print $form->textwithpicto($nbemail,$text,1,'warning'); - } - else - { - print $nbemail; + $text=''; + if ((! empty($conf->global->MAILING_LIMIT_SENDBYWEB) && $conf->global->MAILING_LIMIT_SENDBYWEB < $nbemail) && ($object->statut == 1 || ($object->statut == 2 && $nbtry < $nbemail))) + { + if ($conf->global->MAILING_LIMIT_SENDBYWEB > 0) + { + $text.=$langs->trans('LimitSendingEmailing',$conf->global->MAILING_LIMIT_SENDBYWEB); + } + else + { + $text.=$langs->trans('SendingFromWebInterfaceIsNotAllowed'); + } + } + if (empty($nbemail)) $nbemail.=' '.img_warning('').' '.$langs->trans("NoTargetYet").''; + if ($text) + { + print $form->textwithpicto($nbemail,$text,1,'warning'); + } + else + { + print $nbemail; + } } print ''; @@ -411,6 +436,8 @@ if ($object->fetch($id) >= 0) $num = $db->num_rows($resql); $param = "&id=".$object->id; + //if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($search_lastname) $param.= "&search_lastname=".urlencode($search_lastname); if ($search_firstname) $param.= "&search_firstname=".urlencode($search_firstname); if ($search_email) $param.= "&search_email=".urlencode($search_email); @@ -552,7 +579,7 @@ if ($object->fetch($id) >= 0) } print ''; - // Statut pour l'email destinataire (Attentioon != statut du mailing) + // Status of recipient sending email (Warning != status of emailing) if ($obj->statut == 0) { print ' '; @@ -563,18 +590,22 @@ if ($object->fetch($id) >= 0) { print ''.$obj->date_envoi.''; print ''; - print $object::libStatutDest($obj->statut,2,$obj->error_text); + print $object::libStatutDest($obj->statut, 2, $obj->error_text); print ''; } // Search Icon print ''; - if ($obj->statut == 0) + if ($obj->statut == 0) // Not sent yet { if ($user->rights->mailing->creer && $allowaddtarget) { - print ''.img_delete($langs->trans("RemoveRecipient")); + print ''.img_delete($langs->trans("RemoveRecipient")).''; } } + /*if ($obj->statut == -1) // Sent with error + { + print ''.$langs->trans("Retry").''; + }*/ print ''; print ''; diff --git a/htdocs/comm/mailing/class/mailing.class.php b/htdocs/comm/mailing/class/mailing.class.php index 72c2b6d4690..63fc0a2caab 100644 --- a/htdocs/comm/mailing/class/mailing.class.php +++ b/htdocs/comm/mailing/class/mailing.class.php @@ -34,7 +34,7 @@ class Mailing extends CommonObject public $element='mailing'; public $table_element='mailing'; public $picto='email'; - + var $titre; var $sujet; var $body; @@ -43,7 +43,7 @@ class Mailing extends CommonObject var $bgimage; var $statut; // Status 0=Draft, 1=Validated, 2=Sent partially, 3=Sent completely - + var $email_from; var $email_replyto; var $email_errorsto; @@ -431,7 +431,7 @@ class Mailing extends CommonObject return -1; } } - + /** * Delete targets emailing * @@ -481,11 +481,11 @@ class Mailing extends CommonObject } } - + /** * Count number of target with status * - * @param string $mode Mode ('alreadysent' = Sent success or error) + * @param string $mode Mode ('alreadysent' = Sent success or error, 'alreadysentok' = Sent success, 'alreadysentko' = Sent error) * @return int Nb of target with status */ function countNbOfTargets($mode) @@ -493,12 +493,14 @@ class Mailing extends CommonObject $sql = "SELECT COUNT(rowid) as nb FROM ".MAIN_DB_PREFIX."mailing_cibles"; $sql.= " WHERE fk_mailing = ".$this->id; if ($mode == 'alreadysent') $sql.= " AND statut <> 0"; - else + elseif ($mode == 'alreadysentok') $sql.= " AND statut > 0"; + elseif ($mode == 'alreadysentko') $sql.= " AND statut = -1"; + else { $this->error='BadValueForParameterMode'; return -2; } - + $resql=$this->db->query($sql); if ($resql) { @@ -512,10 +514,10 @@ class Mailing extends CommonObject } return 0; } - + /** - * Retourne le libelle du statut d'un mailing (brouillon, validee, ... + * Return label of status of emailing (draft, validated, ...) * * @param int $mode 0=libelle long, 1=libelle court, 2=Picto + Libelle court, 3=Picto, 4=Picto + Libelle long * @return string Label diff --git a/htdocs/comm/prospect/index.php b/htdocs/comm/prospect/index.php index 0ec6f20ae46..8db5308bf3f 100644 --- a/htdocs/comm/prospect/index.php +++ b/htdocs/comm/prospect/index.php @@ -76,7 +76,7 @@ $sql.= ", ".MAIN_DB_PREFIX."c_stcomm as st "; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fk_stcomm = st.id"; $sql.= " AND s.client IN (2, 3)"; -$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")"; +$sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY st.id"; $sql.= " ORDER BY st.id"; @@ -96,7 +96,7 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - + print ''; print ''; print img_action($langs->trans("Show"),$obj->id).' '; @@ -140,7 +140,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - + print ''; print ''.img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; print ''; @@ -150,7 +150,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) $total += $obj->price; } if ($total>0) { - + print ''.$langs->trans("Total")."".price($total).""; } print "
"; @@ -205,7 +205,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propale->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - + print ''; print ''; print img_object($langs->trans("ShowPropal"),"propal").' '.$obj->ref.''; @@ -243,7 +243,7 @@ $sql = "SELECT s.nom as name, s.rowid as socid, s.client, s.canvas"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fk_stcomm = 1"; -$sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")"; +$sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " ORDER BY s.tms ASC"; $sql.= $db->plimit(15, 0); @@ -263,7 +263,7 @@ if ($resql) while ($i < $num) { $obj = $db->fetch_object($resql); - + print ''; $companystatic->id=$obj->socid; $companystatic->name=$obj->name; diff --git a/htdocs/commande/class/api_orders.class.php b/htdocs/commande/class/api_orders.class.php index e1edde93922..7ed5e3097bf 100644 --- a/htdocs/commande/class/api_orders.class.php +++ b/htdocs/commande/class/api_orders.class.php @@ -424,14 +424,6 @@ class Orders extends DolibarrApi if ($this->commande->availability($this->commande->availability_id) < 0) throw new RestException(400, 'Error while updating availability'); } - // update bank account - if(!empty($this->commande->fk_account)) - { - if($this->commande->setBankAccount($this->commande->fk_account) == 0) - { - throw new RestException(400,$this->commande->error); - } - } if ($this->commande->update(DolibarrApiAccess::$user) > 0) { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 7998a25bd13..65b704693fb 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3036,6 +3036,8 @@ class Commande extends CommonOrder */ function update(User $user, $notrigger=0) { + global $conf; + $error=0; // Clean parameters @@ -3069,6 +3071,7 @@ class Commande extends CommonOrder $sql.= " fk_projet=".(isset($this->fk_project)?$this->fk_project:"null").","; $sql.= " fk_cond_reglement=".(isset($this->cond_reglement_id)?$this->cond_reglement_id:"null").","; $sql.= " fk_mode_reglement=".(isset($this->mode_reglement_id)?$this->mode_reglement_id:"null").","; + $sql.= " fk_account=".($this->fk_account>0?$this->fk_account:"null").","; $sql.= " note_private=".(isset($this->note_private)?"'".$this->db->escape($this->note_private)."'":"null").","; $sql.= " note_public=".(isset($this->note_public)?"'".$this->db->escape($this->note_public)."'":"null").","; $sql.= " model_pdf=".(isset($this->modelpdf)?"'".$this->db->escape($this->modelpdf)."'":"null").","; diff --git a/htdocs/compta/bank/class/paymentvarious.class.php b/htdocs/compta/bank/class/paymentvarious.class.php index 5922b3f5aa7..fe56ea99504 100644 --- a/htdocs/compta/bank/class/paymentvarious.class.php +++ b/htdocs/compta/bank/class/paymentvarious.class.php @@ -34,6 +34,8 @@ class PaymentVarious extends CommonObject public $table_element='payment_various'; //!< Name of table without prefix where object is stored public $picto = 'bill'; + var $id; + var $ref; var $tms; var $datep; var $datev; @@ -87,8 +89,7 @@ class PaymentVarious extends CommonObject // Update request $sql = "UPDATE ".MAIN_DB_PREFIX."payment_various SET"; - - $sql.= " tms='".$this->db->idate($this->tms)."',"; + if ($this->tms) $sql.= " tms='".$this->db->idate($this->tms)."',"; $sql.= " datep='".$this->db->idate($this->datep)."',"; $sql.= " datev='".$this->db->idate($this->datev)."',"; $sql.= " sens=".$this->sens.","; @@ -102,7 +103,6 @@ class PaymentVarious extends CommonObject $sql.= " fk_bank=".($this->fk_bank > 0 ? $this->fk_bank:"null").","; $sql.= " fk_user_author=".$this->fk_user_author.","; $sql.= " fk_user_modif=".$this->fk_user_modif; - $sql.= " WHERE rowid=".$this->id; dol_syslog(get_class($this)."::update", LOG_DEBUG); @@ -146,7 +146,6 @@ class PaymentVarious extends CommonObject global $langs; $sql = "SELECT"; $sql.= " v.rowid,"; - $sql.= " v.tms,"; $sql.= " v.datep,"; $sql.= " v.datev,"; @@ -164,7 +163,6 @@ class PaymentVarious extends CommonObject $sql.= " b.fk_account,"; $sql.= " b.fk_type,"; $sql.= " b.rappro"; - $sql.= " FROM ".MAIN_DB_PREFIX."payment_various as v"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank as b ON v.fk_bank = b.rowid"; $sql.= " WHERE v.rowid = ".$id; @@ -184,7 +182,7 @@ class PaymentVarious extends CommonObject $this->datev = $this->db->jdate($obj->datev); $this->sens = $obj->sens; $this->amount = $obj->amount; - $this->type_payement = $obj->fk_typepayment; + $this->type_payment = $obj->fk_typepayment; $this->num_payment = $obj->num_payment; $this->label = $obj->label; $this->note = $obj->note; @@ -350,6 +348,7 @@ class PaymentVarious extends CommonObject if ($result) { $this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."payment_various"); + $this->ref = $this->id; if ($this->id > 0) { diff --git a/htdocs/compta/bank/various_payment/card.php b/htdocs/compta/bank/various_payment/card.php index 90aa3e5e432..b6649250e64 100644 --- a/htdocs/compta/bank/various_payment/card.php +++ b/htdocs/compta/bank/various_payment/card.php @@ -49,7 +49,7 @@ $sens=GETPOST("sens","int"); $amount=GETPOST("amount"); $paymenttype=GETPOST("paymenttype"); $accountancy_code=GETPOST("accountancy_code","int"); -$projectid = (GETPOST('projectid') ? GETPOST('projectid', 'int') : 0); +$projectid = (GETPOST('projectid','int') ? GETPOST('projectid', 'int') : GETPOST('fk_project','int')); // Security check $socid = GETPOST("socid","int"); @@ -96,22 +96,23 @@ if (empty($reshook)) { $error=0; - $datep=dol_mktime(12,0,0, GETPOST("datepmonth"), GETPOST("datepday"), GETPOST("datepyear")); - $datev=dol_mktime(12,0,0, GETPOST("datevmonth"), GETPOST("datevday"), GETPOST("datevyear")); + $datep=dol_mktime(12,0,0, GETPOST("datepmonth",'int'), GETPOST("datepday",'int'), GETPOST("datepyear",'int')); + $datev=dol_mktime(12,0,0, GETPOST("datevmonth",'int'), GETPOST("datevday",'int'), GETPOST("datevyear",'int')); if (empty($datev)) $datev=$datep; - $object->accountid=GETPOST("accountid") > 0 ? GETPOST("accountid","int") : 0; + $object->ref=''; // TODO + $object->accountid=GETPOST("accountid",'int') > 0 ? GETPOST("accountid","int") : 0; $object->datev=$datev; $object->datep=$datep; - $object->amount=price2num(GETPOST("amount")); - $object->label=GETPOST("label"); - $object->note=GETPOST("note"); - $object->type_payment=GETPOST("paymenttype") > 0 ? GETPOST("paymenttype", "int") : 0; - $object->num_payment=GETPOST("num_payment"); + $object->amount=price2num(GETPOST("amount",'alpha')); + $object->label=GETPOST("label",'none'); + $object->note=GETPOST("note",'none'); + $object->type_payment=GETPOST("paymenttype",'int') > 0 ? GETPOST("paymenttype", "int") : 0; + $object->num_payment=GETPOST("num_payment",'alpha'); $object->fk_user_author=$user->id; $object->accountancy_code=GETPOST("accountancy_code") > 0 ? GETPOST("accountancy_code","int") : ""; $object->sens=GETPOST('sens'); - $object->fk_project= GETPOST('fk_project'); + $object->fk_project= GETPOST('fk_project','int'); if (empty($datep) || empty($datev)) { @@ -411,7 +412,7 @@ if ($id) print ''; // Label - print ''; + print ''; // Payment date print ""; diff --git a/htdocs/compta/bank/various_payment/index.php b/htdocs/compta/bank/various_payment/index.php index e32dc8818e2..d52cbeb7595 100644 --- a/htdocs/compta/bank/various_payment/index.php +++ b/htdocs/compta/bank/various_payment/index.php @@ -108,21 +108,19 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_account as ba ON b.fk_account = ba.row $sql.= " WHERE v.entity IN (".getEntity('payment_various').")"; // Search criteria -if ($search_ref) $sql.=" AND v.rowid=".$search_ref; -if ($search_label) $sql.=natural_search(array('v.label'), $search_label); -if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); -if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); -if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; -if ($search_date) $sql.=" AND v.datep=".$search_date; -if ($search_accountancy_code) $sql.=" AND v.accountancy_code=".$search_accountancy_code; - +if ($search_ref) $sql.=" AND v.rowid=".$search_ref; +if ($search_label) $sql.=natural_search(array('v.label'), $search_label); +if ($search_amount_deb) $sql.=natural_search("v.amount", $search_amount_deb, 1); +if ($search_amount_cred) $sql.=natural_search("v.amount", $search_amount_cred, 1); +if ($search_account > 0) $sql.=" AND b.fk_account=".$search_account; +if ($search_date) $sql.=" AND v.datep=".$search_date; +if ($search_accountancy_code > 0) $sql.=" AND v.accountancy_code=".$search_accountancy_code; +if ($typeid > 0) $sql .= " AND v.fk_typepayment=".$typeid; if ($filtre) { $filtre=str_replace(":","=",$filtre); $sql .= " AND ".$filtre; } -if ($typeid) { - $sql .= " AND v.fk_typepayment=".$typeid; -} + $sql.= $db->order($sortfield,$sortorder); $totalnboflines=0; @@ -142,10 +140,18 @@ if ($result) $var=true; $param=''; - if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - if ($typeid) $param.='&typeid='.$typeid; - if ($optioncss != '') $param.='&optioncss='.$optioncss; + if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_label) $param.='&search_label='.urlencode($search_label); + if ($typeid > 0) $param.='&typeid='.urlencode($typeid); + if ($search_amount_deb) $param.='&search_amount_deb='.urlencode($search_amount_deb); + if ($search_amount_cred) $param.='&search_amount_cred='.urlencode($search_amount_cred); + if ($search_account > 0) $param.='&search_amount='.urlencode($search_account); + //if ($search_date) $param.='&search_date='.$search_date; + if ($search_accountancy_code > 0) $param.='&search_accountancy_code='.urlencode($search_accountancy_code); + + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); print ''; @@ -162,18 +168,6 @@ if ($result) print '
'; print '
'.$langs->trans("Label").''.$object->label.'
'.$langs->trans("Label").''.$object->label.'
'."\n"; - print ''; - print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder); - print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); - print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); - if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); - if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); - print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); - print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); - print "\n"; - print ''; // Ref @@ -227,6 +221,20 @@ if ($result) print "\n"; + + print ''; + print_liste_field_titre("Ref",$_SERVER["PHP_SELF"],"v.rowid","",$param,"",$sortfield,$sortorder); + print_liste_field_titre("Label",$_SERVER["PHP_SELF"],"v.label","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("DatePayment",$_SERVER["PHP_SELF"],"v.datep","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre("PaymentMode",$_SERVER["PHP_SELF"],"type","",$param,'align="left"',$sortfield,$sortorder); + if (! empty($conf->banque->enabled)) print_liste_field_titre("BankAccount",$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + if (! empty($conf->accounting->enabled)) print_liste_field_titre("AccountAccounting",$_SERVER["PHP_SELF"],"v.accountancy_code","",$param,'align="left"',$sortfield,$sortorder); + print_liste_field_titre("Debit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre("Credit",$_SERVER["PHP_SELF"],"v.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre('',$_SERVER["PHP_SELF"],"",'','','',$sortfield,$sortorder,'maxwidthsearch '); + print "\n"; + + $totalarray=array(); while ($i < min($num,$limit)) { diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index c299c1d1de5..cd436543079 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -1570,7 +1570,7 @@ if (empty($reshook)) setEventMessages($langs->trans('ErrorFieldRequired', $langs->transnoentitiesnoconv('Type')), null, 'errors'); $error ++; } - if ($prod_entry_mode == 'free' && empty($idprod) && (! ($price_ht >= 0) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' + if ($prod_entry_mode == 'free' && empty($idprod) && (($price_ht < 0 && empty($conf->global->FACTURE_ENABLE_NEGATIVE_LINES)) || $price_ht == '') && $price_ht_devise == '') // Unit price can be 0 but not '' { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("UnitPriceHT")), null, 'errors'); $error ++; @@ -3047,10 +3047,10 @@ else if ($id > 0 || ! empty($ref)) } } - // Confirmation de la validation + // Confirmation of validation if ($action == 'valid') { - // on verifie si l'objet est en numerotation provisoire + // we check object has a draft number $objectref = substr($object->ref, 1, 4); if ($objectref == 'PROV') { $savdate = $object->date; diff --git a/htdocs/compta/tva/class/tva.class.php b/htdocs/compta/tva/class/tva.class.php index ee34124b118..b951c05f574 100644 --- a/htdocs/compta/tva/class/tva.class.php +++ b/htdocs/compta/tva/class/tva.class.php @@ -652,23 +652,42 @@ class Tva extends CommonObject * * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto * @param string $option link option + * @param int $notooltip 1=Disable tooltip * @return string Chaine with URL */ - function getNomUrl($withpicto=0,$option='') + function getNomUrl($withpicto=0, $option='', $notooltip=0) { global $langs; $result=''; $label=$langs->trans("ShowVatPayment").': '.$this->ref; - $link = ''; - $linkend=''; + $url = DOL_URL_ROOT.'/compta/tva/card.php?id='.$this->id; + + $linkclose=''; + if (empty($notooltip)) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + $label=$langs->trans("ShowMyObject"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; + } + $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; + } + else $linkclose = ($morecss?' class="'.$morecss.'"':''); + + $linkstart = ''; + $linkend =''; $picto='payment'; - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->ref.$linkend; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; + return $result; } diff --git a/htdocs/compta/tva/reglement.php b/htdocs/compta/tva/reglement.php index c411013250f..1a0b0699128 100644 --- a/htdocs/compta/tva/reglement.php +++ b/htdocs/compta/tva/reglement.php @@ -217,8 +217,11 @@ if ($result) $tva_static->id=$obj->rowid; $tva_static->ref=$obj->rowid; + + // Ref print "\n"; - print "\n"; + // Label + print "\n"; print '\n"; print '\n"; // Type diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index 1f307b00c69..f616ca728b6 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -42,6 +42,27 @@ class Contact extends CommonObject public $ismultientitymanaged = 1; // 0=No test on entity, 1=Test with field entity, 2=Test with link by societe public $picto = 'contact'; + + // BEGIN MODULEBUILDER PROPERTIES + /** + * @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor. + */ + public $fields=array( + 'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'), + 'lastname' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'firstname' =>array('type'=>'varchar(128)', 'label'=>'Firstname', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>11, 'searchall'=>1), + 'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20), + 'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>60), + 'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>61), + 'datec' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500), + 'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501), + //'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502), + 'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510), + 'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511), + //'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512), + 'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>1, 'position'=>1000), + ); + public $civility_id; // In fact we store civility_code public $civility_code; public $address; @@ -96,9 +117,15 @@ class Contact extends CommonObject public $user_id; public $user_login; + // END MODULEBUILDER PROPERTIES + + public $oldcopy; // To contains a clone of this when we need to save old properties of object + + + /** * Constructor * @@ -131,7 +158,7 @@ class Contact extends CommonObject $sql.= " WHERE sp.fk_soc = s.rowid AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; $clause = "AND"; } - $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element, 1).')'; + $sql.= ' '.$clause.' sp.entity IN ('.getEntity($this->element).')'; $sql.= " AND (sp.priv='0' OR (sp.priv='1' AND sp.fk_user_creat=".$user->id."))"; if ($user->societe_id > 0) $sql.=" AND sp.fk_soc = ".$user->societe_id; diff --git a/htdocs/core/actions_changeselectedfields.inc.php b/htdocs/core/actions_changeselectedfields.inc.php index 11884f81224..6d39272f74e 100644 --- a/htdocs/core/actions_changeselectedfields.inc.php +++ b/htdocs/core/actions_changeselectedfields.inc.php @@ -33,14 +33,14 @@ if (GETPOST('formfilteraction') == 'listafterchangingselectedfields') $tabparam=array(); $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; - + if (GETPOST("selectedfields")) $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=GETPOST("selectedfields"); else $tabparam["MAIN_SELECTEDFIELDS_".$varpage]=''; include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - + $result=dol_set_user_param($db, $conf, $user, $tabparam); - + //$action='list'; //var_dump($tabparam);exit; } diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 3ccbc05be24..3261572460e 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -84,7 +84,7 @@ class box_produits extends ModeleBoxes { $sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; - $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; + $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; // Add where from hooks diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index e244d276fac..9dc75612773 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -88,7 +88,7 @@ class box_produits_alerte_stock extends ModeleBoxes $sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product"; - $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')'; + $sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element).')'; $sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0"; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index d71277a77ee..7ebd32b30b3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -5849,7 +5849,7 @@ abstract class CommonObject * @param int $dest_id New thirdparty id (the thirdparty that will received element of the other) * @param string[] $tables Tables that need to be changed * @param int $ignoreerrors Ignore errors. Return true even if errors. We need this when replacement can fails like for categories (categorie of old thirdparty may already exists on new one) - * @return bool + * @return bool True if success, False if error */ public static function commonReplaceThirdparty(DoliDB $db, $origin_id, $dest_id, array $tables, $ignoreerrors=0) { diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index dd8081754d8..a1d051440c3 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -259,9 +259,6 @@ class Conf // Load translation object with current language if (empty($this->global->MAIN_LANG_DEFAULT)) $this->global->MAIN_LANG_DEFAULT="en_US"; - //if (! isset($this->global->MAIN_REPEATCONTACTONEACHTAB)) $this->global->MAIN_REPEATCONTACTONEACHTAB=1; - //if (! isset($this->global->MAIN_REPEATADDRESSONEACHTAB)) $this->global->MAIN_REPEATADDRESSONEACHTAB=1; - $rootfordata = DOL_DATA_ROOT; $rootforuser = DOL_DATA_ROOT; // If multicompany module is enabled, we redefine the root of data diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index bc37c428bb6..51a95d3d32e 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -309,7 +309,7 @@ class ExtraFields if (! empty($attrname) && preg_match("/^\w[a-zA-Z0-9-_]*$/",$attrname) && ! is_numeric($attrname)) { - if(is_array($param) && count($param) > 0) + if (is_array($param) && count($param) > 0) { $params = serialize($param); } @@ -627,10 +627,17 @@ class ExtraFields { $this->db->begin(); - if (is_array($param)) + if (is_array($param) && count($param) > 0) { - if (count($param) > 0) $param = $this->db->escape(serialize($param)); - else $param=''; + $params = serialize($param); + } + elseif (strlen($param) > 0) + { + $params = trim($param); + } + else + { + $params=''; } $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."extrafields"; @@ -674,7 +681,7 @@ class ExtraFields $sql.= " ".($langfile?"'".$this->db->escape($langfile)."'":"null").","; $sql.= " ".$pos.","; $sql.= " '".$this->db->escape($alwayseditable)."',"; - $sql.= " '".$this->db->escape($param)."',"; + $sql.= " '".$this->db->escape($params)."',"; $sql.= " ".$list.", "; $sql.= " ".(($default!='')?"'".$this->db->escape($default)."'":"null").","; $sql.= " ".($computed?"'".$this->db->escape($computed)."'":"null").","; @@ -1344,28 +1351,48 @@ class ExtraFields /** * Return HTML string to put an output field into a page * - * @param string $key Key of attribute - * @param string $value Value to show - * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) - * @return string Formated value + * @param string $key Key of attribute + * @param string $value Value to show + * @param string $moreparam To add more parameters on html input tag (only checkbox use html input for output rendering) + * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data + * @return string Formated value */ - function showOutputField($key,$value,$moreparam='') + function showOutputField($key, $value, $moreparam='', $extrafieldsobjectkey='') { global $conf,$langs; - $elementtype=$this->attribute_elementtype[$key]; // seems not used - $label=$this->attribute_label[$key]; - $type=$this->attribute_type[$key]; - $size=$this->attribute_size[$key]; - $default=$this->attribute_default[$key]; - $computed=$this->attribute_computed[$key]; - $unique=$this->attribute_unique[$key]; - $required=$this->attribute_required[$key]; - $param=$this->attribute_param[$key]; - $perms=$this->attribute_perms[$key]; - $langfile=$this->attribute_langfile[$key]; - $list=$this->attribute_list[$key]; - $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + if (! empty($extrafieldsobjectkey)) + { + $elementtype=$this->attributes[$extrafieldsobjectkey]['elementtype'][$key]; // seems not used + $label=$this->attributes[$extrafieldsobjectkey]['label'][$key]; + $type=$this->attributes[$extrafieldsobjectkey]['type'][$key]; + $size=$this->attributes[$extrafieldsobjectkey]['size'][$key]; + $default=$this->attributes[$extrafieldsobjectkey]['default'][$key]; + $computed=$this->attributes[$extrafieldsobjectkey]['computed'][$key]; + $unique=$this->attributes[$extrafieldsobjectkey]['unique'][$key]; + $required=$this->attributes[$extrafieldsobjectkey]['required'][$key]; + $param=$this->attributes[$extrafieldsobjectkey]['param'][$key]; + $perms=$this->attributes[$extrafieldsobjectkey]['perms'][$key]; + $langfile=$this->attributes[$extrafieldsobjectkey]['langfile'][$key]; + $list=$this->attributes[$extrafieldsobjectkey]['list'][$key]; + $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + } + else + { + $elementtype=$this->attribute_elementtype[$key]; // seems not used + $label=$this->attribute_label[$key]; + $type=$this->attribute_type[$key]; + $size=$this->attribute_size[$key]; + $default=$this->attribute_default[$key]; + $computed=$this->attribute_computed[$key]; + $unique=$this->attribute_unique[$key]; + $required=$this->attribute_required[$key]; + $param=$this->attribute_param[$key]; + $perms=$this->attribute_perms[$key]; + $langfile=$this->attribute_langfile[$key]; + $list=$this->attribute_list[$key]; + $hidden=(($list == 0) ? 1 : 0); // If zero, we are sure it is hidden, otherwise we show. If it depends on mode (view/create/edit form or list, this must be filtered by caller) + } if ($hidden) return ''; // This is a protection. If field is hidden, we should just not call this method. @@ -1593,6 +1620,7 @@ class ExtraFields elseif ($type == 'link') { $out=''; + // only if something to display (perf) if ($value) { @@ -1641,14 +1669,16 @@ class ExtraFields /** * Return tag to describe alignement to use for this extrafield * - * @param string $key Key of attribute - * @return string Formated value + * @param string $key Key of attribute + * @param string $extrafieldsobjectkey If defined, use the new method to get extrafields data + * @return string Formated value */ - function getAlignFlag($key) + function getAlignFlag($key, $extrafieldsobjectkey='') { global $conf,$langs; - $type=$this->attribute_type[$key]; + if (! empty($extrafieldsobjectkey)) $type=$this->attributes[$extrafieldsobjectkey]['type'][$key]; + else $type=$this->attribute_type[$key]; $align=''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e3f283368f1..3b773412861 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5275,7 +5275,7 @@ class Form $confkeyforautocompletemode=strtoupper($prefixforautocompletemode).'_USE_SEARCH_TO_SELECT'; // For example COMPANY_USE_SEARCH_TO_SELECT $fieldstoshow='t.ref'; - if (! empty($objecttmp->fields)) + if (! empty($objecttmp->fields)) // For object that declare it, it is better to use declared fields ( like societe, contact, ...) { $tmpfieldstoshow=''; foreach($objecttmp->fields as $key => $val) diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 30719d0da80..94ab828ee39 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -993,7 +993,7 @@ class FormMail extends Form $sql = "SELECT label, topic, joinfiles, content, content_lines, lang"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')"; - $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")"; + $sql.= " AND entity IN (".getEntity('c_email_templates').")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) $sql.=" AND active = ".$active; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; @@ -1065,7 +1065,7 @@ class FormMail extends Form $sql = "SELECT label, topic, content, lang"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " WHERE type_template='".$this->db->escape($type_template)."'"; - $sql.= " AND entity IN (".getEntity('c_email_templates', 0).")"; + $sql.= " AND entity IN (".getEntity('c_email_templates').")"; $sql.= " AND (fk_user is NULL or fk_user = 0 or fk_user = ".$user->id.")"; if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; $sql.= $this->db->order("lang,label","ASC"); @@ -1102,7 +1102,7 @@ class FormMail extends Form $sql = "SELECT rowid, label, topic, content, content_lines, lang, fk_user, private, position"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " WHERE type_template IN ('".$this->db->escape($type_template)."', 'all')"; - $sql.= " AND entity IN (".getEntity('c_email_templates', 1).")"; + $sql.= " AND entity IN (".getEntity('c_email_templates').")"; $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // See all public templates or templates I own. if ($active >= 0) $sql.=" AND active = ".$active; //if (is_object($outputlangs)) $sql.= " AND (lang = '".$outputlangs->defaultlang."' OR lang IS NULL OR lang = '')"; // Return all languages diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 0afae8e358f..f4a6d98c671 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -47,7 +47,7 @@ class FormProjets * Output a combo list with projects qualified for a third party / user * * @param int $socid Id third party (-1=all, 0=only projects not linked to a third party, id=projects not linked or linked to third party id) - * @param int $selected Id project preselected + * @param string $selected Id project preselected ('' or id of project) * @param string $htmlname Name of HTML field * @param int $maxlength Maximum length of label * @param int $option_only Return only html options lines without the select tag diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index 354bbdeddef..0c62c190992 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -640,7 +640,6 @@ function isInEEC($object) function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelink=0, $morehtmlright='') { global $user; - global $bc; $i = -1 ; @@ -768,10 +767,10 @@ function show_projects($conf, $langs, $db, $object, $backtopage='', $nocreatelin */ function show_contacts($conf,$langs,$db,$object,$backtopage='') { - global $user,$conf; - global $bc; + global $user,$conf,$extrafields,$hookmanager; + global $contextpage; - $form= new Form($db); + $form = new Form($db); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); @@ -782,24 +781,67 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $search_addressphone = GETPOST("search_addressphone",'alpha'); if (! $sortorder) $sortorder="ASC"; - if (! $sortfield) $sortfield="p.lastname"; + if (! $sortfield) $sortfield="t.lastname"; + if (! empty($conf->clicktodial->enabled)) + { + $user->fetch_clicktodial(); // lecture des infos de clicktodial du user + } + + + $contactstatic = new Contact($db); + + $extralabels=$extrafields->fetch_name_optionals_label($contactstatic->table_element); + + $contactstatic->fields=array( + 'name' =>array('type'=>'varchar(128)', 'label'=>'Name', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1), + 'poste' =>array('type'=>'varchar(128)', 'label'=>'PostOfFunction', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>20), + 'address' =>array('type'=>'varchar(128)', 'label'=>'Address', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>30), + 'statut' =>array('type'=>'integer', 'label'=>'Status', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'default'=>0, 'index'=>1, 'position'=>40, 'arrayofkeyval'=>array(0=>$contactstatic->LibStatut(0,1), 1=>$contactstatic->LibStatut(1,1))), + ); + + // Definition of fields for list + $arrayfields=array( + 't.rowid'=>array('label'=>"TechnicalID", 'checked'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'enabled'=>($conf->global->MAIN_SHOW_TECHNICAL_ID?1:0), 'position'=>1), + 't.name'=>array('label'=>"Name", 'checked'=>1, 'position'=>10), + 't.poste'=>array('label'=>"PostOrFunction", 'checked'=>1, 'position'=>20), + 't.address'=>array('label'=>(empty($conf->dol_optimize_smallscreen) ? $langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email") : $langs->trans("Address")), 'checked'=>1, 'position'=>30), + 't.statut'=>array('label'=>"Status", 'checked'=>1, 'position'=>40, 'align'=>'center'), + ); + // Extra fields + if (is_array($extrafields->attributes[$contactstatic->table_element]['label']) && count($extrafields->attributes[$contactstatic->table_element]['label'])) + { + foreach($extrafields->attributes[$contactstatic->table_element]['label'] as $key => $val) + { + if (! empty($extrafields->attributes[$contactstatic->table_element]['list'][$key])) $arrayfields["ef.".$key]=array('label'=>$extrafields->attributes[$contactstatic->table_element]['label'][$key], 'checked'=>(($extrafields->attributes[$contactstatic->table_element]['list'][$key]<0)?0:1), 'position'=>$extrafields->attributes[$contactstatic->table_element]['pos'][$key], 'enabled'=>(abs($extrafields->attributes[$contactstatic->table_element]['list'][$key])!=3 && $extrafields->attributes[$contactstatic->table_element]['perms'][$key])); + } + } + + // Initialize array of search criterias + $search=array(); + foreach($contactstatic->fields as $key => $val) + { + if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); + } + + + // Purge search criteria if (GETPOST('button_removefilter_x','alpha') || GETPOST('button_removefilter.x','alpha') ||GETPOST('button_removefilter','alpha')) // All tests are required to be compatible with all browsers { $search_status = ''; $search_name = ''; $search_addressphone = ''; $search_array_options=array(); + + foreach($contactstatic->fields as $key => $val) + { + $search[$key]=''; + } + $toselect=''; } - $i=-1; - - $contactstatic = new Contact($db); - - if (! empty($conf->clicktodial->enabled)) - { - $user->fetch_clicktodial(); // lecture des infos de clicktodial - } + $contactstatic->fields = dol_sort_array($contactstatic->fields, 'position'); + $arrayfields = dol_sort_array($arrayfields, 'position'); $buttoncreate=''; if ($user->rights->societe->contact->creer) @@ -815,25 +857,30 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print load_fiche_titre($title, $buttoncreate,''); print ''; + print ''; print ''; print ''; print ''; print ''; + $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; + $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields + //if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); - print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table - print "\n".'
".$tva_static->getNomUrl(1)."".dol_trunc($obj->label,40)."".dol_trunc($obj->label,40)."'.dol_print_date($db->jdate($obj->dv),'day')."'.dol_print_date($db->jdate($obj->dp),'day')."
'."\n"; + print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table + print "\n".'
'."\n"; $param="socid=".$object->id; if ($search_status != '') $param.='&search_status='.$search_status; if ($search_name != '') $param.='&search_name='.urlencode($search_name); - $sql = "SELECT p.rowid, p.lastname, p.firstname, p.fk_pays as country_id, p.civility, p.poste, p.phone as phone_pro, p.phone_mobile, p.phone_perso, p.fax, p.email, p.skype, p.statut, p.photo,"; - $sql .= " p.civility as civility_id, p.address, p.zip, p.town"; - $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as p"; - $sql .= " WHERE p.fk_soc = ".$object->id; - if ($search_status!='' && $search_status != '-1') $sql .= " AND p.statut = ".$db->escape($search_status); - if ($search_name) $sql .= " AND (p.lastname LIKE '%".$db->escape($search_name)."%' OR p.firstname LIKE '%".$db->escape($search_name)."%')"; + $sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,"; + $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; + $sql .= " FROM ".MAIN_DB_PREFIX."socpeople as t"; + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; + $sql .= " WHERE t.fk_soc = ".$object->id; + if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status); + if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')"; $sql.= " ORDER BY $sortfield $sortorder"; dol_syslog('core/lib/company.lib.php :: show_contacts', LOG_DEBUG); @@ -842,59 +889,63 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $num = $db->num_rows($result); - $colspan=9; - - print ''; - - // Photo - Name - print ''; - - // Position - print ''; - - // Address - Phone - Email - print ''; - - // Status - print ''; - - // Add to agenda - if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) - { - $colspan++; - print ''; - } - - // Action - print ''; - - print ""; - - $titlefieldaddress=$langs->trans("Address").' / '.$langs->trans("Phone").' / '.$langs->trans("Email"); - if (! empty($conf->dol_optimize_smallscreen)) $titlefieldaddress=$langs->trans("Address"); - + // Fields title search + // -------------------------------------------------------------------- print ''; - print_liste_field_titre("Name",$_SERVER["PHP_SELF"],"p.lastname","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Poste",$_SERVER["PHP_SELF"],"p.poste","",$param,'',$sortfield,$sortorder); - print_liste_field_titre($titlefieldaddress,$_SERVER["PHP_SELF"],"","",$param,'',$sortfield,$sortorder); - print_liste_field_titre("Status",$_SERVER["PHP_SELF"],"p.statut","",$param,'align="center"',$sortfield,$sortorder); - // Add to agenda - if (! empty($conf->agenda->enabled) && ! empty($user->rights->agenda->myactions->create)) print_liste_field_titre(''); - // Edit - print_liste_field_titre(''); - print "\n"; + foreach($contactstatic->fields as $key => $val) + { + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) + { + print ''; + } + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; + + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListOption', $parameters, $contactstatic); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Action column + print ''; + print ''."\n"; + + + // Fields title label + // -------------------------------------------------------------------- + print ''; + foreach($contactstatic->fields as $key => $val) + { + $align=''; + if (in_array($val['type'], array('date','datetime','timestamp'))) $align.=($align?' ':'').'center'; + if (in_array($val['type'], array('timestamp'))) $align.=($align?' ':'').'nowrap'; + if ($key == 'status' || $key == 'statut') $align.=($align?' ':'').'center'; + if (! empty($arrayfields['t.'.$key]['checked'])) print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($align?'class="'.$align.'"':''), $sortfield, $sortorder, $align.' ')."\n"; + } + // Extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; + // Hook fields + $parameters=array('arrayfields'=>$arrayfields); + $reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"],'','','','align="center"',$sortfield,$sortorder,'maxwidthsearch ')."\n"; + print ''."\n"; + + $i = -1; if ($num || (GETPOST('button_search') || GETPOST('button_search.x') || GETPOST('button_search_x'))) { - $i=0; + $i = 0; while ($i < $num) { @@ -923,46 +974,81 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $contactstatic->country_code = $country_code; $contactstatic->setGenderFromCivility(); + $contactstatic->fetch_optionals(); + + if (is_array($contactstatic->array_options)) + { + foreach($contactstatic->array_options as $key => $val) + { + $obj->$key = $val; + } + } print ''; + // ID + if (! empty($arrayfields['t.rowid']['checked'])) + { + print ''; + } + // Photo - Name - print ''; + if (! empty($arrayfields['t.name']['checked'])) + { + print ''; + } // Job position - print ''; + if (! empty($arrayfields['t.poste']['checked'])) + { + print ''; + } // Address - Phone - Email - print ''; + if (! empty($arrayfields['t.address']['checked'])) + { + print ''; + } // Status - print ''; + if (! empty($arrayfields['t.statut']['checked'])) + { + print ''; + } - // Add to agenda + // Extra fields + $extrafieldsobjectkey='socpeople'; + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; + + // Actions + print ''; + print '   '; } // Edit if ($user->rights->societe->contact->creer) { - print ''; + print ''; } - else print ''; + + print ''; print "\n"; $i++; @@ -970,9 +1056,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') } else { - print ''; - print ''; - print "\n"; + $colspan=1; + foreach($arrayfields as $key => $val) { if (! empty($val['checked'])) $colspan++; } + print ''; } print "\n
'; - print ''; - print ''; - print ''; - print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); - print ''; - $searchpicto=$form->showFilterButtons(); - print $searchpicto; - print '
'; + if (in_array($key, array('lastname','name'))) print ''; + elseif (in_array($key, array('statut'))) print $form->selectarray('search_status', array('-1'=>'','0'=>$contactstatic->LibStatut(0,1),'1'=>$contactstatic->LibStatut(1,1)),$search_status); + print ''; + $searchpicto=$form->showFilterButtons(); + print $searchpicto; + print '
'; + print $contactstatic->id; + print ''; - print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1); - print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); - print ''; + print $form->showphoto('contact',$contactstatic,0,0,0,'photorefnoborder valignmiddle marginrightonly','small',1,0,1); + print $contactstatic->getNomUrl(0,'',0,'&backtopage='.urlencode($backtopage)); + print ''; - if ($obj->poste) print $obj->poste; - print ''; + if ($obj->poste) print $obj->poste; + print ''; - print $contactstatic->getBannerAddress('contact', $object); - print ''; + print $contactstatic->getBannerAddress('contact', $object); + print ''.$contactstatic->getLibStatut(5).''.$contactstatic->getLibStatut(5).''; + + // Add to agenda if (! empty($conf->agenda->enabled) && $user->rights->agenda->myactions->create) { - print ''; print ''; print img_object($langs->trans("Event"),"action"); - print ''; print ''; print img_edit(); - print ' 
'.$langs->trans("None").'
'.$langs->trans("None").'
\n"; print ''; @@ -995,7 +1081,6 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') function show_addresses($conf,$langs,$db,$object,$backtopage='') { global $user; - global $bc; require_once DOL_DOCUMENT_ROOT.'/societe/class/address.class.php'; @@ -1087,7 +1172,7 @@ function show_addresses($conf,$langs,$db,$object,$backtopage='') */ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$actioncode='') { - global $bc,$user,$conf; + global $user,$conf; $out = show_actions_done($conf,$langs,$db,$filterobj,$objcon,1,$actioncode, 'todo'); @@ -1114,7 +1199,7 @@ function show_actions_todo($conf,$langs,$db,$filterobj,$objcon='',$noprint=0,$ac */ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint=0, $actioncode='', $donetodo='done', $filters=array(), $sortfield='a.datep,a.id', $sortorder='DESC') { - global $bc,$user,$conf; + global $user,$conf; global $form; global $param; @@ -1142,14 +1227,14 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", m.lastname, m.firstname"; if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", o.ref"; if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", o.ref"; - $sql.= " FROM ".MAIN_DB_PREFIX."user as u, ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; + $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."user as u on u.rowid = a.fk_user_action"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_actioncomm as c ON a.fk_action = c.id"; if (is_object($filterobj) && get_class($filterobj) == 'Societe') $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople as sp ON a.fk_contact = sp.rowid"; if (is_object($filterobj) && get_class($filterobj) == 'Adherent') $sql.= ", ".MAIN_DB_PREFIX."adherent as m"; if (is_object($filterobj) && get_class($filterobj) == 'CommandeFournisseur') $sql.= ", ".MAIN_DB_PREFIX."commande_fournisseur as o"; if (is_object($filterobj) && get_class($filterobj) == 'Product') $sql.= ", ".MAIN_DB_PREFIX."product as o"; - $sql.= " WHERE u.rowid = a.fk_user_action"; - $sql.= " AND a.entity IN (".getEntity('agenda').")"; + $sql.= " WHERE a.entity IN (".getEntity('agenda').")"; if (is_object($filterobj) && get_class($filterobj) == 'Societe' && $filterobj->id) $sql.= " AND a.fk_soc = ".$filterobj->id; if (is_object($filterobj) && get_class($filterobj) == 'Project' && $filterobj->id) $sql.= " AND a.fk_project = ".$filterobj->id; if (is_object($filterobj) && get_class($filterobj) == 'Adherent') @@ -1192,7 +1277,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= if ($donetodo == 'done') $sql.= " AND (a.percent = 100 OR (a.percent = -1 AND a.datep <= '".$db->idate($now)."'))"; if (is_array($filters) && $filters['search_agenda_label']) $sql.= natural_search('a.label', $filters['search_agenda_label']); $sql.= $db->order($sortfield, $sortorder); - dol_syslog("company.lib::show_actions_done", LOG_DEBUG); $resql=$db->query($sql); if ($resql) @@ -1298,7 +1382,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= } } - if (! empty($conf->agenda->enabled) || (! empty($conf->mailing->enabled) && ! empty($objcon->email))) { $delay_warning=$conf->global->MAIN_DELAY_ACTIONS_TODO*24*60*60; @@ -1385,7 +1468,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= foreach ($histo as $key=>$value) { - $actionstatic->fetch($histo[$key]['id']); // TODO Do we need this, we already have a lot of data of line into $histo $out.=''; @@ -1407,8 +1489,11 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= //$userstatic->id=$histo[$key]['userid']; //$userstatic->login=$histo[$key]['login']; //$out.=$userstatic->getLoginUrl(1); - $userstatic->fetch($histo[$key]['userid']); - $out.=$userstatic->getNomUrl(-1); + if ($histo[$key]['userid'] > 0) + { + $userstatic->fetch($histo[$key]['userid']); + $out.=$userstatic->getNomUrl(-1); + } $out.=''; // Type @@ -1560,7 +1645,6 @@ function show_actions_done($conf, $langs, $db, $filterobj, $objcon='', $noprint= function show_subsidiaries($conf,$langs,$db,$object) { global $user; - global $bc; $i=-1; diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 699a8955fe8..2dafb56e178 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -111,7 +111,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey', * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project', * 'email_template', 'event', 'donation' - * 'c_paiement', ... + * 'c_paiement', 'c_payment_term', ... * @param int $shared 0=Return id of current entity only, * 1=Return id of current entity + shared entities (default) * @param int $forceentity Entity id diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index 8f912f8dc89..5f5288e7c53 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -995,7 +995,12 @@ function get_next_value($db,$mask,$table,$field,$where='',$objsoc='',$date='',$m else dol_print_error($db); // Check if we must force counter to maskoffset - if (empty($counter) || preg_match('/[^0-9]/i',$counter)) $counter=$maskoffset; + if (empty($counter)) $counter=$maskoffset; + else if (preg_match('/[^0-9]/i',$counter)) + { + $counter=0; + dol_syslog("Error, the last counter found is '".$counter."' so is not a numeric value. We will restart to 1.", LOG_ERR); + } else if ($counter < $maskoffset && empty($conf->global->MAIN_NUMBERING_OFFSET_ONLY_FOR_FIRST)) $counter=$maskoffset; if ($mode == 'last') // We found value for counter = last counter value. Now need to get corresponding ref of invoice. diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 139e192a077..078af5975df 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -686,7 +686,7 @@ class pdf_crabe extends ModelePDFFactures $posy=$this->_tableau_tot($pdf, $object, $deja_regle, $bottomlasttab, $outputlangs); // Affiche zone versements - if ($deja_regle || $amount_credit_notes_included || $amount_deposits_included) + if (($deja_regle || $amount_credit_notes_included || $amount_deposits_included) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { $posy=$this->_tableau_versements($pdf, $object, $posy, $outputlangs); } @@ -1294,7 +1294,7 @@ class pdf_crabe extends ModelePDFFactures $resteapayer = price2num($total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT'); if ($object->paye) $resteapayer=0; - if ($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) + if (($deja_regle > 0 || $creditnoteamount > 0 || $depositsamount > 0) && empty($conf->global->INVOICE_NO_PAYMENT_DETAILS)) { // Already paid + Deposits $index++; diff --git a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php index 7cd86d767ae..58915b7a786 100644 --- a/htdocs/core/tpl/extrafields_list_print_fields.tpl.php +++ b/htdocs/core/tpl/extrafields_list_print_fields.tpl.php @@ -8,32 +8,69 @@ if (empty($conf) || ! is_object($conf)) } // Loop to show all columns of extrafields from $obj, $extrafields and $db -if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) +if (! empty($extrafieldsobjectkey)) // New method: $extrafieldsobject can be 'societe', 'socpeople', ... { - foreach($extrafields->attribute_label as $key => $val) + if (is_array($extrafields->attributes[$extrafieldsobjectkey]['label']) && count($extrafields->attributes[$extrafieldsobjectkey]['label'])) { - if (! empty($arrayfields["ef.".$key]['checked'])) + foreach($extrafields->attributes[$extrafieldsobjectkey]['label'] as $key => $val) { - $align=$extrafields->getAlignFlag($key); - print ''; - $tmpkey='options_'.$key; - if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) + if (! empty($arrayfields["ef.".$key]['checked'])) { - $value = $db->jdate($obj->$tmpkey); + $align=$extrafields->getAlignFlag($key, $extrafieldsobjectkey); + print ''; + $tmpkey='options_'.$key; + if (in_array($extrafields->attributes[$extrafieldsobjectkey]['type'][$key], array('date', 'datetime', 'timestamp'))) + { + $value = $db->jdate($obj->$tmpkey); + } + else + { + $value = $obj->$tmpkey; + } + + print $extrafields->showOutputField($key, $value, '', $extrafieldsobjectkey); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; + $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + } } - else + } + } +} +else // Old method +{ + if (is_array($extrafields->attribute_label) && count($extrafields->attribute_label)) + { + foreach($extrafields->attribute_label as $key => $val) + { + if (! empty($arrayfields["ef.".$key]['checked'])) { - $value = $obj->$tmpkey; - } - print $extrafields->showOutputField($key, $value, ''); - print ''; - if (! $i) $totalarray['nbfield']++; - if (! empty($val['isameasure'])) - { - if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; - $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + $align=$extrafields->getAlignFlag($key); + print ''; + $tmpkey='options_'.$key; + if (in_array($extrafields->attribute_type[$key], array('date', 'datetime', 'timestamp'))) + { + $value = $db->jdate($obj->$tmpkey); + } + else + { + $value = $obj->$tmpkey; + } + print $extrafields->showOutputField($key, $value, ''); + print ''; + if (! $i) $totalarray['nbfield']++; + if (! empty($val['isameasure'])) + { + if (! $i) $totalarray['pos'][$totalarray['nbfield']]='ef.'.$tmpkey; + $totalarray['val']['ef.'.$tmpkey] += $obj->$tmpkey; + } } } } diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 25dc957df02..ec0b0cb6941 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -51,7 +51,7 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers if (empty($conf->blockedlog->enabled)) return 0; // Module not active, we do nothing // Test if event/record is qualified - $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription'); + $listofqualifiedelement = array('facture', 'don', 'payment', 'payment_donation', 'subscription','payment_various'); if (! in_array($object->element, $listofqualifiedelement)) return 1; dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id); @@ -120,9 +120,10 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers $res = $b->create($user); - if ($res<0) + if ($res < 0) { - setEventMessages($b->error, $b->errors, 'errors'); + $this->error = $b->error; + $this->errors = $b->errors; return -1; } else diff --git a/htdocs/fichinter/class/fichinter.class.php b/htdocs/fichinter/class/fichinter.class.php index 237d09570d1..17b8aca8474 100644 --- a/htdocs/fichinter/class/fichinter.class.php +++ b/htdocs/fichinter/class/fichinter.class.php @@ -128,7 +128,7 @@ class Fichinter extends CommonObject $sql.= " WHERE sc.fk_user = " .$user->id; $clause = "AND"; } - $sql.= " ".$clause." fi.entity IN (".getEntity($this->element, 1).")"; + $sql.= " ".$clause." fi.entity IN (".getEntity($this->element).")"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/fourn/card.php b/htdocs/fourn/card.php index 6f473f8deb3..f2ed3005022 100644 --- a/htdocs/fourn/card.php +++ b/htdocs/fourn/card.php @@ -779,7 +779,7 @@ if ($object->id > 0) print ''; - if (! empty($conf->global->MAIN_REPEATCONTACTONEACHTAB)) + if (! empty($conf->global->MAIN_DUPLICATE_CONTACTS_TAB_ON_MAIN_CARD)) { print '
'; // List of contacts diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index cae43a9e3b5..c7b835806c8 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -415,7 +415,7 @@ ExtrafieldParamHelpcheckbox=List of values must be lines with format key,value ( ExtrafieldParamHelpradio=List of values must be lines with format key,value (where key can't be '0')

for example :
1,value1
2,value2
3,value3
... ExtrafieldParamHelpsellist=List of values comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

- idfilter is necessarly a primary int key
- filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list:
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter ExtrafieldParamHelpchkbxlst=List of values comes from a table
Syntax : table_name:label_field:id_field::filter
Example : c_typent:libelle:id::filter

filter can be a simple test (eg active=1) to display only active value
You can also use $ID$ in filter witch is the current id of current object
To do a SELECT in filter use $SEL$
if you want to filter on extrafields use syntax extra.fieldcode=... (where field code is the code of extrafield)

In order to have the list depending on another complementary attribute list :
c_typent:libelle:id:options_parent_list_code|parent_column:filter

In order to have the list depending on another list:
c_typent:libelle:id:parent_list_code|parent_column:filter -ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax : ObjectName:Classpath
Example : Societe:societe/class/societe.class.php +ExtrafieldParamHelplink=Parameters must be ObjectName:Classpath
Syntax : ObjectName:Classpath
Examples :
Societe:societe/class/societe.class.php
Contact:contact/class/contact.class.php LibraryToBuildPDF=Library used for PDF generation WarningUsingFPDF=Warning: Your conf.php contains directive dolibarr_pdf_force_fpdf=1. This means you use the FPDF library to generate PDF files. This library is old and does not support a lot of features (Unicode, image transparency, cyrillic, arab and asiatic languages, ...), so you may experience errors during PDF generation.
To solve this and have a full support of PDF generation, please download TCPDF library, then comment or remove the line $dolibarr_pdf_force_fpdf=1, and add instead $dolibarr_lib_TCPDF_PATH='path_to_TCPDF_dir' LocalTaxDesc=Some countries apply 2 or 3 taxes on each invoice line. If this is the case, choose type for second and third tax and its rate. Possible type are:
1 : local tax apply on products and services without vat (localtax is calculated on amount without tax)
2 : local tax apply on products and services including vat (localtax is calculated on amount + main tax)
3 : local tax apply on products without vat (localtax is calculated on amount without tax)
4 : local tax apply on products including vat (localtax is calculated on amount + main vat)
5 : local tax apply on services without vat (localtax is calculated on amount without tax)
6 : local tax apply on services including vat (localtax is calculated on amount + tax) diff --git a/htdocs/langs/en_US/blockedlog.lang b/htdocs/langs/en_US/blockedlog.lang index 93f64bddbaa..9f6a49a5146 100644 --- a/htdocs/langs/en_US/blockedlog.lang +++ b/htdocs/langs/en_US/blockedlog.lang @@ -14,6 +14,9 @@ OkCheckFingerprintValidityButChainIsKo=Archived log seems valid compared to prev AddedByAuthority=Stored into remote authority NotAddedByAuthorityYet=Not yet stored into remote authority ShowDetails=Show stored details +logPAYMENT_VARIOUS_CREATE=Payment (not assigned to invoice) created +logPAYMENT_VARIOUS_MODIFY=Payment (not assigned to invoice) modified +logPAYMENT_VARIOUS_DELETE=Payment (not assigned to invoice) logical deletion logPAYMENT_ADD_TO_BANK=Payment added to bank logPAYMENT_CUSTOMER_CREATE=Customer payment created logPAYMENT_CUSTOMER_DELETE=Customer payment logical deletion @@ -41,7 +44,7 @@ DownloadLogCSV=Export archived logs (CSV) logDOC_PREVIEW=Preview of a validated document in order to print or download logDOC_DOWNLOAD=Download of a validated document in order to print or send DataOfArchivedEvent=Full datas of archived event -ImpossibleToReloadObject=Object (type %s, id %s) removed (see 'Full data' link for unerasable saved data) +ImpossibleToReloadObject=Original object (type %s, id %s) not linked (see 'Full datas' column to get unalterable saved data) BlockedLogAreRequiredByYourCountryLegislation=Unalterable Logs module may be required by the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit. BlockedLogActivatedBecauseRequiredByYourCountryLegislation=Unalterable Logs module was activated because of the legislation of your country. Disabling this module may render any future transactions invalid with respect to the law and the use of legal software as they can not be validated by a tax audit. BlockedLogDisableNotAllowedForCountry=List of countries where usage of this module is mandatory (just to prevent to disable the module by error, if your country is in this list, disable of module is not possible without editing this list first. Note also that enabling/disabling this module will keep a track into the unalterable log). diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index 4be167d3061..8e2b093fdc2 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -87,6 +87,7 @@ MailingModuleDescEmailsFromFile=Emails from file MailingModuleDescEmailsFromUser=Emails input by user MailingModuleDescDolibarrUsers=Users with Emails MailingModuleDescThirdPartiesByCategories=Third parties (by categories) +SendingFromWebInterfaceIsNotAllowed=Sending from web interface is not allowed. # Libelle des modules de liste de destinataires mailing LineInFile=Line %s in file diff --git a/htdocs/langs/es_ES/accountancy.lang b/htdocs/langs/es_ES/accountancy.lang index a5e4fbdf465..59c20932702 100644 --- a/htdocs/langs/es_ES/accountancy.lang +++ b/htdocs/langs/es_ES/accountancy.lang @@ -25,8 +25,8 @@ Chartofaccounts=Plan contable CurrentDedicatedAccountingAccount=Cuenta contable dedicada AssignDedicatedAccountingAccount=Nueva cuenta a asignar InvoiceLabel=Etiqueta factura -OverviewOfAmountOfLinesNotBound=Ver la cantidad de líneas no ligadas a cuentas contables -OverviewOfAmountOfLinesBound=Ver la cantidad de líneas ligadas a cuentas contables +OverviewOfAmountOfLinesNotBound=Ver la cantidad de líneas no vinculadas a una cuenta contable +OverviewOfAmountOfLinesBound=Ver la cantidad de líneas vinculadas a una cuenta contable OtherInfo=Otra información DeleteCptCategory=Eliminar la cuenta contable del grupo ConfirmDeleteCptCategory=¿Está seguro de querer eliminar esta cuenta contable del grupo de cuentas contables? @@ -158,7 +158,7 @@ NumPiece=Apunte TransactionNumShort=Núm. transacción AccountingCategory=Grupos personalizados GroupByAccountAccounting=Agrupar por cuenta contable -AccountingAccountGroupsDesc=You can define here some groups of accounting account. They will be used for personalized accounting reports. +AccountingAccountGroupsDesc=Puedes definir aquí algunos grupos de cuentas contables. Se usarán para informes de contabilidad personalizados. ByAccounts=Por cuentas ByPredefinedAccountGroups=Por grupos predefinidos ByPersonalizedAccountGroups=Por grupos personalizados @@ -173,7 +173,7 @@ DelBookKeeping=Eliminar los registros del Libro Mayor FinanceJournal=Diario financiero ExpenseReportsJournal=Diario informe de gastos DescFinanceJournal=El diario financiero incluye todos los tipos de pagos por cuenta bancaria -DescJournalOnlyBindedVisible=Esta es una vista de registros que están vinculados a una cuenta contable y pueden ser registrados en el Libro Mayor. +DescJournalOnlyBindedVisible=Esta es una vista del registro vinculado a una cuenta contable y que se puede registrar en el Libro Mayor. VATAccountNotDefined=Cuenta contable para IVA no definida ThirdpartyAccountNotDefined=Cuenta contable de tercero no definida ProductAccountNotDefined=Cuenta contable de producto no definida @@ -191,7 +191,7 @@ DescThirdPartyReport=Consulte aquí el listado de clientes y proveedores y sus c ListAccounts=Listado de cuentas contables UnknownAccountForThirdparty=Cuenta contable de tercero desconocida, usaremos %s UnknownAccountForThirdpartyBlocking=Cuenta contable de tercero desconocida. Error de bloqueo -UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Unknown third party account and waiting account not defined. Blocking error +UnknownAccountForThirdpartyAndWaitingAccountNotDefinedBlocking=Cuenta del terceros desconocida y cuenta de espera no definida. Error de bloqueo Pcgtype=Grupo de cuenta Pcgsubtype=Subgrupo de cuenta @@ -224,6 +224,8 @@ GeneralLedgerSomeRecordWasNotRecorded=Algunas de las operaciones que no podrán NoNewRecordSaved=No hay más registros para el diario ListOfProductsWithoutAccountingAccount=Listado de productos sin cuentas contables ChangeBinding=Cambiar la unión +Accounted=Contabilizada en el Libro Mayor +NotYetAccounted=Aún no contabilizada en el Libro Mayor ## Admin ApplyMassCategories=Aplicar categorías en masa diff --git a/htdocs/langs/es_ES/admin.lang b/htdocs/langs/es_ES/admin.lang index c8e8d5cfe43..02057302f8a 100644 --- a/htdocs/langs/es_ES/admin.lang +++ b/htdocs/langs/es_ES/admin.lang @@ -260,18 +260,18 @@ FontSize=Tamaño de fuente Content=Contenido NoticePeriod=Plazo de aviso NewByMonth=Nuevo por mes -Emails=Emails -EMailsSetup=Configuración emails +Emails=E-Mails +EMailsSetup=Configuración e-mails EMailsDesc=Esta página le permite sobrescribir sus parámetros de PHP para el envío de correos electrónicos. En la mayoría de los casos, en el sistema operativo Unix/Linux, su configuración de PHP es correcta y estos parámetros son inútiles. EmailSenderProfiles=Perfiles de remitentes de e-mails MAIN_MAIL_SMTP_PORT=Puerto del servidor SMTP (Por defecto en php.ini: %s) MAIN_MAIL_SMTP_SERVER=Nombre host o ip del servidor SMTP (Por defecto en php.ini: %s) MAIN_MAIL_SMTP_PORT_NotAvailableOnLinuxLike=Puerto del servidor SMTP (No definido en PHP en sistemas de tipo Unix) MAIN_MAIL_SMTP_SERVER_NotAvailableOnLinuxLike=Nombre servidor o ip del servidor SMTP (No definido en PHP en sistemas de tipo Unix) -MAIN_MAIL_EMAIL_FROM=Correo electrónico del remitente para correos electrónicos automáticos (por defecto en php.ini: %s) -MAIN_MAIL_ERRORS_TO=Correo electrónico del remitente utilizado para los correos electrónicos de error enviados +MAIN_MAIL_EMAIL_FROM=E-mail del remitente para e-mails automáticos (por defecto en php.ini: %s) +MAIN_MAIL_ERRORS_TO=E-mail del remitente utilizado para los e-mails de error enviados MAIN_MAIL_AUTOCOPY_TO= Enviar automáticamente copia oculta de los e-mails enviados a -MAIN_DISABLE_ALL_MAILS=Deshabilitar todos los envíos de correos electrónicos (para propósitos de prueba o demostraciones) +MAIN_DISABLE_ALL_MAILS=Deshabilitar todos los envíos de e-mail (para propósitos de prueba o demostraciones) MAIN_MAIL_SENDMODE=Método de envío de e-mails MAIN_MAIL_SMTPS_ID=ID de autentificación SMTP si se requiere autenticación SMTP MAIN_MAIL_SMTPS_PW=Contraseña autentificación SMTP si se requiere autentificación SMTP @@ -410,11 +410,11 @@ ExtrafieldCheckBoxFromList=Casilla de selección de tabla ExtrafieldLink=Objeto adjuntado ComputedFormula=Campo combinado ComputedFormulaDesc=Puede introducir aquí una fórmula utilizando otras propiedades de objeto o cualquier código PHP para obtener un valor calculado dinámico. Puede utilizar cualquier fórmula compatible con PHP, incluido el operador de condición "?" y los objetos globales siguientes: $db, $conf, $langs, $mysoc, $user, $object.
ATENCIÓN: Sólo algunas propiedades de $object pueden estar disponibles. Si necesita propiedades no cargadas, solo busque el objeto en su fórmula como en el segundo ejemplo.
Usando un campo computado significa que no puede ingresar ningún valor de la interfaz. Además, si hay un error de sintaxis, la fórmula puede devolver nada.

Ejemplo de fórmula:
$object->id < 10 ? round($object->id / 2, 2) : ($object->id + 2 * $user->id) * (int) substr($mysoc->zip, 1, 2)

Ejemlo de recarga de objeto
(($reloadedobj = new Societe($db)) && ($reloadedobj->fetch($obj->id ? $obj->id : ($obj->rowid ? $obj->rowid : $object->id)) > 0)) ? $reloadedobj->array_options['options_extrafieldkey'] * $reloadedobj->capital / 5 : '-1'

Otro ejemplo de fórmula para forzar la carga del objeto y su objeto principal:
(($reloadedobj = new Task($db)) && ($reloadedobj->fetch($object->id) > 0) && ($secondloadedobj = new Project($db)) && ($secondloadedobj->fetch($reloadedobj->fk_project) > 0)) ? $secondloadedobj->ref : 'Parent project not found' -ExtrafieldParamHelpselect=El listado de parámetros tiene que ser key,valor

por ejemplo:
1,value1
2,value2
3,value3
...

Para tener una lista en funcion de atributos complementarios de lista:
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

Para tener la lista en función de otra:
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key +ExtrafieldParamHelpselect=El listado de parámetros tiene que ser key,valor

por ejemplo:
1,value1
2,value2
3,value3
...

Para tener una lista en funcion de campos adicionales de lista:
1,value1|options_parent_list_code:parent_key
2,value2|options_parent_list_code:parent_key

Para tener la lista en función de otra:
1,value1|parent_list_code:parent_key
2,value2|parent_list_code:parent_key ExtrafieldParamHelpcheckbox=El listado de parámetros tiene que ser key,valor

por ejemplo:
1,value1
2,value2
3,value3
... ExtrafieldParamHelpradio=El listado de parámetros tiene que ser key,valor (donde key no puede ser 0)

por ejemplo:
1,value1
2,value2
3,value3
... -ExtrafieldParamHelpsellist=Lista de parámetros proviene de una tabla
Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro
Ejemplo: c_typent: libelle: id :: filtro

filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo
También puede utilizar $ ID $ en el filtro witch es el actual id del objeto actual
Para hacer un SELECT en el filtro de uso $ SEL $
si desea filtrar en extrafields utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de extrafield)

Para que la lista dependa de otra lista de atributos complementarios:
c_typent: libelle: id: options_ parent_list_code | parent_column: filter

Para que la lista dependa de otra lista:
c_typent: libelle: id: parent_list_code | parent_column: filter -ExtrafieldParamHelpchkbxlst=Lista de parámetros proviene de una tabla
Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro
Ejemplo: c_typent: libelle: id :: filtro

filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo
También puede utilizar $ ID $ en el filtro witch es el id actual del objeto actual
Para hacer un SELECT en el filtro de uso $ SEL $
si desea filtrar en extrafields utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de extrafield)

Para que la lista dependa de otra lista de atributos complementarios:
c_typent: libelle: id: options_ parent_list_code | parent_column: filter

Para que la lista dependa de otra lista:
c_typent: libelle: id: parent_list_code | parent_column: filter +ExtrafieldParamHelpsellist=Lista de parámetros proviene de una tabla
Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro
Ejemplo: c_typent: libelle: id :: filtro

filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo
También puede utilizar $ ID $ en el filtro witch es el actual id del objeto actual
Para hacer un SELECT en el filtro de uso $ SEL $
si desea filtrar en campos adicionales utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de campo adicional)

Para que la lista dependa de otra lista de campos adicionales:
c_typent: libelle: id: options_ parent_list_code | parent_column: filter

Para que la lista dependa de otra lista:
c_typent: libelle: id: parent_list_code | parent_column: filter +ExtrafieldParamHelpchkbxlst=Lista de parámetros proviene de una tabla
Sintaxis: nombre_tabla: etiqueta_field: id_field :: filtro
Ejemplo: c_typent: libelle: id :: filtro

filtro puede ser una prueba simple (por ejemplo, activa = 1) Para mostrar sólo el valor activo
También puede utilizar $ ID $ en el filtro witch es el id actual del objeto actual
Para hacer un SELECT en el filtro de uso $ SEL $
si desea filtrar en campos adicionales utilizar la sintaxis Extra.fieldcode = ... (donde código de campo es el código de campo adicional)

Para que la lista dependa de otra lista de campos adicionales:
c_typent: libelle: id: options_ parent_list_code | parent_column: filter

Para que la lista dependa de otra lista:
c_typent: libelle: id: parent_list_code | parent_column: filter ExtrafieldParamHelplink=Los parámetros deben ser ObjectName: Classpath
Sintaxis: ObjectName:Classpath
Ejemplo: Societe:societe/class/societe.class.php LibraryToBuildPDF=Libreria usada en la generación de los PDF WarningUsingFPDF=Atención: Su archivo conf.php contiene la directiva dolibarr_pdf_force_fpdf=1. Esto hace que se use la librería FPDF para generar sus archivos PDF. Esta librería es antigua y no cubre algunas funcionalidades (Unicode, transparencia de imágenes, idiomas cirílicos, árabes o asiáticos, etc.), por lo que puede tener problemas en la generación de los PDF.
Para resolverlo, y disponer de un soporte completo de PDF, puede descargar la librería TCPDF , y a continuación comentar o eliminar la línea $dolibarr_pdf_force_fpdf=1, y añadir en su lugar $dolibarr_lib_TCPDF_PATH='ruta_a_TCPDF' @@ -551,6 +551,8 @@ Module520Desc=Gestión de créditos Module600Name=Notificaciones Module600Desc=Enviar notificaciones por e-mail (desencadenados por algunos eventos) a los usuarios (configuración definida para cada usuario), los contactos de terceros (configuración definida en cada tercero) o e-mails fijos Module600Long=Tenga en cuenta que este módulo está dedicado a enviar mensajes de e-mail en tiempo real cuando se produce un evento. Si está buscando una función para enviar recordatorios por e-mail de los eventos de su agenda, vaya a la configuración del módulo Agenda. +Module610Name=Variantes de productos +Module610Desc=Permite la creación de variantes de productos en función de los atributos (color, tamaño, ...) Module700Name=Donaciones Module700Desc=Gestión de donaciones Module770Name=Informes de gastos @@ -598,7 +600,7 @@ Module10000Name=Sitios web Module10000Desc=Cree sitios web públicos con un editor WYSIWYG. Configure el servidor web (Apache, Nginx,...) para que apunte al directorio dedicado para tenerlo en línea en Internet. Module20000Name=Gestión de días libres retribuidos Module20000Desc=Gestión de los días libres retribuidos de los empleados -Module39000Name=Lotes de producto +Module39000Name=Lotes de productos Module39000Desc=Gestión de lotes o series, fechas de caducidad y venta de los productos Module50000Name=PayBox Module50000Desc=Módulo para ofrecer pagos online aceptando pagos con tarjeta de Débito/Crédito via PayBox. Esto puede ser usado para permitir a tus clientes realizar pagos libres o pagos en un objeto de Dolibarr en particular (factura, pedido...) @@ -824,12 +826,12 @@ Permission1232=Crear facturas de proveedores Permission1233=Validar facturas de proveedores Permission1234=Eliminar facturas de proveedores Permission1235=Enviar facturas de proveedores por correo -Permission1236=Exportar facturas de proveedores, atributos y pagos +Permission1236=Exportar facturas de proveedores, campos adicionales y pagos Permission1237=Exportar pedidos de proveedores junto con sus detalles Permission1251=Lanzar las importaciones en masa a la base de datos (carga de datos) -Permission1321=Exportar facturas a clientes, atributos y cobros +Permission1321=Exportar facturas a clientes, campos adicionales y cobros Permission1322=Reabrir una factura pagada -Permission1421=Exportar pedidos de clientes y atributos +Permission1421=Exportar pedidos de clientes y campos adicionales Permission20001=Leer peticiones días retribuidos (suyos y subordinados) Permission20002=Cear/modificar sus días retribuidos Permission20003=Eliminar peticiones de días retribuidos @@ -890,7 +892,7 @@ DictionaryStaff=Empleados DictionaryAvailability=Tiempos de entrega DictionaryOrderMethods=Métodos de pedido DictionarySource=Orígenes de presupuestos/pedidos -DictionaryAccountancyCategory=Personalized groups for reports +DictionaryAccountancyCategory=Grupos personalizados para imformes DictionaryAccountancysystem=Modelos de planes contables DictionaryAccountancyJournal=Diarios contables DictionaryEMailTemplates=Plantillas E-Mails @@ -1108,23 +1110,23 @@ MAIN_PROXY_HOST=Nombre/Dirección del servidor proxy MAIN_PROXY_PORT=Puerto del servidor proxy MAIN_PROXY_USER=Login del servidor proxy MAIN_PROXY_PASS=Contraseña del servidor proxy -DefineHereComplementaryAttributes=Defina aquí la lista de atributos adicionales, no disponibles por defecto, y que desea gestionar para %s. -ExtraFields=Atributos adicionales -ExtraFieldsLines=Atributos adicionales (líneas) -ExtraFieldsLinesRec=Atributos complementarios (plantillas de líneas de facturas) -ExtraFieldsSupplierOrdersLines=Atributos complementarios (líneas de pedido) -ExtraFieldsSupplierInvoicesLines=Atributos complementarios (líneas de factura) -ExtraFieldsThirdParties=Atributos adicionales (terceros) -ExtraFieldsContacts=Atributos adicionales (contactos/direcciones) -ExtraFieldsMember=Atributos adicionales (miembros) -ExtraFieldsMemberType=Atributos adicionales (tipos de miembros) -ExtraFieldsCustomerInvoices=Atributos adicionales (facturas a clientes) -ExtraFieldsCustomerInvoicesRec=Atributos complementarios (plantillas de facturas) -ExtraFieldsSupplierOrders=Atributos adicionales (pedidos a proveedores) -ExtraFieldsSupplierInvoices=Atributos adicionales (facturas) -ExtraFieldsProject=Atributos adicionales (proyectos) -ExtraFieldsProjectTask=Atributos adicionales (tareas) -ExtraFieldHasWrongValue=El atributo %s tiene un valor no válido +DefineHereComplementaryAttributes=Defina aquí la lista de campos adicionales, no disponibles por defecto, y que desea gestionar para %s. +ExtraFields=Campos adicionales +ExtraFieldsLines=Campos adicionales (líneas) +ExtraFieldsLinesRec=Campos adicionales (plantillas de líneas de facturas) +ExtraFieldsSupplierOrdersLines=Campos adicionales (líneas de pedido) +ExtraFieldsSupplierInvoicesLines=Campos adicionales (líneas de factura) +ExtraFieldsThirdParties=Campos adicionales (terceros) +ExtraFieldsContacts=Campos adicionales (contactos/direcciones) +ExtraFieldsMember=Campos adicionales (miembros) +ExtraFieldsMemberType=Campos adicionales (tipos de miembros) +ExtraFieldsCustomerInvoices=Campos adicionales (facturas a clientes) +ExtraFieldsCustomerInvoicesRec=Campos adicionales (plantillas de facturas) +ExtraFieldsSupplierOrders=Campos adicionales (pedidos a proveedores) +ExtraFieldsSupplierInvoices=Campos adicionales (facturas) +ExtraFieldsProject=Campos adicionales (proyectos) +ExtraFieldsProjectTask=Campos adicionales (tareas) +ExtraFieldHasWrongValue=El campo %s tiene un valor no válido AlphaNumOnlyLowerCharsAndNoSpace=sólo alfanuméricos y minúsculas sin espacio SendmailOptionNotComplete=Atención, en algunos sistemas Linux, con este método de envio, para poder enviar mails en su nombre, la configuración de sendmail debe contener la opción -ba (parámetro mail.force_extra_parameters en el archivo php.ini). Si algunos de sus destinatarios no reciben sus mensajes, pruebe a modificar este parámetro PHP con mail.force_extra_parameters=-ba. PathToDocuments=Rutas de acceso a documentos @@ -1303,17 +1305,17 @@ LDAPContactDnExample=DN completo (ej: ou=contacts,dc=example,dc=com) LDAPMemberDn=DN de los miembros LDAPMemberDnExample=DN completo (ex: ou=members,dc=society,dc=com) LDAPMemberObjectClassList=Lista de objectClass -LDAPMemberObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory) +LDAPMemberObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory) LDAPMemberTypeDn=Tipos DN de miembros de Dolibar LDAPMemberTypepDnExample=DN completo (por ejemplo, ou=memberstypes, dc=example, dc=com) LDAPMemberTypeObjectClassList=Lista de objectClass LDAPMemberTypeObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,groupOfUniqueNames) LDAPUserObjectClassList=Lista de objectClass -LDAPUserObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory) +LDAPUserObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory) LDAPGroupObjectClassList=Lista de objectClass LDAPGroupObjectClassListExample=Lista de ObjectClass que definen los atributos de un registro (ej: top,groupOfUniqueNames) LDAPContactObjectClassList=Lista de objectClass -LDAPContactObjectClassListExample=Lista de objectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user for active directory) +LDAPContactObjectClassListExample=Lista de objectClass que definen los atributos de un registro (ej: top,inetOrgPerson o top,user para active directory) LDAPTestConnect=Probar la conexión LDAP LDAPTestSynchroContact=Probar la sincronización de contactos LDAPTestSynchroUser=Probar la sincronización de usuarios @@ -1728,21 +1730,21 @@ SeeSubstitutionVars=Vea * nota para un listado de posibles variables de sustituc SeeChangeLog=Ver archivo ChangeLog (solo inglés) AllPublishers=Todos los editores UnknownPublishers=Editores desconocidos -AddRemoveTabs=Añadir o eliminar pestañas -AddDataTables=Añadir tablas de objetos -AddDictionaries=Añadir diccionarios -AddData=Agregar objetos o datos de diccionarios -AddBoxes=Añadir paneles -AddSheduledJobs=Añadir tareas programadas -AddHooks=Añadir hooks -AddTriggers=Añadir triggers -AddMenus=Añadir menús -AddPermissions=Añadir permisos -AddExportProfiles=Añadir perfiles de exportación -AddImportProfiles=Añadir perfiles de importación -AddOtherPagesOrServices=Añadir otras páginas o servicios -AddModels=Añadir modelos de documentos o numeración -AddSubstitutions=Añadir substituciones de claves +AddRemoveTabs=Añade o elimina pestañas +AddDataTables=Añade tablas de objetos +AddDictionaries=Añade diccionarios +AddData=Añade objetos o datos de diccionarios +AddBoxes=Añade paneles +AddSheduledJobs=Añade tareas programadas +AddHooks=Añade hooks +AddTriggers=Añade triggers +AddMenus=Añade menús +AddPermissions=Añade permisos +AddExportProfiles=Añade perfiles de exportación +AddImportProfiles=Añade perfiles de importación +AddOtherPagesOrServices=Añade otras páginas o servicios +AddModels=Añade modelos de documentos o numeración +AddSubstitutions=Añade substituciones de claves DetectionNotPossible=No es posible la detección UrlToGetKeyToUseAPIs=Url para conseguir token para usar la API (una vez recibido el token se guarda en la tabla de usuarios de la base de datos y se debe proporcionar en cada llamada API) ListOfAvailableAPIs=Listado de APIs disponibles diff --git a/htdocs/langs/es_ES/bills.lang b/htdocs/langs/es_ES/bills.lang index 7cf978aba75..2ece66711c7 100644 --- a/htdocs/langs/es_ES/bills.lang +++ b/htdocs/langs/es_ES/bills.lang @@ -178,7 +178,7 @@ ConfirmCancelBillQuestion=¿Porqué quiere clasificar esta factura como 'abandon ConfirmClassifyPaidPartially=¿Está seguro de querer cambiar el estado de la factura %s a pagado? ConfirmClassifyPaidPartiallyQuestion=Esta factura no ha sido pagado completamente. ¿Cual es la razón para cerrar esta factura? ConfirmClassifyPaidPartiallyReasonAvoir=El resto a pagar (%s %s) es un descuento otorgado por pronto pago. Regularizaré el IVA con un abono. -ConfirmClassifyPaidPartiallyReasonDiscount=Remaining unpaid (%s %s) is a discount granted because payment was made before term. +ConfirmClassifyPaidPartiallyReasonDiscount=El resto a pagar (%s%s) es un descuento otorgado por pronto pago. ConfirmClassifyPaidPartiallyReasonDiscountNoVat=El resto a pagar (%s %s) es un descuento otorgado por pronto pago. Acepto perder el IVA en este descuento. ConfirmClassifyPaidPartiallyReasonDiscountVat=El resto a pagar (%s %s) es un descuento otorgado por pronto pago. Recuperaré el IVA sin usar un abono. ConfirmClassifyPaidPartiallyReasonBadCustomer=Cliente moroso diff --git a/htdocs/langs/es_ES/categories.lang b/htdocs/langs/es_ES/categories.lang index 9d83ca86817..6a834e36fea 100644 --- a/htdocs/langs/es_ES/categories.lang +++ b/htdocs/langs/es_ES/categories.lang @@ -78,7 +78,7 @@ CatCusLinks=Enlaces entre clientes/clientes potenciales y etiquetas/categorías CatProdLinks=Enlaces entre productos/servicios y etiquetas/categorías CatProJectLinks=Enlaces entre proyectos y etiquetas/categorías DeleteFromCat=Eliminar de la etiqueta/categoría -ExtraFieldsCategories=Atributos complementarios +ExtraFieldsCategories=Campos adicionales CategoriesSetup=Configuración de etiquetas/categorías CategorieRecursiv=Enlazar con la etiqueta/categoría automáticamente CategorieRecursivHelp=Si está activado, el producto se enlazará a la categoría padre si lo añadimos a una subcategoría diff --git a/htdocs/langs/es_ES/companies.lang b/htdocs/langs/es_ES/companies.lang index 98fcc553b0d..d70114dacae 100644 --- a/htdocs/langs/es_ES/companies.lang +++ b/htdocs/langs/es_ES/companies.lang @@ -374,9 +374,9 @@ ContactNotLinkedToCompany=Contacto no vinculado a un tercero DolibarrLogin=Login usuario NoDolibarrAccess=Sin acceso de usuario ExportDataset_company_1=Terceros (Empresas / asociaciones / particulares) y propiedades -ExportDataset_company_2=Contactos de terceros y atributos +ExportDataset_company_2=Contactos de terceros y campos adicionales ImportDataset_company_1=Terceros (Empresas / asociaciones / particulares) y propiedades -ImportDataset_company_2=Contactos/Direcciones (de terceros o no) y atributos +ImportDataset_company_2=Contactos/Direcciones (de terceros o no) y campos adicionales ImportDataset_company_3=Cuentas bancarias ImportDataset_company_4=Terceros/Comerciales (Afecta a los usuarios comerciales de terceros) PriceLevel=Nivel de precios diff --git a/htdocs/langs/es_ES/compta.lang b/htdocs/langs/es_ES/compta.lang index 18eb89f6dbd..277c8f8fcf5 100644 --- a/htdocs/langs/es_ES/compta.lang +++ b/htdocs/langs/es_ES/compta.lang @@ -24,7 +24,7 @@ PaymentsNotLinkedToInvoice=Pagos vinculados a ninguna factura, por lo que ningu PaymentsNotLinkedToUser=Pagos no vinculados a un usuario Profit=Beneficio AccountingResult=Resultado contable -BalanceBefore=Balance (before) +BalanceBefore=Balance (antes) Balance=Saldo Debit=Debe Credit=Haber diff --git a/htdocs/langs/es_ES/donations.lang b/htdocs/langs/es_ES/donations.lang index fddc435971d..0b6c7d207f3 100644 --- a/htdocs/langs/es_ES/donations.lang +++ b/htdocs/langs/es_ES/donations.lang @@ -31,4 +31,4 @@ DONATION_ART200=Mostrar artículo 200 del CGI si se está interesado DONATION_ART238=Mostrar artículo 238 del CGI si se está interesado DONATION_ART885=Mostrar artículo 885 del CGI si se está interesado DonationPayment=Pago de donación -DonationValidated=Donation %s validated +DonationValidated=Donación %s validada diff --git a/htdocs/langs/es_ES/languages.lang b/htdocs/langs/es_ES/languages.lang index d460b1e968f..ec9b14b68fc 100644 --- a/htdocs/langs/es_ES/languages.lang +++ b/htdocs/langs/es_ES/languages.lang @@ -35,7 +35,7 @@ Language_es_PA=Español (Panamá) Language_es_PY=Español (Paraguay) Language_es_PE=Español (Perú) Language_es_PR=Español (Puerto Rico) -Language_es_UY=Spanish (Uruguay) +Language_es_UY=Español (Uruguay) Language_es_VE=Español (Venezuela) Language_et_EE=Estonio Language_eu_ES=Vasco diff --git a/htdocs/langs/es_ES/main.lang b/htdocs/langs/es_ES/main.lang index 729daa6ebcf..310a4b5dd6c 100644 --- a/htdocs/langs/es_ES/main.lang +++ b/htdocs/langs/es_ES/main.lang @@ -722,8 +722,8 @@ After=Después IPAddress=Dirección IP Frequency=Frecuencia IM=Mensajería instantánea -NewAttribute=Nuevo atributo -AttributeCode=Código atributo +NewAttribute=Nuevo campo +AttributeCode=Código URLPhoto=Url de la foto/logo SetLinkToAnotherThirdParty=Vincular a otro tercero LinkTo=Enlazar a @@ -885,7 +885,7 @@ Select2NotFound=No se han encontrado registros Select2Enter=Introducir Select2MoreCharacter=o más caracteres Select2MoreCharacters=o más caracteres -Select2MoreCharactersMore=Sintaxis de búsqueda:
| OR (a|b)
* Cualquier caracter (a*b)
^Empezar con (^ab)
$Terminar con (ab$)
+Select2MoreCharactersMore=Sintaxis de búsqueda:
| O (a|b)
* Cualquier carácter (a*b)
^ Empieza con (^ab)
$ Termina con (ab$)
Select2LoadingMoreResults=Cargando más resultados... Select2SearchInProgress=Búsqueda en progreso... SearchIntoThirdparties=Terceros @@ -912,5 +912,5 @@ CommentPage=Espacio de comentarios CommentAdded=Comentario añadido CommentDeleted=Comentario borrado Everybody=Proyecto compartido -PayedBy=Payed by -PayedTo=Payed to +PayedBy=Pagado por +PayedTo=Pagado a diff --git a/htdocs/langs/es_ES/modulebuilder.lang b/htdocs/langs/es_ES/modulebuilder.lang index 6be47b732bf..188887b7a06 100644 --- a/htdocs/langs/es_ES/modulebuilder.lang +++ b/htdocs/langs/es_ES/modulebuilder.lang @@ -43,6 +43,8 @@ PathToModulePackage=Ruta al zip del módulo/aplicación PathToModuleDocumentation=Ruta a la documentación del módulo/aplicación SpaceOrSpecialCharAreNotAllowed=Espacios o caracteres especiales no son permitidos. FileNotYetGenerated=Fichero todavía no generado +RegenerateClassAndSql=Borrar y regenerar archivos de clase y sql +RegenerateMissingFiles=Generar archivos no encontrados SpecificationFile=Fichero con las reglas de negocio LanguageFile=Archivo para el idioma ConfirmDeleteProperty=¿Estás seguro que quieres eliminar la propiedad %s? Esto cambiará código en la clase PHP pero también eliminará la columna de la definición de la tabla del objeto. diff --git a/htdocs/langs/es_ES/multicurrency.lang b/htdocs/langs/es_ES/multicurrency.lang index dba8d088ca5..493c5f400a5 100644 --- a/htdocs/langs/es_ES/multicurrency.lang +++ b/htdocs/langs/es_ES/multicurrency.lang @@ -7,7 +7,7 @@ multicurrency_syncronize_error=Error sincronización: %s MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Usar fecha del documento para encontrar la tasa de la divisa, en lugar de usar la última tasa conocida multicurrency_useOriginTx=Cuando un objeto se crea desde otro, mantenga la conversión original del objeto de origen (de lo contrario, utilice la tasa de conversión más reciente conocida) CurrencyLayerAccount=CurrencyLayer API -CurrencyLayerAccount_help_to_synchronize=Debe crear una cuenta en su sitio web para utilizar esta función.
Obtenga su clave API
Si utiliza una cuenta gratuita, no puede cambiar la divisa origen (USD por defecto)
. Pero si su divisa principal no es USD, puede usar la divisa origen alternativa para forzar su divisa principal.

Está limitado a 1000 sincronizaciones por mes +CurrencyLayerAccount_help_to_synchronize=Debe crear una cuenta en su sitio web para usar esta funcionalidad
Obtenga su Clave API
Si usa una cuenta gratuita no puede cambiar la moneda origen (por defecto USD)
Pero si su moneda principal no es USD puede usar la moneda origen alternativa para forzar su moneda principal

Estará limitado a 1000 sincronizaciones por mes multicurrency_appId=Clave API multicurrency_appCurrencySource=Divisa origen multicurrency_alternateCurrencySource=Divisa origen alternativa diff --git a/htdocs/langs/es_ES/other.lang b/htdocs/langs/es_ES/other.lang index 2646aea5291..99dfadd2d7d 100644 --- a/htdocs/langs/es_ES/other.lang +++ b/htdocs/langs/es_ES/other.lang @@ -162,9 +162,9 @@ SizeUnitinch=pulgada SizeUnitfoot=pie SizeUnitpoint=punto BugTracker=Incidencias -SendNewPasswordDesc=Este formulario le permite solicitar una nueva contraseña. Se le enviará a su dirección de e-mail.
El cambio se hará efectivo una vez que haga clic en el enlace de confirmación en el e-mail.
Compruebe su bandeja de entrada. +SendNewPasswordDesc=Este formulario le permite obtener una nueva contraseña. Le será enviada a su e-mail.
El cambio será efectivo una vez haga clic en el enlace de confirmación del e-mail.
Revise su e-mail. BackToLoginPage=Volver a la página de conexión -AuthenticationDoesNotAllowSendNewPassword=El modo de autenticación es %s.
En este modo, Dolibarr no conoce ni cambia su contraseña.
Póngase en contacto con el administrador del sistema si desea cambiar su contraseña. +AuthenticationDoesNotAllowSendNewPassword=El modo de autentificación de Dolibarr está configurado como "%s".
En este modo Dolibarr no puede conocer ni modificar su contraseña
Contacte con su administrador para conocer las modalidades de cambio. EnableGDLibraryDesc=Instale o active la libreria GD en su PHP para poder usar esta opción ProfIdShortDesc=Prof Id %s es una información dependiente del país del tercero.
Por ejemplo, para el país %s, és el código %s. DolibarrDemo=Demo de Dolibarr ERP/CRM diff --git a/htdocs/langs/es_ES/printing.lang b/htdocs/langs/es_ES/printing.lang index 352718f6cb9..f9735557d02 100644 --- a/htdocs/langs/es_ES/printing.lang +++ b/htdocs/langs/es_ES/printing.lang @@ -49,4 +49,6 @@ DirectPrintingJobsDesc=Esta página lista los trabajos encontrados en las impres GoogleAuthNotConfigured=Configuración de Google OAuth no realizada. Habilite el módulo de OAuth y establezca un Google ID / Secreto. GoogleAuthConfigured=Las credenciales OAuth de Google se encuentran en la configuración del módulo OAuth. PrintingDriverDescprintgcp=Configuración variables del driver de impresión Google Cloud Print. +PrintingDriverDescprintipp=Configuración variables para el driver de impresión Cups. PrintTestDescprintgcp=Listado de impresoras para Google Cloud Print. +PrintTestDescprintipp=Listado de Impresoras para Cups. diff --git a/htdocs/langs/es_ES/products.lang b/htdocs/langs/es_ES/products.lang index 394aa9e6be1..7234df78d8e 100644 --- a/htdocs/langs/es_ES/products.lang +++ b/htdocs/langs/es_ES/products.lang @@ -239,7 +239,7 @@ MinimumRecommendedPrice=El precio mínimo recomendado es: %s PriceExpressionEditor=Editor de expresión de precios PriceExpressionSelected=Expresión de precios seleccionada PriceExpressionEditorHelp1="price = 2 + 2" o "2 + 2" para configurar un precio. Use ; para separar expresiones -PriceExpressionEditorHelp2=Puede acceder a los atributos adicionales con variables como #extrafield_myextrafieldkey# y variables globales con #global_mycode# +PriceExpressionEditorHelp2=Puede acceder a los campos adicionales con variables como #extrafield_myextrafieldkey# y variables globales con #global_mycode# PriceExpressionEditorHelp3=En productos y servicios, y precios de proveedor están disponibles las siguientes variables
#tva_tx# #localtax1_tx# #localtax2_tx# #weight# #length# #surface# #price_min# PriceExpressionEditorHelp4=Solamente en los precios de productos y servicios: #supplier_min_price#
In supplier prices only: #supplier_quantity# and #supplier_tva_tx# PriceExpressionEditorHelp5=Valores globales disponibles: diff --git a/htdocs/langs/es_ES/users.lang b/htdocs/langs/es_ES/users.lang index daddb0fcf66..f089a880b64 100644 --- a/htdocs/langs/es_ES/users.lang +++ b/htdocs/langs/es_ES/users.lang @@ -63,7 +63,7 @@ CreateDolibarrThirdParty=Crear un tercero LoginAccountDisableInDolibarr=La cuenta está desactivada en Dolibarr UsePersonalValue=Utilizar valores personalizados InternalUser=Usuario interno -ExportDataset_user_1=Usuarios Dolibarr y atributos +ExportDataset_user_1=Usuarios Dolibarr y campos adicionales DomainUser=Usuario de dominio Reactivate=Reactivar CreateInternalUserDesc=Este formulario le permite crear un usuario interno para su empresa/asociación. Para crear un usuario externo (cliente, proveedor, etc), use el botón "Crear una cuenta de usuario" desde una ficha de un contacto del tercero. diff --git a/htdocs/langs/es_ES/website.lang b/htdocs/langs/es_ES/website.lang index 38a2155f292..14f1f3c2083 100644 --- a/htdocs/langs/es_ES/website.lang +++ b/htdocs/langs/es_ES/website.lang @@ -41,7 +41,7 @@ VirtualHostUrlNotDefined=URL del Host Virtual servido por un servidor externo no NoPageYet=No hay páginas todavía SyntaxHelp=Ayuda en la sintaxis del código YouCanEditHtmlSourceckeditor=Puede editar código fuente HTML utilizando el botón "Origen" en el editor. -YouCanEditHtmlSource=Puede editar el código fuente HTML usando el botón "Origen" en el editor. También puede incluir código PHP en esta fuente mediante etiquetas <?php ?>. Las siguientes variables globales están disponibles: $conf, $langs, $db, $mysoc, $user, $website.

También puede incluir contenido de otra Página/Contenedor con la siguiente sintaxis: <?php dolIncludeHtmlContent ($websitekey. '/contentaliastoinclude.php'); ?>

Para incluir un vínculo para descargar un archivo almacenado en el directorio de documentos/medios, utilice la sintaxis:
<a href="/document.php?modulepart=medias&file=filename.ext". +YouCanEditHtmlSource=
Puede incluir código PHP en este fuente usando los tags <?php ?>. Dispone de estas variables globales: $conf, $langs, $db, $mysoc, $user, $website.

También puede incluir contenido de otra Página/Contenedor con la siguiente sintaxis:
<?php includeContainer('alias_of_container_to_include'); ?>

Para incluir un enlace para descargar un archivo guardado en el directorio documents, use el wrapper document.php :
Por ejemplo, para un archivo de documents/ecm (es necesario estar logueado), la sintaxis:
<a href="/document.php?modulepart=ecm&file=[relative_dir/]filename.ext">
Para un archivo de into documents/medias (directorio abierto para acceso público), la sintaxis es:
<a href="/document.php?modulepart=medias&file=[relative_dir/]filename.ext">
Para un archivo compartido mediante un enlace compartido (acceso abierto utilizando la clave hash para compartir del archivo), la sintaxis es:
<a href="/document.php?hashp=publicsharekeyoffile">

Para incluir una imagen guardada en el directorio documents , use el wrapper viewimage.php :
Ejemplo para una imagen de documents/medias (acceso abierto), la sintaxis es:
<a href="/viewimage.php?modulepart=medias&file=[relative_dir/]filename.ext">
ClonePage=Clonar página/contenedor CloneSite=Clonar sitio SiteAdded=Sitio web agregado diff --git a/htdocs/langs/es_ES/withdrawals.lang b/htdocs/langs/es_ES/withdrawals.lang index a8b25e5088e..355380794e6 100644 --- a/htdocs/langs/es_ES/withdrawals.lang +++ b/htdocs/langs/es_ES/withdrawals.lang @@ -26,7 +26,7 @@ LastWithdrawalReceipt=Las %s últimas domiciliaciones MakeWithdrawRequest=Realizar una petición de domiciliación WithdrawRequestsDone=%s domiciliaciones registradas ThirdPartyBankCode=Código banco del tercero -NoInvoiceCouldBeWithdrawed=No se ha domiciliado ninguna factura. Asegúrese de que las facturas son de empresas con los datos de cuentas bancarias correctos. +NoInvoiceCouldBeWithdrawed=No se ha podido realizar la petición de domiciliación de ninguna factura. Compruebe que los terceros de las facturas relacionadas tienen una cuenta IBAN válida y dicho IBAN tiene un RUM con modo %s. ClassCredited=Clasificar como "Abonada" ClassCreditedConfirm=¿Está seguro de querer clasificar esta domiciliación como abonada en su cuenta bancaria? TransData=Fecha envío diff --git a/htdocs/modulebuilder/template/mymoduleindex.php b/htdocs/modulebuilder/template/mymoduleindex.php index c6f70b0ba85..8073d31fd60 100644 --- a/htdocs/modulebuilder/template/mymoduleindex.php +++ b/htdocs/modulebuilder/template/mymoduleindex.php @@ -175,7 +175,7 @@ if (! empty($conf->mymodule->enabled) && $user->rights->mymodule->read) $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client IN (1, 2, 3)"; - $sql.= " AND s.entity IN (".getEntity($companystatic->element, 1).")"; + $sql.= " AND s.entity IN (".getEntity($companystatic->element).")"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = " .$user->id; if ($socid) $sql.= " AND s.rowid = $socid"; $sql .= " ORDER BY s.tms DESC"; diff --git a/htdocs/public/members/new.php b/htdocs/public/members/new.php index 6a5fcbdfc62..978c646a524 100644 --- a/htdocs/public/members/new.php +++ b/htdocs/public/members/new.php @@ -26,7 +26,7 @@ * * Note that you can add following constant to change behaviour of page * MEMBER_NEWFORM_AMOUNT Default amount for auto-subscribe form - * MEMBER_NEWFORM_EDITAMOUNT Amount can be edited + * MEMBER_NEWFORM_EDITAMOUNT 0 or 1 = Amount can be edited * MEMBER_NEWFORM_PAYONLINE Suggest payment with paypal, paybox or stripe * MEMBER_NEWFORM_DOLIBARRTURNOVER Show field turnover (specific for dolibarr foundation) * MEMBER_URL_REDIRECT_SUBSCRIPTION Url to redirect once subscribe submitted diff --git a/htdocs/public/paybox/newpayment.php b/htdocs/public/paybox/newpayment.php index 9d7f79081a9..aea30184286 100644 --- a/htdocs/public/paybox/newpayment.php +++ b/htdocs/public/paybox/newpayment.php @@ -155,7 +155,7 @@ if (! empty($conf->global->PAYMENT_SECURITY_TOKEN)) if (GETPOST('action','aZ09') == 'dopayment') { - $PRICE=price2num(GETPOST("newamount"),'MT'); + $PRICE=price2num(GETPOST("newamount",'alpha'),'MT'); $email=GETPOST("email"); $origfulltag=GETPOST("fulltag",'alpha'); @@ -275,7 +275,7 @@ print $text; // Output payment summary form print ''; print ''; -print ''."\n"; +print ''."\n"; $found=false; $error=0; @@ -305,7 +305,7 @@ if (! GETPOST("source") && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -392,7 +392,7 @@ if (GETPOST("source") == 'order' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -480,7 +480,7 @@ if (GETPOST("source") == 'invoice' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -656,7 +656,7 @@ if (GETPOST("source") == 'contractline' && $valid) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -754,7 +754,7 @@ if (GETPOST("source") == 'membersubscription' && $valid) print ''."\n"; - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; + if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; } // Amount @@ -762,12 +762,31 @@ if (GETPOST("source") == 'membersubscription' && $valid) print ''."\n"; - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; + if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; } // Amount @@ -1215,27 +1215,31 @@ if ($source == 'membersubscription') if (empty($conf->global->MEMBER_NEWFORM_AMOUNT)) print ')'; } print '
'.$langs->trans("ThisIsInformationOnPayment").' :
'.$langs->trans("ThisIsInformationOnPayment").' :
'.price($member->last_subscription_amount); print '
'.$langs->trans("Amount"); if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; print ''; + $valtoshow=''; if (empty($amount) || ! is_numeric($amount)) { - $valtoshow=GETPOST("newamount",'int'); + $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); + // force default subscription amount to value defined into constant... + if (empty($valtoshow)) + { + if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + else { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + } + } + if (empty($amount) || ! is_numeric($amount)) + { + //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/paybox/paymentok.php b/htdocs/public/paybox/paymentok.php index e3812c28dc1..63c15b035f2 100644 --- a/htdocs/public/paybox/paymentok.php +++ b/htdocs/public/paybox/paymentok.php @@ -126,6 +126,7 @@ $result=$interface->run_triggers('PAYBOX_PAYMENT_OK',$object,$user,$langs,$conf) if ($result < 0) { $error++; $errors=$interface->errors; } // Fin appel triggers +$tmptag=dolExplodeIntoArray($fulltag,'.','='); // Send an email if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) @@ -152,7 +153,6 @@ if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $urlback=$_SERVER["REQUEST_URI"]; $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); - $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) { diff --git a/htdocs/public/payment/newpayment.php b/htdocs/public/payment/newpayment.php index efeb1323a3d..4bc33756a51 100644 --- a/htdocs/public/payment/newpayment.php +++ b/htdocs/public/payment/newpayment.php @@ -268,7 +268,7 @@ if ($action == 'dopayment') { if ($paymentmethod == 'paypal') { - $PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT'); + $PAYPAL_API_PRICE=price2num(GETPOST("newamount",'alpha'),'MT'); $PAYPAL_PAYMENT_TYPE='Sale'; $origfulltag=GETPOST("fulltag",'alpha'); @@ -366,7 +366,7 @@ if ($action == 'dopayment') if ($paymentmethod == 'stripe') { - if (GETPOST('newamount')) $amount = GETPOST('newamount'); + if (GETPOST('newamount','alpha')) $amount = price2num(GETPOST('newamount','alpha'),'MT'); else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); @@ -647,7 +647,7 @@ if (! $source) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -738,7 +738,7 @@ if ($source == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -858,7 +858,7 @@ if ($source == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -1079,7 +1079,7 @@ if ($source == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -1202,7 +1202,7 @@ if ($source == 'membersubscription') print ''.price($member->last_subscription_amount); print '
'; + $valtoshow=''; if (empty($amount) || ! is_numeric($amount)) { - $valtoshow=GETPOST("newamount",'int'); + $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); // force default subscription amount to value defined into constant... - if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { - if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + if (empty($valtoshow)) + { + if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + } } - } - else { - if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { - $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + else { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } } } } if (empty($amount) || ! is_numeric($amount)) { - //$valtoshow=GETPOST("newamount",'int'); + //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/payment/paymentok.php b/htdocs/public/payment/paymentok.php index 7ccd95abcdf..d74305890df 100644 --- a/htdocs/public/payment/paymentok.php +++ b/htdocs/public/payment/paymentok.php @@ -188,7 +188,7 @@ if (! empty($conf->paypal->enabled)) if ($PAYPALTOKEN) { // Get on url call - $onlinetoken = $PAYPALTOKEN; + $onlinetoken = $PAYPALTOKEN; $fulltag = $FULLTAG; $payerID = $PAYPALPAYERID; // Set by newpayment.php @@ -291,6 +291,8 @@ if ($ispaymentok) $sendemail = ''; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL; + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + // Send an email if ($sendemail) { @@ -316,7 +318,6 @@ if ($ispaymentok) $urlback=$_SERVER["REQUEST_URI"]; $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); - $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) { @@ -388,6 +389,8 @@ else if ($paymentmethod == 'paybox' && ! empty($conf->global->PAYBOX_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->PAYBOX_PAYONLINE_SENDEMAIL; if ($paymentmethod == 'stripe' && ! empty($conf->global->STRIPE_PAYONLINE_SENDEMAIL)) $sendemail=$conf->global->STRIPE_PAYONLINE_SENDEMAIL; + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + // Send an email if ($sendemail) { diff --git a/htdocs/public/paypal/newpayment.php b/htdocs/public/paypal/newpayment.php index fac192bd318..8261ba2d99a 100644 --- a/htdocs/public/paypal/newpayment.php +++ b/htdocs/public/paypal/newpayment.php @@ -192,7 +192,7 @@ if (! empty($conf->global->PAYPAL_SECURITY_TOKEN)) if (GETPOST('action','aZ09') == 'dopayment') { - $PAYPAL_API_PRICE=price2num(GETPOST("newamount"),'MT'); + $PAYPAL_API_PRICE=price2num(GETPOST("newamount",'alpha'),'MT'); $PAYPAL_PAYMENT_TYPE='Sale'; $origfulltag=GETPOST("fulltag",'alpha'); @@ -361,7 +361,7 @@ print $text; // Output payment summary form print '
'; print ''; -print ''."\n"; +print ''."\n"; $found=false; $error=0; @@ -375,21 +375,19 @@ if (! GETPOST("source")) $fulltag=$tag; // Creditor - print ''."\n"; // Amount - print ''."\n"; // Tag - print ''."\n"; - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; + if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; } // Amount @@ -915,12 +912,31 @@ if (GETPOST("source") == 'membersubscription') print ')'; } print '
'.$langs->trans("ThisIsInformationOnPayment").' :
'.$langs->trans("ThisIsInformationOnPayment").' :
'.$langs->trans("Creditor"); print ''.$creditor.''; print ''; print '
'.$langs->trans("Amount"); if (empty($amount)) print ' ('.$langs->trans("ToComplete").')'; print ''; if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -402,7 +400,6 @@ if (! GETPOST("source")) print '
'.$langs->trans("PaymentCode"); print ''.$fulltag.''; print ''; @@ -475,7 +472,7 @@ if (GETPOST("source") == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -585,7 +582,7 @@ if (GETPOST("source") == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -783,7 +780,7 @@ if (GETPOST("source") == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -902,7 +899,7 @@ if (GETPOST("source") == 'membersubscription') print ''.price($member->last_subscription_amount); print '
'; + $valtoshow=''; if (empty($amount) || ! is_numeric($amount)) { - $valtoshow=GETPOST("newamount",'int'); + $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); + // force default subscription amount to value defined into constant... + if (empty($valtoshow)) + { + if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + else { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + } + } + if (empty($amount) || ! is_numeric($amount)) + { + //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/paypal/paymentok.php b/htdocs/public/paypal/paymentok.php index 9ae2e90795e..80ec1d8ec2b 100644 --- a/htdocs/public/paypal/paymentok.php +++ b/htdocs/public/paypal/paymentok.php @@ -181,6 +181,8 @@ if ($PAYPALTOKEN) if ($result < 0) { $error++; $errors=$interface->errors; } // Fin appel triggers + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + // Send an email if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) { @@ -206,7 +208,6 @@ if ($PAYPALTOKEN) $urlback=$_SERVER["REQUEST_URI"]; $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); - $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) { @@ -265,6 +266,8 @@ if ($PAYPALTOKEN) if ($mysoc->email) echo "\nPlease, send a screenshot of this page to ".$mysoc->email."
\n"; + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + // Send an email if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) { diff --git a/htdocs/public/stripe/newpayment.php b/htdocs/public/stripe/newpayment.php index 36b27658ee0..8c1db0ea834 100644 --- a/htdocs/public/stripe/newpayment.php +++ b/htdocs/public/stripe/newpayment.php @@ -202,7 +202,7 @@ else if (! empty($conf->global->ONLINE_PAYMENT_CREDITOR)) $creditor=$conf->globa if ($action == 'dopayment') // We click on button Create payment { - if (GETPOST('newamount')) $amount = GETPOST('newamount'); + if (GETPOST('newamount','alpha')) $amount = price2num(GETPOST('newamount','alpha'),'MT'); else { setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Amount")), null, 'errors'); @@ -429,7 +429,7 @@ print $text; // Output payment summary form print '
'; print ''; -print ''."\n"; +print ''."\n"; $found=false; $error=0; @@ -455,7 +455,7 @@ if (! GETPOST("source")) if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -541,7 +541,7 @@ if (GETPOST("source") == 'order') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -652,7 +652,7 @@ if (GETPOST("source") == 'invoice') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -852,7 +852,7 @@ if (GETPOST("source") == 'contractline') if (empty($amount) || ! is_numeric($amount)) { print ''; - print ''; + print ''; } else { print ''.price($amount).''; @@ -971,7 +971,7 @@ if (GETPOST("source") == 'membersubscription') print ''."\n"; - if (empty($amount) && ! GETPOST('newamount')) $_GET['newamount']=$member->last_subscription_amount; + if (empty($amount) && ! GETPOST('newamount','alpha')) $_GET['newamount']=$member->last_subscription_amount; } // Amount @@ -984,12 +984,31 @@ if (GETPOST("source") == 'membersubscription') print ')'; } print '
'.$langs->trans("ThisIsInformationOnPayment").' :
'.$langs->trans("ThisIsInformationOnPayment").' :
'.price($member->last_subscription_amount); print '
'; + $valtoshow=''; if (empty($amount) || ! is_numeric($amount)) { - $valtoshow=GETPOST("newamount",'int'); + $valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); + // force default subscription amount to value defined into constant... + if (empty($valtoshow)) + { + if (! empty($conf->global->MEMBER_NEWFORM_EDITAMOUNT)) { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $valtoshow = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + else { + if (! empty($conf->global->MEMBER_NEWFORM_AMOUNT)) { + $amount = $conf->global->MEMBER_NEWFORM_AMOUNT; + } + } + } + } + if (empty($amount) || ! is_numeric($amount)) + { + //$valtoshow=price2num(GETPOST("newamount",'alpha'),'MT'); if (! empty($conf->global->MEMBER_MIN_AMOUNT) && $valtoshow) $valtoshow=max($conf->global->MEMBER_MIN_AMOUNT,$valtoshow); print ''; - print ''; + print ''; } else { $valtoshow=$amount; diff --git a/htdocs/public/stripe/paymentok.php b/htdocs/public/stripe/paymentok.php index f018bc98b7a..d0ce82d1ca8 100644 --- a/htdocs/public/stripe/paymentok.php +++ b/htdocs/public/stripe/paymentok.php @@ -127,6 +127,8 @@ if ($ispaymentok) $sendemail = ''; if (! empty($conf->global->ONLINE_PAYMENT_SENDEMAIL)) $sendemail=$conf->global->ONLINE_PAYMENT_SENDEMAIL; + $tmptag=dolExplodeIntoArray($fulltag,'.','='); + // Send an email if ($sendemail) { @@ -152,7 +154,6 @@ if ($ispaymentok) $urlback=$_SERVER["REQUEST_URI"]; $topic='['.$appli.'] '.$langs->transnoentitiesnoconv("NewOnlinePaymentReceived"); - $tmptag=dolExplodeIntoArray($fulltag,'.','='); $content=""; if (! empty($tmptag['MEM'])) { diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d3a3854309a..f05f6993322 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -119,7 +119,7 @@ if (empty($reshook)) { $object->fetch($socid); - $errors = 0; + $error = 0; $soc_origin_id = GETPOST('soc_origin', 'int'); $soc_origin = new Societe($db); @@ -131,13 +131,13 @@ if (empty($reshook)) } else { - if (!$errors && $soc_origin->fetch($soc_origin_id) < 1) + if (!$error && $soc_origin->fetch($soc_origin_id) < 1) { setEventMessages($langs->trans('ErrorRecordNotFound'), null, 'errors'); - $errors++; + $error++; } - if (!$errors) + if (!$error) { // TODO Move the merge function into class of object. @@ -184,48 +184,67 @@ if (empty($reshook)) $suppcats = $static_cat->containing($soc_origin->id, 'supplier', 'id'); $object->setCategories($suppcats, 'supplier'); + // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. + if ($soc_origin->code_client == $object->code_client + || $soc_origin->code_fournisseur == $object->code_fournisseur + || $soc_origin->barcode == $object->barcode) + { + dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); + $soc_origin->code_client = ''; + $soc_origin->code_fournisseur = ''; + $soc_origin->barcode = ''; + $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); + } + // Update - $object->update($object->id, $user, 0); + $object->update($object->id, $user, 0, 1, 1, 'merge'); + if ($result < 0) + { + $error++; + } // Move links - $objects = array( - 'Adherent' => '/adherents/class/adherent.class.php', - 'Societe' => '/societe/class/societe.class.php', - 'Categorie' => '/categories/class/categorie.class.php', - 'ActionComm' => '/comm/action/class/actioncomm.class.php', - 'Propal' => '/comm/propal/class/propal.class.php', - 'Commande' => '/commande/class/commande.class.php', - 'Facture' => '/compta/facture/class/facture.class.php', - 'FactureRec' => '/compta/facture/class/facture-rec.class.php', - 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', - 'Contact' => '/contact/class/contact.class.php', - 'Contrat' => '/contrat/class/contrat.class.php', - 'Expedition' => '/expedition/class/expedition.class.php', - 'Fichinter' => '/fichinter/class/fichinter.class.php', - 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', - 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', - 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', - 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', - 'Livraison' => '/livraison/class/livraison.class.php', - 'Product' => '/product/class/product.class.php', - 'Project' => '/projet/class/project.class.php', - 'User' => '/user/class/user.class.php', - ); - - //First, all core objects must update their tables - foreach ($objects as $object_name => $object_file) + if (! $error) { - require_once DOL_DOCUMENT_ROOT.$object_file; + $objects = array( + 'Adherent' => '/adherents/class/adherent.class.php', + 'Societe' => '/societe/class/societe.class.php', + 'Categorie' => '/categories/class/categorie.class.php', + 'ActionComm' => '/comm/action/class/actioncomm.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Commande' => '/commande/class/commande.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Contact' => '/contact/class/contact.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Expedition' => '/expedition/class/expedition.class.php', + 'Fichinter' => '/fichinter/class/fichinter.class.php', + 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'Livraison' => '/livraison/class/livraison.class.php', + 'Product' => '/product/class/product.class.php', + 'Project' => '/projet/class/project.class.php', + 'User' => '/user/class/user.class.php', + ); - if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) + //First, all core objects must update their tables + foreach ($objects as $object_name => $object_file) { - $errors++; - setEventMessages($db->lasterror(), null, 'errors'); + require_once DOL_DOCUMENT_ROOT.$object_file; + + if (!$error && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) + { + $error++; + setEventMessages($db->lasterror(), null, 'errors'); + } } } - //External modules should update their ones too - if (!$errors) + // External modules should update their ones too + if (! $error) { $reshook = $hookmanager->executeHooks('replaceThirdparty', array( 'soc_origin' => $soc_origin->id, @@ -235,7 +254,7 @@ if (empty($reshook)) if ($reshook < 0) { setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); - $errors++; + $error++; } } @@ -254,16 +273,16 @@ if (empty($reshook)) // End call triggers } - if (!$errors) + if (!$error) { //We finally remove the old thirdparty if ($soc_origin->delete($soc_origin->id, $user) < 1) { - $errors++; + $error++; } } - if (!$errors) + if (!$error) { setEventMessages($langs->trans('ThirdpartiesMergeSuccess'), null, 'mesgs'); $db->commit(); diff --git a/htdocs/societe/class/api_thirdparties.class.php b/htdocs/societe/class/api_thirdparties.class.php index 658dc6a50e2..9bc95c5e836 100644 --- a/htdocs/societe/class/api_thirdparties.class.php +++ b/htdocs/societe/class/api_thirdparties.class.php @@ -243,6 +243,218 @@ class Thirdparties extends DolibarrApi return false; } + /** + * Merge a thirdparty into another one. + * + * Merge content (properties, notes) and objects (like invoices, events, orders, proposals, ...) of a thirdparty into a target thirdparty, + * then delete the merged thirdparty. + * If a property has a defined value both in thirdparty to delete and thirdparty to keep, the value into the thirdparty to + * delete will be ignored, the value of target thirdparty will remain, except for notes (content is concatenated). + * + * @param int $id ID of thirdparty to keep (the target thirdparty) + * @param int $idtodelete ID of thirdparty to remove (the thirdparty to delete), once data has been merged into the target thirdparty. + * @return int + * + * @url PUT {id}/merge/{idtodelete} + */ + function merge($id, $idtodelete) + { + global $db, $hookmanager; + + if ($id == $idtodelete) + { + throw new RestException(400, 'Try to merge a thirdparty into itself'); + } + + if(! DolibarrApiAccess::$user->rights->societe->creer) { + throw new RestException(401); + } + + $result = $this->company->fetch($id); // include the fetch of extra fields + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->company->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $this->companytoremove = new Societe($db); + + $result = $this->companytoremove->fetch($idtodelete); // include the fetch of extra fields + if( ! $result ) { + throw new RestException(404, 'Thirdparty not found'); + } + + if( ! DolibarrApi::_checkAccessToResource('societe',$this->companytoremove->id)) { + throw new RestException(401, 'Access not allowed for login '.DolibarrApiAccess::$user->login); + } + + $soc_origin = $this->companytoremove; + $object = $this->company; + $user = DolibarrApiAccess::$user; + + + // Call same code than into action 'confirm_merge' + + + $db->begin(); + + // Recopy some data + $object->client = $object->client | $soc_origin->client; + $object->fournisseur = $object->fournisseur | $soc_origin->fournisseur; + $listofproperties=array( + 'address', 'zip', 'town', 'state_id', 'country_id', 'phone', 'phone_pro', 'fax', 'email', 'skype', 'url', 'barcode', + 'idprof1', 'idprof2', 'idprof3', 'idprof4', 'idprof5', 'idprof6', + 'tva_intra', 'effectif_id', 'forme_juridique', 'remise_percent', 'mode_reglement_supplier_id', 'cond_reglement_supplier_id', 'name_bis', + 'stcomm_id', 'outstanding_limit', 'price_level', 'parent', 'default_lang', 'ref', 'ref_ext', 'import_key', 'fk_incoterms', 'fk_multicurrency', + 'code_client', 'code_fournisseur', 'code_compta', 'code_compta_fournisseur', + 'model_pdf', 'fk_projet' + ); + foreach ($listofproperties as $property) + { + if (empty($object->$property)) $object->$property = $soc_origin->$property; + } + + // Concat some data + $listofproperties=array( + 'note_public', 'note_private' + ); + foreach ($listofproperties as $property) + { + $object->$property = dol_concatdesc($object->$property, $soc_origin->$property); + } + + // Merge extrafields + if (is_array($soc_origin->array_options)) + { + foreach ($soc_origin->array_options as $key => $val) + { + if (empty($object->array_options[$key])) $object->array_options[$key] = $val; + } + } + + // Merge categories + $static_cat = new Categorie($db); + $custcats = $static_cat->containing($soc_origin->id, 'customer', 'id'); + $object->setCategories($custcats, 'customer'); + $suppcats = $static_cat->containing($soc_origin->id, 'supplier', 'id'); + $object->setCategories($suppcats, 'supplier'); + + // If thirdparty has a new code that is same than origin, we clean origin code to avoid duplicate key from database unique keys. + if ($soc_origin->code_client == $object->code_client + || $soc_origin->code_fournisseur == $object->code_fournisseur + || $soc_origin->barcode == $object->barcode) + { + dol_syslog("We clean customer and supplier code so we will be able to make the update of target"); + $soc_origin->code_client = ''; + $soc_origin->code_fournisseur = ''; + $soc_origin->barcode = ''; + $soc_origin->update($soc_origin->id, $user, 0, 1, 1, 'merge'); + } + + // Update + $result = $object->update($object->id, $user, 0, 1, 1, 'merge'); + if ($result < 0) + { + $error++; + } + + // Move links + if (! $error) + { + $objects = array( + 'Adherent' => '/adherents/class/adherent.class.php', + 'Societe' => '/societe/class/societe.class.php', + 'Categorie' => '/categories/class/categorie.class.php', + 'ActionComm' => '/comm/action/class/actioncomm.class.php', + 'Propal' => '/comm/propal/class/propal.class.php', + 'Commande' => '/commande/class/commande.class.php', + 'Facture' => '/compta/facture/class/facture.class.php', + 'FactureRec' => '/compta/facture/class/facture-rec.class.php', + 'LignePrelevement' => '/compta/prelevement/class/ligneprelevement.class.php', + 'Contact' => '/contact/class/contact.class.php', + 'Contrat' => '/contrat/class/contrat.class.php', + 'Expedition' => '/expedition/class/expedition.class.php', + 'Fichinter' => '/fichinter/class/fichinter.class.php', + 'CommandeFournisseur' => '/fourn/class/fournisseur.commande.class.php', + 'FactureFournisseur' => '/fourn/class/fournisseur.facture.class.php', + 'SupplierProposal' => '/supplier_proposal/class/supplier_proposal.class.php', + 'ProductFournisseur' => '/fourn/class/fournisseur.product.class.php', + 'Livraison' => '/livraison/class/livraison.class.php', + 'Product' => '/product/class/product.class.php', + 'Project' => '/projet/class/project.class.php', + 'User' => '/user/class/user.class.php', + ); + + //First, all core objects must update their tables + foreach ($objects as $object_name => $object_file) + { + require_once DOL_DOCUMENT_ROOT.$object_file; + + if (!$errors && !$object_name::replaceThirdparty($db, $soc_origin->id, $object->id)) + { + $errors++; + //setEventMessages($db->lasterror(), null, 'errors'); + } + } + } + + // External modules should update their ones too + if (!$errors) + { + $reshook = $hookmanager->executeHooks('replaceThirdparty', array( + 'soc_origin' => $soc_origin->id, + 'soc_dest' => $object->id + ), $soc_dest, $action); + + if ($reshook < 0) + { + //setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); + $errors++; + } + } + + + if (! $error) + { + $object->context=array('merge'=>1, 'mergefromid'=>$soc_origin->id); + + // Call trigger + $result=$object->call_trigger('COMPANY_MODIFY',$user); + if ($result < 0) + { + //setEventMessages($object->error, $object->errors, 'errors'); + $error++; + } + // End call triggers + } + + if (! $error) + { + //We finally remove the old thirdparty + if ($soc_origin->delete($soc_origin->id, $user) < 1) + { + $errors++; + } + } + + // End of merge + + if ($error) + { + $db->rollback(); + + throw new RestException(500, 'Error failed to merged thirdparty '.$this->companytoremove->id.' into '.$id.'. Enable and read log file for more information.'); + } + else + { + $db->commit(); + } + + return $this->get($id); + } + /** * Delete thirdparty * diff --git a/htdocs/societe/class/client.class.php b/htdocs/societe/class/client.class.php index b4ee6b86249..6db71eb4218 100644 --- a/htdocs/societe/class/client.class.php +++ b/htdocs/societe/class/client.class.php @@ -65,7 +65,7 @@ class Client extends Societe $clause = "AND"; } $sql.= " ".$clause." s.client IN (1,2,3)"; - $sql.= ' AND s.entity IN ('.getEntity($this->element, 1).')'; + $sql.= ' AND s.entity IN ('.getEntity($this->element).')'; $sql.= " GROUP BY s.client"; $resql=$this->db->query($sql); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index cd4b66a23a1..cc2e1fe50af 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -738,7 +738,7 @@ class Societe extends CommonObject * @param int $call_trigger 0=no, 1=yes * @param int $allowmodcodeclient Inclut modif code client et code compta * @param int $allowmodcodefournisseur Inclut modif code fournisseur et code compta fournisseur - * @param string $action 'add' or 'update' + * @param string $action 'add' or 'update' or 'merge' * @param int $nosyncmember Do not synchronize info of linked member * @return int <0 if KO, >=0 if OK */ @@ -867,7 +867,12 @@ class Societe extends CommonObject // Check name is required and codes are ok or unique. // If error, this->errors[] is filled $result = 0; - if ($action != 'add') $result = $this->verify(); // We don't check when update called during a create because verify was already done + if ($action != 'add' && $action != 'merge') + { + // We don't check when update called during a create because verify was already done. + // For a merge, we suppose source data is clean and a customer code of a deleted thirdparty must be accepted into a target thirdparty with empty code without duplicate error + $result = $this->verify(); + } if ($result >= 0) { @@ -1148,7 +1153,7 @@ class Societe extends CommonObject $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_departements as d ON s.fk_departement = d.rowid'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_typent as te ON s.fk_typent = te.id'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON s.fk_incoterms = i.rowid'; - $sql .= ' WHERE s.entity IN ('.getEntity($this->element, 1).')'; + $sql .= ' WHERE s.entity IN ('.getEntity($this->element).')'; if ($rowid) $sql .= ' AND s.rowid = '.$rowid; if ($ref) $sql .= " AND s.nom = '".$this->db->escape($ref)."'"; if ($ref_ext) $sql .= " AND s.ref_ext = '".$this->db->escape($ref_ext)."'"; @@ -3767,16 +3772,22 @@ class Societe extends CommonObject * Function used to replace a thirdparty id with another one. * It must be used within a transaction to avoid trouble * - * @param DoliDB $db Database handler - * @param int $origin_id Old thirdparty id - * @param int $dest_id New thirdparty id - * @return bool + * @param DoliDB $db Database handler + * @param int $origin_id Old thirdparty id (will be removed) + * @param int $dest_id New thirdparty id + * @return bool True if success, False if error */ public static function replaceThirdparty(DoliDB $db, $origin_id, $dest_id) { + if ($origin_id == $id) + { + dol_syslog('Error: Try to merge a thirdparty into itself'); + return false; + } + /** - * Thirdparty commercials cannot be the same in both thirdparties so we look for them and remove some - * Because this function is meant to be executed within a transaction, we won't take care of it. + * Thirdparty commercials cannot be the same in both thirdparties so we look for them and remove some to avoid duplicate. + * Because this function is meant to be executed within a transaction, we won't take care of begin/commit. */ $sql = 'SELECT rowid FROM '.MAIN_DB_PREFIX.'societe_commerciaux '; $sql .= ' WHERE fk_soc = '.(int) $dest_id.' AND fk_user IN ( '; diff --git a/htdocs/societe/contact.php b/htdocs/societe/contact.php index 4077c1e1b28..d57f61045c0 100644 --- a/htdocs/societe/contact.php +++ b/htdocs/societe/contact.php @@ -44,11 +44,7 @@ require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php'; if (! empty($conf->adherent->enabled)) require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; -$langs->load("companies"); -$langs->load("commercial"); -$langs->load("bills"); -$langs->load("banks"); -$langs->load("users"); +$langs->loadLangs(array("companies","commercial","bills","banks","users")); if (! empty($conf->categorie->enabled)) $langs->load("categories"); if (! empty($conf->incoterm->enabled)) $langs->load("incoterm"); if (! empty($conf->notification->enabled)) $langs->load("mails"); @@ -115,6 +111,9 @@ if (empty($reshook)) exit; } } + + // Selection of new fields + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; } @@ -169,8 +168,6 @@ else if ($action != 'presend') { - print '
'; - // Contacts list if (empty($conf->global->SOCIETE_DISABLE_CONTACTS)) { @@ -182,10 +179,6 @@ else { $result=show_addresses($conf,$langs,$db,$object,$_SERVER["PHP_SELF"].'?socid='.$object->id); } - - - print '
'; - } } diff --git a/htdocs/societe/note.php b/htdocs/societe/note.php index 0dbb20ebd00..d0766bc24d8 100644 --- a/htdocs/societe/note.php +++ b/htdocs/societe/note.php @@ -62,7 +62,7 @@ if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/' $help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas'; llxHeader('',$title,$help_url); -if ($id > 0) +if ($object->id > 0) { /* * Affichage onglets @@ -120,6 +120,11 @@ if ($id > 0) dol_fiche_end(); } +else +{ + $langs->load("errors"); + print $langs->trans("ErrorRecordNotFound"); +} llxFooter(); $db->close(); diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index cd7eaf67c73..b856b709acc 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -357,7 +357,7 @@ input.buttonpayment { background: none; padding-left: 30px; text-align: ; - border: 2px solid #ccc; + border: 1px solid #ddd; background-color: #eee; white-space: normal; }