diff --git a/htdocs/admin/translation.php b/htdocs/admin/translation.php index 6013ae41e94..f5a9acca421 100644 --- a/htdocs/admin/translation.php +++ b/htdocs/admin/translation.php @@ -463,7 +463,11 @@ if ($mode == 'searchkey') { } else { // Now search into translation array foreach ($newlang->tab_translate as $key => $val) { - if ($transkey && !preg_match('/'.preg_quote($transkey, '/').'/i', $key)) { + $newtranskey = preg_replace('/\$$/', '', preg_replace('/^\^/', '', $transkey)); + $newtranskeystart = preg_match('/^\^/', $transkey); + $newtranskeyend = preg_match('/\$$/', $transkey); + $regexstring = ($newtranskeystart ? '^' : '').preg_quote($newtranskey, '/').($newtranskeyend ? '$' : ''); + if ($transkey && !preg_match('/'.$regexstring.'/i', $key)) { continue; } if ($transvalue && !preg_match('/'.preg_quote($transvalue, '/').'/i', $val)) { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 3675b6b80fc..17231dde517 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1889,7 +1889,7 @@ if ($action == 'create') { // Source / Channel - What trigger creation print ''.$langs->trans('Source').''; print img_picto('', 'question', 'class="pictofixedwidth"'); - $form->selectInputReason('', 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectInputReason((GETPOSTISSET('demand_reason_id') ? GETPOST('demand_reason_id', 'int') : ''), 'demand_reason_id', "SRC_PROP", 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Delivery delay @@ -1899,7 +1899,7 @@ if ($action == 'create') { } print ''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay('', 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id', 'int') : ''), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Shipping Method @@ -1909,7 +1909,7 @@ if ($action == 'create') { } print ''.$langs->trans('SendingMethod').''; print img_picto('', 'dolly', 'class="pictofixedwidth"'); - $form->selectShippingMethod($shipping_method_id, 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + $form->selectShippingMethod((GETPOSTISSET('shipping_method_id') ? GETPOST('shipping_method_id', 'int') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print ''; } diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 0c9795ae9ec..332d9d13e0b 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1658,10 +1658,10 @@ if ($action == 'create' && $usercancreate) { if (!$remise_percent) { $remise_percent = $soc->remise_percent; } - if (!$dateorder) { + /*if (!$dateorder) { // Do not set 0 here (0 for a date is 1970) $dateorder = (empty($dateinvoice) ? (empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : '') : $dateorder); - } + }*/ } else { // For compatibility if ($element == 'order' || $element == 'commande') { @@ -1760,7 +1760,7 @@ if ($action == 'create' && $usercancreate) { print '
'; print ''; print ''; - print ''."\n"; + print ''; // will be set to 1 by javascript so we know post is done after a company change print ''; print ''; print ''; @@ -1806,6 +1806,7 @@ if ($action == 'create' && $usercancreate) { var socid = $(this).val(); // reload page $("input[name=action]").val("create"); + $("input[name=changecompany]").val("1"); $("form[name=crea_commande]").submit(); }); }); @@ -1855,33 +1856,33 @@ if ($action == 'create' && $usercancreate) { // Delivery delay print ''.$langs->trans('AvailabilityPeriod').''; print img_picto('', 'clock', 'class="pictofixedwidth"'); - $form->selectAvailabilityDelay((GETPOSTISSET('availability_id')?GETPOST('availability_id'):$availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); + $form->selectAvailabilityDelay((GETPOSTISSET('availability_id') ? GETPOST('availability_id') : $availability_id), 'availability_id', '', 1, 'maxwidth200 widthcentpercentminusx'); print ''; // Terms of payment print ''.$langs->trans('PaymentConditionsShort').''; print img_picto('', 'payment', 'class="pictofixedwidth"'); - print $form->getSelectConditionsPaiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id') != 0)?GETPOST('cond_reglement_id'):$cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); + print $form->getSelectConditionsPaiements(((GETPOSTISSET('cond_reglement_id') && GETPOST('cond_reglement_id', 'int') != 0) ? GETPOST('cond_reglement_id') : $cond_reglement_id), 'cond_reglement_id', 1, 1, 0, 'maxwidth200 widthcentpercentminusx', $deposit_percent); print ''; // Payment mode print ''.$langs->trans('PaymentMode').''; print img_picto('', 'bank', 'class="pictofixedwidth"'); - print $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id') != 0)?GETPOST('mode_reglement_id'):$mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); + print $form->select_types_paiements(((GETPOSTISSET('mode_reglement_id') && GETPOST('mode_reglement_id', 'int') != 0) ? GETPOST('mode_reglement_id') : $mode_reglement_id), 'mode_reglement_id', 'CRDT', 0, 1, 0, 0, 1, 'maxwidth200 widthcentpercentminusx', 1); print ''; // Bank Account if (!empty($conf->global->BANK_ASK_PAYMENT_BANK_DURING_ORDER) && isModEnabled("banque")) { print ''.$langs->trans('BankAccount').''; - print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes((GETPOSTISSET('fk_account')?GETPOST('fk_account'):$fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); + print img_picto('', 'bank_account', 'class="pictofixedwidth"').$form->select_comptes(((GETPOSTISSET('fk_account') && GETPOST('fk_account', 'int') != 0) ? GETPOST('fk_account') : $fk_account), 'fk_account', 0, '', 1, '', 0, 'maxwidth200 widthcentpercentminusx', 1); print ''; } // Shipping Method if (isModEnabled('expedition')) { print ''.$langs->trans('SendingMethod').''; - print img_picto('', 'dolly', 'class="pictofixedwidth"'); - $form->selectShippingMethod((GETPOSTISSET('shipping_method_id')?GETPOST('shipping_method_id'):$shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); + print img_picto('', 'object_dolly', 'class="pictofixedwidth"'); + $form->selectShippingMethod(((GETPOSTISSET('shipping_method_id') && GETPOST('shipping_method_id', 'int') != 0) ? GETPOST('shipping_method_id') : $shipping_method_id), 'shipping_method_id', '', 1, '', 0, 'maxwidth200 widthcentpercentminusx'); print ''; } diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 3aa48778a48..a64a24c791f 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -2449,15 +2449,15 @@ if ($resql) { print ''.price($marginInfo['pa_total'], 0, $langs, 1, -1, 'MT').''; if (!$i) { $totalarray['nbfield']++; + $totalarray['pos'][$totalarray['nbfield']] = 'total_pa'; } + $totalarray['val']['total_pa'] += $marginInfo['pa_total']; } // Total margin if (!empty($arrayfields['total_margin']['checked'])) { print ''.price($marginInfo['total_margin'], 0, $langs, 1, -1, 'MT').''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_margin'; } $totalarray['val']['total_margin'] += $marginInfo['total_margin']; @@ -2474,8 +2474,6 @@ if ($resql) { print ''.(($marginInfo['total_mark_rate'] == '') ? '' : price($marginInfo['total_mark_rate'], null, null, null, null, 2).'%').''; if (!$i) { $totalarray['nbfield']++; - } - if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; } if ($i >= $imaxinloop - 1) { @@ -2589,6 +2587,7 @@ if ($resql) { } // Use correct digits number for totals + $totalarray['val']['total_pa'] = (isset($totalarray['val']['total_pa']) ? price2num($totalarray['val']['total_pa'], 'MT') : null); $totalarray['val']['total_margin'] = (isset($totalarray['val']['total_margin']) ? price2num($totalarray['val']['total_margin'], 'MT') : null); // Show total line diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index db307cc91a9..f47d8bcdf2d 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -88,9 +88,10 @@ if (!$error && $massaction == 'confirm_presend') { $oneemailperrecipient = (GETPOST('oneemailperrecipient', 'int') ? 1 : 0); if (!$error) { - $thirdparty = new Societe($db); - $objecttmp = new $objectclass($db); + + // Define object $thirdparty (Societe or User, Adherent, ConferenceOrBoothAttendee...) + $thirdparty = new Societe($db); if ($objecttmp->element == 'expensereport') { $thirdparty = new User($db); } elseif ($objecttmp->element == 'contact') { @@ -99,6 +100,8 @@ if (!$error && $massaction == 'confirm_presend') { $thirdparty = new Adherent($db); } elseif ($objecttmp->element == 'holiday') { $thirdparty = new User($db); + } elseif ($objecttmp->element == 'conferenceorboothattendee') { + $thirdparty = new ConferenceOrBoothAttendee($db); } foreach ($toselect as $toselectid) { @@ -106,21 +109,22 @@ if (!$error && $massaction == 'confirm_presend') { $result = $objecttmp->fetch($toselectid); if ($result > 0) { $listofobjectid[$toselectid] = $toselectid; - - $thirdpartyid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); + $tmpobjectid = ($objecttmp->fk_soc ? $objecttmp->fk_soc : $objecttmp->socid); if ($objecttmp->element == 'societe') { - $thirdpartyid = $objecttmp->id; + $tmpobjectid = $objecttmp->id; } elseif ($objecttmp->element == 'contact') { - $thirdpartyid = $objecttmp->id; + $tmpobjectid = $objecttmp->id; } elseif ($objecttmp->element == 'expensereport') { - $thirdpartyid = $objecttmp->fk_user_author; + $tmpobjectid = $objecttmp->fk_user_author; } elseif ($objecttmp->element == 'partnership' && getDolGlobalString('PARTNERSHIP_IS_MANAGED_FOR') == 'member') { - $thirdpartyid = $objecttmp->fk_member; + $tmpobjectid = $objecttmp->fk_member; } elseif ($objecttmp->element == 'holiday') { - $thirdpartyid = $objecttmp->fk_user; + $tmpobjectid = $objecttmp->fk_user; + } elseif ($objecttmp->element == 'conferenceorboothattendee') { + $tmpobjectid = $objecttmp->id; } - if (empty($thirdpartyid)) { - $thirdpartyid = 0; + if (empty($tmpobjectid)) { + $tmpobjectid = 0; } if ($objectclass == 'Facture') { @@ -141,8 +145,8 @@ if (!$error && $massaction == 'confirm_presend') { } } - $listofobjectthirdparties[$thirdpartyid] = $thirdpartyid; - $listofobjectref[$thirdpartyid][$toselectid] = $objecttmp; + $listofobjectthirdparties[$tmpobjectid] = $tmpobjectid; + $listofobjectref[$tmpobjectid][$toselectid] = $objecttmp; } } } @@ -174,7 +178,7 @@ if (!$error && $massaction == 'confirm_presend') { $massaction = 'presend'; } - // Loop on each recipient/thirdparty + // Loop on each recipient (may be a thirdparty but also a user, a conferenceorboothattendee, ...) if (!$error) { foreach ($listofobjectthirdparties as $thirdpartyid) { $result = $thirdparty->fetch($thirdpartyid); @@ -186,7 +190,7 @@ if (!$error && $massaction == 'confirm_presend') { $sendto = ''; $sendtocc = ''; $sendtobcc = ''; - $sendtoid = array(); + //$sendtoid = array(); // Define $sendto $tmparray = array(); @@ -201,7 +205,7 @@ if (!$error && $massaction == 'confirm_presend') { $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; } elseif ($val && method_exists($thirdparty, 'contact_get_property')) { // Id of contact $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); - $sendtoid[] = $val; + //$sendtoid[] = $val; } } } @@ -305,6 +309,8 @@ if (!$error && $massaction == 'confirm_presend') { if (count($emails_to_sends) > 0) { $sendto = implode(',', $emails_to_sends); } + } elseif ($objectobj->element == 'conferenceorboothattendee') { + $sendto = $objectobj->email; } else { $objectobj->fetch_thirdparty(); $sendto = $objectobj->thirdparty->email; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index a4fe5628056..04510aca821 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -545,6 +545,10 @@ class FormMail extends Form $helpforsubstitution .= $langs->trans('AvailableVariables').' :

'."\n"; } foreach ($this->substit as $key => $val) { + // Do not show deprecated variables into the tooltip help of substitution variables + if (in_array($key, array('__NEWREF__', '__REFCLIENT__', '__REFSUPPLIER__', '__SUPPLIER_ORDER_DATE_DELIVERY__', '__SUPPLIER_ORDER_DELAY_DELIVERY__'))) { + continue; + } $helpforsubstitution .= $key.' -> '.$langs->trans(dol_string_nohtmltag(dolGetFirstLineOfText($val))).'
'; } if (is_array($this->substit) && count($this->substit)) { diff --git a/htdocs/core/class/html.formmargin.class.php b/htdocs/core/class/html.formmargin.class.php index 698b177b9fa..021c82d5c00 100644 --- a/htdocs/core/class/html.formmargin.class.php +++ b/htdocs/core/class/html.formmargin.class.php @@ -98,7 +98,8 @@ class FormMargin } $pv = $line->total_ht; - $pa_ht = (($pv < 0 || ($pv == 0 && in_array($object->element, array('facture', 'facture_fourn')) && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + // We choosed to have line->pa_ht always positive in database, so we guess the correct sign + $pa_ht = (($pv < 0 || ($pv == 0 && in_array($object->element, array('facture', 'facture_fourn')) && $object->type == $object::TYPE_CREDIT_NOTE)) ? -$line->pa_ht : $line->pa_ht); if (getDolGlobalInt('INVOICE_USE_SITUATION') == 1) { // Special case for old situation mode if (($object->element == 'facture' && $object->type == $object::TYPE_SITUATION) || ($object->element == 'facture' && $object->type == $object::TYPE_CREDIT_NOTE && getDolGlobalInt('INVOICE_USE_SITUATION_CREDIT_NOTE') && $object->situation_counter > 0)) { diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index cb501ae8400..03f6d40ced0 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -162,7 +162,7 @@ function versiondolibarrarray() * @param int $nocommentremoval Do no try to remove comments (in such a case, we consider that each line is a request, so use also $linelengthlimit=0) * @param int $offsetforchartofaccount Offset to use to load chart of account table to update sql on the fly to add offset to rowid and account_parent value * @param int $colspan 2=Add a colspan=2 on td - * @param int $onlysqltoimportwebsite Only sql resquests used to import a website template is allowed + * @param int $onlysqltoimportwebsite Only sql resquests used to import a website template are allowed * @return int <=0 if KO, >0 if OK */ function run_sql($sqlfile, $silent = 1, $entity = '', $usesavepoint = 1, $handler = '', $okerror = 'default', $linelengthlimit = 32768, $nocommentremoval = 0, $offsetforchartofaccount = 0, $colspan = 0, $onlysqltoimportwebsite = 0) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 52cb381791f..a2b7f99e6f7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -7869,7 +7869,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__DATE_DELIVERY_MM__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%M") : ''); $substitutionarray['__DATE_DELIVERY_SS__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, "%S") : ''); - // For backward compatibility + // For backward compatibility (deprecated) $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); @@ -7963,6 +7963,11 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__CANDIDATE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : ''; $substitutionarray['__CANDIDATE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : ''; } + if (is_object($object) && $object->element == 'conferenceorboothattendee') { + $substitutionarray['__ATTENDEE_FULLNAME__'] = $object->getFullName($outputlangs); + $substitutionarray['__ATTENDEE_FIRSTNAME__'] = isset($object->firstname) ? $object->firstname : ''; + $substitutionarray['__ATTENDEE_LASTNAME__'] = isset($object->lastname) ? $object->lastname : ''; + } if (is_object($object->project)) { $substitutionarray['__PROJECT_ID__'] = (is_object($object->project) ? $object->project->id : ''); diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 6f9136798ed..fe0bc4e490e 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1747,7 +1747,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $val = ''; } - $sql = "SELECT count(*)"; + $sql = "SELECT count(*) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."const"; $sql .= " WHERE ".$this->db->decrypt('name')." = '".$this->db->escape($name)."'"; $sql .= " AND entity = ".((int) $entity); @@ -1771,7 +1771,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it $err++; } } else { - dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_WARNING); + dol_syslog(get_class($this)."::insert_const constant '".$name."' already exists", LOG_DEBUG); } } else { $err++; diff --git a/htdocs/core/modules/modAgenda.class.php b/htdocs/core/modules/modAgenda.class.php index aa2029bc38a..63e619a2370 100644 --- a/htdocs/core/modules/modAgenda.class.php +++ b/htdocs/core/modules/modAgenda.class.php @@ -51,7 +51,7 @@ class modAgenda extends DolibarrModules $this->numero = 2400; $this->family = "projects"; - $this->module_position = '15'; + $this->module_position = '16'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Follow events or rendez-vous. Record manual events into Agendas or let application record automatic events for log tracking."; diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index a0f1eea90bd..ed84a7e9c4b 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -47,7 +47,7 @@ class modCategorie extends DolibarrModules $this->numero = 1780; $this->family = "technic"; - $this->module_position = '20'; + $this->module_position = '25'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Gestion des categories (produits, clients, fournisseurs...)"; diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 0ecd1ba805f..4d4d482db50 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -40,7 +40,8 @@ class modEventOrganization extends DolibarrModules */ public function __construct($db) { - global $langs, $conf; + global $conf, $langs; + $this->db = $db; $this->numero = 2450; @@ -49,7 +50,7 @@ class modEventOrganization extends DolibarrModules $this->family = "projects"; - $this->module_position = '20'; + $this->module_position = '15'; $this->name = preg_replace('/^mod/i', '', get_class($this)); @@ -306,9 +307,106 @@ class modEventOrganization extends DolibarrModules 'user'=>2, // 0=Menu for internal users, 1=external users, 2=both ); /* END MODULEBUILDER LEFTMENU CONFERENCEORBOOTH */ + // Exports profiles provided by this module $r = 1; + + /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */ + $langs->load("eventorganization"); + $this->export_code[$r]=$this->rights_class.'_'.$r; + $this->export_label[$r]='ListOfAttendeesOfEvent'; // Translation key (used only if key ExportDataset_xxx_z not found) + $this->export_icon[$r]=$this->picto; + // Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array + $keyforclass = 'ConferenceOrBoothAttendee'; $keyforclassfile='/eventorganization/class/conferenceorboothattendee.class.php'; $keyforelement='conferenceorboothattendee'; + include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php'; + $this->export_entities_array[$r]['t.fk_invoice'] = 'invoice'; + unset($this->export_fields_array[$r]['t.fk_project']); // Remove field so we can add it at end just after + unset($this->export_fields_array[$r]['t.fk_soc']); // Remove field so we can add it at end just after + $this->export_fields_array[$r]['t.fk_invoice'] = 'InvoiceId'; + $this->export_fields_array[$r]['t.fk_project'] = 'ProjectId'; + $this->export_fields_array[$r]['p.ref'] = 'ProjectRef'; + $this->export_fields_array[$r]['t.fk_soc'] = 'IdThirdParty'; + $this->export_entities_array[$r]['t.fk_project'] = 'project'; + $this->export_entities_array[$r]['p.ref'] = 'project'; + $this->export_entities_array[$r]['t.fk_soc'] = 'company'; + $this->export_TypeFields_array[$r]['t.fk_project'] = 'Numeric'; + $this->export_TypeFields_array[$r]['t.fk_invoice'] = 'Numeric'; + $this->export_TypeFields_array[$r]['p.ref'] = 'Text'; + $this->export_TypeFields_array[$r]['t.fk_soc'] = 'Numeric'; + //$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text'; + //unset($this->export_fields_array[$r]['t.fieldtoremove']); + $keyforselect='conferenceorboothattendee'; $keyforaliasextra='extra'; $keyforelement='conferenceorboothattendee'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + //$this->export_dependencies_array[$r] = array('aaaline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields) + //$this->export_special_array[$r] = array('t.field'=>'...'); + //$this->export_examplevalues_array[$r] = array('t.field'=>'Example'); + //$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp'); + $this->export_sql_start[$r]='SELECT DISTINCT '; + $this->export_sql_end[$r] =' FROM '.MAIN_DB_PREFIX.'eventorganization_conferenceorboothattendee as t, '.MAIN_DB_PREFIX.'projet as p'; + $this->export_sql_end[$r] .=' WHERE t.fk_project = p.rowid'; + $this->export_sql_end[$r] .=' AND p.entity IN ('.getEntity('conferenceorboothattendee').')'; + $r++; + /* END MODULEBUILDER EXPORT CONFERENCEORBOOTHATTENDEES */ + /* BEGIN MODULEBUILDER EXPORT CONFERENCEORBOOTH */ + /* + $r++; + $this->export_code[$r] = $this->rights_class.'_'.$r; + $this->export_label[$r] = "ExportDataset_event1"; + $this->export_permission[$r] = array(array("agenda", "export")); + $this->export_fields_array[$r] = array('ac.id'=>"IdAgenda", 'ac.ref_ext'=>"ExternalRef", 'ac.datec'=>"DateCreation", 'ac.datep'=>"DateActionBegin", + 'ac.datep2'=>"DateActionEnd", 'ac.label'=>"Title", 'ac.note'=>"Note", 'ac.percent'=>"Percent", 'ac.durationp'=>"Duration", + 'cac.libelle'=>"ActionType", + 's.rowid'=>"IdCompany", 's.nom'=>'CompanyName', 's.address'=>'Address', 's.zip'=>'Zip', 's.town'=>'Town', + 'co.code'=>'CountryCode', 's.phone'=>'Phone', 's.siren'=>'ProfId1', 's.siret'=>'ProfId2', 's.ape'=>'ProfId3', 's.idprof4'=>'ProfId4', 's.idprof5'=>'ProfId5', 's.idprof6'=>'ProfId6', + 's.code_compta'=>'CustomerAccountancyCode', 's.code_compta_fournisseur'=>'SupplierAccountancyCode', 's.tva_intra'=>'VATIntra', + 'p.ref' => 'ProjectRef', + ); + $this->export_TypeFields_array[$r] = array('ac.ref_ext'=>"Text", 'ac.datec'=>"Date", 'ac.datep'=>"Date", + 'ac.datep2'=>"Date", 'ac.label'=>"Text", 'ac.note'=>"Text", 'ac.percent'=>"Numeric", + 'ac.durationp'=>"Duree", + 'cac.libelle'=>"List:c_actioncomm:libelle:libelle", + 's.nom'=>'Text', 's.address'=>'Text', 's.zip'=>'Text', 's.town'=>'Text', + 'co.code'=>'Text', 's.phone'=>'Text', 's.siren'=>'Text', 's.siret'=>'Text', 's.ape'=>'Text', 's.idprof4'=>'Text', 's.idprof5'=>'Text', 's.idprof6'=>'Text', + 's.code_compta'=>'Text', 's.code_compta_fournisseur'=>'Text', 's.tva_intra'=>'Text', + 'p.ref' => 'Text', + ); + $this->export_entities_array[$r] = array('ac.id'=>"action", 'ac.ref_ext'=>"action", 'ac.datec'=>"action", 'ac.datep'=>"action", + 'ac.datep2'=>"action", 'ac.label'=>"action", 'ac.note'=>"action", 'ac.percent'=>"action", 'ac.durationp'=>"action", + 'cac.libelle'=>"action", + 's.rowid'=>"company", 's.nom'=>'company', 's.address'=>'company', 's.zip'=>'company', 's.town'=>'company', + 'co.code'=>'company', 's.phone'=>'company', 's.siren'=>'company', 's.siret'=>'company', 's.ape'=>'company', 's.idprof4'=>'company', 's.idprof5'=>'company', 's.idprof6'=>'company', + 's.code_compta'=>'company', 's.code_compta_fournisseur'=>'company', 's.tva_intra'=>'company', + 'p.ref' => 'project', + ); + + $keyforselect = 'actioncomm'; $keyforelement = 'action'; $keyforaliasextra = 'extra'; + include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php'; + + $this->export_sql_start[$r] = 'SELECT DISTINCT '; + $this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'actioncomm as ac'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_extrafields as extra ON ac.id = extra.fk_object'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_actioncomm as cac on ac.fk_action = cac.id'; + if (!empty($user) && empty($user->rights->agenda->allactions->read)) { + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'actioncomm_resources acr on ac.id = acr.fk_actioncomm'; + } + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'socpeople as sp on ac.fk_contact = sp.rowid'; + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe as s on ac.fk_soc = s.rowid'; + if (!empty($user) && empty($user->rights->societe->client->voir)) { + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'societe_commerciaux as sc ON sc.fk_soc = s.rowid'; + } + $this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_country as co on s.fk_pays = co.rowid'; + $this->export_sql_end[$r] .= " LEFT JOIN ".MAIN_DB_PREFIX."projet as p ON p.rowid = ac.fk_project"; + $this->export_sql_end[$r] .= " WHERE ac.entity IN (".getEntity('agenda').")"; + $this->export_sql_end[$r] .= " AND ac.code = 'AC_EO_INDOORCONF'"; + if (empty($user->rights->societe->client->voir)) { + $this->export_sql_end[$r] .= ' AND (sc.fk_user = '.(empty($user) ? 0 : $user->id).' OR ac.fk_soc IS NULL)'; + } + if (empty($user->rights->agenda->allactions->read)) { + $this->export_sql_end[$r] .= ' AND acr.fk_element = '.(empty($user) ? 0 : $user->id); + } + $this->export_sql_order[$r] = ' ORDER BY ac.datep'; + */ /* END MODULEBUILDER EXPORT CONFERENCEORBOOTH */ // Imports profiles provided by this module @@ -329,6 +427,13 @@ class modEventOrganization extends DolibarrModules { global $conf, $langs, $user; + /*$result = run_sql(DOL_DOCUMENT_ROOT.'/install/mysql/data/llx_c_email_templates.sql', 1, '', 1); + if ($result <= 0) { + return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default') + } + TODO Instead use the array merge of the sql found into llx_c_email_templates for this module + */ + // Permissions $this->remove($options); diff --git a/htdocs/core/modules/modResource.class.php b/htdocs/core/modules/modResource.class.php index 59dc7878161..143d1fd2161 100644 --- a/htdocs/core/modules/modResource.class.php +++ b/htdocs/core/modules/modResource.class.php @@ -55,7 +55,7 @@ class modResource extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "projects"; - $this->module_position = '16'; + $this->module_position = '20'; // Module label (no space allowed) // used if translation string 'ModuleXXXName' not found // (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/eventorganization/class/conferenceorbooth.class.php b/htdocs/eventorganization/class/conferenceorbooth.class.php index 150c2b50c90..53b16462651 100644 --- a/htdocs/eventorganization/class/conferenceorbooth.class.php +++ b/htdocs/eventorganization/class/conferenceorbooth.class.php @@ -106,7 +106,7 @@ class ConferenceOrBooth extends ActionComm 'id' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"), 'ref' => array('type'=>'integer', 'label'=>'Ref', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>2, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'csslist'=>'left', 'comment'=>"Id"), 'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'csslist'=>'tdoverflowmax125', 'help'=>"OrganizationEvenLabelName", 'showoncombobox'=>'1', 'autofocusoncreate'=>1), - 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500', 'csslist'=>'nowraponall'), + 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1:(t.usage_organize_event:=:1)', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>52, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'picto'=>'project', 'css'=>'maxwidth500', 'csslist'=>'tdoverflowmax100'), 'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:((status:=:1) AND (entity:IN:__SHARED_ENTITIES__))', 'label'=>'ThirdParty', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'help'=>"OrganizationEventLinkToThirdParty", 'picto'=>'company', 'csslist'=>'tdoverflowmax125', 'css'=>'maxwidth500'), 'note' => array('type'=>'html', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3), 'fk_action' => array('type'=>'sellist:c_actioncomm:libelle:id::module LIKE (\'%@eventorganization\')', 'label'=>'Format', 'enabled'=>'1', 'position'=>60, 'notnull'=>1, 'visible'=>1, 'css'=>'width100', 'csslist'=>'tdoverflowmax100'), diff --git a/htdocs/eventorganization/class/conferenceorboothattendee.class.php b/htdocs/eventorganization/class/conferenceorboothattendee.class.php index 47d7e96ab03..db41d03c328 100644 --- a/htdocs/eventorganization/class/conferenceorboothattendee.class.php +++ b/htdocs/eventorganization/class/conferenceorboothattendee.class.php @@ -51,7 +51,7 @@ class ConferenceOrBoothAttendee extends CommonObject * @var int Does this object support multicompany module ? * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table */ - public $ismultientitymanaged = 0; + public $ismultientitymanaged = 'fk_project@projet'; /** * @var int Does object support extrafields ? 0=No, 1=Yes @@ -103,7 +103,7 @@ class ConferenceOrBoothAttendee 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'=>2, 'index'=>1, 'comment'=>"Reference of object"), - 'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), + //'fk_actioncomm' => array('type'=>'integer:ActionComm:comm/action/class/actioncomm.class.php:1', 'label'=>'ConferenceOrBooth', 'enabled'=>'1', 'position'=>15, 'notnull'=>0, 'visible'=>0, 'index'=>1, 'picto'=>'agenda'), 'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'enabled'=>"isModEnabled('project')", 'position'=>20, 'notnull'=>1, 'visible'=>0, 'index'=>1, 'picto'=>'project', 'css'=>'tdoverflowmax150 maxwidth500'), 'email' => array('type'=>'mail', 'label'=>'EmailAttendee', 'enabled'=>'1', 'position'=>30, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'autofocusoncreate'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax150'), 'firstname' => array('type'=>'varchar(100)', 'label'=>'Firstname', 'enabled'=>'1', 'position'=>31, 'notnull'=>0, 'visible'=>1, 'index'=>1, 'searchall'=>1, 'csslist'=>'tdoverflowmax125'), @@ -122,8 +122,8 @@ class ConferenceOrBoothAttendee extends CommonObject 'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,), 'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), 'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,), + 'ip' => array('type'=>'varchar(250)', 'label'=>'IPAddress', 'enabled'=>'1', 'position'=>900, 'notnull'=>-1, 'visible'=>-2,), 'status' => array('type'=>'smallint', 'label'=>'Status', 'enabled'=>'1', 'position'=>1000, 'default'=>0, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Canceled'),), - 'ip' => array('type'=>'varchar(250)', 'label'=>'Ip', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,), ); public $rowid; public $ref; diff --git a/htdocs/exports/export.php b/htdocs/exports/export.php index 1afd41c6027..8fc16e43963 100644 --- a/htdocs/exports/export.php +++ b/htdocs/exports/export.php @@ -76,7 +76,8 @@ $entitytoicon = array( 'contract_line' => 'contract', 'translation' => 'generic', 'bomm' => 'bom', - 'bomline' => 'bom' + 'bomline' => 'bom', + 'conferenceorboothattendee' => 'contact' ); // Translation code, array duplicated in import.php, was not synchronized, TODO put it somewhere only once @@ -125,7 +126,8 @@ $entitytolang = array( 'contract_line'=> 'ContractLine', 'translation' => 'Translation', 'bom' => 'BOM', - 'bomline' => 'BOMLine' + 'bomline' => 'BOMLine', + 'conferenceorboothattendee' => 'Attendee' ); $array_selected = isset($_SESSION["export_selected_fields"]) ? $_SESSION["export_selected_fields"] : array(); @@ -527,7 +529,7 @@ if ($step == 2 && $datatoexport) { print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print ''; print ''; - print ''; + print ''; print ''; print ''; if ($client) { - print ''; print ''; } @@ -401,7 +407,7 @@ if ($result) { print ''; if ($client) { - print '
'.$langs->trans("Entities").''.$langs->trans("Object").''.$langs->trans("ExportableFields").''; print ''.$langs->trans("All").""; diff --git a/htdocs/install/mysql/data/llx_c_email_templates.sql b/htdocs/install/mysql/data/llx_c_email_templates.sql index d2886631942..5ad37ffa8e0 100644 --- a/htdocs/install/mysql/data/llx_c_email_templates.sql +++ b/htdocs/install/mysql/data/llx_c_email_templates.sql @@ -35,7 +35,9 @@ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, enabled, active, topic, content, content_lines, joinfiles) VALUES (0, 'recruitment','recruitmentcandidature_send','',0,null,null,'(AnswerCandidature)' ,100,'isModEnabled("recruitment")',1,'[__[MAIN_INFO_SOCIETE_NOM]__] __(YourCandidature)__', '__(Hello)__ __CANDIDATE_FULLNAME__,

\n\n__(YourCandidatureAnswerMessage)__
__ONLINE_INTERVIEW_SCHEDULER_TEXT_AND_URL__\n

\n__(Sincerely)__
__USER_SIGNATURE__',null, 0); -- Event organization +-- Message for default setup of EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_CONF INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskConf)', 10, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskConf)__', '__(Hello)__,

__(OrganizationEventConfRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); +-- Message for default setup of EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailAskBooth)', 20, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailAskBooth)__', '__(Hello)__,

__(OrganizationEventBoothRequestWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); -- TODO Add message for registration only to event __ONLINE_PAYMENT_TEXT_AND_URL__ INSERT INTO llx_c_email_templates (entity, module, type_template, lang, private, fk_user, datec, label, position, active, topic, content, content_lines, enabled, joinfiles) values (0, '', 'conferenceorbooth', '', 0, null, null, '(EventOrganizationEmailBoothPayment)', 30, 1, '[__[MAIN_INFO_SOCIETE_NOM]__] __(EventOrganizationEmailBoothPayment)__', '__(Hello)__,

__(OrganizationEventPaymentOfBoothWasReceived)__


__(Sincerely)__
__USER_SIGNATURE__', null, '1', null); diff --git a/htdocs/margin/agentMargins.php b/htdocs/margin/agentMargins.php index c209fb1f957..f369f1889c2 100644 --- a/htdocs/margin/agentMargins.php +++ b/htdocs/margin/agentMargins.php @@ -151,8 +151,10 @@ $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; $sql .= " u.rowid as agent, u.login, u.lastname, u.firstname,"; $sql .= " sum(d.total_ht) as selling_price,"; // Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) -$sql .= " sum(".$db->ifsql('d.total_ht < 0', 'd.qty * d.buy_price_ht * -1 * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; -$sql .= " sum(".$db->ifsql('d.total_ht < 0', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + +$sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * d.qty * d.buy_price_ht * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; +$sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."element_contact e ON e.element_id = f.rowid and e.statut = 4 and e.fk_c_type_contact = ".(empty($conf->global->AGENT_CONTACT_TYPE) ?-1 : $conf->global->AGENT_CONTACT_TYPE); diff --git a/htdocs/margin/customerMargins.php b/htdocs/margin/customerMargins.php index 2d574ae6653..a3ec3ddada6 100644 --- a/htdocs/margin/customerMargins.php +++ b/htdocs/margin/customerMargins.php @@ -216,12 +216,14 @@ $invoice_status_except_list = array(Facture::STATUS_DRAFT, Facture::STATUS_ABAND $sql = "SELECT"; $sql .= " s.rowid as socid, s.nom as name, s.code_client, s.client,"; if ($client) { - $sql .= " f.rowid as facid, f.ref, f.total_ht, f.datef, f.paye, f.fk_statut as statut,"; + $sql .= " f.rowid as facid, f.ref, f.total_ht, f.datef, f.paye, f.type, f.fk_statut as statut,"; } $sql .= " sum(d.total_ht) as selling_price,"; // Note: qty and buy_price_ht is always positive (if not, your database may be corrupted, you can update this) -$sql .= " sum(".$db->ifsql('d.total_ht < 0', 'd.qty * d.buy_price_ht * -1 * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; -$sql .= " sum(".$db->ifsql('d.total_ht < 0', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + +$sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * d.qty * d.buy_price_ht * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; +$sql .= " sum(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= ", ".MAIN_DB_PREFIX."facturedet as d"; @@ -263,7 +265,7 @@ if (isset($conf->global->ForceBuyingPriceIfNull) && $conf->global->ForceBuyingPr $sql .= " AND d.buy_price_ht <> 0"; } if ($client) { - $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.ref, f.total_ht, f.datef, f.paye, f.fk_statut"; + $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client, f.rowid, f.ref, f.total_ht, f.datef, f.paye, f.type, f.fk_statut"; } else { $sql .= " GROUP BY s.rowid, s.nom, s.code_client, s.client"; } @@ -354,9 +356,12 @@ if ($result) { print '
'; $invoicestatic->id = $objp->facid; $invoicestatic->ref = $objp->ref; + $invoicestatic->statut = $objp->statut; + $invoicestatic->type = $objp->type; + + print ''; print $invoicestatic->getNomUrl(1); print ''; @@ -365,6 +370,7 @@ if ($result) { $companystatic->id = $objp->socid; $companystatic->name = $objp->name; $companystatic->client = $objp->client; + print ''.$companystatic->getNomUrl(1, 'margin').'
'; + print ''; } else { print ''; } diff --git a/htdocs/margin/productMargins.php b/htdocs/margin/productMargins.php index da973c2467e..32cb3c9292d 100644 --- a/htdocs/margin/productMargins.php +++ b/htdocs/margin/productMargins.php @@ -185,10 +185,12 @@ if ($id > 0) { $sql .= " f.rowid as facid, f.ref, f.total_ht, f.datef, f.paye, f.fk_statut as statut,"; } $sql .= " SUM(d.total_ht) as selling_price,"; -// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) $sql .= " SUM(d.qty) as product_qty,"; -$sql .= " SUM(".$db->ifsql('d.total_ht < 0', 'd.qty * d.buy_price_ht * -1 * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; -$sql .= " SUM(".$db->ifsql('d.total_ht < 0', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + +// Note: qty and buy_price_ht is always positive (if not your database may be corrupted, you can update this) +$sql .= " SUM(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * d.qty * d.buy_price_ht * (d.situation_percent / 100)', 'd.qty * d.buy_price_ht * (d.situation_percent / 100)').") as buying_price,"; +$sql .= " SUM(".$db->ifsql('(d.total_ht < 0 OR (d.total_ht = 0 AND f.type = 2))', '-1 * (abs(d.total_ht) - (d.buy_price_ht * d.qty * (d.situation_percent / 100)))', 'd.total_ht - (d.buy_price_ht * d.qty * (d.situation_percent / 100))').") as marge"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe as s"; $sql .= ", ".MAIN_DB_PREFIX."facture as f"; $sql .= ", ".MAIN_DB_PREFIX."facturedet as d"; diff --git a/htdocs/opensurvey/results.php b/htdocs/opensurvey/results.php index d8405c31027..7d68f54023b 100644 --- a/htdocs/opensurvey/results.php +++ b/htdocs/opensurvey/results.php @@ -37,7 +37,7 @@ if (empty($user->rights->opensurvey->read)) { // Init vars $action = GETPOST('action', 'aZ09'); -$numsondage = GETPOST("id"); +$numsondage = GETPOST("id", 'alphanohtml'); $object = new Opensurveysondage($db); $result = $object->fetch(0, $numsondage); @@ -53,8 +53,8 @@ $nblines = $object->fetch_lines(); */ // Return to the results -if (GETPOST('retoursondage')) { - header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'int'))); +if (GETPOST('cancel')) { + header('Location: results.php?id='.(GETPOSTISSET('id_sondage') ? GETPOST('id_sondage', 'aZ09') : GETPOST('id', 'alphanohtml'))); exit; } @@ -427,6 +427,7 @@ $title = $object->title." - ".$langs->trans('Card'); $helpurl = ''; $arrayofjs = array(); $arrayofcss = array('/opensurvey/css/style.css'); + llxHeader('', $title, $helpurl, 0, 0, 0, $arrayofjs, $arrayofcss); @@ -443,6 +444,7 @@ $toutsujet = str_replace("°", "'", $toutsujet); print ''."\n"; print ''; +print ''; $head = opensurvey_prepare_head($object); @@ -508,7 +510,6 @@ print '
'; print ''; - // Expire date print ''."\n"; + print ''."\n"; $colspan = 1; } diff --git a/htdocs/public/opensurvey/studs.php b/htdocs/public/opensurvey/studs.php index 34f8ecd9400..b3459f7e36e 100644 --- a/htdocs/public/opensurvey/studs.php +++ b/htdocs/public/opensurvey/studs.php @@ -424,10 +424,10 @@ if ($object->format == "D") { } else { $next = intval($toutsujet[$i + 1]); } - if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { + if ($next && dol_print_date($cur, "%a %d") == dol_print_date($next, "%a %d") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { $colspan++; } else { - print ''."\n"; + print ''."\n"; $colspan = 1; } } diff --git a/htdocs/public/project/suggestbooth.php b/htdocs/public/project/suggestbooth.php index 0d4574d1405..6c1f88ecb42 100644 --- a/htdocs/public/project/suggestbooth.php +++ b/htdocs/public/project/suggestbooth.php @@ -493,11 +493,11 @@ if (empty($reshook) && $action == 'add') { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template $arraydefaultmessage = null; - $labeltouse = $conf->global->EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH; + $labeltouse = getDolGlobalString('EVENTORGANIZATION_TEMPLATE_EMAIL_ASK_BOOTH'); if (!empty($labeltouse)) { $arraydefaultmessage = $formmail->getEMailTemplate($db, 'conferenceorbooth', $user, $outputlangs, $labeltouse, 1, ''); } @@ -555,7 +555,7 @@ print '
'; // Sub banner print '
'; -print load_fiche_titre($langs->trans("NewSuggestionOfConference"), '', '', 0, 0, 'center'); +print load_fiche_titre($langs->trans("NewSuggestionOfBooth"), '', '', 0, 0, 'center'); // Welcome message print ''.$langs->trans("EvntOrgRegistrationWelcomeMessage").''; print '
'; diff --git a/htdocs/public/project/suggestconference.php b/htdocs/public/project/suggestconference.php index 0cbb9610fdf..c709cee8b4d 100644 --- a/htdocs/public/project/suggestconference.php +++ b/htdocs/public/project/suggestconference.php @@ -424,7 +424,7 @@ if (empty($reshook) && $action == 'add') { $outputlangs = new Translate('', $conf); $outputlangs->setDefaultLang(empty($thirdparty->default_lang) ? $mysoc->default_lang : $thirdparty->default_lang); // Load traductions files required by page - $outputlangs->loadLangs(array("main", "members")); + $outputlangs->loadLangs(array("main", "members", "eventorganization")); // Get email content from template $arraydefaultmessage = null;
'.$langs->trans('ExpireDate').''; if ($action == 'edit') { @@ -575,9 +576,11 @@ if (GETPOST('ajoutsujet')) { accessforbidden(); } - print ''."\n"; + print ''."\n"; print ''; print ''; + print ''; + print ''; print '
'."\n"; print "

\n"; @@ -591,7 +594,7 @@ if (GETPOST('ajoutsujet')) { print ''; print ''; print '     '; - print ''; + print ''; print '

'."\n"; } else { require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php'; @@ -644,7 +647,7 @@ if (GETPOST('ajoutsujet')) { print '

'; print' '."\n"; print '   '; - print ''; + print ''; } print ''."\n"; @@ -757,10 +760,10 @@ if ($object->format == "D") { } else { $next = intval($toutsujet[$i + 1]); } - if ($next && dol_print_date($cur, "%a %e") == dol_print_date($next, "%a %e") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { + if ($next && dol_print_date($cur, "%a %d") == dol_print_date($next, "%a %d") && dol_print_date($cur, "%B") == dol_print_date($next, "%B")) { $colspan++; } else { - print '
'.dol_print_date($cur, "%a %e").''.dol_print_date($cur, "%a %d").''.dol_print_date($cur, "%a %e").''.dol_print_date($cur, "%a %d").'