Merge branch 'develop' into dev_event_factrec

This commit is contained in:
Laurent Destailleur 2022-05-16 15:34:39 +02:00 committed by GitHub
commit 61153f04c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 427 additions and 315 deletions

View File

@ -395,8 +395,8 @@ $sql .= $db->order($sortfield, $sortorder);
$nbtotalofrecords = '';
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$result = $db->query($sql);
$nbtotalofrecords = $db->num_rows($result);
$resql = $db->query($sql);
$nbtotalofrecords = $db->num_rows($resql);
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
$page = 0;
$offset = 0;
@ -406,9 +406,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
$sql .= $db->plimit($limit + 1, $offset);
dol_syslog("/accountancy/admin/productaccount.php", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
$param = '';
@ -608,7 +608,7 @@ if ($result) {
$i = 0;
while ($i < min($num, $limit)) {
$obj = $db->fetch_object($result);
$obj = $db->fetch_object($resql);
// Ref produit as link
$product_static->ref = $obj->ref;
@ -891,7 +891,7 @@ if ($result) {
print '</form>';
$db->free($result);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -586,11 +586,11 @@ class AccountingAccount extends CommonObject
$sql .= ' WHERE a.rowid = ' . ((int) $id);
dol_syslog(get_class($this) . '::info sql=' . $sql);
$result = $this->db->query($sql);
$resql = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
if ($obj->fk_user_author) {
$cuser = new User($this->db);
@ -605,7 +605,7 @@ class AccountingAccount extends CommonObject
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->tms);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}

View File

@ -266,14 +266,14 @@ class Lettering extends BookKeeping
$sql .= " ORDER BY ab2.lettering_code DESC";
$sql .= " LIMIT 1 ";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqla = $this->db->query($sql);
if ($resqla) {
$obj = $this->db->fetch_object($resqla);
$lettre = (empty($obj->lettering_code) ? 'AAA' : $obj->lettering_code);
if (!empty($obj->lettering_code)) {
$lettre++;
}
$this->db->free($result);
$this->db->free($resqla);
} else {
$this->errors[] = 'Error'.$this->db->lasterror();
$error++;
@ -281,14 +281,14 @@ class Lettering extends BookKeeping
$sql = "SELECT SUM(ABS(debit)) as deb, SUM(ABS(credit)) as cred FROM ".MAIN_DB_PREFIX."accounting_bookkeeping WHERE ";
$sql .= " rowid IN (".$this->db->sanitize(implode(',', $ids)).") AND lettering_code IS NULL AND subledger_account != ''";
$result = $this->db->query($sql);
if ($result) {
$obj = $this->db->fetch_object($result);
$resqlb = $this->db->query($sql);
if ($resqlb) {
$obj = $this->db->fetch_object($resqlb);
if (!(round(abs($obj->deb), 2) === round(abs($obj->cred), 2))) {
$this->errors[] = 'Total not exacts '.round(abs($obj->deb), 2).' vs '.round(abs($obj->cred), 2);
$error++;
}
$this->db->free($result);
$this->db->free($resqlb);
} else {
$this->errors[] = 'Erreur sql'.$this->db->lasterror();
$error++;

View File

@ -64,7 +64,7 @@ if ($action == 'set_default') {
} elseif ($action == 'del_default') {
$ret = delDocumentModel($value, $type);
if ($ret > 0) {
if ($conf->global->MEMBER_ADDON_PDF_ODT == "$value") {
if (getDolGlobalString('MEMBER_ADDON_PDF_ODT') == "$value") {
dolibarr_del_const($db, 'MEMBER_ADDON_PDF_ODT', $conf->entity);
}
}

View File

@ -95,12 +95,13 @@ if ($action == 'update') {
$form = new Form($db);
$title = $langs->trans("MembersSetup");
$help_url = 'EN:Module_Foundations|FR:Module_Adh&eacute;rents|ES:M&oacute;dulo_Miembros';
llxHeader('', $langs->trans("MembersSetup"), $help_url);
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("MembersSetup"), $linkback, 'title_setup');
print load_fiche_titre($title, $linkback, 'title_setup');
$head = member_admin_prepare_head();

View File

@ -490,17 +490,17 @@ class Subscription extends CommonObject
$sql .= ' FROM '.MAIN_DB_PREFIX.'subscription as c';
$sql .= ' WHERE c.rowid = '.((int) $id);
$result = $this->db->query($sql);
if ($result) {
if ($this->db->num_rows($result)) {
$obj = $this->db->fetch_object($result);
$resql = $this->db->query($sql);
if ($resql) {
if ($this->db->num_rows($resql)) {
$obj = $this->db->fetch_object($resql);
$this->id = $obj->rowid;
$this->date_creation = $this->db->jdate($obj->datec);
$this->date_modification = $this->db->jdate($obj->datem);
}
$this->db->free($result);
$this->db->free($resql);
} else {
dol_print_error($this->db);
}

View File

@ -99,12 +99,12 @@ $sql .= " WHERE t.entity IN (".getEntity('member_type').")";
$sql .= " GROUP BY t.rowid, t.libelle, t.subscription, d.statut";
dol_syslog("index.php::select nb of members per type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$adhtype = new AdherentType($db);
$adhtype->id = $objp->rowid;
@ -127,7 +127,7 @@ if ($result) {
$i++;
}
$db->free($result);
$db->free($resql);
}
$now = dol_now();
@ -143,16 +143,16 @@ $sql .= " AND t.rowid = d.fk_adherent_type";
$sql .= " GROUP BY d.fk_adherent_type";
dol_syslog("index.php::select nb of uptodate members by type", LOG_DEBUG);
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$i = 0;
while ($i < $num) {
$objp = $db->fetch_object($result);
$objp = $db->fetch_object($resql);
$MembersUpToDate[$objp->fk_adherent_type] = $objp->somme;
$i++;
}
$db->free();
$db->free($resql);
}
/*

View File

@ -1598,7 +1598,7 @@ class ActionComm extends CommonObject
//$tooltip .= '<br><b>'.img_picto('', 'email').' '.$langs->trans("Email").'</b>';
$tooltip .= '<br><b>'.$langs->trans('MailTopic').':</b> '.$this->email_subject;
$tooltip .= '<br><b>'.$langs->trans('MailFrom').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_from);
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b>, '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to);
$tooltip .= '<br><b>'.$langs->trans('MailTo').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_to);
if (!empty($this->email_tocc)) {
$tooltip .= '<br><b>'.$langs->trans('MailCC').':</b> '.str_replace(array('<', '>'), array('&amp;lt', '&amp;gt'), $this->email_tocc);
}

View File

@ -310,9 +310,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
if ($result_sql) {
$num = $db->num_rows($result_sql);
$resql = $db->query($sql);
if ($resql) {
$num = $db->num_rows($resql);
$numopen = $num;
} else {
dol_print_error($db);
@ -695,9 +695,9 @@ if ($object->id > 0) {
$sql .= " AND pfd.traite = 0";
$sql .= " AND pfd.ext_payment_id IS NULL";
$result_sql = $db->query($sql);
if ($result_sql) {
$obj = $db->fetch_object($result_sql);
$resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
if ($obj) {
$pending = $obj->amount;
}
@ -797,17 +797,17 @@ if ($object->id > 0) {
$sql .= " AND pfd.ext_payment_id IS NULL";
$sql .= " ORDER BY pfd.date_demande DESC";
$result_sql = $db->query($sql);
$resql = $db->query($sql);
$num = 0;
if ($result_sql) {
if ($resql) {
$i = 0;
$tmpuser = new User($db);
$num = $db->num_rows($result);
while ($i < $num) {
$obj = $db->fetch_object($result_sql);
$obj = $db->fetch_object($resql);
$tmpuser->id = $obj->user_id;
$tmpuser->login = $obj->login;
@ -840,7 +840,7 @@ if ($object->id > 0) {
$i++;
}
$db->free($result_sql);
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -198,7 +198,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -194,7 +194,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
/*print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total-$sumpaid,0,$outputlangs,1,-1,-1,$conf->currency).'</td></tr>';*/

View File

@ -143,7 +143,8 @@ if ($resql) {
print price($total);
print '</td><td class="right">&nbsp;</td>';
print "</tr></table>";
$db->free();
$db->free($resql);
} else {
dol_print_error($db);
}

View File

@ -772,16 +772,6 @@ class Contrat extends CommonObject
$now = dol_now();
/*
if (!is_object($extrafields)) {
require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
$extrafields = new ExtraFields($this->db);
}
$line = new ContratLigne($this->db);
$extrafields->fetch_name_optionals_label(ContratLigne::$table_element, true);
*/
$this->lines = array();
$pos = 0;
@ -875,7 +865,7 @@ class Contrat extends CommonObject
$line->date_fin_prevue = $this->db->jdate($objp->date_fin_validite);
$line->date_fin_reel = $this->db->jdate($objp->date_cloture);
// Retrieve all extrafields for contract
// Retrieve all extrafields for contract line
// fetch optionals attributes and labels
$line->fetch_optionals();

View File

@ -346,22 +346,27 @@ if ($result) {
while ($i < $num) {
$obj = $db->fetch_object($result);
$datem = $db->jdate($obj->tms);
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
$staticcontrat->id = $obj->cid;
$staticcompany->id = $obj->socid;
$staticcompany->name = $obj->name;
print '<tr class="oddeven">';
print '<td class="nowraponall">';
$staticcontrat->ref = ($obj->ref ? $obj->ref : $obj->cid);
$staticcontrat->id = $obj->cid;
print $staticcontrat->getNomUrl(1, 16);
if ($obj->nb_late) {
print img_warning($langs->trans("Late"));
}
print '</td>';
print '<td>';
$staticcompany->id = $obj->socid;
$staticcompany->name = $obj->name;
print $staticcompany->getNomUrl(1, '', 20);
print '</td>';
print '<td class="center">'.dol_print_date($db->jdate($obj->tms), 'dayhour').'</td>';
print '<td class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'">';
print dol_print_date($datem, 'dayhour');
print '</td>';
//print '<td class="left">'.$staticcontrat->LibStatut($obj->statut,2).'</td>';
print '<td class="right nowraponall" width="32">'.($obj->nb_initial > 0 ? '<span class="paddingright">'.$obj->nb_initial.'</span>'.$staticcontratligne->LibStatut(0, 3, -1, 'class="paddingleft"') : '').'</td>';
print '<td class="right nowraponall" width="32">'.($obj->nb_running > 0 ? '<span class="paddingright">'.$obj->nb_running.'</span>'.$staticcontratligne->LibStatut(4, 3, 0, 'class="marginleft"') : '').'</td>';
@ -451,7 +456,7 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {
@ -532,7 +537,8 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {
@ -614,7 +620,7 @@ if ($resql) {
print "</tr>\n";
$i++;
}
$db->free();
$db->free($resql);
print "</table></div>";
} else {

View File

@ -121,7 +121,7 @@ if ($action == 'add' && !empty($permissiontoadd)) {
// Fill array 'array_options' with data from add form
if (!$error) {
$ret = $extrafields->setOptionalsFromPost(null, $object);
$ret = $extrafields->setOptionalsFromPost(null, $object, '', 1);
if ($ret < 0) {
$error++;
}

View File

@ -147,7 +147,7 @@ class box_boms extends ModeleBoxes
}
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);

View File

@ -140,7 +140,7 @@ class box_clients extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel')
);

View File

@ -177,7 +177,7 @@ class box_contacts extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'),
);

View File

@ -83,8 +83,8 @@ class box_contracts extends ModeleBoxes
$thirdpartytmp = new Societe($this->db);
$sql = "SELECT s.nom as name, s.rowid as socid, s.email, s.client, s.fournisseur, s.code_client, s.code_fournisseur, s.code_compta, s.code_compta_fournisseur,";
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.fin_validite, c.date_cloture";
$sql .= ", c.ref_customer, c.ref_supplier";
$sql .= " c.rowid, c.ref, c.statut as fk_statut, c.date_contrat, c.datec, c.tms as date_modification, c.fin_validite, c.date_cloture,";
$sql .= " c.ref_customer, c.ref_supplier";
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c";
if (empty($user->rights->societe->client->voir) && !$user->socid) {
$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -117,6 +117,7 @@ class box_contracts extends ModeleBoxes
$objp = $this->db->fetch_object($resql);
$datec = $this->db->jdate($objp->datec);
$datem = $this->db->jdate($objp->date_modification);
$dateterm = $this->db->jdate($objp->fin_validite);
$dateclose = $this->db->jdate($objp->date_cloture);
$late = '';
@ -155,8 +156,8 @@ class box_contracts extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="right"',
'text' => dol_print_date($datec, 'day', 'tzuserrel'),
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);
$this->info_box_contents[$line][] = array(

View File

@ -145,7 +145,7 @@ class box_members extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, "day", 'tzuserrel'),
);

View File

@ -144,7 +144,7 @@ class box_mos extends ModeleBoxes
}
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("DateModification").': '.dol_print_date($datem, 'dayhour', 'tzuserrel')).'"',
'text' => dol_print_date($datem, 'day', 'tzuserrel'),
);

View File

@ -165,7 +165,7 @@ class box_propales extends ModeleBoxes
);
$this->info_box_contents[$line][] = array(
'td' => 'class="center nowraponall"',
'td' => 'class="center nowraponall" title="'.dol_escape_htmltag($langs->trans("Date").': '.dol_print_date($datem, 'day', 'tzuserrel')).'"',
'text' => dol_print_date($date, 'day', 'tzuserrel'),
);

View File

@ -7805,7 +7805,7 @@ abstract class CommonObject
* @param string $keyprefix Prefix string to add before name and id of field (can be used to avoid duplicate names)
* @param string $onetrtd All fields in same tr td. Used by objectline_create.tpl.php for example.
* @param string $display_type "card" for form display, "line" for document line display (extrafields on propal line, order line, etc...)
* @return string
* @return string String with html content to show
*/
public function showOptionals($extrafields, $mode = 'view', $params = null, $keysuffix = '', $keyprefix = '', $onetrtd = 0, $display_type = 'card')
{
@ -7814,13 +7814,20 @@ abstract class CommonObject
if (!is_object($form)) {
$form = new Form($db);
}
if (!is_object($extrafields)) {
dol_syslog('Bad parameter extrafields for showOptionals', LOG_ERR);
return 'Bad parameter extrafields for showOptionals';
}
if (!is_array($extrafields->attributes[$this->table_element])) {
dol_syslog("extrafields->attributes was not loaded with extrafields->fetch_name_optionals_label(table_element);", LOG_WARNING);
}
$out = '';
$parameters = array();
$reshook = $hookmanager->executeHooks('showOptionals', $parameters, $this, $action); // Note that $action and $object may have been modified by hook
if (empty($reshook)) {
if (key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) {
if (is_array($extrafields->attributes[$this->table_element]) && key_exists('label', $extrafields->attributes[$this->table_element]) && is_array($extrafields->attributes[$this->table_element]['label']) && count($extrafields->attributes[$this->table_element]['label']) > 0) {
$out .= "\n";
$out .= '<!-- commonobject:showOptionals --> ';
$out .= "\n";

View File

@ -1948,14 +1948,15 @@ class ExtraFields
/**
* Fill array_options property of object by extrafields value (using for data sent by forms)
*
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param object $object Object
* @param string $onlykey Only some keys are filled:
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
* @param array $extralabels Deprecated (old $array of extrafields, now set this to null)
* @param object $object Object
* @param string $onlykey Only some keys are filled:
* 'string' => When we make update of only one extrafield ($action = 'update_extras'), calling page can set this to avoid to have other extrafields being reset.
* '@GETPOSTISSET' => When we make update of several extrafields ($action = 'update'), calling page can set this to avoid to have fields not into POST being reset.
* @param int $todefaultifmissing 1=Set value to the default value in database if value is mandatory and missing
* @return int 1 if array_options set, 0 if no value, -1 if error (field required missing for example)
*/
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '')
public function setOptionalsFromPost($extralabels, &$object, $onlykey = '', $todefaultifmissing = 0)
{
global $_POST, $langs;
@ -2015,8 +2016,10 @@ class ExtraFields
|| (!is_array($_POST["options_".$key]) && isset($_POST["options_".$key]) && $this->attributes[$object->table_element]['type'][$key] == 'sellist' && $_POST['options_'.$key] == '0')
|| (is_array($_POST["options_".$key]) && empty($_POST["options_".$key]))) {
//print 'ccc'.$value.'-'.$this->attributes[$object->table_element]['required'][$key];
// Field is not defined. We mark this as a problem. We may fix it later if there is a default value and $todefaultifmissing is set.
$nofillrequired++;
$error_field_required[] = $langs->transnoentitiesnoconv($value);
$error_field_required[$key] = $langs->transnoentitiesnoconv($value);
}
}
@ -2047,12 +2050,22 @@ class ExtraFields
}
}
if (!empty($error_field_required[$key]) && $todefaultifmissing) {
// Value is required but we have a default value and we asked to set empty value to the default value
if (!empty($this->attributes[$object->table_element]['default']) && !is_null($this->attributes[$object->table_element]['default'][$key])) {
$value_key = $this->attributes[$object->table_element]['default'][$key];
unset($error_field_required[$key]);
$nofillrequired--;
}
}
$object->array_options["options_".$key] = $value_key;
}
if ($nofillrequired) {
$langs->load('errors');
setEventMessages($langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required), null, 'errors');
$this->error = $langs->trans('ErrorFieldsRequired').' : '.implode(', ', $error_field_required);
setEventMessages($this->error, null, 'errors');
return -1;
} else {
return 1;

View File

@ -1533,10 +1533,12 @@ class FormMail extends Form
if (!is_object($extrafields)) {
$extrafields = new ExtraFields($this->db);
}
$extrafields->fetch_name_optionals_label('product', true);
$product = new Product($this->db);
$product->fetch($line->fk_product, '', '', 1);
$product->fetch_optionals();
$extrafields->fetch_name_optionals_label($product->table_element, true);
if (is_array($extrafields->attributes[$product->table_element]['label']) && count($extrafields->attributes[$product->table_element]['label']) > 0) {
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {
$substit_line['__PRODUCT_EXTRAFIELD_'.strtoupper($key).'__'] = $product->array_options['options_'.$key];

View File

@ -2257,7 +2257,7 @@ function dol_format_address($object, $withcountry = 0, $sep = "\n", $outputlangs
$ret = '';
$countriesusingstate = array('AU', 'CA', 'US', 'IN', 'GB', 'ES', 'UK', 'TR', 'CN'); // See also MAIN_FORCE_STATE_INTO_ADDRESS
$sep = "\n";
// See format of addresses on https://en.wikipedia.org/wiki/Address
// Address
if (empty($mode)) {

View File

@ -509,7 +509,7 @@ function project_admin_prepare_head()
$head[$h][2] = 'attributes_task';
$h++;
if (getDolGlobalInt('MAIN_FEATURES_LEVEL') >= 2) {
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
$langs->load("members");
$head[$h][0] = DOL_URL_ROOT.'/projet/admin/website.php';
@ -2819,7 +2819,7 @@ function getTaskProgressView($task, $label = true, $progressNumber = true, $hide
$out .= ' </div>';
} else {
// bad
$out .= ' <div class="progress-bar progress-bar-consumed" style="width: '.floatval($progressCalculated).'%" title="'.floatval($progressCalculated).'%">';
$out .= ' <div class="progress-bar progress-bar-consumed-late" style="width: '.floatval($progressCalculated).'%" title="'.floatval($progressCalculated).'%">';
$out .= ' <div class="progress-bar '.$progressBarClass.'" style="width: '.($task->progress ? floatval($task->progress / $progressCalculated * 100).'%' : '1px').'" title="'.floatval($task->progress).'%"></div>';
$out .= ' </div>';
}

View File

@ -41,6 +41,7 @@ if (!isset($parameters)) {
}
$reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
print $hookmanager->resPrint;
if (empty($reshook)) {
$params = array();
@ -48,6 +49,7 @@ if (empty($reshook)) {
$params['tpl_context'] = $tpl_context;
}
$params['cols'] = key_exists('colspanvalue', $parameters) ? $parameters['colspanvalue'] : '';
print $object->showOptionals($extrafields, 'create', $params);
}

View File

@ -924,7 +924,8 @@ class InterfaceActionsAuto extends DolibarrTriggers
}
}
// If trackid is not defined, we set it
// If trackid is not defined, we set it.
// Note that it should be set by caller. This is for compatibility purpose only.
if (empty($object->trackid)) {
// See also similar list into emailcollector.class.php
if (preg_match('/^COMPANY_/', $action)) {
@ -1039,15 +1040,17 @@ class InterfaceActionsAuto extends DolibarrTriggers
$actioncomm->contact_id = $contactforaction->id; // deprecated, use ->socpeopleassigned instead
$actioncomm->authorid = $user->id; // User saving action
$actioncomm->userownerid = $user->id; // Owner of action
// Fields defined when action is an email (content should be into object->actionmsg to be added into note, subject into object->actionms2 to be added into label)
$actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
$actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
$actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
$actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
$actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
$actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
$actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
// Fields defined when action is an email (content should be into object->actionmsg to be added into event note, subject should be into object->actionms2 to be added into event label)
if (!property_exists($object, 'email_fields_no_propagate_in_actioncomm') || empty($object->email_fields_no_propagate_in_actioncomm)) {
$actioncomm->email_msgid = empty($object->email_msgid) ? null : $object->email_msgid;
$actioncomm->email_from = empty($object->email_from) ? null : $object->email_from;
$actioncomm->email_sender = empty($object->email_sender) ? null : $object->email_sender;
$actioncomm->email_to = empty($object->email_to) ? null : $object->email_to;
$actioncomm->email_tocc = empty($object->email_tocc) ? null : $object->email_tocc;
$actioncomm->email_tobcc = empty($object->email_tobcc) ? null : $object->email_tobcc;
$actioncomm->email_subject = empty($object->email_subject) ? null : $object->email_subject;
$actioncomm->errors_to = empty($object->errors_to) ? null : $object->errors_to;
}
// Object linked (if link is for thirdparty, contact, project it is a recording error. We should not have links in link table
// for such objects because there is already a dedicated field into table llx_actioncomm or llx_actioncomm_resources.

View File

@ -149,7 +149,7 @@ $resql = $db->query($sql);
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}

View File

@ -212,7 +212,7 @@ if ($action == 'create' || empty($action)) {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
print '<tr><td>'.$langs->trans("AlreadyPaid").'</td><td>'.price($sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("RemainderToPay").'</td><td>'.price($total - $sumpaid, 0, $outputlangs, 1, -1, -1, $conf->currency).'</td></tr>';

View File

@ -3523,7 +3523,7 @@ class CommandeFournisseur extends CommonOrder
empty($this->receptions[$obj->rowid]) ? $this->receptions[$obj->rowid] = $obj->qty : $this->receptions[$obj->rowid] += $obj->qty;
$i++;
}
$this->db->free();
$this->db->free($resql);
return $num;
} else {

View File

@ -146,6 +146,27 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 5
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 56, 5601, '', 0, 'Brasil');
-- Burundi Regions (id country=61) -- https://fr.wikipedia.org/wiki/Provinces_du_Burundi
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6101, '', 0, 'Bubanza');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6102, '', 0, 'Bujumbura Mairie');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6103, '', 0, 'Bujumbura Rural');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6104, '', 0, 'Bururi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6105, '', 0, 'Cankuzo');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6106, '', 0, 'Cibitoke');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6107, '', 0, 'Gitega');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6108, '', 0, 'Karuzi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6109, '', 0, 'Kayanza');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6110, '', 0, 'Kirundo');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6111, '', 0, 'Makamba');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6112, '', 0, 'Muramvya');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6113, '', 0, 'Muyinga');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6114, '', 0, 'Mwaro');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6115, '', 0, 'Ngozi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6116, '', 0, 'Rumonge');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6117, '', 0, 'Rutana');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6118, '', 0, 'Ruyigi');
-- Canada Region (id country=14)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 14, 1401, '', 0, 'Canada');
@ -512,25 +533,3 @@ INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 2
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23208, '', 0, 'Nor-Oriental');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 232, 23209, '', 0, 'Zuliana');
-- Burundi Regions (id country=61) -- https://fr.wikipedia.org/wiki/Provinces_du_Burundi
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6101, '', 0, 'Bubanza');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6102, '', 0, 'Bujumbura Mairie');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6103, '', 0, 'Bujumbura Rural');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6104, '', 0, 'Bururi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6105, '', 0, 'Cankuzo');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6106, '', 0, 'Cibitoke');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6107, '', 0, 'Gitega');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6108, '', 0, 'Karuzi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6109, '', 0, 'Kayanza');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6110, '', 0, 'Kirundo');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6111, '', 0, 'Makamba');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6112, '', 0, 'Muramvya');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6113, '', 0, 'Muyinga');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6114, '', 0, 'Mwaro');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6115, '', 0, 'Ngozi');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6116, '', 0, 'Rumonge');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6117, '', 0, 'Rutana');
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 61, 6118, '', 0, 'Ruyigi');

View File

@ -28,7 +28,9 @@ CREATE TABLE llx_webhook_target(
fk_user_modif integer,
import_key varchar(14),
status integer DEFAULT 0 NOT NULL,
url varchar(255) NOT NULL,
trigger_codes text NOT NULL
url varchar(255) NOT NULL,
connection_method varchar(255) NULL, -- to store the way to authenticate to the webhook
connection_data varchar(255) NULL, -- to store the data to use to authenticate to the webhook
trigger_codes text NULL -- list of selected trigger that must call the webhook
-- END MODULEBUILDER FIELDS
) ENGINE=innodb;

View File

@ -82,7 +82,7 @@ $form = new Form($db);
/*
// fetch optionals attributes and labels
$extralabels = $extrafields->fetch_name_optionals_label('intracommreport');
$extralabels = $extrafields->fetch_name_optionals_label($object->table_element);
$search_array_options=$extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
*/

View File

@ -2253,4 +2253,5 @@ HashForPing=Hash used for ping
ReadOnlyMode=Is instance in "Read Only" mode
DEBUGBAR_USE_LOG_FILE=Use the <b>dolibarr.log</b> file to trap Logs
UsingLogFileShowAllRecordOfSubrequestButIsSlower=Use the dolibarr.log file to trap Logs instead of live memory catching. It allows to catch all logs instead of only log of current process (so including the one of ajax subrequests pages) but will make your instance very very slow. Not recommended.
FixedOrPercent=Fixed (use keyword 'fixed') or percent (use keyword 'percent')
FixedOrPercent=Fixed (use keyword 'fixed') or percent (use keyword 'percent')
DefaultOpportunityStatus=Default opportunity status (first status when lead is created)

View File

@ -1174,3 +1174,5 @@ ConfirmAllocateCommercial=Assign sales representative confirmation
ConfirmAllocateCommercialQuestion=Are you sure you want to assign the %s selected record(s)?
CommercialsAffected=Sales representatives affected
CommercialAffected=Sales representative affected
YourMessage=Votre message
YourMessageHasBeenReceived=Your message has been received. We will answer or contact you as soon as possible.

View File

@ -289,3 +289,8 @@ FormForNewLeadDesc=Thanks to fill the following form to contact us. You can also
ProjectsHavingThisContact=Projects having this contact
StartDateCannotBeAfterEndDate=End date cannot be before start date
ErrorPROJECTLEADERRoleMissingRestoreIt=The "PROJECTLEADER" role is missing or has been de-activited, please restore in the dictionary of contact types
LeadPublicFormDesc=You can enable here a public page to allow your prospects to make a first contact to you from a public online form
EnablePublicLeadForm=Enable the public form for contact
NewLeadbyWeb=Your message or request has been recorded. We will answer or contact your soon.
NewLeadForm=New contact form
LeadFromPublicForm=Online lead from public form

View File

@ -244,7 +244,7 @@ if ($action == 'create') {
if ($resql) {
$obj = $db->fetch_object($resql);
$sumpaid = $obj->total;
$db->free();
$db->free($resql);
}
print '<form name="add_payment" action="'.$_SERVER['PHP_SELF'].'" method="post">';

View File

@ -154,7 +154,6 @@ class PriceParser
//Retrieve all extrafield for product and add it to values
$extrafields = new ExtraFields($this->db);
$extrafields->fetch_name_optionals_label('product', true);
$product->fetch_optionals();
if (is_array($extrafields->attributes[$product->table_element]['label'])) {
foreach ($extrafields->attributes[$product->table_element]['label'] as $key => $label) {

View File

@ -265,7 +265,7 @@ print '<td width="80">&nbsp;</td></tr>'."\n";
print '<tr class="oddeven">';
print '<td width="80%">'.$langs->trans("ManageOpportunitiesStatus").'</td>';
print '<td width="60" class="right">';
print ajax_constantonoff("PROJECT_USE_OPPORTUNITIES");
print ajax_constantonoff("PROJECT_USE_OPPORTUNITIES", null, null, 0, 0, 1);
print '</td><td class="right">';
print "</td>";
print '</tr>';

View File

@ -28,6 +28,7 @@ require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php';
// Load translation files required by the page
@ -35,10 +36,14 @@ $langs->loadLangs(array("admin", "members"));
$action = GETPOST('action', 'aZ09');
$defaultoppstatus = getDolGlobalInt('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
if (!$user->admin) {
accessforbidden();
}
$error = 0;
/*
* Actions
@ -54,8 +59,10 @@ if ($action == 'setPROJECT_ENABLE_PUBLIC') {
if ($action == 'update') {
$public = GETPOST('PROJECT_ENABLE_PUBLIC');
$defaultoppstatus = GETPOST('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', 'int');
$res = dolibarr_set_const($db, "PROJECT_ENABLE_PUBLIC", $public, 'chaine', 0, '', $conf->entity);
$res = dolibarr_set_const($db, "PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD", $defaultoppstatus, 'chaine', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
@ -74,13 +81,15 @@ if ($action == 'update') {
*/
$form = new Form($db);
$formproject = new FormProjets($db);
$title = $langs->trans("ProjectsSetup");
$help_url = '';
llxHeader('', $langs->trans("ProjectsSetup"), $help_url);
llxHeader('', $title, $help_url);
$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ProjectsSetup"), $linkback, 'title_setup');
print load_fiche_titre($title, $linkback, 'title_setup');
$head = project_admin_prepare_head();
@ -90,11 +99,12 @@ print '<form action="'.$_SERVER["PHP_SELF"].'" method="post">';
print '<input type="hidden" name="action" value="update">';
print '<input type="hidden" name="token" value="'.newToken().'">';
print dol_get_fiche_head($head, 'website', $langs->trans("Projects"), -1, 'user');
print dol_get_fiche_head($head, 'website', $langs->trans("Projects"), -1, 'project');
print '<span class="opacitymedium">'.$langs->trans("LeadPublicFormDesc").'</span><br><br>';
$param = '';
$enabledisablehtml = $langs->trans("EnablePublicLeadForm").' ';
if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
@ -111,6 +121,33 @@ if (empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
print $enabledisablehtml;
print '<input type="hidden" id="PROJECT_ENABLE_PUBLIC" name="PROJECT_ENABLE_PUBLIC" value="'.(empty($conf->global->PROJECT_ENABLE_PUBLIC) ? 0 : 1).'">';
print '<br>';
if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
print '<br>';
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td class="right">'.$langs->trans("Value").'</td>';
print "</tr>\n";
// Default opportunity status
print '<tr class="oddeven drag" id="trforcetype"><td>';
print $langs->trans("DefaultOpportunityStatus");
print '</td><td class="right">';
print $formproject->selectOpportunityStatus('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', GETPOSTISSET('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD') ? GETPOST('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD', 'int') : $defaultoppstatus, 1, 0, 0, 0, '', 0, 1);
print "</td></tr>\n";
print '</table>';
print '</div>';
print '<div class="center">';
print '<input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'">';
print '</div>';
}
print dol_get_fiche_end();
@ -120,8 +157,8 @@ print '</form>';
if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
print '<br>';
//print $langs->trans('FollowingLinksArePublic').'<br>';
print img_picto('', 'globe').' '.$langs->trans('BlankSubscriptionForm').':<br>';
if ($conf->multicompany->enabled) {
print img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans('BlankSubscriptionForm').'</span><br>';
if (!empty($conf->multicompany->enabled)) {
$entity_qr = '?entity='.$conf->entity;
} else {
$entity_qr = '';
@ -132,7 +169,11 @@ if (!empty($conf->global->PROJECT_ENABLE_PUBLIC)) {
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/project/new.php'.$entity_qr.'">'.$urlwithroot.'/public/project/new.php'.$entity_qr.'</a>';
print '<div class="urllink">';
print '<input type="text" id="publicurlmember" class="quatrevingtpercentminusx" value="'.$urlwithroot.'/public/project/new.php'.$entity_qr.'">';
print '<a target="_blank" rel="noopener noreferrer" href="'.$urlwithroot.'/public/project/new.php'.$entity_qr.'">'.img_picto('', 'globe', 'class="paddingleft"').'</a>';
print '</div>';
print ajax_autoselect('publicurlmember');
}
// End of page

View File

@ -159,7 +159,9 @@ class Project extends CommonObject
public $statuts_long;
public $statut; // 0=draft, 1=opened, 2=closed
public $opp_status; // opportunity status, into table llx_c_lead_status
public $fk_opp_status; // opportunity status, into table llx_c_lead_status
public $opp_percent; // opportunity probability
public $email_msgid;
@ -236,14 +238,14 @@ class Project extends CommonObject
'datee' =>array('type'=>'date', 'label'=>'DateEnd', 'enabled'=>1, 'visible'=>1, 'position'=>35),
'description' =>array('type'=>'text', 'label'=>'Description', 'enabled'=>1, 'visible'=>3, 'position'=>55, 'searchall'=>1),
'public' =>array('type'=>'integer', 'label'=>'Visibility', 'enabled'=>1, 'visible'=>1, 'position'=>65),
'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>1, 'visible'=>1, 'position'=>75),
'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>1, 'visible'=>1, 'position'=>80),
'fk_opp_status' =>array('type'=>'integer', 'label'=>'OpportunityStatusShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>75),
'opp_percent' =>array('type'=>'double(5,2)', 'label'=>'OpportunityProbabilityShort', 'enabled'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'visible'=>1, 'position'=>80),
'note_private' =>array('type'=>'text', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>85, 'searchall'=>1),
'note_public' =>array('type'=>'text', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>90, 'searchall'=>1),
'model_pdf' =>array('type'=>'varchar(255)', 'label'=>'ModelPdf', 'enabled'=>1, 'visible'=>0, 'position'=>95),
'date_close' =>array('type'=>'datetime', 'label'=>'DateClosing', 'enabled'=>1, 'visible'=>0, 'position'=>105),
'fk_user_close' =>array('type'=>'integer', 'label'=>'UserClosing', 'enabled'=>1, 'visible'=>0, 'position'=>110),
'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>1, 'position'=>115),
'opp_amount' =>array('type'=>'double(24,8)', 'label'=>'OpportunityAmountShort', 'enabled'=>1, 'visible'=>'!empty($conf->global->PROJECT_USE_OPPORTUNITIES)', 'position'=>115),
'budget_amount' =>array('type'=>'double(24,8)', 'label'=>'Budget', 'enabled'=>1, 'visible'=>1, 'position'=>119),
'usage_bill_time' =>array('type'=>'integer', 'label'=>'UsageBillTimeShort', 'enabled'=>1, 'visible'=>-1, 'position'=>130),
'usage_opportunity' =>array('type'=>'integer', 'label'=>'UsageOpportunity', 'enabled'=>1, 'visible'=>-1, 'position'=>135),

View File

@ -28,6 +28,10 @@ class ProjectStats extends Stats
public $userid;
public $socid;
public $year;
public $yearmonth;
public $status;
public $opp_status;
/**
* Constructor
@ -180,7 +184,25 @@ class ProjectStats extends Stats
}
if (!empty($this->status)) {
$sqlwhere[] = " t.fk_opp_status IN (".$this->db->sanitize($this->status).")";
$sqlwhere[] = " t.fk_statut IN (".$this->db->sanitize($this->status).")";
}
if (!empty($this->opp_status)) {
if (is_numeric($this->opp_status) && $this->opp_status > 0) {
$sqlwhere[] = " t.fk_opp_status = ".((int) $this->opp_status);
}
if ($this->opp_status == 'all') {
$sqlwhere[] = " (t.fk_opp_status IS NOT NULL AND t.fk_opp_status <> -1)";
}
if ($this->opp_status == 'openedopp') {
$sqlwhere[] = " (t.fk_opp_status IS NOT NULL AND t.fk_opp_status <> -1 AND t.fk_opp_status NOT IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code IN ('WON','LOST')))";
}
if ($this->opp_status == 'notopenedopp') {
$sqlwhere[] = " (t.fk_opp_status IS NULL OR t.fk_opp_status = -1 OR t.fk_opp_status IN (SELECT rowid FROM ".MAIN_DB_PREFIX."c_lead_status WHERE code = 'WON'))";
}
if ($this->opp_status == 'none') {
$sqlwhere[] = " (t.fk_opp_status IS NULL OR t.fk_opp_status = -1)";
}
}
if (empty($user->rights->projet->all->lire)) {

View File

@ -932,7 +932,7 @@ if (!empty($arrayfields['p.public']['checked'])) {
// Opp status
if (!empty($arrayfields['p.fk_opp_status']['checked'])) {
print '<td class="liste_titre nowrap center">';
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100', 1);
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth100', 1, 0);
print '</td>';
}
if (!empty($arrayfields['p.opp_amount']['checked'])) {
@ -1174,8 +1174,8 @@ while ($i < min($num, $limit)) {
}
// Title
if (!empty($arrayfields['p.title']['checked'])) {
print '<td class="tdoverflowmax200">';
print dol_trunc($obj->title, 80);
print '<td class="tdoverflowmax200" title="'.dol_escape_htmltag($obj->title).'">';
print $obj->title;
print '</td>';
if (!$i) {
$totalarray['nbfield']++;

View File

@ -24,18 +24,15 @@
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/project.lib.php';
require_once DOL_DOCUMENT_ROOT.'/projet/class/projectstats.class.php';
// Security check
if (!$user->rights->projet->lire) {
accessforbidden();
}
$WIDTH = DolGraph::getDefaultGraphSizeForStats('width');
$HEIGHT = DolGraph::getDefaultGraphSizeForStats('height');
$search_opp_status = GETPOST("search_opp_status", 'alpha');
$userid = GETPOST('userid', 'int');
$socid = GETPOST('socid', 'int');
// Security check
@ -44,19 +41,25 @@ if ($user->socid > 0) {
$socid = $user->socid;
}
$nowyear = strftime("%Y", dol_now());
$year = GETPOST('year') > 0 ?GETPOST('year') : $nowyear;
$year = GETPOST('year', 'int') > 0 ? GETPOST('year', 'int') : $nowyear;
$startyear = $year - (empty($conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS) ? 2 : max(1, min(10, $conf->global->MAIN_STATS_GRAPHS_SHOW_N_YEARS)));
$endyear = $year;
// Load translation files required by the page
$langs->loadLangs(array('companies', 'projects'));
// Security check
if (!$user->rights->projet->lire) {
accessforbidden();
}
/*
* View
*/
$form = new Form($db);
$formproject = new FormProjets($db);
$includeuserlist = array();
@ -82,66 +85,11 @@ if (!empty($year)) {
$stats_project->year = $year;
}
/*
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES))
{
// Current stats of project amount per status
$data1 = $stats_project->getAllProjectByStatus();
if (!is_array($data1) && $data1 < 0) {
setEventMessages($stats_project->error, null, 'errors');
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
if ($search_opp_status) {
$stats_project->opp_status = $search_opp_status;
}
if (empty($data1))
{
$showpointvalue = 0;
$nocolor = 1;
$data1 = array(array(0=>$langs->trans("None"), 1=>1));
}
$filenamenb = $conf->project->dir_output."/stats/projectbystatus.png";
$fileurlnb = DOL_URL_ROOT.'/viewimage.php?modulepart=projectstats&amp;file=projectbystatus.png';
$px = new DolGraph();
$mesg = $px->isGraphKo();
if (empty($mesg)) {
$i = 0; $tot = count($data1); $legend = array();
while ($i <= $tot)
{
$legend[] = $data1[$i][0];
$i++;
}
$px->SetData($data1);
unset($data1);
if ($nocolor)
$px->SetDataColor(array(
array(
220,
220,
220
)
));
$px->SetLegend($legend);
$px->setShowLegend(0);
$px->setShowPointValue($showpointvalue);
$px->setShowPercent(1);
$px->SetMaxValue($px->GetCeilMaxValue());
$px->SetWidth($WIDTH);
$px->SetHeight($HEIGHT);
$px->SetShading(3);
$px->SetHorizTickIncrement(1);
$px->SetCssPrefix("cssboxes");
$px->SetType(array('pie'));
$px->SetTitle($langs->trans('OpportunitiesStatusForProjects'));
$result = $px->draw($filenamenb, $fileurlnb);
if ($result < 0) {
setEventMessages($px->error, null, 'errors');
}
} else {
setEventMessages(null, $mesg, 'errors');
}
}*/
}
// Build graphic number of object
@ -285,12 +233,19 @@ print '<tr><td>'.$langs->trans("ThirdParty").'</td><td>';
print img_picto('', 'company', 'class="pictofixedwidth"');
print $form->select_company($socid, 'socid', '', 1, 0, 0, array(), 0, 'widthcentpercentminusx maxwidth300', '');
print '</td></tr>';
// Opportunity status
if (!empty($conf->global->PROJECT_USE_OPPORTUNITIES)) {
print '<tr><td>'.$langs->trans("OpportunityStatusShort").'</td><td>';
print $formproject->selectOpportunityStatus('search_opp_status', $search_opp_status, 1, 0, 1, 0, 'maxwidth300', 1, 1);
print '</td></tr>';
}
// User
/*print '<tr><td>'.$langs->trans("ProjectCommercial").'</td><td>';
print $form->select_dolusers($userid, 'userid', 1, array(),0,$includeuserlist);
print '</td></tr>';*/
// Year
print '<tr><td>'.$langs->trans("Year").'</td><td>';
print '<tr><td>'.$langs->trans("Year").' <span class="opacitymedium">('.$langs->trans("DateCreation").')</span></td><td>';
if (!in_array($year, $arrayyears)) {
$arrayyears[$year] = $year;
}

View File

@ -57,7 +57,6 @@ if (!defined('NOIPCHECK')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
@ -430,7 +429,7 @@ if (empty($reshook) && $action == 'added') {
llxHeaderVierge($langs->trans("NewMemberForm"));
// Si on a pas ete redirige
print '<br>';
print '<br><br>';
print '<div class="center">';
print $langs->trans("NewMemberbyWeb");
print '</div>';
@ -448,7 +447,7 @@ if (empty($reshook) && $action == 'added') {
$form = new Form($db);
$formcompany = new FormCompany($db);
$adht = new AdherentType($db);
$extrafields->fetch_name_optionals_label('adherent'); // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
llxHeaderVierge($langs->trans("NewSubscription"));

View File

@ -419,7 +419,7 @@ if (empty($reshook) && $action == 'added') {
llxHeaderVierge($langs->trans("NewPartnershipForm"));
// Si on a pas ete redirige
print '<br>';
print '<br><br>';
print '<div class="center">';
print $langs->trans("NewPartnershipbyWeb");
print '</div>';
@ -437,7 +437,7 @@ if (empty($reshook) && $action == 'added') {
$form = new Form($db);
$formcompany = new FormCompany($db);
$extrafields->fetch_name_optionals_label('partnership'); // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($partnership->table_element); // fetch optionals attributes and labels
llxHeaderVierge($langs->trans("NewPartnershipRequest"));

View File

@ -45,7 +45,6 @@ if (!defined('NOIPCHECK')) {
// For MultiCompany module.
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
// TODO This should be useless. Because entity must be retrieve from object ref and not from url.
$entity = (!empty($_GET['entity']) ? (int) $_GET['entity'] : (!empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
if (is_numeric($entity)) {
define("DOLENTITY", $entity);
@ -132,9 +131,9 @@ function llxHeaderVierge($title, $head = "", $disablejs = 0, $disablehead = 0, $
print '</div>';
}
if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT)) {
print '<div class="backimagepublicorganizedevent">';
print '<img id="idPROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_ORGANIZEDEVENT.'">';
if (!empty($conf->global->PROJECT_IMAGE_PUBLIC_NEWLEAD)) {
print '<div class="backimagepublicnewlead">';
print '<img id="idPROJECT_IMAGE_PUBLIC_NEWLEAD" src="'.$conf->global->PROJECT_IMAGE_PUBLIC_NEWLEAD.'">';
print '</div>';
}
@ -159,22 +158,6 @@ function llxFooterVierge()
}
$arrayofdata = array();
if (GETPOST('action') == 'addlead') {
// When a json request is sent
$entityBody = file_get_contents('php://input');
if ($entityBody) {
$arrayofdata = json_decode($entityBody, true);
}
print 'Date received and lead created';
$db->close();
exit;
}
/*
* Actions
@ -194,42 +177,6 @@ if (empty($reshook) && $action == 'add') {
$db->begin();
// test if lead already exists
/*
if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) {
if (!GETPOST('login')) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Login"))."<br>\n";
}
$sql = "SELECT login FROM ".MAIN_DB_PREFIX."adherent WHERE login='".$db->escape(GETPOST('login'))."'";
$result = $db->query($sql);
if ($result) {
$num = $db->num_rows($result);
}
if ($num != 0) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorLoginAlreadyExists")."<br>\n";
}
if (!GETPOSTISSET("pass1") || !GETPOSTISSET("pass2") || GETPOST("pass1", 'none') == '' || GETPOST("pass2", 'none') == '' || GETPOST("pass1", 'none') != GETPOST("pass2", 'none')) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorPasswordsMustMatch")."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("EMail"))."<br>\n";
}
}
*/
if (GETPOST('type') <= 0) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Type"))."<br>\n";
}
if (!in_array(GETPOST('morphy'), array('mor', 'phy'))) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv('Nature'))."<br>\n";
}
if (!GETPOST("lastname")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Lastname"))."<br>\n";
@ -238,27 +185,124 @@ if (empty($reshook) && $action == 'add') {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Firstname"))."<br>\n";
}
if (!GETPOST("email")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Email"))."<br>\n";
}
if (!GETPOST("description")) {
$error++;
$errmsg .= $langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Message"))."<br>\n";
}
if (GETPOST("email") && !isValidEmail(GETPOST("email"))) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorBadEMail", GETPOST("email"))."<br>\n";
}
// Set default opportunity status
$defaultoppstatus = getDolGlobalString('PROJECT_DEFAULT_OPPORTUNITY_STATUS_FOR_ONLINE_LEAD');
if (empty($defaultoppstatus)) {
$error++;
$langs->load("errors");
$errmsg .= $langs->trans("ErrorModuleSetupNotComplete", $langs->transnoentitiesnoconv("Project"))."<br>\n";
}
$proj = new Project($db);
$thirdparty = new Societe($db);
if (!$error) {
// email a peu pres correct et le login n'existe pas
$proj = new Project($db);
$proj->statut = -1;
// Search thirdparty and set it if found to the new created project
$result = $thirdparty->fetch(0, '', '', '', '', '', '', '', '', '', $object->email);
if ($result > 0) {
$proj->socid = $thirdparty->id;
} else {
// Create the prospect
if (GETPOST('societe')) {
$thirdparty->name = GETPOST('societe');
$thirdparty->name_alias = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
} else {
$thirdparty->name = dolGetFirstLastname(GETPOST('firstname'), GETPOST('lastname'));
}
$thirdparty->address = GETPOST('address');
$thirdparty->zip = GETPOST('zip');
$thirdparty->town = GETPOST('town');
$thirdparty->country_id = GETPOST('country_id', 'int');
$thirdparty->state_id = GETPOST('state_id');
$thirdparty->client = $thirdparty::PROSPECT;
$thirdparty->code_client = 'auto';
$thirdparty->code_fournisseur = 'auto';
// Fill array 'array_options' with data from the form
$extrafields->fetch_name_optionals_label($thirdparty->table_element);
$ret = $extrafields->setOptionalsFromPost(null, $thirdparty, '', 1);
//var_dump($thirdparty->array_options);exit;
if ($ret < 0) {
$error++;
$errmsg = ($extrafields->error ? $extrafields->error.'<br>' : '').join('<br>', $extrafields->errors);
}
if (!$error) {
$result = $thirdparty->create($user);
if ($result <= 0) {
$error++;
$errmsg = ($thirdparty->error ? $thirdparty->error.'<br>' : '').join('<br>', $thirdparty->errors);
} else {
$proj->socid = $thirdparty->id;
}
}
}
}
if (!$error) {
// Defined the ref into $defaultref
$defaultref = '';
$modele = empty($conf->global->PROJECT_ADDON) ? 'mod_project_simple' : $conf->global->PROJECT_ADDON;
// Search template files
$file = ''; $classname = ''; $filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/project/".$modele.'.php', 0);
if (file_exists($file)) {
$filefound = 1;
$classname = $modele;
break;
}
}
if ($filefound) {
$result = dol_include_once($reldir."core/modules/project/".$modele.'.php');
$modProject = new $classname;
$defaultref = $modProject->getNextValue($thirdparty, $object);
}
if (is_numeric($defaultref) && $defaultref <= 0) {
$defaultref = '';
}
if (empty($defaultref)) {
$defaultref = 'PJ'.dol_print_date(dol_now(), 'dayrfc');
}
$proj->ref = $defaultref;
$proj->statut = $proj::STATUS_DRAFT;
$proj->status = $proj::STATUS_DRAFT;
$proj->email = GETPOST("email");
$proj->note_private = GETPOST("note_private");
$proj->public = 1;
$proj->usage_opportunity = 1;
$proj->title = $langs->trans("LeadFromPublicForm");
$proj->description = GETPOST("description", "alphanohtml");
$proj->opp_status = $defaultoppstatus;
$proj->fk_opp_status = $defaultoppstatus;
// Fill array 'array_options' with data from add form
// Fill array 'array_options' with data from the form
$extrafields->fetch_name_optionals_label($proj->table_element);
$ret = $extrafields->setOptionalsFromPost(null, $proj);
if ($ret < 0) {
$error++;
}
// Create the project
$result = $proj->create($user);
if ($result > 0) {
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
@ -275,7 +319,7 @@ if (empty($reshook) && $action == 'add') {
$outputlangs = new Translate('', $conf);
$outputlangs->setDefaultLang(empty($object->thirdparty->default_lang) ? $mysoc->default_lang : $object->thirdparty->default_lang);
// Load traductions files required by page
$outputlangs->loadLangs(array("main", "members"));
$outputlangs->loadLangs(array("main", "members", "projects"));
// Get email content from template
$arraydefaultmessage = null;
$labeltouse = $conf->global->PROJECT_EMAIL_TEMPLATE_AUTOLEAD;
@ -288,11 +332,15 @@ if (empty($reshook) && $action == 'add') {
$subject = $arraydefaultmessage->topic;
$msg = $arraydefaultmessage->content;
}
if (empty($labeltosue)) {
$labeltouse = '['.$mysoc->name.'] '.$langs->trans("YourMessage");
$msg = $langs->trans("YourMessageHasBeenReceived");
}
$substitutionarray = getCommonSubstitutionArray($outputlangs, 0, null, $object);
complete_substitutions_array($substitutionarray, $outputlangs, $object);
$subjecttosend = make_substitutions($subject, $substitutionarray, $outputlangs);
$texttosend = make_substitutions(dol_concatdesc($msg, $adht->getMailOnValid()), $substitutionarray, $outputlangs);
$texttosend = make_substitutions($msg, $substitutionarray, $outputlangs);
if ($subjecttosend && $texttosend) {
$moreinheader = 'X-Dolibarr-Info: send_an_email by public/lead/new.php'."\r\n";
@ -317,10 +365,11 @@ if (empty($reshook) && $action == 'add') {
if (!empty($entity)) {
$urlback .= '&entity='.$entity;
}
dol_syslog("project lead ".$proj->ref." was created, we redirect to ".$urlback);
dol_syslog("project lead ".$proj->ref." has been created, we redirect to ".$urlback);
} else {
$error++;
$errmsg .= join('<br>', $proj->errors);
$errmsg .= $proj->error.'<br>'.join('<br>', $proj->errors);
}
}
@ -334,23 +383,16 @@ if (empty($reshook) && $action == 'add') {
}
}
// Create lead from $arrayofdata
if (empty($reshook) && !empty($arrayofdata)) {
// TODO
dol_syslog(var_export($arrayofdata, true));
// ...
}
// Action called after a submitted was send and member created successfully
// If MEMBER_URL_REDIRECT_SUBSCRIPTION is set to url we never go here because a redirect was done to this url.
// backtopage parameter with an url was set on member submit page, we never go here because a redirect was done to this url.
if (empty($reshook) && $action == 'added') {
llxHeaderVierge($langs->trans("NewMemberForm"));
llxHeaderVierge($langs->trans("NewLeadForm"));
// Si on a pas ete redirige
print '<br>';
print '<br><br>';
print '<div class="center">';
print $langs->trans("NewMemberbyWeb");
print $langs->trans("NewLeadbyWeb");
print '</div>';
llxFooterVierge();
@ -365,8 +407,8 @@ if (empty($reshook) && $action == 'added') {
$form = new Form($db);
$formcompany = new FormCompany($db);
$extrafields->fetch_name_optionals_label('project'); // fetch optionals attributes and labels
$extrafields->fetch_name_optionals_label($object->table_element); // fetch optionals attributes and labels
llxHeaderVierge($langs->trans("NewContact"));
@ -415,14 +457,16 @@ jQuery(document).ready(function () {
print '<table class="border" summary="form to subscribe" id="tablesubscribe">'."\n";
// Lastname
print '<tr><td>'.$langs->trans("Lastname").' <span style="color: red">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("Lastname").' <span style="color: red">*</span></td><td><input type="text" name="lastname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('lastname')).'" required></td></tr>'."\n";
// Firstname
print '<tr><td>'.$langs->trans("Firstname").' <span style="color: red">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'"></td></tr>'."\n";
print '<tr><td>'.$langs->trans("Firstname").' <span style="color: red">*</span></td><td><input type="text" name="firstname" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('firstname')).'" required></td></tr>'."\n";
// EMail
print '<tr><td>'.$langs->trans("Email").' <span style="color: red">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'" required></td></tr>'."\n";
// Company
print '<tr id="trcompany" class="trcompany"><td>'.$langs->trans("Company").'</td><td><input type="text" name="societe" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('societe')).'"></td></tr>'."\n";
// Address
print '<tr><td>'.$langs->trans("Address").'</td><td>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
print '<textarea name="address" id="address" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_2.'">'.dol_escape_htmltag(GETPOST('address', 'restricthtml'), 0, 1).'</textarea></td></tr>'."\n";
// Zip / Town
print '<tr><td>'.$langs->trans('Zip').' / '.$langs->trans('Town').'</td><td>';
print $formcompany->select_ziptown(GETPOST('zipcode'), 'zipcode', array('town', 'selectcountry_id', 'state_id'), 6, 1);
@ -453,21 +497,20 @@ print '</td></tr>';
if (empty($conf->global->SOCIETE_DISABLE_STATE)) {
print '<tr><td>'.$langs->trans('State').'</td><td>';
if ($country_code) {
print $formcompany->select_state(GETPOST("state_id"), $country_code);
print $formcompany->select_state(GETPOST("state_id", 'int'), $country_code);
} else {
print '';
}
print '</td></tr>';
}
// EMail
print '<tr><td>'.$langs->trans("Email").' <span style="color: red">*</span></td><td><input type="text" name="email" maxlength="255" class="minwidth150" value="'.dol_escape_htmltag(GETPOST('email')).'"></td></tr>'."\n";
// Other attributes
$tpl_context = 'public'; // define template context to public
include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
// Comments
print '<tr>';
print '<td class="tdtop">'.$langs->trans("Comments").'</td>';
print '<td class="tdtop"><textarea name="note_private" id="note_private" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_3.'">'.dol_escape_htmltag(GETPOST('note_private', 'restricthtml'), 0, 1).'</textarea></td>';
print '<td class="tdtop">'.$langs->trans("Message").' <span style="color: red">*</span></td>';
print '<td class="tdtop"><textarea name="description" id="description" wrap="soft" class="quatrevingtpercent" rows="'.ROWS_5.'" required>'.dol_escape_htmltag(GETPOST('description', 'restricthtml'), 0, 1).'</textarea></td>';
print '</tr>'."\n";
print "</table>\n";

View File

@ -62,6 +62,11 @@ class RecruitmentCandidature extends CommonObject
*/
public $picto = 'recruitmentcandidature';
/**
* @var int Do not exploit fields email_xxx into triggers.
*/
public $email_fields_no_propagate_in_actioncomm;
const STATUS_DRAFT = 0;
const STATUS_VALIDATED = 1;

View File

@ -134,7 +134,9 @@ if (empty($reshook)) {
$triggermodname = 'RECRUITMENTCANDIDATURE_MODIFY'; // Name of trigger action code to execute when we modify record
// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
$object->email_fields_no_propagate_in_actioncomm = 1;
include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
$object->email_fields_no_propagate_in_actioncomm = 0;
// Actions when linking object each other
include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';

View File

@ -956,7 +956,7 @@ class Societe extends CommonObject
$sql .= ", accountancy_code_sell";
$sql .= ") VALUES (";
$sql .= $this->id;
$sql .= ", ".$conf->entity;
$sql .= ", ".((int) $conf->entity);
$sql .= ", '".$this->db->escape($this->accountancy_code_customer)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_supplier)."'";
$sql .= ", '".$this->db->escape($this->accountancy_code_buy)."'";

View File

@ -194,4 +194,8 @@ body[class*="colorblind-"] .progress-bar-red, body[class*="colorblind-"] .progre
}
.progress-bar-consumed {
background-color: rgb(0, 0, 0, 0.15);
}
}
.progress-bar-consumed-late {
background-color: <?php echo colorAgressiveness($badgeDanger, -95, +70) ?>;
}

View File

@ -1372,7 +1372,12 @@ class Ticket extends CommonObject
$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref.'<br>';
$label .= '<b>'.$langs->trans('TicketTrackId').':</b> '.$this->track_id.'<br>';
$label .= '<b>'.$langs->trans('Subject').':</b> '.$this->subject;
if ($this->date_creation) {
$label .= '<br><b>'.$langs->trans('DateCreation').':</b> '.$this->date_creation;
}
if ($this->date_modification) {
$label .= '<br><b>'.$langs->trans('DateModification').':</b> '.$this->date_modification;
}
$url = DOL_URL_ROOT.'/ticket/card.php?id='.$this->id;
if ($option != 'nolink') {

View File

@ -101,12 +101,12 @@ class Workstation extends CommonObject
public $fields=array(
'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>1, 'noteditable'=>'0', 'default'=>'', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'comment'=>"Reference of object"),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'showoncombobox'=>'2',),
'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'showoncombobox'=>'2',),
'type' => array('type'=>'varchar(8)', 'label'=>'Type', 'enabled'=>'1', 'position'=>32, 'default'=>1, 'notnull'=>1, 'visible'=>1, 'arrayofkeyval'=>array('HUMAN'=>'Human', 'MACHINE'=>'Machine', 'BOTH'=>'HumanMachine'),),
'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0,),
'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2, 'csslist'=>'nowraponall'),
'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2, 'csslist'=>'nowraponall'),
'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>512, 'notnull'=>-1, 'visible'=>-2,),