Ejemplo n.º 1
0
 public static function add_tracing_notes($dest_rset, $dest_id, $dest_label, $linkto_rset, $linkto_id, $linkto_label)
 {
     $after = __('Follow-up after') . ': ';
     $follow = __('Follow-up') . ': ';
     switch ($dest_rset) {
         case 'phonecall':
             $fwd_note_path = 'phonecall/' . $dest_id;
             $bck_note = $after . '[phone=' . $dest_id . ']' . $dest_label . '[/phone]';
             break;
         case 'meeting':
             $fwd_note_path = 'crm_meeting/' . $dest_id;
             $bck_note = $after . '[meeting=' . $dest_id . ']' . $dest_label . '[/meeting]';
             break;
         case 'task':
             $fwd_note_path = 'task/' . $dest_id;
             $bck_note = $after . '[task=' . $dest_id . ']' . $dest_label . '[/task]';
             break;
     }
     switch ($linkto_rset) {
         case 'phonecall':
             $bck_note_path = 'phonecall/' . $linkto_id;
             $fwd_note = $follow . '[phone=' . $linkto_id . ']' . $linkto_label . '[/phone]';
             break;
         case 'meeting':
             $bck_note_path = 'crm_meeting/' . $linkto_id;
             $fwd_note = $follow . '[meeting=' . $linkto_id . ']' . $linkto_label . '[/meeting]';
             break;
         case 'task':
             $bck_note_path = 'task/' . $linkto_id;
             $fwd_note = $follow . '[task=' . $linkto_id . ']' . $linkto_label . '[/task]';
             break;
     }
     Utils_AttachmentCommon::add($fwd_note_path, 0, Acl::get_user(), $fwd_note);
     Utils_AttachmentCommon::add($bck_note_path, 0, Acl::get_user(), $bck_note);
 }
Ejemplo n.º 2
0
 public static function display_status($record, $nolink, $desc)
 {
     $prefix = 'crm_tasks_leightbox';
     $v = $record[$desc['id']];
     if (!$v) {
         $v = 0;
     }
     $status = Utils_CommonDataCommon::get_translated_array('CRM/Status');
     if ($v >= 3 || $nolink) {
         return $status[$v];
     }
     CRM_FollowupCommon::drawLeightbox($prefix);
     if (!Utils_RecordBrowserCommon::get_access('task', 'edit', $record) && !Base_AclCommon::i_am_admin()) {
         return $status[$v];
     }
     if (isset($_REQUEST['form_name']) && $_REQUEST['form_name'] == $prefix . '_follow_up_form' && $_REQUEST['id'] == $record['id']) {
         unset($_REQUEST['form_name']);
         $v = $_REQUEST['closecancel'];
         $action = $_REQUEST['action'];
         $note = $_REQUEST['note'];
         if ($note) {
             if (get_magic_quotes_gpc()) {
                 $note = stripslashes($note);
             }
             $note = str_replace("\n", '<br />', $note);
             Utils_AttachmentCommon::add('task/' . $record['id'], 0, Acl::get_user(), $note);
         }
         if ($action == 'set_in_progress') {
             $v = 1;
         }
         Utils_RecordBrowserCommon::update_record('task', $record['id'], array('status' => $v));
         if ($action == 'set_in_progress') {
             location(array());
         }
         $values = $record;
         $values['date_and_time'] = date('Y-m-d H:i:s');
         $values['title'] = __('Follow-up') . ': ' . $values['title'];
         $values['status'] = 0;
         if ($action != 'none') {
             $x = ModuleManager::get_instance('/Base_Box|0');
             $values['follow_up'] = array('task', $record['id'], $record['title']);
             if ($action == 'new_task') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, $values), array('task'));
             }
             if ($action == 'new_meeting') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('title' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date' => date('Y-m-d'), 'time' => date('H:i:s'), 'duration' => 3600, 'status' => 0, 'employees' => $values['employees'], 'customers' => $values['customers'], 'follow_up' => $values['follow_up'])), array('crm_meeting'));
             }
             if ($action == 'new_phonecall') {
                 $x->push_main('Utils/RecordBrowser', 'view_entry', array('add', null, array('subject' => $values['title'], 'permission' => $values['permission'], 'priority' => $values['priority'], 'description' => $values['description'], 'date_and_time' => date('Y-m-d H:i:s'), 'employees' => $values['employees'], 'status' => 0, 'customer' => !empty($values['customers']) ? array_pop($values['customers']) : '', 'follow_up' => $values['follow_up'])), array('phonecall'));
             }
             return false;
         }
         location(array());
     }
     if ($v == 0) {
         return '<a href="javascript:void(0)" onclick="' . $prefix . '_set_action(\'set_in_progress\');' . $prefix . '_set_id(\'' . $record['id'] . '\');' . $prefix . '_submit_form();">' . $status[$v] . '</a>';
     }
     return '<a href="javascript:void(0)" class="lbOn" rel="' . $prefix . '_followups_leightbox" onMouseDown="' . $prefix . '_set_id(' . $record['id'] . ');">' . $status[$v] . '</a>';
 }
Ejemplo n.º 3
0
	public static function copy_notes($from_group, $to_group) {
		$notes = self::get_files($from_group);
		$mapping = array();
		foreach ($notes as $n) {
			$file = self::Instance()->get_data_dir().$n['note_id'].'/'.$n['file_id'];
			if(file_exists($file)) {
				$file2 = $file.'_tmp';
				copy($file,$file2);
			} else {
				$file2 = null;
			}
			$mapping[$n['note_id']] = @Utils_AttachmentCommon::add($to_group,$n['permission'],Acl::get_user(),$n['text'],$n['original'],$file2);
		}
		return $mapping;
	}
Ejemplo n.º 4
0
 public static function copy_notes($from_group, $to_group)
 {
     $notes = self::get_files($from_group);
     $mapping = array();
     foreach ($notes as $n) {
         $meta = Utils_FileStorageCommon::meta($n['filestorage_id']);
         $mapping[$n['note_id']] = @Utils_AttachmentCommon::add($to_group, $n['permission'], Acl::get_user(), $n['text'], $n['original'], $meta['file']);
     }
     return $mapping;
 }