Merge branch 'NEW_mail_project' of github.com:ATM-Consulting/dolibarr into develop_atm
This commit is contained in:
commit
a574712dd2
@ -168,6 +168,7 @@ if ($conf->fournisseur->enabled) $elementList['invoice_supplier_send']=$la
|
||||
if ($conf->societe->enabled) $elementList['thirdparty']=$langs->trans('MailToThirdparty');
|
||||
if ($conf->adherent->enabled) $elementList['member']=$langs->trans('MailToMember');
|
||||
if ($conf->contrat->enabled) $elementList['contract']=$langs->trans('MailToSendContract');
|
||||
if ($conf->projet->enabled) $elementList['project']=$langs->trans('MailToProject');
|
||||
$elementList['user']=$langs->trans('MailToUser');
|
||||
$elementList['all'] =$langs->trans('VisibleEverywhere');
|
||||
$elementList['none']=$langs->trans('VisibleNowhere');
|
||||
|
||||
@ -706,7 +706,6 @@ class Categorie extends CommonObject
|
||||
|
||||
|
||||
// Call trigger
|
||||
$this->linkto=$obj; // Deprecated. Save object we want to link category to into category instance to provide information to trigger
|
||||
$this->context=array('linkto'=>$obj); // Save object we want to link category to into category instance to provide information to trigger
|
||||
$result=$this->call_trigger('CATEGORY_LINK',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
|
||||
@ -675,7 +675,8 @@ class Contrat extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* Load lines array into this->lines
|
||||
* Load lines array into this->lines.
|
||||
* This set also nbofserviceswait, nbofservicesopened, nbofservicesexpired and nbofservicesclosed
|
||||
*
|
||||
* @return ContratLigne[] Return array of contract lines
|
||||
*/
|
||||
|
||||
@ -385,7 +385,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO
|
||||
|
||||
if ($mailfile->error)
|
||||
{
|
||||
setEventMessage($mailfile->error, 'errors');
|
||||
setEventMessages($mailfile->error, $mailfile->errors, 'errors');
|
||||
$action='presend';
|
||||
}
|
||||
else
|
||||
|
||||
@ -753,7 +753,7 @@ class CMailFile
|
||||
$domainName = $conf->global->MAIN_MAIL_EMAIL_DKIM_DOMAIN;
|
||||
$selector = $conf->global->MAIN_MAIL_EMAIL_DKIM_SELECTOR;
|
||||
$signer = new Swift_Signers_DKIMSigner($privateKey, $domainName, $selector);
|
||||
$this->message->attachSigner($signer);
|
||||
$this->message->attachSigner($signer->ignoreHeader('Return-Path'));
|
||||
}
|
||||
|
||||
if (! empty($conf->global->MAIN_MAIL_DEBUG)) {
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -24,8 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* \class DiscountAbsolute
|
||||
* \brief Class to manage absolute discounts
|
||||
* Class to manage absolute discounts
|
||||
*/
|
||||
class DiscountAbsolute
|
||||
{
|
||||
@ -231,7 +230,7 @@ class DiscountAbsolute
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Check if we can remove the discount
|
||||
if ($this->fk_invoice_supplier_source)
|
||||
{
|
||||
@ -241,7 +240,7 @@ class DiscountAbsolute
|
||||
$sql.=" OR fk_invoice_supplier IS NOT NULL)"; // Not used as credit note and not used as deposit
|
||||
$sql.=" AND fk_invoice_supplier_source = ".$this->fk_invoice_supplier_source;
|
||||
//$sql.=" AND rowid != ".$this->id;
|
||||
|
||||
|
||||
dol_syslog(get_class($this)."::delete Check if we can remove discount", LOG_DEBUG);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
@ -298,7 +297,7 @@ class DiscountAbsolute
|
||||
}
|
||||
}
|
||||
elseif($this->fk_invoice_supplier_source) {
|
||||
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture_fourn";
|
||||
$sql.=" set paye=0, fk_statut=1";
|
||||
$sql.=" WHERE (type = 2 or type = 3) AND rowid=".$this->fk_invoice_supplier_source;
|
||||
|
||||
@ -6444,6 +6444,11 @@ class Form
|
||||
else $morehtmlstatus=$hookmanager->resPrint;
|
||||
if ($morehtmlstatus) $ret.='<div class="statusref">'.$morehtmlstatus.'</div>';
|
||||
|
||||
$parameters = array();
|
||||
$reshook = $hookmanager->executeHooks('moreHtmlRef', $parameters, $object); // Note that $action and $object may have been modified by hook
|
||||
if (empty($reshook)) $morehtmlref.=$hookmanager->resPrint;
|
||||
elseif ($reshook > 0) $morehtmlref=$hookmanager->resPrint;
|
||||
|
||||
// Left part of banner
|
||||
if ($morehtmlleft)
|
||||
{
|
||||
|
||||
@ -1298,6 +1298,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
|
||||
$maxvisiblephotos=1;
|
||||
$showimage=1;
|
||||
$entity=(empty($object->entity)?$conf->entity:$object->entity);
|
||||
$showbarcode=empty($conf->barcode->enabled)?0:($object->barcode?1:0);
|
||||
if (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && empty($user->rights->barcode->lire_advance)) $showbarcode=0;
|
||||
$modulepart='unknown';
|
||||
@ -1324,10 +1325,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if ($object->element == 'product')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$object->entity]);
|
||||
$showimage=$object->is_photo_available($conf->product->multidir_output[$entity]);
|
||||
$maxvisiblephotos=(isset($conf->global->PRODUCT_MAX_VISIBLE_PHOTO)?$conf->global->PRODUCT_MAX_VISIBLE_PHOTO:5);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$object->entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('product', $conf->product->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->PRODUCT_NODISPLAYIFNOPHOTO)) {
|
||||
@ -1343,10 +1344,10 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
elseif ($object->element == 'ticketsup')
|
||||
{
|
||||
$width=80; $cssclass='photoref';
|
||||
$showimage=$object->is_photo_available($conf->ticketsup->dir_output.'/'.$object->track_id);
|
||||
$showimage=$object->is_photo_available($conf->ticketsup->multidir_output[$entity].'/'.$object->track_id);
|
||||
$maxvisiblephotos=(isset($conf->global->TICKETSUP_MAX_VISIBLE_PHOTO)?$conf->global->TICKETSUP_MAX_VISIBLE_PHOTO:2);
|
||||
if ($conf->browser->phone) $maxvisiblephotos=1;
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticketsup', $conf->ticketsup->dir_output,'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
if ($showimage) $morehtmlleft.='<div class="floatleft inline-block valignmiddle divphotoref">'.$object->show_photos('ticketsup', $conf->ticketsup->multidir_output[$entity],'small',$maxvisiblephotos,0,0,0,$width,0).'</div>';
|
||||
else
|
||||
{
|
||||
if (!empty($conf->global->TICKETSUP_NODISPLAYIFNOPHOTO)) {
|
||||
@ -1370,7 +1371,7 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
|
||||
if (in_array($modulepart, array('propal', 'commande', 'facture', 'ficheinter', 'contract', 'supplier_order', 'supplier_proposal', 'supplier_invoice', 'expensereport')) && class_exists("Imagick"))
|
||||
{
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
$dir_output = $conf->$modulepart->dir_output . "/";
|
||||
$dir_output = $conf->$modulepart->multidir_output[$entity] . "/";
|
||||
if (in_array($modulepart, array('invoice_supplier', 'supplier_invoice')))
|
||||
{
|
||||
$subdir = get_exdir($object->id, 2, 0, 0, $object, $modulepart).$objectref; // the objectref dir is not include into get_exdir when used with level=2, so we add it here
|
||||
|
||||
@ -127,15 +127,18 @@ function rebuildObjectClass($destdir, $module, $objectname, $newmask, $readdir='
|
||||
{
|
||||
$i++;
|
||||
$texttoinsert.= "\t\t'".$key."' => array('type'=>'".$val['type']."', 'label'=>'".$val['label']."',";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'enabled'=>".($val['enabled']!=''?$val['enabled']:1).",";
|
||||
$texttoinsert.= " 'visible'=>".($val['visible']!=''?$val['visible']:-1).",";
|
||||
$texttoinsert.= " 'position'=>".($val['position']!=''?$val['position']:50).",";
|
||||
$texttoinsert.= " 'notnull'=>".($val['notnull']!=''?$val['notnull']:-1).",";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\","; // addslashes is escape for PHP
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\","; // addslashes is escape for PHP
|
||||
if ($val['default']) $texttoinsert.= " 'default'=>'".$val['default']."',";
|
||||
if ($val['index']) $texttoinsert.= " 'index'=>".$val['index'].",";
|
||||
if ($val['searchall']) $texttoinsert.= " 'searchall'=>".$val['searchall'].",";
|
||||
if ($val['isameasure']) $texttoinsert.= " 'isameasure'=>'".$val['isameasure']."',";
|
||||
if ($val['foreignkey']) $texttoinsert.= " 'foreignkey'=>'".$val['foreignkey']."',";
|
||||
if ($val['help']) $texttoinsert.= " 'help'=>\"".preg_replace('/"/', '', $val['help'])."\",";
|
||||
if ($val['comment']) $texttoinsert.= " 'comment'=>\"".preg_replace('/"/', '', $val['comment'])."\",";
|
||||
if ($val['showoncombobox']) $texttoinsert.= " 'showoncombobox'=>'".$val['showoncombobox']."',";
|
||||
if ($val['arrayofkeyval'])
|
||||
{
|
||||
$texttoinsert.= " 'arrayofkeyval'=>array(";
|
||||
@ -301,11 +304,20 @@ function rebuildObjectSql($destdir, $module, $objectname, $newmask, $readdir='',
|
||||
foreach($object->fields as $key => $val)
|
||||
{
|
||||
$i++;
|
||||
if ($val['index'])
|
||||
if (! empty($val['index']))
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD INDEX idx_".strtolower($module).'_'.strtolower($objectname)."_".$key." (".$key.");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
if (! empty($val['foreignkey']))
|
||||
{
|
||||
$tmp=explode('.',$val['foreignkey']);
|
||||
if (! empty($tmp[0]) && ! empty($tmp[1]))
|
||||
{
|
||||
$texttoinsert.= "ALTER TABLE llx_".strtolower($module).'_'.strtolower($objectname)." ADD CONSTRAINT llx_".strtolower($module).'_'.strtolower($objectname)."_".$key." FOREIGN KEY (".$key.") REFERENCES ".$tmp[0]."(".$tmp[1].");";
|
||||
$texttoinsert.= "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$texttoinsert.= '-- END MODULEBUILDER INDEXES';
|
||||
|
||||
@ -591,6 +591,7 @@ class ImportCsv extends ModeleImports
|
||||
|
||||
if (!empty($updatekeys)) {
|
||||
// We do SELECT to get the rowid, if we already have the rowid, it's to be used below for related tables (extrafields)
|
||||
|
||||
if (empty($lastinsertid)) {
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
@ -626,6 +627,34 @@ class ImportCsv extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
@ -651,6 +651,34 @@ class ImportXlsx extends ModeleImports
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
} else {
|
||||
// We have a last INSERT ID. Check if we have a row referencing this foreign key.
|
||||
// This is required when updating table with some extrafields. When inserting a record in parent table, we can make
|
||||
// a direct insert into subtable extrafields, but when me wake an update, the insertid is defined and the child record
|
||||
// may already exists. So we rescan the extrafield table to be know if record exists or not for the rowid.
|
||||
$sqlSelect = 'SELECT rowid FROM '.$tablename;
|
||||
|
||||
if(empty($keyfield)) $keyfield = 'rowid';
|
||||
$sqlSelect .= ' WHERE '.$keyfield.' = '.$lastinsertid;
|
||||
|
||||
$resql=$this->db->query($sqlSelect);
|
||||
if($resql) {
|
||||
$res = $this->db->fetch_object($resql);
|
||||
if($resql->num_rows == 1) {
|
||||
// We have a row referencing this last foreign key, continue with UPDATE.
|
||||
} else {
|
||||
// No record found referencing this last foreign key,
|
||||
// force $lastinsertid to 0 so we INSERT below.
|
||||
$lastinsertid = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//print 'E';
|
||||
$this->errors[$error]['lib']=$this->db->lasterror();
|
||||
$this->errors[$error]['type']='SQL';
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($lastinsertid)) {
|
||||
|
||||
@ -138,14 +138,15 @@ if (empty($outputalsopricetotalwithtax)) $outputalsopricetotalwithtax=0;
|
||||
|
||||
// Show date range
|
||||
if ($line->element == 'facturedetrec') {
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><br><div class="nowraponall">';
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '<br><div class="clearboth nowraponall">';
|
||||
if ($line->date_start_fill) echo $langs->trans('AutoFillDateFromShort').': '.yn($line->date_start_fill);
|
||||
if ($line->date_start_fill && $line->date_end_fill) echo ' - ';
|
||||
if ($line->date_end_fill) echo $langs->trans('AutoFillDateToShort').': '.yn($line->date_end_fill);
|
||||
if ($line->date_start_fill || $line->date_end_fill) echo '</div>';
|
||||
}
|
||||
else {
|
||||
echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
echo '<br><div class="clearboth nowraponall">'.get_date_range($line->date_start, $line->date_end, $format).'</div>';
|
||||
//echo get_date_range($line->date_start, $line->date_end, $format);
|
||||
}
|
||||
|
||||
// Add description in form
|
||||
|
||||
@ -56,10 +56,10 @@ class InterfaceMailmanSpipsynchro extends DolibarrTriggers
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
// We add subscription if we change category (new category may means more mailing-list to subscribe)
|
||||
if (is_object($object->linkto) && method_exists($object->linkto, 'add_to_abo') && $object->linkto->add_to_abo() < 0)
|
||||
if (is_object($object->context['linkto']) && method_exists($object->context['linkto'], 'add_to_abo') && $object->context['linkto']->add_to_abo() < 0)
|
||||
{
|
||||
$this->error=$object->linkto->error;
|
||||
$this->errors=$object->linkto->errors;
|
||||
$this->error=$object->context['linkto']->error;
|
||||
$this->errors=$object->context['linkto']->errors;
|
||||
$return=-1;
|
||||
}
|
||||
else
|
||||
|
||||
@ -517,7 +517,7 @@ if ($num > 0)
|
||||
print '<td align="right" class="nowraponall">';
|
||||
if ($user->rights->cron->create)
|
||||
{
|
||||
print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].($param?'?'.$param:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."</a> ";
|
||||
print "<a href=\"".DOL_URL_ROOT."/cron/card.php?id=".$obj->rowid."&action=edit".($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'').$param."&backtourl=".urlencode($_SERVER["PHP_SELF"].'?'.$param.($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:''))."\" title=\"".dol_escape_htmltag($langs->trans('Edit'))."\">".img_picto($langs->trans('Edit'),'edit')."</a> ";
|
||||
}
|
||||
if ($user->rights->cron->delete)
|
||||
{
|
||||
|
||||
@ -736,7 +736,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
// List of lines already dispatched
|
||||
$sql = "SELECT p.ref, p.label,";
|
||||
$sql .= " e.rowid as warehouse_id, e.ref as entrepot,";
|
||||
$sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
|
||||
$sql .= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status, cfd.datec";
|
||||
$sql .= " FROM " . MAIN_DB_PREFIX . "product as p,";
|
||||
$sql .= " " . MAIN_DB_PREFIX . "commande_fournisseur_dispatch as cfd";
|
||||
$sql .= " LEFT JOIN " . MAIN_DB_PREFIX . "entrepot as e ON cfd.fk_entrepot = e.rowid";
|
||||
@ -770,6 +770,7 @@ if ($id > 0 || ! empty($ref)) {
|
||||
print '<td>' . $langs->trans("Comment") . '</td>';
|
||||
if (! empty($conf->global->SUPPLIER_ORDER_USE_DISPATCH_STATUS))
|
||||
print '<td align="center" colspan="2">' . $langs->trans("Status") . '</td>';
|
||||
print '<td>' . $langs->trans("Date") . '</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
$var = false;
|
||||
@ -841,7 +842,9 @@ if ($id > 0 || ! empty($ref)) {
|
||||
}
|
||||
print '</td>';
|
||||
}
|
||||
|
||||
// date
|
||||
print '<td>' . dol_print_date($objp->datec) . '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
|
||||
$i ++;
|
||||
|
||||
@ -1729,6 +1729,7 @@ MailToSendContract=To send a contract
|
||||
MailToThirdparty=To send email from third party page
|
||||
MailToMember=To send email from member page
|
||||
MailToUser=To send email from user page
|
||||
MailToProject= To send email from project page
|
||||
ByDefaultInList=Show by default on list view
|
||||
YouUseLastStableVersion=You use the latest stable version
|
||||
TitleExampleForMajorRelease=Example of message you can use to announce this major release (feel free to use it on your web sites)
|
||||
|
||||
@ -226,3 +226,4 @@ AllowCommentOnProject=Allow user comments on projects
|
||||
DontHavePermissionForCloseProject=You do not have permissions to close the project %s
|
||||
DontHaveTheValidateStatus=The project %s must be open to be closed
|
||||
RecordsClosed=%s project(s) closed
|
||||
SendProjectRef=About project %s
|
||||
|
||||
@ -60,6 +60,7 @@ class MyObject extends CommonObject
|
||||
* 'enabled' is a condition when the field must be managed.
|
||||
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only. Using a negative value means field is not shown by default on list but can be selected for viewing)
|
||||
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'index' if we want an index in database.
|
||||
* 'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
|
||||
* 'position' is the sort order of field.
|
||||
@ -67,8 +68,8 @@ class MyObject extends CommonObject
|
||||
* 'isameasure' must be set to 1 if you want to have a total on list for this field. Field type must be summable like integer or double(24,8).
|
||||
* 'help' is a string visible as a tooltip on field
|
||||
* 'comment' is not used. You can store here any text of your choice. It is not used by application.
|
||||
* 'default' is a default value for creation (can still be replaced by the global setup of default values)
|
||||
* 'showoncombobox' if field must be shown into the label of combobox
|
||||
* 'showoncombobox' if value of the field must be visible into the label of the combobox that list record
|
||||
* 'arraykeyval' to set list of value if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel")
|
||||
*/
|
||||
|
||||
// BEGIN MODULEBUILDER PROPERTIES
|
||||
@ -79,16 +80,16 @@ class MyObject extends CommonObject
|
||||
'rowid' =>array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'index'=>1, 'position'=>1, 'comment'=>'Id'),
|
||||
'ref' =>array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>1, 'visible'=>1, 'notnull'=>1, 'showoncombobox'=>1, 'index'=>1, 'position'=>10, 'searchall'=>1, 'comment'=>'Reference of object'),
|
||||
'entity' =>array('type'=>'integer', 'label'=>'Entity', 'enabled'=>1, 'visible'=>0, 'default'=>1, 'notnull'=>1, 'index'=>1, 'position'=>20),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text'),
|
||||
'label' =>array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>30, 'searchall'=>1, 'css'=>'minwidth200', 'help'=>'Help text', 'showoncombobox'=>1),
|
||||
'amount' =>array('type'=>'double(24,8)', 'label'=>'Amount', 'enabled'=>1, 'visible'=>1, 'default'=>'null', 'position'=>40, 'searchall'=>0, 'isameasure'=>1, 'help'=>'Help text'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'searchall'=>0, 'help'=>'LinkToThirparty'),
|
||||
'fk_soc' =>array('type'=>'integer:Societe:societe/class/societe.class.php', 'label'=>'ThirdParty', 'visible'=>1, 'enabled'=>1, 'position'=>50, 'notnull'=>-1, 'index'=>1, 'help'=>'LinkToThirparty'),
|
||||
'description' =>array('type'=>'text', 'label'=>'Descrption', 'enabled'=>1, 'visible'=>0, 'position'=>60),
|
||||
'note_public' =>array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>1, 'visible'=>0, 'position'=>61),
|
||||
'note_private' =>array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>1, 'visible'=>0, 'position'=>62),
|
||||
'date_creation' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>500),
|
||||
'tms' =>array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>501),
|
||||
//'date_valid' =>array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>1, 'visible'=>-2, 'position'=>502),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510),
|
||||
'fk_user_creat' =>array('type'=>'integer', 'label'=>'UserAuthor', 'enabled'=>1, 'visible'=>-2, 'notnull'=>1, 'position'=>510, 'foreignkey'=>'llx_user.rowid'),
|
||||
'fk_user_modif' =>array('type'=>'integer', 'label'=>'UserModif', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'position'=>511),
|
||||
//'fk_user_valid' =>array('type'=>'integer', 'label'=>'UserValidation', 'enabled'=>1, 'visible'=>-1, 'position'=>512),
|
||||
'import_key' =>array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>1, 'visible'=>-2, 'notnull'=>-1, 'index'=>0, 'position'=>1000),
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
ALTER TABLE llx_mymodule_myobject ADD INDEX idx_fieldobject (fieldobject);
|
||||
-- END MODULEBUILDER INDEXES
|
||||
|
||||
--ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxyz(fieldx, fieldy);
|
||||
--ALTER TABLE llx_mymodule_myobject ADD UNIQUE INDEX uk_mymodule_myobject_fieldxy(fieldx, fieldy);
|
||||
|
||||
--ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_field_id FOREIGN KEY (fk_field) REFERENCES llx_myotherobject(rowid);
|
||||
--ALTER TABLE llx_mymodule_myobject ADD CONSTRAINT llx_mymodule_myobject_fk_field FOREIGN KEY (fk_field) REFERENCES llx_mymodule_myotherobject(rowid);
|
||||
|
||||
|
||||
@ -446,6 +446,13 @@ if (empty($reshook))
|
||||
$comefromclone=true;
|
||||
}
|
||||
}
|
||||
|
||||
// Actions to send emails
|
||||
$trigger_name='PROJECT_SENTBYMAIL';
|
||||
$paramname='id';
|
||||
$autocopy='MAIN_MAIL_AUTOCOPY_ORDER_TO'; // used to know the automatic BCC to add
|
||||
$trackid='proj'.$object->id;
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
|
||||
}
|
||||
|
||||
|
||||
@ -1064,7 +1071,7 @@ elseif ($object->id > 0)
|
||||
// modified by hook
|
||||
if (empty($reshook))
|
||||
{
|
||||
if ($action != "edit" )
|
||||
if ($action != "edit" && $action != 'presend' )
|
||||
{
|
||||
|
||||
// Create event
|
||||
@ -1075,6 +1082,12 @@ elseif ($object->id > 0)
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create&origin=' . $object->element . '&originid=' . $object->id . '&socid=' . $object->socid . '&projectid=' . $object->id . '">' . $langs->trans("AddAction") . '</a></div>';
|
||||
}*/
|
||||
|
||||
// Send
|
||||
if ($object->statut != 2)
|
||||
{
|
||||
print '<div class="inline-block divButAction"><a class="butAction" href="card.php?id='.$object->id.'&action=presend&mode=init#formmailbeforetitle">' . $langs->trans('SendMail').'</a></div>';
|
||||
}
|
||||
|
||||
// Modify
|
||||
if ($object->statut != 2 && $user->rights->projet->creer)
|
||||
{
|
||||
@ -1212,6 +1225,10 @@ elseif ($object->id > 0)
|
||||
|
||||
print "</div>";
|
||||
|
||||
if (GETPOST('modelselected')) {
|
||||
$action = 'presend';
|
||||
}
|
||||
|
||||
if ($action != 'presend')
|
||||
{
|
||||
print '<div class="fichecenter"><div class="fichehalfleft">';
|
||||
@ -1244,6 +1261,14 @@ elseif ($object->id > 0)
|
||||
print '</div></div></div>';
|
||||
}
|
||||
|
||||
// Presend form
|
||||
$modelmail='project';
|
||||
$defaulttopic='SendProjectRef';
|
||||
$diroutput = $conf->projet->dir_output;
|
||||
$trackid = 'proj'.$object->id;
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
|
||||
|
||||
// Hook to add more things on page
|
||||
$parameters=array();
|
||||
$reshook=$hookmanager->executeHooks('mainCardTabAddMore',$parameters,$object,$action); // Note that $action and $object may have been modified by hook
|
||||
|
||||
Loading…
Reference in New Issue
Block a user